]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/BASE/AliHLTConsumerDescriptor.cxx
Updated macros for PHOS alignment calculation
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTConsumerDescriptor.cxx
CommitLineData
6235cd38 1// $Id$
2
c515df4c 3///**************************************************************************
4// * This file is property of and copyright by the *
5// * ALICE Experiment at CERN, All rights reserved. *
6// * *
7// * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
8// * for The ALICE HLT Project. *
9// * *
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// **************************************************************************
6235cd38 18
c515df4c 19/// @file AliHLTConsumerDescriptor.cxx
20/// @author Matthias Richter
21/// @date
22/// @brief Helper class to describe a consumer component.
23///
6235cd38 24
25#include "AliHLTConsumerDescriptor.h"
26
27/** ROOT macro for the implementation of ROOT specific class methods */
28ClassImp(AliHLTConsumerDescriptor)
29
30AliHLTConsumerDescriptor::AliHLTConsumerDescriptor()
31 :
32 fpConsumer(NULL),
33 fSegments()
34{
35 // see header file for class documentation
36 // or
37 // refer to README to build package
38 // or
39 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
40 fSegments.clear();
41}
42
43AliHLTConsumerDescriptor::AliHLTConsumerDescriptor(AliHLTComponent* pConsumer)
44 :
45 fpConsumer(pConsumer),
46 fSegments()
47{
48 // see header file for function documentation
49 fSegments.clear();
50}
51
6235cd38 52AliHLTConsumerDescriptor::~AliHLTConsumerDescriptor()
53{
54 // see header file for function documentation
55 if (fSegments.size()>0) {
56 //HLTWarning("unreleased data segments found");
57 }
58}
59
b46ca65e 60int AliHLTConsumerDescriptor::SetActiveDataSegment(AliHLTDataBuffer::AliHLTDataSegment segment)
6235cd38 61{
62 // see header file for function documentation
63 int iResult=0;
6235cd38 64 fSegments.push_back(segment);
65 //HLTDebug("set active segment (%d:%d) for consumer %p", offset, size, this);
66 return iResult;
67}
68
b46ca65e 69int AliHLTConsumerDescriptor::CheckActiveDataSegment(AliHLTDataBuffer::AliHLTDataSegment segment)
6235cd38 70{
71 // see header file for function documentation
72 int iResult=0;
73 if (fSegments.size()>0) {
c515df4c 74 AliHLTDataBuffer::AliHLTDataSegmentList::iterator element=fSegments.begin();
b46ca65e 75 while (element!=fSegments.end()) {
76 if ((iResult=(segment==(*element)))>0) {
6235cd38 77 break;
78 }
b46ca65e 79 element++;
6235cd38 80 }
81 } else {
82 //HLTWarning("no data segment active for consumer %p", this);
83 iResult=-ENODATA;
84 }
85 return iResult;
86}
87
b46ca65e 88int AliHLTConsumerDescriptor::ReleaseActiveDataSegment(AliHLTDataBuffer::AliHLTDataSegment segment)
6235cd38 89{
90 // see header file for function documentation
91 int iResult=0;
92 if (fSegments.size()>0) {
c515df4c 93 AliHLTDataBuffer::AliHLTDataSegmentList::iterator element=fSegments.begin();
b46ca65e 94 while (element!=fSegments.end()) {
95 if ((iResult=(segment==(*element)))>0) {
96 fSegments.erase(element);
6235cd38 97 break;
98 }
b46ca65e 99 element++;
6235cd38 100 }
101 if (iResult==0) {
102 //HLTWarning("no data segment (%d:%d) active for consumer %p", offset, size, this);
103 iResult=-ENOENT;
104 }
105 } else {
106 //HLTWarning("no data segment active for consumer %p", this);
107 iResult=-ENODATA;
108 }
109 return iResult;
110}
12c8715e 111
112void AliHLTConsumerDescriptor::Print(const char* /*option*/) const
113{
114 // print info about this descriptor
115 cout << "AliHLTConsumerDescriptor " << this
116 << " component ID " << (fpConsumer?fpConsumer->GetComponentID():"NULL")
117 //<< " chain ID " << (fpConsumer?fpConsumer->GetChainId():"NULL")
118 << endl;
119 for (unsigned i=0; i<fSegments.size(); i++) {
120 cout << " ";
121 fSegments[i].Print("");
122 }
123}