@brief Handling of Data Buffers for HLT components.
*/
-// see header file for class documentation
-// or
-// refer to README to build package
-// or
-// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
-
#if __GNUC__>= 3
using namespace std;
#endif
AliHLTDataBuffer::AliHLTRawBuffer::~AliHLTRawBuffer()
{
- // see header file for class documentation
if (fExternalPtr==NULL && fPtr) {
free(fPtr);
}
fTotalSize=0;
}
-int AliHLTDataBuffer::AliHLTRawBuffer::operator==(const void* ptr) const
+int AliHLTDataBuffer::AliHLTRawBuffer::operator==(void* ptr) const
{
// see header file for function documentation
- return fPtr == static_cast<const AliHLTUInt8_t*>(ptr);
+ return fPtr == static_cast<AliHLTUInt8_t*>(ptr);
}
-int AliHLTDataBuffer::AliHLTRawBuffer::operator<(const void* ptr) const
+int AliHLTDataBuffer::AliHLTRawBuffer::operator<(void* ptr) const
{
// see header file for function documentation
- int iResult=fPtr < static_cast<const AliHLTUInt8_t*>(ptr);
+ int iResult=fPtr < static_cast<AliHLTUInt8_t*>(ptr);
//printf("%p: %p <= %p (%d)\n", this, fPtr, ptr, iResult);
return iResult;
}
-int AliHLTDataBuffer::AliHLTRawBuffer::operator<=(const void* ptr) const
+int AliHLTDataBuffer::AliHLTRawBuffer::operator<=(void* ptr) const
{
// see header file for function documentation
- int iResult=fPtr <= static_cast<const AliHLTUInt8_t*>(ptr);
+ int iResult=fPtr <= static_cast<AliHLTUInt8_t*>(ptr);
//printf("%p: %p <= %p (%d)\n", this, fPtr, ptr, iResult);
return iResult;
}
-int AliHLTDataBuffer::AliHLTRawBuffer::operator>(const void* ptr) const
+int AliHLTDataBuffer::AliHLTRawBuffer::operator>(void* ptr) const
{
// see header file for function documentation
- int iResult=fPtr+fSize > static_cast<const AliHLTUInt8_t*>(ptr);
+ int iResult=fPtr+fSize > static_cast<AliHLTUInt8_t*>(ptr);
//printf("%p: %p + %d > %p (%d)\n", this, fPtr, fSize, ptr, iResult);
return iResult;
}
-int AliHLTDataBuffer::AliHLTRawBuffer::operator-(const void* ptr) const
+int AliHLTDataBuffer::AliHLTRawBuffer::operator-(void* ptr) const
{
// see header file for function documentation
- return static_cast<int>(static_cast<const AliHLTUInt8_t*>(ptr)-fPtr);
+ return static_cast<int>(static_cast<AliHLTUInt8_t*>(ptr)-fPtr);
}
int AliHLTDataBuffer::AliHLTRawBuffer::operator<(const AliHLTRawBuffer& op) const
return 1;
}
-int AliHLTDataBuffer::AliHLTRawPage::SetSize(const AliHLTDataBuffer::AliHLTRawBuffer* pBuffer, AliHLTUInt32_t size)
+int AliHLTDataBuffer::AliHLTRawPage::SetSize(AliHLTDataBuffer::AliHLTRawBuffer* pBuffer, AliHLTUInt32_t size)
{
/// set the size of a raw buffer and release the remaining part
int iResult=0;
return 1;
}
-bool AliHLTDataBuffer::AliHLTRawPage::HasBuffer(const AliHLTDataBuffer::AliHLTRawBuffer* pBuffer)
+bool AliHLTDataBuffer::AliHLTRawPage::HasBuffer(AliHLTDataBuffer::AliHLTRawBuffer* pBuffer)
{
/// check if the buffer is in this page
for (AliHLTRawBufferPList::iterator iter=fUsedBuffers.begin();
return 0;
}
-AliHLTDataBuffer::AliHLTRawPage* AliHLTDataBuffer::AliHLTRawPage::NextPage(const AliHLTDataBuffer::AliHLTRawPage* prev)
+AliHLTDataBuffer::AliHLTRawPage* AliHLTDataBuffer::AliHLTRawPage::NextPage(AliHLTDataBuffer::AliHLTRawPage* prev)
{
// get next global page
vector<AliHLTDataBuffer::AliHLTRawPage*>::iterator page=fgGlobalPages.begin();
-//-*- Mode: C++ -*-
-// $Id$
+// @(#) $Id$
#ifndef ALIHLTDATABUFFER_H
#define ALIHLTDATABUFFER_H
-//* This file is property of and copyright by the ALICE HLT Project *
-//* ALICE Experiment at CERN, All rights reserved. *
-//* See cxx source for full Copyright notice *
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
/** @file AliHLTDataBuffer.h
@author Matthias Richter
* @brief Descriptor of a data segment within the buffer.
*/
class AliHLTDataSegment {
+ friend class AliHLTDataBuffer;
+ friend class AliHLTConsumerDescriptor;
public:
AliHLTDataSegment()
:
AliHLTDataSegment(void* ptr, AliHLTUInt32_t offset, AliHLTUInt32_t size)
:
fDataType(kAliHLTVoidDataType),
- fPtr(reinterpret_cast<AliHLTUInt8_t*>(ptr)),
+ fPtr((AliHLTUInt8_t*)ptr),
fSegmentOffset(offset),
fSegmentSize(size),
fSpecification(0)
AliHLTDataSegment(void* ptr, AliHLTUInt32_t offset, AliHLTUInt32_t size, AliHLTComponentDataType dt, AliHLTUInt32_t spec)
:
fDataType(dt),
- fPtr(reinterpret_cast<AliHLTUInt8_t*>(ptr)),
+ fPtr((AliHLTUInt8_t*)ptr),
fSegmentOffset(offset),
fSegmentSize(size),
fSpecification(spec)
AliHLTUInt32_t fSegmentSize; // see above
/** data specification */
AliHLTUInt32_t fSpecification; // see above
-
- friend class AliHLTDataBuffer; // TODO: implement some getters/setters
};
class AliHLTRawBuffer;
/** adjust global page size */
static void SetGlobalPageSize(AliHLTUInt32_t size) {fgGlobalPageSize=size;}
/** find next page after prev, or first page */
- static AliHLTRawPage* NextPage(const AliHLTRawPage* prev=NULL);
+ static AliHLTRawPage* NextPage(AliHLTRawPage* prev=NULL);
/** alloc a buffer of specified size */
AliHLTRawBuffer* Alloc(AliHLTUInt32_t size);
/** free a buffer and merge consecutive free buffers */
int Free(AliHLTRawBuffer* pBuffer);
/** set the size of a raw buffer and release the remaining part */
- int SetSize(const AliHLTRawBuffer* pBuffer, AliHLTUInt32_t size);
+ int SetSize(AliHLTRawBuffer* pBuffer, AliHLTUInt32_t size);
/// check if the buffer is in this page
- bool HasBuffer(const AliHLTRawBuffer* pBuffer);
+ bool HasBuffer(AliHLTRawBuffer* pBuffer);
AliHLTUInt32_t Size() const {return fSize;}
AliHLTUInt32_t Capacity() const;
*/
void Print(const char* option);
- int operator==(const void* ptr) const;
- int operator==(const AliHLTUInt8_t* ptr) const {return fPtr==ptr;}
- int operator<(const void* ptr) const;
- int operator<=(const void* ptr) const;
- int operator>(const void* ptr) const;
- int operator-(const void* ptr) const;
- int operator<(const AliHLTRawBuffer& op) const;
- int operator<=(const AliHLTRawBuffer& op) const;
- int operator>(const AliHLTRawBuffer& op) const;
+ 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;
+ int operator-(void*) const;
+ int operator<(const AliHLTRawBuffer&) const;
+ int operator<=(const AliHLTRawBuffer&) const;
+ int operator>(const AliHLTRawBuffer&) const;
operator void*() const {return fPtr;}
operator AliHLTUInt8_t*() const {return fPtr;}