MAK RTIspy API Documentation for HLA 1516
Home
Modules
Namespaces
Classes
Files
Examples
Libraries
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
libsrc
RTI
ulongHandleImpl.h
Go to the documentation of this file.
1
/*********************************************************************
2
** Copyright (c) 2003 MaK Technologies, Inc.
3
** All rights reserved.
4
*********************************************************************/
5
/*********************************************************************
6
** $RCSfile: ulongHandleImpl.h,v $ $Revision: 1.7 $ $State: Exp $
7
*********************************************************************/
8
11
12
#ifndef uloneHandleImplementation_H_
13
#define uloneHandleImplementation_H_
14
15
#include "
rtiMsConfig.h
"
16
#include <
RTI/VariableLengthData.h
>
17
#include <string>
18
#include <sstream>
19
#include "
internalTypes.h
"
20
21
class
DT_DLL_LRC
ULongHandleImplementation
22
{
23
public
:
24
26
ULongHandleImplementation
();
27
ULongHandleImplementation
(
unsigned
long
handleValue);
28
ULongHandleImplementation
(
ULongHandleImplementation
const
& rhs);
29
31
ULongHandleImplementation
& operator=(
ULongHandleImplementation
const
& rhs);
32
34
bool
operator==(
ULongHandleImplementation
const
& rhs)
const
;
35
bool
operator!=(
ULongHandleImplementation
const
& rhs)
const
;
36
bool
operator< (
ULongHandleImplementation
const
& rhs)
const
;
37
40
rti1516::VariableLengthData
encode()
const
;
42
unsigned
long
encode(
void
* buffer,
unsigned
long
bufferSize)
const
;
43
unsigned
long
encodedLength()
const
;
44
46
void
decode(
47
rti1516::VariableLengthData
const
& encodedHandle);
48
50
void
decode(
void
* buffer,
unsigned
long
bufferSize);
51
53
std::wstring
toString
()
const
;
54
56
void
setValue(
long
val);
57
long
value()
const
;
58
59
protected
:
60
unsigned
long
myValue
;
61
};
62
63
inline
ULongHandleImplementation::ULongHandleImplementation
() : myValue(0)
64
{
65
}
66
inline
ULongHandleImplementation::ULongHandleImplementation
(
67
unsigned
long
handleValue) : myValue(handleValue)
68
{
69
}
70
inline
ULongHandleImplementation::ULongHandleImplementation
(
71
ULongHandleImplementation
const
& rhs) : myValue(rhs.myValue)
72
{
73
}
74
75
inline
ULongHandleImplementation
&
ULongHandleImplementation::operator=
(
76
ULongHandleImplementation
const
& rhs)
77
{
78
if
(
this
== &rhs)
79
return
*
this
;
80
myValue
= rhs.
myValue
;
81
return
*
this
;
82
}
83
84
inline
bool
ULongHandleImplementation::operator==
(
85
ULongHandleImplementation
const
& rhs)
const
86
{
87
return
myValue
== rhs.
myValue
;
88
}
89
inline
bool
ULongHandleImplementation::operator!=
(
90
ULongHandleImplementation
const
& rhs)
const
91
{
92
return
myValue
!= rhs.
myValue
;
93
}
94
inline
bool
ULongHandleImplementation::operator<
(
95
ULongHandleImplementation
const
& rhs)
const
96
{
97
return
myValue
< rhs.
myValue
;
98
}
99
100
inline
rti1516::VariableLengthData
ULongHandleImplementation::encode
()
const
101
{
102
DtNetU32 netValue =
myValue
;
103
return
rti1516::VariableLengthData
(&netValue,
sizeof
(netValue));
104
}
105
inline
unsigned
long
ULongHandleImplementation::encode
(
void
* buffer,
106
unsigned
long
bufferSize)
const
107
{
108
DtNetU32 netValue =
myValue
;
109
if
(bufferSize <
sizeof
(netValue))
110
return
0;
111
memcpy(buffer, &netValue,
sizeof
(netValue));
112
return
sizeof
(netValue);
113
}
114
inline
unsigned
long
ULongHandleImplementation::encodedLength
()
const
115
{
116
return
sizeof
(DtNetU32);
117
}
118
119
inline
std::wstring
ULongHandleImplementation::toString
()
const
120
{
121
std::wstringstream ss;
122
ss <<
myValue
;
123
return
ss.str();
124
}
125
126
inline
void
ULongHandleImplementation::setValue
(
long
val)
127
{
128
myValue
=
myValue
;
129
}
130
inline
long
ULongHandleImplementation::value
()
const
131
{
132
return
myValue
;
133
}
134
inline
void
ULongHandleImplementation::decode
(
135
rti1516::VariableLengthData
const
& encodedHandle)
136
{
137
myValue
= *((DtNetU32*)encodedHandle.
data
());
138
}
139
140
inline
void
ULongHandleImplementation::decode
(
void
* buffer,
141
unsigned
long
bufferSize)
142
{
143
myValue
= *((DtNetU32*)buffer);
144
}
145
146
#endif
Document ID: Generated on Mon Jul 9 10:30:41 EDT 2018 from SVN revision 190224
Copyright © 2005-2018 VT MÄK Inc. All Rights Reserved (
www.mak.com
)