MAK Data Logger API Documentation for HLA
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
leTypes.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 1992-2010 VT MAK
3 ** All rights reserved.
4 ******************************************************************************/
5 
8 
9 #ifndef leTypes_H_
10 #define leTypes_H_
11 
12 #include <vlutil/vlNetTypes.h>
13 
15 class DtLeU16
16 {
17 public:
18  DtNetU8 msbyte;
19  DtNetU8 lsbyte;
20 
21  DtLeU16(): msbyte(), lsbyte() { }
22 
23  DtLeU16(DtU16 u)
24  {
25 #if DT_LITTLE_ENDIAN
26  *((DtU16 *) this) = u;
27 #else
28  lsbyte = ((u & 0xff00) >> 8); msbyte = (u & 0xff);
29 #endif
30  }
31 
32  DtLeU16(const DtLeU16& u) : msbyte(u.msbyte), lsbyte(u.lsbyte) { }
33 
34  DtLeU16& operator=(const DtLeU16& u) {
35  if (this != &u)
36  { msbyte = u.msbyte; lsbyte = u.lsbyte;}
37  return *this; }
38 
39  DtLeU16& operator=(const DtU16& u) { return (*this= DtLeU16(u));}
40 
41  operator DtU16 () const
42  {
43 #if DT_LITTLE_ENDIAN
44  return *((DtU16 *) this);
45 #else
46  return (msbyte & 0xff) | ((lsbyte & 0xff) << 8);
47 #endif
48  }
49 };
50 
52 class DtLeU32
53 {
54 public:
55 
58 
59  DtLeU32() { }
60 
61  DtLeU32(const DtU32 &u)
62  {
63 #if DT_LITTLE_ENDIAN
64  *((DtU32 *) this) = u;
65 #else
66  msword = (DtU16)(u & 0xffff); lsword = (DtU16)((u & 0xffff0000) >> 16);
67 #endif
68  }
69 
70  DtLeU32(const DtLeU32& u) : msword(u.msword),lsword(u.lsword) { }
71 
72  DtLeU32& operator=(const DtLeU32 &u) {
73  if (this != &u)
74  { msword = u.msword; lsword = u.lsword; }
75  return *this; }
76 
77  DtLeU32& operator=(const DtU32 &u) { return (*this = DtLeU32(u)); }
78 
79  operator DtU32 () const
80  {
81 #if DT_LITTLE_ENDIAN
82  return *((DtU32 *) this);
83 #else
84  return ((lsword & 0xffff) << 16) | (msword & 0xffff);
85 #endif
86  }
87 };
88 
89 
90 
92 class DtLeInt16
93 {
94 public:
95 
96  DtNetInt8 msbyte;
97  DtNetInt8 lsbyte;
98 
99  DtLeInt16() { }
100 
101  DtLeInt16(const DtInt16& i)
102  {
103 #if DT_LITTLE_ENDIAN
104  *((DtInt16 *) this) = i;
105 #else
106  lsbyte = ((i & 0xff00) >> 8); msbyte = (i & 0xff);
107 #endif
108  }
109 
110  DtLeInt16(const DtLeInt16& i) : msbyte(i.msbyte), lsbyte(i.lsbyte) { }
111 
112  DtLeInt16& operator=(const DtLeInt16& other) {
113  if (&other != this)
114  { lsbyte = other.lsbyte; msbyte = other.msbyte; }
115  return *this; }
116 
117  DtLeInt16& operator=(const DtInt16& other) {return (*this = DtLeInt16(other)); }
118 
119  operator DtInt16 () const
120  {
121 #if DT_LITTLE_ENDIAN
122  return *((DtInt16 *) this);
123 #else
124  return (msbyte & 0xff) | ((lsbyte & 0xff) << 8);
125 #endif
126  }
127 };
128 
131 {
132 public:
133 
136 
137  DtLeInt32() { }
138 
139  DtLeInt32(const DtInt32& i)
140  {
141 #if DT_LITTLE_ENDIAN
142  *((DtInt32 *) this) = i;
143 #else
144  msword = (DtU16)(i & 0xffff); lsword = (DtU16)((i & 0xffff0000) >> 16);
145 #endif
146  }
147 
149 
150  DtLeInt32& operator=(const DtLeInt32 &other) {
151  if (this != &other)
152  { msword = other.msword; lsword = other.lsword; }
153  return(*this);
154  }
155 
156  DtLeInt32& operator=(const DtInt32 &other){ return *this = DtLeInt32(other); }
157 
158  operator DtInt32 () const
159  {
160 #if DT_LITTLE_ENDIAN
161  return *((DtInt32 *) this);
162 #else
163  return ((lsword & 0xffff) << 16) | (msword & 0xffff);
164 #endif
165  }
166 };
167 
168 #endif
DtLeU16()
Least Significant Byte.
Definition: leTypes.h:21
Little Endian unsigned 16-bit quantity.
Definition: leTypes.h:15
DtLeInt32()
Least Significant Word.
Definition: leTypes.h:137
DtLeInt16 & operator=(const DtLeInt16 &other)
Definition: leTypes.h:112
Little Endian unsigned 32-bit quantity.
Definition: leTypes.h:52
DtLeU32 & operator=(const DtLeU32 &u)
Definition: leTypes.h:72
DtLeU16 & operator=(const DtU16 &u)
Definition: leTypes.h:39
DtLeInt16 lsword
Most Significant Word.
Definition: leTypes.h:135
Little endian signed 32-bit quantity.
Definition: leTypes.h:130
DtLeInt32(const DtLeInt32 &i)
Definition: leTypes.h:148
DtLeU16 & operator=(const DtLeU16 &u)
Definition: leTypes.h:34
DtLeInt16(const DtLeInt16 &i)
Definition: leTypes.h:110
DtLeU32()
Least Significant Word.
Definition: leTypes.h:59
DtLeInt16(const DtInt16 &i)
Definition: leTypes.h:101
DtLeU32(const DtLeU32 &u)
Definition: leTypes.h:70
DtLeInt16 & operator=(const DtInt16 &other)
Definition: leTypes.h:117
DtLeInt32 & operator=(const DtInt32 &other)
Definition: leTypes.h:156
DtLeU16(const DtLeU16 &u)
Definition: leTypes.h:32
DtNetU8 lsbyte
Most Significant Byte.
Definition: leTypes.h:19
DtNetU8 msbyte
Definition: leTypes.h:18
DtLeInt32(const DtInt32 &i)
Definition: leTypes.h:139
DtLeInt16 msword
Definition: leTypes.h:134
DtLeU16(DtU16 u)
Definition: leTypes.h:23
Little Endian signed 16-bit quantity.
Definition: leTypes.h:92
DtLeInt32 & operator=(const DtLeInt32 &other)
Definition: leTypes.h:150
DtLeU32(const DtU32 &u)
Definition: leTypes.h:61
DtLeU16 msword
Definition: leTypes.h:56
DtNetInt8 lsbyte
Most Significant Byte.
Definition: leTypes.h:97
DtLeU16 lsword
Most Significant Word.
Definition: leTypes.h:57
DtLeInt16()
Least Significant Byte.
Definition: leTypes.h:99
DtLeU32 & operator=(const DtU32 &u)
Definition: leTypes.h:77
DtNetInt8 msbyte
Definition: leTypes.h:96

Document ID: Generated on Thu Jul 14 15:45:33 EDT 2022 from SVN revision 244827
Copyright © 2021 MAK Technologies. All Rights Reserved (www.mak.com)