BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
NodeUtils.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Param/Node/NodeUtils.h
6 //! @brief Defines collection of utility functions for INode.
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifdef SWIG
16 #error no need to expose this header to Swig
17 #endif
18 
19 #ifndef USER_API
20 #ifndef BORNAGAIN_PARAM_NODE_NODEUTILS_H
21 #define BORNAGAIN_PARAM_NODE_NODEUTILS_H
22 
23 #include <string>
24 #include <vector>
25 
26 class INode;
27 
28 namespace NodeUtils {
29 
30 //! Returns a vector of triples (descendant, depth, parent)
31 std::vector<std::tuple<const INode*, int, const INode*>> progenyPlus(const INode* node,
32  int level = 0);
33 
34 //! Returns multiline string representing tree structure starting from given node.
35 std::string nodeToString(const INode* node);
36 
37 //! Returns path composed of node's displayName, with respect to root node
38 std::string nodePath(const INode* node, const INode* root = nullptr);
39 
40 } // namespace NodeUtils
41 
42 #endif // BORNAGAIN_PARAM_NODE_NODEUTILS_H
43 #endif // USER_API
Base class for tree-like structures containing parameterized objects.
Definition: INode.h:49
std::vector< std::tuple< const INode *, int, const INode * > > progenyPlus(const INode *node, int level=0)
Returns a vector of triples (descendant, depth, parent)
Definition: NodeUtils.cpp:69
std::string nodeToString(const INode *node)
Returns multiline string representing tree structure starting from given node.
Definition: NodeUtils.cpp:81
std::string nodePath(const INode *node, const INode *root=nullptr)
Returns path composed of node's displayName, with respect to root node.
Definition: NodeUtils.cpp:89