#include <PsnMomeFifo.h>
Inheritance diagram for PsnMomeFifo< Type >:


Public Methods | |
| PsnMomeFifo (const unsigned int, PsnRelaxedMemoryManager *myMemory) | |
| PsnMomeFifo (void *fifoAddress, const unsigned int) | |
| virtual | ~PsnMomeFifo () |
| virtual void | set (const Type &val, const PsDate &date)=0 |
| add a value to the fifo | |
| virtual unsigned int | getNumberOfPresentValues (int maxCherche=-1) const=0 |
| get the number of values in the fifo | |
| virtual const Type & | getPreceedingValue (const unsigned int indice) const |
| get a value before the current value | |
| virtual const PsDate & | getPreceedingDate (const unsigned int indice) const |
| get the date associated to a value before the current value | |
| 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 () const=0 |
| printDebuggingInformation print any usefull debugging information | |
| void * | fifo () |
| virtual void | resyncFifo (PsnRelaxedMemoryManager *myMemory) const |
Protected Methods | |
| virtual unsigned int | findFirstValid () const=0 |
Protected Attributes | |
| PsnAbstractArray< valeurDate > * | _tab |
| the array in wich the values are kept | |
| PsDate | _dateOfOldestValidValue |
| the date of the oldest valid value localy available | |
| unsigned int | _lastValidIndex |
| unsigned int | _offsetToMostRecentOfLastExamined |
| Context variable. | |
| unsigned int | _indexOfLastValueExamined |
| Context variable. | |
| PsnMutexLock | _accessToContext |
| a lock to protect acces to the context | |
Definition at line 40 of file PsnMomeFifo.h.
|
||||||||||||||||
|
Definition at line 197 of file PsnMomeFifo.h. References PsnMomeFifo< Type >::_dateOfOldestValidValue, PsnAbstractFifo< Type >::_fifoSize, PsnMomeFifo< Type >::_lastValidIndex, PsnMomeFifo< Type >::_tab, PsnRelaxedMemoryManager::getReadableQueueIndex(), and PsDate.
00198 : PsnAbstractFifo<Type>(taille), _offsetToMostRecentOfLastExamined(taille) { 00199 00200 myMemory->lockIfNeeded ( ) ; 00201 00202 _tab = new(myMemory) PsnMomeArray< valeurDate > ( taille, *myMemory) ; 00203 00204 myMemory->unlockIfNeeded ( ) ; 00205 00206 _dateOfOldestValidValue = PsDate ( -1 ); 00207 _lastValidIndex = ( PsnRelaxedMemoryManager::getReadableQueueIndex() - 1 + _fifoSize ) % _fifoSize ; |
|
||||||||||||||||
|
Definition at line 212 of file PsnMomeFifo.h. References PsnMomeFifo< Type >::_dateOfOldestValidValue, PsnAbstractFifo< Type >::_fifoSize, PsnMomeFifo< Type >::_lastValidIndex, PsnMomeFifo< Type >::_tab, PsnRelaxedMemoryManager::getReadableQueueIndex(), and PsDate.
00214 : PsnAbstractFifo<Type>(taille), 00215 _offsetToMostRecentOfLastExamined(taille) { 00216 00217 _tab = (PsnMomeArray< valeurDate > * ) fifoAddress ; 00218 00219 _dateOfOldestValidValue = PsDate ( -1 ); 00220 00221 _lastValidIndex = ( PsnRelaxedMemoryManager::getReadableQueueIndex() - 1 + _fifoSize ) % _fifoSize ; |
|
|||||||||
|
Definition at line 190 of file PsnMomeFifo.h.
00191 {
00192 #ifdef _DEBUGEXEC
00193 cerr<<"PsnMomeFifo<Type>::~PsnMomeFifo ()"<<endl;
00194 #endif
|
|
|||||||||
|
clear the fifo
Implements PsnAbstractFifo< Type >. Implemented in PsnMomeReaderFifo< Type >, and PsnMomeWriterFifo< Type >. |
|
|||||||||
|
Definition at line 111 of file PsnMomeFifo.h. References PsnMomeFifo< Type >::_tab.
00112 {
00113 return (void *)_tab ;
|
|
|||||||||
|
Implemented in PsnMomeReaderFifo< Type >, and PsnMomeWriterFifo< Type >. Referenced by PsnMomeFifo< Type >::getPreceedingDate(), and PsnMomeFifo< Type >::getPreceedingValue(). |
|
|||||||||
|
get a reference to the next place that will be used to store a value
Implements PsnAbstractFifo< Type >. Implemented in PsnMomeReaderFifo< Type >, and PsnMomeWriterFifo< Type >. |
|
||||||||||
|
get the number of values in the fifo
Implements PsnAbstractFifo< Type >. Implemented in PsnMomeReaderFifo< Type >, and PsnMomeWriterFifo< Type >. |
|
||||||||||
|
get the date associated to a value before the current value
Implements PsnAbstractFifo< Type >. Definition at line 158 of file PsnMomeFifo.h. References PsnMomeFifo< Type >::_dateOfOldestValidValue, PsnAbstractFifo< Type >::_fifoSize, PsnMomeFifo< Type >::findFirstValid(), PsnMomeFifo< Type >::printDebuggingInformation(), and PsDate.
00159 {
00160 #ifdef _DEBUGATTRIBUTSMOME
00161 cerr<<"PsnMomeFifo<"<<typeid(Type).name()<<">::"<<this<<"::getPreceedingDate ("<<offsetToMostRecent<<") const"<<endl;
00162 printDebuggingInformation();
00163 #endif
00164
00165 assert (offsetToMostRecent >= 0) ;
00166
00167 if (offsetToMostRecent > 4) cerr<<"C'est anormal de demander à "<<offsetToMostRecent<<endl;
00168 assert (offsetToMostRecent < _fifoSize - 2) ;
00169
00170 int lookAt = findFirstValid () ;
00171 unsigned int offsetToMostRecentOfLastExamined = -1 ;
00172
00173 if ( (*_tab)[lookAt].dateValeur >= _dateOfOldestValidValue ) offsetToMostRecentOfLastExamined++ ;
00174
00175
00176 while ( offsetToMostRecentOfLastExamined != offsetToMostRecent ) {
00177 if ( lookAt != 0 ) {
00178 lookAt--;
00179 }
00180 else {
00181 lookAt = _fifoSize - 1 ;
00182 }
00183
00184 if ( (*_tab)[lookAt].dateValeur >= _dateOfOldestValidValue ) offsetToMostRecentOfLastExamined++ ;
00185 }
00186
00187 return (*_tab)[lookAt].dateValeur ;
|
|
||||||||||
|
get a value before the current value
Implements PsnAbstractFifo< Type >. Definition at line 116 of file PsnMomeFifo.h. References PsnMomeFifo< Type >::_dateOfOldestValidValue, PsnAbstractFifo< Type >::_fifoSize, PsnMomeFifo< Type >::findFirstValid(), and PsnMomeFifo< Type >::printDebuggingInformation().
00117 {
00118 #ifdef _DEBUGATTRIBUTSMOME
00119 cerr<<"PsnMomeFifo<"<<typeid(Type).name()<<">::"<<this<<"::getPreceedingValue ("<<offsetToMostRecent<<") const"<<endl;
00120 #endif
00121
00122 assert (offsetToMostRecent >= 0) ;
00123 assert (offsetToMostRecent < _fifoSize - 2 ) ;
00124
00125 int lookAt = findFirstValid () ;
00126 #ifdef _DEBUGATTRIBUTSMOME
00127 cerr<<"First valid is : "<<lookAt<<endl;
00128 printDebuggingInformation() ;
00129 #endif
00130
00131 unsigned int offsetToMostRecentOfLastFound = -1 ;
00132
00133 if ( (*_tab)[lookAt].dateValeur >= _dateOfOldestValidValue ) offsetToMostRecentOfLastFound++ ;
00134
00135 while ( offsetToMostRecentOfLastFound != offsetToMostRecent ) {
00136 if ( lookAt != 0 ) {
00137 lookAt--;
00138 }
00139 else {
00140 lookAt = _fifoSize - 1 ;
00141 }
00142
00143 if ( (*_tab)[lookAt].dateValeur >= _dateOfOldestValidValue ) offsetToMostRecentOfLastFound++ ;
00144 }
00145
00146 return (*_tab)[lookAt].valeur ;
|
|
|||||||||
|
||||||||||
|
Definition at line 150 of file PsnMomeFifo.h. References PsnMomeFifo< Type >::_tab. Referenced by PsnMomeReaderFifo< Type >::printDebuggingInformation().
00151 {
00152 ((PsnMomeArray<valeurDate> *) _tab )->resync( myMemory ) ;
|
|
||||||||||||||||
|
add a value to the fifo
Implements PsnAbstractFifo< Type >. Implemented in PsnMomeReaderFifo< Type >, and PsnMomeWriterFifo< Type >. |
|
||||||||||||||||
|
make an allready copied value available for reading
Implements PsnAbstractFifo< Type >. Implemented in PsnMomeReaderFifo< Type >, and PsnMomeWriterFifo< Type >. |
|
|||||
|
a lock to protect acces to the context
Definition at line 92 of file PsnMomeFifo.h. |
|
|||||
|
the date of the oldest valid value localy available
Definition at line 84 of file PsnMomeFifo.h. Referenced by PsnMomeWriterFifo< Type >::clear(), PsnMomeWriterFifo< Type >::getNumberOfPresentValues(), PsnMomeReaderFifo< Type >::getNumberOfPresentValues(), PsnMomeWriterFifo< Type >::getOldestDateAfter(), PsnMomeFifo< Type >::getPreceedingDate(), PsnMomeFifo< Type >::getPreceedingValue(), PsnMomeFifo< Type >::printDebuggingInformation(), PsnMomeFifo< Type >::PsnMomeFifo(), PsnMomeWriterFifo< Type >::set(), and PsnMomeWriterFifo< Type >::setInPlace(). |
|
|||||
|
Context variable.
Definition at line 90 of file PsnMomeFifo.h. |
|
|||||
|
|||||
|
Context variable.
Definition at line 88 of file PsnMomeFifo.h. |
|
|||||
|
the array in wich the values are kept
Definition at line 81 of file PsnMomeFifo.h. Referenced by PsnMomeFifo< Type >::fifo(), PsnMomeWriterFifo< Type >::getOldestDateAfter(), PsnMomeReaderFifo< Type >::printDebuggingInformation(), PsnMomeFifo< Type >::printDebuggingInformation(), PsnMomeFifo< Type >::PsnMomeFifo(), PsnMomeFifo< Type >::resyncFifo(), PsnMomeWriterFifo< Type >::set(), and PsnMomeWriterFifo< Type >::setInPlace(). |
| Documentation generated on Mon Nov 25 15:26:09 2002 |
Generated with doxygen 1.2.12 by Dimitri van Heesch , 1997-2001 |