ATLAS Offline Software
Loading...
Searching...
No Matches
CBNode.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5/*****************************************************************************
6 *
7 * CBNode.cxx
8 * IOVSvc
9 *
10 * Author: Charles Leggett
11 *
12 * Tree node structure for callback function trigger tree
13 *
14 *****************************************************************************/
15
16#include "CBNode.h"
17
18#include "SGTools/DataProxy.h"
19
20std::atomic<unsigned int> CBNode::s_serial = 0;
21
22CBNode::CBNode(const std::string& name, CBNode* parent):
23 m_name(name), m_proxy(0), m_fcn(0), m_trig(false), m_flag(false) {
25 if (parent != 0) {
26 m_level = parent->level() + 1;
27 addParent( parent );
28 parent->addChild( this );
29 } else {
30 m_level = 0;
31 }
32}
33
34CBNode::CBNode(const SG::DataProxy* proxy, const std::string& name,
35 CBNode* parent):
36 m_name(name), m_proxy(proxy), m_fcn(0), m_trig(false), m_flag(false) {
38 if (parent != 0) {
39 m_level = parent->level() + 1;
40 addParent( parent );
41 parent->addChild( this );
42 } else {
43 m_level = 0;
44 }
45}
46
47CBNode::CBNode(BFCN* fcn, const CallBackID& cb, CBNode* parent):
48 m_name (cb.name()),
49 m_proxy(0), m_fcn(fcn), m_cbid(cb), m_trig(false), m_flag(false) {
51
52 if (parent != 0) {
53 m_level = parent->level() + 1;
54 addParent( parent );
55 parent->addChild( this );
56 } else {
57 m_level = 0;
58 }
59}
60
62
63}
64
65void CBNode::addParent( CBNode* parent ) {
66 assert( parent);
67 m_parents.insert( parent );
68}
69
70void CBNode::addChild( CBNode* child ) {
71 assert(child);
72 m_children.insert( child );
73}
74
76 std::set<CBNode*>::iterator itr = m_parents.find(par);
77 if (itr != m_parents.end()) {
78 m_parents.erase( itr );
79 return true;
80 }
81 return false;
82}
83
84bool CBNode::delChild( CBNode* child ) {
85 std::set<CBNode*>::iterator itr = m_children.find(child);
86 if (itr != m_children.end()) {
87 m_children.erase( itr );
88 return true;
89 }
90 return false;
91}
92
94 assert(0 != p);
95 m_proxy=p;
96 m_name=p->name();
97}
void addParent(CBNode *parent)
Definition CBNode.cxx:65
nodeSet m_parents
Definition CBNode.h:93
BFCN * fcn()
Definition CBNode.h:87
bool m_flag
Definition CBNode.h:104
void addChild(CBNode *child)
Definition CBNode.cxx:70
int m_level
Definition CBNode.h:97
nodeSet m_children
Definition CBNode.h:94
void setProxy(const SG::DataProxy *p)
Definition CBNode.cxx:93
const SG::DataProxy * proxy() const
Definition CBNode.h:84
bool delChild(CBNode *child)
Definition CBNode.cxx:84
~CBNode()
Definition CBNode.cxx:61
IOVSvcCallBackFcn BFCN
Definition CBNode.h:33
const std::string & name() const
Definition CBNode.h:74
std::string m_name
Definition CBNode.h:96
unsigned int m_serial
Definition CBNode.h:106
CBNode()=delete
bool m_trig
Definition CBNode.h:103
static std::atomic< unsigned int > s_serial
Definition CBNode.h:107
BFCN * m_fcn
Definition CBNode.h:100
const SG::DataProxy * m_proxy
Definition CBNode.h:99
bool delParent(CBNode *parent)
Definition CBNode.cxx:75
CallBackID m_cbid
Definition CBNode.h:101