VR-Forces 5.0.3 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
luaMessageInterface.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2021 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 #pragma once
6 
7 #include <vrfLua/vrfLuaDefines.h>
8 #include <luabind/luabind.hpp>
9 #include <unordered_map>
11 #include <functional>
12 
13 class DtScriptVrfObject;
15 class DtAdminContent;
16 class DtVrfObjectMessage;
17 class DtScriptVrfObject;
18 
24 {
25 private:
29  DtLuaMessageInterface& operator=(const DtLuaMessageInterface& other);
30 public:
31  typedef DtAdminContent*(*luaTableToAdminContentFcn)(const luabind::object& messageContents);
32  typedef bool(*adminContentToLuaTableFcn)(const DtAdminContent*, luabind::object& luaTable);
33 
35  //typedef void(*receiveLuaMessageFcn)(const std::string& messageType, const luabind::object& messageContents, void* usr);
36  typedef std::function<void(const DtVrfObjectMessage* msg)> MessageReceiveFcn;
37 
39  virtual ~DtLuaMessageInterface();
40 
41  virtual void sendMessage(const DtScriptVrfObject& receiver, const std::string& messageType, const luabind::object& messageContents);
42  virtual void sendRadioMessage(const DtScriptVrfObject& receiver, const std::string& messageType, const luabind::object& messageContents);
43  virtual void registerForMessage(const std::string& messageType);
44  virtual void unregisterForMessage(const std::string& messageType);
45 
46 protected:
47  static void objectMessageCallback(const DtVrfObjectMessage* msg, void* usr);
48  virtual void processObjectMessage(const DtVrfObjectMessage* msg);
49 
50 protected:
52  std::list<DtAdminContentMessageType> myRegisteredAdminTypes;
54 };
std::list< DtAdminContentMessageType > myRegisteredAdminTypes
Definition: luaMessageInterface.h:52
Handles translation of messages from C++ structures into Lua tables and the reverse translation as we...
Definition: luaMessageInterface.h:23
std::function< void(const DtVrfObjectMessage *msg)> MessageReceiveFcn
Function signature for the function called when.
Definition: luaMessageInterface.h:36
DtVrfObjectCommunicationInterface * myCommunicationIf
Definition: luaMessageInterface.h:51
MessageReceiveFcn myMessageReceiveFcn
Definition: luaMessageInterface.h:53
#define DT_DLL_vrfLua
This file is used to determine how to build.
Definition: vrfLuaDefines.h:25
The base class for all messages to/from a specific DtVrfObject. Various subclasses of this class will...
Definition: vrfObjectMessage.h:30
DtAdminContent.
Definition: adminContent.h:23
The central class of a DtLocalObject for all communications to and from the object. This class manages all communications on a specific DtLocalObject, though both simulation internal communication, and communication though the simulated radios of the object. All communication is done though the use of the DtVrfObjectMessage class and its subclasses. Callbacks can be registered on this interface which will be called on receipt of a message by this entity. Messages can be sent from this entity by using the message sending functions. These messages may be sent though the SimInternal message mechanism, or the radio message system. Radios will not exist until createRadiosFromDescriptorList() or createRadiosFromDescriptorList(const DtRadioDescriptorList&amp; descList) is called.
Definition: vrfObjectCommunicationInterface.h:40
Definition: scriptVrfObject.h:29

Document ID: Generated on Thu Jun 1 17:58:13 EDT 2023 from SVN revision 255404
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)