[ismrmrd] 40/177: Added convenience class FlagBit.

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Wed Jan 14 20:02:00 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to annotated tag v1.1.0.beta.1
in repository ismrmrd.

commit 456896ab9b84730d0023e387c2dd2468cc1c7e78
Author: Souheil Inati <souheil.inati at nih.gov>
Date:   Wed Sep 3 14:12:45 2014 -0400

    Added convenience class FlagBit.
---
 ismrmrd.h | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/ismrmrd.h b/ismrmrd.h
index af2cee2..667ee0a 100644
--- a/ismrmrd.h
+++ b/ismrmrd.h
@@ -55,7 +55,9 @@ enum ISMRMRD_Constants {
     ISMRMRD_USER_FLOATS = 8,
     ISMRMRD_PHYS_STAMPS = 3,
     ISMRMRD_CHANNEL_MASKS = 16,
-    ISMRMRD_NDARRAY_MAXDIM = 7
+    ISMRMRD_NDARRAY_MAXDIM = 7,
+    ISMRMRD_POSITION_LENGTH=3,
+    ISMRMRD_DIRECTION_LENGTH=3
 };
 
     
@@ -342,6 +344,30 @@ void ismrmrd_quaternion_to_directions(float quat[4], float read_dir[3], float ph
 // TODO:
 // - exports for all the classes
 
+// Some typedefs to beautify the namespace
+typedef  ISMRMRD_EncodingCounters EncodingCounters;
+
+// A convenience class for flags
+class FlagBit
+{
+public:
+ FlagBit(unsigned short b)
+   : bitmask_(0)
+    {
+      if (b > 0) {
+    bitmask_ = 1;
+    bitmask_ = (bitmask_ << (b-1));
+      }
+    }
+  
+  bool isSet(const uint64_t& m) const {
+    return ((m & bitmask_)>0);
+  }
+  
+  uint64_t bitmask_;
+  
+};
+
 class AcquisitionHeader: public ISMRMRD_AcquisitionHeader {
 public:
     // Constructors

-- 
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