orxonox::SubclassIdentifier< T > Class Template Reference

The SubclassIdentifier acts almost like an Identifier, but has some prerequisites. More...

#include <src/core/Identifier.h>

List of all members.

Public Member Functions

T * fabricate (BaseObject *creator) const
 Creates a new object of the type of the assigned Identifier and dynamic_casts it to the minimal type given by T.
IdentifiergetIdentifier () const
 Returns the assigned identifier.
 operator Identifier * () const
 Returns the assigned identifier. This allows you to assign a SubclassIdentifier to a normal Identifier*.
Identifieroperator* () const
 Overloading of the * operator: returns the assigned identifier.
Identifieroperator-> () const
 Overloading of the -> operator: returns the assigned identifier.
SubclassIdentifier< T > & operator= (Identifier *identifier)
 Overloading of the = operator: assigns the identifier and checks its type.
 SubclassIdentifier (Identifier *identifier)
 Copyconstructor: Assigns the given Identifier.
 SubclassIdentifier ()
 Constructor: Automaticaly assigns the Identifier of the given class.

Private Attributes

Identifieridentifier_
 Returns true, if the assigned identifier is at least of the given type.


Detailed Description

template<class T>
class orxonox::SubclassIdentifier< T >

The SubclassIdentifier acts almost like an Identifier, but has some prerequisites.

You can only assign an Identifier that belongs to a class T (or derived) to a SubclassIdentifier<T>. If you assign something else, the program aborts. Because we know the minimum type, a dynamic_cast is done, which makes it easier to create a new object.


Constructor & Destructor Documentation

template<class T>
orxonox::SubclassIdentifier< T >::SubclassIdentifier (  )  [inline]

Constructor: Automaticaly assigns the Identifier of the given class.

template<class T>
orxonox::SubclassIdentifier< T >::SubclassIdentifier ( Identifier identifier  )  [inline]

Copyconstructor: Assigns the given Identifier.

Parameters:
identifier The Identifier


Member Function Documentation

template<class T>
T* orxonox::SubclassIdentifier< T >::fabricate ( BaseObject creator  )  const [inline]

Creates a new object of the type of the assigned Identifier and dynamic_casts it to the minimal type given by T.

Returns:
The new object

Referenced by orxonox::WeaponSystem::getMunition().

template<class T>
Identifier* orxonox::SubclassIdentifier< T >::getIdentifier (  )  const [inline]

template<class T>
orxonox::SubclassIdentifier< T >::operator Identifier * (  )  const [inline]

Returns the assigned identifier. This allows you to assign a SubclassIdentifier to a normal Identifier*.

template<class T>
Identifier* orxonox::SubclassIdentifier< T >::operator* (  )  const [inline]

Overloading of the * operator: returns the assigned identifier.

template<class T>
Identifier* orxonox::SubclassIdentifier< T >::operator-> (  )  const [inline]

Overloading of the -> operator: returns the assigned identifier.

template<class T>
SubclassIdentifier<T>& orxonox::SubclassIdentifier< T >::operator= ( Identifier identifier  )  [inline]

Overloading of the = operator: assigns the identifier and checks its type.

Parameters:
identifier The Identifier to assign
Returns:
The SubclassIdentifier itself


Member Data Documentation

template<class T>
Identifier* orxonox::SubclassIdentifier< T >::identifier_ [private]

Returns true, if the assigned identifier is at least of the given type.

Parameters:
identifier The identifier to compare with Returns true, if the assigned identifier is exactly of the given type.
identifier The identifier to compare with Returns true, if the assigned identifier is a child of the given identifier.
identifier The identifier to compare with Returns true, if the assigned identifier is a direct child of the given identifier.
identifier The identifier to compare with Returns true, if the assigned identifier is a parent of the given identifier.
identifier The identifier to compare with Returns true, if the assigned identifier is a direct parent of the given identifier.
identifier The identifier to compare with The assigned identifier


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

Generated on Tue Jul 28 16:23:06 2009 for Orxonox by  doxygen 1.5.6