//////////////////////////////////////////////////////////////////// // // Process only events in an event ID list. // // This processor allows you to specify a list of event IDs (GTIDs) to // process in a text file. Events with IDs not in the list are aborted, // i.e. no subsequent processors are run. The typical use case is // reading in events from disk, in which case this processor should be // called first in the event loop. // // Note that, since the processing chain is aborted for an event if the // ID is not in the list, skipped events will not be written to disk. // // The format of the text file is flexible. The IDs in the list may be // separated by any combination of whitespace, newlines, and commas. // Comments following a "#" character are allowed. An ID may be in // decimal format (indicated by a bare number), hexadecimal (preceded by // a "0x"), or octal (preceded by a "0"). // // Author: A. Mastbaum - contact person // // REVISION HISTORY: // 25 Sep 2013 : A. Mastbaum - new file // 2013-11-14 : P G Jones - Added conditional results // //////////////////////////////////////////////////////////////////// #ifndef __RAT_EventListProc___ #define __RAT_EventListProc___ #include #include #include namespace RAT { namespace DS { class Entry; class EV; } class EventListProc : public Processor { public: EventListProc() : Processor("EventListProc"), fFileSet(false) {} virtual ~EventListProc() {} // Handle string 'procset' arguments. // // file - string, name of the file from which to load the event ID list virtual void SetS(const std::string& param, const std::string& value); // Process one event. // // If the event's ID is in the list, continue processing by returning OK; // otherwise, abort further processing by returning ABORT. virtual Processor::Result DSEvent(DS::Run& run, DS::Entry& ds); protected: // Read GTIDs from a file into fGTIDList bool LoadFile(const std::string filename); std::vector fEventIDList; // Sorted list of IDs to process bool fFileSet; // true after the ID list file has been loaded }; } // namespace RAT #endif // __RAT_EventListProc__