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

Class: CIccArrayCreator. More...

#include <IccArrayFactory.h>

+ Collaboration diagram for CIccArrayCreator:

Public Member Functions

 ~CIccArrayCreator ()
 

Static Public Member Functions

static IIccArrayCreateArray (icArraySignature arrayTypeSig, CIccTagArray *pTagArray=NULL)
 Function: CreateArray(structTypeSig) Create a element of type structTypeSig.
 
static icArraySignature GetArraySig (const icChar *arrayName)
 Function: GetArraySig(arrayName) Get signature associate with display name arrayName handler.
 
static bool GetArraySigName (std::string &arrayName, icArraySignature arrayTypeSig, bool bFillUnknown=true)
 Function: GetArraySigName(structTypeSig) Get display name of structTypeSig.
 
static IIccArrayFactoryPopFactory ()
 Function: PopFactory() Remove the top IIccArrayFactory from the stack of element factories tracked by the system.
 
static void PushFactory (IIccArrayFactory *pFactory)
 Function: PushFactory(pFactory) Add an IIccArrayFactory to the stack of element factories tracked by the system.
 

Private Member Functions

 CIccArrayCreator ()
 Only GetInstance() can create the singleton.
 
IIccArrayDoCreateArray (icArraySignature arrayTypeSig, CIccTagArray *pArray)
 
icArraySignature DoGetArraySig (const icChar *arrayName)
 
bool DoGetArraySigName (std::string &arrayName, icArraySignature arrayTypeSig, bool bFillUnknown=true)
 
IIccArrayFactoryDoPopFactory (bool bAll=false)
 
void DoPushFactory (IIccArrayFactory *pFactory)
 

Static Private Member Functions

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

Private Attributes

CIccArrayFactoryList factoryStack
 

Static Private Attributes

static CIccArrayCreatorPtr theArrayCreator
 

Detailed Description

Class: CIccArrayCreator.

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

Definition at line 220 of file IccArrayFactory.h.

Constructor & Destructor Documentation

◆ ~CIccArrayCreator()

CIccArrayCreator::~CIccArrayCreator ( )

Definition at line 145 of file IccArrayFactory.cpp.

146{
147 IIccArrayFactory *pFactory = DoPopFactory(true);
148
149 while (pFactory) {
150 delete pFactory;
151 pFactory = DoPopFactory(true);
152 }
153}
IIccArrayFactory * DoPopFactory(bool bAll=false)
Class: IIccArrayFactory.

◆ CIccArrayCreator()

CIccArrayCreator::CIccArrayCreator ( )
inlineprivate

Only GetInstance() can create the singleton.

Definition at line 306 of file IccArrayFactory.h.

306{ }

Member Function Documentation

◆ CreateArray()

static IIccArray * CIccArrayCreator::CreateArray ( icArraySignature arrayTypeSig,
CIccTagArray * pTagArray = NULL )
inlinestatic

Function: CreateArray(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 CIccProcessArray object of the given signature type. Each factory in the factoryStack is used until a factory supports the signature type.

Definition at line 237 of file IccArrayFactory.h.

238 { return CIccArrayCreator::GetInstance()->DoCreateArray(arrayTypeSig, pTagArray); }
IIccArray * DoCreateArray(icArraySignature arrayTypeSig, CIccTagArray *pArray)
static CIccArrayCreator * GetInstance()
Function: GetInstance() Private static function to access singleton CiccArrayCreator Object.

References DoCreateArray(), and GetInstance().

Referenced by CIccTagArray::GetArrayHandler(), and CIccTagArray::SetTagArrayType().

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

◆ DoCreateArray()

IIccArray * CIccArrayCreator::DoCreateArray ( icArraySignature arrayTypeSig,
CIccTagArray * pArray )
private

Definition at line 166 of file IccArrayFactory.cpp.

167{
168 CIccArrayFactoryList::iterator i;
169 IIccArray *rv = NULL;
170
171 for (i=factoryStack.begin(); i!=factoryStack.end(); i++) {
172 rv = (*i)->CreateArray(arrayTypeSig, pTagArray);
173 if (rv)
174 break;
175 }
176 return rv;
177}
CIccArrayFactoryList factoryStack
Class: IIccArray.

Referenced by CreateArray().

+ Here is the caller graph for this function:

◆ DoGetArraySig()

icArraySignature CIccArrayCreator::DoGetArraySig ( const icChar * arrayName)
private

Definition at line 191 of file IccArrayFactory.cpp.

192{
193 CIccArrayFactoryList::iterator i;
194
195 for (i = factoryStack.begin(); i != factoryStack.end(); i++) {
196 icArraySignature rv = (*i)->GetArraySig(structName);
197 if (rv)
198 return rv;
199 }
200
201 return (icArraySignature)0;
202}
icArraySignature
Tag Array type signatures.

Referenced by GetArraySig().

+ Here is the caller graph for this function:

◆ DoGetArraySigName()

bool CIccArrayCreator::DoGetArraySigName ( std::string & arrayName,
icArraySignature arrayTypeSig,
bool bFillUnknown = true )
private

Definition at line 179 of file IccArrayFactory.cpp.

180{
181 CIccArrayFactoryList::iterator i;
182
183 for (i=factoryStack.begin(); i!=factoryStack.end(); i++) {
184 if ((*i)->GetArraySigName(arrayName, arrayTypeSig, bFillUnknown))
185 return true;
186 }
187
188 return false;
189}

Referenced by GetArraySigName().

+ Here is the caller graph for this function:

◆ DoPopFactory()

IIccArrayFactory * CIccArrayCreator::DoPopFactory ( bool bAll = false)
private

Definition at line 210 of file IccArrayFactory.cpp.

211{
212 if (factoryStack.size()>0) {
213 CIccArrayFactoryList::iterator i=factoryStack.begin();
214 IIccArrayFactory* rv = (*i);
215 factoryStack.pop_front();
216 return rv;
217 }
218 return NULL;
219}

Referenced by PopFactory().

+ Here is the caller graph for this function:

◆ DoPushFactory()

void CIccArrayCreator::DoPushFactory ( IIccArrayFactory * pFactory)
private

Definition at line 205 of file IccArrayFactory.cpp.

206{
207 factoryStack.push_front(pFactory);
208}

◆ GetArraySig()

static icArraySignature CIccArrayCreator::GetArraySig ( const icChar * arrayName)
inlinestatic

Function: GetArraySig(arrayName) Get signature associate with display name arrayName handler.

Parameter(s): arrayName = string to find signature for

Returns array signuture if arrayName arrays are recognized by any factory, 0 if all factories do not create arrayName arrays.

Definition at line 268 of file IccArrayFactory.h.

269 { return CIccArrayCreator::GetInstance()->DoGetArraySig(arrayName); }
icArraySignature DoGetArraySig(const icChar *arrayName)

References DoGetArraySig(), and GetInstance().

Referenced by CIccTagXmlArray::ParseXml().

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

◆ GetArraySigName()

static bool CIccArrayCreator::GetArraySigName ( std::string & arrayName,
icArraySignature arrayTypeSig,
bool bFillUnknown = true )
inlinestatic

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

Parameter(s): arrayName = string to put struct name into arrayTypeSig = signature of the ICC struct type to get a name for bFillUnknown = flag to fill in arrayName if arryTypeSig is unknown

Returns true if struct type is recognized by any factory, false if all factories do not create arrayTypeSig arrays. If arrayTypeSig is not recognized by any factories a suitable display name will be placed in arrayName if bFindUnkown is true (otherwise arrayName will be empty).

Definition at line 254 of file IccArrayFactory.h.

255 { return CIccArrayCreator::GetInstance()->DoGetArraySigName(arrayName, arrayTypeSig, bFillUnknown); }
bool DoGetArraySigName(std::string &arrayName, icArraySignature arrayTypeSig, bool bFillUnknown=true)

References DoGetArraySigName(), and GetInstance().

Referenced by CIccTagArray::Describe(), CIccInfo::GetArraySigName(), and CIccTagXmlArray::ToXml().

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

◆ GetInstance()

CIccArrayCreator * CIccArrayCreator::GetInstance ( )
staticprivate

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

Parameter(s): None

Returns the singleton CIccArrayCreator object. It will allocate a new one and push a single CIccSpecArray Factory object onto the factory stack if the singleton has not been initialized.

Definition at line 155 of file IccArrayFactory.cpp.

156{
157 if (!theArrayCreator.get()) {
159
160 theArrayCreator->DoPushFactory(new CIccBasicArrayFactory);
161 }
162
163 return theArrayCreator.get();
164}
std::unique_ptr< CIccArrayCreator > CIccArrayCreatorPtr
Class: CIccArrayCreator.
static CIccArrayCreatorPtr theArrayCreator
Class: CIccBasicArrayFactory.

Referenced by CreateArray(), GetArraySig(), GetArraySigName(), PopFactory(), and PushFactory().

+ Here is the caller graph for this function:

◆ PopFactory()

static IIccArrayFactory * CIccArrayCreator::PopFactory ( )
inlinestatic

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

Parameter(s): None

Returns the top IIccArrayFactory 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 IccArrayFactory.h.

References DoPopFactory(), and GetInstance().

+ Here is the call graph for this function:

◆ PushFactory()

static void CIccArrayCreator::PushFactory ( IIccArrayFactory * pFactory)
inlinestatic

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

Parameter(s): pFactory = pointer to an IIccArrayFactory object to add to the system. The pFactory must be created with new, and will be owned CIccArrayCreator 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 IccArrayFactory.h.

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

References GetInstance().

+ Here is the call graph for this function:

Member Data Documentation

◆ factoryStack

CIccArrayFactoryList CIccArrayCreator::factoryStack
private

Definition at line 329 of file IccArrayFactory.h.

◆ theArrayCreator

std::unique_ptr< CIccArrayCreator > CIccArrayCreator::theArrayCreator
staticprivate

Definition at line 327 of file IccArrayFactory.h.


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