OMK::ValuedEvent< UserType > Class Template Reference

An event that carries an associated value. More...

#include <OMKValuedEvent.h>

Inheritance diagram for OMK::ValuedEvent< UserType >:

Inheritance graph
[legend]
Collaboration diagram for OMK::ValuedEvent< UserType >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ValuedEvent (const ValuedEvent &originalEvent)
 Copy constructor.
ValuedEventoperator= (const ValuedEvent &originalEvent)
 Assignement.
virtual ValuedEventclone () const
 Cloning.
virtual void insertInStream (std::ostream &=std::cout) const
 Insert in stream.
virtual void extract (std::istream &=std::cin)
 Extract from stream.
virtual void unpack (IncomingSynchronisationMessage &)
 Unpack from a message.
virtual void pack (OutgoingSynchronisationMessage &) const
 Pack in a message.
 ValuedEvent (const EventIdentifier &event, const Date &date, const Name &sender, const Name &receiver, const UserType &userValue)
 Constructor.
 ValuedEvent (const EventIdentifier &event, const Date &date, const Name &sender, const Name &receiver)
 Constructor.
virtual ~ValuedEvent ()
 Destructor.

Public Attributes

UserType value
 The value carried by the event.

Static Public Attributes

static ValuedEventCreator myEventCreator
 The local event creator.

Classes

class  ValuedEventCreator

Detailed Description

template<typename UserType>
class OMK::ValuedEvent< UserType >

An event that carries an associated value.

See DECLARE_PRM_TYPE_EVENT and DECLARE_PRM_TYPE_EVENT_LISTENER.

Definition at line 32 of file OMKValuedEvent.h.


Constructor & Destructor Documentation

template<typename UserType>
OMK::ValuedEvent< UserType >::ValuedEvent ( const ValuedEvent< UserType > &  originalEvent  ) 

Copy constructor.

Definition at line 119 of file OMKValuedEvent.h.

References OMK::ValuedEvent< UserType >::myEventCreator, and OMK::EventCreator::touch().

00119                                                                                :
00120                                           Event ( originalEvent ),
00121                                           value ( originalEvent.value )
00122 {
00123    // this static ensures that the static members are present in the genretaed code
00124    // enabling correct linking. In this case, it enbles valued event registration with the OMKEventCreator
00125   static bool instanciated = myEventCreator.touch() ;
00126   myEventCreator.touch(instanciated) ;
00127 }

template<typename UserType>
OMK::ValuedEvent< UserType >::ValuedEvent ( const EventIdentifier event,
const Date date,
const Name sender,
const Name receiver,
const UserType &  userValue 
)

Constructor.

Parameters:
event,: the event
date,: date of sending
sender,: sender
receiver,: receiver
userValue,: the value of the valued event

Definition at line 164 of file OMKValuedEvent.h.

References OMK::ValuedEvent< UserType >::myEventCreator, and OMK::EventCreator::touch().

00168                                                                        :
00169    Event(event, date, sender, receiver) ,
00170    value (userValue )
00171 {
00172    // this static ensures that the static members are present in the generated code
00173    // enabling correct linking. In this case, it enbles valued event registration with the OMKEventCreator
00174    // as from g++3, it is no longer necessary in constructors
00175   static bool instanciated = myEventCreator.touch() ;
00176   myEventCreator.touch(instanciated) ;
00177 }

template<typename UserType>
OMK::ValuedEvent< UserType >::ValuedEvent ( const EventIdentifier event,
const Date date,
const Name sender,
const Name receiver 
)

Constructor.

Parameters:
event : the event
date : date of sending
sender : sender
receiver : receiver

Definition at line 182 of file OMKValuedEvent.h.

References OMK::ValuedEvent< UserType >::myEventCreator, and OMK::EventCreator::touch().

00185                                                                   :
00186 Event(event, date, sender, receiver) 
00187 {
00188    // this static ensures that the static members are present in the generated code
00189    // enabling correct linking. In this case, it enbles valued event registration with the OMKEventCreator
00190    // as from g++3, it is no longer necessary in constructors
00191   static bool instanciated = myEventCreator.touch() ;
00192   myEventCreator.touch(instanciated) ;
00193 }

template<typename UserType>
OMK::ValuedEvent< UserType >::~ValuedEvent (  )  [virtual]

Destructor.

Definition at line 197 of file OMKValuedEvent.h.

References OMK::ValuedEvent< UserType >::myEventCreator, and OMK::EventCreator::touch().

00198 {
00199    // this static ensures that the static members are present in the generated code
00200    // enabling correct linking. In this case, it enbles valued event registration with the OMKEventCreator
00201    static bool instanciated = myEventCreator.touch() ;  
00202   myEventCreator.touch(instanciated) ;
00203 }


Member Function Documentation

template<typename UserType>
ValuedEvent< UserType > & OMK::ValuedEvent< UserType >::operator= ( const ValuedEvent< UserType > &  originalEvent  ) 

Assignement.

Definition at line 132 of file OMKValuedEvent.h.

References OMK::Event::operator=(), and OMK::ValuedEvent< UserType >::value.

00133 {
00134   Event::operator = ( originalEvent ) ;
00135   value = originalEvent.value ;
00136   return *this ;
00137 }

template<typename UserType>
ValuedEvent< UserType > * OMK::ValuedEvent< UserType >::clone (  )  const [virtual]

Cloning.

Reimplemented from OMK::Event.

Definition at line 142 of file OMKValuedEvent.h.

00143 {
00144    return new ValuedEvent<UserType>( *this ) ;
00145 }

template<typename UserType>
void OMK::ValuedEvent< UserType >::insertInStream ( std::ostream &  = std::cout  )  const [virtual]

Insert in stream.

Parameters:
out : stream where insert message

Reimplemented from OMK::Event.

Definition at line 150 of file OMKValuedEvent.h.

References OMK::Event::insertInStream(), and OMK::ValuedEvent< UserType >::value.

00151 {
00152   Event::insertInStream ( out ) ;
00153    out<<value<<" ";
00154 }

template<typename UserType>
void OMK::ValuedEvent< UserType >::extract ( std::istream &  = std::cin  )  [virtual]

Extract from stream.

Parameters:
in : stream where extract message

Reimplemented from OMK::Event.

Definition at line 157 of file OMKValuedEvent.h.

References OMK::Event::extract(), and OMK::ValuedEvent< UserType >::value.

00158 {
00159   Event::extract ( in ) ;
00160    in >> value ;
00161 }

template<typename UserType>
void OMK::ValuedEvent< UserType >::unpack ( IncomingSynchronisationMessage  )  [virtual]

Unpack from a message.

When this member function is called, the 4 base fields (eventId, date, sender and receiver) have allready been unpacked. This is necessary to enable correct un packing of valuedEvents

Reimplemented from OMK::Event.

Definition at line 206 of file OMKValuedEvent.h.

References OMK::Event::unpack(), and OMK::ValuedEvent< UserType >::value.

00207 {
00208    //un pack base information
00209   Event::unpack ( in ) ;
00210    in >> value ;
00211 }

template<typename UserType>
void OMK::ValuedEvent< UserType >::pack ( OutgoingSynchronisationMessage  )  const [virtual]

Pack in a message.

Reimplemented from OMK::Event.

Definition at line 214 of file OMKValuedEvent.h.

References OMK::Event::date, OMK::Event::eventId, OMK::Event::receiver, OMK::Event::sender, and OMK::ValuedEvent< UserType >::value.

00215 {
00216    static Name valueType( typeid( ValuedEvent< UserType > ).name() ) ;
00217    out << valueType
00218        << eventId 
00219        << date 
00220        << sender 
00221        << receiver
00222        << value ;
00223 }


Member Data Documentation

template<typename UserType>
UserType OMK::ValuedEvent< UserType >::value

The value carried by the event.

Definition at line 37 of file OMKValuedEvent.h.

Referenced by OMK::ValuedEvent< UserType >::extract(), OMK::ValuedEvent< UserType >::insertInStream(), OMK::ValuedEvent< UserType >::operator=(), OMK::ValuedEvent< UserType >::pack(), OMK::InputConnectionEventListener< T >::processEvent(), OMK::DistributedController::processEvent(), OMK::ChangedControlParameterEventListener< T >::processEvent(), OMK::IAttribute::processGetValue(), OMK::IAttributeT< PrmType, ModelType, AccessorType >::processSetValueOf(), OMK::Controller::reactToControlledObjectsSystemEvents(), OMK::Vis::AnimatorEventPlugT< T >::setEvent(), and OMK::ValuedEvent< UserType >::unpack().

template<typename UserType>
ValuedEvent< UserType >::ValuedEventCreator OMK::ValuedEvent< UserType >::myEventCreator [static]

The local event creator.

Definition at line 108 of file OMKValuedEvent.h.

Referenced by OMK::ValuedEvent< UserType >::ValuedEvent(), and OMK::ValuedEvent< UserType >::~ValuedEvent().


logo OpenMask

Documentation generated on Mon Jun 9 11:46:01 2008

Generated with doxygen by Dimitri van Heesch ,   1997-2007