{
assert( buffer != NULL );
}
+
+ /**
+ * Copy constructor that performs a shallow copy.
+ * Since this class does not take direct ownership of the buffer, never
+ * allocates or deallocates memory, this can be allowed.
+ */
+ AliHLTMUONDataBlockReader(const AliHLTMUONDataBlockReader& reader)
+ {
+ fSize = reader.fSize;
+ fBlock = reader.fBlock;
+ fData = reader.fData;
+ }
+
+ /**
+ * Assignment operator performs a shallow copy.
+ * This is OK because this class does not take direct ownership of the
+ * output memory buffer.
+ */
+ AliHLTMUONDataBlockReader& operator = (const AliHLTMUONDataBlockReader& reader)
+ {
+ fSize = reader.fSize;
+ fBlock = reader.fBlock;
+ fData = reader.fData;
+ return *this;
+ }
/**
* Checks that the size of the buffer storing the data block is correct.
*/
AliHLTMUONDataBlockWriter(void* buffer, AliHLTUInt32_t size) :
fSize(size),
- fMaxArraySize(size - sizeof(DataBlockType)),
+ fMaxArraySize(size > sizeof(DataBlockType) ? size - sizeof(DataBlockType) : 0),
fBlock(reinterpret_cast<DataBlockType*>(buffer)),
fData(reinterpret_cast<DataElementType*>(
reinterpret_cast<DataBlockType*>(buffer) + 1
{
assert( buffer != NULL );
}
+
+ /**
+ * Copy constructor that performs a shallow copy.
+ * Since this class does not take direct ownership of the buffer, never
+ * allocates or deallocates memory, this can be allowed.
+ */
+ AliHLTMUONDataBlockWriter(const AliHLTMUONDataBlockWriter& writer)
+ {
+ fSize = writer.fSize;
+ fMaxArraySize = writer.fMaxArraySize;
+ fBlock = writer.fBlock;
+ fData = writer.fData;
+ }
+
+ /**
+ * Assignment operator performs a shallow copy.
+ * This is OK because this class does not take direct ownership of the
+ * output memory buffer.
+ */
+ AliHLTMUONDataBlockWriter& operator = (const AliHLTMUONDataBlockWriter& writer)
+ {
+ fSize = writer.fSize;
+ fMaxArraySize = writer.fMaxArraySize;
+ fBlock = writer.fBlock;
+ fData = writer.fData;
+ return *this;
+ }
/**
* Initialises the common data block header by setting the type and record