#include <OMKSimpleTypeT.h>
Inheritance diagram for OMK::Type::SimpleTypeT< T >:
Public Member Functions | |
Reset | |
virtual void | resetDefaultValues () |
Reset the default values of SimpleTypeT. | |
Accessors to attributes. | |
void | setValue (const T &value) |
Set the value value of SimpleTypeT. | |
const T & | getValue () const |
Return the value value of SimpleTypeT. | |
T & | getValue () |
Return the value value of SimpleTypeT. | |
operator const T & () const | |
Cast operator in T. | |
Operators. | |
SimpleTypeT & | operator= (const SimpleTypeT< T > &ref) |
Copy operator. | |
SimpleTypeT & | operator= (const T &value) |
Copy operator. | |
bool | operator== (const T &value) const |
comparator | |
bool | operator!= (const T &value) const |
bool | operator== (const SimpleTypeT< T > &value) const |
bool | operator!= (const SimpleTypeT< T > &value) const |
Packable, Flowable, OMKType interfaces. | |
virtual void | insertInStream (std::ostream &out=std::cout) const |
Insert datas in an output stream. | |
virtual void | extract (std::istream &in=std::cin) |
Extract datas from an input stream. | |
virtual void | pack (OutgoingSynchronisationMessage &out) const |
Pack datas in the message. | |
virtual void | unpack (IncomingSynchronisationMessage &in) |
Unpack datas from the message. | |
virtual PolatorNT * | createPolator () |
Default polator creator. | |
Protected Attributes | |
Datas | |
T | _value |
This member holds the value value of SimpleTypeT. |
OMK::Type::IntType integer ; // Define as SimpleTypeT< int > // In these three lines the implicit non const operator will convert // 'integer' in a 'int&' integer++ ; // now 'integer' is 1 integer += 3 ; // now 'integer' is 4 integer *= 2 ; // now 'integer' is 8 // In this line the implicit const operator will convert 'integer' in a // 'int' which will be compared bool minusOrEqual3 = integer <= 3 ; // is false // In these two lines the two copy operators will be used integer = 2 ; // now 'integer' is 2 integer = OMK::Type::IntType( 5 ) ; // now 'integer' is 5
// A struture with two integers struct Something { Something() : a( 0 ), b( 0 ) {} Something(int a_, int b_) : a( a_ ), b( b_ ) {} Something( const Something& q ) : a( q.a ), b( q.b ) {} Something& operator = ( const Something& q ) { a = q.a ; b = q.b ; return *this ; } int a ; int b ; void fct() { a++; b += 5 ; } } ; // some operators Something& operator += ( Something& a, const Something& q ) // The stream operators needed by the SimpleTypeT std::ostream& operator << ( std::ostream& out, const Something& q ) std::istream& operator >> ( std::istream& in, Something& q ) OMK::OutgoingSynchronisationMessage& operator << ( OMK::OutgoingSynchronisationMessage& out, const Something& q ) OMK::IncomingSynchronisationMessage& operator >> ( OMK::IncomingSynchronisationMessage& in, Something& q ) // The typedef typedef OMK::Type::SimpleTypeT< Something > SomethingType ; // The default value template<> const Something SomethingType::s_defaultValue( 0, -1 ) ; // Some lines code SomethingType something; // now 'something' is ( 0, -1 ) something=Something( 3, 3 ); // now 'something' is ( 3, 3 ) something.resetDefaultValues() ; // now 'something' is ( 0, -1 ) ((Something&)something).fct() ; // now 'something' is ( 1, 4 ) something += Something(3, 3); // now 'something' is ( 4, 7 )
template<> const std::string OMK::Type::SimpleTypeT< std::string >::s_defaultValue( "An empty string !" ) ; OMK::Type::SimpleTypeT< std::string > myString; // now 'myString' is "An empty string !" myString = "try" ; // now 'myString' is "try" ((std::string&)myString) += " to append something" ; // now 'myString' is "try to append something" myString = "another string" ; // now 'myString' is "another string"
myObject { Class ObjectWhichUsesSimpleType Scheduling { Frequency 75 Process processA } UserParams { AValue <T> AnotherValue <T> //... other object parameters } }
class ObjectWhichUsesSimpleType : public SimulatedObject { //... protected: SimpleTypeT<T> _aValue ; SimpleTypeT<T> _anotherValue ; } ;
void ObjectWhichUsesSimpleType::init() { //will always display a message with object informations if not found _aValue.loadParameters( this, "AValue" ) ; //will display a message if not found according to the \ref ParametersAccessor::displayWarning state _anotherValue.loadParameters( getConfigurationParameters(), "AnotherValue" ) ; }
Definition at line 144 of file OMKSimpleTypeT.h.
OMK::Type::SimpleTypeT< T >::SimpleTypeT | ( | const SimpleTypeT< T > & | ref | ) | [inline] |
OMK::Type::SimpleTypeT< T >::SimpleTypeT | ( | const T & | value = T() |
) | [inline] |
virtual OMK::Type::SimpleTypeT< T >::~SimpleTypeT | ( | ) | [inline, virtual] |
OMK::Type::SimpleTypeT< T >::SimpleTypeT | ( | const SimpleTypeT< T > & | ref | ) | [inline] |
OMK::Type::SimpleTypeT< T >::SimpleTypeT | ( | const T & | value = T() |
) | [inline] |
virtual OMK::Type::SimpleTypeT< T >::~SimpleTypeT | ( | ) | [inline, virtual] |
virtual void OMK::Type::SimpleTypeT< T >::resetDefaultValues | ( | ) | [inline, virtual] |
Reset the default values of SimpleTypeT.
Definition at line 162 of file OMKSimpleTypeT.h.
00162 { _value = T() ; }
void OMK::Type::SimpleTypeT< T >::setValue | ( | const T & | value | ) | [inline] |
Set the value value of SimpleTypeT.
Definition at line 169 of file OMKSimpleTypeT.h.
Referenced by OMK::Type::NumericPolatorT< Type >::extrapolate().
00169 { _value = value ; }
const T& OMK::Type::SimpleTypeT< T >::getValue | ( | ) | const [inline] |
Return the value value of SimpleTypeT.
Definition at line 171 of file OMKSimpleTypeT.h.
Referenced by OMK::Vis::TransparencyValueAnimator::selfProcessVis(), OMK::Vis::TransformAnimator::selfProcessVis(), OMK::Vis::SwitchAnimator::selfProcessVis(), OMK::Vis::MaterialAnimator< Type >::selfProcessVis(), OMK::Vis::AwarenessColorAnimator::selfProcessVis(), and OMK::Vis::AwarenessAnimator< Type >::selfProcessVis().
00171 { return _value ; }
T& OMK::Type::SimpleTypeT< T >::getValue | ( | ) | [inline] |
Return the value value of SimpleTypeT.
Definition at line 173 of file OMKSimpleTypeT.h.
00173 { return _value ; }
OMK::Type::SimpleTypeT< T >::operator const T & | ( | ) | const [inline] |
Cast operator in T.
Const version of the cast operator
Definition at line 177 of file OMKSimpleTypeT.h.
00177 { return _value ; }
SimpleTypeT& OMK::Type::SimpleTypeT< T >::operator= | ( | const SimpleTypeT< T > & | ref | ) | [inline] |
Copy operator.
Definition at line 183 of file OMKSimpleTypeT.h.
00183 { _value = ref._value ; return *this ; }
SimpleTypeT& OMK::Type::SimpleTypeT< T >::operator= | ( | const T & | value | ) | [inline] |
Copy operator.
Definition at line 185 of file OMKSimpleTypeT.h.
00185 { _value = value ; return *this ; }
bool OMK::Type::SimpleTypeT< T >::operator== | ( | const T & | value | ) | const [inline] |
bool OMK::Type::SimpleTypeT< T >::operator!= | ( | const T & | value | ) | const [inline] |
bool OMK::Type::SimpleTypeT< T >::operator== | ( | const SimpleTypeT< T > & | value | ) | const [inline] |
bool OMK::Type::SimpleTypeT< T >::operator!= | ( | const SimpleTypeT< T > & | value | ) | const [inline] |
void OMK::Type::SimpleTypeT< T >::insertInStream | ( | std::ostream & | out = std::cout |
) | const [virtual] |
Insert datas in an output stream.
Implements OMK::Flowable.
Definition at line 283 of file OMKSimpleTypeT.inl.
References OMK::Type::SimpleTypeT< T >::_value.
00284 { 00285 out << _value << " " << " " ; 00286 }
void OMK::Type::SimpleTypeT< T >::extract | ( | std::istream & | in = std::cin |
) | [virtual] |
Extract datas from an input stream.
Implements OMK::Flowable.
Definition at line 289 of file OMKSimpleTypeT.inl.
References OMK::Type::SimpleTypeT< T >::_value.
00290 { 00291 in >> _value ; 00292 }
void OMK::Type::SimpleTypeT< T >::pack | ( | OutgoingSynchronisationMessage & | out | ) | const [virtual] |
Pack datas in the message.
Reimplemented from OMK::Flowable.
Definition at line 295 of file OMKSimpleTypeT.inl.
References OMK::Type::SimpleTypeT< T >::_value.
00296 { 00297 out << _value ; 00298 }
void OMK::Type::SimpleTypeT< T >::unpack | ( | IncomingSynchronisationMessage & | in | ) | [virtual] |
Unpack datas from the message.
Reimplemented from OMK::Flowable.
Definition at line 301 of file OMKSimpleTypeT.inl.
References OMK::Type::SimpleTypeT< T >::_value.
Referenced by OMK::AbstractFifo< T >::unpackAllValues().
00302 { 00303 in >> _value ; 00304 }
PolatorNT * OMK::Type::TransformType::createPolator | ( | ) | [inline, virtual] |
T OMK::Type::SimpleTypeT< T >::_value [protected] |
This member holds the value value of SimpleTypeT.
The value of the type.
Definition at line 216 of file OMKSimpleTypeT.h.
Referenced by OMK::Type::SimpleTypeT< T >::extract(), OMK::Type::SimpleTypeT< OMK::Type::Transform >::getValue(), OMK::Type::SimpleTypeT< T >::insertInStream(), OMK::Type::SimpleTypeT< Type >::operator const Type &(), OMK::Type::SimpleTypeT< OMK::Type::Transform >::operator=(), OMK::Type::SimpleTypeT< OMK::Type::Transform >::operator==(), OMK::Type::SimpleTypeT< T >::pack(), OMK::Type::SimpleTypeT< OMK::Type::Transform >::resetDefaultValues(), OMK::Type::SimpleTypeT< OMK::Type::Transform >::setValue(), and OMK::Type::SimpleTypeT< T >::unpack().
Documentation generated on Mon Jun 9 11:46:05 2008 |
Generated with doxygen by Dimitri van Heesch , 1997-2007 |