VR-Link API Documentation for HLA 4
 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) 1992-2025 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 {
47 };
48 
51 {
52  private:
56  virtual ~DtManagedInterface();
57 
58  public:
60  static DtManagedInterface& instance();
61 
63  static bool exists();
64 
66  static void destroy();
67 
69  static bool checkVrlLicense();
70 
72  void initializeManagedInterface(ManagedMessageDelegate del);
74  void initializeManagedInterface(JavaManagedMessageDelegate del, void* data,
75  unsigned char * reusableSendMsgBuffer);
76 
78  void tick(double maxTime);
79 
81  void shutdown();
82 
84  void receiveMessage(unsigned char* msg, int length);
85 
87  void sendMessage(DtMessage* msg);
88 
90  bool handleMessage(DtMessage* msg);
91 
93  virtual DtMessageFactory& messageFactory() const;
94 
97  //{@
99  virtual bool hasResource(const std::string& name) const;
100 
102  virtual void* findResource(const std::string& name ) const;
103 
105  virtual void setResource(const std::string& name, void* asset);
106 
108  virtual bool removeResource(const std::string& name);
110 
112  //{@
113  virtual void addHandler(const std::string& messageType, DtMessageDelegate* handler);
114  virtual void removeHandler(const std::string& messageType, DtMessageDelegate* handler);
116 
118  //{@
119  virtual void addStrategy(DtLinkStrategy* strategy);
120  virtual void removeStrategy(const std::string& name);
121  virtual DtLinkStrategy* findStrategy(const std::string& name);
123 
126  virtual void addStrategyCreator(const std::string& name, StrategyCreator creator);
127 
129  virtual DtLinkStrategy* createStrategy(const std::string& name);
130 
132  virtual double maxDrainInputTime() {return myMaxDrainInputTime;}
133 
135  virtual std::set<DtProtocolType> availableProtocols();
136 
138  virtual DtProtocolType activeProtocol();
140  virtual void setActiveProtocol(DtProtocolType protocol);
142 
143  public:
144  static std::string theDataPath;
145 
146  protected:
148  virtual void handlePrintMessage(DtMessage* msg);
150  virtual void handleNotifyLevelMessage(DtMessage* msg);
152  virtual void prefixPath(const std::string &prefixDir) const;
154  virtual void restorePath() const;
156  virtual std::set<std::string> getPathDirs() const;
158  virtual void loadLibsFromDir(const std::string &dirname, const std::set<std::string> &files, std::list<std::string>& filesLoaded);
160  virtual std::set<std::string> findLibNames(const std::string &dirname, const std::string &filePrefix) const;
162  virtual bool loadLibrary(const std::string &filename, const DtString &acceptableVersionStr);
164  virtual bool loadCoreLibraries(const std::string &dirname, std::list<std::string>& filesLoaded);
166  virtual void findAndLoadCoreLibraries(std::list<std::string>& filesLoaded);
168  virtual void loadLibraries();
170  virtual bool checkLibrariesLoaded(const std::list<std::string>& filesLoaded, std::set<DtProtocolType>& availableProtocol, bool shouldThrow = false);
171 
173 
176 
178  void* myData;
179  unsigned char* myReusableSendBuffer;
180 
182  std::set<DtProtocolType> myInitializedProtocols;
183 
185 
186  typedef std::map<std::string, void*> ResourceMap;
187  typedef ResourceMap::iterator ResourceIter;
189 
190  typedef std::multimap<std::string, DtMessageDelegate*> HandlerMap;
191  typedef std::pair<std::string, DtMessageDelegate*> HandlerPair;
193 
194  typedef std::map<std::string, DtLinkStrategy*> StrategyMap;
195  typedef std::pair<std::string, DtLinkStrategy*> StrategyPair;
197 
198  typedef std::map<std::string, StrategyCreator> StrategyCreatorMap;
200 
203 
205  std::set<std::string> myFilesLoaded;
206  std::set<std::string> myPluginsLoaded;
207 
209 
210  static std::string restorePathStr;
211 };
Defines a single parameter delegate to make binding member function pointers easier.
static std::string restorePathStr
Definition: managedInterface.h:210
static std::string theDataPath
Definition: managedInterface.h:144
virtual double maxDrainInputTime()
get the maximum time to spend in drain input
Definition: managedInterface.h:132
Contains the DtString class declaration.
StrategyCreatorMap myStrategyCreatorMap
Definition: managedInterface.h:199
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:175
std::set< std::string > myPluginsLoaded
Definition: managedInterface.h:206
std::map< std::string, StrategyCreator > StrategyCreatorMap
Definition: managedInterface.h:198
Definition: managedInterface.h:41
This is the DtMessage class.
Definition: message.h:20
unsigned char * myReusableSendBuffer
Definition: managedInterface.h:179
std::map< std::string, void * > ResourceMap
Definition: managedInterface.h:186
The DtManagedInterface Class is a singleton that is used to manage the message flow between C# and th...
Definition: managedInterface.h:50
Definition: managedInterface.h:45
std::set< DtProtocolType > myInitializedProtocols
Definition: managedInterface.h:182
JavaManagedMessageDelegate myJavaMessageDelegate
Definition: managedInterface.h:177
Definition: managedInterface.h:46
DtMessageFactory * myMessageFactory
Definition: managedInterface.h:184
DtProtocolType myActiveProtocol
Definition: managedInterface.h:174
void(* PluginNameFunction)(DtString &name)
Definition: managedInterface.h:32
the DtMessageFactory class
Definition: messageFactory.h:25
Definition: managedInterface.h:44
StrategyMap myLinkStrategies
Definition: managedInterface.h:196
DtLinkStrategy *(* StrategyCreator)(DtManagedInterface *gl)
Definition: managedInterface.h:33
void * myData
Definition: managedInterface.h:178
Definition: managedInterface.h:43
DtMessageDelegate * myNotifyLevelHandler
Definition: managedInterface.h:202
std::multimap< std::string, DtMessageDelegate * > HandlerMap
Definition: managedInterface.h:190
std::pair< std::string, DtLinkStrategy * > StrategyPair
Definition: managedInterface.h:195
static DtManagedInterface * theInstance
Definition: managedInterface.h:172
ResourceMap myResources
Definition: managedInterface.h:188
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:201
DtFilePrinter * myFilePrinter
Definition: managedInterface.h:204
MANAGEDINTERFACE_DLL void tick(double maxTime)
Tick ManagedInterface.
bool myIsInitalized
Definition: managedInterface.h:181
Instances of DtString are used to represent strings.
Definition: vlString.h:36
std::map< std::string, DtLinkStrategy * > StrategyMap
Definition: managedInterface.h:194
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:192
std::set< std::string > myFilesLoaded
Definition: managedInterface.h:205
ResourceMap::iterator ResourceIter
Definition: managedInterface.h:187
double myMaxDrainInputTime
Definition: managedInterface.h:208
void(* PluginVerisionFunction)(DtString &version)
Definition: managedInterface.h:31
MANAGEDINTERFACE_DLL bool checkVrlLicense()
Check VR-Link License Availability.
Definition: managedInterface.h:42
std::pair< std::string, DtMessageDelegate * > HandlerPair
Definition: managedInterface.h:191

Document ID: Generated on Thu Oct 16 00:12:25 EDT 2025 from SVN revision 280738
Copyright © 1992-2025 MAK Technologies. All Rights Reserved (www.mak.com)