Commit 9a7d625b by yiannis

Latest

parent e7e51bee
......@@ -23,7 +23,7 @@ typedef vector<FILE *> TFileVec;
typedef vector<CDaqChannelInfo> TChanInfoVec;
const int cMaxDaqRec = 96*1024; ///< maximum size of data per DAQ record
const int cMaxDaqRec = 128*1024; ///< maximum size of data per DAQ record
const int cMaxChannels = 500; ///< maximum number of channels we can handle
///////////////////////////////////////////////////////////////////////////////////
......@@ -36,12 +36,9 @@ typedef enum {
eNO_OPTION = 0,
eEXPAND_DIFFERENTIAL = 1,
eFILL_MISSING = 2,
eFILL_MISSING_ORDER_0 = 4,
eFILL_MISSING_ORDER_1 = 8,
eFILL_MISSING_ORDER_2 = 16,
eINCLUDE_FRAME = 4,
eBINARY_FORMAT = 32,
eASCII_FORMAT = 64,
eINCLUDE_FRAME = 128
eASCII_FORMAT = 64
} TConvertOptions;
inline TConvertOptions
......@@ -218,8 +215,11 @@ public:
vector<TDaqByte> m_Data; // data is stored here
protected:
void Append(void *pData, int size, int count);
void Append(const void *pData, int size, int count);
void Replace(const void *pData, size_t size, int count);
void AllocSpace(int size, int count=0);
void Clear(void) { m_Data.clear(); m_Count = 0; };
int m_Count; // count of data, not in bytes but in type
};
......@@ -239,9 +239,9 @@ protected:
///
inline void
CDaqBuffer::Append(
void* p, ///< pointer to data to append
int size, ///< size in bytes of data
int count) ///< count of data items in that buffer
const void* p, ///< pointer to data to append
int size, ///< size in bytes of data
int count) ///< count of data items in that buffer
{
size_t oldsize = m_Data.size();
......@@ -251,6 +251,33 @@ CDaqBuffer::Append(
m_Count += count;
}
/////////////////////////////////////////////////////////////////////////////////
///
/// This function replaces the existing data with new one.
///
/// The function receives a pointer to the data, the size of the buffer in
/// bytes and a count of elements in that buffer. The class deals with
/// untyped buffers, so the only way to keep track of how many elements
/// are in the buffer (i.e., 2 integers as opposed to 8 bytes) is for the
/// caller to provide that information, which in this case is the count
/// argument.
///
inline void
CDaqBuffer::Replace(
const void* p, ///< pointer to data to append
size_t size, ///< size in bytes of data
int count) ///< count of data items in that buffer
{
size_t oldsize = m_Data.size();
if ( oldsize < size ) {
m_Data.resize(size);
}
memcpy(&m_Data[0], p, size);
m_Count = count;
}
/////////////////////////////////////////////////////////////////////////////////
///
......@@ -307,14 +334,16 @@ public:
{ return m_LastError; };
void Close(void);
bool FrameDropped(int frm);
bool FrameHasData(int frm);
void SetCallbacks( void errf(const char *, const char *), void progf(const char *, int, int));
bool LowLevelDataRead(const TIntVec* chans, TDataVec& data);
bool LowLevelDataRead(const TIntVec* chans, TDataVec& data, vector<TIntVec>* pFrameList=0);
bool LowLevelDataCopy(const TIntVec* chans, TFileVec& dest,
TConvertOptions options = eBINARY_FORMAT + eINCLUDE_FRAME);
bool GetFullData(const TIntVec* chans, TDataVec& data, const TIntVec& subsample,
TConvertOptions options = eFILL_MISSING_ORDER_0,
int frm1 = -1, int frm2 = -1);
bool GetFullData(const TIntVec* chans, TDataVec& data, TConvertOptions option = eNO_OPTION,
int frm1 = -1, int frm2 = -1, vector<TIntVec>* pFrameList = 0);
private:
enum TReadErrorCode {
......@@ -341,7 +370,7 @@ private:
bool WriteTocFile(const string& fname);
bool ReadTocFile(const string& fname);
TReadErrorCode ReadFrameHeader(int, int& ,int&, int&);
TReadErrorCode ReadDataForOneFrame(int, TIntVec, TDataVec &, void *);
TReadErrorCode ReadDataForOneFrame(int, TIntVec, TDataVec &, void *, vector<bool>&);
// bool GenPurpTraverse(bool frameCB(int frm, int numC, bool end),
// bool channelCB(int frm, int chan) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment