ChimeraTK-DeviceAccess  03.18.00
ChimeraTK::RegisterPath Class Reference

Class to store a register path name. More...

#include <RegisterPath.h>

+ Collaboration diagram for ChimeraTK::RegisterPath:

Public Member Functions

 RegisterPath ()
 
 RegisterPath (const std::string &_path)
 
 RegisterPath (const RegisterPath &_path)
 
RegisterPathoperator= (const RegisterPath &_path)=default
 
 RegisterPath (const char *_path)
 
 operator std::string () const
 type conversion operators into std::string More...
 
void setAltSeparator (const std::string &altSeparator)
 set alternative separator. More...
 
std::string getWithAltSeparator () const
 obtain path with alternative separator character instead of "/". More...
 
RegisterPathoperator/= (const std::string &rightHandSide)
 /= operator: modify this object by adding a new element to this path More...
 
RegisterPathoperator+= (const std::string &rightHandSide)
 += operator: just concatenate-assign like normal strings More...
 
bool operator< (const RegisterPath &rightHandSide) const
 < operator: comparison used for sorting e.g. in std::map More...
 
RegisterPathoperator-- (int)
 Cut-right operator, e.g. registerPath–. More...
 
RegisterPathoperator-- ()
 Cut-left operator, e.g. –registerPath. More...
 
bool operator== (const RegisterPath &rightHandSide) const
 comparison with other RegisterPath More...
 
bool operator== (const std::string &rightHandSide) const
 comparison with std::string More...
 
bool operator== (const char *rightHandSide) const
 comparison with char* More...
 
bool operator!= (const RegisterPath &rightHandSide) const
 comparison with other RegisterPath More...
 
bool operator!= (const std::string &rightHandSide) const
 comparison with std::string More...
 
bool operator!= (const char *rightHandSide) const
 comparison with char* More...
 
size_t length () const
 return the length of the path (including leading slash) More...
 
bool startsWith (const RegisterPath &compare) const
 check if the register path starts with the given path More...
 
bool endsWith (const RegisterPath &compare) const
 check if the register path ends with the given path component(s) More...
 
std::vector< std::string > getComponents () const
 split path into components More...
 

Protected Member Functions

void removeExtraSeparators ()
 Search for duplicate separators (e.g. More...
 
std::string getWithOtherSeparatorReplaced (const std::string &otherSeparator) const
 Return the path after replacing the given otherSeparator with the standard separator "/". More...
 
std::string getCommonAltSeparator (const RegisterPath &otherPath) const
 return common alternative separator for this RegisterPath and the specified other RegisterPath objects. More...
 

Static Protected Member Functions

static std::string removeExtraSeparators (std::string string, const std::string &sep=separator)
 Search for duplicate separators (e.g. More...
 

Protected Attributes

std::string path
 path in standardised notation More...
 
std::string separator_alt
 altenative separator character More...
 

Static Protected Attributes

static const char separator [] = "/"
 separator character to separate the elements in the path More...
 

Friends

RegisterPath operator/ (const RegisterPath &leftHandSide, const RegisterPath &rightHandSide)
 non-member / operator: add a new element to the path. More...
 
RegisterPath operator+ (const RegisterPath &leftHandSide, const std::string &rightHandSide)
 
RegisterPath operator/ (const RegisterPath &leftHandSide, int rightHandSide)
 operators used to build numeric addresses from integers More...
 
RegisterPath operator* (const RegisterPath &leftHandSide, int rightHandSide)
 
std::ostream & operator<< (std::ostream &os, const RegisterPath &me)
 streaming operator More...
 

Detailed Description

Class to store a register path name.

Elements of the path are separated by a "/" character, but an alternative separation character (e.g. ".") can optionally be specified as well. Different equivalent notations will be converted into a standardised notation automatically.

Definition at line 16 of file RegisterPath.h.

Constructor & Destructor Documentation

◆ RegisterPath() [1/4]

ChimeraTK::RegisterPath::RegisterPath ( )
inline

Definition at line 18 of file RegisterPath.h.

+ Here is the caller graph for this function:

◆ RegisterPath() [2/4]

ChimeraTK::RegisterPath::RegisterPath ( const std::string &  _path)
inline

Definition at line 21 of file RegisterPath.h.

+ Here is the call graph for this function:

◆ RegisterPath() [3/4]

ChimeraTK::RegisterPath::RegisterPath ( const RegisterPath _path)
inline

Definition at line 22 of file RegisterPath.h.

+ Here is the call graph for this function:

◆ RegisterPath() [4/4]

ChimeraTK::RegisterPath::RegisterPath ( const char *  _path)
inline

Definition at line 29 of file RegisterPath.h.

+ Here is the call graph for this function:

Member Function Documentation

◆ endsWith()

bool ChimeraTK::RegisterPath::endsWith ( const RegisterPath compare) const
inline

check if the register path ends with the given path component(s)

Definition at line 149 of file RegisterPath.h.

+ Here is the call graph for this function:

◆ getCommonAltSeparator()

std::string ChimeraTK::RegisterPath::getCommonAltSeparator ( const RegisterPath otherPath) const
inlineprotected

return common alternative separator for this RegisterPath and the specified other RegisterPath objects.

Definition at line 224 of file RegisterPath.h.

+ Here is the caller graph for this function:

◆ getComponents()

std::vector<std::string> ChimeraTK::RegisterPath::getComponents ( ) const
inline

split path into components

Definition at line 158 of file RegisterPath.h.

+ Here is the caller graph for this function:

◆ getWithAltSeparator()

std::string ChimeraTK::RegisterPath::getWithAltSeparator ( ) const
inline

obtain path with alternative separator character instead of "/".

The leading separator will be omitted

Definition at line 48 of file RegisterPath.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getWithOtherSeparatorReplaced()

std::string ChimeraTK::RegisterPath::getWithOtherSeparatorReplaced ( const std::string &  otherSeparator) const
inlineprotected

Return the path after replacing the given otherSeparator with the standard separator "/".

Definition at line 208 of file RegisterPath.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ length()

size_t ChimeraTK::RegisterPath::length ( ) const
inline

return the length of the path (including leading slash)

Definition at line 138 of file RegisterPath.h.

+ Here is the caller graph for this function:

◆ operator std::string()

ChimeraTK::RegisterPath::operator std::string ( ) const
inline

type conversion operators into std::string

Definition at line 34 of file RegisterPath.h.

+ Here is the call graph for this function:

◆ operator!=() [1/3]

bool ChimeraTK::RegisterPath::operator!= ( const char *  rightHandSide) const
inline

comparison with char*

Definition at line 135 of file RegisterPath.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator!=() [2/3]

bool ChimeraTK::RegisterPath::operator!= ( const RegisterPath rightHandSide) const
inline

comparison with other RegisterPath

Definition at line 129 of file RegisterPath.h.

+ Here is the call graph for this function:

◆ operator!=() [3/3]

bool ChimeraTK::RegisterPath::operator!= ( const std::string &  rightHandSide) const
inline

comparison with std::string

Definition at line 132 of file RegisterPath.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator+=()

RegisterPath& ChimeraTK::RegisterPath::operator+= ( const std::string &  rightHandSide)
inline

+= operator: just concatenate-assign like normal strings

Definition at line 66 of file RegisterPath.h.

+ Here is the call graph for this function:

◆ operator--() [1/2]

RegisterPath& ChimeraTK::RegisterPath::operator-- ( )
inline

Cut-left operator, e.g. –registerPath.

Remove the first element form the path and return the modified path.

Definition at line 102 of file RegisterPath.h.

◆ operator--() [2/2]

RegisterPath& ChimeraTK::RegisterPath::operator-- ( int  )
inline

Cut-right operator, e.g. registerPath–.

Remove the last element from the path and return the modified path.

Attention
In contrast to the xx– operator on numeric types this is NOT a post operator! It returns the already modified register path.

Definition at line 84 of file RegisterPath.h.

◆ operator/=()

RegisterPath& ChimeraTK::RegisterPath::operator/= ( const std::string &  rightHandSide)
inline

/= operator: modify this object by adding a new element to this path

Definition at line 59 of file RegisterPath.h.

+ Here is the call graph for this function:

◆ operator<()

bool ChimeraTK::RegisterPath::operator< ( const RegisterPath rightHandSide) const
inline

< operator: comparison used for sorting e.g. in std::map

Definition at line 73 of file RegisterPath.h.

+ Here is the call graph for this function:

◆ operator=()

RegisterPath& ChimeraTK::RegisterPath::operator= ( const RegisterPath _path)
default

◆ operator==() [1/3]

bool ChimeraTK::RegisterPath::operator== ( const char *  rightHandSide) const
inline

comparison with char*

Definition at line 126 of file RegisterPath.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator==() [2/3]

bool ChimeraTK::RegisterPath::operator== ( const RegisterPath rightHandSide) const
inline

comparison with other RegisterPath

Definition at line 117 of file RegisterPath.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator==() [3/3]

bool ChimeraTK::RegisterPath::operator== ( const std::string &  rightHandSide) const
inline

comparison with std::string

Definition at line 123 of file RegisterPath.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeExtraSeparators() [1/2]

void ChimeraTK::RegisterPath::removeExtraSeparators ( )
inlineprotected

Search for duplicate separators (e.g.

"//") and remove one of them. Also removes a trailing separator, if present.

Definition at line 192 of file RegisterPath.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeExtraSeparators() [2/2]

static std::string ChimeraTK::RegisterPath::removeExtraSeparators ( std::string  string,
const std::string &  sep = separator 
)
inlinestaticprotected

Search for duplicate separators (e.g.

"//") and remove one of them. Also removes a trailing separator, if present. The second optional argument allows to search for other separators instead of the default.

Definition at line 197 of file RegisterPath.h.

+ Here is the call graph for this function:

◆ setAltSeparator()

void ChimeraTK::RegisterPath::setAltSeparator ( const std::string &  altSeparator)
inline

set alternative separator.

Definition at line 37 of file RegisterPath.h.

+ Here is the caller graph for this function:

◆ startsWith()

bool ChimeraTK::RegisterPath::startsWith ( const RegisterPath compare) const
inline

check if the register path starts with the given path

Definition at line 141 of file RegisterPath.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator*

RegisterPath operator* ( const RegisterPath leftHandSide,
int  rightHandSide 
)
friend

Definition at line 47 of file RegisterPath.cc.

◆ operator+

RegisterPath operator+ ( const RegisterPath leftHandSide,
const std::string &  rightHandSide 
)
friend

Definition at line 32 of file RegisterPath.cc.

◆ operator/ [1/2]

RegisterPath operator/ ( const RegisterPath leftHandSide,
const RegisterPath rightHandSide 
)
friend

non-member / operator: add a new element to the path.

Must be a non-member operator to allow implicit type conversions also on the leftHandSide.

Definition at line 15 of file RegisterPath.cc.

◆ operator/ [2/2]

RegisterPath operator/ ( const RegisterPath leftHandSide,
int  rightHandSide 
)
friend

operators used to build numeric addresses from integers

Definition at line 41 of file RegisterPath.cc.

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const RegisterPath me 
)
friend

streaming operator

Definition at line 56 of file RegisterPath.cc.

Member Data Documentation

◆ path

std::string ChimeraTK::RegisterPath::path
protected

path in standardised notation

Definition at line 182 of file RegisterPath.h.

◆ separator

const char ChimeraTK::RegisterPath::separator = "/"
staticprotected

separator character to separate the elements in the path

Definition at line 185 of file RegisterPath.h.

◆ separator_alt

std::string ChimeraTK::RegisterPath::separator_alt
protected

altenative separator character

Definition at line 188 of file RegisterPath.h.


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