ATLAS Offline Software
CBNode.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef IOVSVC_CBNODE_H
6 #define IOVSVC_CBNODE_H
7 
8 /*****************************************************************************
9  *
10  * CBNode.h
11  * IOVSvc
12  *
13  * Author: Charles Leggett
14  *
15  * Tree node structure for callback function trigger tree
16  *
17  *****************************************************************************/
18 
19 #include <set>
20 #include <string>
21 
23 #include "SGTools/CallBackID.h"
24 #include <atomic>
25 
26 namespace SG {
27  class DataProxy;
28 }
29 
30 class CBNode {
31 public:
32 
34 
35  class nodeOrder {
36  public:
37  bool operator() ( const CBNode &n1, const CBNode &n2 ) const {
38  if ( n1.level() != n2.level() ) {
39  return ( n1.level() < n2.level() );
40  } else {
41  return ( n1.serial() < n2.serial() );
42  }
43  }
44 
45  bool operator() ( const CBNode *n1, const CBNode *n2 ) const {
46  if ( n1->level() != n2->level() ) {
47  return ( n1->level() < n2->level() );
48  } else {
49  return ( n1->serial() < n2->serial() );
50  }
51  }
52  };
53 
54  typedef std::set<CBNode*, CBNode::nodeOrder> nodeSet;
55  typedef std::vector<const CBNode*> constNodeVec;
56 
57  CBNode() = delete;
58  CBNode(const std::string& name, CBNode* parent);
59  CBNode(const SG::DataProxy* proxy, const std::string& name, CBNode* parent);
60  CBNode(BFCN* fcn, const CallBackID& cb, CBNode* parent);
61  ~CBNode();
62 
63  void addParent(CBNode* parent);
64  void addChild(CBNode* child);
65 
66  bool delParent(CBNode* parent);
67  bool delChild(CBNode* child);
68 
69  const nodeSet& children() { return m_children; }
70  const nodeSet& parents() { return m_parents; }
71  constNodeVec children() const { return constNodeVec (m_children.begin(), m_children.end()); }
72  constNodeVec parents() const { return constNodeVec (m_parents.begin(), m_parents.end()); }
73 
74  const std::string& name() const { return m_name; }
75  int level() const { return m_level; }
76  void setLevel(int l) { m_level = l; }
77 
78  bool trigger() const { return m_trig; }
79  void setTrigger(bool b) { m_trig = b; }
80 
81  bool flag() const { return m_flag; }
82  void setFlag(bool b) { m_flag = b; }
83 
84  const SG::DataProxy* proxy() const { return m_proxy; }
85  void setProxy(const SG::DataProxy* p);
86 
87  BFCN* fcn() { return m_fcn; }
88  const BFCN* fcn() const { return m_fcn; }
89 
90  unsigned int serial() const { return m_serial; }
91 
92 private:
95 
96  std::string m_name;
97  int m_level;
98 
102 
103  bool m_trig;
104  bool m_flag;
105 
106  unsigned int m_serial;
107  static std::atomic<unsigned int> s_serial;
108 };
109 
110 #endif
CBNode::CBNode
CBNode()=delete
CallBackID
Definition: CallBackID.h:24
SG
Forward declaration.
Definition: CaloCellPacker_400_500.h:32
CallBackID.h
CBNode::nodeOrder
Definition: CBNode.h:35
CBNode::setTrigger
void setTrigger(bool b)
Definition: CBNode.h:79
CBNode::delParent
bool delParent(CBNode *parent)
Definition: CBNode.cxx:75
CBNode::m_trig
bool m_trig
Definition: CBNode.h:103
CBNode::proxy
const SG::DataProxy * proxy() const
Definition: CBNode.h:84
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
CBNode::m_serial
unsigned int m_serial
Definition: CBNode.h:106
CBNode::m_name
std::string m_name
Definition: CBNode.h:96
CBNode::setProxy
void setProxy(const SG::DataProxy *p)
Definition: CBNode.cxx:93
CBNode
Definition: CBNode.h:30
CBNode::m_fcn
BFCN * m_fcn
Definition: CBNode.h:100
CBNode::m_proxy
const SG::DataProxy * m_proxy
Definition: CBNode.h:99
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
CBNode::constNodeVec
std::vector< const CBNode * > constNodeVec
Definition: CBNode.h:55
CBNode::s_serial
static std::atomic< unsigned int > s_serial
Definition: CBNode.h:107
DataProxy
DataProxy provides the registry services for StoreGate.
Definition: DataProxy.h:32
CBNode::parents
const nodeSet & parents()
Definition: CBNode.h:70
test_pyathena.parent
parent
Definition: test_pyathena.py:15
IOVSvcCallBackFcn
boost::function< StatusCode(IOVSVC_CALLBACK_ARGS) > IOVSvcCallBackFcn
the type of an IOVSvc call back: it wraps both the method and the object the method is called on
Definition: IOVSvcDefs.h:58
CBNode::level
int level() const
Definition: CBNode.h:75
CBNode::BFCN
IOVSvcCallBackFcn BFCN
Definition: CBNode.h:33
CBNode::setLevel
void setLevel(int l)
Definition: CBNode.h:76
CBNode::trigger
bool trigger() const
Definition: CBNode.h:78
CBNode::addParent
void addParent(CBNode *parent)
Definition: CBNode.cxx:65
CBNode::m_flag
bool m_flag
Definition: CBNode.h:104
CBNode::m_cbid
CallBackID m_cbid
Definition: CBNode.h:101
CBNode::m_children
nodeSet m_children
Definition: CBNode.h:94
CBNode::m_parents
nodeSet m_parents
Definition: CBNode.h:93
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
Rtt_histogram.n1
n1
Definition: Rtt_histogram.py:21
CBNode::nodeOrder::operator()
bool operator()(const CBNode &n1, const CBNode &n2) const
Definition: CBNode.h:37
CBNode::name
const std::string & name() const
Definition: CBNode.h:74
CBNode::children
const nodeSet & children()
Definition: CBNode.h:69
CBNode::serial
unsigned int serial() const
Definition: CBNode.h:90
CBNode::fcn
BFCN * fcn()
Definition: CBNode.h:87
CBNode::delChild
bool delChild(CBNode *child)
Definition: CBNode.cxx:84
CBNode::fcn
const BFCN * fcn() const
Definition: CBNode.h:88
CBNode::nodeSet
std::set< CBNode *, CBNode::nodeOrder > nodeSet
Definition: CBNode.h:54
CBNode::parents
constNodeVec parents() const
Definition: CBNode.h:72
CBNode::~CBNode
~CBNode()
Definition: CBNode.cxx:61
CBNode::children
constNodeVec children() const
Definition: CBNode.h:71
IOVSvcDefs.h
defines and typedefs for IOVSvc
SG::DataProxy
Definition: DataProxy.h:45
CBNode::flag
bool flag() const
Definition: CBNode.h:81
CBNode::setFlag
void setFlag(bool b)
Definition: CBNode.h:82
CBNode::addChild
void addChild(CBNode *child)
Definition: CBNode.cxx:70
CBNode::m_level
int m_level
Definition: CBNode.h:97