VR-Link API Documentation for HLA 1.3
 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 
137  virtual DtProtocolType activeProtocol();
139  virtual void setActiveProtocol(DtProtocolType protocol);
141 
142  public:
143  static std::string theDataPath;
144 
145  protected:
147  virtual void handlePrintMessage(DtMessage* msg);
149  virtual void handleNotifyLevelMessage(DtMessage* msg);
151  virtual void prefixPath(const std::string &prefixDir) const;
153  virtual void restorePath() const;
155  virtual std::set<std::string> getPathDirs() const;
157  virtual void loadLibsFromDir(const std::string &dirname, const std::set<std::string> &files, std::list<std::string>& filesLoaded);
159  virtual std::set<std::string> findLibNames(const std::string &dirname, const std::string &filePrefix) const;
161  virtual bool loadLibrary(const std::string &filename, const DtString &acceptableVersionStr);
163  virtual bool loadCoreLibraries(const std::string &dirname, std::list<std::string>& filesLoaded);
165  virtual void findAndLoadCoreLibraries(std::list<std::string>& filesLoaded);
167  virtual void loadLibraries();
169  virtual bool checkLibrariesLoaded(const std::list<std::string>& filesLoaded, std::set<DtProtocolType>& availableProtocol, bool shouldThrow = false);
170 
172 
175 
177  void* myData;
178  unsigned char* myReusableSendBuffer;
179 
181  std::set<DtProtocolType> myInitializedProtocols;
182 
184 
185  typedef std::map<std::string, void*> ResourceMap;
186  typedef ResourceMap::iterator ResourceIter;
188 
189  typedef std::multimap<std::string, DtMessageDelegate*> HandlerMap;
190  typedef std::pair<std::string, DtMessageDelegate*> HandlerPair;
192 
193  typedef std::map<std::string, DtLinkStrategy*> StrategyMap;
194  typedef std::pair<std::string, DtLinkStrategy*> StrategyPair;
196 
197  typedef std::map<std::string, StrategyCreator> StrategyCreatorMap;
199 
202 
204  std::set<std::string> myFilesLoaded;
205  std::set<std::string> myPluginsLoaded;
206 
208 
209  static std::string restorePathStr;
210 };
Definition: managedInterface.h:44
Defines a single parameter delegate to make binding member function pointers easier.
static std::string restorePathStr
Definition: managedInterface.h:209
static std::string theDataPath
Definition: managedInterface.h:143
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:198
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:174
std::set< std::string > myPluginsLoaded
Definition: managedInterface.h:205
Definition: managedInterface.h:43
std::map< std::string, StrategyCreator > StrategyCreatorMap
Definition: managedInterface.h:197
This is the DtMessage class.
Definition: message.h:20
unsigned char * myReusableSendBuffer
Definition: managedInterface.h:178
std::map< std::string, void * > ResourceMap
Definition: managedInterface.h:185
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:181
JavaManagedMessageDelegate myJavaMessageDelegate
Definition: managedInterface.h:176
DtMessageFactory * myMessageFactory
Definition: managedInterface.h:183
Definition: managedInterface.h:42
DtProtocolType myActiveProtocol
Definition: managedInterface.h:173
Definition: managedInterface.h:45
void(* PluginNameFunction)(DtString &name)
Definition: managedInterface.h:32
the DtMessageFactory class
Definition: messageFactory.h:25
StrategyMap myLinkStrategies
Definition: managedInterface.h:195
DtLinkStrategy *(* StrategyCreator)(DtManagedInterface *gl)
Definition: managedInterface.h:33
void * myData
Definition: managedInterface.h:177
DtMessageDelegate * myNotifyLevelHandler
Definition: managedInterface.h:201
std::multimap< std::string, DtMessageDelegate * > HandlerMap
Definition: managedInterface.h:189
std::pair< std::string, DtLinkStrategy * > StrategyPair
Definition: managedInterface.h:194
static DtManagedInterface * theInstance
Definition: managedInterface.h:171
ResourceMap myResources
Definition: managedInterface.h:187
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:200
DtFilePrinter * myFilePrinter
Definition: managedInterface.h:203
MANAGEDINTERFACE_DLL void tick(double maxTime)
Tick ManagedInterface.
bool myIsInitalized
Definition: managedInterface.h:180
Instances of DtString are used to represent strings.
Definition: vlString.h:29
std::map< std::string, DtLinkStrategy * > StrategyMap
Definition: managedInterface.h:193
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:191
std::set< std::string > myFilesLoaded
Definition: managedInterface.h:204
ResourceMap::iterator ResourceIter
Definition: managedInterface.h:186
double myMaxDrainInputTime
Definition: managedInterface.h:207
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:190

Document ID: Generated on Wed Mar 27 02:04:30 EDT 2024 from SVN revision 264570
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)