34 #ifndef INCLUDED_PathElementTypes_h_GUID_5CC817E5_C7CB_45AE_399D_0B0D39579374
35 #define INCLUDED_PathElementTypes_h_GUID_5CC817E5_C7CB_45AE_399D_0B0D39579374
43 #include <boost/variant/variant.hpp>
44 #include <boost/mpl/contains.hpp>
45 #include <boost/operators.hpp>
46 #include <json/value.h>
50 #include <type_traits>
56 #ifndef OSVR_DOXYGEN_EXTERNAL
70 const char *getTypeName()
const;
83 template <
typename Type>
85 boost::operators<Type> {
114 boost::operators<DeviceElement> {
118 std::string
const &server)
119 : m_devName(deviceName), m_server(server) {}
122 createVRPNDeviceElement(std::string
const &deviceName,
123 std::string
const &server);
129 std::string
const &server,
130 int port = util::UseDefaultPort);
132 OSVR_COMMON_EXPORT std::string &getDeviceName();
133 OSVR_COMMON_EXPORT std::string
const &getDeviceName()
const;
134 OSVR_COMMON_EXPORT std::string &getServer();
135 OSVR_COMMON_EXPORT std::string
const &getServer()
const;
136 OSVR_COMMON_EXPORT std::string getFullDeviceName()
const;
138 OSVR_COMMON_EXPORT Json::Value &getDescriptor();
139 OSVR_COMMON_EXPORT Json::Value
const &getDescriptor()
const;
143 return m_devName == other.m_devName &&
144 m_server == other.m_server &&
145 m_descriptor == other.m_descriptor;
149 std::string m_devName;
150 std::string m_server;
151 Json::Value m_descriptor;
174 boost::operators<DeviceElement> {
192 OSVR_COMMON_EXPORT
void setSource(std::string
const &source);
195 OSVR_COMMON_EXPORT std::string &
getSource();
197 OSVR_COMMON_EXPORT std::string
const &
getSource()
const;
201 OSVR_COMMON_EXPORT AliasPriority &
priority();
203 OSVR_COMMON_EXPORT AliasPriority
priority()
const;
207 return m_priority == rhs.m_priority && m_source == rhs.m_source;
211 std::string m_source;
212 AliasPriority m_priority;
228 OSVR_COMMON_EXPORT std::string &
getString();
231 OSVR_COMMON_EXPORT std::string
const &
getString()
const;
235 return m_val == other.m_val;
254 static_assert(std::is_base_of<base_type, type>::value,
255 "ElementBase<T> must be the base of an element "
256 "type T (the CRTP)!");
261 boost::mpl::contains<PathElement::types, type>::type::value,
262 "Every element type must be a part of the PathElement variant "
263 "type's bounded type list!");
271 #endif // INCLUDED_PathElementTypes_h_GUID_5CC817E5_C7CB_45AE_399D_0B0D39579374
EmptyElementBase()
Protected constructor to force subclassing.
The element type corresponding to a path alias, with a priority level for sorting out whether automat...
Header defining some special values that may be passed to some functions that request a port number t...
AliasPriority & priority()
Get/set whether this alias was automatically set (and thus subject to being override by explicit rout...
std::string & getSource()
Get the source of data for this alias.
The element type corresponding to a particular sensor of an interface.
The element type corresponding to a plugin.
static DeviceElement createDeviceElement(std::string const &deviceName, std::string const &server, int port=util::UseDefaultPort)
The element type corresponding to a device, which implements 0 or more interfaces.
bool operator==(DeviceElement const &other) const
Equality comparison operator.
bool operator==(AliasElement const &rhs) const
Equality comparison operator.
Namespace for the various element types that may constitute a node in the path tree.
Base, using the CRTP, of "empty" path elements (those that don't store additional data but derive the...
The element type corresponding to a string value such as a JSON string.
AliasElement()
default constructor
The element type corresponding to an interface, which often may have one or more sensors.
ElementBase()
Protected constructor to force subclassing.
std::string & getString()
Get/set (if non const) the stored string.
void setSource(std::string const &source)
Sets the source of this alias.
Automatically-generated export header - do not edit!
Header forward-declaring the types in PathElementTypes.h and including the PathElement typedef...
Base, using the CRTP, providing some basic functionality for path elements.
StringElement()
Default constructor.
The element type created when requesting a path that isn't yet in the tree.
bool operator==(EmptyElementBase< Type > const &) const
Trivial equality comparison operator.
bool operator==(StringElement const &other) const
Equality comparison operator.