VR-Link API Documentation for DIS
 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 };

Document ID: Generated on Mon Apr 8 04:49:21 EDT 2019 from SVN revision 197403
Copyright © 2005-2016 VT MÄK. All Rights Reserved (www.mak.com)