• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

include/sp605/Iterator.h (r4864/r3204)

Go to the documentation of this file.
00001 #ifndef SP605_ITERATOR_H
00002 #define SP605_ITERATOR_H
00003 
00004 #include "sp605/Message.h"
00005 
00006 #include "roc/Message.h"
00007 
00008 namespace sp605 {
00009 
00010    class Board;
00011 
00012    class Iterator {
00013       protected:
00014 
00015          enum IteratorMessageKind { kindNone, kindRoc, kindSpadic };
00016 
00017          enum { MaxGroupId = 2, MaxSpadicId = 4 };
00018 
00019          sp605::Board*  fBoard;      
00020 
00021          int            fFormat;     
00022 
00023          void*          fBuffer;     
00024          unsigned       fBufferLen;  
00025          unsigned       fBufferPos;  
00026 
00027          void*          fInterm;     
00028          unsigned       fIntermSize; 
00029          unsigned       fIntermFill; 
00030 
00031          unsigned       fSP605Id;    
00032 
00033          IteratorMessageKind fKind; 
00034 
00035          sp605::Message fMsg;        
00036          unsigned       fLastEpoch[MaxSpadicId][MaxGroupId];  
00037          unsigned       fLastSenderId; 
00038          unsigned       fSpadicId;  
00039 
00040          roc::Message   fRocMsg;     
00041          unsigned       fLastRocEpoch; 
00042 
00043          void           allocateInterm();
00044 
00045       public:
00046          Iterator(int fmt = formatSpadic10Optic);
00047          ~Iterator();
00048 
00049          void setFormat(int fmt) { fFormat = fmt; }
00050          int getFormat() const { return fFormat; }
00051 
00052          void setBoardId(unsigned id) { fSP605Id = id; }
00053          void resetBoardId() { fSP605Id = 0xffffffff; }
00054          bool isBoardId() const { return fSP605Id != 0xffffffff; }
00055          unsigned getBoardId() const { return isBoardId() ? fSP605Id : 0; }
00056 
00058          bool assign(void* buf, unsigned sz);
00059 
00061          bool nextBuffer(sp605::Board* brd, double tmout = 1.);
00062 
00064          bool next(double tmout=1.);
00065 
00067          bool at_the_end() const { return fBufferPos>=fBufferLen; }
00068 
00069 
00071          bool isSpadicMsg() const { return fKind == kindSpadic; }
00072          sp605::Message& msg() { return fMsg; }
00073 
00074          void setSpadicId(unsigned id) { fSpadicId = id; }
00075          unsigned getSpadicId() const { return fSpadicId; }
00076 
00077 
00079          bool isRocMsg() const { return fKind == kindRoc; }
00080          roc::Message& rocmsg() { return fRocMsg; }
00081 
00083          uint64_t getMsgFullTime() const;
00084          double getMsgFullTimeD() const;
00085 
00086          void printMessage();
00087 
00088    };
00089 }
00090 
00091 #endif

Generated on Tue Dec 10 2013 04:52:22 for ROCsoft by  doxygen 1.7.1