@note The class is used in Offline (AliRoot) context
*/
+// see below for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
#include <vector>
#include "AliHLTLogging.h"
#include "AliHLTDataTypes.h"
-//#include "AliHLTDefinitions.h"
#include "TObject.h"
-//#include "TList.h"
class AliHLTComponent;
class AliHLTConsumerDescriptor;
/* standard constructor
*/
AliHLTDataBuffer();
- /** not a valid copy constructor, defined according to effective C++ style */
- AliHLTDataBuffer(const AliHLTDataBuffer&);
- /** not a valid assignment op, but defined according to effective C++ style */
- AliHLTDataBuffer& operator=(const AliHLTDataBuffer&);
/** destructor */
virtual ~AliHLTDataBuffer();
int GetNofSegments();
/**
- * Get the number of consumers
+ * Get the total number of consumers.
+ * This gives the number of consumers regardless of their state.
* @return number of consumers
*/
int GetNofConsumers();
/**
- * Get the number of active consumers
+ * Get the number of consumers which still need to be processed during
+ * the current event.
+ * @return number of consumers
+ */
+ int GetNofPendingConsumers();
+
+ /**
+ * Get the number of consumers currently under processing.
* @return number of active consumers
*/
int GetNofActiveConsumers();
* @brief Descriptor of a data segment within the buffer.
*/
class AliHLTDataSegment {
+ friend class AliHLTDataBuffer;
+ friend class AliHLTConsumerDescriptor;
public:
AliHLTDataSegment()
:
{
memset(&fDataType, 0, sizeof(AliHLTComponentDataType));
}
+ private:
/** the data type of this segment */
AliHLTComponentDataType fDataType; // see above
/** offset in byte within the data buffer */
public:
/** standard constructor */
AliHLTRawBuffer() : fSize(0), fTotalSize(0), fPtr(NULL) {}
- /** not a valid copy constructor, defined according to effective C++ style */
- AliHLTRawBuffer(const AliHLTRawBuffer&) : fSize(0), fTotalSize(0), fPtr(NULL) {}
- /** not a valid assignment op, but defined according to effective C++ style */
- AliHLTRawBuffer& operator=(const AliHLTRawBuffer&) {return *this;}
- /** standard destructor */
- virtual ~AliHLTRawBuffer() {}
+ /** constructor */
+ AliHLTRawBuffer(AliHLTUInt32_t size);
+ /** destructor */
+ virtual ~AliHLTRawBuffer();
+
+ /**
+ * Use a fraction of the buffer.
+ * @param size size in bytes to be used
+ * @return pointer to buffer
+ */
+ AliHLTUInt8_t* UseBuffer(AliHLTUInt32_t size);
+
+ /**
+ * Check whether buffer fits for a request.
+ * @param size size of the request in bytes
+ * @return 1 if buffer is big enough, 0 if not
+ */
+ int CheckSize(AliHLTUInt32_t size) const;
+
+ /**
+ * Get used size of the buffer
+ */
+ AliHLTUInt32_t GetUsedSize() const {return fSize;}
+
+ /**
+ * Get total size of the buffer
+ */
+ AliHLTUInt32_t GetTotalSize() const {return fTotalSize;}
+
+ /**
+ * Get pointer of data buffer
+ */
+ AliHLTUInt8_t* GetPointer() const {return fPtr;}
+
+ /**
+ * Write check pattern
+ */
+ int WritePattern(const char* pattern, int size);
+
+ /**
+ * Check pattern
+ */
+ int CheckPattern(const char* pattern, int size) const;
+
+ /**
+ * Reset buffer.
+ * Data buffer remains allocated, used size set to 0
+ */
+ int Reset();
+
+ int operator==(void*) const;
+ int operator==(AliHLTUInt8_t* ptr) const {return fPtr==ptr;}
+ int operator<=(void*) const;
+ int operator>(void*) const;
+ int operator-(void*) const;
+
+ operator void*() const {return fPtr;}
+ operator AliHLTUInt8_t*() const {return fPtr;}
+
+ private:
+ /** copy constructor prohibited */
+ AliHLTRawBuffer(const AliHLTRawBuffer&);
+ /** assignment operator prohibited */
+ AliHLTRawBuffer& operator=(const AliHLTRawBuffer&);
+
/** size of the currently occupied partition of the buffer */
AliHLTUInt32_t fSize; // see above
/** total size of the buffer, including safety margin */
AliHLTUInt32_t fTotalSize; // see above
/** the buffer */
- void* fPtr; //! transient
+ AliHLTUInt8_t* fPtr; //! transient
};
private:
+ /** copy constructor prohibited */
+ AliHLTDataBuffer(const AliHLTDataBuffer&);
+ /** assignment operator prohibited */
+ AliHLTDataBuffer& operator=(const AliHLTDataBuffer&);
+
/* lets see if this is needed
AliHLTDataSegment* FindDataSegment(AliHLTComponentDataType datatype);
*/