OSVR-Core
VRPNConnectionCollection.h
Go to the documentation of this file.
1 
11 // Copyright 2015 Sensics, Inc.
12 //
13 // Licensed under the Apache License, Version 2.0 (the "License");
14 // you may not use this file except in compliance with the License.
15 // You may obtain a copy of the License at
16 //
17 // http://www.apache.org/licenses/LICENSE-2.0
18 //
19 // Unless required by applicable law or agreed to in writing, software
20 // distributed under the License is distributed on an "AS IS" BASIS,
21 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 // See the License for the specific language governing permissions and
23 // limitations under the License.
24 
25 #ifndef INCLUDED_VRPNConnectionCollection_h_GUID_AB4B5310_43DF_4E9A_2EAF_CF512F979288
26 #define INCLUDED_VRPNConnectionCollection_h_GUID_AB4B5310_43DF_4E9A_2EAF_CF512F979288
27 
28 // Internal Includes
29 #include <osvr/Util/SharedPtr.h>
31 #include <osvr/Client/Export.h>
32 
33 // Library/third-party includes
34 #include <vrpn_ConnectionPtr.h>
35 
36 // Standard includes
37 #include <string>
38 #include <unordered_map>
39 
40 namespace osvr {
41 namespace client {
43  public:
44  OSVR_CLIENT_EXPORT VRPNConnectionCollection();
45 
46  OSVR_CLIENT_EXPORT vrpn_ConnectionPtr
47  addConnection(vrpn_ConnectionPtr conn, std::string const &host);
48 
49  vrpn_ConnectionPtr getConnection(std::string const &device,
50  std::string const &host);
51  vrpn_ConnectionPtr
52  getConnection(common::elements::DeviceElement const &elt);
53  OSVR_CLIENT_EXPORT void updateAll();
54  bool empty() const {
55  return m_connMap->empty();
56  }
57 
58  private:
59  typedef std::unordered_map<std::string, vrpn_ConnectionPtr>
60  ConnectionMap;
61  shared_ptr<ConnectionMap> m_connMap;
62  };
63 
64 } // namespace client
65 } // namespace osvr
66 
67 #endif // INCLUDED_VRPNConnectionCollection_h_GUID_AB4B5310_43DF_4E9A_2EAF_CF512F979288
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.
The element type corresponding to a device, which implements 0 or more interfaces.
Definition: PathElementTypes.h:113
Definition: VRPNConnectionCollection.h:42