LCOV - code coverage report
Current view: top level - ifmap - ifmap_agent_parser.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 11 19 57.9 %
Date: 2026-06-22 02:21:21 Functions: 2 10 20.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 __DB_IFMAP_AGENT_PARSER_H__
       6             : #define __DB_IFMAP_AGENT_PARSER_H__
       7             : 
       8             : #include <list>
       9             : #include <map>
      10             : #include <boost/function.hpp>
      11             : #include "db/db.h"
      12             : #include "ifmap/ifmap_object.h"
      13             : #include "ifmap/ifmap_table.h"
      14             : 
      15             : namespace pugi {
      16             : class xml_document;
      17             : class xml_node;
      18             : }  // namespace pugi
      19             : 
      20             : class IFMapAgentParser {
      21             : public:
      22             : 
      23             :     enum ConfigMsgType {
      24             :         UPDATE,
      25             :         DEL,
      26             :         MAX
      27             :     };
      28             : 
      29          15 :     IFMapAgentParser(DB *db) : db_(db) { reset_statistics(); } ;
      30             : 
      31             :     typedef boost::function< IFMapObject *(const pugi::xml_node, DB *,
      32             :                                                std::string *id_name) > NodeParseFn;
      33             :     typedef std::map<std::string, NodeParseFn> NodeParseMap;
      34             :     void NodeRegister(const std::string &node, NodeParseFn parser);
      35             :     void NodeClear();
      36             :     void ConfigParse(const pugi::xml_node config, uint64_t seq);
      37           0 :     uint64_t node_updates() { return nodes_processed_[UPDATE]; }
      38           0 :     uint64_t node_deletes() { return nodes_processed_[DEL]; }
      39           0 :     uint64_t link_updates() { return links_processed_[UPDATE]; }
      40           0 :     uint64_t link_deletes() { return links_processed_[DEL]; }
      41           0 :     uint64_t node_update_parse_errors() { return node_parse_errors_[UPDATE]; }
      42           0 :     uint64_t node_delete_parse_errors() { return node_parse_errors_[DEL]; }
      43           0 :     uint64_t link_update_parse_errors() { return link_parse_errors_[UPDATE]; }
      44           0 :     uint64_t link_delete_parse_errors() { return link_parse_errors_[DEL]; }
      45          15 :     void reset_statistics() {
      46          15 :         nodes_processed_[UPDATE] = 0;
      47          15 :         nodes_processed_[DEL] = 0;
      48          15 :         links_processed_[UPDATE] = 0;
      49          15 :         links_processed_[DEL] = 0;
      50          15 :         node_parse_errors_[UPDATE] = 0;
      51          15 :         node_parse_errors_[DEL] = 0;
      52          15 :         link_parse_errors_[UPDATE] = 0;
      53          15 :         link_parse_errors_[DEL] = 0;
      54          15 :     }
      55             : private:
      56             :     DB *db_;
      57             :     NodeParseMap node_map_;
      58             :     uint64_t nodes_processed_[MAX];
      59             :     uint64_t links_processed_[MAX];
      60             :     uint64_t node_parse_errors_[MAX];
      61             :     uint64_t link_parse_errors_[MAX];
      62             :     void NodeParse(pugi::xml_node &node, DBRequest::DBOperation oper, uint64_t seq);
      63             :     void LinkParse(pugi::xml_node &node, DBRequest::DBOperation oper, uint64_t seq);
      64             : };
      65             : 
      66             : #endif

Generated by: LCOV version 1.14