Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  
igtlUnit.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: The OpenIGTLink Library
4  Language: C++
5  Web page: http://openigtlink.org/
6 
7  Copyright (c) Insight Software Consortium. All rights reserved.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notices for more information.
12 
13 =========================================================================*/
14 
15 #ifndef __igtlUnit_h
16 #define __igtlUnit_h
17 
18 #include "igtlWin32Header.h"
19 
20 #include "igtlMacro.h"
21 #include "igtlObject.h"
22 #include "igtlObjectFactory.h"
23 #include "igtlTypes.h"
24 
25 namespace igtl
26 {
27 
28 typedef igtlUint64 igtlUnit;
29 
45 {
46 public:
47 
49  enum {
50  SI_PREFIX_NONE = 0x0, /* None */
51  SI_PREFIX_DEKA = 0x1, /* deka (deca) (1e1) */
52  SI_PREFIX_HECTO = 0x2, /* hecto (1e2) */
53  SI_PREFIX_KILO = 0x3, /* kilo (1e3) */
54  SI_PREFIX_MEGA = 0x4, /* mega (1e6) */
55  SI_PREFIX_GIGA = 0x5, /* giga (1e9) */
56  SI_PREFIX_TERA = 0x6, /* tera (1e12) */
57  SI_PREFIX_PETA = 0x7, /* peta (1e15) */
58  SI_PREFIX_DECI = 0x9, /* deci (1e-1) */
59  SI_PREFIX_CENTI = 0xA, /* centi (1e-2) */
60  SI_PREFIX_MILLI = 0xB, /* milli (1e-3) */
61  SI_PREFIX_MICRO = 0xC, /* micro (1e-6) */
62  SI_PREFIX_NANO = 0xD, /* nano (1e-9) */
63  SI_PREFIX_PICO = 0xE, /* pico (1e-12) */
64  SI_PREFIX_FEMTO = 0xF, /* femto (1e-15) */
65  };
66 
68  enum {
69  // SI Base Units
70  SI_BASE_NONE = 0x00,
71  SI_BASE_METER = 0x01, /* meter */
72  SI_BASE_GRAM = 0x02, /* gram */
73  SI_BASE_SECOND = 0x03, /* second */
74  SI_BASE_AMPERE = 0x04, /* ampere */
75  SI_BASE_KELVIN = 0x05, /* kelvin */
76  SI_BASE_MOLE = 0x06, /* mole */
77  SI_BASE_CANDELA = 0x07, /* candela */
78 
79  // SI Derived Units
80  SI_DERIVED_RADIAN = 0x08, /* radian meter/meter */
81  SI_DERIVED_STERADIAN = 0x09, /* steradian meter^2/meter^2 */
82  SI_DERIVED_HERTZ = 0x0A, /* hertz /second */
83  SI_DERIVED_NEWTON = 0x0B, /* newton meter-kilogram/second^2 */
84  SI_DERIVED_PASCAL = 0x0C, /* pascal kilogram/meter-second^2 */
85  SI_DERIVED_JOULE = 0x0D, /* joule meter^2-kilogram/second^2 */
86  SI_DERIVED_WATT = 0x0E, /* watt meter^2-kilogram/second^3 */
87  SI_DERIVED_COULOMB = 0x0F, /* coulomb second-ampere */
88  SI_DERIVED_VOLT = 0x10, /* volt meter^2-kilogram/second^3-ampere */
89  SI_DERIVED_FARAD = 0x11, /* farad second^4-ampere^2/meter^2-kilogram */
90  SI_DERIVED_OHM = 0x12, /* ohm meter^2-kilogram/second^3-ampere^2 */
91  SI_DERIVED_SIEMENS = 0x13, /* siemens second^3-ampere^2/meter^2-kilogram */
92  SI_DERIVED_WEBER = 0x14, /* weber meter^2-kilogram/second^2-ampere */
93  SI_DERIVED_TESLA = 0x15, /* tesla kilogram/second^2-ampere */
94  SI_DERIVED_HENRY = 0x16, /* henry meter^2-kilogram/second^2-ampere^2 */
95  SI_DERIVED_LUMEN = 0x17, /* lumen candela-steradian */
96  SI_DERIVED_LUX = 0x18, /* lux candela-steradian/meter^2 */
97  SI_DERIVED_BECQUEREL = 0x19, /* becquerel /second */
98  SI_DERIVED_GRAY = 0x1A, /* gray meter^2/second^2 */
99  SI_DERIVED_SIEVERT = 0x1B, /* sievert meter^2/second^2 */
100 
101  SI_NUM_UNIT_TYPES = 0x1C,
102  };
103 
104 
105 
106 public:
107  typedef Unit Self;
111 
113  igtlNewMacro(Self);
114 
116  void Init();
117 
119  int SetPrefix(int prefix);
120 
122  int Append(int unit, int exp);
123 
125  igtlUnit Pack();
126 
128  int Unpack(igtlUnit unit);
129 
130 protected:
131 
133  Unit();
134 
136  virtual ~Unit();
137 
138 private:
139 
141  igtlUint8 m_Prefix;
142 
144  igtlUint8 m_Unit[6];
145 
147  igtlInt8 m_Exp[6];
148 
150  igtlInt32 m_NUnits;
151 
152 };
153 
154 }
155 
156 #endif // __igtlUnit_h
157 
#define igtlTypeMacro(thisClass, superclass)
Definition: igtlMacro.h:486
The "igtl" namespace contains all OpenIGTLink classes. There are several nested namespaces within the...
SmartPointer< Self > Pointer
Definition: igtlUnit.h:109
#define IGTLCommon_EXPORT
SmartPointer< const Self > ConstPointer
Definition: igtlUnit.h:110
igtlUint64 igtlUnit
Definition: igtlUnit.h:28
Unit Self
Definition: igtlUnit.h:107
Object Superclass
Definition: igtlUnit.h:108
#define igtlNewMacro(x)
Definition: igtlMacro.h:431
Base class for most igtl classes.
Definition: igtlObject.h:60

Generated for OpenIGTLink by Doxygen 1.8.13 written by Dimitri van Heesch, © 1997-2012