// FileHeader.cxx #include "hesfileimp/FileHeader.h" using hes::Name; using hes::FileType; using hes::FileId; using hes::FileHeader; using hes::StreamType; //********************************************************************** // Member functions. //********************************************************************** // Constructor. // All parameters are set invalid (lock is set false). FileHeader::FileHeader() : m_locked(false) { } //********************************************************************** // Set the file type. int FileHeader::set_file_type(FileType type) { if ( ! type.is_valid() ) return 1; if ( ! m_file_type.is_valid() ) { m_file_type = type; return 0; } if ( type == m_file_type ) return 0; return 2; } //********************************************************************** // Set the physical name. int FileHeader::set_physical_name(Name name) { if ( ! name.is_valid() ) return 1; if ( ! m_physical_name.is_valid() ) { m_physical_name = name; return 0; } if ( name == m_physical_name ) return 0; return 2; } //********************************************************************** // Set the logical name. int FileHeader::set_logical_name(Name name) { if ( ! name.is_valid() ) return 1; if ( ! m_logical_name.is_valid() ) { m_logical_name = name; return 0; } if ( name == m_logical_name ) return 0; return 2; } //********************************************************************** // Set the file ID. int FileHeader::set_file_id(FileId id) { if ( ! id.is_valid() ) return 1; if ( ! m_file_id.is_valid() ) { m_file_id = id; return 0; } if ( id == m_file_id ) return 0; return 2; } //********************************************************************** // Set the stream type. int FileHeader::set_stream_type(const StreamType& stype) { if ( ! stype.is_valid() ) return 1; if ( ! m_stream_type.is_valid() ) { m_stream_type = stype; return 0; } if ( stype == m_stream_type ) return 0; return 2; } //********************************************************************** // Return the file type. FileType FileHeader::type() const { return m_file_type; } //********************************************************************** // Return the physical name of the file. Name FileHeader::physical_name() const { return m_physical_name; } //********************************************************************** // Return the logical name of the file. Name FileHeader::logical_name() const { return m_logical_name; } //********************************************************************** // Return the file ID. FileId FileHeader::id() const { return m_file_id; } //********************************************************************** // Return the the stream type implemented by this file. const StreamType& FileHeader::stream_type() const { return m_stream_type; } //********************************************************************** // Is the file locked? bool FileHeader::is_locked() const { return m_locked; } //********************************************************************** // Lock the file. void FileHeader::lock() { m_locked = true; } //**********************************************************************