00001 /* 00002 * This file is part of openMask © INRIA, CNRS, Universite de Rennes 1 1993-2002, thereinafter the Software 00003 * 00004 * The Software has been developped within the Siames Project. 00005 * INRIA, the University of Rennes 1 and CNRS jointly hold intellectual property rights 00006 * 00007 * The Software has been registered with the Agence pour la Protection des 00008 * Programmes (APP) under registration number IDDN.FR.001.510008.00.S.P.2001.000.41200 00009 * 00010 * This file may be distributed under the terms of the Q Public License 00011 * version 1.0 as defined by Trolltech AS of Norway and appearing in the file 00012 * LICENSE.QPL included in the packaging of this file. 00013 * 00014 * Licensees holding valid specific licenses issued by INRIA, CNRS or Université de Rennes 1 00015 * for the software may use this file in accordance with that specific license 00016 * 00017 */ 00018 #ifndef OMKKERNELOBJECTABSTRACTFACTORYHEADER 00019 #define OMKKERNELOBJECTABSTRACTFACTORYHEADER 00020 00021 #include "OMKOpenMASK.h" 00022 00023 #include<iostream> 00024 namespace OMK 00025 { 00026 template <typename T> class ControlParameter ; 00027 template <typename T,class AncestorClass > class GenericControlParameter; 00028 template <typename T> class InputAlias; 00029 template <typename T> class SensitiveInputAlias; 00030 template <typename T> class SensitiveNotifyingInputAlias; 00031 template <typename T> class OutputAlias; 00032 template <typename T> class AbstractInput; 00033 template <typename T> class Input; 00034 template <typename T> class SensitiveInput; 00035 template <typename T> class SensitiveNotifyingInput; 00036 template <typename T> class Output; 00037 class KernelObjectClassicFactory; 00038 class SimulatedObject ; 00039 class Controller ; 00040 class Name ; 00041 namespace Type { class PolatorNT; } 00042 00044 class OMK_API KernelObjectAbstractFactory 00045 { 00046 public: 00047 ~KernelObjectAbstractFactory(); 00048 00049 template <typename T> 00050 Input<T> * createInput(const Name & name, 00051 SimulatedObject & owner, 00052 bool makeConnectable, 00053 int requestedPrecisionLevel) ; 00054 template <typename T> 00055 SensitiveInput<T> * createSensitiveInput(const Name & name, 00056 SimulatedObject & owner, 00057 bool makeConnectable, 00058 int requestedPrecisionLevel) ; 00059 template <typename T> 00060 SensitiveNotifyingInput<T> * createSensitiveNotifyingInput(const Name & name, 00061 SimulatedObject & owner, 00062 bool makeConnectable, 00063 int requestedPrecisionLevel) ; 00064 template <typename T> 00065 Output<T> * createOutput(const Name & name, 00066 SimulatedObject & owner, 00067 int historyLength, 00068 OMK::Type::PolatorNT * polator) ; 00069 template <typename T> 00070 ControlParameter<T> * createControlParameter( const Name & name, 00071 SimulatedObject & owner, 00072 int historyLength, 00073 OMK::Type::PolatorNT * polator) ; 00074 template <typename T> 00075 InputAlias<T> * createInputAlias(const Name & name, 00076 SimulatedObject & owner, 00077 AbstractInput<T> * input, 00078 int requestedPrecisionLevel) ; 00079 template <typename T> 00080 SensitiveInputAlias<T> * createSensitiveInputAlias(const Name & name, 00081 SimulatedObject & owner, 00082 AbstractInput<T> * input, 00083 int requestedPrecisionLevel) ; 00084 template <typename T> 00085 SensitiveNotifyingInputAlias<T> * 00086 createSensitiveNotifyingInputAlias(const Name & name, 00087 SimulatedObject & owner, 00088 AbstractInput<T> * input, 00089 int requestedPrecisionLevel) ; 00090 template <typename T> 00091 OutputAlias<T> * createOutputAlias(const Name & name, 00092 SimulatedObject & owner, 00093 Output<T> * output, 00094 int historyLength, 00095 OMK::Type::PolatorNT * polator); 00096 protected: 00097 enum ConcreteFactory { CLASSIC }; 00098 KernelObjectAbstractFactory( ConcreteFactory factoryType ); 00099 KernelObjectClassicFactory * _classicFactory; 00100 private: 00101 ConcreteFactory _myConcreteFactoryType ; 00102 }; 00103 00109 class KernelObjectClassicFactory : public KernelObjectAbstractFactory 00110 { 00111 public: 00112 KernelObjectClassicFactory(); 00113 virtual ~KernelObjectClassicFactory(); 00114 00115 template <typename T> 00116 Input<T> * createInput(const Name & name, 00117 SimulatedObject & owner, 00118 bool makeConnectable, 00119 int requestedPrecisionLevel) 00120 { 00121 return new Input<T>(name,owner,makeConnectable,requestedPrecisionLevel); 00122 } 00123 template <typename T> 00124 SensitiveInput<T> * createSensitiveInput(const Name & name, 00125 SimulatedObject & owner, 00126 bool makeConnectable, 00127 int requestedPrecisionLevel) 00128 { 00129 return new SensitiveInput<T>(name,owner,makeConnectable,requestedPrecisionLevel); 00130 } 00131 template <typename T> 00132 SensitiveNotifyingInput<T> * 00133 createSensitiveNotifyingInput(const Name & name, 00134 SimulatedObject & owner, 00135 bool makeConnectable, 00136 int requestedPrecisionLevel) 00137 { 00138 return new SensitiveNotifyingInput<T>(name,owner,makeConnectable,requestedPrecisionLevel); 00139 } 00140 template <typename T> 00141 Output<T> * createOutput(const Name & name, 00142 SimulatedObject & owner, 00143 int historyLength, 00144 OMK::Type::PolatorNT * polator) 00145 { 00146 return new Output<T>(name,owner,historyLength,polator); 00147 } 00148 00149 template <typename T> 00150 ControlParameter<T> * createControlParameter(const Name & name, 00151 SimulatedObject & owner, 00152 int historyLength, 00153 OMK::Type::PolatorNT * polator) { 00154 return new GenericControlParameter<T,Output<T> > (name,owner,historyLength,polator) ; 00155 } 00156 00157 00158 template <typename T> 00159 InputAlias<T> * createInputAlias(const Name & name, 00160 SimulatedObject & owner, 00161 AbstractInput<T> * input, 00162 int requestedPrecisionLevel) { 00163 return new InputAlias<T>(name,owner,input,requestedPrecisionLevel); 00164 } 00165 template <typename T> 00166 SensitiveInputAlias<T> * createSensitiveInputAlias(const Name & name, 00167 SimulatedObject & owner, 00168 AbstractInput<T> * input, 00169 int requestedPrecisionLevel) 00170 { 00171 return new SensitiveInputAlias<T>(name,owner,input,requestedPrecisionLevel); 00172 } 00173 template <typename T> 00174 SensitiveNotifyingInputAlias<T> * createSensitiveNotifyingInputAlias(const Name & name, 00175 SimulatedObject & owner, 00176 AbstractInput<T> * input, 00177 int requestedPrecisionLevel) 00178 { 00179 return new SensitiveNotifyingInputAlias<T>(name,owner,input,requestedPrecisionLevel); 00180 } 00181 00182 template <typename T> 00183 OutputAlias<T> * createOutputAlias(const Name & name, 00184 SimulatedObject & owner, 00185 Output<T> * output, 00186 int historyLength, 00187 OMK::Type::PolatorNT * polator) 00188 { 00189 return new OutputAlias<T>(name,owner,output,historyLength,polator); 00190 } 00191 00192 00193 }; 00194 //------------------------ Mise en oeuvre ----------------------------- 00195 } // namespace OMK 00196 #include <OMKController.h> 00197 namespace OMK 00198 { 00199 template <typename T> 00200 Input<T> * KernelObjectAbstractFactory::createInput(const Name & name, 00201 SimulatedObject & owner, 00202 bool makeConnectable, 00203 int requestedPrecisionLevel) 00204 { 00205 switch(_myConcreteFactoryType) 00206 { 00207 case CLASSIC: 00208 return _classicFactory->template createInput<T>(name,owner,makeConnectable,requestedPrecisionLevel); 00209 default: 00210 Controller::error("KernelObjetcFactory de type inconnu"); 00211 return NULL; 00212 } 00213 } 00214 00215 template <typename T> 00216 SensitiveInput<T> * KernelObjectAbstractFactory::createSensitiveInput(const Name & name, 00217 SimulatedObject & owner, 00218 bool makeConnectable, 00219 int requestedPrecisionLevel) 00220 { 00221 switch(_myConcreteFactoryType) { 00222 case CLASSIC: 00223 return _classicFactory->template createSensitiveInput<T>(name,owner,makeConnectable,requestedPrecisionLevel); 00224 default: 00225 Controller::error("KernelObjetcFactory de type inconnu"); 00226 return NULL; 00227 } 00228 } 00229 template <typename T> 00230 SensitiveNotifyingInput<T> * 00231 KernelObjectAbstractFactory::createSensitiveNotifyingInput(const Name & name, 00232 SimulatedObject & owner, 00233 bool makeConnectable, 00234 int requestedPrecisionLevel) 00235 { 00236 switch(_myConcreteFactoryType) { 00237 case CLASSIC: 00238 return _classicFactory->template createSensitiveNotifyingInput<T>(name,owner,makeConnectable,requestedPrecisionLevel); 00239 default: 00240 Controller::error("KernelObjetcFactory de type inconnu"); 00241 return NULL; 00242 } 00243 } 00244 00245 template <typename T> 00246 SensitiveInputAlias<T> * 00247 KernelObjectAbstractFactory::createSensitiveInputAlias(const Name & name, 00248 SimulatedObject & owner, 00249 AbstractInput<T> * input, 00250 int requestedPrecisionLevel) { 00251 switch(_myConcreteFactoryType) { 00252 case CLASSIC: 00253 return _classicFactory->template createSensitiveInputAlias<T>(name,owner,input,requestedPrecisionLevel); 00254 default: 00255 Controller::error("KernelObjetcFactory de type inconnu"); 00256 return NULL; 00257 } 00258 } 00259 template <typename T> 00260 SensitiveNotifyingInputAlias<T> * 00261 KernelObjectAbstractFactory::createSensitiveNotifyingInputAlias(const Name & name, 00262 SimulatedObject & owner, 00263 AbstractInput<T> * input, 00264 int requestedPrecisionLevel) 00265 { 00266 switch(_myConcreteFactoryType) { 00267 case CLASSIC: 00268 return _classicFactory->template createSensitiveNotifyingInputAlias<T>(name,owner,input,requestedPrecisionLevel); 00269 default: 00270 Controller::error("KernelObjetcFactory de type inconnu"); 00271 return NULL; 00272 } 00273 } 00274 00275 // ------------- 00276 00277 template <typename T> 00278 Output<T> * KernelObjectAbstractFactory::createOutput(const Name & name, 00279 SimulatedObject & owner, 00280 const int historyLength, 00281 OMK::Type::PolatorNT * polator) 00282 { 00283 switch(_myConcreteFactoryType) 00284 { 00285 case CLASSIC: 00286 return _classicFactory->template createOutput<T>(name,owner,historyLength,polator); 00287 default: 00288 Controller::error("KernelObjetcFactory de type inconnu"); 00289 return NULL; 00290 } 00291 } 00292 00293 // ------------- 00294 00295 template <typename T> 00296 ControlParameter<T> * KernelObjectAbstractFactory::createControlParameter(const Name & name, 00297 SimulatedObject & owner, 00298 int historyLength, 00299 OMK::Type::PolatorNT * polator) 00300 { 00301 switch(_myConcreteFactoryType) 00302 { 00303 case CLASSIC: 00304 return _classicFactory->template createControlParameter<T>(name,owner, historyLength, polator); 00305 default: 00306 Controller::error("KernelObjetcFactory de type inconnu"); 00307 return NULL; 00308 } 00309 } 00310 00311 // ------------- 00312 00313 00314 template <typename T> 00315 InputAlias<T> * KernelObjectAbstractFactory::createInputAlias(const Name & name, 00316 SimulatedObject & owner, 00317 AbstractInput<T> * input, 00318 int requestedPrecisionLevel) 00319 { 00320 switch(_myConcreteFactoryType) { 00321 case CLASSIC: 00322 return _classicFactory->template createInputAlias<T>(name,owner,input,requestedPrecisionLevel); 00323 default: 00324 Controller::error("KernelObjetcFactory de type inconnu"); 00325 return NULL; 00326 } 00327 } 00328 00329 template <typename T> 00330 OutputAlias<T> * KernelObjectAbstractFactory::createOutputAlias(const Name & name, 00331 SimulatedObject & owner, 00332 Output<T> * output, 00333 int historyLength, 00334 OMK::Type::PolatorNT * polator) 00335 { 00336 switch(_myConcreteFactoryType) { 00337 case CLASSIC: 00338 return _classicFactory->template createOutputAlias<T>(name,owner,output,historyLength,polator); 00339 default: 00340 Controller::error("KernelObjetcFactory de type inconnu"); 00341 return NULL; 00342 } 00343 } 00344 }//namespace OMK 00345 #endif // OMKKERNELOBJECTABSTRACTFACTORYHEADER
Documentation generated on Mon Jun 9 11:45:56 2008 |
Generated with doxygen by Dimitri van Heesch , 1997-2007 |