soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SObjectFactoryMgr Class Reference

Manager for object factories. More...

#include <SObjectFactory.h>

Inheritance diagram for SObjectFactoryMgr:
SCmnMap< SObjectFactoryPtr, SObjectInfo > SApplication

Public Member Functions

 SObjectFactoryMgr (void)
 Constructor for SObjectFactoryMgr.
 
BOOL RegisterFactory (const IObjectFactory *objFactory, BOOL bReplace=false)
 Registers an object factory.
 
BOOL UnregisterFactory (const SObjectInfo &objInfo)
 Unregisters an object factory.
 
void SetSwndDefAttr (IObject *pObject) const
 Sets default attributes for a given object.
 
SObjectInfo BaseObjectInfoFromObjectInfo (const SObjectInfo &objInfo)
 Gets the base object information from a given object information.
 
template<class T>
BOOL TplRegisterFactory ()
 Template method to register a factory for a specific object type.
 
template<class T>
BOOL TplUnregisterFactory ()
 Template method to unregister a factory for a specific object type.
 
- Public Member Functions inherited from SCmnMap< SObjectFactoryPtr, SObjectInfo >
 SCmnMap (void(*funOnKeyRemoved)(const SObjectFactoryPtr &)=NULL)
 Constructor.
 
virtual ~SCmnMap ()
 Destructor.
 
bool HasKey (const SObjectInfo &key) const
 Checks if a key exists in the map.
 
bool GetKeyObject (const SObjectInfo &key, SObjectFactoryPtr &obj) const
 Retrieves an object associated with a key.
 
SObjectFactoryPtr & GetKeyObject (const SObjectInfo &key) const
 Retrieves an object associated with a key.
 
bool AddKeyObject (const SObjectInfo &key, const SObjectFactoryPtr &obj)
 Adds a key-object pair to the map.
 
void SetKeyObject (const SObjectInfo &key, const SObjectFactoryPtr &obj)
 Sets an object for a key, replacing any existing object.
 
bool RemoveKeyObject (const SObjectInfo &key)
 Removes a key-object pair from the map.
 
void RemoveAll ()
 Removes all key-object pairs from the map.
 
size_t GetCount ()
 Gets the number of key-object pairs in the map.
 

Protected Member Functions

virtual IObject * CreateObject (const SObjectInfo &objInfo) const
 Creates an object based on the given object information.
 
virtual IObject * OnCreateUnknownObject (const SObjectInfo &objInfo) const
 Handles the creation of an unknown object.
 

Static Protected Member Functions

static void OnFactoryRemoved (const SObjectFactoryPtr &obj)
 Static callback for when a factory is removed.
 

Additional Inherited Members

- Protected Attributes inherited from SCmnMap< SObjectFactoryPtr, SObjectInfo >
void(* m_pFunOnKeyRemoved )(const SObjectFactoryPtr &obj)
 
SMap< SObjectInfo, SObjectFactoryPtr > * m_mapNamedObj
 

Detailed Description

Manager for object factories.

Description: Manages the registration, unregistration, and creation of objects using factories.

Definition at line 142 of file SObjectFactory.h.

Constructor & Destructor Documentation

◆ SObjectFactoryMgr()

SObjectFactoryMgr::SObjectFactoryMgr ( void )

Constructor for SObjectFactoryMgr.

Definition at line 25 of file SObjectFactory.cpp.

Member Function Documentation

◆ BaseObjectInfoFromObjectInfo()

SObjectInfo SObjectFactoryMgr::BaseObjectInfoFromObjectInfo ( const SObjectInfo & objInfo)

Gets the base object information from a given object information.

Parameters
objInfoObject information structure.
Returns
Base object information structure.

Definition at line 91 of file SObjectFactory.cpp.

◆ CreateObject()

IObject * SObjectFactoryMgr::CreateObject ( const SObjectInfo & objInfo) const
protectedvirtual

Creates an object based on the given object information.

Parameters
objInfoObject information structure.
Returns
Pointer to the created object.

Definition at line 79 of file SObjectFactory.cpp.

◆ OnCreateUnknownObject()

IObject * SObjectFactoryMgr::OnCreateUnknownObject ( const SObjectInfo & objInfo) const
protectedvirtual

Handles the creation of an unknown object.

Parameters
objInfoObject information structure.
Returns
Pointer to the created object.

Definition at line 140 of file SObjectFactory.cpp.

◆ OnFactoryRemoved()

void SObjectFactoryMgr::OnFactoryRemoved ( const SObjectFactoryPtr & obj)
staticprotected

Static callback for when a factory is removed.

Parameters
objPointer to the object factory.

Definition at line 61 of file SObjectFactory.cpp.

◆ RegisterFactory()

BOOL SObjectFactoryMgr::RegisterFactory ( const IObjectFactory * objFactory,
BOOL bReplace = false )

Registers an object factory.

Parameters
objFactoryPointer to the object factory.
bReplaceFlag to replace existing factory if it exists.
Returns
TRUE if registration is successful, FALSE otherwise.

Definition at line 38 of file SObjectFactory.cpp.

◆ SetSwndDefAttr()

void SObjectFactoryMgr::SetSwndDefAttr ( IObject * pObject) const

Sets default attributes for a given object.

Parameters
pObjectPointer to the object.

Definition at line 105 of file SObjectFactory.cpp.

◆ TplRegisterFactory()

template<class T>
BOOL SObjectFactoryMgr::TplRegisterFactory ( )
inline

Template method to register a factory for a specific object type.

Template Parameters
TType of the object.
Returns
TRUE if registration is successful, FALSE otherwise.

Definition at line 183 of file SObjectFactory.h.

◆ TplUnregisterFactory()

template<class T>
BOOL SObjectFactoryMgr::TplUnregisterFactory ( )
inline

Template method to unregister a factory for a specific object type.

Template Parameters
TType of the object.
Returns
TRUE if unregistration is successful, FALSE otherwise.

Definition at line 195 of file SObjectFactory.h.

◆ UnregisterFactory()

BOOL SObjectFactoryMgr::UnregisterFactory ( const SObjectInfo & objInfo)

Unregisters an object factory.

Parameters
objInfoObject information structure.
Returns
TRUE if unregistration is successful, FALSE otherwise.

Definition at line 74 of file SObjectFactory.cpp.


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