Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
InstanceTracker< FamilyT, ClassNameT, FactoryBaseT, FactoryT > Class Template ReferenceAttempts to provide references to all currently instantiated objects of a class (and its subclasses). More...
Inheritance diagram for InstanceTracker< FamilyT, ClassNameT, FactoryBaseT, FactoryT >:
Detailed Descriptiontemplate<class FamilyT, typename ClassNameT = std::string, class FactoryBaseT = Factory1Arg<FamilyT,std::string>, template< class U > class FactoryT = FactoryBaseT::template Factory>
|
Classes | |
struct | FactoryType |
allows indirect access to create factory classes More... | |
class | InstanceEntry |
Provides a wrapper for non-plistDictionary entries. More... | |
Public Types | |
typedef plist::Dictionary::iterator | iterator |
shorthand for iterators to be returned | |
typedef plist::Dictionary::const_iterator | const_iterator |
shorthand for iterators to be returned | |
typedef FamilyT | FamilyType |
allows indirect access to the product family type | |
typedef ClassNameT | ClassNameType |
allows indirect access to the product class name type | |
typedef FactoryBaseT | FactoryBaseType |
allows indirect access to the factory base class | |
Public Member Functions | |
InstanceTracker () | |
constructor | |
template<class T > | |
bool | registerInstance (const std::string &name, T &inst) |
Register an existing instance via reference, does not assume responsibility for memory deallocation, returns false if name is already in use. | |
template<class T > | |
bool | registerInstance (const std::string &name, T *inst) |
Register an existing instance via pointer, does assume responsibility for memory deallocation, returns false if name is already in use. | |
template<class T > | |
bool | registerInstance (const ClassNameT &type, const std::string &name, T &inst) |
Register an existing instance via reference, does not assume responsibility for memory deallocation, returns false if name is already in use. | |
template<class T > | |
bool | registerInstance (const ClassNameT &type, const std::string &name, T *inst) |
Register an existing instance via pointer, does assume responsibility for memory deallocation, returns false if name is already in use. | |
FamilyT * | create (const ClassNameType &type, const std::string &name) |
create and register an instance in one call | |
FamilyT * | getInstance (const std::string &name) |
looks up a previously registered instance, returning NULL if not found | |
bool | destroy (const std::string &name) |
Removes an instance from the tracker. | |
void | loadXML (xmlNode *node) |
This specialization looks for the SensorInfo::sensorType, then has the factory construct the correct subtype before loading the node into and returning that. | |
Private Member Functions | |
InstanceTracker (const InstanceTracker &) | |
copy constructor, don't call | |
InstanceTracker & | operator= (const InstanceTracker &) |
assignment, don't call |
typedef ClassNameT InstanceTracker< FamilyT, ClassNameT, FactoryBaseT, FactoryT >::ClassNameType |
allows indirect access to the product class name type
Definition at line 16 of file InstanceTracker.h.
typedef plist::Dictionary::const_iterator InstanceTracker< FamilyT, ClassNameT, FactoryBaseT, FactoryT >::const_iterator |
shorthand for iterators to be returned
Reimplemented from plist::DictionaryBase.
Definition at line 11 of file InstanceTracker.h.
typedef FactoryBaseT InstanceTracker< FamilyT, ClassNameT, FactoryBaseT, FactoryT >::FactoryBaseType |
allows indirect access to the factory base class
Reimplemented from FamilyFactory< FamilyT, ClassNameT, FactoryBaseT, FactoryT >.
Definition at line 18 of file InstanceTracker.h.
typedef FamilyT InstanceTracker< FamilyT, ClassNameT, FactoryBaseT, FactoryT >::FamilyType |
allows indirect access to the product family type
Reimplemented from FamilyFactory< FamilyT, ClassNameT, FactoryBaseT, FactoryT >.
Definition at line 14 of file InstanceTracker.h.
typedef plist::Dictionary::iterator InstanceTracker< FamilyT, ClassNameT, FactoryBaseT, FactoryT >::iterator |
shorthand for iterators to be returned
Reimplemented from plist::DictionaryBase.
Definition at line 9 of file InstanceTracker.h.
InstanceTracker< FamilyT, ClassNameT, FactoryBaseT, FactoryT >::InstanceTracker | ( | ) |
constructor
Definition at line 23 of file InstanceTracker.h.
InstanceTracker< FamilyT, ClassNameT, FactoryBaseT, FactoryT >::InstanceTracker | ( | const InstanceTracker< FamilyT, ClassNameT, FactoryBaseT, FactoryT > & | ) | [private] |
copy constructor, don't call
FamilyT * InstanceTracker< FamilyT, ClassNameT, FactoryBaseT, FactoryT >::create | ( | const ClassNameType & | type, | |
const std::string & | name | |||
) |
create and register an instance in one call
Definition at line 149 of file InstanceTracker.h.
Referenced by InstanceTracker< FamilyT, ClassNameT, FactoryBaseT, FactoryT >::loadXML().
bool InstanceTracker< FamilyT, ClassNameT, FactoryBaseT, FactoryT >::destroy | ( | const std::string & | name | ) |
Removes an instance from the tracker.
If the tracker was managing the memory allocation (via create() or the registerInstance() functions which take a pointer instead of a reference), then this will cause the instance to be deallocated.
Definition at line 177 of file InstanceTracker.h.
Referenced by InstanceTracker< FamilyT, ClassNameT, FactoryBaseT, FactoryT >::loadXML().
FamilyT * InstanceTracker< FamilyT, ClassNameT, FactoryBaseT, FactoryT >::getInstance | ( | const std::string & | name | ) |
looks up a previously registered instance, returning NULL if not found
Definition at line 160 of file InstanceTracker.h.
void InstanceTracker< FamilyT, ClassNameT, FactoryBaseT, FactoryT >::loadXML | ( | xmlNode * | node | ) | [virtual] |
This specialization looks for the SensorInfo::sensorType, then has the factory construct the correct subtype before loading the node into and returning that.
From the name of node, will instantiate a new ObjectBase subclass to load it.
supports use of plist::ArrayOf<PlannerObstacle> for polymorphic load/save
The mapping from node names to actual instantiated types is:
If successful, returns a pointer to a newly allocated region, which the caller is responsible for freeing. If an error occurs, NULL is returned.
attempts to load a new T instance from the specified xmlNode
Reimplemented from plist::DictionaryBase.
Definition at line 198 of file InstanceTracker.h.
InstanceTracker& InstanceTracker< FamilyT, ClassNameT, FactoryBaseT, FactoryT >::operator= | ( | const InstanceTracker< FamilyT, ClassNameT, FactoryBaseT, FactoryT > & | ) | [private] |
assignment, don't call
bool InstanceTracker< FamilyT, ClassNameT, FactoryBaseT, FactoryT >::registerInstance | ( | const ClassNameT & | type, | |
const std::string & | name, | |||
T * | inst | |||
) |
Register an existing instance via pointer, does assume responsibility for memory deallocation, returns false if name is already in use.
If type is not an empty string, and inst is a plist::Dictionary, a '.type' entry will be added to store the type. This allows polymorphic loading. Non-dictionaries will be wrapped in a new plist::Dictionary with a '.type'.
Definition at line 136 of file InstanceTracker.h.
bool InstanceTracker< FamilyT, ClassNameT, FactoryBaseT, FactoryT >::registerInstance | ( | const ClassNameT & | type, | |
const std::string & | name, | |||
T & | inst | |||
) |
Register an existing instance via reference, does not assume responsibility for memory deallocation, returns false if name is already in use.
If type is not an empty string, and inst is a plist::Dictionary, a '.type' entry will be added to store the type. This allows polymorphic loading. Non-dictionaries will be wrapped in a new plist::Dictionary with a '.type'.
Definition at line 118 of file InstanceTracker.h.
bool InstanceTracker< FamilyT, ClassNameT, FactoryBaseT, FactoryT >::registerInstance | ( | const std::string & | name, | |
T * | inst | |||
) |
Register an existing instance via pointer, does assume responsibility for memory deallocation, returns false if name is already in use.
Definition at line 107 of file InstanceTracker.h.
bool InstanceTracker< FamilyT, ClassNameT, FactoryBaseT, FactoryT >::registerInstance | ( | const std::string & | name, | |
T & | inst | |||
) |
Register an existing instance via reference, does not assume responsibility for memory deallocation, returns false if name is already in use.
Definition at line 93 of file InstanceTracker.h.
Referenced by InstanceTracker< FamilyT, ClassNameT, FactoryBaseT, FactoryT >::create().
Tekkotsu v5.1CVS |
Generated Mon May 9 04:59:09 2016 by Doxygen 1.6.3 |