#include <embeddable.h>
Public Types |
|
Type definitions
|
|
typedef std::vector< Embeddable * > | EmbeddableVector |
Public Member Functions |
|
virtual void | dump (std::ostream &s=std::cout, Size depth=0) const |
Internal value dump. |
|
Constructors and Destructors
|
|
Embeddable (const String &identifier="<Embeddable>") | |
Default constructor. |
|
Embeddable (const Embeddable &embeddable) | |
Copy constructor. |
|
virtual | ~Embeddable () |
Accessors
|
|
void | setIdentifier (const String &identifier) |
Return the instance
identifier. |
|
const String & | getIdentifier () const |
Assign a new identifier. |
|
void | unregisterThis () |
Unregister the instance. |
|
virtual void | registerThis () |
Register the instance. |
|
Static Protected Member Functions |
|
static void | registerInstance_ (const std::type_info &type, const Embeddable *instance) |
static void | unregisterInstance_ (const Embeddable *instance) |
static Size | countInstances_ (const std::type_info &type) |
Return the number of instances of a
certain type. |
|
static Embeddable * | getInstance_ (const std::type_info &type, Position index) |
Return an instance of a registered
type by its index. |
|
static Embeddable * | getInstance_ (const std::type_info &type, const String &identifier) |
Return an instance of a registered
type by its identifier. |
This class defines a common interface for all classes that have to be accessible from an embedded Python interpreter. Each instance of a class derived from embeddable can be registered by calling registerThis() of the instance and is then accessible through the static methods of the class (e.g. getInstance).
MainControl
ModularWidget
virtual void BALL::Embeddable::dump | ( | std::ostream & | s =
std::cout , |
|
Size | depth =
0 |
|||
) | const [virtual] |
Internal value dump.
Dump the current state to the output ostream s with dumping depth depth.
s | output stream where to output the state | |
depth | the dumping depth |
Reimplemented in BALL::VIEW::MainControl, BALL::VIEW::ModularWidget, BALL::VIEW::ServerWidget, BALL::VIEW::PyWidget, and BALL::VIEW::Scene.
static Embeddable* BALL::Embeddable::getInstance_ | ( | const std::type_info & | type, | |
const String & | identifier | |||
) | [static, protected] |
Return an instance of a registered type by its identifier.
If the identifier does not exist, a null pointer is returned
static Embeddable* BALL::Embeddable::getInstance_ | ( | const std::type_info & | type, | |
Position | index | |||
) | [static, protected] |
Return an instance of a registered type by its index.
If the index is out of bounds or the position is invalid, a null pointer is returned
virtual void BALL::Embeddable::registerThis | ( | ) | [virtual] |
Register the instance.
DO NOT IMPLEMENT THIS METHOD! It is automatically implemented correctly when putting the BALL_EMBEDDABLE macro in a class definition.