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

4
5
6
// Forward Declarations
class XdmfArray;

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// 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:

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

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

32
33
34
35
36
37
38
	/**
	 * 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;

39
40
41
42
43
44
45
	/**
	 * 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;

46
47
48
49
50
51
52
	/**
	 * 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;

53
54
55
56
57
	/**
	 * Get the precision of the hdf5 data set owned by this controller.
	 *
	 * @return a int containing the precision of the hdf5 data set.
	 */
58
	unsigned int getPrecision() const;
59
60
61
62
63
64

	/**
	 * Get the size of the hdf5 data set owned by this controller.
	 *
	 * @return a int containing the size of the hdf5 data set.
	 */
65
	unsigned int getSize() const;
66
67
68
69
70
71
72
73

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

74
75
76
77
78
79
80
	/**
	 * 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);

81
82
protected:

83
	XdmfHDF5Controller(const std::string & dataSetPath, const unsigned int precision, const unsigned int size, const std::string & type);
84
85
86
87
88
89
90
	virtual ~XdmfHDF5Controller();

private:

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

91
92
	std::string mDataSetName;
	std::string mHDF5FilePath;
93
94
	unsigned int mPrecision;
	unsigned int mSize;
95
96
97
98
	std::string mType;
};

#endif /* XDMFHDF5CONTROLLER_HPP_ */