ChimeraTK-ApplicationCore 04.06.00
Loading...
Searching...
No Matches
ChimeraTK::Utilities Namespace Reference

Functions

std::string getUnqualifiedName (const std::string &qualifiedName)
 Return the last component of the given qualified path name.
 
std::string getPathName (const std::string &qualifiedName)
 Return all but the last components of the given qualified name.
 
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.
 
std::string unescapeName (const std::string &name_stripped)
 Undo the escaping done by escapeName().
 
bool checkName (const std::string &name, bool allowDotsAndSlashes)
 Check given name for characters which are not allowed in variable or module names.
 
void setThreadName (const std::string &name)
 Set name of the current thread.
 
std::string raiseIftrailingSlash (const std::string &name, bool isModule)
 Raises logic error if name ends in a slash, or if it contains consecutive slashes.
 
bool isBeingDebugged ()
 Checks whether the current process is being debugged.
 

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 88 of file Utilities.cc.

◆ 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 45 of file Utilities.cc.

◆ 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 29 of file Utilities.cc.

◆ 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 19 of file Utilities.cc.

◆ isBeingDebugged()

bool ChimeraTK::Utilities::isBeingDebugged ( )

Checks whether the current process is being debugged.

Works only on Unix-like systems with a /proc file system.

Definition at line 132 of file Utilities.cc.

◆ 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 117 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 105 of file Utilities.cc.

◆ unescapeName()

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

Undo the escaping done by escapeName().

Definition at line 71 of file Utilities.cc.