OSVR-Core
OriginalSource.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_OriginalSource_h_GUID_B7D02DC3_ACFA_4BAF_85C5_8B70854700A7
26 #define INCLUDED_OriginalSource_h_GUID_B7D02DC3_ACFA_4BAF_85C5_8B70854700A7
27 
28 // Internal Includes
29 #include <osvr/Common/Export.h>
34 
35 // Library/third-party includes
36 #include <boost/optional.hpp>
37 
38 // Standard includes
39 #include <string>
40 
41 namespace osvr {
42 namespace common {
43 
48  public:
49  OSVR_COMMON_EXPORT OriginalSource();
50 
53  OSVR_COMMON_EXPORT void decompose(PathNode &node);
54 
55  OSVR_COMMON_EXPORT bool isResolved() const;
56 
57  void setDevice(PathNode &device);
58 
59  void setInterface(PathNode &iface);
60 
61  void setSensor(PathNode &sensor);
62 
63  void nestTransform(Json::Value const &transform);
64 
65  PathNode *getDevice() const;
66 
68  OSVR_COMMON_EXPORT std::string getDevicePath() const;
69 
70  OSVR_COMMON_EXPORT elements::DeviceElement const &
71  getDeviceElement() const;
72 
73  PathNode *getInterface() const;
74  OSVR_COMMON_EXPORT std::string getInterfaceName() const;
75 
76  PathNode *getSensor() const;
77 
78  OSVR_COMMON_EXPORT boost::optional<int> getSensorNumber() const;
79  OSVR_COMMON_EXPORT boost::optional<OSVR_ChannelCount>
80  getSensorNumberAsChannelCount() const;
81 
82  OSVR_COMMON_EXPORT Json::Value getTransformJson() const;
83  OSVR_COMMON_EXPORT bool hasTransform() const;
84 
85  private:
86  std::string m_getPath() const;
87  PathNode *m_device;
88  PathNode *m_interface;
89  PathNode *m_sensor;
90  GeneralizedTransform m_transform;
91  };
92 } // namespace common
93 } // namespace osvr
94 
95 #endif // INCLUDED_OriginalSource_h_GUID_B7D02DC3_ACFA_4BAF_85C5_8B70854700A7
The result of resolving a tree node to a device: either an original source to connect to...
Definition: OriginalSource.h:47
Handles spatial transformations.
Definition: SerializationTraitExample_Complicated.h:40
A node in a generic tree, which can contain an object by value.
Definition: TreeNode.h:72
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
OSVR_COMMON_EXPORT std::string getDevicePath() const
Gets the full path of the device node.
Definition: OriginalSource.cpp:73
Container for easy manipulation of nested transforms.
Definition: GeneralizedTransform.h:45
The element type corresponding to a device, which implements 0 or more interfaces.
Definition: PathElementTypes.h:113
t_< detail::transform_< List, Fun >> transform
Given a list and an alias class, apply the alias class to each element in the list and return the res...
Definition: Transform.h:54
OSVR_COMMON_EXPORT void decompose(PathNode &node)
Decompose a path node representing an original source into its device, interface, and sensor...
Definition: OriginalSource.cpp:210
Header forward-declaring the types in PathElementTypes.h and including the PathElement typedef...