9 #ifndef RMF_HDF5_DATA_SET_INDEX_D_H
10 #define RMF_HDF5_DATA_SET_INDEX_D_H
12 #include "RMF/config.h"
16 #include <boost/functional/hash.hpp>
19 RMF_ENABLE_WARNINGS
namespace RMF {
29 for (
unsigned int i = 0; i < D; ++i) {
32 else if (d_[i] > o.d_[i])
40 RMF_USAGE_CHECK(o.size() == D,
"Wrong number of values");
41 std::copy(o.begin(), o.end(), d_);
45 RMF_USAGE_CHECK(D == 1,
"Constructor does not match dimension.");
49 RMF_USAGE_CHECK(D == 2,
"Constructor does not match dimension.");
53 DataSetIndexD(
unsigned int i,
unsigned int j,
unsigned int k) {
54 RMF_USAGE_CHECK(D == 3,
"Constructor does not match dimension.");
61 hsize_t& operator[](
unsigned int i) {
62 RMF_INDEX_CHECK(i, D);
65 hsize_t operator[](
unsigned int i)
const {
66 RMF_INDEX_CHECK(i, D);
69 typedef const hsize_t* const_iterator;
70 const_iterator begin()
const {
return d_; }
71 const_iterator end()
const {
return d_ + D; }
72 typedef hsize_t* iterator;
73 iterator begin() {
return d_; }
74 iterator end() {
return d_ + D; }
75 hsize_t*
get()
const {
return const_cast<hsize_t*
>(d_); }
77 int __getitem__(
unsigned int i)
const {
80 throw std::runtime_error(
"out of range");
85 unsigned int get_dimension()
const {
return D; }
89 for (
unsigned int i = 0; i < D; ++i) {
90 boost::hash_combine(ret, static_cast<size_t>(d_[i]));
101 typedef DataSetIndexD<1> DataSetIndex1D;
102 typedef std::vector<DataSetIndex1D> DataSetIndex1Ds;
103 typedef DataSetIndexD<2> DataSetIndex2D;
104 typedef std::vector<DataSetIndex2D> DataSetIndex2Ds;
105 typedef DataSetIndexD<3> DataSetIndex3D;
106 typedef std::vector<DataSetIndex3D> DataSetIndex3Ds;
Various general useful macros for IMP.
std::size_t hash_value(const DataSetIndexD< D > &t)
Produce hash values for boost hash tables.
#define RMF_COMPARISONS(Name)
Implement comparison in a class using field as the variable to compare.
#define RMF_HASHABLE(name, hashret)
Implement a hash function for the class.
Handle read/write of Model data from/to files.