}
}
+void AliHLTComponent::SetDataType(AliHLTComponentDataType& dt, AliHLTUInt64_t id, AliHLTUInt32_t origin)
+{
+ // see header file for function documentation
+ dt.fStructSize=sizeof(AliHLTComponentDataType);
+ assert(kAliHLTComponentDataTypefIDsize==sizeof(id));
+ assert(kAliHLTComponentDataTypefOriginSize==sizeof(origin));
+ memcpy(&dt.fID, &id, kAliHLTComponentDataTypefIDsize);
+ memcpy(&dt.fOrigin, &origin, kAliHLTComponentDataTypefOriginSize);
+}
+
void AliHLTComponent::FillEventData(AliHLTComponentEventData& evtData)
{
// see header file for function documentation
*/
static void SetDataType(AliHLTComponentDataType& tgtdt, const char* id, const char* origin);
+ /**
+ * Set the ID and Origin of an AliHLTComponentDataType structure.
+ * Given the fact that the data type ID is 64bit wide and origin 32, this helper
+ * function sets the data type from those two parameters.
+ * @param tgtdt target data type structure
+ * @param id 64bit id
+ * @param origin 32bit origin
+ */
+ static void SetDataType(AliHLTComponentDataType& dt, AliHLTUInt64_t id, AliHLTUInt32_t orig);
+
/**
* Stopwatch type for benchmarking.
*/
return pReader;
}
-AliHLTHOMERReader* AliHLTHOMERLibManager::OpenReader(const AliHLTUInt8_t* pBuffer, int size)
+AliHLTHOMERReader* AliHLTHOMERLibManager::OpenReaderBuffer(const AliHLTUInt8_t* pBuffer, int size)
{
// see header file for class documentation
if (fLibraryStatus<0) return NULL;
* Load HOMER library dynamically and create object working on the provided
* buffer.
*/
- AliHLTHOMERReader* OpenReader(const AliHLTUInt8_t* pBuffer, int size);
+ AliHLTHOMERReader* OpenReaderBuffer(const AliHLTUInt8_t* pBuffer, int size);
/**
* Delete a HOMER reader.
{
// see header file for class documentation
int iResult=0;
+ SetStatusFlag(kCollecting);
if ((iResult=GenerateIndex())>=0) {
if ((iResult=InitHandlers())>=0) {
}
}
+ ClearStatusFlag(kCollecting);
return iResult;
}
{
// see header file for class documentation
if (CheckStatusFlag(kLocked)) return -EPERM;
+ if (fCurrent==fBlockDescList.end()) return -ENOENT;
fCurrent++;
return FindAndSelectDataBlock();
}
if ((*fCurrent)==fSearchDataType &&
fSearchSpecification==kAliHLTVoidDataSpec || (*fCurrent)==fSearchSpecification &&
1/*fSearchHandlerType==AliHLTModuleAgent::kUnknownOutput*/) {
- iResult=0;
+ iResult=fCurrent->GetIndex();
// TODO: check the byte order on the current system and the byte order of the
// data block, print warning when missmatch and user did not check
//AliHLTOUTByteOrder_t blockBO=CheckByteOrder();
// TODO: check the alignment on the current system and the alignment of the
// data block, print warning when missmatch and user did not check
ClearStatusFlag(kAlignmentChecked);
+
+ break;
}
fCurrent++;
}
AliHLTUInt32_t AliHLTOUT::GetDataBlockIndex()
{
// see header file for class documentation
- assert(0); // not implemented
- return AliHLTOUTInvalidIndex;
+ if (fCurrent==fBlockDescList.end()) return AliHLTOUTInvalidIndex;
+ return fCurrent->GetIndex();
}
int AliHLTOUT::GetDataBuffer(const AliHLTUInt8_t* &pBuffer, AliHLTUInt32_t& size)
// see header file for class documentation
int iResult=0;
AliHLTOUTIndexList remnants;
- for (iResult=SelectFirstDataBlock(kAliHLTAnyDataType, kAliHLTVoidDataSpec); iResult>0; iResult=SelectNextDataBlock()) {
+ for (iResult=SelectFirstDataBlock(kAliHLTAnyDataType, kAliHLTVoidDataSpec); iResult>=0; iResult=SelectNextDataBlock()) {
remnants.push_back(GetDataBlockIndex());
AliHLTComponentDataType dt=kAliHLTVoidDataType;
AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
return *this;
}
-AliHLTUInt32_t AliHLTOUT::AliHLTOUTHandlerListEntry::operator[](int i) const {
+AliHLTUInt32_t AliHLTOUT::AliHLTOUTHandlerListEntry::operator[](int i) const
+{
+ // see header file for class documentation
return fBlocks.size()>i?fBlocks[i]:AliHLTOUTInvalidIndex;
}
bool AliHLTOUT::AliHLTOUTHandlerListEntry::operator==(const AliHLTOUTHandlerListEntry& entry) const
{
+ // see header file for class documentation
+ assert(0); // not yet implemented
return false;
}
-void AliHLTOUT::AliHLTOUTHandlerListEntry::AddIndex(AliHLTUInt32_t index) {
+void AliHLTOUT::AliHLTOUTHandlerListEntry::AddIndex(AliHLTUInt32_t index)
+{
+ // see header file for class documentation
fBlocks.push_back(index);
}
* neg. error code if failed <br>
* -EPERM if access denied (object locked)
*/
- int SelectFirstDataBlock(AliHLTComponentDataType dt, AliHLTUInt32_t spec,
+ int SelectFirstDataBlock(AliHLTComponentDataType dt=kAliHLTAnyDataType,
+ AliHLTUInt32_t spec=kAliHLTVoidDataSpec,
AliHLTModuleAgent::AliHLTOUTHandlerType handlerType=AliHLTModuleAgent::kUnknownOutput);
/**
int iResult=0;
if (!fpReader) {
if (fpManager) {
- fpReader=fpManager->OpenReader(fpBuffer, fSize);
+ fpReader=fpManager->OpenReaderBuffer(fpBuffer, fSize);
}
}
if (fpReader) {
{
// see header file for class documentation
int iResult=0;
- if (pReader) {
+ if (pReader && pReader->ReadNextEvent()==0) {
AliHLTUInt32_t nofBlocks=pReader->GetBlockCnt();
AliHLTUInt32_t tmp1=0x1;
AliHLTUInt32_t tmp2=offset;
homer_uint32 origin=pReader->GetBlockDataOrigin( i );
homer_uint32 spec=pReader->GetBlockDataSpec( i );
AliHLTComponentDataType dt;
- memcpy(&dt.fID, &id, kAliHLTComponentDataTypefIDsize);
- memcpy(&dt.fOrigin, &origin, kAliHLTComponentDataTypefOriginSize);
+ AliHLTComponent::SetDataType(dt, id, origin);
AliHLTOUTBlockDescriptor desc(dt, spec, offset|i);
+ HLTDebug("adding block %d: %s %#x", i, AliHLTComponent::DataType2Text(dt).c_str(), spec);
iResult=AddBlockDescriptor(desc);
}
} else {
while (fpRawreader->ReadNextData(pSrc) && pSrc!=NULL && iResult>=0) {
AliHLTUInt32_t id=(fpRawreader->GetEquipmentId())<<fgkIdShift;
int size=fpRawreader->GetDataSize();
- AliHLTHOMERReader* pReader=fpManager->OpenReader(pSrc, size);
+ AliHLTHOMERReader* pReader=fpManager->OpenReaderBuffer(pSrc, size);
if (pReader) {
iResult=ScanReader(pReader, id);
fpManager->DeleteReader(pReader);
fpRawreader->SelectEquipment(-1, id, id);
UChar_t* pSrc=NULL;
if (fpRawreader->ReadNextData(pSrc) && pSrc!=NULL) {
- fpCurrent=fpManager->OpenReader(pSrc, size);
+ fpCurrent=fpManager->OpenReaderBuffer(pSrc, size);
} else {
iResult=-ENOSYS;
}
for (int n=0; n<(int)evtData.fBlockCnt; n++ ) {
memset( homerHeader, 0, sizeof(homer_uint64)*kCount_64b_Words );
homerDescriptor.Initialize();
- homerDescriptor.SetType(reinterpret_cast<homer_uint64>(blocks[n].fDataType.fID));
- homerDescriptor.SetSubType1(reinterpret_cast<homer_uint64>(blocks[n].fDataType.fOrigin));
+ homerDescriptor.SetType(*(reinterpret_cast<const homer_uint64*>(blocks[n].fDataType.fID)));
+ homerDescriptor.SetSubType1(*(reinterpret_cast<const homer_uint32*>(blocks[n].fDataType.fOrigin)));
homerDescriptor.SetSubType2(static_cast<homer_uint64>(blocks[n].fSpecification));
homerDescriptor.SetBlockSize(blocks[n].fSize);
int writerNo=ShuffleWriters(fWriters, blocks[n].fSize);