OSVR-Core
Namespaces | Macros | Functions
JSONEigen.h File Reference

Header. More...

#include <osvr/Util/EigenCoreGeometry.h>
#include <json/value.h>
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/range/algorithm/count_if.hpp>
#include <boost/assert.hpp>
#include <stdexcept>
#include <cstring>
#include <string>

Go to the source code of this file.

Namespaces

 osvr
 The main namespace for all C++ elements of the framework, internal and external.
 
 osvr::common
 Handles spatial transformations.
 

Macros

#define OSVR_EXTRACT_JSON_MEMBER(_DATATYPENAME, _LOWER, _UPPER)
 
#define OSVR_PARSE_NAME   "Vector3d"
 

Functions

template<typename Derived >
Json::Value osvr::common::toJson (Eigen::QuaternionBase< Derived > const &quat)
 Converts quaternions to JSON objects.
 
template<typename Derived >
Json::Value osvr::common::toJson (Eigen::MatrixBase< Derived > const &vec)
 Converts vectors to JSON arrays.
 
template<typename VecType >
VecType osvr::common::detail::stringToVector (std::string const &s)
 
Eigen::Quaterniond osvr::common::quatFromJson (Json::Value const &json)
 
Eigen::Vector3d osvr::common::vec3FromJson (Json::Value const &json)
 

Detailed Description

Header.

Date
2015
Author
Sensics, Inc. http://sensics.com/osvr

Macro Definition Documentation

§ OSVR_EXTRACT_JSON_MEMBER

#define OSVR_EXTRACT_JSON_MEMBER (   _DATATYPENAME,
  _LOWER,
  _UPPER 
)
Value:
if (json.isMember(#_LOWER)) { \
ret._LOWER() = json[#_LOWER].asDouble(); \
} else if (json.isMember(#_UPPER)) { \
ret._LOWER() = json[#_UPPER].asDouble(); \
} else { \
throw std::runtime_error("In parsing " _DATATYPENAME \
" from JSON, no " #_LOWER " element found!"); \
}