3 /**************************************************************************
4 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
6 * Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
7 * Timm Steinbeck <timm@kip.uni-heidelberg.de> *
8 * for The ALICE Off-line Project. *
10 * Permission to use, copy, modify and distribute this software and its *
11 * documentation strictly for non-commercial purposes is hereby granted *
12 * without fee, provided that the above copyright notice appears in all *
13 * copies and that both the copyright notice and this permission notice *
14 * appear in the supporting documentation. The authors make no claims *
15 * about the suitability of this software for any purpose. It is *
16 * provided "as is" without express or implied warranty. *
17 **************************************************************************/
19 /** @file AliHLTComponent.cxx
20 @author Matthias Richter, Timm Steinbeck
22 @brief Base class implementation for HLT components. */
28 #include "AliHLTComponent.h"
29 #include "AliHLTComponentHandler.h"
31 #include "AliHLTSystem.h"
33 /** ROOT macro for the implementation of ROOT specific class methods */
34 ClassImp(AliHLTComponent)
36 AliHLTComponent::AliHLTComponent()
38 memset(&fEnvironment, 0, sizeof(AliHLTComponentEnvironment));
39 if (fpComponentHandler)
40 fpComponentHandler->ScheduleRegister(this);
43 AliHLTComponent::~AliHLTComponent()
47 AliHLTComponentHandler* AliHLTComponent::fpComponentHandler=NULL;
49 int AliHLTComponent::Init( AliHLTComponentEnvironment* environ, void* environ_param, int argc, const char** argv )
53 memcpy(&fEnvironment, environ, sizeof(AliHLTComponentEnvironment));
54 fEnvironment.fParam=environ_param;
56 iResult=DoInit(argc, argv);
60 int AliHLTComponent::Deinit()
67 void AliHLTComponent::DataType2Text( const AliHLTComponent_DataType& type, char output[14] ) {
68 memset( output, 0, 14 );
69 strncat( output, type.fOrigin, 4 );
70 strcat( output, ":" );
71 strncat( output, type.fID, 8 );
74 int AliHLTComponent::MakeOutputDataBlockList( const vector<AliHLTComponent_BlockData>& blocks, AliHLTUInt32_t* blockCount,
75 AliHLTComponent_BlockData** outputBlocks ) {
76 if ( !blockCount || !outputBlocks )
78 AliHLTUInt32_t count = blocks.size();
85 *outputBlocks = reinterpret_cast<AliHLTComponent_BlockData*>( AllocMemory( sizeof(AliHLTComponent_BlockData)*count ) );
88 for ( unsigned long i = 0; i < count; i++ )
89 (*outputBlocks)[i] = blocks[i];
95 int AliHLTComponent::FindMatchingDataTypes(AliHLTComponent* pConsumer, vector<AliHLTComponent_DataType>* tgtList)
99 vector<AliHLTComponent_DataType> ctlist;
100 ((AliHLTComponent*)pConsumer)->GetInputDataTypes(ctlist);
101 vector<AliHLTComponent_DataType>::iterator type=ctlist.begin();
102 while (type!=ctlist.end() && iResult==0) {
103 if ((*type)==GetOutputDataType()) {
104 if (tgtList) tgtList->push_back(*type);