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

PsEvent.cxx

Go to the documentation of this file.
00001 /*
00002  * This file is part of openMask © INRIA, CNRS, Universite de Rennes 1 1993-2002, thereinafter the Software
00003  * 
00004  * The Software has been developped within the Siames Project. 
00005  * INRIA, the University of Rennes 1 and CNRS jointly hold intellectual property rights
00006  * 
00007  * The Software has been registered with the Agence pour la Protection des
00008  * Programmes (APP) under registration number IDDN.FR.001.510008.00.S.P.2001.000.41200
00009  *
00010  * This file may be distributed under the terms of the Q Public License
00011  * version 1.0 as defined by Trolltech AS of Norway and appearing in the file
00012  * LICENSE.QPL included in the packaging of this file.
00013  *
00014  * Licensees holding valid specific licenses issued by INRIA, CNRS or Université de Rennes 1 
00015  * for the software may use this file in accordance with that specific license 
00016  *
00017  */
00018 
00019 #include<PsEvent.h>
00020 
00021 #include "PsnEventAssociationList.h"
00022 #include "PsEventCreator.h"
00023 
00024 PsEventCreator * PsEvent::_myEventCreator = new PsEventCreator ("PsEvent") ;
00025 
00026 
00027 
00028 PsEvent::PsEvent ( const PsEvent & originalEvent ) :
00029    eventId ( originalEvent.eventId ),
00030    date ( originalEvent.date ),
00031    sender ( originalEvent.sender ),
00032    receiver ( originalEvent.receiver )
00033 {
00034 }
00035 
00036 
00037 
00038 PsEvent & PsEvent::operator= (const PsEvent & evenement) 
00039 {
00040   eventId = evenement.eventId ;
00041   date = evenement.date ;
00042   sender = evenement.sender ;
00043   receiver = evenement.receiver ;
00044   return(*this);
00045 }
00046 
00047 PsEvent * PsEvent::clone () const {
00048    return new PsEvent (*this) ;
00049 }
00050 
00051 
00052 
00053 void PsEvent::unpack (PsIncomingSynchronisationMessage & in) 
00054 {
00055    //do nothing : all usefull information has allready been unpacked
00056 }
00057    
00058    
00059 void PsEvent::pack (PsOutgoingSynchronisationMessage & out) const 
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 }
00071 
00072 
00073 
00074 void PsEvent::insertInStream (ostream & out) const {
00075    out << eventId << " "
00076        << date << " "
00077        << sender << " "
00078        << receiver << " " ;
00079 }
00080 
00081 void PsEvent::extract (istream & in){
00082    int i ;
00083    in >> eventId
00084       >> date
00085       >> sender
00086       >> receiver ;
00087 }
00088 
00089 PsEvent::PsEvent(const PsEventIdentifier & eventId, const PsDate & date, const PsName & sender, const PsName & receiver ) : 
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 }
00099 
00100 PsEvent::~PsEvent() 
00101 {
00102    //cerr<<"PsEvent::~PsEvent() "<<*this<<endl;
00103 }
00104 
00105 
00106 bool PsEvent::isSystem() const {
00107   return eventId.isSystemEvent () ;
00108 }
00109 
00110 
00111 
00112 PsEvent * PsEvent::insertInList(list<PsEvent *> * aList, PsEvent * event) {
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 }
00124 

logo OpenMask

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

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