BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
anonymous_namespace{NodeUtils.cpp} Namespace Reference

Functions

std::string s_indent (int depth)
 
std::string poolToString (const INode &node)
 
std::string nodeString (const INode &node, int depth)
 

Function Documentation

◆ s_indent()

std::string anonymous_namespace{NodeUtils.cpp}::s_indent ( int  depth)

Definition at line 30 of file NodeUtils.cpp.

31 {
32  const int multiplier = 4;
33  return std::string(multiplier * depth, '.');
34 }

Referenced by nodeString().

◆ poolToString()

std::string anonymous_namespace{NodeUtils.cpp}::poolToString ( const INode node)

Definition at line 37 of file NodeUtils.cpp.

38 {
39  std::ostringstream result;
40 
41  const std::vector<RealParameter*> pars = node.parameterPool()->parameters();
42  if (pars.empty())
43  return {};
44 
45  result << " (";
46  size_t index(0);
47  for (auto par : pars) {
48  result << "'" << par->getName() << "':" << par->value();
49  ++index;
50  if (index != pars.size())
51  result << " ";
52  }
53  result << ")";
54 
55  return result.str();
56 }
ParameterPool * parameterPool() const
Returns pointer to the parameter pool.
const std::vector< RealParameter * > parameters() const
Returns full vector of parameters.
Definition: ParameterPool.h:52

References IParameterized::parameterPool(), and ParameterPool::parameters().

Referenced by nodeString().

Here is the call graph for this function:

◆ nodeString()

std::string anonymous_namespace{NodeUtils.cpp}::nodeString ( const INode node,
int  depth 
)

Definition at line 59 of file NodeUtils.cpp.

60 {
61  std::ostringstream result;
62  result << s_indent(depth) << node.displayName() << poolToString(node) << "\n";
63  return result.str();
64 }
std::string displayName() const
Returns display name, composed from the name of node and it's copy number.
Definition: INode.cpp:105
std::string s_indent(int depth)
Definition: NodeUtils.cpp:30
std::string poolToString(const INode &node)
Definition: NodeUtils.cpp:37

References INode::displayName(), poolToString(), and s_indent().

Referenced by NodeUtils::nodeToString().

Here is the call graph for this function: