SGE::CL_TEMPLATE_OBJECT_MANAGER< T, P > Class Template Reference

CL_TEMPLATE_OBJECT_MANAGER is a manager to add/store/remove/get and manipulate any type of objects. [MORE HERE]. More...

#include <cl_template_manager.h>

Inheritance diagram for SGE::CL_TEMPLATE_OBJECT_MANAGER< T, P >:

Inheritance graph
[legend]
Collaboration diagram for SGE::CL_TEMPLATE_OBJECT_MANAGER< T, P >:

Collaboration graph
[legend]
List of all members.

Public Types

typedef T * TplHdle
 Typedef of a pointer to the managed object.
typedef P & IDRef
 Typedef of a reference to the ID value.
typedef const P & IDRefCst
 Typedef of a const reference to the ID value.
typedef std::map< P, TplHdleTplMap
 Typedef of the corresponding std::map of the manager.
typedef std::pair< P, TplHdleTplPair
 Typedef of the corresponding std::pair.
typedef TplMap::iterator iterator
 Typedef of the corresponding std::map iterator.
typedef CL_TEMPLATE_OBJECT_MANAGER<
T, P > 
TplManager

Public Member Functions

_SG_TLS_INLINE CL_TEMPLATE_OBJECT_MANAGER (TplManager *_RemoteManager)
 Default constructor. [MORE HERE].
_SG_TLS_INLINE ~CL_TEMPLATE_OBJECT_MANAGER (void)
 Default destructor.
_SG_TLS_INLINE TplHdle Add (IDRefCst _ID)
 Look into the local and remote manager for an object named by _ID, if found return it. Else create a new object T with ID _ID and return it.
_SG_TLS_INLINE TplHdle AddObj (TplHdle _Obj)
 Look into the local and remote manager for an object corresponding to _Obj, if found return it. Else add _Obj to the local manager and remote manager.
_SG_TLS_INLINE TplHdle GetLastAdded ()
 Return the latest object added.
_SG_TLS_INLINE TplHdle Find (IDRefCst _ID)
 Look into the local and remote manager for an object named by _ID, if found return it.
_SG_TLS_INLINE iterator FindLocalPair (IDRefCst _ID)
 Look into the local manager for an iterator named by _ID.
virtual _SG_TLS_INLINE size_t Delete (IDRefCst _ID)
 Delete the object identified by its IDRef.
virtual _SG_TLS_INLINE size_t DeleteAllLocal ()
 Delete all local object's pair.
_SG_TLS_INLINE TplHdle Get (IDRefCst _ID)
 Return the requested 'T' object pointer. If not present in the local manager, it will look in the remote manager(if defined).
_SG_TLS_INLINE TplHdle operator[] (IDRefCst _ID)
 Return the requested 'T' object pointer. If not present in the local manager, it will look in the remote manager(if defined).
iterator GetFirstIter ()
iterator GetLastIter ()
TplHdle GetFirstObj ()
TplHdle GetLastObj ()
_SG_TLS_INLINE size_t GetCount ()
_SG_TLS_INLINE TplHdle SetDefaultObj (IDRefCst _ID)
 Add a default object that will be returned when the requested object is not found. [MORE HERE].
_SG_TLS_INLINE TplHdle GetDefaultObj ()
 Return the default object.
_SG_TLS_INLINE void PrintAllObjects ()
 Print all objects name and value to the console.
_SG_TLS_INLINE bool SwapID (IDRefCst _ID1, IDRefCst _ID2)
 Swap 2 ID from two objects.
_SG_TLS_INLINE bool SwapID (TplHdle _Obj1, TplHdle _Obj2)
 Swap 2 ID from two objects.
_SG_TLS_INLINE TplHdle UpdateID (IDRefCst _IDsrc, IDRefCst _IDnew)
 Update the ID of an object. Look for the object, then look for if the new ID is free. If not return NULL. Then update the object ID.

Protected Member Functions

virtual _SG_TLS_INLINE bool IsObjValide (TplHdle _Obj)
 Check if the object is valid. May be redefined in herited class.
virtual _SG_TLS_INLINE TplHdle CreateObj (IDRefCst _ID, std::string _ObjType="")
 Check if the object is valid. May be redefined in herited class.
_SG_TLS_INLINE TplHdle AddLocal (IDRefCst _ID)
 Look into the local manager for an object named by _ID, if found return it. Else create a new object T with ID _ID and return it.
_SG_TLS_INLINE TplHdle AddLocalObj (TplHdle _Obj)
 Look into the local manager for an object corresponding to _Obj, if found return it. Else add _Obj to the local manager and remote manager.
_SG_TLS_INLINE TplHdle AddRemote (IDRefCst _ID)
 Look into the remote manager for an object named by _ID, if found return it. Else create a new object T with ID _ID and return it.
_SG_TLS_INLINE TplHdle AddRemoteObj (TplHdle _Obj)
 Look into the remote manager for an object corresponding to _Obj, if found return it. Else add _Obj to the local manager and remote manager.
_SG_TLS_INLINE TplHdle FindLocal (IDRefCst _ID)
 Look into the local manager for an object named by _ID, if found return it.
_SG_TLS_INLINE TplHdle FindRemote (IDRefCst _ID)
 Look into the remote manager for an object named by _ID, if found return it.

Detailed Description

template<class T, typename P = std::string>
class SGE::CL_TEMPLATE_OBJECT_MANAGER< T, P >

CL_TEMPLATE_OBJECT_MANAGER is a manager to add/store/remove/get and manipulate any type of objects. [MORE HERE].

Attention:
The 'T' objects must be unherited from CL_BASE_OBJ class.
Todo:
The update function must be tested with several remote manager.
Author:
Yannouchka


Constructor & Destructor Documentation

template<class T, typename P = std::string>
_SG_TLS_INLINE SGE::CL_TEMPLATE_OBJECT_MANAGER< T, P >::CL_TEMPLATE_OBJECT_MANAGER TplManager _RemoteManager  )  [inline]
 

Default constructor. [MORE HERE].

Parameters:
_RemoteManager => If NULL, all objects are stored localy, else only pointers to objects are store locally, real objects are stored in the _RemoteManager.
Attention:
[MORE HERE]


Member Function Documentation

template<class T, typename P = std::string>
_SG_TLS_INLINE TplHdle SGE::CL_TEMPLATE_OBJECT_MANAGER< T, P >::Add IDRefCst  _ID  )  [inline]
 

Look into the local and remote manager for an object named by _ID, if found return it. Else create a new object T with ID _ID and return it.

Parameters:
_ID => Name of the object to create.
Returns:
A 'T' pointer to the new created object.
See also:
AddLocal(), AddRemote(), Find()

template<class T, typename P = std::string>
_SG_TLS_INLINE TplHdle SGE::CL_TEMPLATE_OBJECT_MANAGER< T, P >::AddLocal IDRefCst  _ID  )  [inline, protected]
 

Look into the local manager for an object named by _ID, if found return it. Else create a new object T with ID _ID and return it.

Parameters:
_ID => Name of the object to create.
Returns:
A 'T' pointer to the new created object.
See also:
Add(), AddRemote(), Find()

template<class T, typename P = std::string>
_SG_TLS_INLINE TplHdle SGE::CL_TEMPLATE_OBJECT_MANAGER< T, P >::AddLocalObj TplHdle  _Obj  )  [inline, protected]
 

Look into the local manager for an object corresponding to _Obj, if found return it. Else add _Obj to the local manager and remote manager.

Parameters:
_Obj => object to add to the manager.
Returns:
_Obj.
See also:
AddObj(), AddObjRemote()

template<class T, typename P = std::string>
_SG_TLS_INLINE TplHdle SGE::CL_TEMPLATE_OBJECT_MANAGER< T, P >::AddObj TplHdle  _Obj  )  [inline]
 

Look into the local and remote manager for an object corresponding to _Obj, if found return it. Else add _Obj to the local manager and remote manager.

Parameters:
_Obj => object to add to the manager.
Returns:
_Obj.
See also:
AddObjLocal(), AddObjRemote()

template<class T, typename P = std::string>
_SG_TLS_INLINE TplHdle SGE::CL_TEMPLATE_OBJECT_MANAGER< T, P >::AddRemote IDRefCst  _ID  )  [inline, protected]
 

Look into the remote manager for an object named by _ID, if found return it. Else create a new object T with ID _ID and return it.

Parameters:
_ID => Name of the object to create.
Returns:
A 'T' pointer to the new created object.
See also:
Add(), AddLocal(), Find()

template<class T, typename P = std::string>
_SG_TLS_INLINE TplHdle SGE::CL_TEMPLATE_OBJECT_MANAGER< T, P >::AddRemoteObj TplHdle  _Obj  )  [inline, protected]
 

Look into the remote manager for an object corresponding to _Obj, if found return it. Else add _Obj to the local manager and remote manager.

Parameters:
_Obj => object to add to the manager.
Returns:
_Obj.
See also:
AddObj(), AddObjLocal()

template<class T, typename P = std::string>
virtual _SG_TLS_INLINE TplHdle SGE::CL_TEMPLATE_OBJECT_MANAGER< T, P >::CreateObj IDRefCst  _ID,
std::string  _ObjType = ""
[inline, protected, virtual]
 

Check if the object is valid. May be redefined in herited class.

Parameters:
_ID => ID of the object to create
_ObjType => NOT USED YET. Will be used for object looking into DLLs, for advenced managers only...
Returns:
new TplHdle object created

template<class T, typename P = std::string>
virtual _SG_TLS_INLINE size_t SGE::CL_TEMPLATE_OBJECT_MANAGER< T, P >::Delete IDRefCst  _ID  )  [inline, virtual]
 

Delete the object identified by its IDRef.

Parameters:
_ID => IDRef of the Object to delete.
Returns:
1 if success, else -1.

template<class T, typename P = std::string>
virtual _SG_TLS_INLINE size_t SGE::CL_TEMPLATE_OBJECT_MANAGER< T, P >::DeleteAllLocal  )  [inline, virtual]
 

Delete all local object's pair.

Todo:
add a control if the object are still referenced in other part of the program...
Returns:
nimber of object deleted.

template<class T, typename P = std::string>
_SG_TLS_INLINE TplHdle SGE::CL_TEMPLATE_OBJECT_MANAGER< T, P >::Find IDRefCst  _ID  )  [inline]
 

Look into the local and remote manager for an object named by _ID, if found return it.

Parameters:
_ID => Name of the object to find.
Returns:
A 'T' pointer to object find.
See also:
FindLocal(), FindRemote(), Add()

template<class T, typename P = std::string>
_SG_TLS_INLINE TplHdle SGE::CL_TEMPLATE_OBJECT_MANAGER< T, P >::FindLocal IDRefCst  _ID  )  [inline, protected]
 

Look into the local manager for an object named by _ID, if found return it.

Parameters:
_ID => Name of the object to find.
Returns:
A 'T' pointer to object find.
See also:
Find(), FindRemote()

template<class T, typename P = std::string>
_SG_TLS_INLINE iterator SGE::CL_TEMPLATE_OBJECT_MANAGER< T, P >::FindLocalPair IDRefCst  _ID  )  [inline]
 

Look into the local manager for an iterator named by _ID.

Parameters:
_ID => Name of the object to find.
Returns:
A iteratorr to object find.
See also:
Find(), FindRemote()

template<class T, typename P = std::string>
_SG_TLS_INLINE TplHdle SGE::CL_TEMPLATE_OBJECT_MANAGER< T, P >::FindRemote IDRefCst  _ID  )  [inline, protected]
 

Look into the remote manager for an object named by _ID, if found return it.

Parameters:
_ID => Name of the object to find.
Returns:
A 'T' pointer to object find.
See also:
Find(), FindLocal()

template<class T, typename P = std::string>
_SG_TLS_INLINE TplHdle SGE::CL_TEMPLATE_OBJECT_MANAGER< T, P >::Get IDRefCst  _ID  )  [inline]
 

Return the requested 'T' object pointer. If not present in the local manager, it will look in the remote manager(if defined).

Parameters:
_ID => Name of the requested object.
Returns:
'T' pointer.

template<class T, typename P = std::string>
_SG_TLS_INLINE size_t SGE::CL_TEMPLATE_OBJECT_MANAGER< T, P >::GetCount  )  [inline]
 

Returns:
The number of 'T' objects stored.

template<class T, typename P = std::string>
_SG_TLS_INLINE TplHdle SGE::CL_TEMPLATE_OBJECT_MANAGER< T, P >::GetDefaultObj  )  [inline]
 

Return the default object.

Returns:
DfltObj.
See also:
SetDefaultObj()

template<class T, typename P = std::string>
iterator SGE::CL_TEMPLATE_OBJECT_MANAGER< T, P >::GetFirstIter  )  [inline]
 

Returns:
First iterator of the MAP.

template<class T, typename P = std::string>
TplHdle SGE::CL_TEMPLATE_OBJECT_MANAGER< T, P >::GetFirstObj  )  [inline]
 

Returns:
First object of the manager.

template<class T, typename P = std::string>
_SG_TLS_INLINE TplHdle SGE::CL_TEMPLATE_OBJECT_MANAGER< T, P >::GetLastAdded  )  [inline]
 

Return the latest object added.

Returns:
A pointer to the latest object added.

template<class T, typename P = std::string>
iterator SGE::CL_TEMPLATE_OBJECT_MANAGER< T, P >::GetLastIter  )  [inline]
 

Returns:
Last iterator of the MAP.

template<class T, typename P = std::string>
TplHdle SGE::CL_TEMPLATE_OBJECT_MANAGER< T, P >::GetLastObj  )  [inline]
 

Returns:
Last object of the manager.

template<class T, typename P = std::string>
virtual _SG_TLS_INLINE bool SGE::CL_TEMPLATE_OBJECT_MANAGER< T, P >::IsObjValide TplHdle  _Obj  )  [inline, protected, virtual]
 

Check if the object is valid. May be redefined in herited class.

Parameters:
_Obj => Object to check validity
Returns:
true : if valid.

false : else.

template<class T, typename P = std::string>
_SG_TLS_INLINE TplHdle SGE::CL_TEMPLATE_OBJECT_MANAGER< T, P >::operator[] IDRefCst  _ID  )  [inline]
 

Return the requested 'T' object pointer. If not present in the local manager, it will look in the remote manager(if defined).

Parameters:
_ID => Name of the requested object.
Returns:
'T' pointer.
See also:
Get()

template<class T, typename P = std::string>
_SG_TLS_INLINE TplHdle SGE::CL_TEMPLATE_OBJECT_MANAGER< T, P >::SetDefaultObj IDRefCst  _ID  )  [inline]
 

Add a default object that will be returned when the requested object is not found. [MORE HERE].

Returns:
a TplHdle pointer to the new created object.
Note:
Default objects are used to avoid crashing the application. It is usefull will some media objects like :
  • sounds : set an error message.
  • texture : an image 'in construction' or 'not found'
  • etc...
See also:
GetDefaultObj()

template<class T, typename P = std::string>
_SG_TLS_INLINE TplHdle SGE::CL_TEMPLATE_OBJECT_MANAGER< T, P >::UpdateID IDRefCst  _IDsrc,
IDRefCst  _IDnew
[inline]
 

Update the ID of an object. Look for the object, then look for if the new ID is free. If not return NULL. Then update the object ID.

Parameters:
_IDsrc => ID 1 of the object we want to update.
_IDnew => new ID 1 of the object.
Returns:
_Obj if ID update is successful, else false.


The documentation for this class was generated from the following file:
Generated on Mon Mar 19 23:15:16 2007 for SugoiTools by  doxygen 1.4.6-NO