DetectorGraph  2.0
Functions
DetectorGraph::NodeNameUtils Namespace Reference

Functions

std::string GetDemangledName (const std::string &aMangledString)
 Provides utilities for manipulating DetectorGraph node names. More...
 
std::string GetMinimalName (const std::string &aMangledString)
 Returns a readable name with redundant prefixes/suffixes removed. More...
 
std::string WrapOnCommonEndings (const std::string &aNodeName)
 Adds a \n to the input name before common suffixes. More...
 
std::string RemoveSubstrings (const std::string &aInStr, const char *elimStrings[])
 Removes all elimStrings from aInStr and returns new string. More...
 
std::string WrapOnSubStrings (const std::string &aInStr, const char *wrapStrings[])
 Adds a \n to aInStr before each sub-string in wrapStrings. More...
 

Function Documentation

◆ GetDemangledName()

std::string DetectorGraph::NodeNameUtils::GetDemangledName ( const std::string &  aMangledString)

Provides utilities for manipulating DetectorGraph node names.

DetectorGraph Vertices (Detectors & Topics) and TopicStates have a GetName() API call that returns a compiler-specific string identifying that type.

The utilities in this file were created to decode those names for either visualization or code-generation purposes.

"You will never find a more wretched hive of scum and villainy. We must be cautious." - this code should not be used for anything serious. Returns the Demangled name as a single-line string.

This method uses cxxabi.h's __cxa_demangle to return the original names for objects. This works in the same way as c++filt.

Definition at line 22 of file nodenameutils.cpp.

◆ GetMinimalName()

std::string DetectorGraph::NodeNameUtils::GetMinimalName ( const std::string &  aMangledString)

Returns a readable name with redundant prefixes/suffixes removed.

For visualization purposes it may be useful to strip out common prefixes/ suffixes on types (e.g. Detectors::Topics<>, TopicState).

Definition at line 32 of file nodenameutils.cpp.

◆ RemoveSubstrings()

std::string DetectorGraph::NodeNameUtils::RemoveSubstrings ( const std::string &  aInStr,
const char *  elimStrings[] 
)

Removes all elimStrings from aInStr and returns new string.

Definition at line 67 of file nodenameutils.cpp.

◆ WrapOnCommonEndings()

std::string DetectorGraph::NodeNameUtils::WrapOnCommonEndings ( const std::string &  aNodeName)

Adds a \n to the input name before common suffixes.

Definition at line 48 of file nodenameutils.cpp.

◆ WrapOnSubStrings()

std::string DetectorGraph::NodeNameUtils::WrapOnSubStrings ( const std::string &  aInStr,
const char *  wrapStrings[] 
)

Adds a \n to aInStr before each sub-string in wrapStrings.

Note that this will not add leading \n even if the name starts with a string in wrapStrings.

Definition at line 90 of file nodenameutils.cpp.