// EventId.h #ifndef EventId_H #define EventId_H // David Adams // June 2002 // // Event Identifier // // We assume a specifiic implementation: long run number plus // long event number. // // Ordering is included to allow sorted containers. // // Increment is included to allow contiguous ranges. // // XML format: // // EventId // run = 123 // event = 246 // // Run and event are integers with value greater than zero. // #include #include "dataset_util/Text.h" class XmlElement; class EventId { public: // typedefs typedef unsigned long RunNumber; typedef unsigned long EventNumber; public: // static methods static const char* xml_name() { return "EventId"; } // XML DTD. static const Text& dtd(); private: // Run number (must be greater than zero) RunNumber _run; // Event number within the run. EventNumber _evt; public: // Default constructor. // Leaves ID in an invalid state. EventId(); // Constructor. EventId(RunNumber run, EventNumber evt); // XML constructor. explicit EventId(const XmlElement& ele); // Validity. bool is_valid() const; // Run. RunNumber run() const { return _run; } // Event. EventNumber event() const { return _evt; } // Increment. EventId& operator++(); // Convert to XML. const XmlElement* xml() const; }; // Ordering. bool operator<(const EventId& lhs, const EventId& rhs); // Equality. bool operator==(const EventId& lhs, const EventId& rhs); // Inequality. bool operator!=(const EventId& lhs, const EventId& rhs); // Output stream. std::ostream& operator<<(std::ostream& lhs, const EventId& rhs); #endif