μHAL (v2.6.5)
Part of the IPbus software repository
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
GccOutputCleaner Class Reference

Parameterized Functor which parses and formats GCC call stack so that they are human readable. More...

#include <uhal/log/GccOutputCleaner.hpp>

Public Member Functions

 GccOutputCleaner (const uint32_t &aIndent=2, std::string(*aStyling)(const uint32_t &)=&GccOutputCleaner::SquareBracketStyle)
 Constructor. More...
 
virtual ~GccOutputCleaner ()
 Destructor. More...
 
std::string operator() (const std::string &aStr)
 Functor implementation. More...
 

Static Public Member Functions

static std::string SquareBracketStyle (const uint32_t &aIndex)
 Wrap the type-substitution index in square braces. More...
 
static std::string HashStyle (const uint32_t &aIndex)
 Prefix the type-substitution index with a # More...
 
static std::string TStyle (const uint32_t &aIndex)
 Prefix the type-substitution index with a T More...
 

Private Member Functions

uint32_t RecursiveClean (std::string::const_iterator aIt, std::string::const_iterator aEnd)
 Recursively perform sub-term extraction from the string. More...
 

Private Attributes

std::vector< std::string > mTypes
 A vector of known types, the position of which into this list becomes the substitution index. More...
 
std::string mIndent
 The number of spaces by which to indent the lines. More...
 
std::string(* mStyling )(const uint32_t &)
 The functor for styling the type-substitution index. More...
 

Detailed Description

Parameterized Functor which parses and formats GCC call stack so that they are human readable.

It does this by substituting every template parameter and argument with an integer and then printing this across multiple lines

Definition at line 50 of file GccOutputCleaner.hpp.

Constructor & Destructor Documentation

◆ GccOutputCleaner()

GccOutputCleaner::GccOutputCleaner ( const uint32_t &  aIndent = 2,
std::string(*)(const uint32_t &)  aStyling = &GccOutputCleaner::SquareBracketStyle 
)

Constructor.

Parameters
aIndentthe number of spaces ahead of the formatted input
aStylingfunctor which formats numbers to strings and which is used to format type substitutions

Definition at line 61 of file GccOutputCleaner.cpp.

References mTypes.

◆ ~GccOutputCleaner()

GccOutputCleaner::~GccOutputCleaner ( )
virtual

Destructor.

Definition at line 66 of file GccOutputCleaner.cpp.

Member Function Documentation

◆ HashStyle()

std::string GccOutputCleaner::HashStyle ( const uint32_t &  aIndex)
static

Prefix the type-substitution index with a #

Parameters
aIndexa type-substitution index to prefix
Returns
a formatted string

Definition at line 47 of file GccOutputCleaner.cpp.

◆ operator()()

std::string GccOutputCleaner::operator() ( const std::string &  aStr)

Functor implementation.

Parameters
aStrA string containing a GCC call stack to format
Returns
A nicely formatted string of the GCC call stack

Definition at line 69 of file GccOutputCleaner.cpp.

References mIndent, mTypes, and RecursiveClean().

◆ RecursiveClean()

uint32_t GccOutputCleaner::RecursiveClean ( std::string::const_iterator  aIt,
std::string::const_iterator  aEnd 
)
private

Recursively perform sub-term extraction from the string.

Parameters
aItthe starting point for the current extraction
aEndthe end-point for the current extraction
Returns
the index into the vector which contains the type corresponding to the string between aIt and aEnd (which is added by the function, if it doesn't already exist)

Definition at line 87 of file GccOutputCleaner.cpp.

References mTypes.

Referenced by operator()().

◆ SquareBracketStyle()

std::string GccOutputCleaner::SquareBracketStyle ( const uint32_t &  aIndex)
static

Wrap the type-substitution index in square braces.

Parameters
aIndexa type-substitution index to wrap
Returns
a formatted string

Definition at line 40 of file GccOutputCleaner.cpp.

◆ TStyle()

std::string GccOutputCleaner::TStyle ( const uint32_t &  aIndex)
static

Prefix the type-substitution index with a T

Parameters
aIndexa type-substitution index to prefix
Returns
a formatted string

Definition at line 54 of file GccOutputCleaner.cpp.

Referenced by uhal::exception::exception::what().

Member Data Documentation

◆ mIndent

std::string GccOutputCleaner::mIndent
private

The number of spaces by which to indent the lines.

Definition at line 96 of file GccOutputCleaner.hpp.

Referenced by operator()().

◆ mStyling

std::string( * GccOutputCleaner::mStyling) (const uint32_t &)
private

The functor for styling the type-substitution index.

Definition at line 98 of file GccOutputCleaner.hpp.

◆ mTypes

std::vector< std::string > GccOutputCleaner::mTypes
private

A vector of known types, the position of which into this list becomes the substitution index.

Definition at line 94 of file GccOutputCleaner.hpp.

Referenced by GccOutputCleaner(), operator()(), and RecursiveClean().


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