Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
ObjectRegistry< T, Key > Class Template Reference

#include <ObjectRegistry.h>

Public Types

typedef std::map< Key, T * > RegistryMapType

Public Member Functions

RegistryMapType const & GetRegisteredItems () const
 Return the map of registered items.
unsigned int GetRegisteredItems (std::vector< Key > &l) const
 Inefficiently return a vector of registered items.
const T * GetRegistryItem (Key key) const
 Returns a registry item.
bool HasItem (Key key) const
 Returns true if registry contains an item.
bool InsertItem (T *obj, Key key, bool override=false)
 Inserts a registry item.
 ObjectRegistry ()
void RemoveItem (Key key, bool delete_object=true)
 Removes a registry item.
 ~ObjectRegistry ()

Private Attributes

RegistryMapType i_registeredObjects

Detailed Description

template<class T, class Key = std::string>
class ObjectRegistry< T, Key >

ObjectRegistry holds all registry item of the same type

Definition at line 19 of file ObjectRegistry.h.

Member Typedef Documentation

◆ RegistryMapType

template<class T, class Key = std::string>
typedef std::map<Key, T*> ObjectRegistry< T, Key >::RegistryMapType

Definition at line 22 of file ObjectRegistry.h.

Constructor & Destructor Documentation

◆ ObjectRegistry()

template<class T, class Key = std::string>
ObjectRegistry< T, Key >::ObjectRegistry ( )
inline

Definition at line 81 of file ObjectRegistry.h.

◆ ~ObjectRegistry()

template<class T, class Key = std::string>
ObjectRegistry< T, Key >::~ObjectRegistry ( )
inline

Definition at line 82 of file ObjectRegistry.h.

Member Function Documentation

◆ GetRegisteredItems() [1/2]

template<class T, class Key = std::string>
RegistryMapType const & ObjectRegistry< T, Key >::GetRegisteredItems ( ) const
inline

Return the map of registered items.

Definition at line 76 of file ObjectRegistry.h.

◆ GetRegisteredItems() [2/2]

template<class T, class Key = std::string>
unsigned int ObjectRegistry< T, Key >::GetRegisteredItems ( std::vector< Key > & l) const
inline

Inefficiently return a vector of registered items.

Definition at line 66 of file ObjectRegistry.h.

Referenced by FactorySelector::selectAI().

◆ GetRegistryItem()

template<class T, class Key = std::string>
const T * ObjectRegistry< T, Key >::GetRegistryItem ( Key key) const
inline

◆ HasItem()

template<class T, class Key = std::string>
bool ObjectRegistry< T, Key >::HasItem ( Key key) const
inline

Returns true if registry contains an item.

Definition at line 60 of file ObjectRegistry.h.

◆ InsertItem()

template<class T, class Key = std::string>
bool ObjectRegistry< T, Key >::InsertItem ( T * obj,
Key key,
bool override = false )
inline

Inserts a registry item.

Definition at line 32 of file ObjectRegistry.h.

Referenced by FactoryHolder< CreatureAI >::RegisterSelf().

◆ RemoveItem()

template<class T, class Key = std::string>
void ObjectRegistry< T, Key >::RemoveItem ( Key key,
bool delete_object = true )
inline

Removes a registry item.

Definition at line 48 of file ObjectRegistry.h.

Referenced by FactoryHolder< CreatureAI >::DeregisterSelf().

Member Data Documentation

◆ i_registeredObjects

template<class T, class Key = std::string>
RegistryMapType ObjectRegistry< T, Key >::i_registeredObjects
private

Definition at line 89 of file ObjectRegistry.h.


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