VPTissue Reference Manual
SimPT_Sim::Util::PTreeUtils Class Reference

A collection of functions for manipulating the structure of ptrees. More...

#include <PTreeUtils.h>

Collaboration diagram for SimPT_Sim::Util::PTreeUtils:
Collaboration graph

Static Public Member Functions

static void CopyNonExistingChildren (const boost::property_tree::ptree &src, boost::property_tree::ptree &dst, const std::set< std::string > &ignore=std::set< std::string >())
 Copies every node from 'source' ptree if that node doesn't exist in 'destination' ptree. More...
 
static void CopyStructure (const boost::property_tree::ptree &src, boost::property_tree::ptree &dst, const std::string &fill_value, const std::set< std::string > &ignore=std::set< std::string >())
 
static void FillPTree (boost::property_tree::ptree &pt1, const boost::property_tree::ptree &pt2)
 Fill the first ptree with the second ptree. More...
 
static std::list< std::pair< std::string, std::string > > Flatten (const boost::property_tree::ptree &pt, bool indexedArray=false, const std::string &path="")
 Flattens a ptree from a given path. More...
 
static const boost::property_tree::ptree & GetIndexedChild (const boost::property_tree::ptree &pt, const std::string &path)
 Returns a reference to the subptree in the given ptree, taking indexes of array-elements (of PTreeUtils::Flatten function) into account. More...
 
static void PutIndexedChild (boost::property_tree::ptree &pt, const std::string &path, const boost::property_tree::ptree &child)
 Put the child in the given ptree on the given path. More...
 
static void RemoveNonExistingChildren (const boost::property_tree::ptree &src, boost::property_tree::ptree &dst, const std::set< std::string > &ignore=std::set< std::string >())
 Removes every node in 'destination' ptree if that node doesn't exist in 'source' ptree. More...
 

Detailed Description

A collection of functions for manipulating the structure of ptrees.

Definition at line 35 of file PTreeUtils.h.

Member Function Documentation

void SimPT_Sim::Util::PTreeUtils::CopyNonExistingChildren ( const boost::property_tree::ptree &  src,
boost::property_tree::ptree &  dst,
const std::set< std::string > &  ignore = std::set<std::string>() 
)
static

Copies every node from 'source' ptree if that node doesn't exist in 'destination' ptree.

Parameters
src'source' ptree.
dst'destination' ptree.
ignoreA list of node keys not to copy. (they are skipped).

Definition at line 68 of file PTreeUtils.cpp.

void SimPT_Sim::Util::PTreeUtils::FillPTree ( boost::property_tree::ptree &  pt1,
const boost::property_tree::ptree &  pt2 
)
static

Fill the first ptree with the second ptree.

The ptrees should have the same structures.

Parameters
pt1The first ptree.
pt2The second ptree.

Definition at line 111 of file PTreeUtils.cpp.

Referenced by SimPT_Editor::EditControlLogic::CopyAttributes().

Here is the caller graph for this function:

list< pair< string, string > > SimPT_Sim::Util::PTreeUtils::Flatten ( const boost::property_tree::ptree &  pt,
bool  indexedArray = false,
const std::string &  path = "" 
)
static

Flattens a ptree from a given path.

Parameters
ptThe given ptree.
indexedArrayWhether to append indexes '[i]' to children of '*_array' entries of the ptree.
pathThe given path (shouldn't be given when the full ptree should be flatten).
Returns
A list with for each path in the ptree, the associated value.

Definition at line 130 of file PTreeUtils.cpp.

Referenced by SimPT_Parex::ParameterExploration::GetPossibleParameters().

Here is the caller graph for this function:

const ptree & SimPT_Sim::Util::PTreeUtils::GetIndexedChild ( const boost::property_tree::ptree &  pt,
const std::string &  path 
)
static

Returns a reference to the subptree in the given ptree, taking indexes of array-elements (of PTreeUtils::Flatten function) into account.

Parameters
ptThe given ptree.
pathThe given path.
Returns
The subtree to get.

Definition at line 152 of file PTreeUtils.cpp.

Referenced by SimPT_Parex::ParameterExploration::GetOriginalValue().

Here is the caller graph for this function:

void SimPT_Sim::Util::PTreeUtils::PutIndexedChild ( boost::property_tree::ptree &  pt,
const std::string &  path,
const boost::property_tree::ptree &  child 
)
static

Put the child in the given ptree on the given path.

The path can contain indexes. The path can't be empty and when a node doesn't exist, it will only be created when it has no index or when the index is zero.

Parameters
ptThe given ptree.
pathThe given path.
childThe given child.

Definition at line 193 of file PTreeUtils.cpp.

Referenced by SimPT_Parex::ParameterExploration::CreateTask().

Here is the caller graph for this function:

void SimPT_Sim::Util::PTreeUtils::RemoveNonExistingChildren ( const boost::property_tree::ptree &  src,
boost::property_tree::ptree &  dst,
const std::set< std::string > &  ignore = std::set<std::string>() 
)
static

Removes every node in 'destination' ptree if that node doesn't exist in 'source' ptree.

Parameters
src'source' ptree.
dst'destination' ptree.
ignoreA list of node keys not to remove. (they are skipped).

Definition at line 235 of file PTreeUtils.cpp.


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