00001 #ifndef PROCESSOR_HPP__
00002 #define PROCESSOR_HPP__
00003
00004 #include <string>
00005 #include <iosfwd>
00006
00007 #include "TObject.h"
00008
00009 class TFile;
00010 class TDirectory;
00011 class TPluginManager;
00012
00013 namespace cafe {
00014
00015 class Event;
00016 class Controller;
00017
00032 class Processor {
00033 public:
00034 Processor(const char *name);
00035 virtual ~Processor();
00036
00037 public:
00038
00039
00041
00042 virtual void begin();
00043
00045 virtual void finish();
00046
00048 virtual void inputFileOpened(TFile *file);
00049
00051 virtual void inputFileClosing(TFile *file);
00052
00054 virtual bool processEvent(cafe::Event& event);
00055
00057 void incEventCount();
00058
00060 int eventCount() const;
00061
00063
00064
00065
00067
00069 std::string name() const;
00070
00073 std::string fullName() const;
00074
00076 std::ostream& out();
00077
00079 std::ostream& info();
00080
00082 std::ostream& warn();
00083
00085 std::ostream& err();
00086
00088 unsigned int debug() const;
00089
00091 virtual void setDebug(unsigned int level);
00092
00094 TDirectory *getDirectory() const;
00095
00097 Processor *getParent() const;
00098
00099
00102 std::string resolve(const std::string& name, bool recurse = true) const;
00103
00106 std::string replace(const std::string& input, bool recurse = true) const;
00107
00109
00110
00111
00113
00117 static Processor* Create(const std::string& className, const std::string& instance = "");
00118
00120
00121 protected:
00122
00123 Processor();
00124
00125 friend class Controller;
00126
00127 void setDirectory(TDirectory *dir);
00128 void setParent(Processor *parent);
00129
00130 private:
00131 unsigned int _eventCount;
00132 unsigned int _debug;
00133 std::string _name;
00134 mutable TDirectory *_directory;
00135 Processor *_parent;
00136 public:
00137 ClassDef(Processor, 0);
00138 };
00139
00140 }
00141
00142 #endif // PROCESSOR_HPP__