LCOV - code coverage report
Current view: top level - root/contrail/src/contrail-common/sandesh/compiler/parse - t_const.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 10 10 100.0 %
Date: 2026-11-09 02:10:49 Functions: 4 4 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Licensed to the Apache Software Foundation (ASF) under one
       3             :  * or more contributor license agreements. See the NOTICE file
       4             :  * distributed with this work for additional information
       5             :  * regarding copyright ownership. The ASF licenses this file
       6             :  * to you under the Apache License, Version 2.0 (the
       7             :  * "License"); you may not use this file except in compliance
       8             :  * with the License. You may obtain a copy of the License at
       9             :  *
      10             :  *   http://www.apache.org/licenses/LICENSE-2.0
      11             :  *
      12             :  * Unless required by applicable law or agreed to in writing,
      13             :  * software distributed under the License is distributed on an
      14             :  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
      15             :  * KIND, either express or implied. See the License for the
      16             :  * specific language governing permissions and limitations
      17             :  * under the License.
      18             :  *
      19             :  * Modifications Copyright (c) Juniper Networks, Inc.
      20             :  * Copyright Contributors to the OpenSDN project
      21             :  */
      22             : 
      23             : #ifndef T_CONST_H
      24             : #define T_CONST_H
      25             : 
      26             : #include "t_type.h"
      27             : #include "t_const_value.h"
      28             : 
      29             : /**
      30             :  * A const is a constant value defined across languages that has a type and
      31             :  * a value. The trick here is that the declared type might not match the type
      32             :  * of the value object, since that is not determined until after parsing the
      33             :  * whole thing out.
      34             :  *
      35             :  */
      36             : class t_const : public t_doc {
      37             :  public:
      38        8450 :   t_const(t_type* type, std::string name, t_const_value* value) :
      39        8450 :     type_(type),
      40        8450 :     name_(name),
      41       16900 :     value_(value) {}
      42             : 
      43       11499 :   t_type* get_type() const {
      44       11499 :     return type_;
      45             :   }
      46             : 
      47        7379 :   std::string get_name() const {
      48        7379 :     return name_;
      49             :   }
      50             : 
      51        9998 :   t_const_value* get_value() const {
      52        9998 :     return value_;
      53             :   }
      54             : 
      55             :  private:
      56             :   t_type* type_;
      57             :   std::string name_;
      58             :   t_const_value* value_;
      59             : };
      60             : 
      61             : #endif
      62             : 

Generated by: LCOV version 1.14