36 for(std::set<CBNode*>::iterator itr=
m_allNodes.begin();
59 if (0 != n) n->setProxy(pNew);
83 cout <<
"ERROR: no parent proxy found in tree for " << proxy->name()
101 cout <<
"ERROR: no parent function found in tree for " << parent_fcn
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;
148 if (parent->flag()) {
149 cout <<
"ERROR: cannot connect " <<
node->
name() <<
" to "
150 << parent->name() <<
" as a loop would be formed"
156 node->addParent( parent );
157 parent->addChild(
node );
158 if (
node->level() < (parent->level() + 1)) {
162 node->setLevel( parent->level() + 1);
193 if ( start->proxy() == proxy ) {
197 for (
auto c : start->children() ) {
219 if (start->fcn() == fcn) {
224 std::set<CBNode*>::const_iterator citr = start->children().begin();
225 for (; citr != start->children().end(); ++citr) {
246 if (start->name() == name) {
251 std::set<CBNode*>::const_iterator citr = start->children().begin();
252 for (; citr != start->children().end(); ++citr) {
266 cout <<
"total entries: " <<
m_allNodes.size() <<
" max levels: "
275 for (
int i=0; i<start->level(); ++i) {
279 if (start->trigger()) {
282 cout << start->name();
283 if (start->trigger()) {
288 for (
const CBNode* child : start->children()) {
302 lp = parent->level();
305 for (
int i=0; i<lp; ++i) {
309 for (
int i=0; i<(current->level()-lp); ++i) {
319 if (current->trigger()) {
320 cout <<
"␛[93;1m" << current->name() <<
"␛[m";
322 cout << current->name();
330 nodeSet::const_iterator itr =
m_allNodes.end();
332 return (*itr)->level();
338 nodeSet::const_iterator citr =
m_allNodes.begin();
340 cout << (*citr)->name() <<
" " << *citr <<
" " << (*citr)->level()
341 <<
" " << (*citr)->trigger() << endl;
348 nodeSet::const_iterator& start,
349 nodeSet::const_iterator& end)
const {
356 nodeSet::const_iterator citr =
m_allNodes.begin();
358 if (!s && (*citr)->level() == level) {
363 if (s && (*citr)->level() != level) {
379 start->setTrigger(b);
381 std::set<CBNode*>::iterator citr = start->children().begin();
382 for (;citr!=start->children().end(); ++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;
421 (*itr)->setTrigger(
false);
435 for (
CBNode* child : start->children()) {
443 nodeSet::const_iterator itr;
445 (*itr)->setFlag(
false);
454 int level = start->level();
456 std::set<CBNode*>::iterator citr = start->children().begin();
457 for (;citr != start->children().end(); ++citr) {
459 (*citr)->setLevel( level+1 );
479 if (current == 0) {
return; }
483 for (
const CBNode* child : current->children()) {
492 if (current == 0) {
return; }
496 for (
const CBNode* parent : current->parents()) {
518 if (current == 0) {
return; }
520 (*pf)(current,parent);
522 for (
const CBNode* child : current->children()) {
531 if (current == 0) {
return; }
533 (*pf)(current,child);
535 for (
const CBNode* parent : current->parents()) {
554 const CBNode *n = (*pf)(current);
560 for (
const CBNode* child : current->children()) {
574 const CBNode *n = (*pf)(current);
580 for (
const CBNode* parent : current->parents()) {
CBNode * addNode(const std::string &name, CBNode *parent)
CBNode * replaceProxy(const SG::DataProxy *pOld, const SG::DataProxy *pNew)
void cascadeTrigger(const bool b, CBNode *start)
void connectNode(CBNode *node, CBNode *parent)
void adjustLevels(CBNode *start)
void traverseR(const CBNode *, void(*pF)(const CBNode *)) const
void clearTrigger() const
void cascadeFlag(const bool b, CBNode *node) const
void traverse(void(*pF)(const CBNode *)) const
static void _printTree(const CBNode *, const CBNode *)
CBNode * findNode(const std::string &name)
bool delNode(const SG::DataProxy *prx)
virtual const name_type & name() const override final
Retrieve data object key == string.
void name(const std::string &n)