#ifndef FILTERMODULE_H #define FILTERMODULE_H // FIlterModule.h -- Illustration of using the filterModule and exlcudeModule // features of ErrorLogger. // // ------------------------------------- // Headers for files making up Framework // ------------------------------------- // // Event.h // // This is a rather lame mock-up of what an Event looks like. // The framework will pass an Event from one module to the next. class Event { public: int data; inline Event( int d ) : data(d) { } }; // Event // --------------------- // // Module.h -- the base class for all physicist modules // // Normally this would include framework.h. // In this illustration that content is in this same file. #ifndef ZMENVIRONMENT_H #include "ZMutility/ZMenvironment.h" #endif #include #include "ErrorLogger/ErrorLog.h" class Module { public: Module( const std::string & name ); virtual void operator()( Event & e ) = 0; // do this module's processing! protected: // Note that this is the only line in Module ErrorLog errlog; // inserted because of the ErrorLogger // mechanism! }; // Module // ----------------------------- // Header for Physicsists' Code // ----------------------------- // // DoPhysics.h -- Many physicists can supply this sort of class // // Normally one would include framework.h. // In this illustration that content is in this same file. // The following are defined in that framework: // class Event; // class Module; // For all these examples, we suppose the physicist will provide code in // the form of a class with an operator() method taking an Event. // That is, the physicist provides a class (DoPhysics in this case) // rather than a global function. // Normally one would include but it is included above in this file. class DoPhysics1 : public Module { public: inline DoPhysics1( const std::string & name ) : Module(name) {} void operator()( Event & event ); // THIS IS WHERE ALL THE PHYSICS // CODE WILL GO. }; // DoPhysics1 class DoPhysics2 : public Module { public: inline DoPhysics2( const std::string & name ) : Module(name) {} void operator()( Event & event ); // THIS IS WHERE ALL THE PHYSICS // CODE WILL GO. }; // DoPhysics2 class DoPhysics3 : public Module { public: inline DoPhysics3( const std::string & name ) : Module(name) {} void operator()( Event & event ); // THIS IS WHERE ALL THE PHYSICS // CODE WILL GO. }; // DoPhysics3 #endif /* FILTERMODULE_H */