XdmfHDF5Controller.hpp 2.54 KB
Newer Older
1 2 3
#ifndef XDMFHDF5CONTROLLER_HPP_
#define XDMFHDF5CONTROLLER_HPP_

4 5
// Forward Declarations
class XdmfArray;
6
class XdmfArrayType;
7

8 9 10 11 12 13 14 15 16 17 18 19 20 21
// Includes
#include "XdmfObject.hpp"

/**
 * @brief Couples an XdmfArray with HDF5 data stored on disk.
 *
 * Serves as an interface between data stored in XdmfArrays and data stored on disk.  When an Xdmf file is read from or
 * written to disk an XdmfHDF5Controller is attached to XdmfArrays.  This allows data to be released
 * from memory but still be accessible or have its location written to light data.
 */
class XdmfHDF5Controller : public XdmfObject {

public:

22
	virtual ~XdmfHDF5Controller();
23 24 25 26

	/**
	 * Create a new controller for an hdf5 data set on disk.
	 */
27
	static boost::shared_ptr<XdmfHDF5Controller> New(const std::string & dataSetPath, const unsigned int size, const boost::shared_ptr<const XdmfArrayType> type)
28
	{
29
		boost::shared_ptr<XdmfHDF5Controller> p(new XdmfHDF5Controller(dataSetPath, size, type));
30 31 32
		return p;
	}

33 34 35 36 37 38 39
	/**
	 * Get the name of the data set owned by this controller.
	 *
	 * @return a std::string containing the name of the data set.
	 */
	std::string getDataSetName() const;

40 41 42 43 44 45 46
	/**
	 * Get the path to the hdf5 data set on disk owned by this controller.
	 *
	 * @return a std::string to the hdf5 data set location on disk.
	 */
	std::string getDataSetPath() const;

47 48 49 50 51 52 53
	/**
	 * Get the path to the hdf5 file on disk where the data set owned by this controller resides.
	 *
	 * @return a std::string containing the path to the hdf5 file.
	 */
	std::string getHDF5FilePath() const;

54 55 56 57 58
	/**
	 * Get the size of the hdf5 data set owned by this controller.
	 *
	 * @return a int containing the size of the hdf5 data set.
	 */
59
	unsigned int getSize() const;
60 61

	/**
62
	 * Get the array type of the hdf5 data set owned by this controller.
63
	 *
64
	 * @return an XdmfArrayType containing the array type of the hdf5 data set.
65
	 */
66
	boost::shared_ptr<const XdmfArrayType> getType() const;
67

68 69 70 71 72 73 74
	/**
	 * Read data owned by this controller on disk into the passed XdmfArray.
	 *
	 * @param array and XdmfArray to read data into.
	 */
	void read(XdmfArray * const array);

75 76
protected:

77
	XdmfHDF5Controller(const std::string & dataSetPath, const unsigned int size, const boost::shared_ptr<const XdmfArrayType> type);
78 79 80 81 82 83

private:

	XdmfHDF5Controller(const XdmfHDF5Controller & hdf5Controller);  // Not implemented.
	void operator=(const XdmfHDF5Controller & hdf5Controller);  // Not implemented.

84 85
	std::string mDataSetName;
	std::string mHDF5FilePath;
86
	unsigned int mSize;
87
	boost::shared_ptr<const XdmfArrayType> mType;
88 89 90
};

#endif /* XDMFHDF5CONTROLLER_HPP_ */