iMSTK
Interactive Medical Simulation Toolkit
Static Public Member Functions | List of all members
imstk::DeviceManagerFactory Class Reference

Manages and generates the DeviceManager's. More...

#include <imstkDeviceManagerFactory.h>

Inheritance diagram for imstk::DeviceManagerFactory:
Inheritance graph
[legend]
Collaboration diagram for imstk::DeviceManagerFactory:
Collaboration graph
[legend]

Static Public Member Functions

static std::shared_ptr< DeviceManagermakeDeviceManager (const std::string typeName)
 Attempts to create a new DeviceManager by type name. More...
 
static std::shared_ptr< DeviceManagermakeDeviceManager ()
 Attempts to create a new DeviceManager by whichever is default If multiple haptic managers are built with, the preference is: Haply > OpenHaptics > VRPN. More...
 
- Static Public Member Functions inherited from imstk::ObjectFactory< std::shared_ptr< DeviceManager > >
static std::shared_ptr< DeviceManagercreate (const std::string &name, Args &&... args)
 tries to construct the object give name, it will forward the given paramters More...
 
static void add (const std::string &name, Creator c)
 adds a new creation function to the factory More...
 
static bool contains (const std::string &name)
 
static const std::vector< std::string > getNames ()
 

Additional Inherited Members

- Public Types inherited from imstk::ObjectFactory< std::shared_ptr< DeviceManager > >
using BaseType = std::shared_ptr< DeviceManager >
 
using Creator = std::function< std::shared_ptr< DeviceManager >(Args...)>
 Type of the function to generate a new object.
 

Detailed Description

Manages and generates the DeviceManager's.

The factory is a singleton and can be accessed anywhere. Given a name of a DeviceManager this will generate the appropriate object that should be executed. By default the class name is the name that is used to look up the DeviceManager. ie: "HapticDeviceManager" -> HapticDeviceManager The generation Will fail if the name is not known to the factory.

There are multiple ways to register a DeviceManager, preferred should be ...

IMSTK_REGISTER_DEVICE_MANAGER(typeName)

will register the delegate for the class-name of the algorithm, this will satisfy the default mechanism If want to register a custom delegate with more customization you can use

DeviceManagerRegistrar<delegateType> registrar("LookupTypeName");

Definition at line 37 of file imstkDeviceManagerFactory.h.

Member Function Documentation

◆ makeDeviceManager() [1/2]

std::shared_ptr< DeviceManager > imstk::DeviceManagerFactory::makeDeviceManager ( const std::string  typeName)
static

Attempts to create a new DeviceManager by type name.

Parameters
typeNamename of the class to look up

Definition at line 37 of file imstkDeviceManagerFactory.cpp.

Here is the call graph for this function:

◆ makeDeviceManager() [2/2]

std::shared_ptr< DeviceManager > imstk::DeviceManagerFactory::makeDeviceManager ( )
static

Attempts to create a new DeviceManager by whichever is default If multiple haptic managers are built with, the preference is: Haply > OpenHaptics > VRPN.

Todo:
: Extend based on device availability, multi device support

Definition at line 51 of file imstkDeviceManagerFactory.cpp.


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