Eris  1.3.23
TypeInfo.h
1 #ifndef ERIS_TYPE_INFO_H
2 #define ERIS_TYPE_INFO_H
3 
4 #include <Eris/Types.h>
5 #include <Eris/TypeService.h>
6 
7 #include <sigc++/trackable.h>
8 
9 #include <map>
10 #include <string>
11 
12 namespace Atlas {
13  namespace Message {
14  class Element;
15  typedef std::map<std::string, Element> MapType;
16  }
17 }
18 
19 namespace Eris {
20 
37 class TypeInfo : virtual public sigc::trackable
38 {
39 public:
43  bool isA(TypeInfoPtr ti);
44 
48  inline bool isBound() const;
49 
53  bool hasUnresolvedChildren() const;
54 
59  void resolveChildren();
60 
61 // operators
63  bool operator==(const TypeInfo &x) const;
64 
66  bool operator<(const TypeInfo &x) const;
67 
68 // accessors
70  const std::string& getName() const;
71 
76  const TypeInfoSet & getChildren() const;
77 
82  const TypeInfoSet & getParents() const;
83 
89  const Atlas::Message::MapType& getAttributes() const;
90 
98  const Atlas::Message::Element* getAttribute(const std::string& attributeName) const;
99 
104  sigc::signal<void, const std::string&, const Atlas::Message::Element&> AttributeChanges;
105 
106 
112  void setAttribute(const std::string& attributeName, const Atlas::Message::Element& element);
113 
114 
115 protected:
116  friend class TypeService;
117  friend class TypeBoundRedispatch;
118 
120  TypeInfo(const std::string &id, TypeService*);
121 
123  TypeInfo(const Atlas::Objects::Root &atype, TypeService*);
124 
125  void validateBind();
126 
128  void processTypeData(const Atlas::Objects::Root& atype);
129 
133  sigc::signal<void> Bound;
134 
135 
142  void onAttributeChanges(const std::string& attributeName, const Atlas::Message::Element& element);
143 
144 private:
145  void addParent(TypeInfoPtr tp);
146  void addChild(TypeInfoPtr tp);
147 
149  void addAncestor(TypeInfoPtr tp);
150 
156  void extractDefaultAttributes(const Atlas::Objects::Root& atype);
157 
159  TypeInfoSet m_parents;
161  TypeInfoSet m_children;
162 
164  TypeInfoSet m_ancestors;
165 
166  bool m_bound;
167  const std::string m_name;
168  int m_atlasClassNo;
169 
170  StringSet m_unresolvedChildren;
171 
176  unsigned int m_moveCount;
177 
178  TypeService* m_typeService;
179 
183  Atlas::Message::MapType m_attributes;
184 };
185 
186 inline const Atlas::Message::MapType& TypeInfo::getAttributes() const
187 {
188  return m_attributes;
189 }
190 
191 inline bool TypeInfo::isBound() const
192 {
193  return m_bound;
194 }
195 
196 inline const std::string& TypeInfo::getName() const
197 {
198  return m_name;
199 }
200 
201 inline const TypeInfoSet & TypeInfo::getChildren() const
202 {
203  return m_children;
204 }
205 
206 inline const TypeInfoSet & TypeInfo::getParents() const
207 {
208  return m_parents;
209 }
210 
211 
212 } // of Eris namespace
213 
214 #endif
sigc::signal< void > Bound
Emitted when the type is bound, i.e there is an unbroken graph of TypeInfo instances through every an...
Definition: TypeInfo.h:133
The representation of an Atlas type (i.e a class or operation definition).
Definition: TypeInfo.h:37
Definition: TypeBoundRedispatch.h:13
Definition: Account.cpp:33
A service class querying and caching types.
Definition: TypeService.h:24
sigc::signal< void, const std::string &, const Atlas::Message::Element & > AttributeChanges
Emitted before an attribute changes.
Definition: TypeInfo.h:104
Definition: BaseConnection.h:15