// FileId.h #ifndef hes_FileId_H #define hes_FileId_H // David Adams // February 2002 // // Holds the ID for a HES file. // // The ID has three pieces: // FileType // 24-bit hi index // 32-bit lo index // // The 8-bit index representation of the file type and the high index are // merged to form the 32-bit type_hi index. // // A file ID can be recorded as and reconstituted from the type_hi and lo // indices. #include #include "Index.h" namespace hes { class FileType; class FileId { public: // static methods // Return version number. // This will change if the bit allocations change. static int version(); private: // data // Index. Index m_hi; Index m_lo; public: // methods // Default constructor. FileId(); // Constructor from type and indices. FileId(FileType type, Index hi, Index lo); // Constructor from the type_hi and lo indices. FileId(Index type_hi, Index lo); // Return if this is a valid index. bool is_valid() const; // Return the file type. FileType file_type() const; // Return the indices. Index hi_index() const; Index lo_index() const; Index type_hi_index() const; }; } // end namespace hes // Ordering. bool operator<(const hes::FileId& lhs, const hes::FileId& rhs); // Equality. bool operator==(const hes::FileId& lhs, const hes::FileId& rhs); // Inequality. bool operator!=(const hes::FileId& lhs, const hes::FileId& rhs); // Output stream. std::ostream& operator<<(std::ostream& lhs, const hes::FileId& rhs); #endif