// EdoId.h #ifndef hes_EdoId_H #define hes_EdoId_H // This is the identifier for an EDO. The full identifier is an // array of 32-bit integers. The class maintains an indexed table of // these arrays and individual objects hold this index rather than // the array. #include #include "Index.h" #include "IndexVector.h" namespace hes { class FileId; class EventId; class EdoType; class EdoKey; class EdoTypeKey; class EdoId { public: // static functions. // Version that changes if the array of indices changes. static hes::Index version(); // Return the number of allocated ID's. // Includes one for the invalid state. static hes::Index id_count(); // Return the maximum number of ID's. static hes::Index max_id_count(); private: // data hes::Index m_idx; public: // functions // Default constructor. // Leaves ID in an invalid state. EdoId(); // Constructor from full set of values. // All must be valid. EdoId(hes::FileId fid, hes::EventId eid, hes::EdoType typ, hes::EdoKey key); // Constructor from a full set of indices. EdoId(const hes::IndexVector& idxs); // Constructor from a full set of indices taken from somewwhere // in an index vector. The version indicates the version of this // class used to construct the vector. EdoId(hes::IndexVector::const_iterator& iidx, Index version); // Validity check. bool is_valid() const; // Return the file ID. FileId file_id() const; // Return the event ID. EventId event_id() const; // Return the type. EdoType type() const; // Return the key. EdoKey key() const; // Return the type and key. EdoTypeKey type_key() const; // Return the indices. // These indices may be written to persistent store and later // read back to reconstruct the ID. const hes::IndexVector& indices() const; }; } // end namespace hes // Equality. bool operator==(const hes::EdoId& lhs, const hes::EdoId& rhs); // Inequality. bool operator!=(const hes::EdoId& lhs, const hes::EdoId& rhs); // Output stream. std::ostream& operator<<(std::ostream& lhs, const hes::EdoId& rhs); #endif