ATLAS Offline Software
Functions
TrkExTools Namespace Reference

Functions

std::string getToolSuffix (const std::string &fullToolName)
 Return the name suffix, e.g. return 'myNiceTool' from 'ToolSvc.myNiceTool'. More...
 
std::vector< std::string > extractToolNames (const std::vector< std::string > &toolNameVector)
 return a vector of extracted names More...
 
bool validToolName (const std::string &toolName)
 indicate whether a string is a valid Tool variable name More...
 
std::string possibleToolNameError (const std::vector< std::string > &toolNameVector)
 Give an error message if tool names are invalid; empty string if good. More...
 
unsigned int numberOfUniqueEntries (const std::vector< std::string > &nameVector)
 Give the number of unique entries in a vector. More...
 

Function Documentation

◆ extractToolNames()

std::vector< std::string > TrkExTools::extractToolNames ( const std::vector< std::string > &  toolNameVector)

return a vector of extracted names

Definition at line 19 of file TrkExToolsStringUtility.cxx.

19  {
20  std::vector<std::string> result(toolNameVector.size());
21  std::transform(toolNameVector.begin(),toolNameVector.end(),result.begin(), getToolSuffix );
22  return result;
23  }

◆ getToolSuffix()

std::string TrkExTools::getToolSuffix ( const std::string &  fullToolName)

Return the name suffix, e.g. return 'myNiceTool' from 'ToolSvc.myNiceTool'.

Definition at line 14 of file TrkExToolsStringUtility.cxx.

14  {
15  return fullToolName.substr(fullToolName.find_last_of('.') + 1);
16  }

◆ numberOfUniqueEntries()

unsigned int TrkExTools::numberOfUniqueEntries ( const std::vector< std::string > &  nameVector)

Give the number of unique entries in a vector.

Definition at line 45 of file TrkExToolsStringUtility.cxx.

45  {
46  std::set<std::string> setOfNames(nameVector.begin(), nameVector.end());
47  return setOfNames.size();
48  }

◆ possibleToolNameError()

std::string TrkExTools::possibleToolNameError ( const std::vector< std::string > &  toolNameVector)

Give an error message if tool names are invalid; empty string if good.

Definition at line 34 of file TrkExToolsStringUtility.cxx.

34  {
35  std::string result{};
36  auto isEmpty = [](const std::string & s){return s.empty();};
37  if (std::any_of(toolNameVector.begin(), toolNameVector.end(), isEmpty) ) return "A tool name was empty.";
38  if (auto pTheTool=std::find_if_not(toolNameVector.begin(), toolNameVector.end(), validToolName); pTheTool != toolNameVector.end()) {
39  result = "A tool name was invalid: " + *pTheTool;
40  }
41  return result;
42  }

◆ validToolName()

bool TrkExTools::validToolName ( const std::string &  toolName)

indicate whether a string is a valid Tool variable name

Definition at line 26 of file TrkExToolsStringUtility.cxx.

26  {
27  //valid name can contain underscore or alphanumeric characters, but cannot start
28  //with a number
29  std::regex re{"^[a-zA-Z_][a-zA-Z0-9_]*(::)?[a-zA-Z0-9_]*$"};
30  return std::regex_match(toolName, re);
31  }
TrkExTools::getToolSuffix
std::string getToolSuffix(const std::string &fullToolName)
Return the name suffix, e.g. return 'myNiceTool' from 'ToolSvc.myNiceTool'.
Definition: TrkExToolsStringUtility.cxx:14
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
get_generator_info.result
result
Definition: get_generator_info.py:21
PrepareReferenceFile.regex
regex
Definition: PrepareReferenceFile.py:43
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
TrkExTools::validToolName
bool validToolName(const std::string &toolName)
indicate whether a string is a valid Tool variable name
Definition: TrkExToolsStringUtility.cxx:26
re
const boost::regex re(r_e)