From a8aea8578979486065b6e7e398f8c45480c5faea Mon Sep 17 00:00:00 2001 From: richterm Date: Wed, 14 Mar 2007 10:29:36 +0000 Subject: [PATCH] moved from BASE to BASE/util --- HLT/BASE/util/AliHLTFilePublisher.h | 138 ++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 HLT/BASE/util/AliHLTFilePublisher.h diff --git a/HLT/BASE/util/AliHLTFilePublisher.h b/HLT/BASE/util/AliHLTFilePublisher.h new file mode 100644 index 00000000000..58964ffa3a3 --- /dev/null +++ b/HLT/BASE/util/AliHLTFilePublisher.h @@ -0,0 +1,138 @@ +// -*- Mode: C++ -*- +// @(#) $Id$ + +#ifndef ALIHLTFILEPUBLISHER_H +#define ALIHLTFILEPUBLISHER_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/** @file AliHLTFilePublisher.h + @author Matthias Richter + @date + @brief An HLT file publishing (data source) component. + @note The class is used in Offline (AliRoot) context +*/ + +#include "AliHLTDataSource.h" +#include + +/** + * @class AliHLTFilePublisher + * An HLT data source component which publishes data from one or a sequence + * of files.
+ * + * Component ID: \b FilePublisher
+ * Library: \b libHLTBase (in order to use the component from the external + * interface, it might be necessary to specify a dummy library with the + * \em -componentlibrary argument). + * + * Mandatory arguments:
+ * + * \li -datafile filename + * \li -datafilelist file pattern
+ * not yet implemented + * \li -datatype datatype dataorigin
+ * data type ID and origin, e.g. -datatype CLUSTERS TPC + * \li -dataspec specification
+ * data specification treated as decimal number or hex number if + * prepended by '0x' + * + * Optional arguments:
+ * + * The component needs at least one argument \em -datafile or \em -datafilelist. + * Both can occur multiple times. The \em -datatype and \em -dataspec + * parameters are valid for all files until the next occurrence of + * \em -datatype/spec + * @ingroup alihlt_component + */ +class AliHLTFilePublisher : public AliHLTDataSource { + public: + /** standard constructor */ + AliHLTFilePublisher(); + /** not a valid copy constructor, defined according to effective C++ style */ + AliHLTFilePublisher(const AliHLTFilePublisher&); + /** not a valid assignment op, but defined according to effective C++ style */ + AliHLTFilePublisher& operator=(const AliHLTFilePublisher&); + /** destructor */ + virtual ~AliHLTFilePublisher(); + + const char* GetComponentID(); + AliHLTComponentDataType GetOutputDataType(); + void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ); + AliHLTComponent* Spawn(); + + /** + * Open all files. + * Opens all files from the file name list @ref fFileNames and adds TFile + * opjects to the TFiles list. + */ + int OpenFiles(); + + protected: + /** + * Init method. + */ + int DoInit( int argc, const char** argv ); + + /** + * Deinit method. + */ + int DoDeinit(); + + /** + * Data processing method for the component. + * @param evtData event data structure + * @param trigData trigger data structure + * @param outputPtr pointer to target buffer + * @param size input: size of target buffer + * output:size of produced data + * @param outputBlocks list to receive output block descriptors + * @return + */ + int GetEvent( const AliHLTComponentEventData& evtData, + AliHLTComponentTriggerData& trigData, + AliHLTUInt8_t* outputPtr, + AliHLTUInt32_t& size, + vector& outputBlocks ); + + /** + * Scan one argument and adjacent parameters. + * Can be overloaded by child classes in order to add additional arguments + * beyond the standard arguments of the file publisher. The method is called + * whenever a non-standard argument is recognized. + * @param argc size of the argument array + * @param argv agument array for component initialization + * @return number of processed members of the argv
+ * -EINVAL unknown argument
+ * -EPROTO parameter for argument missing
+ */ + virtual int ScanArgument(int argc, const char** argv); + + protected: + /** + * Get the data type which is set for the current file + */ + AliHLTComponentDataType GetCurrentDataType() const; + + /** + * Get the data specification which is set for the current file + */ + AliHLTUInt32_t GetCurrentSpecification() const; + + private: + /** list of file names */ + TList fFileNames; // see above + /** list of opened files */ + TList fFiles; // see above + /** current positions in the file list */ + TObjLink* fpCurrent; //! transient + /** data type */ + AliHLTComponentDataType fDataType; // see above + /** data specification */ + AliHLTUInt32_t fSpecification; // see above + /** the maximum buffer size i.e. size of the biggest file */ + Int_t fMaxSize; // see above + + ClassDef(AliHLTFilePublisher, 0) +}; +#endif -- 2.43.0