XdmfHDF5Controller.hpp 2.16 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
#ifndef XDMFHDF5CONTROLLER_HPP_
#define XDMFHDF5CONTROLLER_HPP_

// Includes
#include <string>
#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:

	template <typename T> friend void boost::checked_delete(T * x);

	/**
	 * Create a new controller for an hdf5 data set on disk.
	 *
	 * @param dataSetPath the path to the hdf5 data set on disk.
	 */
	static boost::shared_ptr<XdmfHDF5Controller> New(const std::string & dataSetPath, const int precision,
			const int size, const std::string & type)
	{
		boost::shared_ptr<XdmfHDF5Controller> p(new XdmfHDF5Controller(dataSetPath, precision, size, type));
		return p;
	}

	/**
	 * 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;

	/**
	 * Get the precision of the hdf5 data set owned by this controller.
	 *
	 * @return a int containing the precision of the hdf5 data set.
	 */
	int getPrecision() const;

	/**
	 * Get the size of the hdf5 data set owned by this controller.
	 *
	 * @return a int containing the size of the hdf5 data set.
	 */
	int getSize() const;

	/**
	 * Get the data type of the hdf5 data set owned by this controller.
	 *
	 * @return a std::string containing the name of the data type of the hdf5 data set.
	 */
	std::string getType() const;

protected:

	XdmfHDF5Controller(const std::string & dataSetPath, const int precision, const int size,
			const std::string & type);
	virtual ~XdmfHDF5Controller();

private:

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

	std::string mDataSetPath;
	int mPrecision;
	int mSize;
	std::string mType;
};

#endif /* XDMFHDF5CONTROLLER_HPP_ */