8 #ifndef M3DATAINTERFACE_HH_ 9 #define M3DATAINTERFACE_HH_ 42 template<
typename SetType >
55 void set_at( SetType value,
unsigned index )
70 throw M3Exception() <<
"Unable to make a digitized unsigned data interface with data type size " << aDataTypeSize;
81 throw M3Exception() <<
"Unable to make a digitized signed data interface with data type size " << aDataTypeSize;
84 else if( aDataFormat ==
sAnalog )
90 throw M3Exception() <<
"Unable to make a analog data interface with data type size " << aDataTypeSize;
95 throw M3Exception() <<
"Invalid combination of data format <" << aDataFormat <<
">, data type size <" << aDataTypeSize <<
">";
184 template<
typename SetType >
191 SetInterface( aDataTypeSize, aDataFormat, aSampleSize );
197 void set_at( SetType value,
unsigned index )
202 void SetInterface(
unsigned aDataTypeSize, uint32_t aDataFormat,
unsigned aSampleSize = 2 )
209 throw M3Exception() <<
"Unable to make a digitized unsigned data interface with data type size " << aDataTypeSize;
212 else if( aDataFormat ==
sDigitizedS && aSampleSize == 1 )
217 throw M3Exception() <<
"Unable to make a digitized signed data interface with data type size " << aDataTypeSize;
221 else if( aDataFormat ==
sAnalog && aSampleSize == 2 )
227 throw M3Exception() <<
"Unable to make a analog data interface with data type size " << aDataTypeSize;
232 throw M3Exception() <<
"Invalid combination of data format <" << aDataFormat <<
">, data type size <" << aDataTypeSize <<
"> and sample size <" << aSampleSize <<
">";
255 fF4CompBytesData[ index ][ 0 ] = value[ 0 ];
256 fF4CompBytesData[ index ][ 1 ] = value[ 1 ];
261 fF8CompBytesData[ index ][ 0 ] = value[ 0 ];
262 fF8CompBytesData[ index ][ 1 ] = value[ 1 ];
296 template<
typename ReturnType >
309 ReturnType
at(
unsigned index )
const 324 throw M3Exception() <<
"Unable to make a digitized unsigned data interface with data type size " << aDataTypeSize;
335 throw M3Exception() <<
"Unable to make a digitized signed data interface with data type size " << aDataTypeSize;
339 else if( aDataFormat ==
sAnalog )
345 throw M3Exception() <<
"Unable to make a analog data interface with data type size " << aDataTypeSize;
350 throw M3Exception() <<
"Invalid combination of data format <" << aDataFormat <<
">, data type size <" << aDataTypeSize <<
">";
361 ReturnType
at_u1(
unsigned index )
const 366 ReturnType
at_u2(
unsigned index )
const 371 ReturnType
at_u4(
unsigned index )
const 376 ReturnType
at_u8(
unsigned index )
const 381 ReturnType
at_i1(
unsigned index )
const 386 ReturnType
at_i2(
unsigned index )
const 391 ReturnType
at_i4(
unsigned index )
const 396 ReturnType
at_i8(
unsigned index )
const 401 ReturnType
at_f4(
unsigned index )
const 406 ReturnType
at_f8(
unsigned index )
const 439 template<
typename ReturnType >
446 SetInterface( aDataTypeSize, aDataFormat, aSampleSize );
452 const ReturnType&
at(
unsigned index )
const 457 void SetInterface(
unsigned aDataTypeSize, uint32_t aDataFormat,
unsigned aSampleSize = 2 )
464 throw M3Exception() <<
"Unable to make a digitized (unsigned) data interface with data type size " << aDataTypeSize;
467 else if( aDataFormat ==
sDigitizedS && aSampleSize == 1 )
472 throw M3Exception() <<
"Unable to make a digitized (signed) data interface with data type size " << aDataTypeSize;
475 else if( aDataFormat ==
sAnalog && aSampleSize == 2 )
481 throw M3Exception() <<
"Unable to make a analog data interface with data type size " << aDataTypeSize;
486 throw M3Exception() <<
"Invalid combination of data format <" << aDataFormat <<
">, data type size <" << aDataTypeSize <<
"> and sample size <" << aSampleSize <<
">";
497 const ReturnType&
at_u1(
unsigned index )
const 504 const ReturnType&
at_i1(
unsigned index )
const 513 fBuffer[ 0 ] = fF4CompBytesData[ index ][ 0 ];
514 fBuffer[ 1 ] = fF4CompBytesData[ index ][ 1 ];
520 fBuffer[ 0 ] = fF8CompBytesData[ index ][ 0 ];
521 fBuffer[ 1 ] = fF8CompBytesData[ index ][ 1 ];
void set_at(SetType value, unsigned index)
void SetInterface(unsigned aDataTypeSize, uint32_t aDataFormat, unsigned aSampleSize=2)
const ReturnType & at(unsigned index) const
const f8_complex * fF8CompBytesData
void set_at_f8_comp(SetType value, unsigned index)
ReturnType at_i1(unsigned index) const
void SetInterface(unsigned aDataTypeSize, uint32_t aDataFormat)
void set_at_u2(SetType value, unsigned index)
f8_complex * fF8CompBytesData
static const uint32_t sDigitizedUS
const uint8_t * fUByteData
M3ComplexDataWriter(byte_type *aData, unsigned aDataTypeSize, uint32_t aDataFormat, unsigned aSampleSize=2)
ReturnType at_u2(unsigned index) const
void SetData(const byte_type *aData)
void set_at_u1(SetType value, unsigned index)
ReturnType at_u4(unsigned index) const
ReturnType at_f8(unsigned index) const
ReturnType at_i4(unsigned index) const
void set_at_i4(SetType value, unsigned index)
const int8_t * fIByteData
void set_at(SetType value, unsigned index)
const int8_t * fIByteData
ReturnType at(unsigned index) const
const uint64_t * fU8BytesData
void set_at_i8(SetType value, unsigned index)
ReturnType at_f4(unsigned index) const
const int16_t * fI2BytesData
static const uint32_t sDigitizedS
ReturnType at_i2(unsigned index) const
M3DataReader(const byte_type *aData, unsigned aDataTypeSize, uint32_t aDataFormat)
void SetInterface(unsigned aDataTypeSize, uint32_t aDataFormat)
void SetData(const byte_type *aData)
double f8_complex[2]
Binary-compatible to fftw_complex.
const ReturnType & at_i1(unsigned index) const
const ReturnType & at_f4_comp(unsigned index) const
const uint16_t * fU2BytesData
Interface class for complex data types.
void set_at_f4(SetType value, unsigned index)
Specialized exception class for Monarch3.
const f4_complex * fF4CompBytesData
M3DataWriter(byte_type *aData, unsigned aDataTypeSize, uint32_t aDataFormat)
void(M3DataWriter::* fArrayFcn)(SetType, unsigned)
M3ComplexDataReader(const byte_type *aData, unsigned aDataTypeSize, uint32_t aDataFormat, unsigned aSampleSize=2)
void set_at_u8(SetType value, unsigned index)
const uint8_t * fUByteData
const ReturnType &(M3ComplexDataReader::* fArrayFcn)(unsigned) const
float f4_complex[2]
Binary-compatible to fftwf_complex.
void SetData(const byte_type *aData)
const ReturnType & at_f8_comp(unsigned index) const
void set_at_i2(SetType value, unsigned index)
Interface class for complex data types.
Interface class for a variety of data types.
f4_complex * fF4CompBytesData
void set_at_i1(SetType value, unsigned index)
void set_at_u4(SetType value, unsigned index)
void set_at_u1(SetType value, unsigned index)
const ReturnType & at_u1(unsigned index) const
void set_at_i1(SetType value, unsigned index)
void SetInterface(unsigned aDataTypeSize, uint32_t aDataFormat, unsigned aSampleSize=2)
Interface class for a variety of data types.
static const uint32_t sAnalog
ReturnType at_u1(unsigned index) const
void SetData(const byte_type *aData)
const int32_t * fI4BytesData
ReturnType at_i8(unsigned index) const
void set_at_f8(SetType value, unsigned index)
const uint32_t * fU4BytesData
const double * fF8BytesData
const int64_t * fI8BytesData
void set_at_f4_comp(SetType value, unsigned index)
ReturnType at_u8(unsigned index) const
const float * fF4BytesData