XdmfHeavyDataController.hpp 4.88 KB
Newer Older
Kenneth Leiter's avatar
Kenneth Leiter committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/*****************************************************************************/
/*                                    XDMF                                   */
/*                       eXtensible Data Model and Format                    */
/*                                                                           */
/*  Id : XdmfHeavyDataController.hpp                                         */
/*                                                                           */
/*  Author:                                                                  */
/*     Kenneth Leiter                                                        */
/*     kenneth.leiter@arl.army.mil                                           */
/*     US Army Research Laboratory                                           */
/*     Aberdeen Proving Ground, MD                                           */
/*                                                                           */
/*     Copyright @ 2011 US Army Research Laboratory                          */
/*     All Rights Reserved                                                   */
/*     See Copyright.txt for details                                         */
/*                                                                           */
/*     This software is distributed WITHOUT ANY WARRANTY; without            */
/*     even the implied warranty of MERCHANTABILITY or FITNESS               */
/*     FOR A PARTICULAR PURPOSE.  See the above copyright notice             */
/*     for more information.                                                 */
/*                                                                           */
/*****************************************************************************/

24 25 26 27 28 29 30 31 32 33
#ifndef XDMFHEAVYDATACONTROLLER_HPP_
#define XDMFHEAVYDATACONTROLLER_HPP_

// Forward Declarations
class XdmfArray;
class XdmfArrayType;

// Includes
#include <boost/shared_ptr.hpp>
#include <string>
34
#include <vector>
35
#include "XdmfCore.hpp"
36 37 38 39

/**
 * @brief Couples an XdmfArray with heavy data stored on disk.
 *
40 41 42 43 44 45 46 47
 * 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.
48
 */
49
class XDMFCORE_EXPORT XdmfHeavyDataController {
50

51 52 53 54 55
 public:

  virtual ~XdmfHeavyDataController() = 0;

  /**
56 57
   * Get the path of the data set within the heavy data file owned by
   * this controller.
58 59 60 61 62 63
   * 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;

64 65 66 67 68 69 70 71
  /**
   * Get the dimensions of the heavy data set owned by this controller.
   *
   * @return a vector containing the size in each dimension of the heavy data
   * set owned by this controller.
   */
  std::vector<unsigned int> getDimensions() const;

72
  /**
73 74
   * Get the absolute path to the heavy data file on disk where the
   * data set owned by this controller resides.
75 76 77 78 79 80 81
   * 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;

  /**
82 83
   * Get the name of this heavy data format. E.g. "HDF" for hdf5
   * format.
84 85 86 87 88 89 90 91 92 93 94 95 96
   *
   * @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;

  /**
97 98
   * Get the array type of the heavy data set owned by this
   * controller.
99 100 101 102 103 104
   *
   * @return an XdmfArrayType containing the array type of the heavy data set.
   */
  boost::shared_ptr<const XdmfArrayType> getType() const;

  /**
105 106
   * Read data owned by this controller on disk into the passed
   * XdmfArray.
107 108 109 110 111 112 113 114 115
   *
   * @param array and XdmfArray to read data into.
   */
  virtual void read(XdmfArray * const array) = 0;

 protected:

  XdmfHeavyDataController(const std::string & filePath,
                          const std::string & dataSetPath,
116 117
                          const boost::shared_ptr<const XdmfArrayType> type,
                          const std::vector<unsigned int> & dimensions);
118

119 120 121 122
  const std::string mDataSetPath;
  const std::vector<unsigned int> mDimensions;
  const std::string mFilePath;
  const boost::shared_ptr<const XdmfArrayType> mType;
123 124 125 126 127

 private:

  XdmfHeavyDataController(const XdmfHeavyDataController&);  // Not implemented.
  void operator=(const XdmfHeavyDataController &);  // Not implemented.
128 129 130

};

131
#ifdef _WIN32
132 133
XDMFCORE_TEMPLATE template class XDMFCORE_EXPORT
boost::shared_ptr<const XdmfArrayType>;
134 135
#endif

136
#endif /* XDMFHEAVYDATACONTROLLER_HPP_ */