MAK RTIspy API Documentation for HLA 1516
Home
Modules
Namespaces
Classes
Files
Examples
Libraries
File List
File Members
include
HLA1516
RTI
RTI/Handle.h
Go to the documentation of this file.
1
/***********************************************************************
2
IEEE 1516.1 High Level Architecture Interface Specification C++ API
3
File: RTI/Handle.h
4
***********************************************************************/
5
6
#ifndef RTI_Handle_h
7
#define RTI_Handle_h
8
9
#include <RTI/SpecificConfig.h>
10
#include <RTI/Exception.h>
11
#include <RTI/VariableLengthData.h>
12
#include <string>
13
14
// The following macro is used to define each of the Handle classes
15
// that are used by the RTI's API, e.g. AttributeHandle, ParameterHandle, etc.
16
// Each kind of handle contains the same set of operators and functions, but
17
// each is a separate class for type safety. The encode method can be used to
18
// generate an encoded value for a handle, that can be sent to other federates
19
// as an attribute or parameter. (Use RTIambassador functions to reconstruct a
20
// handle from an encoded value). RTI implementations contain definitions
21
// for each kind of the HandleKindImplementation classes (e.g.
22
// AttributeHandleImplementation), but these classes are not needed by
23
// federate code.
24
25
#define DEFINE_HANDLE_CLASS(HandleKind) \
26
\
27
/* Forward declaration for the RTI-internal class */
\
28
/* used to implement a specific kind of handle */
\
29
class HandleKind##Implementation; \
30
\
31
/* Each handle class generated by this macro provides the */
\
32
/* following interface */
\
33
class RTI_EXPORT HandleKind \
34
{ \
35
public: \
36
\
37
/* Constructs an invalid handle */
\
38
HandleKind(); \
39
\
40
~HandleKind() \
41
throw(); \
42
\
43
HandleKind(HandleKind const & rhs); \
44
\
45
HandleKind & \
46
operator=(HandleKind const & rhs); \
47
\
48
/* Indicates whether this handle is valid */
\
49
bool isValid() const; \
50
\
51
/* All invalid handles are equivalent */
\
52
bool operator==(HandleKind const & rhs) const; \
53
bool operator!=(HandleKind const & rhs) const; \
54
bool operator< (HandleKind const & rhs) const; \
55
\
56
/* Generate an encoded value that can be used to send */
\
57
/* handles to other federates in updates or interactions. */
\
58
VariableLengthData encode() const; \
59
\
60
/* Alternate encode for directly filling a buffer */
\
61
unsigned long encodedLength() const; \
62
unsigned long encode( \
63
void* buffer, unsigned long bufferSize) const \
64
throw (CouldNotEncode); \
65
\
66
std::wstring toString() const; \
67
\
68
protected: \
69
\
70
/* Friend declaration for an RTI-internal class that */
\
71
/* can access the implementation of a handle. */
\
72
friend class HandleKind##Friend; \
73
\
74
const HandleKind##Implementation* getImplementation() const; \
75
\
76
HandleKind##Implementation* getImplementation(); \
77
\
78
explicit \
79
HandleKind(HandleKind##Implementation* impl); \
80
\
81
explicit \
82
HandleKind(VariableLengthData const & encodedValue); \
83
\
84
HandleKind##Implementation* _impl; \
85
\
86
}; \
87
\
88
/* Output operator for Handles */
\
89
std::wostream RTI_EXPORT & \
90
operator << (std::wostream &, HandleKind const &);
91
92
93
namespace
rti1516
94
{
95
96
// All of the RTI API's Handle classes are defined
97
// by invoking the macro above.
98
DEFINE_HANDLE_CLASS
(
FederateHandle
)
99
DEFINE_HANDLE_CLASS
(
ObjectClassHandle
)
100
DEFINE_HANDLE_CLASS
(
InteractionClassHandle
)
101
DEFINE_HANDLE_CLASS
(ObjectInstanceHandle)
102
DEFINE_HANDLE_CLASS
(
AttributeHandle
)
103
DEFINE_HANDLE_CLASS
(
ParameterHandle
)
104
DEFINE_HANDLE_CLASS
(
DimensionHandle
)
105
DEFINE_HANDLE_CLASS
(MessageRetractionHandle)
106
DEFINE_HANDLE_CLASS
(RegionHandle)
107
108
}
109
110
#endif // RTI_Handle_h
111
Document ID: Generated on Fri Mar 14 19:08:55 EDT 2014 from SVN revision 137085
Copyright © 2005-2014 VT MÄK Inc. All Rights Reserved (
www.mak.com
)