]>
Commit | Line | Data |
---|---|---|
f23a6e1a | 1 | // $Id$ |
2 | ||
3 | /************************************************************************** | |
4 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
5 | * * | |
6 | * Authors: Matthias Richter <Matthias.Richter@ift.uib.no> * | |
7 | * Timm Steinbeck <timm@kip.uni-heidelberg.de> * | |
8 | * Artur Szostak <artursz@iafrica.com> * | |
9 | * for The ALICE Off-line Project. * | |
10 | * * | |
11 | * Permission to use, copy, modify and distribute this software and its * | |
12 | * documentation strictly for non-commercial purposes is hereby granted * | |
13 | * without fee, provided that the above copyright notice appears in all * | |
14 | * copies and that both the copyright notice and this permission notice * | |
15 | * appear in the supporting documentation. The authors make no claims * | |
16 | * about the suitability of this software for any purpose. It is * | |
17 | * provided "as is" without express or implied warranty. * | |
18 | **************************************************************************/ | |
19 | ||
20 | /////////////////////////////////////////////////////////////////////////////// | |
21 | // // | |
22 | // base class for HLT components // | |
23 | // // | |
24 | /////////////////////////////////////////////////////////////////////////////// | |
25 | ||
26 | #if __GNUC__== 3 | |
27 | using namespace std; | |
28 | #endif | |
29 | ||
30 | #include "AliHLTComponent.h" | |
31 | #include "AliHLTComponentHandler.h" | |
a5854ddd | 32 | #include <string> |
f23a6e1a | 33 | #include "AliHLTSystem.h" |
34 | ||
35 | ClassImp(AliHLTComponent) | |
36 | ||
37 | AliHLTComponentHandler* AliHLTComponent::fpComponentHandler=NULL; | |
38 | ||
39 | AliHLTComponent::AliHLTComponent() | |
40 | { | |
41 | memset(&fEnvironment, 0, sizeof(AliHLTComponentEnvironment)); | |
42 | if (fpComponentHandler) | |
43 | fpComponentHandler->ScheduleRegister(this); | |
44 | } | |
45 | ||
46 | AliHLTComponent::~AliHLTComponent() | |
47 | { | |
48 | } | |
49 | ||
50 | int AliHLTComponent::Init( AliHLTComponentEnvironment* environ, void* environ_param, int argc, const char** argv ) | |
51 | { | |
52 | int iResult=0; | |
53 | if (environ) { | |
54 | memcpy(&fEnvironment, environ, sizeof(AliHLTComponentEnvironment)); | |
55 | fEnvironment.fParam=environ_param; | |
56 | } | |
57 | iResult=DoInit(argc, argv); | |
58 | return iResult; | |
59 | } | |
60 | ||
61 | int AliHLTComponent::Deinit() | |
62 | { | |
63 | int iResult=0; | |
64 | iResult=DoDeinit(); | |
65 | return iResult; | |
66 | } | |
fa2e9b7c | 67 | |
68 | void AliHLTComponent::DataType2Text( const AliHLTComponent_DataType& type, char output[14] ) { | |
69 | memset( output, 0, 14 ); | |
70 | strncat( output, type.fOrigin, 4 ); | |
71 | strcat( output, ":" ); | |
72 | strncat( output, type.fID, 8 ); | |
73 | } | |
74 | ||
75 | int AliHLTComponent::MakeOutputDataBlockList( const vector<AliHLTComponent_BlockData>& blocks, AliHLTUInt32_t* blockCount, | |
76 | AliHLTComponent_BlockData** outputBlocks ) { | |
77 | if ( !blockCount || !outputBlocks ) | |
78 | return EFAULT; | |
79 | AliHLTUInt32_t count = blocks.size(); | |
80 | if ( !count ) | |
81 | { | |
82 | *blockCount = 0; | |
83 | *outputBlocks = NULL; | |
84 | return 0; | |
85 | } | |
86 | *outputBlocks = reinterpret_cast<AliHLTComponent_BlockData*>( AllocMemory( sizeof(AliHLTComponent_BlockData)*count ) ); | |
87 | if ( !*outputBlocks ) | |
88 | return ENOMEM; | |
89 | for ( unsigned long i = 0; i < count; i++ ) | |
90 | (*outputBlocks)[i] = blocks[i]; | |
91 | *blockCount = count; | |
92 | return 0; | |
93 | ||
94 | } |