OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ifmap_encoder.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #ifndef __ctrlplane__ifmap_encoder__
6 #define __ctrlplane__ifmap_encoder__
7 
8 #include <pugixml/pugixml.hpp>
9 
10 class IFMapNode;
11 class IFMapLink;
12 class IFMapUpdate;
13 
14 class IFMapMessage {
15 public:
16  static const int kObjectsPerMessage = 16;
17  IFMapMessage();
18 
19  void Close();
20  // set the 'to' field in the message
21  void SetReceiverInMsg(const std::string &cli_identifier);
22  void SetObjectsPerMessage(int num);
23  void EncodeUpdate(const IFMapUpdate *update);
24  bool IsFull();
25  bool IsEmpty();
26  void Reset();
27 
28  const std::string &get_string() const { return str_; }
29 
30 private:
31  enum Op {
35  };
36  void Open();
37  void EncodeNode(const IFMapUpdate *update);
38  void EncodeLink(const IFMapUpdate *update);
39 
40  pugi::xml_document doc_;
41  pugi::xml_node config_;
42  Op op_type_; // the current type of op_node_
43  pugi::xml_node op_node_;
44  std::string str_;
47 };
48 
49 #endif /* defined(__ctrlplane__ifmap_encoder__) */
pugi::xml_document doc_
Definition: ifmap_encoder.h:40
pugi::xml_node config_
Definition: ifmap_encoder.h:41
void EncodeNode(const IFMapUpdate *update)
void SetObjectsPerMessage(int num)
const std::string & get_string() const
Definition: ifmap_encoder.h:28
void EncodeUpdate(const IFMapUpdate *update)
int objects_per_message_
Definition: ifmap_encoder.h:46
void EncodeLink(const IFMapUpdate *update)
pugi::xml_node op_node_
Definition: ifmap_encoder.h:43
static const int kObjectsPerMessage
Definition: ifmap_encoder.h:16
std::string str_
Definition: ifmap_encoder.h:44
void SetReceiverInMsg(const std::string &cli_identifier)