MAK Data Logger API Documentation for HLA
Home
Modules
Namespaces
Classes
Files
Examples
Libraries
File List
File Members
libsrc
lgrUtil
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
56
DtLeU16
msword
;
57
DtLeU16
lsword
;
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
130
class
DtLeInt32
131
{
132
public
:
133
134
DtLeInt16
msword
;
135
DtLeInt16
lsword
;
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
148
DtLeInt32
(
const
DtLeInt32
& i) :
msword
(i.
msword
),
lsword
(i.
lsword
) { }
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
Document ID: Generated on Mon Jan 19 08:20:14 EST 2015 from SVN revision 149581
Copyright © 2005-2012 VT MÄK. All Rights Reserved (
www.mak.com
)