RTC Toolkit 5.1.0
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Friends | List of all members
rtctk::componentFramework::DataPointPath Class Referencefinal

This class provides a wrapper for a data point path. More...

#include <rtctk/componentFramework/dataPointPath.hpp>

Classes

class  InvalidPathException
 Exception class used when an invalid character is used in a DataPointPath. More...
 

Public Member Functions

 DataPointPath ()=default
 
 DataPointPath (const DataPointPath &)=default
 
DataPointPathoperator= (const DataPointPath &)=default
 
 DataPointPath (DataPointPath &&)=default
 
DataPointPathoperator= (DataPointPath &&)=default
 
 ~DataPointPath ()=default
 
 DataPointPath (const std::string &new_path)
 Create DataPointPath from a string.
 
 DataPointPath (std::string &&new_path)
 Create DataPointPath from a string.
 
 DataPointPath (const char *const new_path)
 Create DataPointPath from a null terminated character string.
 
const std::string & ToString () const noexcept
 Get string representing the DataPointPath.
 
DataPointPathoperator= (const std::string &new_path)
 Assignment operator from string.
 
DataPointPathoperator= (std::string &&new_path)
 Assignment operator from string (move).
 
 operator std::string () const noexcept
 Cast operator to string (implicit).
 
DataPointPathoperator+= (const DataPointPath &rhs)
 Append another DataPointPath to this DataPointPath without adding a path seperator, and check if appended path is still valid.
 
DataPointPathoperator/= (const DataPointPath &rhs)
 Append another DataPointPath to this DataPointPath with a path seperator (/) in between if needed.
 
elt::mal::Uri ToRepositoryURI (const elt::mal::Uri &base_uri) const
 Creates and returns a complete URI.
 
std::pair< DataPointPath, DataPointPathSplit () const
 Splits the path into a base path and last component pair.
 
DataPointPath BasePath () const
 Returns the base component of the path.
 
DataPointPath LastComponent () const
 Returns the last component of the path.
 
std::vector< DataPointPathSplitAll () const
 Splits the path into a list of individual components.
 

Static Public Member Functions

static elt::mal::Uri AppendSuffixToUriPath (const std::string &suffix, const elt::mal::Uri &uri)
 Appends a suffix string to the path of a URI.
 

Friends

DataPointPath operator+ (DataPointPath lhs, const DataPointPath &rhs)
 Concatenate two DataPointPaths without adding a path seperator, and checked if path is still valid.
 
DataPointPath operator/ (DataPointPath lhs, const DataPointPath &rhs)
 Concatenate two DataPointPaths with a path separator in between.
 
std::ostream & operator<< (std::ostream &out, const DataPointPath &rhs)
 Output to a ostream object.
 
bool operator== (const DataPointPath &lhs, const char *rhs) noexcept
 
bool operator!= (const DataPointPath &lhs, const char *rhs) noexcept
 
bool operator< (const DataPointPath &lhs, const char *rhs) noexcept
 
bool operator<= (const DataPointPath &lhs, const char *rhs) noexcept
 
bool operator> (const DataPointPath &lhs, const char *rhs) noexcept
 
bool operator>= (const DataPointPath &lhs, const char *rhs) noexcept
 
bool operator== (const DataPointPath &lhs, const std::string &rhs) noexcept
 
bool operator!= (const DataPointPath &lhs, const std::string &rhs) noexcept
 
bool operator< (const DataPointPath &lhs, const std::string &rhs) noexcept
 
bool operator<= (const DataPointPath &lhs, const std::string &rhs) noexcept
 
bool operator> (const DataPointPath &lhs, const std::string &rhs) noexcept
 
bool operator>= (const DataPointPath &lhs, const std::string &rhs) noexcept
 
bool operator== (const DataPointPath &lhs, const DataPointPath &rhs) noexcept
 
bool operator!= (const DataPointPath &lhs, const DataPointPath &rhs) noexcept
 
bool operator< (const DataPointPath &lhs, const DataPointPath &rhs) noexcept
 
bool operator<= (const DataPointPath &lhs, const DataPointPath &rhs) noexcept
 
bool operator> (const DataPointPath &lhs, const DataPointPath &rhs) noexcept
 
bool operator>= (const DataPointPath &lhs, const DataPointPath &rhs) noexcept
 
bool operator== (const char *lhs, const DataPointPath &rhs) noexcept
 
bool operator!= (const char *lhs, const DataPointPath &rhs) noexcept
 
bool operator< (const char *lhs, const DataPointPath &rhs) noexcept
 
bool operator<= (const char *lhs, const DataPointPath &rhs) noexcept
 
bool operator> (const char *lhs, const DataPointPath &rhs) noexcept
 
bool operator>= (const char *lhs, const DataPointPath &rhs) noexcept
 
bool operator== (const std::string &lhs, const DataPointPath &rhs) noexcept
 
bool operator!= (const std::string &lhs, const DataPointPath &rhs) noexcept
 
bool operator< (const std::string &lhs, const DataPointPath &rhs) noexcept
 
bool operator<= (const std::string &lhs, const DataPointPath &rhs) noexcept
 
bool operator> (const std::string &lhs, const DataPointPath &rhs) noexcept
 
bool operator>= (const std::string &lhs, const DataPointPath &rhs) noexcept
 
std::istream & operator>> (std::istream &input, DataPointPath &path)
 Read into DataPointPath from an istream object.
 

Detailed Description

This class provides a wrapper for a data point path.

This ensures that the paths used to refer to specific data points only contain valid characters. Trying to use paths with invalid characters with this class will raise an exception.

An acceptable data point path contains path components separated by a single slash. Each path component can only contain lower case alphabetic characters [a-z], numeric characters [0-9] or an underscore [_]. However, a trailing underscore is not allowed and a leading numerical character is also not allowed.

The following are examples of valid data point paths:

/a
elt::mal::future< std::string > InjectReqRepEvent(StateMachineEngine &engine)
Definition malEventInjector.hpp:23

The following are examples of invalid data point paths that will throw and exception:

/A
/abc//xyz
/ab/12/cd
/ab/12x/cd

Constructor & Destructor Documentation

◆ DataPointPath() [1/6]

rtctk::componentFramework::DataPointPath::DataPointPath ( )
default

◆ DataPointPath() [2/6]

rtctk::componentFramework::DataPointPath::DataPointPath ( const DataPointPath & )
default

◆ DataPointPath() [3/6]

rtctk::componentFramework::DataPointPath::DataPointPath ( DataPointPath && )
default

◆ ~DataPointPath()

rtctk::componentFramework::DataPointPath::~DataPointPath ( )
default

◆ DataPointPath() [4/6]

rtctk::componentFramework::DataPointPath::DataPointPath ( const std::string & new_path)
explicit

Create DataPointPath from a string.

Parameters
new_pathThe initial path value.
Exceptions
InvalidPathExceptionWhen invalid characters are found. Only a-z,0-9,_,/ are allowed, no duplicate slashes '/', and no triple underscores '_' or trailing underscores.

◆ DataPointPath() [5/6]

rtctk::componentFramework::DataPointPath::DataPointPath ( std::string && new_path)
explicit

Create DataPointPath from a string.

Parameters
new_pathThe initial path value.
Exceptions
InvalidPathExceptionWhen invalid characters are found. Only a-z,0-9,_,/ are allowed, no duplicate slashes '/', and no triple underscores '_' or trailing underscores.

◆ DataPointPath() [6/6]

rtctk::componentFramework::DataPointPath::DataPointPath ( const char *const new_path)
inlineexplicit

Create DataPointPath from a null terminated character string.

Parameters
new_pathThe initial path value.
Exceptions
InvalidPathExceptionWhen invalid characters are found. Only a-z,0-9,_,/ are allowed, no duplicate slashes '/', and no triple underscores '_' or trailing underscores.

Member Function Documentation

◆ AppendSuffixToUriPath()

elt::mal::Uri rtctk::componentFramework::DataPointPath::AppendSuffixToUriPath ( const std::string & suffix,
const elt::mal::Uri & uri )
static

Appends a suffix string to the path of a URI.

This function concatenates a suffix string, interpreted as a path, to the given URI's path. However, this is done taking the leading and trailing slash characters into account, i.e. it makes sure that the path separator character '/' is only introduced once between the path from the input URI and the suffix string. In addition, if the original URI contains an empty path then the suffix is appended as is, allowing construction of URI's with relative paths.

Parameters
suffixThe suffix string to append to uri.
uriThe URI to which the suffix will be appended.
Returns
A new URI object with the suffix concatenated to the input URI.

◆ BasePath()

DataPointPath rtctk::componentFramework::DataPointPath::BasePath ( ) const

Returns the base component of the path.

Returns
The part of the path from the beginning of the path string up to the last slash ('/') character that is not the root directory.

◆ LastComponent()

DataPointPath rtctk::componentFramework::DataPointPath::LastComponent ( ) const

Returns the last component of the path.

Returns
The part of the path from the last slash ('/') character to the end of the path string.

◆ operator std::string()

rtctk::componentFramework::DataPointPath::operator std::string ( ) const
inlinenoexcept

Cast operator to string (implicit).

This cast operator allows using DataPointPath in places where std::string is needed. It will just return the internal string.

◆ operator+=()

DataPointPath & rtctk::componentFramework::DataPointPath::operator+= ( const DataPointPath & rhs)

Append another DataPointPath to this DataPointPath without adding a path seperator, and check if appended path is still valid.

Exceptions
InvalidPathExceptionWhen invalid characters are found. Only a-z,0-9,_,/ are allowed, no duplicate slashes '/', and no triple underscores '_' or trailing underscores.
Parameters
rhsRight hand side operand.

◆ operator/=()

DataPointPath & rtctk::componentFramework::DataPointPath::operator/= ( const DataPointPath & rhs)

Append another DataPointPath to this DataPointPath with a path seperator (/) in between if needed.

Note
: It is checked if current DataPointPath already ends with a separator (slash), or if one to be added (rhs) begins with a slash. In this cases no separator (/) is added in between. If detected that current DataPointPath ends with slash, and added one begins with a slash, one slash is removed.
Parameters
rhsRight hand side operand.

◆ operator=() [1/4]

DataPointPath & rtctk::componentFramework::DataPointPath::operator= ( const DataPointPath & )
default

◆ operator=() [2/4]

DataPointPath & rtctk::componentFramework::DataPointPath::operator= ( const std::string & new_path)

Assignment operator from string.

Parameters
new_pathThe new path string to use.
Exceptions
InvalidPathExceptionWhen invalid characters are found. Only a-z,0-9,_,/ are allowed, no duplicate slashes '/', and no triple underscores '_' or trailing underscores.

◆ operator=() [3/4]

DataPointPath & rtctk::componentFramework::DataPointPath::operator= ( DataPointPath && )
default

◆ operator=() [4/4]

DataPointPath & rtctk::componentFramework::DataPointPath::operator= ( std::string && new_path)

Assignment operator from string (move).

Parameters
new_pathThe new path string to use.
Exceptions
InvalidPathExceptionWhen invalid characters are found. Only a-z,0-9,_,/ are allowed, no duplicate slashes '/', and no triple underscores '_' or trailing underscores.

◆ Split()

std::pair< DataPointPath, DataPointPath > rtctk::componentFramework::DataPointPath::Split ( ) const

Splits the path into a base path and last component pair.

Returns
A pair of DataPointPath objects, where the first DataPointPath contains the part of the path from the beginning of the path string up to the last slash ('/') character that is not the root directory, i.e. the base path, and the second DataPointPath contains the part of the path after the last slash up to the end of the path string, i.e. the equivalent of a filename in the analogous case of a filesystem path.

◆ SplitAll()

std::vector< DataPointPath > rtctk::componentFramework::DataPointPath::SplitAll ( ) const

Splits the path into a list of individual components.

Returns
A list of path components, split on the slash ('/') character. If the path is an absolute path, i.e. starts with the slash ('/') character, the first component in the returned list is DataPointPath("/").

◆ ToRepositoryURI()

elt::mal::Uri rtctk::componentFramework::DataPointPath::ToRepositoryURI ( const elt::mal::Uri & base_uri) const

Creates and returns a complete URI.

This function generates a Uri object given a base uri. The path is appended to base_uri and the complete URI is returned. It takes care that no double slashes, are3 created in URI. E.g. check for if curent URI ends with a slash, and path starts with a slash.

Parameters
base_uriThe base URI prefix that is to be added as a prefix.
Returns
The concatenated URI.

◆ ToString()

const std::string & rtctk::componentFramework::DataPointPath::ToString ( ) const
inlinenoexcept

Get string representing the DataPointPath.

Friends And Related Symbol Documentation

◆ operator!= [1/5]

bool operator!= ( const char * lhs,
const DataPointPath & rhs )
friend

◆ operator!= [2/5]

bool operator!= ( const DataPointPath & lhs,
const char * rhs )
friend

◆ operator!= [3/5]

bool operator!= ( const DataPointPath & lhs,
const DataPointPath & rhs )
friend

◆ operator!= [4/5]

bool operator!= ( const DataPointPath & lhs,
const std::string & rhs )
friend

◆ operator!= [5/5]

bool operator!= ( const std::string & lhs,
const DataPointPath & rhs )
friend

◆ operator+

DataPointPath operator+ ( DataPointPath lhs,
const DataPointPath & rhs )
friend

Concatenate two DataPointPaths without adding a path seperator, and checked if path is still valid.

Exceptions
InvalidPathExceptionWhen invalid characters are found. Only a-z,0-9,_,/ are allowed, no duplicate slashes '/', and no triple underscores '_' or trailing underscores.
Parameters
lhsLeft hand side operand.
rhsRight hand side operand.

◆ operator/

DataPointPath operator/ ( DataPointPath lhs,
const DataPointPath & rhs )
friend

Concatenate two DataPointPaths with a path separator in between.

Note
: It is checked if current DataPointPath already ends with a separator (slash), or if one to be added (rhs) begins with a slash. In this cases no separator (/) is added in between. If detected that current DataPointPath ends with slash, and added one begins with a slash, one slash is removed.
Parameters
lhsLeft hand side operand.
rhsRight hand side operand.

◆ operator< [1/5]

bool operator< ( const char * lhs,
const DataPointPath & rhs )
friend

◆ operator< [2/5]

bool operator< ( const DataPointPath & lhs,
const char * rhs )
friend

◆ operator< [3/5]

bool operator< ( const DataPointPath & lhs,
const DataPointPath & rhs )
friend

◆ operator< [4/5]

bool operator< ( const DataPointPath & lhs,
const std::string & rhs )
friend

◆ operator< [5/5]

bool operator< ( const std::string & lhs,
const DataPointPath & rhs )
friend

◆ operator<<

std::ostream & operator<< ( std::ostream & out,
const DataPointPath & rhs )
friend

Output to a ostream object.

◆ operator<= [1/5]

bool operator<= ( const char * lhs,
const DataPointPath & rhs )
friend

◆ operator<= [2/5]

bool operator<= ( const DataPointPath & lhs,
const char * rhs )
friend

◆ operator<= [3/5]

bool operator<= ( const DataPointPath & lhs,
const DataPointPath & rhs )
friend

◆ operator<= [4/5]

bool operator<= ( const DataPointPath & lhs,
const std::string & rhs )
friend

◆ operator<= [5/5]

bool operator<= ( const std::string & lhs,
const DataPointPath & rhs )
friend

◆ operator== [1/5]

bool operator== ( const char * lhs,
const DataPointPath & rhs )
friend

◆ operator== [2/5]

bool operator== ( const DataPointPath & lhs,
const char * rhs )
friend

◆ operator== [3/5]

bool operator== ( const DataPointPath & lhs,
const DataPointPath & rhs )
friend

◆ operator== [4/5]

bool operator== ( const DataPointPath & lhs,
const std::string & rhs )
friend

◆ operator== [5/5]

bool operator== ( const std::string & lhs,
const DataPointPath & rhs )
friend

◆ operator> [1/5]

bool operator> ( const char * lhs,
const DataPointPath & rhs )
friend

◆ operator> [2/5]

bool operator> ( const DataPointPath & lhs,
const char * rhs )
friend

◆ operator> [3/5]

bool operator> ( const DataPointPath & lhs,
const DataPointPath & rhs )
friend

◆ operator> [4/5]

bool operator> ( const DataPointPath & lhs,
const std::string & rhs )
friend

◆ operator> [5/5]

bool operator> ( const std::string & lhs,
const DataPointPath & rhs )
friend

◆ operator>= [1/5]

bool operator>= ( const char * lhs,
const DataPointPath & rhs )
friend

◆ operator>= [2/5]

bool operator>= ( const DataPointPath & lhs,
const char * rhs )
friend

◆ operator>= [3/5]

bool operator>= ( const DataPointPath & lhs,
const DataPointPath & rhs )
friend

◆ operator>= [4/5]

bool operator>= ( const DataPointPath & lhs,
const std::string & rhs )
friend

◆ operator>= [5/5]

bool operator>= ( const std::string & lhs,
const DataPointPath & rhs )
friend

◆ operator>>

std::istream & operator>> ( std::istream & input,
DataPointPath & path )
friend

Read into DataPointPath from an istream object.


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