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

PsnAbstractFifo< Type > Class Template Reference

Abstract Fifo used to store attribute history information For thread safety reasons, this class should ensure that multiple reads and one write can be done in concurrent fashion and with coherant results. More...

#include <PsnAbstractFifo.h>

Inheritance diagram for PsnAbstractFifo< Type >:

Inheritance graph
[legend]
Collaboration diagram for PsnAbstractFifo< Type >:

Collaboration graph
[legend]
List of all members.

Public Methods

 PsnAbstractFifo (const int taille)
 constructor

virtual ~PsnAbstractFifo ()
 destructor

virtual int getMaximumNumberOfValues () const
 get the size of the fifo

virtual unsigned int getNumberOfPresentValues (int lookingFor=-1) const=0
 get the number of values in the fifo

virtual const Type & getPreceedingValue (const unsigned int index) const=0
 get a value before the current value

virtual const PsDategetPreceedingDate (const unsigned int indice) const=0
 get the date associated to a value before the current value

virtual void set (const Type &val, const PsDate &date)=0
 add a value to the fifo

virtual void setInPlace (const Type &val, const PsDate &date)=0
 make an allready copied value available for reading

virtual Type & getNextPlaceHolder ()=0
 get a reference to the next place that will be used to store a value

virtual void clear ()=0
 clear the fifo

virtual void printDebuggingInformation (void) const=0
 printDebuggingInformation print any usefull debugging information

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

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

virtual void unpack (PsIncomingSynchronisationMessage &)
 unpack an update from a message (suppose the value's timestamp is the message's timestamp

virtual void pack (PsOutgoingSynchronisationMessage &) const
 pack in an update message

virtual void unpackAllValues (PsIncomingSynchronisationMessage &)
 unpack a complete (implemented in a minimal fashion) from a message

virtual void packAllValues (PsOutgoingSynchronisationMessage &) const
 pack a complete message


Protected Attributes

unsigned int _fifoSize
 Number of values that can be contained in the FIFO.


Detailed Description

template<typename Type>
class PsnAbstractFifo< Type >

Abstract Fifo used to store attribute history information For thread safety reasons, this class should ensure that multiple reads and one write can be done in concurrent fashion and with coherant results.

Definition at line 29 of file PsnAbstractFifo.h.


Constructor & Destructor Documentation

template<typename Type>
PsnAbstractFifo< Type >::PsnAbstractFifo const int    taille
 

constructor

Definition at line 124 of file PsnAbstractFifo.h.

00124                                                         : _fifoSize ( taille ) {
00125 
00126 }

template<typename Type>
PsnAbstractFifo< Type >::~PsnAbstractFifo   [virtual]
 

destructor

Definition at line 129 of file PsnAbstractFifo.h.

00129                                           {
00130 
00131 } 


Member Function Documentation

template<typename Type>
virtual void PsnAbstractFifo< Type >::clear   [pure virtual]
 

clear the fifo

Implemented in PsnFifo< Type >, PsnMomeFifo< Type >, PsnMomeReaderFifo< Type >, and PsnMomeWriterFifo< Type >.

template<typename Type>
void PsnAbstractFifo< Type >::extract istream &    = cin [virtual]
 

extract from an input stream

Implements PsFlowable.

Definition at line 141 of file PsnAbstractFifo.h.

References PsDate, and PsnAbstractFifo< Type >::set().

00141                                                  {
00142    PsDate dateDerniereVal;
00143    Type data;
00144    in >> dateDerniereVal >> data ;
00145    set(data, dateDerniereVal);
00146 }

template<typename Type>
int PsnAbstractFifo< Type >::getMaximumNumberOfValues   const [virtual]
 

get the size of the fifo

Definition at line 119 of file PsnAbstractFifo.h.

References PsnAbstractFifo< Type >::_fifoSize.

00119                                                           {
00120    return _fifoSize ;
00121 }

template<typename Type>
virtual Type& PsnAbstractFifo< Type >::getNextPlaceHolder   [pure virtual]
 

get a reference to the next place that will be used to store a value

Implemented in PsnFifo< Type >, PsnMomeFifo< Type >, PsnMomeReaderFifo< Type >, and PsnMomeWriterFifo< Type >.

Referenced by PsnAbstractFifo< Type >::unpack(), and PsnAbstractFifo< Type >::unpackAllValues().

template<typename Type>
virtual unsigned int PsnAbstractFifo< Type >::getNumberOfPresentValues int    lookingFor = -1 const [pure virtual]
 

get the number of values in the fifo

Parameters:
lookingFor the number of values the caller is looking for. If == -1, get all values, otherwise, once lookingFor values are found, that number is returned

Implemented in PsnFifo< Type >, PsnMomeFifo< Type >, PsnMomeReaderFifo< Type >, and PsnMomeWriterFifo< Type >.

template<typename Type>
virtual const PsDate& PsnAbstractFifo< Type >::getPreceedingDate const unsigned int    indice const [pure virtual]
 

get the date associated to a value before the current value

Parameters:
index if 0, get the date of the most recent value, if 1, get the date associated to the preceeding value...

Implemented in PsnFifo< Type >, and PsnMomeFifo< Type >.

Referenced by PsnAbstractFifo< Type >::insertInStream(), and PsnAbstractFifo< Type >::packAllValues().

template<typename Type>
virtual const Type& PsnAbstractFifo< Type >::getPreceedingValue const unsigned int    index const [pure virtual]
 

get a value before the current value

Parameters:
index if 0, get the most recent value, if 1, get the preceeding value...

Implemented in PsnFifo< Type >, and PsnMomeFifo< Type >.

Referenced by PsnAbstractFifo< Type >::insertInStream(), PsnAbstractFifo< Type >::pack(), and PsnAbstractFifo< Type >::packAllValues().

template<typename Type>
void PsnAbstractFifo< Type >::insertInStream ostream &    = cout const [virtual]
 

insert in a output stream

Implements PsFlowable.

Definition at line 151 of file PsnAbstractFifo.h.

References PsnAbstractFifo< Type >::getPreceedingDate(), and PsnAbstractFifo< Type >::getPreceedingValue().

00152 {
00153    out << getPreceedingDate (0) << " "<<getPreceedingValue (0) << " ";
00154 }

template<typename Type>
void PsnAbstractFifo< Type >::pack PsOutgoingSynchronisationMessage   const [virtual]
 

pack in an update message

Reimplemented from PsFlowable.

Definition at line 176 of file PsnAbstractFifo.h.

References PsnAbstractFifo< Type >::getPreceedingValue().

00177 {
00178    getPreceedingValue (0).pack (out) ;
00179 }

template<typename Type>
void PsnAbstractFifo< Type >::packAllValues PsOutgoingSynchronisationMessage   const [virtual]
 

pack a complete message

Definition at line 182 of file PsnAbstractFifo.h.

References PsnAbstractFifo< Type >::getPreceedingDate(), and PsnAbstractFifo< Type >::getPreceedingValue().

00183 {
00184    // implement in a minimal fashion
00185    getPreceedingDate (0).pack(out) ;
00186    getPreceedingValue (0).pack (out) ;
00187 }

template<typename Type>
void PsnAbstractFifo< Type >::printDebuggingInformation void    const [pure virtual]
 

printDebuggingInformation print any usefull debugging information

Implemented in PsnFifo< Type >, PsnMomeFifo< Type >, PsnMomeReaderFifo< Type >, and PsnMomeWriterFifo< Type >.

Definition at line 134 of file PsnAbstractFifo.h.

References PsnAbstractFifo< Type >::_fifoSize.

Referenced by PsnMomeFifo< Type >::printDebuggingInformation(), and PsnFifo< Type >::printDebuggingInformation().

00134                                                             {
00135    cerr<< "Capacity of fifo : "<<_fifoSize<<endl;
00136 }

template<typename Type>
virtual void PsnAbstractFifo< Type >::set const Type &    val,
const PsDate   date
[pure virtual]
 

add a value to the fifo

Implemented in PsnFifo< Type >, PsnMomeFifo< Type >, PsnMomeReaderFifo< Type >, and PsnMomeWriterFifo< Type >.

Referenced by PsnAbstractFifo< Type >::extract().

template<typename Type>
virtual void PsnAbstractFifo< Type >::setInPlace const Type &    val,
const PsDate   date
[pure virtual]
 

make an allready copied value available for reading

Implemented in PsnFifo< Type >, PsnMomeFifo< Type >, PsnMomeReaderFifo< Type >, and PsnMomeWriterFifo< Type >.

Referenced by PsnAbstractFifo< Type >::unpack(), and PsnAbstractFifo< Type >::unpackAllValues().

template<typename Type>
void PsnAbstractFifo< Type >::unpack PsIncomingSynchronisationMessage   [virtual]
 

unpack an update from a message (suppose the value's timestamp is the message's timestamp

Reimplemented from PsFlowable.

Definition at line 158 of file PsnAbstractFifo.h.

References PsIncomingSynchronisationMessage::getMessageDate(), PsnAbstractFifo< Type >::getNextPlaceHolder(), and PsnAbstractFifo< Type >::setInPlace().

00159 {
00160    Type & receivedValue ( getNextPlaceHolder() ) ;
00161    receivedValue.unpack( in ) ;
00162    setInPlace( receivedValue, in.getMessageDate() );
00163 }

template<typename Type>
void PsnAbstractFifo< Type >::unpackAllValues PsIncomingSynchronisationMessage   [virtual]
 

unpack a complete (implemented in a minimal fashion) from a message

Definition at line 166 of file PsnAbstractFifo.h.

References PsnAbstractFifo< Type >::getNextPlaceHolder(), PsDate, and PsnAbstractFifo< Type >::setInPlace().

00167 {
00168    Type & receivedValue ( getNextPlaceHolder() ) ;
00169    PsDate dateOfReceivedValue ;
00170    dateOfReceivedValue.unpack ( in ) ;
00171    receivedValue.unpack( in ) ;
00172    setInPlace( receivedValue , dateOfReceivedValue );
00173 }


Member Data Documentation

template<typename Type>
unsigned int PsnAbstractFifo< Type >::_fifoSize [protected]
 

Number of values that can be contained in the FIFO.

Definition at line 105 of file PsnAbstractFifo.h.

Referenced by PsnMomeReaderFifo< Type >::findFirstValid(), PsnAbstractFifo< Type >::getMaximumNumberOfValues(), PsnFifo< Type >::getNextPlaceHolder(), PsnMomeWriterFifo< Type >::getNumberOfPresentValues(), PsnMomeReaderFifo< Type >::getNumberOfPresentValues(), PsnFifo< Type >::getNumberOfPresentValues(), PsnMomeWriterFifo< Type >::getOldestDateAfter(), PsnMomeFifo< Type >::getPreceedingDate(), PsnFifo< Type >::getPreceedingDate(), PsnMomeFifo< Type >::getPreceedingValue(), PsnFifo< Type >::getPreceedingValue(), PsnMomeFifo< Type >::printDebuggingInformation(), PsnFifo< Type >::printDebuggingInformation(), PsnAbstractFifo< Type >::printDebuggingInformation(), PsnMomeFifo< Type >::PsnMomeFifo(), PsnFifo< Type >::set(), and PsnFifo< Type >::setInPlace().


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

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

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