VR-Link API Documentation for DIS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
defaultOwnershipHandler.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 2014 VT MAK
3 ** All rights reserved.
4 *********************************************************************/
5 
6 #pragma once
7 
8 #if DtHLA
9 
10 #include <vl/ownershipHandler.h>
11 #include <vl/objClassDesc.h>
12 
13 #include <list>
14 
15 enum DtOwnershipAction
16 {
17  OWNERSHIP_CALLBACK,
18  OWNERSHIP_ACCEPT_ALL,
19  OWNERSHIP_DENY_ALL
20 };
21 
22 typedef void (*DtAcquireOwnershipCb)(DtHlaObject* hlaObject, void* usr);
23 typedef void (*DtDivestOwnershipCb)(DtHlaObject* hlaObject, void* usr);
24 
25 typedef bool (*DtAcquireOwnershipRequestCb)(DtHlaObject* hlaObject, void* usr);
26 typedef bool (*DtDivestOwnershipRequestCb)(DtHlaObject* hlaObject, void* usr);
27 
28 struct DtAcquireOwnershipCbInfo
29 {
30  DtAcquireOwnershipCb cbFunction;
31  void* userData;
32 };
33 
34 struct DtDivestOwnershipCbInfo
35 {
36  DtDivestOwnershipCb cbFunction;
37  void* userData;
38 };
39 
40 struct DtAcquireOwnershipRequestCbInfo
41 {
42  DtAcquireOwnershipRequestCb cbFunction;
43  void* userData;
44 };
45 
46 struct DtDivestOwnershipRequestCbInfo
47 {
48  DtDivestOwnershipRequestCb cbFunction;
49  void* userData;
50 };
51 
57 class DT_DLL_VL DtDefaultOwnershipHandler : public DtOwnershipHandler
58 {
59 public:
61  DtDefaultOwnershipHandler();
62 
64  virtual ~DtDefaultOwnershipHandler();
65 
67  virtual DtOwnershipHandler* clone() const;
68 
70  DtDefaultOwnershipHandler(const DtDefaultOwnershipHandler& other);
71 
73  DtDefaultOwnershipHandler& operator=(const DtDefaultOwnershipHandler& other);
74 
78  virtual void setOwnershipAcquisitionAction(DtOwnershipAction);
79 
83  virtual void setOwnershipDivestitudeAction(DtOwnershipAction);
84 
88  virtual void gainOwnership(const RTI::AttributeHandleSet& set);
89 
94  virtual void loseOwnership(const RTI::AttributeHandleSet& set);
95 
98  //{@
99  virtual void addAcquireOwnershipCallback(DtAcquireOwnershipCb cb, void* usr, const DtObjClassDesc* desc = 0);
100  virtual void removeAcquireOwnershipCallback(DtAcquireOwnershipCb cb, void* usr, const DtObjClassDesc* desc = 0);
102 
105  //{@
106  virtual void addDivestOwnershipCallback(DtDivestOwnershipCb cb, void* usr, const DtObjClassDesc* desc = 0);
107  virtual void removeDivestOwnershipCallback(DtDivestOwnershipCb cb, void* usr, const DtObjClassDesc* desc = 0);
109 
113  //{@
114  virtual void addAcquireOwnershipRequestCallback(DtAcquireOwnershipRequestCb cb, void* usr);
115  virtual void removeAcquireOwnershipRequestCallback(DtAcquireOwnershipRequestCb cb, void* usr);
116 
117  virtual void addDivestOwnershipRequestCallback(DtDivestOwnershipRequestCb cb, void* usr);
118  virtual void removeDivestOwnershipRequestCallback(DtDivestOwnershipRequestCb cb, void* usr);
120 
121  virtual bool requestAttributeOwnershipRelease (
122  const RTI::AttributeHandleSet& candidateAttributes,
123 #if DtHLA_1516
124  const RTI::VariableLengthData &theTag
125 #else
126  const char* theTag
127 #endif
128  );
129 
130  virtual void requestAttributeOwnershipAssumption (
131  const RTI::AttributeHandleSet& offeredAttributes,
132 #if DtHLA_1516
133  const RTI::VariableLengthData &theTag
134 #else
135  const char* theTag
136 #endif
137  );
138 
139 protected:
140  DtOwnershipAction myAcquisitionAction;
141  DtOwnershipAction myDivestAction;
142 
143  std::map<RTI::ObjectClassHandle, std::list<DtAcquireOwnershipCbInfo> > myAcquireOwnershipCbList;
144  std::map<RTI::ObjectClassHandle, std::list<DtDivestOwnershipCbInfo> > myDivestOwnershipCbList;
145  std::list<DtAcquireOwnershipCbInfo> myDefaultAcquireOwnershipCb;
146  std::list<DtDivestOwnershipCbInfo> myDefaultDivestOwnershipCb;
147  std::list<DtAcquireOwnershipRequestCbInfo> myAcquireOwnershipRequestCbList;
148  std::list<DtDivestOwnershipRequestCbInfo> myDivestOwnershipRequestCbList;
149 };
150 
151 
152 #endif //DtHLA
153 

Document ID: Generated on Tue Mar 1 02:56:17 EST 2016 from SVN revision 162687
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)