The Util library: Functionality not necessarily coupled to any particular core library, serving more as a common base layer behind all systems. More...
Namespaces | |
| container_policies | |
| Flags or arguments to specify what features you want ContainerWrapper to provide publicly. Pass as template args to ContainerWrapper to request a feature. | |
| eigen_interop | |
| filters | |
| Filters for use with Eigen datatypes. | |
| time | |
| Functionality related to time and the OSVR_TimeValue abstraction.Note that this is for C API-bordering areas. For purely C++ code, please use std::chrono for your time needs. | |
| tree | |
| Contains a generic tree. This namespace exists to assist in argument-dependent lookup with tree-related nonmembers, the class template TreeNode is imported into the parent namespace. | |
| typesafeid_traits | |
| Namespace for traits templates associated with osvr::util::TypeSafeId. | |
| unique_container_policies | |
| Policies controlling behavior of UniqueContainer. | |
Classes | |
| class | AlignedAllocDeleter |
| Deleter class matching alignedAlloc. More... | |
| class | AnyMap |
| A data structure storing "any" by name, to reduce coupling. More... | |
| class | BasicKeyedOwnershipContainer |
| Holds on to smart pointers by value, and lets you free them by providing the corresponding void *. More... | |
| class | CallbackWrapper |
| A class template turning a callback with some number of arguments, with a userdata pointer last, into a function object. More... | |
| class | CellGroupProxy |
| struct | Conditional |
| Quick C++11-aligned conditional (if/then/elese) implementation. More... | |
| struct | Conditional< false, Then, Else > |
| class | CSV |
| class | CSVBase |
| class | DefaultBool |
| A class template primarily useful for flags, that has a defined value at default initialization. More... | |
| class | Deletable |
| Base class for objects that just need to be generically deletable. More... | |
| class | DummyGuard |
| struct | EnableIf |
| Quick C++11-aligned enable_if implementation. More... | |
| struct | EnableIf< true, T > |
| class | FinalTask |
| class | Flag |
| A class that lightly wraps a bool, in order to provide easier maintenance of a "dirty" flag, for example, with sensible default initialization and no short-circuiting. More... | |
| class | GuardInterface |
| An interface to a (deferred) guard class: after instantiation and lock returning true, some resource is locked and available until destruction. More... | |
| struct | HashIdAggregate |
| struct | HashIdAggregate< std::pair< TypeSafeId< FirstTag >, TypeSafeId< SecondTag > > > |
| class | IndentingStream |
| A boost::iostreams::filtering_ostream with a constructor that automatically sets it up to indent the first character after a newline the given number of spaces and forward the output to a std::ostream. More... | |
| class | MultipleReferenceOwnershipPolicy |
| class | NumberTypeData |
| Runtime data on numeric types. More... | |
| class | PointerWrapper |
| A wrapper to easily define structures that exist just to hold a pointer. More... | |
| class | Rect |
| class | ResourcePath |
| Class representing a host and resource path in the OSVR logical system. More... | |
| class | SingleOwnershipPolicy |
| class | StreamCSV |
| class | StringBufferBuilder |
| A utility class to adapt APIs that first provide a length, then place a string in a user-allocated buffer, to nearly transparently handle the buffer and convert into a std::string. More... | |
| class | TypeSafeId |
| class | TypeSafeIdBase |
| A generic typesafe (as long as you use differing tag types) wrapper for identifiers (typically integers). More... | |
| class | TypeSafeIdRefAccessorBase |
| class | UniqueContainer |
| A "Unique Container" designed for composition, not inheritance. More... | |
| class | UniqueContainerBase |
| A policy-based generic "Unique Container", that wraps ContainerWrapper (and thus an underlying container) with set-like semantics/invariant: at most one instance of a value is in the container at a time. More... | |
| class | ValueOrRange |
| Class providing a unified container-like interface to either a single value or a range of integers. More... | |
Typedefs | |
| using | AlignedPtr = unique_ptr< void, AlignedAllocDeleter > |
| using | AlignedImageBufferPtr = unique_ptr< OSVR_ImageBufferElement, AlignedAllocDeleter > |
| template<typename System , typename Y = double> | |
| using | AngleGeneric = boost::units::quantity< boost::units::unit< boost::units::plane_angle_dimension, System >, Y > |
| Convenience template alias for a plane_angle quantity in an arbitrary system with arbitrary scalar. | |
| template<typename Y > | |
| using | AngleRadians = boost::units::quantity< boost::units::si::plane_angle, Y > |
| Alias for an angle in radians with arbitrary scalar type. | |
| template<typename Y > | |
| using | AngleDegrees = boost::units::quantity< boost::units::degree::plane_angle, Y > |
| Alias for an angle in degrees with arbitrary scalar type. | |
| typedef AngleRadians< double > | AngleRadiansd |
| typedef AngleDegrees< double > | AngleDegreesd |
| typedef AngleRadiansd | Angle |
| Default angle type. | |
| template<typename Container , typename... Args> | |
| using | ContainerWrapper = detail::ContainerWrapper_t< Container, Args...> |
| Parent class to inherit from to get a container with some functionality exposed. More... | |
| using | ColMatrix44d = Eigen::Matrix4d |
| using | ColVector3d = Eigen::Vector3d |
| using | ColVector4d = Eigen::Vector4d |
| using | RowMatrix44d = Eigen::Matrix< double, 4, 4, Eigen::RowMajor > |
| template<typename Scalar > | |
| using | Isometry3 = Eigen::Transform< Scalar, 3, Eigen::Isometry > |
| template<typename Scalar > | |
| using | Translation3 = Eigen::Translation< Scalar, 3 > |
|
typedef unique_ptr < util::GuardInterface > | GuardPtr |
|
typedef BasicKeyedOwnershipContainer < SingleOwnershipPolicy > | KeyedOwnershipContainer |
|
typedef BasicKeyedOwnershipContainer < MultipleReferenceOwnershipPolicy > | MultipleKeyedOwnershipContainer |
| typedef Rect | Rectd |
| template<std::size_t minBytes, bool isSigned = false> | |
| using | sized_int_t = typename detail::sized_int< minBytes, isSigned >::type |
| typedef shared_ptr< Deletable > | DeletablePtr |
| Shared-ownership smart pointer to a Deletable. | |
|
typedef ::std::vector < DeletablePtr > | DeletableList |
| Vector of shared-ownership smart pointers. | |
|
typedef TypeSafeId < LocalStringIdTag > | StringID |
|
typedef TypeSafeId < PeerStringIdTag > | PeerStringID |
Enumerations | |
| enum | { DefaultOSVRPort = 3883, DefaultVRPNPort = 3883 } |
| enum | { UseDefaultPort = -1, OmitAppendingPort = -2 } |
Functions | |
| void * | alignedAlloc (size_t bytes, size_t alignment=OSVR_DEFAULT_ALIGN_SIZE) |
| Aligned allocation function, gives a pointer to a block of memory aligned to a memory boundary. | |
| void | alignedFree (void *p) |
| Aligned deallocation function, uses the pointer to the original memory block to deallocate it. | |
| AlignedPtr | makeAlignedBuffer (size_t bytes, size_t alignment=OSVR_DEFAULT_ALIGN_SIZE) |
| AlignedImageBufferPtr | makeAlignedImageBuffer (size_t bytes, size_t alignment=OSVR_DEFAULT_ALIGN_SIZE) |
| template<typename System , typename Y > | |
| Y | getRadians (AngleGeneric< System, Y > const angle) |
| Get the raw scalar value of your angle in radians. | |
| template<typename System , typename Y > | |
| Y | getDegrees (AngleGeneric< System, Y > const angle) |
| Get the raw scalar value of your angle in degrees. | |
| std::string | getBinaryLocation () |
| template<typename T > | |
| detail::Cell< T > | cell (const char *header, T const &data) |
| Helper free function to make a CSV cell. | |
| template<typename T > | |
| detail::Cell< T > | cell (std::string const &header, T const &data) |
| Helper free function to make a CSV cell. | |
| template<typename RowProxyType , typename GroupTag , typename... CellArgs> | |
| CellGroupProxy< RowProxyType, GroupTag > & | operator<< (CellGroupProxy< RowProxyType, GroupTag > &group, detail::Cell< CellArgs...> &¤tCell) |
| template<typename T > | |
| detail::CellGroup< T > | cellGroup (const char *groupHeader, T const &data) |
| Helper function to create a cell group with a group header prefix. | |
| template<typename T > | |
| detail::CellGroup< T, std::string > | cellGroup (std::string const &groupHeader, T const &data) |
| Helper function to create a cell group with a group header prefix. | |
| template<typename Tag , typename T > | |
| detail::CellGroup< T, const char *, Tag > | cellGroup (const char *groupHeader, T const &data, Tag *=static_cast< Tag * >(nullptr)) |
| template<typename Tag , typename T > | |
| detail::CellGroup< T, std::string, Tag > | cellGroup (std::string const &groupHeader, T const &data, Tag *=static_cast< Tag * >(nullptr)) |
| template<typename T > | |
| detail::CellGroup< T > | cellGroup (T const &data) |
| template<typename Tag , typename T > | |
| detail::CellGroup< T, const char *, Tag > | cellGroup (T const &data, Tag *=static_cast< Tag * >(nullptr)) |
| template<typename T > | |
| void | operator<< (CellGroupProxy< T, DefaultGroupTag > &group, time::TimeValue const &tv) |
| template<typename T > | |
| void | operator<< (CellGroupProxy< T, AbbreviatedTimeMemberFieldsTag > &group, time::TimeValue const &tv) |
| template<typename T > | |
| void | operator<< (CellGroupProxy< T, DecimalTimeFieldTag > &group, time::TimeValue const &tv) |
| template<typename T > | |
| void | operator<< (CellGroupProxy< T, DefaultGroupTag > &group, OSVR_Vec3 const &v) |
| template<typename T > | |
| void | operator<< (CellGroupProxy< T, DefaultGroupTag > &group, OSVR_Quaternion const &q) |
| template<typename Derived > | |
| detail::SameLayoutVector < 4, Derived > | makeHomogeneousPoint (Eigen::MatrixBase< Derived > const &vec) |
| Makes a 3D vector into a 4D homogeneous point, with the same options (scalar, row vs col vector) as the input. | |
| template<typename Derived > | |
| detail::SameLayoutVector < 4, Derived > | makeHomogeneousVector (Eigen::MatrixBase< Derived > const &vec) |
| Makes a 3D vector into a 4D homogeneous vector, with the same options (scalar, row vs col vector) as the input. | |
| template<typename Derived > | |
| detail::SameLayoutVector < 3, Derived > | extractPoint (Eigen::MatrixBase< Derived > const &homogenous) |
Pulls the 3D point or vector from a 4D vec, performing division by w if it is nonzero. | |
| template<typename Derived1 , typename Derived2 > | |
| Isometry3< typename Derived1::Scalar > | makeIsometry (Eigen::MatrixBase< Derived1 > const &translation, Eigen::RotationBase< Derived2, 3 > const &rotation) |
A simpler, functional-style alternative to .fromPositionOrientationScale when no scaling is performed. | |
| Eigen::Quaterniond | flipQuatSignToMatch (Eigen::Quaterniond const &refQ, Eigen::Quaterniond const &q) |
| Eigen::Map< Eigen::Vector3d > | vecMap (OSVR_Vec3 &vec) |
| Wrap an OSVR_Vec3 in an Eigen object that allows it to interoperate with Eigen as though it were an Eigen::Vector3d. More... | |
| Eigen::Map< const Eigen::Vector3d > | vecMap (OSVR_Vec3 const &vec) |
| Eigen::Quaterniond | fromQuat (OSVR_Quaternion const &q) |
| Convert an OSVR_Quaternion to an Eigen::Quaterniond. | |
| void | toQuat (Eigen::Quaterniond const &src, OSVR_Quaternion &q) |
| Convert an Eigen::Quaterniond to a OSVR_Quaternion. | |
| Eigen::Isometry3d | fromPose (OSVR_Pose3 const &pose) |
| Turn an OSVR_Pose3 into an Eigen::Transform. More... | |
| void | toPose (Eigen::Isometry3d const &xform, OSVR_Pose3 &pose) |
| Turn an Eigen::Isometry3d (transform) into an OSVR_Pose3. More... | |
| void | toPose (Eigen::Matrix4d const &mat, OSVR_Pose3 &pose) |
| Turn an Eigen::Matrix4d (transform) into an OSVR_Pose3. More... | |
| template<typename T > | |
| auto | extractYaw (T const &quat) -> decltype(std::atan(quat.w())) |
| template<typename F > | |
| FinalTask< F > | finally (F &&f) |
| template<typename F > | |
| FinalTask< F > | finally (F const &f) |
| template<typename T > | |
| void | generic_deleter (void *obj) |
| Generic deleter function, wrapping the stock delete call. More... | |
| boost::optional< std::string > | getEnvironmentVariable (std::string const &var) |
| Gets an environment variable's value. On systems that don't distinguish between having a variable defined and having it non-empty (like Windows), empty will imply not defined and thus an empty boost::optional return value. More... | |
| template<typename Scalar , typename T > | |
| void | matrixEigenAssign (T const &src, OSVR_MatrixConventions flags, Scalar *dest) |
| Helper function template to assign/convert matrices as required. More... | |
| template<typename Functor > | |
| bool | opencvTypeDispatch (int openCVType, Functor &f) |
| Given an OpenCV type depth and a reference to a functor, calls that functor with a single parameter: the corresponding type wrapped in boost::mpl::identity. More... | |
| NumberTypeData | opencvNumberTypeData (int openCVType) |
| int | cvTypeFromData (bool isSigned, bool isFloat, size_t depth) |
| Computes the OpenCV "type" (also known as depth - as in CV_8U) for a given combination of signed, float, and byte depth. | |
| int | computeOpenCVMatType (OSVR_ImagingMetadata const &metadata) |
| Computes the OpenCV matrix type (as in CV_8UC3) from a metadata struct. | |
|
std::pair< std::string, std::string > | convertProgramOptionShowHideIntoTrueFalse (std::string s) |
| An "additional parser" for Boost.Program_options that will turn any –hide-xyz into –xyz false and –show-xyz into –xyz true. | |
| Eigen::Matrix4d | createProjectionMatrix (Rectd const &bounds, double near, double far) |
| Takes in points at the near clipping plane, as well as the near and far clipping planes. Result matrix maps [l, r] and [b, t] to [-1, 1], and [n, f] to [-1, 1] (should be configurable) More... | |
| template<projection_options::OptionType options = projection_options::ZOutputSigned | projection_options::RightHandedInput> | |
| Eigen::Matrix4d | parameterizedCreateProjectionMatrix (Rectd const &bounds, double near, double far) |
| Takes in points at the near clipping plane, as well as the near and far clipping planes. Result matrix maps [l, r] and [b, t] to [-1, 1], and [n, f] to [-1, 1] or [0, 1] depending on presence/absence of ZOutputUnsigned flag bit, taking in right- or left-handed input also as configured. | |
| template<typename System > | |
| Rectd | computeSymmetricFOVRect (AngleGeneric< System > hFov, AngleGeneric< System > vFov) |
| Compute a rectangle at unit distance for the given fov values. | |
| template<typename System > | |
| Rectd | computeSymmetricFOVRect (AngleGeneric< System > hFov, AngleGeneric< System > vFov, double near) |
| Compute a rectangle at the near clipping plane for the given fov values. | |
| template<typename System > | |
| Eigen::Matrix4d | createSymmetricProjectionMatrix (AngleGeneric< System > hFov, AngleGeneric< System > vFov, double near, double far) |
| template<typename StreamType , typename Scalar > | |
| StreamType & | operator<< (StreamType &os, Rect< Scalar > const &rect) |
| template<typename RangeType > | |
| void | resetPointerRange (RangeType range) |
| Reset every smart pointer in a container one by one. | |
| template<size_t N> | |
| std::string | makeString (const char(&arrayLiteral)[N]) |
| Safely and easily convert a literal array of characters (like from osvr_json_to_c) into a std::string. | |
| template<typename Tag , typename T > | |
| detail::CellGroup< T, Tag > | cellGroup (const char *groupHeader, T const &data, Tag *=static_cast< Tag * >(nullptr)) |
| template<typename Tag , typename T > | |
| detail::CellGroup< T, Tag > | cellGroup (T const &data, Tag *=static_cast< Tag * >(nullptr)) |
| template<typename T > | |
| void | operator<< (CellGroupProxy< T, DefaultGroupTag > &group, Eigen::Vector3d const &v) |
| template<typename T > | |
| void | operator<< (CellGroupProxy< T, DefaultGroupTag > &group, Eigen::Quaterniond const &q) |
| Eigen::Vector3d | getEuler (Eigen::Quaterniond const &q) |
| template<typename T > | |
| void | operator<< (CellGroupProxy< T, QuatAsEulerTag > &group, Eigen::Vector3d const &euler) |
| template<typename T > | |
| void | operator<< (CellGroupProxy< T, QuatAsEulerTag > &group, Eigen::Quaterniond const &q) |
The Util library: Functionality not necessarily coupled to any particular core library, serving more as a common base layer behind all systems.
| using osvr::util::ContainerWrapper = typedef detail::ContainerWrapper_t<Container, Args...> |
Parent class to inherit from to get a container with some functionality exposed.
| Container | the underlying container you want, reference accessible via Base::container() |
| Args | 0 or more tag types from osvr::util::container_policies indicating the features you want publicly exposed |
Definition at line 232 of file ContainerWrapper.h.
| using osvr::util::sized_int_t = typedef typename detail::sized_int<minBytes, isSigned>::type |
Alias providing an integer type (signed or unsigned, your choice) containing at least as many bytes as you requested.
Definition at line 80 of file SizedInt.h.
| anonymous enum |
| Enumerator | |
|---|---|
| DefaultOSVRPort |
|
Definition at line 42 of file DefaultPort.h.
| anonymous enum |
| Enumerator | |
|---|---|
| OmitAppendingPort |
For use when there may not actually be a port in use: some single process situations, etc. |
Definition at line 43 of file PortFlags.h.
| std::string osvr::util::getBinaryLocation | ( | ) |
Get this binary's location, often as a step in finding the "root" and search paths.
Definition at line 91 of file BinaryLocation.cpp.
|
inline |
Handles user results from overloading operator<<(CellGroupProxy<RowProxyType, GroupTag> &group, TheirThing) and sending in cell calls within it.
Definition at line 73 of file CSVCellGroup.h.
|
inline |
Helper function to create a cell group with a group header prefix and explicit (non-default) tag.
Definition at line 175 of file CSVCellGroup.h.
|
inline |
Helper function to create a cell group with a group header prefix and explicit (non-default) tag.
Definition at line 184 of file CSVCellGroup.h.
|
inline |
Helper function to create a cell group with no group header prefix - warning: column headers must be unique!
Definition at line 190 of file CSVCellGroup.h.
|
inline |
Helper function to create a cell group with no group header prefix and explicit (non-default) tag - warning: column headers must be unique!
Definition at line 198 of file CSVCellGroup.h.
|
inline |
A utility function to extract "yaw" out of a quaternion, of any representation as long as it responds to .w(), .x(), .y(), and .z(). Uses atan2() internally, and the return type is automatically deduced based on the scalar type in use in your quaternion class.
Reference: http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/
Definition at line 47 of file ExtractYaw.h.
|
inline |
Creation free function for final tasks to run on scope exit. Works great when paired with lambdas (particularly with [&] reference capture). Use like: auto f = finally([&]{ dothis(); }); to have dothis() called when f goes out of scope, no matter how.
Perfect forwarding version.
|
inline |
|
inline |
Generic deleter function, wrapping the stock delete call.
Used in header-only C++ wrappers over C APIs.
Definition at line 33 of file GenericDeleter.h.
| boost::optional< std::string > osvr::util::getEnvironmentVariable | ( | std::string const & | var | ) |
Gets an environment variable's value. On systems that don't distinguish between having a variable defined and having it non-empty (like Windows), empty will imply not defined and thus an empty boost::optional return value.
A real implementation of the functionality.
Definition at line 52 of file GetEnvironmentVariable.cpp.
|
inline |
Helper function template to assign/convert matrices as required.
Handles memory ordering (transpose) and scalar type conversion automatically/based on the flags passed in.
| src | An Eigen 4x4 fixed-size matrix or matrix expression (source) |
| flags | Some matrix convention flags - only the first two (the ones that affect if a transpose is needed) are observed. |
| dest | A pointer to a contiguous 16-element array (destination for the copy) |
Definition at line 51 of file MatrixEigenAssign.h.
|
inline |
Given an OpenCV type depth and a reference to a functor, calls that functor with a single parameter: the corresponding type wrapped in boost::mpl::identity.
Definition at line 54 of file OpenCVTypeDispatch.h.
|
inline |
Takes in points at the near clipping plane, as well as the near and far clipping planes. Result matrix maps [l, r] and [b, t] to [-1, 1], and [n, f] to [-1, 1] (should be configurable)
Resulting matrix operates on Eigen::Vector4d, which are row-matrices - transpose if you want it to work on column matrices.
Definition at line 48 of file ProjectionMatrix.h.
|
inline |
Note that because we delegate to the fully-generic projection matrix code, we'll end up computing two entries in the third column that will always be zero (and other computations may include an unnecessary addition/subtraction). But, only one place to introduce bugs.
Definition at line 81 of file ProjectionMatrixFromFOV.h.
|
inline |
Helper function to create a cell group with a group header prefix and explicit (non-default) tag.
Definition at line 135 of file CSVCellGroup.h.
|
inline |
Helper function to create a cell group with no group header prefix and explicit (non-default) tag - warning: column headers must be unique!
Definition at line 149 of file CSVCellGroup.h.
|
inline |
Convert an Eigen quat to a Quatlib quat.
Definition at line 43 of file QuatToEuler.h.