eris
1.4.0
A WorldForge client library.
|
1 #ifndef ERIS_TYPE_INFO_H
2 #define ERIS_TYPE_INFO_H
5 #include <Atlas/Message/Element.h>
6 #include <Atlas/Objects/Root.h>
8 #include <sigc++/trackable.h>
9 #include <sigc++/signal.h>
32 class TypeInfo :
virtual public sigc::trackable
44 bool isA(
const std::string& typeName)
const;
76 const std::string&
getName()
const;
108 const Atlas::Message::Element*
getProperty(
const std::string& propertyName)
const;
114 sigc::signal<void, const std::string&, const Atlas::Message::Element&>
PropertyChanges;
121 void setProperty(
const std::string& propertyName,
const Atlas::Message::Element& element);
127 const Atlas::Message::ListType&
getEntities()
const;
163 void onPropertyChanges(
const std::string& propertyName,
const Atlas::Message::Element& element);
177 void extractDefaultProperties(
const Atlas::Objects::Root& atype);
182 std::set<TypeInfo*> m_children;
185 std::set<TypeInfo*> m_ancestors;
188 const std::string m_name;
189 std::string m_objType;
191 std::set<std::string> m_unresolvedChildren;
198 Atlas::Message::MapType m_properties;
203 Atlas::Message::ListType m_entities;
248 return m_typeService;
251 inline const TypeService& TypeInfo::getTypeService()
const
253 return m_typeService;
void setProperty(const std::string &propertyName, const Atlas::Message::Element &element)
Sets a property.
const Atlas::Message::ListType & getEntities() const
Gets a list of entities, if the type is an Archetype.
bool isBound() const
Check the bound flag for this node; if false then recursivley check parents until an authorative is f...
bool isA(TypeInfo *ti) const
Test whether this type inherits (directly or indirectly) from the specific class. If this type is not...
void resolveChildren()
Retrive all child types from the server. This will log an error and do nothing if no unresolved child...
const Atlas::Message::MapType & getProperties() const
Gets the default properties for this entity type. Note that the map returned does not include inherit...
const std::string & getName() const
the unique type name (matches the Atlas type)
const std::set< TypeInfo * > & getChildren() const
Gets the currently resolved child TypeInfo instances.
bool operator==(const TypeInfo &x) const
efficent comparisom of types (uses type ids if possible)
sigc::signal< void, const std::string &, const Atlas::Message::Element & > PropertyChanges
Emitted before an property changes. The first parameter is the name of the property,...
const std::string & getObjType() const
the object type of this Type or Archetype
const Atlas::Message::Element * getProperty(const std::string &propertyName) const
Gets the value of the named property. This method will search through both this instance and all of i...
bool hasUnresolvedChildren() const
Test if there are child types of the type, which have not yet been retrieved from the server.
void processTypeData(const Atlas::Objects::Root &atype)
process the INFO data
TypeInfo(std::string id, TypeService &)
forward constructor, when data is not available
The representation of an Atlas type (i.e a class or operation definition). This class supports effice...
bool operator<(const TypeInfo &x) const
efficent ordering of type (uses type ids if possible)
void refresh()
Request update to the type info from the server.
const TypeInfo * getParent() const
Gets the currently resolved parent TypeInfo instances.
sigc::signal< void > Bound
Emitted when the type is bound, i.e there is an unbroken graph of TypeInfo instances through every an...
void onPropertyChanges(const std::string &propertyName, const Atlas::Message::Element &element)
Called before the PropertyChanges signal is emitted. This call is made before an property is changed....
TypeInfo(const Atlas::Objects::Root &atype, TypeService &)
full constructor, if an INFO has been received