Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

HalftonerFactory.h

Go to the documentation of this file.
00001 /*
00002  * @(#)include/HalftonerFactory.h  1.0  2002-07-21 22:13
00003  *
00004  * Copyright (C)  2002  Daniel Léonard
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00019  */
00020 
00026 #ifndef _HALFTONER_FACTORY_H_
00027 #define _HALFTONER_FACTORY_H_
00028 
00029 #include <map>
00030 #include <stdexcept>
00031 
00032 namespace halftoner
00033 {
00034    class Halftoner;
00035    class Instanciator;
00036 
00044    class HalftonerFactory
00045    {
00046       private:
00054          class Repository
00055          {
00056             private:
00059 
00060                std::map<const char*, const Instanciator*> depot;
00061 //\}
00062 
00063             public:
00069                Repository() throw();
00073                ~Repository() throw();
00074 
00077 
00087                void add(const char* name, const Instanciator* instanciator) throw (std::invalid_argument);
00088 
00096                const Instanciator* get(const char* key) throw ();
00098 
00099             private:
00102 
00106                std::map<const char*, const Instanciator*>& getMap() throw();
00108          };
00109 
00112       private:
00114          static HalftonerFactory::Repository repository;
00115 
00116       public:
00118          static const char* FLOYD_STEINBERG;
00120          static const char* JARVIS_JUDICE_NINKE;
00122          static const char* STUCKI;
00124          static const char* VG91;
00126          static const char* VG95;
00128          static const char* VGEXP;
00129 //\}
00130 
00131       private:
00134 
00137          HalftonerFactory() throw();
00138 
00142          HalftonerFactory(const HalftonerFactory&) throw();
00143 
00147          HalftonerFactory operator=(const HalftonerFactory&) throw();
00149 
00150       public:
00154          ~HalftonerFactory() throw();
00155 
00158 
00163          static void addHalftoner(const char* key, const Instanciator* instanciator) throw (std::invalid_argument);
00174          static Halftoner* getInstance(const char* key) throw (std::invalid_argument);
00176 
00177       private:
00181          static HalftonerFactory::Repository& getRepository() throw();
00183    };
00184 
00185 }
00186 
00187 #endif   /* #ifndef _HALFTONER_FACTORY_H_ */

Generated on Sat Sep 7 16:31:38 2002 for Halftoning Library by doxygen1.2.17