]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/AliHLTFilePublisher.h
Modification of operator=
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTFilePublisher.h
1 // @(#) $Id$
2
3 #ifndef ALIHLTFILEPUBLISHER_H
4 #define ALIHLTFILEPUBLISHER_H
5 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
6  * See cxx source for full Copyright notice                               */
7
8 /** @file   AliHLTFilePublisher.h
9     @author Matthias Richter
10     @date   
11     @brief  An HLT file publishing (data source) component.
12     @note   The class is used in Offline (AliRoot) context
13 */
14
15 #include "AliHLTDataSource.h"
16 #include <TList.h>
17
18 /**
19  * @class AliHLTFilePublisher
20  * An HLT data source component which publishes data from one or a sequence
21  * of files.<br>
22  *
23  * Component ID: \b FilePublisher <br>
24  * Library: \b libHLTBase (in order to use the component from the external
25  * interface, it might be necessary to specify a dummy library with the
26  * \em -componentlibrary argument).
27  *
28  * Mandatory arguments: <br>
29  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formating -->
30  * \li -datafile     <i> filename      </i>
31  * \li -datafilelist <i> file pattern  </i> <br>
32  *      not yet implemented
33  * \li -datatype     <i> datatype   dataorigin </i> <br>
34  *      data type ID and origin, e.g. <tt>-datatype CLUSTERS TPC </tt>
35  * \li -dataspec     <i> specification </i> <br>
36  *      data specification treated as decimal number or hex number if
37  *      prepended by '0x'
38  *
39  * Optional arguments:<br>
40  *
41  * The component needs at least one argument \em -datafile or \em -datafilelist.
42  * Both can occur multiple times. The \em -datatype and \em -dataspec
43  * parameters are valid for all files until the next occurrence of
44  * \em -datatype/spec
45  * @ingroup alihlt_component
46  */
47 class AliHLTFilePublisher : public AliHLTDataSource  {
48  public:
49   /** standard constructor */
50   AliHLTFilePublisher();
51   /** not a valid copy constructor, defined according to effective C++ style */
52   AliHLTFilePublisher(const AliHLTFilePublisher&);
53   /** not a valid assignment op, but defined according to effective C++ style */
54   AliHLTFilePublisher& operator=(const AliHLTFilePublisher&);
55   /** destructor */
56   virtual ~AliHLTFilePublisher();
57
58   const char* GetComponentID();
59   AliHLTComponentDataType GetOutputDataType();
60   void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
61   AliHLTComponent* Spawn();
62
63   /**
64    * Open all files.
65    * Opens all files from the file name list @ref fFileNames and adds TFile
66    * opjects to the TFiles list.
67    */
68   int OpenFiles();
69
70  protected:
71   /**
72    * Init method.
73    */
74   int DoInit( int argc, const char** argv );
75
76   /**
77    * Deinit method.
78    */
79   int DoDeinit();
80
81   /**
82    * Data processing method for the component.
83    * @param evtData       event data structure
84    * @param trigData      trigger data structure
85    * @param outputPtr     pointer to target buffer
86    * @param size          <i>input</i>: size of target buffer
87    *                      <i>output</i>:size of produced data
88    * @param outputBlocks  list to receive output block descriptors
89    * @return
90    */
91   int GetEvent( const AliHLTComponentEventData& evtData,
92                         AliHLTComponentTriggerData& trigData,
93                         AliHLTUInt8_t* outputPtr, 
94                         AliHLTUInt32_t& size,
95                         vector<AliHLTComponentBlockData>& outputBlocks );
96
97   /**
98    * Scan one argument and adjacent parameters.
99    * Can be overloaded by child classes in order to add additional arguments
100    * beyond the standard arguments of the file publisher. The method is called
101    * whenever a non-standard argument is recognized.
102    * @param argc           size of the argument array
103    * @param argv           agument array for component initialization
104    * @return number of processed members of the argv <br>
105    *         -EINVAL unknown argument <br>
106    *         -EPROTO parameter for argument missing <br>
107    */
108   virtual int ScanArgument(int argc, const char** argv);
109
110  protected:
111   /**
112    * Get the data type which is set for the current file
113    */
114   AliHLTComponentDataType GetCurrentDataType() const;
115
116   /**
117    * Get the data specification which is set for the current file
118    */
119   AliHLTUInt32_t          GetCurrentSpecification() const;
120   
121  private:
122   /** list of file names */
123   TList                   fFileNames;                              // see above
124   /** list of opened files */
125   TList                   fFiles;                                  // see above
126   /** current positions in the file list */
127   TObjLink*               fpCurrent;                               //! transient
128   /** data type */
129   AliHLTComponentDataType fDataType;                               // see above
130   /** data specification */
131   AliHLTUInt32_t          fSpecification;                          // see above
132   /** the maximum buffer size i.e. size of the biggest file */
133   Int_t                   fMaxSize;                                // see above
134
135   ClassDef(AliHLTFilePublisher, 0)
136 };
137 #endif