Planet
navihomeaboutscreenshotsdownloaddevelopmentforum
Orxonox: orxonox::OrxonoxClass Class Reference

orxonox::OrxonoxClass Class Reference

The class all objects and interfaces of the game-logic (not the engine) are derived from. More...

#include <core/OrxonoxClass.h>

Inheritance diagram for orxonox::OrxonoxClass:
orxonox::BaseObject orxonox::BaseSound orxonox::BasicProjectile orxonox::CameraManager orxonox::ChatListener orxonox::ClientConnectionListener orxonox::Core orxonox::DevModeListener orxonox::Game orxonox::GametypeMessageListener orxonox::GraphicsManager orxonox::GSMainMenu orxonox::InputBuffer orxonox::JoyStick orxonox::JoyStickQuantityListener orxonox::KeyBinderManager orxonox::LevelInfoItem orxonox::LevelManager orxonox::MoodListener orxonox::MoodManager orxonox::NetworkChatListener orxonox::NetworkFunctionBase orxonox::NotificationListener orxonox::Pickupable orxonox::PickupCarrier orxonox::PickupListener orxonox::PlayerTrigger orxonox::QuestManager orxonox::RadarListener orxonox::RadarViewable orxonox::Rewardable orxonox::ScreenshotManager orxonox::SkyboxGenerator orxonox::SoundManager orxonox::Synchronisable orxonox::TeamColourable orxonox::Tickable orxonox::TimeFactorListener orxonox::Timer orxonox::ViewportEventListener orxonox::WANDiscoverable orxonox::WANDiscovery orxonox::WindowEventListener orxonox::XMLNameListener

List of all members.

Public Member Functions

 OrxonoxClass ()
 Constructor: Sets the default values.
virtual ~OrxonoxClass ()
 Destructor: Removes the object from the object-lists, notifies all DestructionListener (for example weak pointers) that this object is being deleted.
void destroy ()
 Deletes the object if no smart pointers point to this object.
template<class T >
ORX_FORCEINLINE const T * getDerivedPointer (unsigned int classID) const
 Const version of getDerivedPointer with template.
template<class T >
ORX_FORCEINLINE T * getDerivedPointer (unsigned int classID)
 Version of getDerivedPointer with template.
ORX_FORCEINLINE void * getDerivedPointer (unsigned int classID)
 Returns a valid pointer of any derived type that is registered in the class hierarchy.
IdentifiergetIdentifier () const
 Returns the Identifier of the object.
unsigned int getReferenceCount () const
 Returns the number of smart pointers that point to this object.
bool isA (const OrxonoxClass *object)
 Returns true if the object's class is of the given type or a derivative.
template<class B >
bool isA (const SubclassIdentifier< B > *identifier)
 Returns true if the object's class is of the given type or a derivative.
bool isA (const Identifier *identifier)
 Returns true if the object's class is of the given type or a derivative.
bool isChildOf (const OrxonoxClass *object)
 Returns true if the object's class is a child of the given type.
template<class B >
bool isChildOf (const SubclassIdentifier< B > *identifier)
 Returns true if the object's class is a child of the given type.
bool isChildOf (const Identifier *identifier)
 Returns true if the object's class is a child of the given type.
bool isDirectChildOf (const OrxonoxClass *object)
 Returns true if the object's class is a direct child of the given type.
template<class B >
bool isDirectChildOf (const SubclassIdentifier< B > *identifier)
 Returns true if the object's class is a direct child of the given type.
bool isDirectChildOf (const Identifier *identifier)
 Returns true if the object's class is a direct child of the given type.
bool isDirectParentOf (const OrxonoxClass *object)
 Returns true if the object's class is a direct child of the given type.
template<class B >
bool isDirectParentOf (const SubclassIdentifier< B > *identifier)
 Returns true if the object's class is a direct parent of the given type.
bool isDirectParentOf (const Identifier *identifier)
 Returns true if the object's class is a direct parent of the given type.
bool isExactlyA (const OrxonoxClass *object)
 Returns true if the object's class is exactly of the given type.
template<class B >
bool isExactlyA (const SubclassIdentifier< B > *identifier)
 Returns true if the object's class is exactly of the given type.
bool isExactlyA (const Identifier *identifier)
 Returns true if the object's class is exactly of the given type.
bool isParentOf (const OrxonoxClass *object)
 Returns true if the object's class is a parent of the given type.
template<class B >
bool isParentOf (const SubclassIdentifier< B > *identifier)
 Returns true if the object's class is a parent of the given type.
bool isParentOf (const Identifier *identifier)
 Returns true if the object's class is a parent of the given type.
void setConfigValues ()
 Function to collect the SetConfigValue-macro calls.
void unregisterObject ()
 Removes this object from the object-lists.

Protected Member Functions

virtual void preDestroy ()
 This virtual function is called if destroy() is called and no SmartPtr points to this object. Used in some cases to create a new SmartPtr to prevent destruction.

Private Member Functions

void decrementReferenceCount ()
 Decrements the reference counter (for smart pointers).
void incrementReferenceCount ()
 Increments the reference counter (for smart pointers).
void registerDestructionListener (DestructionListener *pointer)
 Register a destruction listener (for example a weak pointer which points to this object).
void unregisterDestructionListener (DestructionListener *pointer)
 Unegister a destruction listener (for example a weak pointer which pointed to this object before).

Private Attributes

std::set< DestructionListener * > destructionListeners_
 All destruction listeners (for example weak pointers which point to this object and like to get notified if it dies).
Identifieridentifier_
 The Identifier of the object.
MetaObjectListmetaList_
 MetaObjectList, containing all ObjectLists and ObjectListElements the object is registered in.
std::vector< std::pair
< unsigned int, void * > > 
objectPointers_
 'Fast map' that holds this-pointers of all derived types
std::set< const Identifier * > * parents_
 List of all parents of the object.
int referenceCount_
 Counts the references from smart pointers to this object.
bool requestedDestruction_
 Becomes true after someone called delete on this object.

Friends

class ClassIdentifier
class DestructionListener
class SmartPtr

Detailed Description

The class all objects and interfaces of the game-logic (not the engine) are derived from.

The BaseObject and Interfaces are derived with virtual public OrxonoxClass from OrxonoxClass. OrxonoxClass is needed to create the class-hierarchy at startup and to store the Identifier and the MetaObjectList, as well as to provide an interface for SmartPtr and WeakPtr.


Constructor & Destructor Documentation

orxonox::OrxonoxClass::OrxonoxClass (  ) 

Constructor: Sets the default values.

orxonox::OrxonoxClass::~OrxonoxClass (  )  [virtual]

Destructor: Removes the object from the object-lists, notifies all DestructionListener (for example weak pointers) that this object is being deleted.


Member Function Documentation

void orxonox::OrxonoxClass::decrementReferenceCount (  )  [inline, private]

Decrements the reference counter (for smart pointers).

void orxonox::OrxonoxClass::destroy ( void   ) 

Deletes the object if no smart pointers point to this object.

Otherwise schedules the object to be deleted as soon as possible.

Reimplemented in orxonox::Core, orxonox::Game, orxonox::GraphicsManager, orxonox::GUIManager, and orxonox::Pickupable.

template<class T >
ORX_FORCEINLINE const T* orxonox::OrxonoxClass::getDerivedPointer ( unsigned int  classID  )  const [inline]

Const version of getDerivedPointer with template.

template<class T >
ORX_FORCEINLINE T* orxonox::OrxonoxClass::getDerivedPointer ( unsigned int  classID  )  [inline]

Version of getDerivedPointer with template.

ORX_FORCEINLINE void* orxonox::OrxonoxClass::getDerivedPointer ( unsigned int  classID  )  [inline]

Returns a valid pointer of any derived type that is registered in the class hierarchy.

Returns:
Returns NULL if the no pointer was found.
Identifier* orxonox::OrxonoxClass::getIdentifier (  )  const [inline]

Returns the Identifier of the object.

unsigned int orxonox::OrxonoxClass::getReferenceCount (  )  const [inline]

Returns the number of smart pointers that point to this object.

void orxonox::OrxonoxClass::incrementReferenceCount (  )  [inline, private]

Increments the reference counter (for smart pointers).

bool orxonox::OrxonoxClass::isA ( const OrxonoxClass object  ) 

Returns true if the object's class is of the given type or a derivative.

template<class B >
bool orxonox::OrxonoxClass::isA ( const SubclassIdentifier< B > *  identifier  )  [inline]

Returns true if the object's class is of the given type or a derivative.

bool orxonox::OrxonoxClass::isA ( const Identifier identifier  ) 

Returns true if the object's class is of the given type or a derivative.

bool orxonox::OrxonoxClass::isChildOf ( const OrxonoxClass object  ) 

Returns true if the object's class is a child of the given type.

template<class B >
bool orxonox::OrxonoxClass::isChildOf ( const SubclassIdentifier< B > *  identifier  )  [inline]

Returns true if the object's class is a child of the given type.

bool orxonox::OrxonoxClass::isChildOf ( const Identifier identifier  ) 

Returns true if the object's class is a child of the given type.

bool orxonox::OrxonoxClass::isDirectChildOf ( const OrxonoxClass object  ) 

Returns true if the object's class is a direct child of the given type.

template<class B >
bool orxonox::OrxonoxClass::isDirectChildOf ( const SubclassIdentifier< B > *  identifier  )  [inline]

Returns true if the object's class is a direct child of the given type.

bool orxonox::OrxonoxClass::isDirectChildOf ( const Identifier identifier  ) 

Returns true if the object's class is a direct child of the given type.

bool orxonox::OrxonoxClass::isDirectParentOf ( const OrxonoxClass object  ) 

Returns true if the object's class is a direct child of the given type.

template<class B >
bool orxonox::OrxonoxClass::isDirectParentOf ( const SubclassIdentifier< B > *  identifier  )  [inline]

Returns true if the object's class is a direct parent of the given type.

bool orxonox::OrxonoxClass::isDirectParentOf ( const Identifier identifier  ) 

Returns true if the object's class is a direct parent of the given type.

bool orxonox::OrxonoxClass::isExactlyA ( const OrxonoxClass object  ) 

Returns true if the object's class is exactly of the given type.

template<class B >
bool orxonox::OrxonoxClass::isExactlyA ( const SubclassIdentifier< B > *  identifier  )  [inline]

Returns true if the object's class is exactly of the given type.

bool orxonox::OrxonoxClass::isExactlyA ( const Identifier identifier  ) 

Returns true if the object's class is exactly of the given type.

bool orxonox::OrxonoxClass::isParentOf ( const OrxonoxClass object  ) 

Returns true if the object's class is a parent of the given type.

template<class B >
bool orxonox::OrxonoxClass::isParentOf ( const SubclassIdentifier< B > *  identifier  )  [inline]

Returns true if the object's class is a parent of the given type.

bool orxonox::OrxonoxClass::isParentOf ( const Identifier identifier  ) 

Returns true if the object's class is a parent of the given type.

virtual void orxonox::OrxonoxClass::preDestroy ( void   )  [inline, protected, virtual]

This virtual function is called if destroy() is called and no SmartPtr points to this object. Used in some cases to create a new SmartPtr to prevent destruction.

Reimplemented in orxonox::NotificationManager, orxonox::Pickupable, orxonox::PickupCarrier, orxonox::AmbientSound, orxonox::ControllableEntity, and orxonox::Pawn.

void orxonox::OrxonoxClass::registerDestructionListener ( DestructionListener pointer  )  [inline, private]

Register a destruction listener (for example a weak pointer which points to this object).

void orxonox::OrxonoxClass::unregisterDestructionListener ( DestructionListener pointer  )  [inline, private]

Unegister a destruction listener (for example a weak pointer which pointed to this object before).

void orxonox::OrxonoxClass::unregisterObject (  ) 

Removes this object from the object-lists.


Friends And Related Function Documentation

friend class ClassIdentifier [friend]
friend class DestructionListener [friend]
friend class SmartPtr [friend]

Member Data Documentation

All destruction listeners (for example weak pointers which point to this object and like to get notified if it dies).

MetaObjectList, containing all ObjectLists and ObjectListElements the object is registered in.

std::vector<std::pair<unsigned int, void*> > orxonox::OrxonoxClass::objectPointers_ [private]

'Fast map' that holds this-pointers of all derived types

std::set<const Identifier*>* orxonox::OrxonoxClass::parents_ [private]

List of all parents of the object.

Counts the references from smart pointers to this object.

Becomes true after someone called delete on this object.


The documentation for this class was generated from the following files:
Generated on Wed May 22 06:32:22 2013 for Orxonox by  doxygen 1.6.3