Version: 1.0
Classes | Functions
conact_tree.h File Reference
#include <fstream>
#include "condition_action.h"
#include "tree.h"
#include "drag.h"

Go to the source code of this file.

Classes

struct  Save
 
struct  Load
 

Functions

bool LoadConactTree (BinaryDrag< conact > &t, const std::string &filename)
 Loads a tree from file. More...
 
bool WriteConactTree (const BinaryDrag< conact > &t, const std::string &filename)
 Saves a tree into a file structured as described in the LoadConactTree() More...
 
bool equivalent_trees (const BinaryDrag< conact >::node *n1, const BinaryDrag< conact >::node *n2)
 
void intersect_leaves (BinaryDrag< conact >::node *n1, BinaryDrag< conact >::node *n2)
 
bool EqualTrees (const BinaryDrag< conact >::node *n1, const BinaryDrag< conact >::node *n2)
 Checks whether two (sub)trees 'n1' and 'n2' are equal or nor. More...
 
void IntersectTrees (BinaryDrag< conact >::node *n1, BinaryDrag< conact >::node *n2)
 
bool LoadConactDrag (BinaryDrag< conact > &t, const std::string &filename)
 
bool WriteConactDrag (BinaryDrag< conact > &t, const std::string &filename)
 

Function Documentation

◆ EqualTrees()

bool EqualTrees ( const BinaryDrag< conact >::node *  n1,
const BinaryDrag< conact >::node *  n2 
)

Checks whether two (sub)trees 'n1' and 'n2' are equal or nor.

Parameters
[in]n1Pointer to the root of the first subtree to be checked
[in]n2Pointer to the root of the second subtree to be checked
Returns
true if the two subtrees are equal, false otherwise

Definition at line 107 of file conact_tree.cpp.

◆ equivalent_trees()

bool equivalent_trees ( const BinaryDrag< conact >::node *  n1,
const BinaryDrag< conact >::node *  n2 
)

Definition at line 86 of file conact_tree.cpp.

◆ intersect_leaves()

void intersect_leaves ( BinaryDrag< conact >::node *  n1,
BinaryDrag< conact >::node *  n2 
)

Definition at line 96 of file conact_tree.cpp.

◆ IntersectTrees()

void IntersectTrees ( BinaryDrag< conact >::node *  n1,
BinaryDrag< conact >::node *  n2 
)

Definition at line 118 of file conact_tree.cpp.

◆ LoadConactDrag()

bool LoadConactDrag ( BinaryDrag< conact > &  t,
const std::string &  filename 
)

◆ LoadConactTree()

bool LoadConactTree ( BinaryDrag< conact > &  t,
const std::string &  filename 
)

Loads a tree from file.

The tree must be saved in a file with the following structure:

x a (left son of x) c . 2 . 3 . 1,3,4 (list of actions) b (right son of x) c . 2 . 3 . 4

Parameters
[out]tLoaded tree saved into a BinaryDrag
[in]filenameName of the file (path) from which load the tree
Returns
whether the tree has been correctly loaded or not

◆ WriteConactDrag()

bool WriteConactDrag ( BinaryDrag< conact > &  t,
const std::string &  filename 
)

◆ WriteConactTree()

bool WriteConactTree ( const BinaryDrag< conact > &  t,
const std::string &  filename 
)

Saves a tree into a file structured as described in the LoadConactTree()