I have a generic tree implementation written in C++ that can store any type (int, float, string, etc.)
template<class T> class Tree {
public:
// Class interface
private:
T node;
std::list<Tree<T>*>* children;
};
and I have a program (written in C++) that take as input a source tree and give in output another tree based on a set of rules (stored in a file).
Any instance of class A become an instance of class X
Any instance of class B become an instance of class Y
Any instance of class C become an instance of class Z
For example, suppose I have this input tree A(B(C)) (the node A has B as child and B has C as child). Based on the file of rule my program give me this tree X(Y(Z)). My question is: How can I save in a file the set of rules? How can I store the tree type in this file? I'm thinking to use XML for store the rules, like this
<translationUnit>
<from>
<A>
<B>
<C></C>
</B>
</A>
</from>
<to>
<X>
<Y>
<Z></Z>
</Y>
</X>
<to>
</translationUnit>
but how can I store the class type?