vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DeviceManager.h
Go to the documentation of this file.
1 /***************************************************************************
2  devicemanager.h - description
3  -------------------
4  begin : March 2003
5  copyright : (C) 2003 by Jan Flasar
6  email : flasar@fi.muni.cz
7  ***************************************************************************/
8 
9 
10 #ifndef DEVICEMANAGER_H
11 #define DEVICEMANAGER_H
12 
13 #include <vrecko/BaseClass.h>
14 #include <vrecko/Device.h>
15 #include <vrecko/vThread.h>
16 
17 #include <map>
18 #include <vector>
19 
20 #include <osgDB/DynamicLibrary>
21 
22 
23 namespace vrecko {
24 
26 class VRECKO_EXPORT DeviceManager : public BaseClass {
27  public:
28  DeviceManager();
29  ~DeviceManager();
30 
33  int requestForDevice(const std::string &plugin_name, const std::string &device_type, const char *port, float frequency);
34 
37  bool requestForDevice(const std::string &plugin_name, const std::string &device_type, const char *port, int id, float frequency);
38 
40  Device* getDevicePtr(int device_id);
41 
43  Device* getDevicePtrByType(const std::string &device_type);
44 
46  struct DT {
49  };
50 
52  std::map<int, DT> &getDeviceMap(void) {return device_map;}
53 
54  static vrecko::Device *getDeviceInstance(const std::string &plugin_name, const std::string &device_type);
55 
56  protected:
58  std::map<int, DT> device_map;
59 
61  bool connectDevice(const std::string &plugin_name, const std::string &device_type, const char *port, Device **device_ptr);
62 
63  static std::map<std::string, osgDB::DynamicLibrary *> _dl_map;
64 
65 };
66 
67 }
68 
69 #endif
70