DDS  ver. 2.0
TopoBase.h
Go to the documentation of this file.
1 // Copyright 2014 GSI, Inc. All rights reserved.
2 //
3 //
4 //
5 
6 #ifndef __DDS__TopoBase__
7 #define __DDS__TopoBase__
8 
9 // DDS
10 #include "TopoIndex.h"
11 // STD
12 #include <sstream>
13 #include <string>
14 #include <vector>
15 // BOOST
16 #include <boost/property_tree/ptree.hpp>
17 
18 namespace dds
19 {
20  namespace topology_api
21  {
22  enum class ETopoType
23  {
24  TOPO_BASE,
27  TASK,
28  COLLECTION,
29  GROUP,
31  TOPO_VARS,
32  TRIGGER
33  };
34 
35  class CTopoBase
36  {
37  public:
39  void setId(const std::string& _id);
40  void setParent(CTopoBase* _parent);
41 
43  std::string getId() const;
44  ETopoType getType() const;
45  CTopoBase* getParent() const;
46 
48  std::string getPath() const;
49 
51  CTopoIndex getIndex() const;
52 
56  virtual void initFromPropertyTree(const std::string& _name, const boost::property_tree::ptree& _pt) = 0;
57 
65  static const boost::property_tree::ptree& findElement(ETopoType _type,
66  const std::string& _name,
67  const boost::property_tree::ptree& _pt);
68 
71  virtual std::string toString() const;
72 
76  friend std::ostream& operator<<(std::ostream& _strm, const CTopoBase& _element);
77 
78  protected:
80  CTopoBase();
81 
83  virtual ~CTopoBase();
84 
85  void setType(ETopoType _type);
86 
87  private:
88  std::string m_id;
89  ETopoType m_type;
90  CTopoBase* m_parent;
91 
92  // FIXME: Probably we have to add an ID which will uniquely identifies the object.
93  };
94 
95  typedef std::shared_ptr<CTopoBase> TopoBasePtr_t;
96  typedef std::vector<TopoBasePtr_t> TopoBasePtrVector_t;
97  }
98 }
99 #endif /* defined(__DDS__TopoBase__) */
Definition: TopoIndex.h:16
Definition: TopoBase.h:35
ETopoType
Definition: TopoBase.h:22
std::vector< TopoBasePtr_t > TopoBasePtrVector_t
Definition: TopoBase.h:96
Definition: dds-agent/src/AgentConnectionManager.h:18
std::shared_ptr< CTopoBase > TopoBasePtr_t
Definition: TopoBase.h:95
std::ostream & operator<<(std::ostream &_out, EAgentCmdType &_agentCmd)
Definition: dds-agent-cmd/src/Options.h:45