// HbookDataset.h #ifndef dset__HbookDataset_H #define dset__HbookDataset_H // David Adams // February 2004 // Updated October 2004. // // Dataset consisting a single HBOOK file. // Inherits from GenericDataset. // Content is absent; location is explicit. #include #include #include "dataset_base/GenericDataset.h" class HbookFile; namespace dset { class HbookDataset : public dset::GenericDataset { private: // data // Logical file. // Mutable so replica can be accessed const. mutable Url m_file; // HBOOK file. // Mutable so file can be opened and closed const. mutable HbookFile* m_phfile; private: // Hide assignment // Assignment. HbookDataset& operator=(const HbookDataset& rhs); public: // functions // Constructor from logical file. // The lock status is set to locked. HbookDataset(Url file, bool lock =true); // Constructor from logical file and ID of parent dataset. // The lock status is set to locked. HbookDataset(Url file, DatasetId parent, bool lock =true); // Constructor from a generic dataset or a single file dataset. HbookDataset(const GenericDataset& gdst); // Copy constructor. HbookDataset(const HbookDataset& rhs); // Destructor. ~HbookDataset(); // Return the file. Url file() const; // Return the (readonly) physical file. std::string filename() const; // Return the HBOOK file. // Name safe for use with PAW can be found here. HbookFile& hbook_file() const; public: // virtual functions // Lock. int lock(); // Clone. // Copies HBOOK file and uses it to construct the new dataset. HbookDataset* clone(std::string dir) const; // Merge another dataset into this one. // Must be of the same type. // Returns nonzero for error. int merge(const Dataset& dst, std::string dir =""); }; } // end namespace dset #endif