OSVR-Core
Public Member Functions | Static Public Member Functions | List of all members
osvr::common::RouteContainer Class Reference

Public Member Functions

OSVR_COMMON_EXPORT RouteContainer ()
 Empty constructor.
 
OSVR_COMMON_EXPORT RouteContainer (std::string const &routes)
 Constructor from a JSON array of routes.
 
OSVR_COMMON_EXPORT bool addRoute (std::string const &routingDirective)
 Register a JSON string as a routing directive. More...
 
OSVR_COMMON_EXPORT std::string getRoutes (bool styled=false) const
 Get a JSON array of all routing directives. More...
 
OSVR_COMMON_EXPORT std::string getSource (std::string const &destination) const
 Get the source JSON string for a given destination path. More...
 
OSVR_COMMON_EXPORT std::string getSourceAt (size_t i) const
 
OSVR_COMMON_EXPORT std::string getDestinationAt (size_t i) const
 
OSVR_COMMON_EXPORT std::string getRouteForDestination (std::string const &destination) const
 Get the full routing JSON string for a given destination path. More...
 
std::size_t size () const
 Gets the number of directives.
 
std::vector< std::string > const & getRouteList () const
 

Static Public Member Functions

static OSVR_COMMON_EXPORT std::string getDestinationFromString (std::string const &route)
 Gets the destination of a route, given the route in string format. More...
 
static OSVR_COMMON_EXPORT std::string getSourceFromString (std::string const &route)
 Gets the source of a route, given the route in string format. More...
 

Member Function Documentation

§ addRoute()

bool osvr::common::RouteContainer::addRoute ( std::string const &  routingDirective)

Register a JSON string as a routing directive.

Returns
true if the route was new, false if it replaced a previous route for that destination.

§ getDestinationFromString()

std::string osvr::common::RouteContainer::getDestinationFromString ( std::string const &  route)
static

Gets the destination of a route, given the route in string format.

§ getRouteForDestination()

std::string osvr::common::RouteContainer::getRouteForDestination ( std::string const &  destination) const

Get the full routing JSON string for a given destination path.

Returns
an empty string if the destination was not found.

§ getRoutes()

std::string osvr::common::RouteContainer::getRoutes ( bool  styled = false) const

Get a JSON array of all routing directives.

Parameters
styledPass true if you want the result pretty-printed.

§ getSource()

std::string osvr::common::RouteContainer::getSource ( std::string const &  destination) const

Get the source JSON string for a given destination path.

Returns
an empty string if the destination was not found.

§ getSourceFromString()

std::string osvr::common::RouteContainer::getSourceFromString ( std::string const &  route)
static

Gets the source of a route, given the route in string format.


The documentation for this class was generated from the following files: