IccMAX 2.1.27
Color Profile Tools
Loading...
Searching...
No Matches
CIccStructCreator Class Reference

#include <IccStructFactory.h>

Public Member Functions

 ~CIccStructCreator ()
 

Static Public Member Functions

static IIccStructCreateStruct (icStructSignature structTypeSig, CIccTagStruct *pTagStruct)
 
static icStructSignature GetStructSig (const icChar *structName)
 
static bool GetStructSigName (std::string &structName, icStructSignature structTypeSig, bool bFillUnknown=true)
 
static IIccStructFactoryPopFactory ()
 
static void PushFactory (IIccStructFactory *pFactory)
 

Private Member Functions

 CIccStructCreator ()
 
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 ()
 

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.

Constructor & Destructor Documentation

◆ ~CIccStructCreator()

CIccStructCreator::~CIccStructCreator ( )
166{
167 IIccStructFactory *pFactory = DoPopFactory(true);
168
169 while (pFactory) {
170 delete pFactory;
171 pFactory = DoPopFactory(true);
172 }
173}
Definition IccStructFactory.h:103
IIccStructFactory * DoPopFactory(bool bAll=false)
Definition IccStructFactory.cpp:229

References DoPopFactory().

+ Here is the call graph for this function:

◆ CIccStructCreator()

CIccStructCreator::CIccStructCreator ( )
inlineprivate

Only GetInstance() can create the singleton

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.

237 { return CIccStructCreator::GetInstance()->DoCreateStruct(structTypeSig, pTagStruct); }
static CIccStructCreator * GetInstance()
Definition IccStructFactory.cpp:175
IIccStruct * DoCreateStruct(icStructSignature structTypeSig, CIccTagStruct *pTagStruct=NULL)
Definition IccStructFactory.cpp:186

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
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}
Definition IccTagComposite.h:97
CIccStructFactoryList factoryStack
Definition IccStructFactory.h:329

References IIccStructFactory::CreateStruct(), and factoryStack.

Referenced by CreateStruct().

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

◆ DoGetStructSig()

icStructSignature CIccStructCreator::DoGetStructSig ( const char *  structName)
private
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
Definition icProfileHeader.h:598

References factoryStack, and IIccStructFactory::GetStructSig().

Referenced by GetStructSig().

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

◆ DoGetStructSigName()

bool CIccStructCreator::DoGetStructSigName ( std::string &  structName,
icStructSignature  structTypeSig,
bool  bFillUnknown = true 
)
private
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}

References factoryStack, and IIccStructFactory::GetStructSigName().

Referenced by GetStructSigName().

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

◆ DoPopFactory()

IIccStructFactory * CIccStructCreator::DoPopFactory ( bool  bAll = false)
private
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}

References factoryStack.

Referenced by ~CIccStructCreator(), and PopFactory().

+ Here is the caller graph for this function:

◆ DoPushFactory()

void CIccStructCreator::DoPushFactory ( IIccStructFactory pFactory)
private
225{
226 factoryStack.push_front(pFactory);
227}

References factoryStack.

Referenced by GetInstance(), and PushFactory().

+ Here is the caller graph for this function:

◆ 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.

176{
177 if (!theStructCreator.get()) {
179
180 theStructCreator->DoPushFactory(new CIccBasicStructFactory);
181 }
182
183 return theStructCreator.get();
184}
std::unique_ptr< CIccStructCreator > CIccStructCreatorPtr
Definition IccStructFactory.h:207
Definition IccStructFactory.h:165
Definition IccStructFactory.h:220
static CIccStructCreatorPtr theStructCreator
Definition IccStructFactory.h:327

References DoPushFactory(), and theStructCreator.

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

+ Here is the call graph for this function:
+ 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.

267 {
269 }
icStructSignature DoGetStructSig(const char *structName)
Definition IccStructFactory.cpp:211

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.

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

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.

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.

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

References DoPushFactory(), and GetInstance().

+ Here is the call graph for this function:

Field Documentation

◆ factoryStack

CIccStructFactoryList CIccStructCreator::factoryStack
private

◆ theStructCreator

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

Referenced by GetInstance().


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