orxonox::Factory Class Reference

The Factory is used to map the name or the network ID of a class with its Identifier. More...

#include <src/core/Factory.h>

List of all members.

Static Public Member Functions

static void add (const std::string &name, Identifier *identifier)
 Adds a new Identifier to both maps.
static void changeNetworkID (Identifier *identifier, const uint32_t oldID, const uint32_t newID)
 Removes the entry with the old network ID and adds a new one.
static void cleanNetworkIDs ()
 Cleans the NetworkID map (needed on clients for correct initialization).
static void createClassHierarchy ()
 Creates the class-hierarchy by creating and destroying one object of each type.
static const std::map
< std::string, Identifier * > & 
getFacbtoryMap ()
 Returns the factory-map.
static std::map< std::string,
Identifier * >::const_iterator 
getFactoryMapBegin ()
 Returns the begin-iterator of the factory-map.
static std::map< std::string,
Identifier * >::const_iterator 
getFactoryMapEnd ()
 Returns the end-iterator of the factory-map.
static FactorygetFactoryPointer ()
 Ensures the Factory gets created in the right moment.
static IdentifiergetIdentifier (const uint32_t id)
 Returns the Identifier with a given network ID.
static IdentifiergetIdentifier (const std::string &name)
 Returns the Identifier with a given name.

Private Member Functions

 Factory (const Factory &factory)
 Factory ()
 ~Factory ()

Private Attributes

std::map< uint32_t, Identifier * > identifierNetworkIDMap_
 The map, mapping the network ID with the Identifier.
std::map< std::string,
Identifier * > 
identifierStringMap_
 The map, mapping the name with the Identifier.


Detailed Description

The Factory is used to map the name or the network ID of a class with its Identifier.

Constructor & Destructor Documentation

orxonox::Factory::Factory (  )  [inline, private]

Referenced by getFactoryPointer().

orxonox::Factory::Factory ( const Factory factory  )  [private]

orxonox::Factory::~Factory (  )  [inline, private]


Member Function Documentation

void orxonox::Factory::add ( const std::string name,
Identifier identifier 
) [static]

Adds a new Identifier to both maps.

Parameters:
name The name of the identifier
identifier The identifier to add

References getFactoryPointer(), orxonox::Identifier::getNetworkID(), identifierNetworkIDMap_, and identifierStringMap_.

Referenced by orxonox::ClassFactory< T >::create().

void orxonox::Factory::changeNetworkID ( Identifier identifier,
const uint32_t  oldID,
const uint32_t  newID 
) [static]

Removes the entry with the old network ID and adds a new one.

Parameters:
identifier The identifier to change
oldID The old networkID
newID The new networkID

References getFactoryPointer(), and identifierNetworkIDMap_.

Referenced by orxonox::Identifier::setNetworkID().

void orxonox::Factory::cleanNetworkIDs (  )  [static]

Cleans the NetworkID map (needed on clients for correct initialization).

References getFactoryPointer(), and identifierNetworkIDMap_.

Referenced by orxonox::packet::ClassID::process().

void orxonox::Factory::createClassHierarchy (  )  [static]

Creates the class-hierarchy by creating and destroying one object of each type.

References COUT, getFactoryPointer(), and identifierStringMap_.

Referenced by orxonox::Core::Core().

static const std::map<std::string, Identifier*>& orxonox::Factory::getFacbtoryMap (  )  [inline, static]

Returns the factory-map.

References getFactoryPointer(), and identifierStringMap_.

static std::map<std::string, Identifier*>::const_iterator orxonox::Factory::getFactoryMapBegin (  )  [inline, static]

Returns the begin-iterator of the factory-map.

References getFactoryPointer(), and identifierStringMap_.

Referenced by orxonox::packet::ClassID::ClassID().

static std::map<std::string, Identifier*>::const_iterator orxonox::Factory::getFactoryMapEnd (  )  [inline, static]

Returns the end-iterator of the factory-map.

References getFactoryPointer(), and identifierStringMap_.

Referenced by orxonox::packet::ClassID::ClassID().

Factory * orxonox::Factory::getFactoryPointer (  )  [static]

Ensures the Factory gets created in the right moment.

Returns:
The Factory.

References Factory().

Referenced by add(), changeNetworkID(), cleanNetworkIDs(), createClassHierarchy(), getFacbtoryMap(), getFactoryMapBegin(), getFactoryMapEnd(), and getIdentifier().

Identifier * orxonox::Factory::getIdentifier ( const uint32_t  id  )  [static]

Returns the Identifier with a given network ID.

Parameters:
id The network ID of the wanted Identifier
Returns:
The Identifier

References getFactoryPointer(), and identifierNetworkIDMap_.

Identifier * orxonox::Factory::getIdentifier ( const std::string name  )  [static]

Returns the Identifier with a given name.

Parameters:
name The name of the wanted Identifier
Returns:
The Identifier

References getFactoryPointer(), and identifierStringMap_.

Referenced by orxonox::XMLPortClassObjectContainer< T, O >::port().


Member Data Documentation

std::map<uint32_t, Identifier*> orxonox::Factory::identifierNetworkIDMap_ [private]

The map, mapping the network ID with the Identifier.

Referenced by add(), changeNetworkID(), cleanNetworkIDs(), and getIdentifier().


The documentation for this class was generated from the following files:

Generated on Tue Jul 28 16:22:29 2009 for Orxonox by  doxygen 1.5.6