VPTissue Reference Manual

Collection of functions for recursively comparing ptrees, with some 'array' semantics applied. More...
#include <PTreeComparison.h>
Static Public Member Functions  
static bool  CompareArray (ptree const &pt1, ptree const &pt2, double acceptable_diff) 
Test if ordered list of children of both ptrees are equal, i.e. More...  
static bool  CompareNonArray (ptree const &pt1, ptree const &pt2, double acceptable_diff) 
Test if every child in first ptree with certain key can also be found in second ptree under the same key, and vice versa. More...  
static bool  CompareRootValues (ptree const &pt1, ptree const &pt2, double acceptable_diff) 
Test if root values of both ptrees are equal, with the possibility of having some tolerance for small differences in case both root values are floats. More...  
Collection of functions for recursively comparing ptrees, with some 'array' semantics applied.
Because all data in a ptree is both ordered (sequential) and unordered (mapped by a key) at the same time, we apply the semantics that, if a subtree path ends with "_array", the order of its children is semantically taken into account. For 2 'array' subtrees to be equal, we thus require all children to be present in the same order in both subtrees. If a subtree path does not end with "_array", we just want all values with a certain key to be found under the same key in the subtree it is compared with.
This is all done recursively: For instance, the ordered items of an array can, in its turn, be arrays or unordered subtrees, and the unordered items of an indexed subtree can be arrays or unordered subtrees. The right compare method is selected on each recursion.
Definition at line 43 of file PTreeComparison.h.

static 
Test if ordered list of children of both ptrees are equal, i.e.
lenghts must be the same, and every item in one ptree must occur in the other at the same index.
Root values of children are compared using CompareRootValues. On top of that, recursively compares children of both ptrees: When a key under which a child ptree is found ends with the suffix "_array", CompareArray is used. Otherwise, CompareNonArray is used.
pt1  First ptree. 
pt2  Second ptree. 
acceptable_diff  Largest tolerated difference between root values of children in both ptrees. 
Definition at line 88 of file PTreeComparison.cpp.

static 
Test if every child in first ptree with certain key can also be found in second ptree under the same key, and vice versa.
Comparison is RECURSIVE, see PTreeComparison::CompareArray for details.
pt1  First ptree. 
pt2  Second ptree. 
acceptable_diff  Largest tolerated difference between root values of children in both ptrees. 
Definition at line 126 of file PTreeComparison.cpp.

static 
Test if root values of both ptrees are equal, with the possibility of having some tolerance for small differences in case both root values are floats.
Does NOT recursively compare children of the given ptrees.
pt1  First ptree. 
pt2  Second ptree. 
acceptable_diff  Largest tolerated difference between root values if both are float type. 
Definition at line 42 of file PTreeComparison.cpp.