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 PsOutputAliasHEADER 00019 #define PsOutputAliasHEADER 00020 00021 #include <PsOutput.h> 00022 //----------------------------------------------------------------- 00023 //----------------------------------------------------------------- 00024 /* An output alias 00025 * aliases are use to shared an output between an object and it's sons in the simulation tree 00026 * @author Olivier Filangi (version 1.0) 00027 * @version 1.3 (revision $revision$ ) 00028 * \li 1.0 -> 1.1 by David Margery: english version of an alias 00029 * \li 1.1 -> 1.2 by David Margery: changed support for aliases of aliases : reponsability for correct alias linking is now responsability of this class 00030 * \li 1.2 -> 1.3 by David Margery (2002/06/04): added support for virtual inheritance of PsAttribute 00031 */ 00032 00033 template < typename Type > 00034 class PsOutputAlias : public PsOutput <Type> 00035 { 00036 public: 00038 PsOutputAlias ( const PsName & name, 00039 PsSimulatedObject & owner, 00040 PsOutput<Type> * outputAliased, 00041 int historyLength, 00042 PsPolatorNT * polator = NULL 00043 ); 00044 00046 virtual ~PsOutputAlias (); 00047 00048 00050 virtual void unsetAlias () ; 00051 00053 virtual void setUsedOutput (PsOutput<Type> * output) ; 00054 00056 virtual void unalias() ; 00057 00059 virtual void aliasedOutputDeleted () ; 00060 00064 virtual void alias(PsOutput<Type> * aliasedOutput); 00065 00066 protected: 00068 virtual void notifyConnectedSensitiveInputs(); 00069 00071 PsOutput<Type> * _aliasedOutput ; 00072 00073 }; // PsOutputAlias 00074 00075 template <typename Type> 00076 inline PsOutputAlias<Type>::PsOutputAlias ( const PsName & aliasName, 00077 PsSimulatedObject & owner, 00078 PsOutput<Type> * aliasedOutput, 00079 int historyLength, 00080 PsPolatorNT * polator ) 00081 : 00082 PsAttribute( owner, aliasName), 00083 PsOutput<Type>(aliasName, owner, historyLength, polator), 00084 _aliasedOutput ( aliasedOutput ) 00085 { 00086 00087 assert ( aliasedOutput != NULL ) ; 00088 00089 aliasedOutput->setAlias ( this ) ; 00090 00091 aliasedOutput->setUsedOutput(this) ; 00092 00093 } 00094 00095 00096 template <class Type> 00097 inline PsOutputAlias<Type>::~PsOutputAlias () 00098 { 00099 unalias(); 00100 } 00101 00102 00103 template <class Type> 00104 void PsOutputAlias<Type>::setUsedOutput (PsOutput<Type> * output) 00105 { 00106 PsOutput<Type>::setUsedOutput( output ) ; 00107 00108 if ( _aliasedOutput != NULL ) 00109 { 00110 _aliasedOutput->setUsedOutput( output ) ; 00111 } 00112 } 00113 00114 template <typename Type> 00115 void PsOutputAlias<Type>::notifyConnectedSensitiveInputs() 00116 { 00117 PsOutput<Type>::notifyConnectedSensitiveInputs() ; 00118 if ( _aliasedOutput != NULL ) 00119 { 00120 _aliasedOutput->notifyConnectedSensitiveInputs() ; 00121 } 00122 } 00123 00124 template <typename Type> 00125 inline void PsOutputAlias<Type>::unalias() 00126 { 00127 if ( _aliasedOutput != NULL ) 00128 { 00129 _aliasedOutput->unsetAlias() ; 00130 setUsedOutput ( this ) ; 00131 _aliasedOutput = NULL ; 00132 } 00133 } 00134 00135 00136 template <typename Type> 00137 inline void PsOutputAlias<Type>::unsetAlias() 00138 { 00139 PsOutput<Type>::unsetAlias () ; 00140 } 00141 00142 00143 template <typename Type> 00144 inline void PsOutputAlias<Type>::alias(PsOutput<Type> * aliasedOutput) 00145 { 00146 assert ( aliasedOutput != NULL ) ; 00147 00148 if ( _aliasedOutput != NULL ) 00149 { 00150 unalias() ; 00151 _aliasedOutput = aliasedOutput ; 00152 } 00153 00154 aliasedOutput->setAlias ( this ) ; 00155 00156 aliasedOutput->setUsedOutput(this) ; 00157 } 00158 00159 template <typename Type> 00160 inline void PsOutputAlias<Type>::aliasedOutputDeleted () 00161 { 00162 _aliasedOutput = NULL ; 00163 } 00164 00165 #endif 00166 00167 00168 00169
| Documentation generated on Mon Nov 25 15:25:02 2002 |
Generated with doxygen 1.2.12 by Dimitri van Heesch , 1997-2001 |