VR-Link API Documentation for HLA 1516
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
managedInterface.h
Go to the documentation of this file.
1 /*********************************************************************************
2 ** Copyright (c) 2014 MAK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************************/
5 
6 #pragma once
7 
11 
14 
15 #include <vlutil/vlString.h>
16 
17 #include <list>
18 #include <set>
19 #include <string>
20 #include <map>
21 
22 class DtManagedInterface;
23 class DtMessage;
24 class DtMessageFactory;
25 class DtMessageHandler;
26 class DtLinkStrategy;
27 class DtFilePrinter;
28 
31 typedef void (*PluginVerisionFunction)(DtString& version);
32 typedef void (*PluginNameFunction)(DtString& name);
33 typedef DtLinkStrategy* (*StrategyCreator)(DtManagedInterface* gl);
34 
36 typedef void (*ManagedMessageDelegate)(unsigned char* msg, int length);
37 typedef void (*JavaManagedMessageDelegate)(unsigned char* msg, int length, void* data);
38 
40 {
41  DtUnknown = 0,
42  DtDis = 1,
43  DtHLA13 = 2,
44  DtHLA1516 = 3,
46 };
47 
50 {
51  private:
55  virtual ~DtManagedInterface();
56 
57  public:
59  static DtManagedInterface& instance();
60 
62  static bool exists();
63 
65  static void destroy();
66 
68  static bool checkVrlLicense();
69 
71  void initializeManagedInterface(ManagedMessageDelegate del);
73  void initializeManagedInterface(JavaManagedMessageDelegate del, void* data,
74  unsigned char * reusableSendMsgBuffer);
75 
77  void tick(double maxTime);
78 
80  void shutdown();
81 
83  void receiveMessage(unsigned char* msg, int length);
84 
86  void sendMessage(DtMessage* msg);
87 
89  bool handleMessage(DtMessage* msg);
90 
92  virtual DtMessageFactory& messageFactory() const;
93 
96  //{@
98  virtual bool hasResource(const std::string& name) const;
99 
101  virtual void* findResource(const std::string& name ) const;
102 
104  virtual void setResource(const std::string& name, void* asset);
105 
107  virtual bool removeResource(const std::string& name);
109 
111  //{@
112  virtual void addHandler(const std::string& messageType, DtMessageDelegate* handler);
113  virtual void removeHandler(const std::string& messageType, DtMessageDelegate* handler);
115 
117  //{@
118  virtual void addStrategy(DtLinkStrategy* strategy);
119  virtual void removeStrategy(const std::string& name);
120  virtual DtLinkStrategy* findStrategy(const std::string& name);
122 
125  virtual void addStrategyCreator(const std::string& name, StrategyCreator creator);
126 
128  virtual DtLinkStrategy* createStrategy(const std::string& name);
129 
131  virtual double maxDrainInputTime() {return myMaxDrainInputTime;}
132 
134  virtual std::set<DtProtocolType> availableProtocols();
135 
136  public:
137  static std::string theDataPath;
138 
139  protected:
141  virtual void handlePrintMessage(DtMessage* msg);
143  virtual void handleNotifyLevelMessage(DtMessage* msg);
145  virtual void prefixPath(const std::string &prefixDir) const;
147  virtual void restorePath() const;
149  virtual std::set<std::string> getPathDirs() const;
151  virtual void loadLibsFromDir(const std::string &dirname, const std::set<std::string> &files, std::list<std::string>& filesLoaded);
153  virtual std::set<std::string> findLibNames(const std::string &dirname, const std::string &filePrefix) const;
155  virtual bool loadLibrary(const std::string &filename, const DtString &acceptableVersionStr);
157  virtual bool loadCoreLibraries(const std::string &dirname, std::list<std::string>& filesLoaded);
159  virtual void findAndLoadCoreLibraries(std::list<std::string>& filesLoaded);
161  virtual void loadLibraries();
163  virtual bool checkLibrariesLoaded(const std::list<std::string>& filesLoaded, std::set<DtProtocolType>& availableProtocol, bool shouldThrow = false);
164 
166 
168 
170  void* myData;
171  unsigned char* myReusableSendBuffer;
172 
174  std::set<DtProtocolType> myInitializedProtocols;
175 
177 
178  typedef std::map<std::string, void*> ResourceMap;
179  typedef ResourceMap::iterator ResourceIter;
181 
182  typedef std::multimap<std::string, DtMessageDelegate*> HandlerMap;
183  typedef std::pair<std::string, DtMessageDelegate*> HandlerPair;
185 
186  typedef std::map<std::string, DtLinkStrategy*> StrategyMap;
187  typedef std::pair<std::string, DtLinkStrategy*> StrategyPair;
189 
190  typedef std::map<std::string, StrategyCreator> StrategyCreatorMap;
192 
195 
197  std::set<std::string> myFilesLoaded;
198  std::set<std::string> myPluginsLoaded;
199 
201 
202  static std::string restorePathStr;
203 };
Definition: managedInterface.h:44
Defines a single parameter delegate to make binding member function pointers easier.
static std::string restorePathStr
Definition: managedInterface.h:202
static std::string theDataPath
Definition: managedInterface.h:137
virtual double maxDrainInputTime()
get the maximum time to spend in drain input
Definition: managedInterface.h:131
Definition: managedInterface.h:41
Contains the DtString class declaration.
StrategyCreatorMap myStrategyCreatorMap
Definition: managedInterface.h:191
DtFilePrinter is a subclass of DtPrinter which opens a file and dumps all information received from D...
Definition: vlPrint.h:80
void(* JavaManagedMessageDelegate)(unsigned char *msg, int length, void *data)
Definition: managedInterface.h:37
#define MANAGEDINTERFACE_DLL
Definition: plugin.h:15
bool(* InitManagedInterfaceDllFunction)(DtManagedInterface *gl)
typedef function definitions for creator and DLL Initialize functions
Definition: managedInterface.h:30
ManagedMessageDelegate myCSharpMessageDelegate
Definition: managedInterface.h:167
std::set< std::string > myPluginsLoaded
Definition: managedInterface.h:198
Definition: managedInterface.h:43
std::map< std::string, StrategyCreator > StrategyCreatorMap
Definition: managedInterface.h:190
This is the DtMessage class.
Definition: message.h:20
unsigned char * myReusableSendBuffer
Definition: managedInterface.h:171
std::map< std::string, void * > ResourceMap
Definition: managedInterface.h:178
The DtManagedInterface Class is a singleton that is used to manage the message flow between C# and th...
Definition: managedInterface.h:49
std::set< DtProtocolType > myInitializedProtocols
Definition: managedInterface.h:174
JavaManagedMessageDelegate myJavaMessageDelegate
Definition: managedInterface.h:169
DtMessageFactory * myMessageFactory
Definition: managedInterface.h:176
Definition: managedInterface.h:42
Definition: managedInterface.h:45
void(* PluginNameFunction)(DtString &name)
Definition: managedInterface.h:32
the DtMessageFactory class
Definition: messageFactory.h:25
StrategyMap myLinkStrategies
Definition: managedInterface.h:188
DtLinkStrategy *(* StrategyCreator)(DtManagedInterface *gl)
Definition: managedInterface.h:33
void * myData
Definition: managedInterface.h:170
DtMessageDelegate * myNotifyLevelHandler
Definition: managedInterface.h:194
std::multimap< std::string, DtMessageDelegate * > HandlerMap
Definition: managedInterface.h:182
std::pair< std::string, DtLinkStrategy * > StrategyPair
Definition: managedInterface.h:187
static DtManagedInterface * theInstance
Definition: managedInterface.h:165
ResourceMap myResources
Definition: managedInterface.h:180
void(* ManagedMessageDelegate)(unsigned char *msg, int length)
typedef for external function to handle messages coming from DtManagedInterfac
Definition: managedInterface.h:36
DtProtocolType
Definition: managedInterface.h:39
DtMessageDelegate * myPrintHandler
Definition: managedInterface.h:193
DtFilePrinter * myFilePrinter
Definition: managedInterface.h:196
MANAGEDINTERFACE_DLL void tick(double maxTime)
Tick ManagedInterface.
bool myIsInitalized
Definition: managedInterface.h:173
Instances of DtString are used to represent strings.
Definition: vlString.h:29
std::map< std::string, DtLinkStrategy * > StrategyMap
Definition: managedInterface.h:186
Delegate template for binding static or member functions for callback at later time The return type a...
Definition: delegate.h:69
HandlerMap myMessageHandlers
Definition: managedInterface.h:184
std::set< std::string > myFilesLoaded
Definition: managedInterface.h:197
ResourceMap::iterator ResourceIter
Definition: managedInterface.h:179
double myMaxDrainInputTime
Definition: managedInterface.h:200
void(* PluginVerisionFunction)(DtString &version)
Definition: managedInterface.h:31
MANAGEDINTERFACE_DLL bool checkVrlLicense()
Check VR-Link License Availability.
std::pair< std::string, DtMessageDelegate * > HandlerPair
Definition: managedInterface.h:183

Document ID: Generated on Tue Aug 10 00:12:31 EDT 2021 from SVN revision 232765
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)