VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
interactionEventTranslator.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2021 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 
7 #pragma once
8 
11 #include <vl/interaction.h>
12 #include "interactionEvent.h"
14 
15 template <typename T_Interaction, unsigned EventId>
17 {
18 public:
20 
22  virtual ~DtVrlinkInteractionTranslator() override;
23 
24  virtual void init(makVrf::DtVrlinkNetworkInterface*) override;
25 
26  static void netMessageCallback(T_Interaction* inter, void* usr);
27  virtual void processNetMessage(T_Interaction* inter);
28 
29 protected:
30  virtual bool processEvent(const makVrfEvents::DtEvent&) override;
31 };
32 
33 template <typename T_Interaction, unsigned EventId>
35 {
36 }
37 
38 template <typename T_Interaction, unsigned EventId>
40 {
41 }
42 
43 template <typename T_Interaction, unsigned EventId>
45 {
47 
48  T_Interaction::addCallback(myNetworkInterface->exerciseConnection(), netMessageCallback, this);
49 }
50 
51 template <typename T_Interaction, unsigned EventId>
53 {
54  static_cast<DtVrlinkInteractionTranslator<T_Interaction, EventId >*>(usr)->processNetMessage(inter);
55 }
56 
57 template <typename T_Interaction, unsigned EventId>
59 {
60  T_InteractionEvent interEvent;
61 
62  // Convert the sender ID from the entity ID to the VRF UUID
63  interEvent.setSenderId(myNetworkInterface->uuidForObjectIdentifier(inter->senderId()));
64  interEvent.setInteraction(*inter);
65 
66  // All will get checked at a higher level. This is just mostly a pass through
67  signal_receivedEvent(interEvent);
68 }
69 
70 template <typename T_Interaction, unsigned EventId>
72 {
73  const T_InteractionEvent* interEvent = static_cast<const T_InteractionEvent*>(&e);
74  T_Interaction inter = interEvent->interaction();
75 
76  // Convert the sender ID from the VRF UUID to the entity ID
77  inter.setSenderId(myNetworkInterface->objectIdentifierFor(interEvent->senderId()));
78 
79  myNetworkInterface->exerciseConnection()->sendStamped(inter);
80  return true;
81 }
virtual void setInteraction(const T_Interaction &inter)
Definition: interactionEvent.h:90
const DtUUID & senderId() const
Definition: interactionEvent.h:108
Definition: event.h:13
virtual void setSenderId(const DtUUID &sender)
Definition: interactionEvent.h:102
DT_DLL_DEBUGDRAWRENDERER void init(makVrv::DtDe &de)
Work function for the plugin initialization.
const T_Interaction & interaction() const
Definition: interactionEvent.h:96
Definition: interactionEvent.h:20

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)