A class that stores all kind of objects. More...
#include <object_store.hpp>
Public Member Functions | |
object_store () | |
~object_store () | |
prototype_iterator | insert_prototype (object_base_producer *producer, const char *type, bool abstract=false, const char *parent="object") |
template<class T > | |
prototype_iterator | insert_prototype (const char *type, bool abstract=false) |
template<class T , class S > | |
prototype_iterator | insert_prototype (const char *type, bool abstract=false) |
bool | clear_prototype (const char *type, bool recursive) |
bool | remove_prototype (const char *type) |
prototype_iterator | find_prototype (const char *type) const |
Finds prototype node. More... | |
template<class T > | |
prototype_iterator | find_prototype () const |
Finds prototype node by template type. More... | |
prototype_iterator | begin () const |
prototype_iterator | end () const |
void | clear (bool full=false) |
bool | empty () const |
void | dump_prototypes (std::ostream &out) const |
void | dump_objects (std::ostream &out) const |
object * | create (const char *type) const |
template<class Y > | |
object_ptr< Y > | insert (Y *o) |
void | insert (object_container &oc) |
bool | is_removable (const object_base_ptr &o) const |
void | remove (object_base_ptr &o) |
void | remove (object_container &oc) |
void | register_observer (object_observer *observer) |
Register an observer with the object store. More... | |
void | unregister_observer (object_observer *observer) |
Unregisters an observer from the object store. More... | |
object_proxy * | create_proxy (long id) |
Creates and inserts an object proxy object. More... | |
bool | delete_proxy (long id) |
Delete proxy from map. More... | |
object_proxy * | find_proxy (long id) const |
Finds object proxy with id. More... | |
void | insert_proxy (prototype_node *node, object_proxy *oproxy) |
Inserts the proxy into a prototype list. More... | |
void | remove_proxy (prototype_node *node, object_proxy *oproxy) |
Removes an object proxy from a prototype list. More... | |
sequencer_impl_ptr | exchange_sequencer (const sequencer_impl_ptr &seq) |
Exchange the sequencer strategy. More... | |
Friends | |
class | object_creator |
class | object_deleter |
class | object_serializer |
class | restore_visitor |
class | object_container |
class | object |
Detailed Description
A class that stores all kind of objects.
This class is the main container class for all objects. To manage the internal list of objects the store must know the object class hierarchy.
Therefor an object prototype tree holds the object hierarchy representation including a producer class object of all known types.
Constructor & Destructor Documentation
oos::object_store::object_store | ( | ) |
Create an empty object store.
oos::object_store::~object_store | ( | ) |
Destroys all prototypes, objects and observers in store.
Member Function Documentation
prototype_iterator oos::object_store::begin | ( | ) | const |
Return the first prototype node.
- Returns
- The first prototype node iterator.
void oos::object_store::clear | ( | bool | full = false | ) |
Removes all inserted prototypes and all inserted objects.
bool oos::object_store::clear_prototype | ( | const char * | type, |
bool | recursive | ||
) |
Clears a prototype node. All objects will be deleted. If the recursive flag is set all objects from the children nodea will be deleted as well.
- Parameters
-
type The name of the type to remove. recursive If set, also the object in children nodes are deleted.
- Returns
- Returns true if the type was found and successfully cleared.
object* oos::object_store::create | ( | const char * | type | ) | const |
Creates an object of the given type name.
- Parameters
-
type Typename of the object to create.
- Returns
- The created object on success or NULL if the type couldn't be found.
object_proxy* oos::object_store::create_proxy | ( | long | id | ) |
Creates and inserts an object proxy object.
An object proxy object is created and inserted into the internal proxy hash map. The proxy won't be linked into the main object proxy list until it gets a valid object.
- Parameters
-
id Unique id of the object proxy.
- Returns
- An object proxy object.
bool oos::object_store::delete_proxy | ( | long | id | ) |
Delete proxy from map.
Deletes the proxy with the given id from map.
- Parameters
-
id Id of proxy to delete
- Returns
- Returns true if deletion was successfully
void oos::object_store::dump_objects | ( | std::ostream & | out | ) | const |
Dump all object to a given stream
- Parameters
-
out The stream to the objects dump on.
void oos::object_store::dump_prototypes | ( | std::ostream & | out | ) | const |
Dump all prototypes to a given stream
- Parameters
-
out The stream to the prototypes dump on.
bool oos::object_store::empty | ( | ) | const |
Returns true if the object_store conatins no elements (objects)
- Returns
- True on empty object_store.
prototype_iterator oos::object_store::end | ( | ) | const |
Return the last prototype node.
- Returns
- The last prototype node iterator.
sequencer_impl_ptr oos::object_store::exchange_sequencer | ( | const sequencer_impl_ptr & | seq | ) |
Exchange the sequencer strategy.
Exchange the sequencer strategy of this object_store. The current sequencer is replaced by the new one and the current sequence is synced with the new sequencer sequence. The old strategy is returned.
- Parameters
-
seq The new sequencer strategy object.
- Returns
- The old sequencer startegy implementation.
prototype_iterator oos::object_store::find_prototype | ( | const char * | type | ) | const |
Finds prototype node.
Finds and returns prototype node iterator identified by the given name or classname (typeid). If the prototype couldn't be found prototype_iterator end is returned.
- Parameters
-
type Name or class name of the prototype
- Returns
- Returns a prototype iterator.
|
inline |
Finds prototype node by template type.
- Template Parameters
-
Template type.
Finds and returns prototype node iterator identified by the given template typeid. If the prototype couldn't be found prototype_iterator end is returned.
- Returns
- Returns a prototype iterator.
object_proxy* oos::object_store::find_proxy | ( | long | id | ) | const |
Finds object proxy with id.
Try to find the object proxy with given id in object stores proxy map. If object can't be found NULL is returned.
- Parameters
-
id ID of object proxy to find
- Returns
- On success it returns an object proxy on failure null
|
inline |
Inserts an object of a specfic type. On successfull insertion an object_ptr element with the inserted object is returned.
- Parameters
-
o Object to be inserted.
- Returns
- Inserted object contained by an object_ptr on success.
void oos::object_store::insert | ( | object_container & | oc | ) |
Inserts an object_container into the object store. Subsequently the object_container is initialized.
- Parameters
-
oc The object_container to insert.
prototype_iterator oos::object_store::insert_prototype | ( | object_base_producer * | producer, |
const char * | type, | ||
bool | abstract = false , |
||
const char * | parent = "object" |
||
) |
Inserts a new object prototype into the prototype tree. The prototype constist of a producer and a unique type name. To know where the new prototype is inserted into the hierarchy the type name of the parent node is also given.
- Parameters
-
producer The producer object produces a new object of a specific type. type The unique name of the type. abstract Indicates if the producers object is treated as an abstract node. parent The name of the parent type.
- Returns
- Returns new inserted prototype iterator.
|
inline |
Inserts a new object prototype into the prototype tree. The prototype constist of a producer and a unique type name. To know where the new prototype is inserted into the hierarchy the type name of the parent node is also given. The producer is automatically created via the template parameter.
- Template Parameters
-
T The type of the prototype node
- Parameters
-
type The unique name of the type. abstract Indicates if the producers object is treated as an abstract node.
- Returns
- Returns new inserted prototype iterator.
|
inline |
Inserts a new object prototype into the prototype tree. The prototype constist of a producer and a unique type name. To know where the new prototype is inserted into the hierarchy the type name of the parent node is also given. The producer is automatically created via the template parameter.
- Template Parameters
-
T The type of the prototype node S The type of the parent prototype node
- Parameters
-
type The unique name of the type. abstract Indicates if the producers object is treated as an abstract node.
- Returns
- Returns new inserted prototype iterator.
void oos::object_store::insert_proxy | ( | prototype_node * | node, |
object_proxy * | oproxy | ||
) |
Inserts the proxy into a prototype list.
- Parameters
-
node Prototype into which the proxy will be inserted. oproxy Object proxy to insert
bool oos::object_store::is_removable | ( | const object_base_ptr & | o | ) | const |
Returns true if the underlaying object is removable.
- Parameters
-
o The object to check.
- Returns
- True if object is removable.
void oos::object_store::register_observer | ( | object_observer * | observer | ) |
Register an observer with the object store.
- Parameters
-
observer The object observer to register.
void oos::object_store::remove | ( | object_base_ptr & | o | ) |
Removes an object from the object store. After successfull removal the object is set to zero and isn't valid any more.
Before removal is done a reference and pointer counter check is done. If at least one counter is greater than zero the object can't be removed and false is returned.
- Exceptions
-
object_exception
- Parameters
-
o Object to remove.
void oos::object_store::remove | ( | object_container & | oc | ) |
Removes an object_container from object store. All elements of the container are removed from the store after a successfull reference and pointer counter check.
- Exceptions
-
object_exception
- Parameters
-
oc The object vector to remove.
bool oos::object_store::remove_prototype | ( | const char * | type | ) |
Removes an object prototype from the prototype tree. All children nodes and all objects are also removed.
- Parameters
-
type The name of the type to remove.
- Returns
- Returns true if the type was found and successfully removed
void oos::object_store::remove_proxy | ( | prototype_node * | node, |
object_proxy * | oproxy | ||
) |
Removes an object proxy from a prototype list.
- Parameters
-
node Prototype from which the proxy will be removed. oproxy Object proxy to remove
void oos::object_store::unregister_observer | ( | object_observer * | observer | ) |
Unregisters an observer from the object store.
- Parameters
-
observer The object observer to unregister.
The documentation for this class was generated from the following file:
- object/object_store.hpp