/usr/include/SampleICC/IccMpeFactory.h is in libsampleicc-dev 1.6.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | /** @file
File: IccMpeFactory.h
Contains: Header for implementation of CIccMpeFactory class and
creation factories
Version: V1
Copyright: © see ICC Software License
*/
/*
* The ICC Software License, Version 0.2
*
*
* Copyright (c) 2005 The International Color Consortium. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. In the absence of prior written permission, the names "ICC" and "The
* International Color Consortium" must not be used to imply that the
* ICC organization endorses or promotes products derived from this
* software.
*
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE INTERNATIONAL COLOR CONSORTIUM OR
* ITS CONTRIBUTING MEMBERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the The International Color Consortium.
*
*
* Membership in the ICC is encouraged when this software is used for
* commercial purposes.
*
*
* For more information on The International Color Consortium, please
* see <http://www.color.org/>.
*
*
*/
//////////////////////////////////////////////////////////////////////
// HISTORY:
//
// -Feb 4, 2006
// A CIccMpeCreator singleton class has been added to provide general
// support for dynamically creating element classes using a element signature.
// Prototype and private element type support can be added to the system
// by pushing additional IIccMpeFactory based objects to the
// singleton CIccMpeCreator object.
//
// -Nov 6, 2006
// Merged into release
//
//////////////////////////////////////////////////////////////////////
#ifndef _ICCMPEFACTORY_H
#define _ICCMPEFACTORY_H
#include "IccDefs.h"
#include <memory>
#include <list>
//CIccProcessElement factory support
#ifdef USESAMPLEICCNAMESPACE
namespace sampleICC {
#endif
class CIccMultiProcessElement;
/**
***********************************************************************
* Class: IIccMpeFactory
*
* Purpose:
* IIccMpeFactory is a factory pattern interface for CIccProcessElement
* creation.
* This class is pure virtual.
***********************************************************************
*/
class ICCPROFLIB_API IIccMpeFactory
{
public:
virtual ~IIccMpeFactory() {}
/**
* Function: CreateElement(elemTypeSig)
* Create a element of type elemTypeSig.
*
* Parameter(s):
* elemTypeSig = signature of the ICC element type for the element to
* be created
*
* Returns a new CIccProcessElement object of the given signature type.
* If the element factory doesn't support creation of elements of type
* elemTypeSig then it should return NULL.
*/
virtual CIccMultiProcessElement* CreateElement(icElemTypeSignature elemTypeSig)=0;
/**
* Function: GetElementSigName(elemTypeSig)
* Get display name of elemTypeSig.
*
* Parameter(s):
* elemName = string to put element name into,
* elemTypeSig = signature of the ICC element type to get a name for
*
* Returns true if element type is recognized by the factory, false if
* the factory doesn't create elemTypeSig elements.
*/
virtual bool GetElementSigName(std::string &elemName, icElemTypeSignature elemTypeSig)=0;
};
//A CIccMpeFactoryList is used by CIccMpeCreator to keep track of element
//creation factories
typedef std::list<IIccMpeFactory*> CIccMpeFactoryList;
/**
***********************************************************************
* Class: CIccBasicMpeFactory
*
* Purpose:
* CIccBasicMpeFactory provides creation of CIccProcessElement's
* defined by the ICC profile specification. The CIccMpeCreator always
* creates a CIccBasicElemFactory.
***********************************************************************
*/
class CIccBasicMpeFactory : public IIccMpeFactory
{
public:
/**
* Function: CreateElement(elemTypeSig)
* Create a element of type elemTypeSig.
*
* Parameter(s):
* elemTypeSig = signature of the ICC element type for the element to be created
*
* Returns a new CIccProcessElement object of the given signature type.
* Unrecognized elemTypeSig's will be created as a CIccProcessElementUnknown object.
*/
virtual CIccMultiProcessElement* CreateElement(icElemTypeSignature elementSig);
/**
* Function: GetElementSigName(elemTypeSig)
* Get display name of elemTypeSig.
*
* Parameter(s):
* elemName = string to put element name into,
* elemTypeSig = signature of the ICC element type to get a name for
*
* Returns true if element type is recognized by the factory, false if the
* factory doesn't create elemTypeSig elements.
*/
virtual bool GetElementSigName(std::string &elemName, icElemTypeSignature elemTypeSig);
};
class CIccMpeCreator;
typedef std::auto_ptr<CIccMpeCreator> CIccMpeCreatorPtr;
/**
***********************************************************************
* Class: CIccMpeCreator
*
* Purpose:
* CIccMpeCreator uses a singleton pattern to provide dynamically
* upgradeable CIccProcessElement derived object creation based on
* element signature.
***********************************************************************
*/
class CIccMpeCreator
{
public:
~CIccMpeCreator();
/**
* Function: CreateElement(elemTypeSig)
* Create a element of type elemTypeSig.
*
* Parameter(s):
* elemTypeSig = signature of the ICC element type for the element to
* be created
*
* Returns a new CIccProcessElement object of the given signature type.
* Each factory in the factoryStack is used until a factory supports the
* signature type.
*/
static CIccMultiProcessElement* CreateElement(icElemTypeSignature elemTypeSig)
{ return CIccMpeCreator::GetInstance()->DoCreateElement(elemTypeSig); }
/**
* Function: GetElementSigName(elemTypeSig)
* Get display name of elemTypeSig.
*
* Parameter(s):
* elemName = string to put element name into
* elemTypeSig = signature of the ICC element type to get a name for
*
* Returns true if element type is recognized by any factory, false if all
* factories do not create elemTypeSig elements. If element type is not
* recognized by any factories a suitable display name will be placed in
* elemName.
*/
static bool GetElementSigName(std::string &elemName, icElemTypeSignature elemTypeSig)
{ return CIccMpeCreator::GetInstance()->DoGetElementSigName(elemName, elemTypeSig); }
/**
* Function: PushFactory(pFactory)
* Add an IIccMpeFactory to the stack of element factories tracked by
* the system.
*
* Parameter(s):
* pFactory = pointer to an IIccMpeFactory object to add to the
* system. The pFactory must be created with new, and will be owned
* CIccMpeCreator until popped off the stack using PopFactory().
* Any factories not popped off will be taken care of properly on
* application shutdown.
*
*/
static void PushFactory(IIccMpeFactory *pFactory)
{ CIccMpeCreator::GetInstance()->CIccMpeCreator::DoPushFactory(pFactory); }
/**
* Function: PopFactory()
* Remove the top IIccMpeFactory from the stack of element factories
* tracked by the system.
*
* Parameter(s):
* None
*
* Returns the top IIccMpeFactory 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.
*/
static IIccMpeFactory* PopFactory()
{ return CIccMpeCreator::GetInstance()->DoPopFactory(); }
private:
/**Only GetInstance() can create the singleton*/
CIccMpeCreator() { }
/**
* Function: GetInstance()
* Private static function to access singleton CiccElementCreator Object.
*
* Parameter(s):
* None
*
* Returns the singleton CIccMpeCreator object. It will allocate
* a new one and push a single CIccSpecElement Factory object onto the
* factory stack if the singleton has not been intialized.
*/
static CIccMpeCreator* GetInstance();
CIccMultiProcessElement* DoCreateElement(icElemTypeSignature elemTypeSig);
bool DoGetElementSigName(std::string &elemName, icElemTypeSignature elemTypeSig);
void DoPushFactory(IIccMpeFactory *pFactory);
IIccMpeFactory* DoPopFactory(bool bAll=false);
static CIccMpeCreatorPtr theElementCreator;
CIccMpeFactoryList factoryStack;
};
#ifdef USESAMPLEICCNAMESPACE
} //namespace sampleICC
#endif
#endif //_ICCMPEFACTORY_H
|