// FileEvent.h #ifndef hes_FileEvent_H #define hes_FileEvent_H // David Adams // March 2002 // // Mixin defining the event ID part of the hes::File interface. // This maintains an event ID list and a current event ID. #include "hesfile/File.h" #include "hesbase/EventId.h" namespace hes { class FileEvent : public virtual File { private: // data // Event ID list. EventIdList m_evids; // min and max event ID's EventId m_min_evid; EventId m_max_evid; // Current event iterator. // end means undefined. EventIdList::const_iterator m_ievid; private: // functions // Change the event ID. // All requests to change the current event ID come through here. // The new ID is returned. // Virtual functions end_event() and begin_event() are called so that // subclasses can clean up and initialize, respectively. EventId set_event_iter(EventIdList::const_iterator ievid); public: // New interface // Notification that a new current event has been set. virtual void begin_event() =0; // Notification that the current event is bout to end. virtual void end_event() =0; public: // Functions // Constructor. FileEvent(); // Add an event ID. // Current event does not change. // Returns the total number of event ID's. // Returns 0 for error. int add_event_id(EventId evid); public: // Implement File interface. // Return the number of events. int event_count() const; // Return the event range. EventId min_event() const; EventId max_event() const; // Return the list of event ID's included in this file. // The file includes one placement catgory of each of the above types // for each event in the file. const EventIdList& event_ids() const; // Return the current event ID. EventId event() const; // Set the current event. // No change if the event is not present. // Returns the current event. EventId set_event(EventId evid); // Set the current event to the first event. // The ID of that event is returned. EventId first_event(); // Set the current event to the last event. // The ID of that event is returned. EventId last_event(); // Go to the next event. // The ID of that event is returned. // An invalid ID should be returned when the list is exhausted. EventId next_event(); }; } // end namespace #endif