20 #if defined(PROVIDE_PRINT)
22 inline string space(
int count) {
27 out <<
space(indentLevel)
28 <<
"NodeState=" <<
this
29 <<
" frameNr=" << frameNr <<
" mode=" << mode;
31 out <<
" father=" <<
father <<
" lson=" << leftson <<
" rson=" << rightson;
33 for (
int e = 0; e<3; ++e) {
34 out <<
" e[" << e <<
"]=" << edge[e] <<
"[" << edgeIndex[e] <<
"]";
39 out <<
" sequence=" << sequence;
46 out <<
space(indentLevel) <<
"NodeStack=" <<
this <<
" size " << i <<
" frameNr=" << frameNr << endl;
48 const AP_tree_nlen *
node = *e;
49 out <<
space(indentLevel+1) <<
'[' << i <<
"] AP_tree_nlen*=" << node <<
" remembered_for_frame=" << node->last_remembered_frame() << endl;
50 node->get_states().print(out, indentLevel+2);
56 out <<
space(indentLevel) <<
"StateStack=" <<
this <<
" size " << i << endl;
59 state.print(out, indentLevel+1);
65 out <<
space(indentLevel) <<
"FrameStack=" <<
this <<
" size " << i << endl;
70 nodeStack.print(out, indentLevel+1, frameNr);
76 out <<
space(indentLevel)
77 << label <<
"=" <<
this
79 <<
" rff=" << remembered_for_frame
80 <<
" mut=" << mutations
82 <<
" dist=" << distance
83 <<
" touched=" << br.touched
85 <<
" seqcs=" << (
hasSequence() ? get_seq()->checksum() : 0);
87 for (
int e = 0; e<3; ++e) {
88 out <<
" edge[" << e <<
"]=" << edge[e];
95 out <<
"(not connected to 'this'!";
96 AP_tree_nlen *son = E.
sonNode();
99 out <<
" son=" << son <<
" father=" << fath;
102 out <<
"no son node";
111 out <<
" name=" << name << endl;
115 get_leftson()->print(out, indentLevel+1,
"left");
116 get_rightson()->print(out, indentLevel+1,
"right");
122 out <<
"AP_main tree:" << endl;
123 get_root_node()->print(out, 1,
"root");
125 out <<
"AP_main frames:" << endl;
127 out <<
" currFrame:" << endl;
128 currFrame->print(out, 2, frames.count_elements()+1);
131 out <<
" no currFrame" << endl;
133 frames.print(out, 1);
136 void AP_main::print2file(
const char *file_in_ARBHOME) {
138 std::ofstream out(full, std::ofstream::out);
147 template <
typename SET>
149 ap_assert(!set1.empty() && !set2.empty());
152 set1.begin(), set1.end(),
153 set2.begin(), set2.end(),
154 std::inserter<SET>(common, common.begin())
157 for (
typename SET::iterator e = common.begin(); e != common.end(); ++e) {
164 if (!stack1.nodes.empty() && !stack2.nodes.empty()) {
167 if (!stack1.edges.empty() && !stack2.edges.empty()) {
173 for (NodeSet::iterator n = nodes.begin(); n != nodes.end(); ++n) {
174 AP_tree_nlen *todel = *n;
178 todel->forget_relatives();
179 todel->forget_origin();
187 for (EdgeSet::iterator e = edges.begin(); e != edges.end(); ++e) {
192 todel->node[0] =
NULp;
193 todel->node[1] =
NULp;
204 while (!nodes.empty()) target.
put(getNode());
207 while (!edges.empty()) target.
put(getEdge());
212 created.destroy_nodes();
213 destroyed.forget_nodes();
215 created.destroy_edges();
216 destroyed.forget_edges();
221 ap_assert(correlated(!previous, !common));
225 created.move_nodes(previous->created);
226 destroyed.move_nodes(previous->destroyed);
229 created.forget_nodes();
230 destroyed.destroy_nodes();
235 created.move_edges(previous->created);
236 destroyed.move_edges(previous->destroyed);
239 created.forget_edges();
240 destroyed.destroy_edges();
bool isConnectedTo(const AP_tree_nlen *n) const
void extract_common(ResourceStack &stack1, ResourceStack &stack2)
return string(buffer, length)
void set_extract_common(SET &set1, SET &set2, SET &common)
AP_tree_nlen * sonNode() const
void accept_resources(StackFrameData *previous, ResourceStack *common)
BASE::const_iterator const_iterator
POS_TREE1 * get_father() const
GB_CSTR GB_path_in_ARBHOME(const char *relative_path)
void move_nodes(ResourceStack &target)
void revert_resources(StackFrameData *previous)
void move_edges(ResourceStack &target)
AP_tree_nlen * otherNode(const AP_tree_nlen *n) const
static long count_elements(GBDATA *gbd)
AP_tree_nlen * put(AP_tree_nlen *node)