MAK RTIspy API Documentation for HLA 1.3
Home
Modules
Namespaces
Classes
Files
Examples
Libraries
File List
File Members
include
HLA1516E
RTI
/RTI/Handle.h
Go to the documentation of this file.
1
/***********************************************************************
2
The IEEE hereby grants a general, royalty-free license to copy, distribute,
3
display and make derivative works from this material, for all purposes,
4
provided that any use of the material contains the following
5
attribution: "Reprinted with permission from IEEE 1516.1(TM)-2010".
6
Should you require additional information, contact the Manager, Standards
7
Intellectual Property, IEEE Standards Association (stds-ipr@ieee.org).
8
***********************************************************************/
9
/***********************************************************************
10
IEEE 1516.1 High Level Architecture Interface Specification C++ API
11
File: RTI/Handle.h
12
***********************************************************************/
13
14
#ifndef RTI_Handle_h
15
#define RTI_Handle_h
16
17
#include <RTI/SpecificConfig.h>
18
#include <RTI/Exception.h>
19
#include <RTI/VariableLengthData.h>
20
#include <string>
21
22
// The following macro is used to define each of the Handle classes
23
// that are used by the RTI's API, e.g. AttributeHandle, ParameterHandle, etc.
24
// Each kind of handle contains the same set of operators and functions, but
25
// each is a separate class for type safety. The encode method can be used to
26
// generate an encoded value for a handle, that can be sent to other federates
27
// as an attribute or parameter. (Use RTIambassador functions to reconstruct a
28
// handle from an encoded value). RTI implementations contain definitions
29
// for each kind of the HandleKindImplementation classes (e.g.
30
// AttributeHandleImplementation), but these classes are not needed by
31
// federate code.
32
33
#define DEFINE_HANDLE_CLASS(HandleKind) \
34
\
35
/* Forward declaration for the RTI-internal class */
\
36
/* used to implement a specific kind of handle */
\
37
class HandleKind##Implementation; \
38
\
39
/* Each handle class generated by this macro provides the */
\
40
/* following interface */
\
41
class RTI_EXPORT HandleKind \
42
{ \
43
public: \
44
\
45
/* Constructs an invalid handle */
\
46
HandleKind (); \
47
\
48
~HandleKind () \
49
throw(); \
50
\
51
HandleKind ( \
52
HandleKind const & rhs); \
53
\
54
HandleKind & operator= ( \
55
HandleKind const & rhs); \
56
\
57
/* Indicates whether this handle is valid */
\
58
bool isValid () const; \
59
\
60
/* All invalid handles are equivalent */
\
61
bool operator== ( \
62
HandleKind const & rhs) const; \
63
\
64
bool operator!= ( \
65
HandleKind const & rhs) const; \
66
\
67
bool operator< ( \
68
HandleKind const & rhs) const; \
69
\
70
/* Generate a hash value for use in storing handles in a */
\
71
/* in a hash table. */
\
72
/* Note: The hash value may not be unique across two */
\
73
/* separate handle values but it will be equal given two */
\
74
/* separate instances of the same handle value. */
\
75
/* H1 == H2 implies H1.hash() == H2.hash() */
\
76
/* H1 != H2 does not imply H1.hash() != H2.hash() */
\
77
long hash () const; \
78
\
79
/* Generate an encoded value that can be used to send */
\
80
/* handles to other federates in updates or interactions. */
\
81
VariableLengthData encode () const; \
82
\
83
/* Encode into an existing VariableLengthData */
\
84
void encode (VariableLengthData& buffer) const; \
85
\
86
/* Alternate encode for directly filling a buffer */
\
87
size_t encode ( \
88
void* buffer, \
89
size_t bufferSize) const \
90
throw (CouldNotEncode); \
91
\
92
size_t encodedLength () const; \
93
\
94
std::wstring toString () const; \
95
\
96
protected: \
97
\
98
/* Friend declaration for an RTI-internal class that */
\
99
/* can access the implementation of a handle. */
\
100
friend class HandleKind##Friend; \
101
\
102
const HandleKind##Implementation* getImplementation () const; \
103
\
104
HandleKind##Implementation* getImplementation (); \
105
\
106
explicit HandleKind ( \
107
HandleKind##Implementation* impl); \
108
\
109
explicit HandleKind ( \
110
VariableLengthData const & encodedValue); \
111
\
112
HandleKind##Implementation* _impl; \
113
\
114
}; \
115
\
116
/* Output operator for Handles */
\
117
std::wostream RTI_EXPORT & \
118
operator<< ( \
119
std::wostream &, \
120
HandleKind const &);
121
122
123
namespace
rti1516e
124
{
125
126
// All of the RTI API's Handle classes are defined
127
// by invoking the macro above.
128
DEFINE_HANDLE_CLASS
(
FederateHandle
)
129
DEFINE_HANDLE_CLASS
(
ObjectClassHandle
)
130
DEFINE_HANDLE_CLASS
(
InteractionClassHandle
)
131
DEFINE_HANDLE_CLASS
(ObjectInstanceHandle)
132
DEFINE_HANDLE_CLASS
(
AttributeHandle
)
133
DEFINE_HANDLE_CLASS
(
ParameterHandle
)
134
DEFINE_HANDLE_CLASS
(
DimensionHandle
)
135
DEFINE_HANDLE_CLASS
(MessageRetractionHandle)
136
DEFINE_HANDLE_CLASS
(RegionHandle)
137
138
}
139
140
#endif // RTI_Handle_h
141
Document ID: Generated on Tue May 7 16:26:47 EDT 2013 from SVN revision 126903
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (
www.mak.com
)