Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

PsValuedEvent< UserType > Class Template Reference

an event that carries an associated value More...

#include <PsValuedEvent.h>

Inheritance diagram for PsValuedEvent< UserType >:

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

Collaboration graph
[legend]
List of all members.

Public Methods

 PsValuedEvent (const PsValuedEvent &originalEvent)
 copy constructor

PsValuedEvent & operator= (const PsValuedEvent &originalEvent)
 assignement

virtual PsValuedEvent * clone () const
 cloning

virtual void insertInStream (ostream &=cout) const
 insert in stream

virtual void extract (istream &=cin)
 extract from stream

virtual void unpack (PsIncomingSynchronisationMessage &)
 unpack from a message when this member function is called, the 4 base fields (eventId, date, sender and receiver) have allready been unpacked.

virtual void pack (PsOutgoingSynchronisationMessage &) const
 pack in a message

 PsValuedEvent (const PsEventIdentifier &event, const PsDate &date, const PsName &sender, const PsName &receiver, const UserType &userValue)
 the constructor

 PsValuedEvent (const PsEventIdentifier &event, const PsDate &date, const PsName &sender, const PsName &receiver)
 the constructor

virtual ~PsValuedEvent ()
 Un destructeur.


Public Attributes

UserType value
 the value carried by the event


Static Public Attributes

ValuedEventCreator myEventCreator
 the local event creator


Detailed Description

template<typename UserType>
class PsValuedEvent< UserType >

an event that carries an associated value

Definition at line 27 of file PsValuedEvent.h.


Constructor & Destructor Documentation

template<typename UserType>
PsValuedEvent< UserType >::PsValuedEvent const PsValuedEvent< UserType > &    originalEvent
 

copy constructor

Definition at line 128 of file PsValuedEvent.h.

References PsValuedEvent< UserType >::myEventCreator, and PsEventCreator::touch().

00129                                                                                     :
00130    PsEvent ( originalEvent ),
00131    value ( originalEvent.value )
00132 {
00133    // this static ensures that the static members are present in the genretaed code
00134    // enabling correct linking. In this case, it enbles valued event registration with the PsEventCreator
00135   static bool instanciated = myEventCreator.touch() ;
}

template<typename UserType>
PsValuedEvent< UserType >::PsValuedEvent const PsEventIdentifier   event,
const PsDate   date,
const PsName   sender,
const PsName   receiver,
const UserType &    userValue
 

the constructor

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

Definition at line 168 of file PsValuedEvent.h.

References PsValuedEvent< UserType >::myEventCreator, PsDate, and PsEventCreator::touch().

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

template<typename UserType>
PsValuedEvent< UserType >::PsValuedEvent const PsEventIdentifier   event,
const PsDate   date,
const PsName   sender,
const PsName   receiver
 

the constructor

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

Definition at line 185 of file PsValuedEvent.h.

References PsValuedEvent< UserType >::myEventCreator, PsDate, and PsEventCreator::touch().

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

template<typename UserType>
PsValuedEvent< UserType >::~PsValuedEvent   [virtual]
 

Un destructeur.

Definition at line 199 of file PsValuedEvent.h.

References PsValuedEvent< UserType >::myEventCreator, and PsEventCreator::touch().

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


Member Function Documentation

template<typename UserType>
PsValuedEvent< UserType > * PsValuedEvent< UserType >::clone   const [virtual]
 

cloning

Reimplemented from PsEvent.

Definition at line 149 of file PsValuedEvent.h.

00150                                                                 {
00151    return new PsValuedEvent<UserType>( *this ) ;

template<typename UserType>
void PsValuedEvent< UserType >::extract istream &    = cin [virtual]
 

extract from stream

Parameters:
in : le flot d'où il faut extract l'événement

Reimplemented from PsEvent.

Definition at line 162 of file PsValuedEvent.h.

References PsEvent::extract(), and PsValuedEvent< UserType >::value.

00163                                                      {
00164    PsEvent::extract ( in ) ;
00165    in >> value ;

template<typename UserType>
void PsValuedEvent< UserType >::insertInStream ostream &    = cout const [virtual]
 

insert in stream

Parameters:
out : le flot ou il convient d'insérer le message

Reimplemented from PsEvent.

Definition at line 156 of file PsValuedEvent.h.

References PsEvent::insertInStream(), and PsValuedEvent< UserType >::value.

00157                                                                 {
00158    PsEvent::insertInStream ( out ) ;
00159    out<<value<<" ";

template<typename UserType>
PsValuedEvent< UserType > & PsValuedEvent< UserType >::operator= const PsValuedEvent< UserType > &    originalEvent
 

assignement

Definition at line 140 of file PsValuedEvent.h.

References PsEvent::operator=(), and PsValuedEvent< UserType >::value.

00142 {
00143    PsEvent::operator = ( originalEvent ) ;
00144    value = originalEvent.value ;

template<typename UserType>
void PsValuedEvent< UserType >::pack PsOutgoingSynchronisationMessage   const [virtual]
 

pack in a message

Reimplemented from PsEvent.

Definition at line 218 of file PsValuedEvent.h.

References PsEvent::date, PsEvent::eventId, PsEvent::receiver, PsEvent::sender, and PsValuedEvent< UserType >::value.

00220 {
00221    static PsName valueType ( typeid (PsValuedEvent<UserType>) .name() ) ;
00222    out << valueType
00223        << eventId 
00224        << date 
00225        << sender 
00226        << receiver
00227        << value ;

template<typename UserType>
void PsValuedEvent< UserType >::unpack PsIncomingSynchronisationMessage   [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 PsEvent.

Definition at line 209 of file PsValuedEvent.h.

References PsEvent::unpack(), and PsValuedEvent< UserType >::value.

00211 {
00212 
00213    //un pack base information
00214    PsEvent::unpack ( in ) ;
00215    in >> value ;


Member Data Documentation

template<typename UserType>
PsValuedEvent< UserType >::ValuedEventCreator PsValuedEvent< UserType >::myEventCreator [static]
 

the local event creator

Definition at line 123 of file PsValuedEvent.h.

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

template<typename UserType>
UserType PsValuedEvent< UserType >::value
 

the value carried by the event

Definition at line 32 of file PsValuedEvent.h.

Referenced by PsValuedEvent< UserType >::extract(), PsValuedEvent< UserType >::insertInStream(), PsValuedEvent< UserType >::operator=(), PsValuedEvent< UserType >::pack(), PsInputConnectionEventListener< Type >::processEvent(), PsDistributedController::processEvent(), PsController::processEvent(), PsChangedControlParameterEventListener< Type >::processEvent(), PsController::reactToControlledObjectsSystemEvents(), PsnMomeReferenceObjectHandle::receiveEvent(), and PsValuedEvent< UserType >::unpack().


The documentation for this class was generated from the following file:
logo OpenMask

Documentation generated on Mon Nov 25 15:26:36 2002

Generated with doxygen 1.2.12 by Dimitri van Heesch ,   1997-2001