LCOV - code coverage report
Current view: top level - ifmap - ifmap_node.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 6 6 100.0 %
Date: 2026-06-22 02:21:21 Functions: 4 4 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
       3             :  */
       4             : 
       5             : #ifndef __ctrlplane__ifmap_node__
       6             : #define __ctrlplane__ifmap_node__
       7             : 
       8             : #include <boost/crc.hpp>      // for boost::crc_32_type
       9             : #include <boost/intrusive/list.hpp>
      10             : 
      11             : #include "db/db_graph_vertex.h"
      12             : #include "ifmap/ifmap_object.h"
      13             : 
      14             : class IFMapNode : public DBGraphVertex {
      15             : public:
      16             :     typedef boost::crc_32_type::value_type crc32type;
      17             :     typedef boost::intrusive::member_hook<IFMapObject,
      18             :         boost::intrusive::list_member_hook<>,
      19             :         &IFMapObject::node_> MemberHook;
      20             : 
      21             :     typedef boost::intrusive::list<IFMapObject, MemberHook> ObjectList;
      22             :     typedef std::pair<std::string, std::string> Descriptor;
      23             : 
      24             :     explicit IFMapNode(IFMapTable *table);
      25             :     virtual ~IFMapNode();
      26             : 
      27             :     virtual std::string ToString() const;
      28             : 
      29     3720395 :     IFMapTable *table() { return table_; }
      30      417918 :     const IFMapTable *table() const { return table_; }
      31             : 
      32             :     virtual KeyPtr GetDBRequestKey() const;
      33             : 
      34             :     virtual void SetKey(const DBRequestKey *genkey);
      35             : 
      36     5496550 :     virtual bool IsLess(const DBEntry &db_entry) const {
      37     5496550 :         const IFMapNode &rhs = static_cast<const IFMapNode &>(db_entry);
      38     5496550 :         return name_ < rhs.name_;
      39             :     }
      40             : 
      41             :     void EncodeNodeDetail(pugi::xml_node *parent) const;
      42             :     void EncodeNode(pugi::xml_node *parent) const;
      43             :     static void EncodeNode(const Descriptor &descriptor,
      44             :                            pugi::xml_node *parent);
      45             : 
      46             :     static IFMapNode *DescriptorLookup(DB *db, const Descriptor &descriptor);
      47             : 
      48     1617879 :     const std::string &name() const { return name_; }
      49             : 
      50             :     IFMapObject *Find(IFMapOrigin origin);
      51             :     void Insert(IFMapObject *obj);
      52             :     void Remove(IFMapObject *obj);
      53             : 
      54             :     IFMapObject *GetObject();
      55             :     const IFMapObject *GetObject() const;
      56             :     crc32type GetConfigCrc();
      57             :     void PrintAllObjects();
      58             :     int get_object_list_size() { return list_.size(); }
      59             : 
      60             : private:
      61             :     friend class IFMapNodeCopier;
      62             :     IFMapTable *table_;
      63             :     std::string name_;
      64             :     ObjectList list_;
      65             :     DISALLOW_COPY_AND_ASSIGN(IFMapNode);
      66             : };
      67             : 
      68             : 
      69             : #endif /* defined(__ctrlplane__ifmap_node__) */

Generated by: LCOV version 1.14