25 #ifndef INCLUDED_RemoteHandlerFactory_h_GUID_3B3394C0_DADA_4BAA_3EDD_6CDA96760D91 26 #define INCLUDED_RemoteHandlerFactory_h_GUID_3B3394C0_DADA_4BAA_3EDD_6CDA96760D91 29 #include <osvr/Client/Export.h> 42 #include <unordered_map> 46 class VRPNConnectionCollection;
49 typedef shared_ptr<RemoteHandler> FactoryProduct;
50 typedef std::function<FactoryProduct(
54 void addFactory(std::string
const &name, SpecificFactory factory) {
55 m_factoriesByInterface[name] = factory;
58 bool isKnownInterfaceType(std::string
const &name)
const {
59 return m_factoriesByInterface.find(name) !=
60 end(m_factoriesByInterface);
64 common::InterfaceList &ifaces,
67 m_factoriesByInterface.find(source.getInterfaceName());
69 if (factory == end(m_factoriesByInterface)) {
71 return FactoryProduct();
74 return (factory->second)(source, ifaces, ctx);
78 std::unordered_map<std::string, SpecificFactory> m_factoriesByInterface;
83 OSVR_CLIENT_EXPORT
void 89 #endif // INCLUDED_RemoteHandlerFactory_h_GUID_3B3394C0_DADA_4BAA_3EDD_6CDA96760D91 Definition: RemoteHandlerFactory.h:47
The result of resolving a tree node to a device: either an original source to connect to...
Definition: OriginalSource.h:47
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
Header to bring shared_ptr into the osvr namespace.
Definition: ClientContext.h:50
FactoryProduct invokeFactory(common::OriginalSource const &source, common::InterfaceList &ifaces, common::ClientContext &ctx) const
Definition: RemoteHandlerFactory.h:63
Definition: VRPNConnectionCollection.h:42
OSVR_CLIENT_EXPORT void populateRemoteHandlerFactory(RemoteHandlerFactory &factory, VRPNConnectionCollection const &conns)
Populates a RemoteHandlerFactory with each of the specific factories included with OSVR...
Definition: RemoteHandlerFactory.cpp:45