SampleICC Main srcforge
Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

IccMpeFactory.h

Go to the documentation of this file.
00001 
00012 /*
00013  * The ICC Software License, Version 0.1
00014  *
00015  *
00016  * Copyright (c) 2005 The International Color Consortium. All rights 
00017  * reserved.
00018  *
00019  * Redistribution and use in source and binary forms, with or without
00020  * modification, are permitted provided that the following conditions
00021  * are met:
00022  *
00023  * 1. Redistributions of source code must retain the above copyright
00024  *    notice, this list of conditions and the following disclaimer. 
00025  *
00026  * 2. Redistributions in binary form must reproduce the above copyright
00027  *    notice, this list of conditions and the following disclaimer in
00028  *    the documentation and/or other materials provided with the
00029  *    distribution.
00030  *
00031  * 3. The end-user documentation included with the redistribution,
00032  *    if any, must include the following acknowledgment:  
00033  *       "This product includes software developed by the
00034  *        The International Color Consortium (www.color.org)"
00035  *    Alternately, this acknowledgment may appear in the software itself,
00036  *    if and wherever such third-party acknowledgments normally appear.
00037  *
00038  * 4. In the absence of prior written permission, the names "ICC" and "The
00039  *    International Color Consortium" must not be used to imply that the
00040  *    ICC organization endorses or promotes products derived from this
00041  *    software.
00042  *
00043  *
00044  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
00045  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00046  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00047  * DISCLAIMED.  IN NO EVENT SHALL THE INTERNATIONAL COLOR CONSORTIUM OR
00048  * ITS CONTRIBUTING MEMBERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00049  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00050  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
00051  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00052  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00053  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
00054  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00055  * SUCH DAMAGE.
00056  * ====================================================================
00057  *
00058  * This software consists of voluntary contributions made by many
00059  * individuals on behalf of the The International Color Consortium. 
00060  *
00061  *
00062  * Membership in the ICC is encouraged when this software is used for
00063  * commercial purposes. 
00064  *
00065  *  
00066  * For more information on The International Color Consortium, please
00067  * see <http://www.color.org/>.
00068  *  
00069  * 
00070  */
00071 
00073 // HISTORY:
00074 //
00075 // -Feb 4, 2006 
00076 //  A CIccMpeCreator singleton class has been added to provide general
00077 //  support for dynamically creating element classes using a element signature.
00078 //  Prototype and private element type support can be added to the system
00079 //  by pushing additional IIccMpeFactory based objects to the 
00080 //  singleton CIccMpeCreator object.
00081 //
00082 // -Nov 6, 2006
00083 //  Merged into release
00084 //
00086 
00087 #ifndef _ICCMPEFACTORY_H
00088 #define _ICCMPEFACTORY_H
00089 
00090 #include "IccDefs.h"
00091 #include <memory>
00092 #include <list>
00093 
00094 //CIccProcessElement factory support
00095 #ifdef USESAMPLEICCNAMESPACE
00096 namespace sampleICC {
00097 #endif
00098 
00099 class CIccMultiProcessElement;
00100 
00111 class ICCPROFLIB_API IIccMpeFactory 
00112 {
00113 public:
00114   virtual ~IIccMpeFactory() {}
00115 
00128   virtual CIccMultiProcessElement* CreateElement(icElemTypeSignature elemTypeSig)=0;
00129 
00141   virtual bool GetElementSigName(std::string &elemName, icElemTypeSignature elemTypeSig)=0;
00142 };
00143 
00144 
00145 //A CIccMpeFactoryList is used by CIccMpeCreator to keep track of element
00146 //creation factories
00147 typedef std::list<IIccMpeFactory*> CIccMpeFactoryList;
00148 
00149 
00160 class CIccBasicMpeFactory : public IIccMpeFactory
00161 {
00162 public:
00173   virtual CIccMultiProcessElement* CreateElement(icElemTypeSignature elementSig);
00174 
00186   virtual bool GetElementSigName(std::string &elemName, icElemTypeSignature elemTypeSig);
00187 };
00188 
00189 class CIccMpeCreator;
00190 
00191 typedef std::auto_ptr<CIccMpeCreator> CIccMpeCreatorPtr;
00192 
00203 class CIccMpeCreator 
00204 {
00205 public:
00206   ~CIccMpeCreator();
00207 
00220   static CIccMultiProcessElement* CreateElement(icElemTypeSignature elemTypeSig)
00221       { return CIccMpeCreator::GetInstance()->DoCreateElement(elemTypeSig); }
00222 
00236   static bool GetElementSigName(std::string &elemName, icElemTypeSignature elemTypeSig)
00237       { return CIccMpeCreator::GetInstance()->DoGetElementSigName(elemName, elemTypeSig); }
00238 
00252   static void PushFactory(IIccMpeFactory *pFactory)
00253       { CIccMpeCreator::GetInstance()->CIccMpeCreator::DoPushFactory(pFactory); }
00254 
00269   static IIccMpeFactory* PopFactory()
00270       { return CIccMpeCreator::GetInstance()->DoPopFactory(); }
00271 
00272 private:
00274   CIccMpeCreator() { }
00275 
00287   static CIccMpeCreator* GetInstance();
00288 
00289   CIccMultiProcessElement* DoCreateElement(icElemTypeSignature elemTypeSig);
00290   bool DoGetElementSigName(std::string &elemName, icElemTypeSignature elemTypeSig);
00291   void DoPushFactory(IIccMpeFactory *pFactory);
00292   IIccMpeFactory* DoPopFactory(bool bAll=false);
00293 
00294   static CIccMpeCreatorPtr theElementCreator; 
00295 
00296   CIccMpeFactoryList factoryStack;
00297 };
00298 
00299 #ifdef USESAMPLEICCNAMESPACE
00300 } //namespace sampleICC
00301 #endif
00302 
00303 #endif //_ICCMPEFACTORY_H

Generated on Tue Jun 26 17:51:43 2007 for IccProfLib by  doxygen 1.3.9.1