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 00019 #ifndef PsInputAliasHEADER 00020 #define PsInputAliasHEADER 00021 00022 00023 00024 #include <PsSimulatedObject.h> 00025 #include <PsController.h> 00026 #include <PsInput.h> 00027 00035 template <typename Type> 00036 class PsInputAlias:public PsAbstractInput <Type> 00037 { 00038 public: 00039 00046 PsInputAlias (const PsName & inputName, 00047 PsSimulatedObject & owner, 00048 PsAbstractInput<Type> * aliasedInput, 00049 const int requestedPrecisionLevel=PsPolatorNT::defaultPrecisionLevel ) 00050 : PsAbstractInput<Type>(inputName, 00051 owner, 00052 aliasedInput->isConnectable(), 00053 requestedPrecisionLevel) , 00054 _aliasedInput ( aliasedInput ) 00055 { 00056 if ( _aliasedInput != NULL ) 00057 { 00058 _aliasedInput->notifyAliasing(this) ; 00059 } 00060 else 00061 { 00062 cerr<<"WARNING : PsInputAlias::PsInputAlias : aliased input is NULL "<<endl; 00063 } 00064 }; 00065 00067 virtual ~PsInputAlias (void) 00068 { 00069 if ( _aliasedInput != NULL ) 00070 { 00071 _aliasedInput->notifyUnaliasing(this) ; 00072 } 00073 }; 00074 00078 virtual const Type & get (int deltaT = 0); 00079 00083 virtual int getDistanceToExactValue() const ; 00084 00088 virtual const Type & getLastExactValue() const ; 00089 00090 00094 virtual const PsDate & getDateOfLastExactValue() const ; 00095 00096 00102 virtual bool connect (const PsName & objectName, const PsName & outputName ) ; 00103 00104 00110 virtual bool connect (PsSimulatedObject & object, const PsName & outputName ) ; 00111 00112 00118 virtual bool connect (PsSimulatedObject * pointerToObject, const PsName & outputName ) ; 00119 00120 00127 virtual bool connect (const PsName & objectName, const PsName & outputName, const Type & initialValue) ; 00128 00129 00136 virtual bool connect (PsSimulatedObject & object, const PsName & outputName, const Type & initialValue) ; 00137 00138 00145 virtual bool connect (PsSimulatedObject * pointerToObject, const PsName & outputName, const Type & initialValue) ; 00146 00147 00153 virtual bool connectToControlParameter (const PsName & objectName, const PsName & controlParameterName ) ; 00154 00155 00161 virtual bool connectToControlParameter (PsSimulatedObject & object, const PsName & controlParameterName ) ; 00162 00163 00169 virtual bool connectToControlParameter (PsSimulatedObject * pointerToObject, const PsName & controlParameterName ) ; 00170 00171 00178 virtual bool connectToControlParameter (const PsName & objectName, const PsName & controlParameterName, const Type & initialValue) ; 00179 00180 00187 virtual bool connectToControlParameter (PsSimulatedObject & object, const PsName & controlParameterName, const Type & initialValue) ; 00188 00189 00196 virtual bool connectToControlParameter (PsSimulatedObject * pointerToObject, const PsName & controlParameterName, const Type & initialValue) ; 00197 00198 00200 virtual const PsOutputNT * getConnectedOutput () const ; 00201 00202 00205 virtual void disconnect () ; 00206 00207 00211 virtual void extract (istream & = cin) ; 00212 00216 virtual void insertInStream (ostream & = cout) const ; 00217 00221 virtual void printDebuggingInformation ( ostream & err ) const ; 00222 00227 virtual bool realConnect (PsOutputNT * output) { 00228 return _aliasedInput->realConnect(output); 00229 } 00230 00232 virtual void inputAliasedDeleted () ; 00233 protected: 00234 00236 PsAbstractInput<Type> * _aliasedInput; 00237 00238 } ; // PsInputAlias 00239 00240 //----------------------------------------------------------------- 00241 00242 template <typename Type> 00243 inline void PsInputAlias<Type>::inputAliasedDeleted () 00244 { 00245 _aliasedInput = NULL ; 00246 } 00247 00248 //----------------------------------------------------------------- 00249 00250 template <typename Type> 00251 inline const Type & PsInputAlias<Type>::get (int deltaT) 00252 { 00253 #ifdef _DEBUGTYPEUTIL 00254 cout << "PsInputAlias<Type>::localGet calling get of _aliasedInput " << endl; 00255 #endif 00256 return _aliasedInput->get (deltaT); 00257 } 00258 00259 //----------------------------------------------------------------- 00260 00261 template <typename Type> 00262 inline int PsInputAlias<Type>::getDistanceToExactValue () const 00263 { 00264 return _aliasedInput->getDistanceToExactValue(); 00265 } 00266 00267 //----------------------------------------------------------------- 00268 00269 template <typename Type> 00270 inline void PsInputAlias<Type>::extract (istream & in) 00271 { 00272 _aliasedInput->extract(in) ; 00273 } 00274 00275 //----------------------------------------------------------------- 00276 00277 template <typename Type> 00278 inline void PsInputAlias<Type>::insertInStream (ostream & out) const 00279 { 00280 _aliasedInput->insertInStream(out) ; 00281 } 00282 00283 //----------------------------------------------------------------- 00284 00285 template <typename Type> 00286 inline void PsInputAlias<Type>::printDebuggingInformation ( ostream & err ) const 00287 { 00288 err << "**********************************************************" << endl; 00289 err << "Class PsInputAlias" << endl; 00290 err << "Owner : " << _owner.getName() << endl; 00291 err << "polation precision level : " << _precisionLevel << endl; 00292 } 00293 00294 00295 template <typename Type> 00296 const Type & PsInputAlias<Type>::getLastExactValue() const { 00297 return _aliasedInput->getLastExactValue() ; 00298 } 00299 00300 00301 template <typename Type> 00302 const PsDate & PsInputAlias<Type>::getDateOfLastExactValue() const { 00303 return _aliasedInput->getDateOfLastExactValue() ; 00304 } 00305 00306 template <typename Type> 00307 bool PsInputAlias<Type>::connect (const PsName & objectName, 00308 const PsName & outputName) 00309 { 00310 return _aliasedInput->connect(objectName,outputName); 00311 } 00312 00313 00314 template <typename Type> 00315 bool PsInputAlias<Type>::connect (PsSimulatedObject & object, 00316 const PsName & outputName) 00317 { 00318 return _aliasedInput->connect(object, outputName); 00319 } 00320 00321 00322 template <typename Type> 00323 bool PsInputAlias<Type>::connect (PsSimulatedObject * object, 00324 const PsName & outputName) 00325 { 00326 return PsAbstractInput<Type>::connect(object, outputName); 00327 } 00328 00329 00330 template <typename Type> 00331 bool PsInputAlias<Type>::connect (const PsName & objectName, 00332 const PsName & outputName, 00333 const Type & initialValue) 00334 { 00335 return _aliasedInput->connect( objectName, outputName, initialValue ); 00336 } 00337 00338 00339 template <typename Type> 00340 bool PsInputAlias<Type>::connect (PsSimulatedObject & object, 00341 const PsName & outputName, 00342 const Type & initialValue) 00343 { 00344 return _aliasedInput->connect( object, outputName, initialValue ); 00345 } 00346 00347 template <typename Type> 00348 bool PsInputAlias<Type>::connect (PsSimulatedObject * object, 00349 const PsName & outputName, 00350 const Type & initialValue) 00351 { 00352 return PsAbstractInput<Type>::connect( object, outputName, initialValue ); 00353 } 00354 00355 template <typename Type> 00356 bool PsInputAlias<Type>::connectToControlParameter (const PsName & objectName, 00357 const PsName & controlParameterName) 00358 { 00359 return _aliasedInput->connectToControlParameter(objectName,controlParameterName); 00360 } 00361 00362 00363 template <typename Type> 00364 bool PsInputAlias<Type>::connectToControlParameter (PsSimulatedObject & object, 00365 const PsName & controlParameterName) 00366 { 00367 return _aliasedInput->connectToControlParameter(object, controlParameterName); 00368 } 00369 00370 00371 template <typename Type> 00372 bool PsInputAlias<Type>::connectToControlParameter (PsSimulatedObject * object, 00373 const PsName & controlParameterName) 00374 { 00375 return PsAbstractInput<Type>::connectToControlParameter(object, controlParameterName); 00376 } 00377 00378 00379 template <typename Type> 00380 bool PsInputAlias<Type>::connectToControlParameter (const PsName & objectName, 00381 const PsName & controlParameterName, 00382 const Type & initialValue) 00383 { 00384 return _aliasedInput->connectToControlParameter( objectName, controlParameterName, initialValue ); 00385 } 00386 00387 00388 template <typename Type> 00389 bool PsInputAlias<Type>::connectToControlParameter (PsSimulatedObject & object, 00390 const PsName & controlParameterName, 00391 const Type & initialValue) 00392 { 00393 return _aliasedInput->connectToControlParameter( object, controlParameterName, initialValue ); 00394 } 00395 00396 00397 template <typename Type> 00398 bool PsInputAlias<Type>::connectToControlParameter (PsSimulatedObject * object, 00399 const PsName & controlParameterName, 00400 const Type & initialValue) 00401 { 00402 return PsAbstractInput<Type>::connectToControlParameter( object, controlParameterName, initialValue ); 00403 } 00404 00405 00406 template <typename Type> 00407 void PsInputAlias<Type>::disconnect () 00408 { 00409 _aliasedInput->disconnect( ); 00410 } 00411 00412 00413 template <typename Type> 00414 const PsOutputNT * PsInputAlias<Type>::getConnectedOutput () const 00415 { 00416 return _aliasedInput->getConnectedOutput( ); 00417 } 00418 00419 #endif
| Documentation generated on Mon Nov 25 15:25:00 2002 |
Generated with doxygen 1.2.12 by Dimitri van Heesch , 1997-2001 |