00001 #include "streenode.h" 00002 #include <sstream> 00003 00004 ostream& operator<<(ostream &os, const Node::Assignment &data){ 00005 Node::Assignment::const_iterator it = data.begin(); 00006 Node::Assignment::const_iterator eit = data.end(); 00007 while (it!=eit){ 00008 os << it->first << " " << it->second << endl; 00009 it++; 00010 }; 00011 return os; 00012 }; 00013 00014 ostream& operator<<(ostream &os, const Node *data){ 00015 return data->php(os); 00016 }; 00017 00018 string Node::toString() const{ 00019 ostringstream str; 00020 str << this; 00021 return str.str(); 00022 }; 00023 00024 00025 Node* Node::push_back(Node *statement) { 00026 throw "push_back called for Node"; 00027 }; 00028 00029 Node* Node::transform(const Transformer* transformer){ 00030 return transformer->transform(this); 00031 }; 00032 00033 bool Node::forall(const Tester* tester, const NameSpace &nameSpace) const{ 00034 return tester->test(this, nameSpace); 00035 }; 00036 00037 bool Node::exists(const Tester* tester, const NameSpace &nameSpace) const{ 00038 return tester->test(this, nameSpace); 00039 }; 00040 00041 int Node::getLength() const{ 00042 throw "getLength called for Node"; 00043 }; 00044 00045 void substituteNode(Node* &node, const Node::Assignment &assign){ 00046 Node *targ = node->substitute(assign); 00047 if (node!=targ) { 00048 delete node; 00049 node = targ; 00050 } 00051 };