XdmfHeavyDataController.hpp 2.72 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
#ifndef XDMFHEAVYDATACONTROLLER_HPP_
#define XDMFHEAVYDATACONTROLLER_HPP_

// Forward Declarations
class XdmfArray;
class XdmfArrayType;

// Includes
#include <boost/shared_ptr.hpp>
#include <string>
11
#include "XdmfCore.hpp"
12 13 14 15 16 17 18 19 20

/**
 * @brief Couples an XdmfArray with heavy data stored on disk.
 * This is an abstract base class to support the reading of different heavy data formats.
 *
 * 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 XdmfHeavyController is attached to XdmfArrays.  This allows data to be released
 * from memory but still be accessible or have its location written to light data.
 */
21
class XDMFCORE_EXPORT XdmfHeavyDataController {
22 23 24

public:

25
	virtual ~XdmfHeavyDataController() = 0;
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

	/**
	 * Get the path of the data set within the heavy data file owned by this controller.
	 * For "/home/output.h5:/foo/data" this is "/foo/data"
	 *
	 * @return a std::string containing the path of the data set.
	 */
	std::string getDataSetPath() const;

	/**
	 * Get the absolute path to the heavy data file on disk where the data set owned by this controller resides.
	 * For "/home/output.h5:/foo/data" this is "/home/output.h5"
	 *
	 * @return a std::string containing the path to the heavy data file.
	 */
	std::string getFilePath() const;

	/**
	 * Get the name of this heavy data format.  E.g. "HDF" for hdf5 format.
	 *
	 * @return std::string containing the name of this heavy data format
	 */
	virtual std::string getName() const = 0;

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

	/**
	 * Get the array type of the heavy data set owned by this controller.
	 *
	 * @return an XdmfArrayType containing the array type of the heavy data set.
	 */
	boost::shared_ptr<const XdmfArrayType> getType() const;

	/**
	 * Read data owned by this controller on disk into the passed XdmfArray.
	 *
	 * @param array and XdmfArray to read data into.
	 */
	virtual void read(XdmfArray * const array) = 0;

protected:

73
	XdmfHeavyDataController(const std::string & filePath, const std::string & dataSetPath, const unsigned int size, const boost::shared_ptr<const XdmfArrayType> type);
74 75 76 77 78 79 80 81 82 83 84 85 86

	std::string mDataSetPath;
	std::string mFilePath;
	unsigned int mSize;
	boost::shared_ptr<const XdmfArrayType> mType;

private:

	XdmfHeavyDataController(const XdmfHeavyDataController & heavyDataController);  // Not implemented.
	void operator=(const XdmfHeavyDataController & heavyDataController);  // Not implemented.

};

87 88 89 90
#ifdef _WIN32
    XDMFCORE_TEMPLATE template class XDMFCORE_EXPORT boost::shared_ptr<const XdmfArrayType>;
#endif

91
#endif /* XDMFHEAVYDATACONTROLLER_HPP_ */