[ismrmrd] 61/281: 'const' safties in NDArrayContainer methods and non-singleton dimensions
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Wed Jan 14 20:00:56 UTC 2015
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to annotated tag ismrmrd0.5
in repository ismrmrd.
commit fa62f549df518d77e90cd4d1074aa699f67b3e97
Author: kvahed <kaveh at vahedipour.de>
Date: Tue Jan 8 16:00:48 2013 +0100
'const' safties in NDArrayContainer methods and non-singleton dimensions
---
ismrmrd.h | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/ismrmrd.h b/ismrmrd.h
index 6cbb288..68447da 100644
--- a/ismrmrd.h
+++ b/ismrmrd.h
@@ -5,6 +5,7 @@
/* Michael S. Hansen (michael.hansen at nih.gov) */
/* Brian Hargreaves (bah at stanford.edu) */
/* Sebastian Kozerke (kozerke at biomed.ee.ethz.ch) */
+/* Kaveh Vahedipour (k.vahedipour at fz-juelich.de) */
#pragma once
#ifndef ISMRMRD_H
@@ -402,24 +403,29 @@ public:
std::vector<unsigned int> dimensions_; /**< Array with dimensions of the array. First dimension is fastest moving in the array */
std::vector<T> data_; /**< The data itself. A vector is used here for easy memory management */
- size_t elements() {
+ size_t elements() const {
if (dimensions_.size() == 0) {
return 0;
}
size_t elements = 1;
- std::vector<unsigned int>::iterator it = dimensions_.begin();
+ std::vector<unsigned int>::const_iterator it = dimensions_.begin();
while (it != dimensions_.end()) {
elements *= *(it++);
}
return elements;
}
- bool is_consistent() {
- if (elements() != data_.size()) {
- return false;
- }
- return true;
+ bool is_consistent() const {
+ return (elements() == data_.size());
+ }
+
+ size_t ndims() const {
+ size_t i = 1, n_dimensions = 1;
+ for (; i < dimensions_.size(); i++)
+ n_dimensions += (size_t) (dimensions_[i] > 1);
+ return n_dimensions;
}
+
};
#endif //__cplusplus
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/ismrmrd.git
More information about the debian-science-commits
mailing list