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

PsEvent Class Reference

Base class for all events exchanged between simulation objects. More...

#include <PsEvent.h>

Inheritance diagram for PsEvent:

Inheritance graph
[legend]
Collaboration diagram for PsEvent:

Collaboration graph
[legend]
List of all members.

member function for event manipulation

 PsEvent (const PsEvent &originalEvent)
 copy constructor

PsEvent & operator= (const PsEvent &originalEvent)
 assignement

virtual PsEvent * clone () const
 cloning

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

virtual void extract (istream &in=cin)
 extract from a 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

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

virtual ~PsEvent ()
 the destructor.

virtual bool isSystem () const
 is the event a system event

PsEvent * insertInList (list< PsEvent * > *alist, PsEvent *)
 insert an event in an event list, so that events are ordered from oldest to most recent


Public Attributes

The four base fields
PsEventIdentifier eventId
 the event identifier

PsDate date
 date of sending

PsName sender
 sender of the event

PsName receiver
 intended receiver


Static Protected Attributes

PsEventCreator_myEventCreator = new PsEventCreator ("PsEvent")

Detailed Description

Base class for all events exchanged between simulation objects.

Author:
[David Margery]{mailto:David.Margery@irisa.fr}.
Version:
1.9

Definition at line 35 of file PsEvent.h.


Constructor & Destructor Documentation

PsEvent::PsEvent const PsEvent &    originalEvent
 

copy constructor

Definition at line 28 of file PsEvent.cxx.

Referenced by clone().

00028                                                  :
00029    eventId ( originalEvent.eventId ),
00030    date ( originalEvent.date ),
00031    sender ( originalEvent.sender ),
00032    receiver ( originalEvent.receiver )
00033 {
00034 }

PsEvent::PsEvent 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 89 of file PsEvent.cxx.

References PsDate.

00089                                                                                                                         : 
00090    eventId ( eventId ),
00091    date ( date ),
00092    sender ( sender ),
00093    receiver (receiver )
00094 {
00095 #ifdef _DEBUGEVT
00096    cerr<<"PsEvent::PsEvent(const PsEventIdentifier & eventId, const PsDate & date, const PsName & sender, const PsName & receiver )"<<endl;
00097 #endif
00098 }

PsEvent::~PsEvent   [virtual]
 

the destructor.

Definition at line 100 of file PsEvent.cxx.

00101 {
00102    //cerr<<"PsEvent::~PsEvent() "<<*this<<endl;
00103 }


Member Function Documentation

PsEvent * PsEvent::clone   const [virtual]
 

cloning

Reimplemented in PsValuedEvent< UserType >.

Definition at line 47 of file PsEvent.cxx.

References PsEvent().

Referenced by PsMomeController::actOnSystemEvent(), PsController::actOnSystemEvent(), PsnPvmDuplicatedObjectHandle::broadcastEvent(), PsDistributedController::broadcastEventsForSignal(), PsnReferenceObjectHandle::receiveEvent(), and PsSimulatedObject::sendEvent().

00047                                 {
00048    return new PsEvent (*this) ;
00049 }

void PsEvent::extract istream &    in = cin [virtual]
 

extract from a stream

Parameters:
in the stream from which the event must be extracted

Implements PsFlowable.

Reimplemented in PsValuedEvent< UserType >.

Definition at line 81 of file PsEvent.cxx.

References date, eventId, receiver, and sender.

Referenced by PsValuedEvent< UserType >::extract().

00081                                   {
00082    int i ;
00083    in >> eventId
00084       >> date
00085       >> sender
00086       >> receiver ;
00087 }

PsEvent * PsEvent::insertInList list< PsEvent * > *    alist,
PsEvent *   
[static]
 

insert an event in an event list, so that events are ordered from oldest to most recent

Definition at line 112 of file PsEvent.cxx.

References date, list< T, Alloc >::rbegin(), and list< T, Alloc >::rend().

Referenced by PsController::actOnSystemEvent(), and PsnReferenceObjectHandle::receiveEvent().

00112                                                                         {
00113 
00114    list<PsEvent *>::reverse_iterator i = aList->rbegin () ;
00115 
00116    while ( i != aList->rend() &&
00117            (event->date < (*i)->date ) )
00118       {
00119          ++i ;
00120       }
00121    aList-> insert (i.base(),event) ;
00122    return event ;
00123 }

void PsEvent::insertInStream ostream &    out = cout const [virtual]
 

insert in a stream

Parameters:
out the stream where the event must be printed

Implements PsFlowable.

Reimplemented in PsValuedEvent< UserType >.

Definition at line 74 of file PsEvent.cxx.

References date, eventId, receiver, and sender.

Referenced by PsValuedEvent< UserType >::insertInStream().

00074                                                  {
00075    out << eventId << " "
00076        << date << " "
00077        << sender << " "
00078        << receiver << " " ;
00079 }

bool PsEvent::isSystem   const [virtual]
 

is the event a system event

Returns:
the event is a system event

Definition at line 106 of file PsEvent.cxx.

References eventId, and PsEventIdentifier::isSystemEvent().

Referenced by PsnReferenceObjectHandle::receiveEvent().

00106                              {
00107   return eventId.isSystemEvent () ;
00108 }

PsEvent & PsEvent::operator= const PsEvent &    originalEvent
 

assignement

Definition at line 38 of file PsEvent.cxx.

References date, eventId, receiver, and sender.

Referenced by PsValuedEvent< UserType >::operator=().

00039 {
00040   eventId = evenement.eventId ;
00041   date = evenement.date ;
00042   sender = evenement.sender ;
00043   receiver = evenement.receiver ;
00044   return(*this);
00045 }

void PsEvent::pack PsOutgoingSynchronisationMessage   const [virtual]
 

pack in a message

Reimplemented from PsFlowable.

Reimplemented in PsValuedEvent< UserType >.

Definition at line 59 of file PsEvent.cxx.

References date, eventId, receiver, and sender.

00060 {
00061    static PsName eventWithNoValue ("PsEvent") ;
00062 #ifdef _DEBUGPVMMESS
00063    cerr<<"PsEvent::pack"<<endl;
00064 #endif
00065    out << eventWithNoValue
00066        << eventId 
00067        << date 
00068        << sender 
00069        << receiver ;
00070 }

void PsEvent::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 PsFlowable.

Reimplemented in PsValuedEvent< UserType >.

Definition at line 53 of file PsEvent.cxx.

Referenced by PsValuedEvent< UserType >::unpack(), PsnPvmReferenceObjectHandle::unpack(), and PsnPvmDuplicatedObjectHandle::unpack().

00054 {
00055    //do nothing : all usefull information has allready been unpacked
00056 }


Member Data Documentation

PsEventCreator * PsEvent::_myEventCreator = new PsEventCreator ("PsEvent") [static, protected]
 

Definition at line 24 of file PsEvent.cxx.

PsDate PsEvent::date
 

date of sending

Definition at line 46 of file PsEvent.h.

Referenced by extract(), insertInList(), insertInStream(), operator=(), PsValuedEvent< UserType >::pack(), pack(), PsDistributedController::processEvent(), PsController::processEvent(), PsnReferenceObjectHandle::receiveEvent(), and PsSimulatedObject::sendEvent().

PsEventIdentifier PsEvent::eventId
 

the event identifier

Definition at line 42 of file PsEvent.h.

Referenced by extract(), insertInStream(), isSystem(), operator=(), PsValuedEvent< UserType >::pack(), pack(), PsInputConnectionEventListener< Type >::processEvent(), PsDistributedController::processEvent(), PsController::processEvent(), PsController::reactToControlledObjectsSystemEvents(), PsnReferenceObjectHandle::receiveEvent(), PsnMomeReferenceObjectHandle::receiveEvent(), PsSimulatedObject::sendEvent(), and PsnSignalDispatcher::sendEventsForSignal().

PsName PsEvent::receiver
 

intended receiver

Definition at line 54 of file PsEvent.h.

Referenced by PsMomeController::actOnSystemEvent(), PsController::actOnSystemEvent(), PsController::addToPendingEvents(), PsDistributedController::dispatchEvent(), extract(), insertInStream(), operator=(), PsValuedEvent< UserType >::pack(), pack(), PsDistributedController::processEvent(), PsController::reactToControlledObjectsSystemEvents(), PsnReferenceObjectHandle::receiveEvent(), PsSimulatedObject::sendEvent(), and PsnSignalDispatcher::sendEventsForSignal().

PsName PsEvent::sender
 

sender of the event

Definition at line 50 of file PsEvent.h.

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


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

Documentation generated on Mon Nov 25 15:25:59 2002

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