RTC Toolkit  2.0.0
Classes | Public Member Functions | Static Public Member Functions | Friends | List of all members
rtctk::componentFramework::DataPointPath Class Reference

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

#include <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
 
virtual ~DataPointPath ()=default
 
 DataPointPath (const std::string &new_path)
 Create DataPointPath from a string. More...
 
 DataPointPath (std::string &&new_path)
 Create DataPointPath from a string. More...
 
 DataPointPath (const char *const new_path)
 Create DataPointPath from a null terminated character string. More...
 
const std::string & ToString () const noexcept
 Get string representing the DataPointPath. More...
 
DataPointPathoperator= (const std::string &new_path)
 Assignment operator from string. More...
 
DataPointPathoperator= (std::string &&new_path)
 Assignment operator from string (move). More...
 
 operator std::string () const noexcept
 Cast operator to string (implicit). More...
 
DataPointPathoperator+= (const DataPointPath &rhs)
 Append another DataPointPath to this DataPointPath without adding a path seperator, and check if appended path is still valid. More...
 
DataPointPathoperator/= (const DataPointPath &rhs)
 Append another DataPointPath to this DataPointPath with a path seperator (/) in between if needed. More...
 
elt::mal::Uri ToRepositoryURI (const elt::mal::Uri &base_uri) const
 Creates and returns a complete URI. More...
 

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. More...
 

Friends

DataPointPath operator+ (DataPointPath lhs, const DataPointPath &rhs)
 Concatenate two DataPointPaths without adding a path seperator, and checked if path is still valid. More...
 
DataPointPath operator/ (DataPointPath lhs, const DataPointPath &rhs)
 Concatenate two DataPointPaths with a path seperator in between. More...
 
std::ostream & operator<< (std::ostream &out, const DataPointPath &rhs)
 Output to ostream. More...
 
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 istream. More...
 

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
/abc/xyz
abc/xyz
/abc/xyz/
/abc/xyz123
/abc/_x
/abc/_123
/abc/_1xyz

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

/A
/abc/X
/abc//xyz
/ab___c/xyz
/abc_/xyz
/ab/12/cd
/ab/12x/cd
/abc/_
/abc_/xyz

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()

virtual rtctk::componentFramework::DataPointPath::~DataPointPath ( )
virtualdefault

◆ 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.

◆ 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)
inline

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)
inline

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.

◆ 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.

◆ ToString()

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

Get string representing the DataPointPath.

Friends And Related Function 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 seperator 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 ostream.

◆ 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 istream.


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