OSVR Framework (Internal Development Docs)  0.6-1962-g59773924
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Viewer.cpp
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 // Internal Includes
26 #include <osvr/Client/Viewer.h>
29 
30 // Library/third-party includes
31 // - none
32 
33 // Standard includes
34 // - none
35 
36 namespace osvr {
37 namespace client {
38  Viewer::Viewer(OSVR_ClientContext ctx, const char path[])
39  : m_head(ctx, path) {}
40 
41  OSVR_Pose3 Viewer::getPose() const {
42  OSVR_TimeValue timestamp;
43  OSVR_Pose3 pose;
44  bool hasState = m_head->getState<OSVR_PoseReport>(timestamp, pose);
45  if (!hasState) {
46  throw NoPoseYet();
47  }
48  return pose;
49  }
50 
51  bool Viewer::hasPose() const {
52  return m_head->hasStateForReportType<OSVR_PoseReport>();
53  }
54 
55 } // namespace client
56 } // namespace osvr
Header.
Header containing a typelist of all special report types.
A structure defining a 3D (6DOF) rigid body pose: translation and rotation.
Definition: Pose3C.h:54
Standardized, portable parallel to struct timeval for representing both absolute times and time inter...
Definition: TimeValueC.h:81
Report type for a pose (position and orientation) callback on a tracker interface.