@date
@brief The control class for HLTOUT data. */
- // see header file for class documentation
- // or
- // refer to README to build package
- // or
- // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+// see header file for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+#include <cerrno>
#include "AliHLTOUT.h"
/** ROOT macro for the implementation of ROOT specific class methods */
ClassImp(AliHLTOUT)
AliHLTOUT::AliHLTOUT()
-{
+ :
+ fSearchDataType(kAliHLTVoidDataType),
+ fSearchSpecification(kAliHLTVoidDataSpec),
+ fbLocked(0),
+ fBlockDescList(),
+ fCurrent(fBlockDescList.begin()),
+ fpBuffer(NULL)
+{
// see header file for class documentation
// or
// refer to README to build package
}
AliHLTOUT::~AliHLTOUT()
-{
+{
+ // see header file for class documentation
+}
+
+int AliHLTOUT::GetNofDataBlocks()
+{
+ // see header file for class documentation
+ return fBlockDescList.size();
+}
+
+int AliHLTOUT::SelectFirstDataBlock(AliHLTComponentDataType dt, AliHLTUInt32_t spec)
+{
+ // see header file for class documentation
+ if (fbLocked) return -EPERM;
+ fCurrent=fBlockDescList.begin();
+ fSearchDataType=dt;
+ fSearchSpecification=spec;
+ return SelectNextDataBlock();
+}
+
+int AliHLTOUT::SelectNextDataBlock()
+{
+ // see header file for class documentation
+ if (fbLocked) return -EPERM;
+ int iResult=-ENOENT;
+ while (fCurrent!=fBlockDescList.end() && iResult==-ENOENT) {
+ if ((fSearchDataType==kAliHLTAnyDataType || (*fCurrent)==fSearchDataType) &&
+ fSearchSpecification==kAliHLTVoidDataSpec || (*fCurrent)==fSearchSpecification) {
+ iResult=0;
+ }
+ }
+ return iResult;
+}
+
+int AliHLTOUT::GetDataBlockDescription(AliHLTComponentDataType& dt, AliHLTUInt32_t& spec)
+{
+ // see header file for class documentation
+ int iResult=-ENOENT;
+ if (fCurrent!=fBlockDescList.end()) {
+ iResult=0;
+ dt=(*fCurrent);
+ spec=(*fCurrent);
+ }
+ return iResult;
+}
+
+int AliHLTOUT::GetDataBuffer(const AliHLTUInt8_t* &pBuffer, AliHLTUInt32_t& size)
+{
+ // see header file for class documentation
+ int iResult=-ENOENT;
+ pBuffer=NULL;
+ size=0;
+ if (fCurrent!=fBlockDescList.end()) {
+ if ((iResult=GetDataBuffer((*fCurrent).GetIndex(), pBuffer, size))>=0) {
+ fpBuffer=pBuffer;
+ }
+ }
+ return iResult;
+}
+
+int AliHLTOUT::ReleaseDataBuffer(const AliHLTUInt8_t* pBuffer)
+{
+ // see header file for class documentation
+ int iResult=0;
+ if (pBuffer==fpBuffer) {
+ fpBuffer=NULL;
+ } else {
+ HLTWarning("buffer %p does not match the provided one %p", pBuffer, fpBuffer);
+ }
+ return iResult;
+}
+
+int AliHLTOUT::AddBlockDescriptor(const AliHLTOUTBlockDescriptor desc)
+{
// see header file for class documentation
+ if (!fbLocked) return -EPERM;
+ int iResult=0;
+ fBlockDescList.push_back(desc);
+ return iResult;
}
// refer to README to build package
// or
// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
*/
+#include <vector>
#include "AliHLTLogging.h"
/**
/** standard destructor */
virtual ~AliHLTOUT();
+ /**
+ * Get number of data blocks in the HLTOUT data
+ */
+ int GetNofDataBlocks();
+
+ /**
+ * Select the first data block of a certain data type and specification.
+ * The selection criteria can be of kAliHLTAnyDataType and/or
+ * kAliHLTVoidDataSpec in order to be ignored and just match any data block.
+ * @param dt [in] data type to match <br>
+ * @param spec [in] data specification to match <br>
+ * @return identifier >=0 if success, neg. error code if failed <br>
+ * -ENOENT if no block found <br>
+ * -EPERM if access denied (object locked)
+ */
+ int SelectFirstDataBlock(AliHLTComponentDataType dt, AliHLTUInt32_t spec);
+
+ /**
+ * Select the next data block of data type and specification of the previous
+ * call to @ref SelectFirstDataBlock.
+ * @return identifier >=0 if success, neg. error code if failed <br>
+ * -ENOENT if no block found <br>
+ * -EPERM if access denied (object locked)
+ */
+ int SelectNextDataBlock();
+
+ /**
+ * Get properties of the selected data block.
+ * @param dt [out] data type of the selected block
+ * @param spec [out] data specification of the selected block
+ */
+ int GetDataBlockDescription(AliHLTComponentDataType& dt, AliHLTUInt32_t& spec);
+
+ /**
+ * Get buffer of the selected data block.
+ * @param pBuffer [out] buffer of the selected data block
+ * @param size [out] size of the selected data block
+ */
+ int GetDataBuffer(const AliHLTUInt8_t* &pBuffer, AliHLTUInt32_t& size);
+
+ /**
+ * Release buffer after use.
+ * @param pBuffer [in] buffer of the selected data block
+ */
+ int ReleaseDataBuffer(const AliHLTUInt8_t* pBuffer);
+
+ /**
+ * Locking guard for the AliHLTOUT object.
+ * If the object is locked, the selection of data blocks can not be changed.
+ */
+ class AliHLTOUTLockGuard {
+ public:
+ /** constructor */
+ AliHLTOUTLockGuard(AliHLTOUT* pInstance) : fpInstance(pInstance)
+ {if (fpInstance) fpInstance->fbLocked=1;}
+ /** destructor */
+ ~AliHLTOUTLockGuard()
+ {if (fpInstance) fpInstance->fbLocked=0;}
+
+ private:
+ /** standard constructor prohibited */
+ AliHLTOUTLockGuard();
+ /** copy constructor prohibited */
+ AliHLTOUTLockGuard(const AliHLTOUTLockGuard&);
+ /** assignment operator prohibited */
+ AliHLTOUTLockGuard& operator=(const AliHLTOUTLockGuard&);
+
+ /** the AliHLTOUT instance the guard is locking */
+ AliHLTOUT* fpInstance; //!transient
+ };
+
+ /**
+ * Block descriptor.
+ */
+ class AliHLTOUTBlockDescriptor {
+ public:
+ AliHLTOUTBlockDescriptor(AliHLTComponentDataType dt, AliHLTUInt32_t spec, AliHLTUInt32_t index)
+ : fDataType(dt), fSpecification(spec), fIndex(index) {};
+ ~AliHLTOUTBlockDescriptor() {}
+
+ operator AliHLTComponentDataType() const {return fDataType;}
+ operator AliHLTUInt32_t() const {return fSpecification;}
+ int operator==(AliHLTComponentDataType dt) const {return dt==fDataType;}
+ int operator==(AliHLTUInt32_t spec) const {return spec==fSpecification;}
+
+ AliHLTUInt32_t GetIndex() const {return fIndex;}
+ private:
+ /** data type of the block */
+ AliHLTComponentDataType fDataType; //!transient
+ /** data specification of the block */
+ AliHLTUInt32_t fSpecification; //!transient
+ /** index in the data stream */
+ AliHLTUInt32_t fIndex; //!transient
+ };
+
protected:
+ /**
+ * Add a block descriptor.
+ * This is done by the child classes generating the index. The AliHLTOUT
+ * object must be locked for index generation.
+ * @param desc the block descriptor
+ * @return 0 if success, -EPERM if access denied
+ */
+ int AddBlockDescriptor(const AliHLTOUTBlockDescriptor desc);
private:
/** copy constructor prohibited */
/** assignment operator prohibited */
AliHLTOUT& operator=(const AliHLTOUT&);
+ /**
+ * Generate the index of the HLTOUT data.
+ * Must be implemented by the child classes.
+ */
+ virtual int GenerateIndex()=0;
+
+ /**
+ * Get the data buffer
+ * @param index [in] index of the block
+ * @param pBuffer [out] buffer of the selected data block
+ * @param size [out] size of the selected data block
+ */
+ virtual int GetDataBuffer(AliHLTUInt32_t index, const AliHLTUInt8_t* &pBuffer,
+ AliHLTUInt32_t& size)=0;
+
+ /** data type for the current block search, set from @ref SelectFirstDataBlock */
+ AliHLTComponentDataType fSearchDataType; //!transient
+
+ /** data specification for the current block search */
+ AliHLTUInt32_t fSearchSpecification; //!transient
+
+ /** instance locked or not */
+ int fbLocked; //!transient
+
+ /** list of block descriptors */
+ vector<AliHLTOUTBlockDescriptor> fBlockDescList; //!transient
+
+ /** current position in the list */
+ vector<AliHLTOUTBlockDescriptor>::iterator fCurrent; //!transient
+
+ /** data buffer under processing */
+ const AliHLTUInt8_t* fpBuffer; //!transient
+
ClassDef(AliHLTOUT, 0)
};
#endif
--- /dev/null
+// $Id$
+
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project *
+ * ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
+ * for The ALICE HLT Project. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+/** @file AliHLTOUTHomerBuffer.cxx
+ @author Matthias Richter
+ @date
+ @brief HLTOUT data wrapper for AliRawReader. */
+
+// see header file for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+
+#include <cerrno>
+#include "AliHLTOUTHomerBuffer.h"
+#include "AliHLTHOMERReader.h"
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTOUTHomerBuffer)
+
+AliHLTOUTHomerBuffer::AliHLTOUTHomerBuffer(const AliHLTUInt8_t* pBuffer)
+ :
+ AliHLTOUT(),
+ fpBuffer(pBuffer),
+ fpReader(NULL)
+{
+ // see header file for class documentation
+ // or
+ // refer to README to build package
+ // or
+ // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+}
+
+AliHLTOUTHomerBuffer::~AliHLTOUTHomerBuffer()
+{
+ // see header file for class documentation
+}
+
+int AliHLTOUTHomerBuffer::GenerateIndex()
+{
+ // see header file for class documentation
+ int iResult=0;
+ return iResult;
+}
+
+int AliHLTOUTHomerBuffer::GetDataBuffer(AliHLTUInt32_t index, const AliHLTUInt8_t* &pBuffer,
+ AliHLTUInt32_t& size)
+{
+ // see header file for class documentation
+ int iResult=0;
+ if (fpReader) {
+ if ((pBuffer=static_cast<const AliHLTUInt8_t*>(fpReader->GetBlockData(index)))!=NULL) {
+ size=fpReader->GetBlockDataLength(index);
+ } else {
+ iResult=-ENOENT;
+ }
+ } else {
+ iResult=-ENODEV;
+ }
+ return iResult;
+}
--- /dev/null
+//-*- Mode: C++ -*-
+// @(#) $Id$
+
+#ifndef ALIHLTOUTHOMERBUFFER_H
+#define ALIHLTOUTHOMERBUFFER_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 */
+
+/** @file AliHLTOUTHomerBuffer.h
+ @author Matthias Richter
+ @date
+ @brief HLTOUT data wrapper for a data buffer.
+
+// see below for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+ */
+#include "AliHLTOUT.h"
+
+class HOMERReader;
+
+/**
+ * @class AliHLTOUTHomerBuffer
+ * Handler of HLTOUT data for buffer input.
+ */
+class AliHLTOUTHomerBuffer : public AliHLTOUT {
+ public:
+ /** constructor */
+ AliHLTOUTHomerBuffer(const AliHLTUInt8_t* pBuffer);
+ /** destructor */
+ virtual ~AliHLTOUTHomerBuffer();
+
+ protected:
+
+ private:
+ /** standard constructor prohibited */
+ AliHLTOUTHomerBuffer();
+ /** copy constructor prohibited */
+ AliHLTOUTHomerBuffer(const AliHLTOUTHomerBuffer&);
+ /** assignment operator prohibited */
+ AliHLTOUTHomerBuffer& operator=(const AliHLTOUTHomerBuffer&);
+
+ /**
+ * Generate the index of the HLTOUT data from the data buffer.
+ */
+ virtual int GenerateIndex();
+
+ /**
+ * Get the data buffer
+ * @param index [in] index of the block
+ * @param pBuffer [out] buffer of the selected data block
+ * @param size [out] size of the selected data block
+ */
+ virtual int GetDataBuffer(AliHLTUInt32_t index, const AliHLTUInt8_t* &pBuffer,
+ AliHLTUInt32_t& size);
+
+ /** data buffer */
+ const AliHLTUInt8_t* fpBuffer; //! transient
+
+ /** instance of the HOMER reader */
+ HOMERReader* fpReader; //!transient
+
+ ClassDef(AliHLTOUTHomerBuffer, 0)
+};
+#endif
AliHLTOfflineDataSink.h \
AliHLTModuleAgent.h \
AliHLTOUT.h \
+ AliHLTOUTHomerBuffer.h \
AliHLTOUTHandler.h \
AliHLTMemoryFile.h \
AliHLTMessage.h
PACKCFLAGS := ${HLTCLFAGS}
PACKDCXXFLAGS:= ${HLTDCXXFLAGS}
-EINCLUDE := HLT/BASE
+# the libHLTbase depends on the abstract interface of the monitoring reader
+# and needs include patch HLT/BASE/HOMER because of that. There is no library
+# dependency. Objects are intantianted dynamically.
+EINCLUDE := HLT/BASE HLT/BASE/HOMER