ChimeraTK-ApplicationCore  04.01.00
ChimeraTK::Utilities Namespace Reference

Functions

std::string getUnqualifiedName (const std::string &qualifiedName)
 Return the last component of the given qualified path name. More...
 
std::string getPathName (const std::string &qualifiedName)
 Return all but the last components of the given qualified name. More...
 
std::string escapeName (const std::string &name, bool allowDotsAndSlashes)
 Convert all characters which are not allowed in variable or module names into underscores followed by their 3-digit ascii code. More...
 
std::string unescapeName (const std::string &name_stripped)
 Undo the escaping done by escapeName(). More...
 
bool checkName (const std::string &name, bool allowDotsAndSlashes)
 Check given name for characters which are not allowed in variable or module names. More...
 
void setThreadName (const std::string &name)
 Set name of the current thread. More...
 
std::string raiseIftrailingSlash (const std::string &name, bool isModule)
 Raises logic error if name ends in a slash, or if it contains consecutive slashes. More...
 

Function Documentation

◆ checkName()

bool ChimeraTK::Utilities::checkName ( const std::string &  name,
bool  allowDotsAndSlashes 
)

Check given name for characters which are not allowed in variable or module names.

If allowDotsAndSlashes is true, dots and slashes are allowed, so the resulting name can be a qualified name.

Definition at line 87 of file Utilities.cc.

+ Here is the caller graph for this function:

◆ escapeName()

std::string ChimeraTK::Utilities::escapeName ( const std::string &  name,
bool  allowDotsAndSlashes 
)

Convert all characters which are not allowed in variable or module names into underscores followed by their 3-digit ascii code.

An underscore will be escaped that way as well. If allowDotsAndSlashes is true, dots and slashes will not be converted, so the resulting name can be a qualified name.

Definition at line 44 of file Utilities.cc.

+ Here is the caller graph for this function:

◆ getPathName()

std::string ChimeraTK::Utilities::getPathName ( const std::string &  qualifiedName)

Return all but the last components of the given qualified name.

Example: "/some/deep/hierarchy/levels" would return "/some/deep/hierarchy"

This function is useful together with getUnqualifiedName(), when a qualified variable name is given, and a HierarchyModifyingGroup with the variable inside needs to be created.

Definition at line 28 of file Utilities.cc.

+ Here is the caller graph for this function:

◆ getUnqualifiedName()

std::string ChimeraTK::Utilities::getUnqualifiedName ( const std::string &  qualifiedName)

Return the last component of the given qualified path name.

Example: "/some/deep/hierarchy/levels" would return "levels"

This function is useful together with getPathName(), when a qualified variable name is given, and a HierarchyModifyingGroup with the variable inside needs to be created.

Definition at line 18 of file Utilities.cc.

+ Here is the caller graph for this function:

◆ raiseIftrailingSlash()

std::string ChimeraTK::Utilities::raiseIftrailingSlash ( const std::string &  name,
bool  isModule 
)

Raises logic error if name ends in a slash, or if it contains consecutive slashes.

Modules are allowed to be named "/", if the bool isModule is true.

Definition at line 116 of file Utilities.cc.

◆ setThreadName()

void ChimeraTK::Utilities::setThreadName ( const std::string &  name)

Set name of the current thread.

Note
: This function contains platform-dependent code and may need adjustment for new platforms. On unsupported platforms, this function does nothing.

Definition at line 104 of file Utilities.cc.

◆ unescapeName()

std::string ChimeraTK::Utilities::unescapeName ( const std::string &  name_stripped)

Undo the escaping done by escapeName().

Definition at line 70 of file Utilities.cc.