OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ifmap_agent_parser.h
Go to the documentation of this file.
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 
21 public:
22 
25  DEL,
27  };
28 
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  uint64_t node_updates() { return nodes_processed_[UPDATE]; }
38  uint64_t node_deletes() { return nodes_processed_[DEL]; }
39  uint64_t link_updates() { return links_processed_[UPDATE]; }
40  uint64_t link_deletes() { return links_processed_[DEL]; }
47  nodes_processed_[DEL] = 0;
49  links_processed_[DEL] = 0;
54  }
55 private:
56  DB *db_;
58  uint64_t nodes_processed_[MAX];
59  uint64_t links_processed_[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
uint64_t nodes_processed_[MAX]
void LinkParse(pugi::xml_node &node, DBRequest::DBOperation oper, uint64_t seq)
uint64_t node_update_parse_errors()
uint64_t node_delete_parse_errors()
std::map< std::string, NodeParseFn > NodeParseMap
uint64_t link_parse_errors_[MAX]
void NodeRegister(const std::string &node, NodeParseFn parser)
Definition: db.h:24
uint64_t link_delete_parse_errors()
NodeParseMap node_map_
void ConfigParse(const pugi::xml_node config, uint64_t seq)
void NodeParse(pugi::xml_node &node, DBRequest::DBOperation oper, uint64_t seq)
uint64_t link_update_parse_errors()
uint64_t links_processed_[MAX]
uint64_t node_parse_errors_[MAX]
boost::function< IFMapObject *(const pugi::xml_node, DB *, std::string *id_name) > NodeParseFn