5 #ifndef BALL_CONCEPT_EMBEDDABLE_H 6 #define BALL_CONCEPT_EMBEDDABLE_H 12 #ifndef BALL_DATATYPE_STRINGHASHMAP_H 16 #ifndef BALL_DATATYPE_HASHMAP_H 31 #define BALL_EMBEDDABLE(TYPE,BASE)\ 32 virtual void registerThis() \ 34 if (typeid(*this) != typeid(TYPE))\ 36 Log.error() << "Warning: derived class " << typeid(*this).name() << " was derived from BALL::Embeddable, but the macro\n"\ 37 << "BALL_EMBEDDABLE(...) was not specified in the class declaration!" << std::endl;\ 39 Embeddable::registerInstance_(typeid(TYPE), this);\ 40 Embeddable::registerInstance_(typeid(BASE), this);\ 43 static TYPE* getInstance(Position index) \ 45 Embeddable* ptr = Embeddable::getInstance_(typeid(TYPE), index);\ 48 return dynamic_cast<TYPE*>(ptr); \ 55 static TYPE* getInstance(const String& identifier) \ 57 Embeddable* ptr = Embeddable::getInstance_(typeid(TYPE), identifier);\ 60 return dynamic_cast<TYPE*>(ptr); \ 67 static Size countInstances() { return (Embeddable::countInstances_(typeid(TYPE))); }; 117 void setIdentifier(
const String& identifier)
122 const String& getIdentifier()
const 127 void unregisterThis()
136 virtual void registerThis()
147 virtual void dump(std::ostream& s = std::cout,
Size depth = 0)
const 153 static void registerInstance_(
const std::type_info& type,
const Embeddable* instance)
157 static void unregisterInstance_(
const Embeddable* instance)
162 static Size countInstances_(
const std::type_info& type)
175 static Embeddable* getInstance_(
const std::type_info& type,
const String& identifier)
196 #endif // BALL_CONCEPT_EMBEDDABLE_H
std::vector< Embeddable * > EmbeddableVector
-*- Mode: C++; tab-width: 2; -*-
HashMap class based on the STL map (containing serveral convenience functions)