CARMA C++
DataFrameManager.h
Go to the documentation of this file.
1 #ifndef SZA_UTIL_DATAFRAMEMANAGER_H
2 #define SZA_UTIL_DATAFRAMEMANAGER_H
3 
12 #include "carma/szautil/DataType.h"
14 #include "carma/szautil/Mutex.h"
15 
16 namespace sza {
17  namespace util {
18 
24 
25  public:
26 
31  DataFrameManager(unsigned nBuffer);
34 
38  virtual ~DataFrameManager();
39 
43  void resize(unsigned int nBuffer);
44 
48  void pack(unsigned int* data, unsigned int ndata,
49  int startIndex=-1);
50 
54  void pack(unsigned long* data, unsigned int ndata,
55  int startIndex=-1);
56 
60  void pack(float* data, unsigned int ndata,
61  int startIndex=-1);
62 
66  void pack(DataFrame* frame, int startIndex);
67 
71  void fillBuffer(unsigned char val, unsigned int ndata);
72 
76  void fillBuffer(unsigned char val);
77 
81  void setErrorStatus(bool wasError);
82 
86  DataFrame* frame();
87 
94  void unpack(unsigned char* data, unsigned int ndata);
95 
101  void unpack(unsigned char* data);
102 
106  void advance(unsigned ndata);
107 
112  virtual void reinitialize();
113 
117  void lock();
118 
122  void unlock();
123 
128  virtual unsigned int getId() {
129  return 0;
130  };
131 
136  unsigned byteOffsetInFrameOfData();
137 
141  unsigned sizeInBytes();
142 
147  unsigned sizeInBytesOfData();
148 
152  virtual void operator=(DataFrameManager& fm);
153 
154  public:
155 
156  sza::util::DataFrame* frame_;// The data frame managed by this object
157 
158  bool dataIsInitialized_; // False until the DataFrame buffer
159  // has been allocated
160  unsigned currentIndex_; // Current index into the
161  // DataFrame buffer
162  unsigned nBuffer_; // The number of bytes in the buffer
163  unsigned nUsed_; // The number of bytes used
164 
165  private:
166 
170  void pack(void* data, unsigned int ndata, DataType::Type type,
171  int startIndex=-1);
172 
176  void initialize();
177 
178  }; // End class DataFrameManager
179 
180  }; // End namespace util
181 }; // End namespace sza
182 
183 #endif // End #ifndef
Tagged: Tue Jun 22 22:32:16 UTC 2004.
void resize(unsigned int nBuffer)
Resize the data frame.
DataFrame * frame()
Return a handle to the raw data frame managed by this object.
void fillBuffer(unsigned char val, unsigned int ndata)
Fill the next ndata registers with a constant value.
DataFrameManager()
Constructors.
virtual void reinitialize()
Reinitialize.
Tagged: Sat Mar 20 00:16:55 UTC 2004.
This is a base class for managing a generic dataframe of registers.
void setErrorStatus(bool wasError)
Set a global error status for this frame.
unsigned sizeInBytes()
Return the size in bytes of the frame managed by this object.
void unlock()
Unlock the frame.
void lock()
Lock the frame.
virtual ~DataFrameManager()
Destructor.
void advance(unsigned ndata)
Advance the internal buffer ndata elements.
unsigned sizeInBytesOfData()
Return the size in bytes of the data portion only, of the frame managed by this object.
virtual void operator=(DataFrameManager &fm)
Define an overloadable assignment operator.
Tagged: Sat Mar 27 16:28:13 PST 2004.
void pack(unsigned int *data, unsigned int ndata, int startIndex=-1)
Pack an array of unsigned ints.
virtual unsigned int getId()
Get a unique frame id based on integral MJD half-seconds.
void unpack(unsigned char *data, unsigned int ndata)
Unpack the next ndata elements of the frame into a passed byte array (incremental unpack) ...
A generic interface for a data frame consisting of contiguous blocks of arbitrary-sized types...
Definition: DataFrame.h:27
Tagged: Fri Nov 14 12:39:33 UTC 2003.
unsigned byteOffsetInFrameOfData()
The data portion of the buffer will be offset by the size in bytes of the header. ...