Hoyt's FORK of DemoIccMAX 2.1.17.hoyt
Documentation for Hoyt's FORK of DemoIccMAX
Loading...
Searching...
No Matches
CIccStructCreator Class Reference

Class: CIccStructCreator. More...

#include <IccStructFactory.h>

+ Collaboration diagram for CIccStructCreator:

Public Member Functions

 ~CIccStructCreator ()
 

Static Public Member Functions

static IIccStructCreateStruct (icStructSignature structTypeSig, CIccTagStruct *pTagStruct)
 Function: CreateStruct(structTypeSig) Create a element of type structTypeSig.
 
static icStructSignature GetStructSig (const icChar *structName)
 Function: GetStructSig(structName) Get signature of structure from display name.
 
static bool GetStructSigName (std::string &structName, icStructSignature structTypeSig, bool bFillUnknown=true)
 Function: GetStructSigName(structTypeSig) Get display name of structTypeSig.
 
static IIccStructFactoryPopFactory ()
 Function: PopFactory() Remove the top IIccStructFactory from the stack of element factories tracked by the system.
 
static void PushFactory (IIccStructFactory *pFactory)
 Function: PushFactory(pFactory) Add an IIccStructFactory to the stack of element factories tracked by the system.
 

Private Member Functions

 CIccStructCreator ()
 Only GetInstance() can create the singleton.
 
IIccStructDoCreateStruct (icStructSignature structTypeSig, CIccTagStruct *pTagStruct=NULL)
 
icStructSignature DoGetStructSig (const char *structName)
 
bool DoGetStructSigName (std::string &structName, icStructSignature structTypeSig, bool bFillUnknown=true)
 
IIccStructFactoryDoPopFactory (bool bAll=false)
 
void DoPushFactory (IIccStructFactory *pFactory)
 

Static Private Member Functions

static CIccStructCreatorGetInstance ()
 Function: GetInstance() Private static function to access singleton CiccStructCreator Object.
 

Private Attributes

CIccStructFactoryList factoryStack
 

Static Private Attributes

static CIccStructCreatorPtr theStructCreator
 

Detailed Description

Class: CIccStructCreator.

Purpose: CIccStructCreator uses a singleton pattern to provide dynamically upgradeable IIccStructObject derived object creation based on element signature.

Definition at line 219 of file IccStructFactory.h.

Constructor & Destructor Documentation

◆ ~CIccStructCreator()

CIccStructCreator::~CIccStructCreator ( )

Definition at line 165 of file IccStructFactory.cpp.

166{
167 IIccStructFactory *pFactory = DoPopFactory(true);
168
169 while (pFactory) {
170 delete pFactory;
171 pFactory = DoPopFactory(true);
172 }
173}
IIccStructFactory * DoPopFactory(bool bAll=false)
Class: IIccStructFactory.

◆ CIccStructCreator()

CIccStructCreator::CIccStructCreator ( )
inlineprivate

Only GetInstance() can create the singleton.

Definition at line 306 of file IccStructFactory.h.

306{ }

Member Function Documentation

◆ CreateStruct()

static IIccStruct * CIccStructCreator::CreateStruct ( icStructSignature structTypeSig,
CIccTagStruct * pTagStruct )
inlinestatic

Function: CreateStruct(structTypeSig) Create a element of type structTypeSig.

Parameter(s): structTypeSig = signature of the ICC element type for the element to be created

Returns a new CIccProcessStruct object of the given signature type. Each factory in the factoryStack is used until a factory supports the signature type.

Definition at line 236 of file IccStructFactory.h.

237 { return CIccStructCreator::GetInstance()->DoCreateStruct(structTypeSig, pTagStruct); }
static CIccStructCreator * GetInstance()
Function: GetInstance() Private static function to access singleton CiccStructCreator Object.
IIccStruct * DoCreateStruct(icStructSignature structTypeSig, CIccTagStruct *pTagStruct=NULL)

References DoCreateStruct(), and GetInstance().

Referenced by CIccTagStruct::Describe(), CIccTagStruct::GetStructHandler(), and CIccTagStruct::SetTagStructType().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoCreateStruct()

IIccStruct * CIccStructCreator::DoCreateStruct ( icStructSignature structTypeSig,
CIccTagStruct * pTagStruct = NULL )
private

Definition at line 186 of file IccStructFactory.cpp.

187{
188 CIccStructFactoryList::iterator i;
189 IIccStruct *rv = NULL;
190
191 for (i=factoryStack.begin(); i!=factoryStack.end(); i++) {
192 rv = (*i)->CreateStruct(structTypeSig, pTagStruct);
193 if (rv)
194 break;
195 }
196 return rv;
197}
CIccStructFactoryList factoryStack
Class: IIccStruct.

Referenced by CreateStruct().

+ Here is the caller graph for this function:

◆ DoGetStructSig()

icStructSignature CIccStructCreator::DoGetStructSig ( const char * structName)
private

Definition at line 211 of file IccStructFactory.cpp.

212{
213 CIccStructFactoryList::iterator i;
214
215 for (i = factoryStack.begin(); i != factoryStack.end(); i++) {
216 icStructSignature rv = (*i)->GetStructSig(structName);
217 if (rv)
218 return rv;
219 }
220
221 return (icStructSignature)0;
222}
icStructSignature
Tag Structure type signatures.

Referenced by GetStructSig().

+ Here is the caller graph for this function:

◆ DoGetStructSigName()

bool CIccStructCreator::DoGetStructSigName ( std::string & structName,
icStructSignature structTypeSig,
bool bFillUnknown = true )
private

Definition at line 199 of file IccStructFactory.cpp.

200{
201 CIccStructFactoryList::iterator i;
202
203 for (i=factoryStack.begin(); i!=factoryStack.end(); i++) {
204 if ((*i)->GetStructSigName(structName, structTypeSig, bFillUnknown))
205 return true;
206 }
207
208 return false;
209}

Referenced by GetStructSigName().

+ Here is the caller graph for this function:

◆ DoPopFactory()

IIccStructFactory * CIccStructCreator::DoPopFactory ( bool bAll = false)
private

Definition at line 229 of file IccStructFactory.cpp.

230{
231 if (factoryStack.size()>0) {
232 CIccStructFactoryList::iterator i=factoryStack.begin();
233 IIccStructFactory* rv = (*i);
234 factoryStack.pop_front();
235 return rv;
236 }
237 return NULL;
238}

Referenced by PopFactory().

+ Here is the caller graph for this function:

◆ DoPushFactory()

void CIccStructCreator::DoPushFactory ( IIccStructFactory * pFactory)
private

Definition at line 224 of file IccStructFactory.cpp.

225{
226 factoryStack.push_front(pFactory);
227}

◆ GetInstance()

CIccStructCreator * CIccStructCreator::GetInstance ( )
staticprivate

Function: GetInstance() Private static function to access singleton CiccStructCreator Object.

Parameter(s): None

Returns the singleton CIccStructCreator object. It will allocate a new one and push a single CIccSpecStruct Factory object onto the factory stack if the singleton has not been intialized.

Definition at line 175 of file IccStructFactory.cpp.

176{
177 if (!theStructCreator.get()) {
179
180 theStructCreator->DoPushFactory(new CIccBasicStructFactory);
181 }
182
183 return theStructCreator.get();
184}
std::unique_ptr< CIccStructCreator > CIccStructCreatorPtr
Class: CIccBasicStructFactory.
Class: CIccStructCreator.
static CIccStructCreatorPtr theStructCreator

Referenced by CreateStruct(), GetStructSig(), GetStructSigName(), PopFactory(), and PushFactory().

+ Here is the caller graph for this function:

◆ GetStructSig()

static icStructSignature CIccStructCreator::GetStructSig ( const icChar * structName)
inlinestatic

Function: GetStructSig(structName) Get signature of structure from display name.

Parameter(s): structName = struct display name

Returns signature of structure if it is recognized by any factory, 0 if the all the factories don't create a structure with such a display name.

Definition at line 266 of file IccStructFactory.h.

267 {
269 }
icStructSignature DoGetStructSig(const char *structName)

References DoGetStructSig(), and GetInstance().

Referenced by CIccTagXmlStruct::ParseXml().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetStructSigName()

static bool CIccStructCreator::GetStructSigName ( std::string & structName,
icStructSignature structTypeSig,
bool bFillUnknown = true )
inlinestatic

Function: GetStructSigName(structTypeSig) Get display name of structTypeSig.

Parameter(s): structName = string to put struct name into structTypeSig = signature of the ICC struct type to get a name for bFillUnknown = flag to indicate structName is filled if not found

Returns true if struct type is recognized by any factory, false if all factories do not create structTypeSig structs. If struct type is not recognized by any factories a suitable display name will be placed in structName if bFillUknown is true.

Definition at line 253 of file IccStructFactory.h.

254 { return CIccStructCreator::GetInstance()->DoGetStructSigName(structName, structTypeSig, bFillUnknown); }
bool DoGetStructSigName(std::string &structName, icStructSignature structTypeSig, bool bFillUnknown=true)

References DoGetStructSigName(), and GetInstance().

Referenced by CIccTagStruct::Describe(), and CIccInfo::GetStructSigName().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PopFactory()

static IIccStructFactory * CIccStructCreator::PopFactory ( )
inlinestatic

Function: PopFactory() Remove the top IIccStructFactory from the stack of element factories tracked by the system.

Parameter(s): None

Returns the top IIccStructFactory from the stack of element factories tracked by the system. The returned element factory is no longer owned by the system and needs to be deleted to avoid memory leaks.

Note: The initial CIccBasicElemFactory cannot be popped off the stack.

Definition at line 301 of file IccStructFactory.h.

References DoPopFactory(), and GetInstance().

+ Here is the call graph for this function:

◆ PushFactory()

static void CIccStructCreator::PushFactory ( IIccStructFactory * pFactory)
inlinestatic

Function: PushFactory(pFactory) Add an IIccStructFactory to the stack of element factories tracked by the system.

Parameter(s): pFactory = pointer to an IIccStructFactory object to add to the system. The pFactory must be created with new, and will be owned CIccStructCreator until popped off the stack using PopFactory(). Any factories not popped off will be taken care of properly on application shutdown.

Definition at line 284 of file IccStructFactory.h.

285 { CIccStructCreator::GetInstance()->CIccStructCreator::DoPushFactory(pFactory); }

References GetInstance().

+ Here is the call graph for this function:

Member Data Documentation

◆ factoryStack

CIccStructFactoryList CIccStructCreator::factoryStack
private

Definition at line 329 of file IccStructFactory.h.

◆ theStructCreator

std::unique_ptr< CIccStructCreator > CIccStructCreator::theStructCreator
staticprivate

Definition at line 327 of file IccStructFactory.h.


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