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 OutputAliasHEADER 00019 #define OutputAliasHEADER 00020 00021 #include "OMKOutput.h" 00022 #include "OMKTracer.h" 00023 00024 namespace OMK 00025 { 00026 //----------------------------------------------------------------- 00027 /* An output alias 00028 * aliases are use to shared an output between an object and it's sons in the simulation tree 00029 * @author Olivier Filangi (version 1.0) 00030 * @version 1.3 (revision $revision$ ) 00031 * \li 1.0 -> 1.1 by David Margery: english version of an alias 00032 * \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 00033 * \li 1.2 -> 1.3 by David Margery (2002/06/04): added support for virtual inheritance of OMKKernelAttribute 00034 */ 00035 00036 template< typename T > 00037 class OutputAlias : public Output< T > 00038 { 00039 public: 00041 OutputAlias( const Name & name, 00042 SimulatedObject & owner, 00043 Output< T > * outputAliased, 00044 int historyLength, 00045 OMK::Type::PolatorNT * polator = NULL ) ; 00046 00048 virtual ~OutputAlias() ; 00049 00050 00052 virtual void unsetAlias() ; 00053 00055 virtual void setUsedOutput( Output< T > * output ) ; 00056 00058 virtual void unalias() ; 00059 00061 virtual void aliasedOutputDeleted() ; 00062 00066 virtual void alias( Output< T > * aliasedOutput ) ; 00067 00068 protected: 00069 00071 Output< T > * _aliasedOutput ; 00072 00073 }; // OutputAlias 00074 00075 00076 //------------------------------------------------------------------------------ 00077 //------------------------------------------------------------------------------ 00078 00079 00080 template< typename T > 00081 inline OutputAlias< T >::OutputAlias( const Name & aliasName, 00082 SimulatedObject & owner, 00083 Output< T > * aliasedOutput, 00084 int historyLength, 00085 OMK::Type::PolatorNT * polator ) 00086 : KernelAttribute( owner, aliasName ), 00087 Output< T >( aliasName, owner, historyLength, polator ), 00088 _aliasedOutput( aliasedOutput ) 00089 { 00090 00091 OMASSERT( aliasedOutput != 0 ) ; 00092 aliasedOutput->setAlias( this ) ; 00093 aliasedOutput->setUsedOutput( this ) ; 00094 } 00095 00096 //------------------------------------------------------------------------------ 00097 00098 template< class T > 00099 inline OutputAlias< T >::~OutputAlias() 00100 { 00101 unalias() ; 00102 } 00103 00104 //------------------------------------------------------------------------------ 00105 00106 template< class T > 00107 void OutputAlias< T >::setUsedOutput( Output< T > * output ) 00108 { 00109 Output< T >::setUsedOutput( output ) ; 00110 if( _aliasedOutput != 0 ) 00111 { 00112 _aliasedOutput->setUsedOutput( output ) ; 00113 } 00114 } 00115 00116 //------------------------------------------------------------------------------ 00117 00118 template< typename T > 00119 inline void OutputAlias< T >::unalias() 00120 { 00121 if( _aliasedOutput != 0 ) 00122 { 00123 _aliasedOutput->unsetAlias() ; 00124 setUsedOutput( this ) ; 00125 _aliasedOutput = 0 ; 00126 } 00127 } 00128 00129 //------------------------------------------------------------------------------ 00130 00131 template< typename T > 00132 inline void OutputAlias< T >::unsetAlias() 00133 { 00134 Output< T >::unsetAlias() ; 00135 } 00136 00137 //------------------------------------------------------------------------------ 00138 00139 template< typename T > 00140 inline void OutputAlias< T >::alias( Output< T > * aliasedOutput ) 00141 { 00142 OMASSERT( aliasedOutput != 0 ) ; 00143 if( _aliasedOutput != 0 ) 00144 { 00145 unalias() ; 00146 _aliasedOutput = aliasedOutput ; 00147 } 00148 aliasedOutput->setAlias( this ) ; 00149 aliasedOutput->setUsedOutput( this ) ; 00150 } 00151 00152 //------------------------------------------------------------------------------ 00153 00154 template< typename T > 00155 inline void OutputAlias< T >::aliasedOutputDeleted() 00156 { 00157 _aliasedOutput = 0 ; 00158 } 00159 00160 //------------------------------------------------------------------------------ 00161 00162 } // namespace OMK 00163 00164 #endif
Documentation generated on Mon Jun 9 11:45:57 2008 |
Generated with doxygen by Dimitri van Heesch , 1997-2007 |