// FileHeader.h #ifndef hes_FileHeader_H #define hes_FileHeader_H // David Adams // March 2002 // // Mixin for hes::File that provides the non-event data and methods. #include "hesbase/Name.h" #include "hesbase/FileType.h" #include "hesbase/FileId.h" #include "hesfile/StreamType.h" #include "hesfile/File.h" namespace hes { class FileHeader : public virtual File { private: // data // File type. FileType m_file_type; // Physical name. Name m_physical_name; // Physical name. Name m_logical_name; // ID. FileId m_file_id; // Stream type. StreamType m_stream_type; // Is the file locked? // Initially set false. bool m_locked; protected: // Constructor. // Constructor. // All parameters are set invalid (lock is set false). FileHeader(); protected: // Setters. // Each of the following sets one of the header parameters. In order for a // parameter to be set, the old value must be invalid and the new value // must be valid. // There is an error if // 1. the new value is invalid or // 2. both are valid and their values differ // For either error, nonzero is returned. // Once a valid value is set, there is no way to unset it. // For lock, valid or invalid means true or false, respectively. // Set the file type. int set_file_type(FileType type); // Set the physical name. int set_physical_name(Name name); // Set the logical name. int set_logical_name(Name name); // Set the file ID. int set_file_id(FileId id); // Set the stream type. int set_stream_type(const StreamType& stype); public: // inherited methods // Return the file type. FileType type() const; // Return the physical name of the file. Name physical_name() const; // Return the logical name of the file. Name logical_name() const; // Return the file ID. FileId id() const; // Return the the stream type implemented by this file. const StreamType& stream_type() const; // Is the file locked? // If so, it cannot be written. bool is_locked() const; // Lock the file. void lock(); }; } // end namespace #endif