VR-Link API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions
DtManagedInterface Class Reference

The DtManagedInterface Class is a singleton that is used to manage the message flow between C# and the rest of the system. More...

+ Collaboration diagram for DtManagedInterface:

Public Member Functions

void initializeManagedInterface (ManagedMessageDelegate del)
 initializes the DtManagedInterface class with a delegate from the C# application
void initializeManagedInterface (JavaManagedMessageDelegate del, void *data, unsigned char *reusableSendMsgBuffer)
 initializes the DtManagedInterface class with a delegate from the Java application
void tick (double maxTime)
 ticks the DtManagedInterface class, and all child strategies as well as any of their resources
void shutdown ()
 Shutdown any simulation connections.
void receiveMessage (unsigned char *msg, int length)
 called when C# sends a message to ManagedInterface for processing
void sendMessage (DtMessage *msg)
 called to send C# a message generated from DtManagedInterface
bool handleMessage (DtMessage *msg)
 Message dispatch function.
virtual DtMessageFactorymessageFactory () const
 returns the message factory
virtual bool hasResource (const std::string &name) const
 Resource handling functions.
virtual void * findResource (const std::string &name) const
 This will return a handle to a named resource or the Null handle if it does not exist.
virtual void setResource (const std::string &name, void *asset)
 This will set given object as a resource with the given name. If the resource already exists, this will replace it.
virtual bool removeResource (const std::string &name)
 This will remove a resource with the given name.
virtual void addHandler (const std::string &messageType, DtMessageDelegate *handler)
 Functions for adding or removing message handlers.
virtual void removeHandler (const std::string &messageType, DtMessageDelegate *handler)
virtual void addStrategy (DtLinkStrategy *strategy)
 Functions for adding, removing, and finding strategies.
virtual void removeStrategy (const std::string &name)
virtual DtLinkStrategyfindStrategy (const std::string &name)
virtual void addStrategyCreator (const std::string &name, StrategyCreator creator)
 add a strategy creator to the strategy factory.
virtual DtLinkStrategycreateStrategy (const std::string &name)
 this will create a strategy with the given name or NULL if the strategy does not exist
virtual double maxDrainInputTime ()
 get the maximum time to spend in drain input
virtual std::set< DtProtocolTypeavailableProtocols ()
 get available protocols

Static Public Member Functions

static DtManagedInterfaceinstance ()
 static access class that will lazily create the one DtManagedInterface instance
static bool exists ()
 to check if the DtManagedInterface class is created
static void destroy ()
 destroys the DtManagedInterface class
static bool checkVrlLicense ()
 Checks the VR-Link License Availability.

Static Public Attributes

static std::string theDataPath

Protected Types

typedef std::map< std::string,
void * > 
ResourceMap
typedef ResourceMap::iterator ResourceIter
typedef std::multimap
< std::string,
DtMessageDelegate * > 
HandlerMap
typedef std::pair< std::string,
DtMessageDelegate * > 
HandlerPair
typedef std::map< std::string,
DtLinkStrategy * > 
StrategyMap
typedef std::pair< std::string,
DtLinkStrategy * > 
StrategyPair
typedef std::map< std::string,
StrategyCreator
StrategyCreatorMap

Protected Member Functions

virtual void handlePrintMessage (DtMessage *msg)
 Handle print messages at arrive from C#.
virtual void handleNotifyLevelMessage (DtMessage *msg)
 Handle notify level changes.
virtual void prefixPath (const std::string &prefixDir) const
 modify system environment PATH variable before loading libraries
virtual void restorePath () const
 return system environment PATH variable to original state
virtual std::set< std::string > getPathDirs () const
 return all directories in the PATH environment variable
virtual void loadLibsFromDir (const std::string &dirname, const std::set< std::string > &files, std::list< std::string > &filesLoaded)
 load library plugins by names from directory dirname
virtual std::set< std::string > findLibNames (const std::string &dirname, const std::string &filePrefix) const
 get library names in directory dirname
virtual bool loadLibrary (const std::string &filename, const DtString &acceptableVersionStr)
 load one DLL by name
virtual bool loadCoreLibraries (const std::string &dirname, std::list< std::string > &filesLoaded)
 load any DLLs with names beginning with managedInterface* from directory dirname.
virtual void findAndLoadCoreLibraries (std::list< std::string > &filesLoaded)
 Search algorithm to find core libraries, then load them.
virtual void loadLibraries ()
 load any DLLs that are in the plugins directory
virtual bool checkLibrariesLoaded (const std::list< std::string > &filesLoaded, std::set< DtProtocolType > &availableProtocol, bool shouldThrow=false)
 check that the minimum strategy libraries were loaded

Protected Attributes

ManagedMessageDelegate myCSharpMessageDelegate
JavaManagedMessageDelegate myJavaMessageDelegate
void * myData
unsigned char * myReusableSendBuffer
bool myIsInitalized
std::set< DtProtocolTypemyInitializedProtocols
DtMessageFactorymyMessageFactory
ResourceMap myResources
HandlerMap myMessageHandlers
StrategyMap myLinkStrategies
StrategyCreatorMap myStrategyCreatorMap
DtMessageDelegatemyPrintHandler
DtMessageDelegatemyNotifyLevelHandler
DtFilePrintermyFilePrinter
std::set< std::string > myFilesLoaded
std::set< std::string > myPluginsLoaded
double myMaxDrainInputTime

Static Protected Attributes

static DtManagedInterfacetheInstance
static std::string restorePathStr

Private Member Functions

 DtManagedInterface ()
 private constructor since this is a singleton
virtual ~DtManagedInterface ()
 private destructor since this is a singleton

Detailed Description

The DtManagedInterface Class is a singleton that is used to manage the message flow between C# and the rest of the system.

Member Typedef Documentation

typedef std::multimap<std::string, DtMessageDelegate*> DtManagedInterface::HandlerMap
protected
typedef std::pair<std::string, DtMessageDelegate*> DtManagedInterface::HandlerPair
protected
typedef ResourceMap::iterator DtManagedInterface::ResourceIter
protected
typedef std::map<std::string, void*> DtManagedInterface::ResourceMap
protected
typedef std::map<std::string, StrategyCreator> DtManagedInterface::StrategyCreatorMap
protected
typedef std::map<std::string, DtLinkStrategy*> DtManagedInterface::StrategyMap
protected
typedef std::pair<std::string, DtLinkStrategy*> DtManagedInterface::StrategyPair
protected

Constructor & Destructor Documentation

DtManagedInterface::DtManagedInterface ( )
private

private constructor since this is a singleton

virtual DtManagedInterface::~DtManagedInterface ( )
privatevirtual

private destructor since this is a singleton

Member Function Documentation

virtual void DtManagedInterface::addHandler ( const std::string &  messageType,
DtMessageDelegate handler 
)
virtual

Functions for adding or removing message handlers.

virtual void DtManagedInterface::addStrategy ( DtLinkStrategy strategy)
virtual

Functions for adding, removing, and finding strategies.

virtual void DtManagedInterface::addStrategyCreator ( const std::string &  name,
StrategyCreator  creator 
)
virtual

add a strategy creator to the strategy factory.

This will replace an existing creator with the given one if used with the name of an existing strategy

virtual std::set<DtProtocolType> DtManagedInterface::availableProtocols ( )
virtual

get available protocols

virtual bool DtManagedInterface::checkLibrariesLoaded ( const std::list< std::string > &  filesLoaded,
std::set< DtProtocolType > &  availableProtocol,
bool  shouldThrow = false 
)
protectedvirtual

check that the minimum strategy libraries were loaded

static bool DtManagedInterface::checkVrlLicense ( )
static

Checks the VR-Link License Availability.

virtual DtLinkStrategy* DtManagedInterface::createStrategy ( const std::string &  name)
virtual

this will create a strategy with the given name or NULL if the strategy does not exist

static void DtManagedInterface::destroy ( )
static

destroys the DtManagedInterface class

static bool DtManagedInterface::exists ( )
static

to check if the DtManagedInterface class is created

virtual void DtManagedInterface::findAndLoadCoreLibraries ( std::list< std::string > &  filesLoaded)
protectedvirtual

Search algorithm to find core libraries, then load them.

virtual std::set<std::string> DtManagedInterface::findLibNames ( const std::string &  dirname,
const std::string &  filePrefix 
) const
protectedvirtual

get library names in directory dirname

virtual void* DtManagedInterface::findResource ( const std::string &  name) const
virtual

This will return a handle to a named resource or the Null handle if it does not exist.

virtual DtLinkStrategy* DtManagedInterface::findStrategy ( const std::string &  name)
virtual
virtual std::set<std::string> DtManagedInterface::getPathDirs ( ) const
protectedvirtual

return all directories in the PATH environment variable

bool DtManagedInterface::handleMessage ( DtMessage msg)

Message dispatch function.

virtual void DtManagedInterface::handleNotifyLevelMessage ( DtMessage msg)
protectedvirtual

Handle notify level changes.

virtual void DtManagedInterface::handlePrintMessage ( DtMessage msg)
protectedvirtual

Handle print messages at arrive from C#.

virtual bool DtManagedInterface::hasResource ( const std::string &  name) const
virtual

Resource handling functions.

Resources are anything that can be saved and shared between different strategies this is used for managing VR-Link objects in an abstract way This will look up a resource by name and return if it exists or not

void DtManagedInterface::initializeManagedInterface ( ManagedMessageDelegate  del)

initializes the DtManagedInterface class with a delegate from the C# application

void DtManagedInterface::initializeManagedInterface ( JavaManagedMessageDelegate  del,
void *  data,
unsigned char *  reusableSendMsgBuffer 
)

initializes the DtManagedInterface class with a delegate from the Java application

static DtManagedInterface& DtManagedInterface::instance ( )
static

static access class that will lazily create the one DtManagedInterface instance

virtual bool DtManagedInterface::loadCoreLibraries ( const std::string &  dirname,
std::list< std::string > &  filesLoaded 
)
protectedvirtual

load any DLLs with names beginning with managedInterface* from directory dirname.

virtual void DtManagedInterface::loadLibraries ( )
protectedvirtual

load any DLLs that are in the plugins directory

virtual bool DtManagedInterface::loadLibrary ( const std::string &  filename,
const DtString acceptableVersionStr 
)
protectedvirtual

load one DLL by name

virtual void DtManagedInterface::loadLibsFromDir ( const std::string &  dirname,
const std::set< std::string > &  files,
std::list< std::string > &  filesLoaded 
)
protectedvirtual

load library plugins by names from directory dirname

virtual double DtManagedInterface::maxDrainInputTime ( )
inlinevirtual

get the maximum time to spend in drain input

virtual DtMessageFactory& DtManagedInterface::messageFactory ( ) const
virtual

returns the message factory

virtual void DtManagedInterface::prefixPath ( const std::string &  prefixDir) const
protectedvirtual

modify system environment PATH variable before loading libraries

void DtManagedInterface::receiveMessage ( unsigned char *  msg,
int  length 
)

called when C# sends a message to ManagedInterface for processing

virtual void DtManagedInterface::removeHandler ( const std::string &  messageType,
DtMessageDelegate handler 
)
virtual
virtual bool DtManagedInterface::removeResource ( const std::string &  name)
virtual

This will remove a resource with the given name.

virtual void DtManagedInterface::removeStrategy ( const std::string &  name)
virtual
virtual void DtManagedInterface::restorePath ( ) const
protectedvirtual

return system environment PATH variable to original state

void DtManagedInterface::sendMessage ( DtMessage msg)

called to send C# a message generated from DtManagedInterface

virtual void DtManagedInterface::setResource ( const std::string &  name,
void *  asset 
)
virtual

This will set given object as a resource with the given name. If the resource already exists, this will replace it.

void DtManagedInterface::shutdown ( )

Shutdown any simulation connections.

void DtManagedInterface::tick ( double  maxTime)

ticks the DtManagedInterface class, and all child strategies as well as any of their resources

Member Data Documentation

ManagedMessageDelegate DtManagedInterface::myCSharpMessageDelegate
protected
void* DtManagedInterface::myData
protected
DtFilePrinter* DtManagedInterface::myFilePrinter
protected
std::set<std::string> DtManagedInterface::myFilesLoaded
protected
std::set<DtProtocolType> DtManagedInterface::myInitializedProtocols
protected
bool DtManagedInterface::myIsInitalized
protected
JavaManagedMessageDelegate DtManagedInterface::myJavaMessageDelegate
protected
StrategyMap DtManagedInterface::myLinkStrategies
protected
double DtManagedInterface::myMaxDrainInputTime
protected
DtMessageFactory* DtManagedInterface::myMessageFactory
protected
HandlerMap DtManagedInterface::myMessageHandlers
protected
DtMessageDelegate* DtManagedInterface::myNotifyLevelHandler
protected
std::set<std::string> DtManagedInterface::myPluginsLoaded
protected
DtMessageDelegate* DtManagedInterface::myPrintHandler
protected
ResourceMap DtManagedInterface::myResources
protected
unsigned char* DtManagedInterface::myReusableSendBuffer
protected
StrategyCreatorMap DtManagedInterface::myStrategyCreatorMap
protected
std::string DtManagedInterface::restorePathStr
staticprotected
std::string DtManagedInterface::theDataPath
static
DtManagedInterface* DtManagedInterface::theInstance
staticprotected

The documentation for this class was generated from the following file:

Document ID: Generated on Thu Feb 22 04:26:36 EST 2018 from SVN revision 186468
Copyright © 2005-2016 VT MÄK. All Rights Reserved (www.mak.com)