DDS  ver. 3.4
OctopusProtocol.h
Go to the documentation of this file.
1 // Copyright 2016 GSI, Inc. All rights reserved.
2 //
3 //
4 //
5 #ifndef DDS_OCTOPUS_PROTOCOL_H
6 #define DDS_OCTOPUS_PROTOCOL_H
7 
8 // DDS
9 #include "Intercom.h"
10 // BOOST
11 #include <boost/property_tree/ptree.hpp>
12 
13 namespace dds
14 {
15  namespace dds_octopus
16  {
17  template <class T>
19  {
20  void init(const boost::property_tree::ptree& _pt)
21  {
22  m_sVal = _pt.data();
23  }
24 
25  void get(boost::property_tree::ptree* _pt)
26  {
27  if (!_pt)
28  return;
29 
30  T* pThis = static_cast<T*>(this);
31  _pt->put(pThis->class_name(), m_sVal);
32  }
33 
34  std::string m_sVal;
35  };
36 
37  // Log command
38  // {
39  // "log": "text"
40  // }
41  struct SOctopusProtocol_Log : SOctopusProtocol_KeyValueImpl<SOctopusProtocol_Log>
42  {
43  static std::string class_name()
44  {
45  return "log";
46  }
47  };
48  // Get Ping command
49  // {
50  // "get_ping": "text"
51  // }
52  struct SOctopusProtocol_GetPing : SOctopusProtocol_KeyValueImpl<SOctopusProtocol_GetPing>
53  {
54  static std::string class_name()
55  {
56  return "get_ping";
57  }
58  };
59  // Return command
60  // {
61  // "ping": "text"
62  // }
63  struct SOctopusProtocol_Return : SOctopusProtocol_KeyValueImpl<SOctopusProtocol_Return>
64  {
65  static std::string class_name()
66  {
67  return "return";
68  }
69  };
70  // Return command
71  // {
72  // "big_cmd": "text"
73  // }
74  struct SOctopusProtocol_BigCmd : SOctopusProtocol_KeyValueImpl<SOctopusProtocol_BigCmd>
75  {
76  static std::string class_name()
77  {
78  return "big_cmd";
79  }
80  };
81  } // namespace dds_octopus
82 } // namespace dds
83 #endif
Definition: OctopusProtocol.h:63
static std::string class_name()
Definition: OctopusProtocol.h:76
Definition: OctopusProtocol.h:74
Definition: AgentConnectionManager.h:13
void get(boost::property_tree::ptree *_pt)
Definition: OctopusProtocol.h:25
void init(const boost::property_tree::ptree &_pt)
Definition: OctopusProtocol.h:20
static std::string class_name()
Definition: OctopusProtocol.h:54
Definition: OctopusProtocol.h:41
static std::string class_name()
Definition: OctopusProtocol.h:43
static std::string class_name()
Definition: OctopusProtocol.h:65
Definition: OctopusProtocol.h:52
std::string m_sVal
Definition: OctopusProtocol.h:34
Definition: OctopusProtocol.h:18