00001 /* 00002 * @(#)src/SFCPathFactory.cxx 1.0 2002-08-27 15:31 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 00027 #include <string> 00028 #include "SFCPath32.h" 00029 #include "SFCPath64.h" 00030 #include "SFCPath128.h" 00031 #include "SFCPath256.h" 00032 #include "SFCPath512.h" 00033 #include "SFCPathFactory.h" 00034 00035 namespace halftoner 00036 { 00037 00038 //------------------------------------------ 00039 // Class SFCPathFactory::SizeMnemonic 00040 //------------------------------------------ 00041 00042 //--------------------------- 00043 // Constructor 00044 //--------------------------- 00045 00046 SFCPathFactory::SizeMnemonic::SizeMnemonic() throw() 00047 { 00048 // nothing 00049 } 00050 00051 00052 //--------------------------- 00053 // Destructor 00054 //--------------------------- 00055 00056 SFCPathFactory::SizeMnemonic::~SizeMnemonic() throw() 00057 { 00058 // nothing 00059 } 00060 00061 00062 //------------------------------------------ 00063 // Class SFCPathFactory::SizeMnemonic32 00064 //------------------------------------------ 00065 00066 //--------------------------- 00067 // Overloaded operator 00068 //--------------------------- 00069 00070 SFCPath* SFCPathFactory::SizeMnemonic32::operator()() const throw() 00071 { 00072 SFCPath* path = new SFCPath32(); 00073 return path; 00074 } 00075 00076 00077 //------------------------------------------ 00078 // Class SFCPathFactory::SizeMnemonic64 00079 //------------------------------------------ 00080 00081 //--------------------------- 00082 // Overloaded operator 00083 //--------------------------- 00084 00085 SFCPath* SFCPathFactory::SizeMnemonic64::operator()() const throw() 00086 { 00087 SFCPath* path = new SFCPath64(); 00088 return path; 00089 } 00090 00091 00092 //------------------------------------------ 00093 // Class SFCPathFactory::SizeMnemonic128 00094 //------------------------------------------ 00095 00096 //--------------------------- 00097 // Overloaded operator 00098 //--------------------------- 00099 00100 SFCPath* SFCPathFactory::SizeMnemonic128::operator()() const throw() 00101 { 00102 SFCPath* path = new SFCPath128(); 00103 return path; 00104 } 00105 00106 00107 //------------------------------------------ 00108 // Class SFCPathFactory::SizeMnemonic256 00109 //------------------------------------------ 00110 00111 //--------------------------- 00112 // Overloaded operator 00113 //--------------------------- 00114 00115 SFCPath* SFCPathFactory::SizeMnemonic256::operator()() const throw() 00116 { 00117 SFCPath* path = new SFCPath256(); 00118 return path; 00119 } 00120 00121 00122 //------------------------------------------ 00123 // Class SFCPathFactory::SizeMnemonic512 00124 //------------------------------------------ 00125 00126 //--------------------------- 00127 // Overloaded operator 00128 //--------------------------- 00129 00130 SFCPath* SFCPathFactory::SizeMnemonic512::operator()() const throw() 00131 { 00132 SFCPath* path = new SFCPath512(); 00133 return path; 00134 } 00135 00136 00137 //------------------------------------------ 00138 // Class SFCPathFactory 00139 //------------------------------------------ 00140 00141 //--------------------------- 00142 // Class variables 00143 //--------------------------- 00144 00145 const SFCPathFactory::SizeMnemonic32 SFCPathFactory::sfc32; 00146 const SFCPathFactory::SizeMnemonic64 SFCPathFactory::sfc64; 00147 const SFCPathFactory::SizeMnemonic128 SFCPathFactory::sfc128; 00148 const SFCPathFactory::SizeMnemonic256 SFCPathFactory::sfc256; 00149 const SFCPathFactory::SizeMnemonic512 SFCPathFactory::sfc512; 00150 00151 const SFCPathFactory::SizeMnemonic& SFCPathFactory::SFC32 = SFCPathFactory::sfc32; 00152 const SFCPathFactory::SizeMnemonic& SFCPathFactory::SFC64 = SFCPathFactory::sfc64; 00153 const SFCPathFactory::SizeMnemonic& SFCPathFactory::SFC128 = SFCPathFactory::sfc128; 00154 const SFCPathFactory::SizeMnemonic& SFCPathFactory::SFC256 = SFCPathFactory::sfc256; 00155 const SFCPathFactory::SizeMnemonic& SFCPathFactory::SFC512 = SFCPathFactory::sfc512; 00156 00157 00158 //--------------------------- 00159 // Destructor 00160 //--------------------------- 00161 00162 SFCPathFactory::~SFCPathFactory() throw() 00163 { 00164 // nothing 00165 } 00166 00167 00168 //--------------------------- 00169 // Class method 00170 //--------------------------- 00171 00172 SFCPath* SFCPathFactory::getInstance(const SFCPathFactory::SizeMnemonic& mnemonic) throw () 00173 { 00174 SFCPath* curve = mnemonic(); 00175 return curve; 00176 } 00177 00178 }