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"
13 
14 template <typename T_Interaction, unsigned EventId>
16 {
17 public:
19 
22 
24 
25  static void netMessageCallback(T_Interaction* inter, void* usr);
26  virtual void processNetMessage(T_Interaction* inter);
27 
28 protected:
29  virtual bool processEvent(const makVrfEvents::DtEvent&);
30 };
31 
32 template <typename T_Interaction, unsigned EventId>
34 {
35 }
36 
37 template <typename T_Interaction, unsigned EventId>
39 {
40 }
41 
42 template <typename T_Interaction, unsigned EventId>
44 {
46 
47  T_Interaction::addCallback(myNetworkInterface->exerciseConnection(), netMessageCallback, this);
48 }
49 
50 template <typename T_Interaction, unsigned EventId>
52 {
53  static_cast<DtVrlinkInteractionTranslator<T_Interaction, EventId >*>(usr)->processNetMessage(inter);
54 }
55 
56 template <typename T_Interaction, unsigned EventId>
58 {
59  T_InteractionEvent interEvent;
60 
61  // Convert the sender ID from the entity ID to the VRF UUID
62  interEvent.setSenderId(myNetworkInterface->uuidForObjectIdentifier(inter->senderId()));
63  interEvent.setInteraction(*inter);
64 
65  // All will get checked at a higher level. This is just mostly a pass through
66  signal_receivedEvent(interEvent);
67 }
68 
69 template <typename T_Interaction, unsigned EventId>
71 {
72  const T_InteractionEvent* interEvent = static_cast<const T_InteractionEvent*>(&e);
73  T_Interaction inter = interEvent->interaction();
74 
75  // Convert the sender ID from the VRF UUID to the entity ID
76  inter.setSenderId(myNetworkInterface->objectIdentifierFor(interEvent->senderId()));
77 
78  myNetworkInterface->exerciseConnection()->sendStamped(inter);
79  return true;
80 }
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 Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)