29 m_root =
new CBNode(
"root",0);
30 m_allNodes.insert( m_root );
37 itr != m_allNodes.end(); ++itr) {
48 m_allNodes.insert(
n );
59 if (0 !=
n)
n->setProxy(pNew);
71 m_allNodes.insert(
n );
83 cout <<
"ERROR: no parent proxy found in tree for " <<
proxy->name()
90 m_allNodes.insert(
n );
101 cout <<
"ERROR: no parent function found in tree for " << parent_fcn
108 m_allNodes.insert(
n );
117 cout <<
"ERROR: no node with DataProxy " << prx->
name() <<
" found in tree"
123 for (
auto p :
n->parents() ) {
124 if (!
p->delChild(
n )) {
125 cout <<
"ERROR: CBTree::delNode : unable to delete child "
126 <<
n->name() <<
" from parent " <<
p->name() << endl;
131 for (
auto c :
n->children()) {
132 if (!
c->delParent(
n )) {
133 cout <<
"ERROR: CBTree::delNode : unable to delete parent "
134 <<
n->name() <<
" from child " <<
c->name() << endl;
147 cascadeFlag(
true,
node);
149 cout <<
"ERROR: cannot connect " <<
node->
name() <<
" to "
150 <<
parent->name() <<
" as a loop would be formed"
161 m_allNodes.erase( m_allNodes.find(
node ) );
163 m_allNodes.insert(
node );
165 adjustLevels(
node );
185 return findNode(
proxy, m_root);
197 for (
auto c :
start->children() ) {
212 return findNode(fcn, m_root);
219 if (
start->fcn() == fcn) {
224 std::set<CBNode*>::const_iterator citr =
start->children().begin();
225 for (; citr !=
start->children().
end(); ++citr) {
226 c = findNode(fcn,*citr);
239 return findNode(
name, m_root);
251 std::set<CBNode*>::const_iterator citr =
start->children().begin();
252 for (; citr !=
start->children().
end(); ++citr) {
253 c = findNode(
name,*citr);
266 cout <<
"total entries: " << m_allNodes.size() <<
" max levels: "
267 << maxLevel() << endl;
275 for (
int i=0;
i<
start->level(); ++
i) {
279 if (
start->trigger()) {
282 cout <<
start->name();
283 if (
start->trigger()) {
305 for (
int i=0;
i<lp; ++
i) {
320 cout <<
"[93;1m" <<
current->name() <<
"[m";
330 nodeSet::const_iterator itr = m_allNodes.end();
332 return (*itr)->level();
338 nodeSet::const_iterator citr = m_allNodes.begin();
339 for (; citr != m_allNodes.end(); ++citr) {
340 cout << (*citr)->name() <<
" " << *citr <<
" " << (*citr)->level()
341 <<
" " << (*citr)->trigger() << endl;
348 nodeSet::const_iterator&
start,
349 nodeSet::const_iterator&
end)
const {
353 start = m_allNodes.end();
354 end = m_allNodes.end();
356 nodeSet::const_iterator citr = m_allNodes.begin();
357 for (; citr != m_allNodes.end(); ++citr) {
358 if (!
s && (*citr)->level() ==
level) {
363 if (
s && (*citr)->level() !=
level) {
382 for (;citr!=
start->children().
end(); ++citr) {
383 cascadeTrigger(
b, *citr);
393 cout <<
"ERROR cascading trigger from fcn: " << fcn << endl;
407 cout <<
"ERROR cascading trigger from proxy: " <<
proxy->name() << endl;
419 nodeSet::const_iterator itr;
420 for (itr=m_allNodes.begin(); itr != m_allNodes.end(); ++itr) {
421 (*itr)->setTrigger(
false);
436 cascadeFlag(
b, child);
443 nodeSet::const_iterator itr;
444 for (itr=m_allNodes.begin(); itr != m_allNodes.end(); ++itr) {
445 (*itr)->setFlag(
false);
457 for (;citr !=
start->children().
end(); ++citr) {
458 m_allNodes.erase( m_allNodes.find( *citr ) );
459 (*citr)->setLevel(
level+1 );
460 m_allNodes.insert( *citr );
461 adjustLevels( *citr );