00001 /************************************************************************/ 00002 /* This file is part of openMask(c) INRIA, CNRS, Universite de Rennes 1 */ 00003 /* 1993-2002, thereinafter the Software */ 00004 /* */ 00005 /* The Software has been developped within the Siames Project. */ 00006 /* INRIA, the University of Rennes 1 and CNRS jointly hold intellectual */ 00007 /* property rights */ 00008 /* */ 00009 /* The Software has been registered with the Agence pour la Protection */ 00010 /* des Programmes (APP) under registration number */ 00011 /* IDDN.FR.001.510008.00.S.P.2001.000.41200 */ 00012 /* */ 00013 /* This file may be distributed under the terms of the Q Public License */ 00014 /* version 1.0 as defined by Trolltech AS of Norway and appearing in */ 00015 /* the file LICENSE.QPL included in the packaging of this file. */ 00016 /* */ 00017 /* Licensees holding valid specific licenses issued by INRIA, CNRS or */ 00018 /* Universite Rennes 1 for the software may use this file in */ 00019 /* acordance with that specific license */ 00020 /************************************************************************/ 00021 #if !defined _SIMPLETYPET_H_ 00022 #define _SIMPLETYPET_H_ 00023 00024 #include "OMKBase.h" 00025 00026 namespace OMK 00027 { 00028 class SimulatedObject ; 00029 class ConfigurationParameterDescriptor ; 00030 class OutgoingSynchronisationMessage ; 00031 class IncomingSynchronisationMessage ; 00032 namespace Type 00033 { 00034 00143 template< typename T > 00144 class SimpleTypeT 00145 : public Base 00146 { 00147 public: 00149 00150 00151 SimpleTypeT( const SimpleTypeT< T >& ref ) : Base(), _value( ref._value ) {} 00153 SimpleTypeT( const T& value = T() ) : Base(), _value( value ) {} 00155 virtual ~SimpleTypeT() {} 00157 00159 00160 public: 00162 virtual void resetDefaultValues() { _value = T() ; } 00164 00166 00167 public: 00169 void setValue( const T& value ) { _value = value ; } 00171 const T& getValue() const { return _value ; } 00173 T& getValue() { return _value ; } 00176 //operator T() const { return _value ; } 00177 operator const T&() const { return _value ; } 00179 00181 00182 00183 SimpleTypeT& operator = ( const SimpleTypeT< T >& ref ) { _value = ref._value ; return *this ; } 00185 SimpleTypeT& operator = ( const T& value ) { _value = value ; return *this ; } 00187 bool operator == ( const T& value ) const { return _value == value ; } 00188 bool operator != ( const T& value ) const { return !( *this == value ) ; } 00189 bool operator == ( const SimpleTypeT< T >& value ) const { return _value == (const T&)value ; } 00190 bool operator != ( const SimpleTypeT< T >& value ) const { return !( *this == value ) ; } 00191 00193 00195 00196 public: 00198 virtual void insertInStream( std::ostream& out = std::cout ) const ; 00200 virtual void extract( std::istream& in = std::cin ) ; 00201 00203 virtual void pack ( OutgoingSynchronisationMessage& out ) const ; 00205 virtual void unpack( IncomingSynchronisationMessage& in ) ; 00206 00208 virtual PolatorNT* createPolator() ; 00210 protected: 00212 00213 00214 00215 00216 T _value ; 00218 } ; 00219 00220 } // namespace Type 00221 } // namespace OMK 00222 #endif // defined _SIMPLETYPET_H_
Documentation generated on Mon Jun 9 11:45:57 2008 |
Generated with doxygen by Dimitri van Heesch , 1997-2007 |