The Gaudi Framework  master (37c0b60a)
iNode.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #pragma once
12 
13 #include <GaudiKernel/Kernel.h>
14 #include <GaudiKernel/StatusCode.h>
15 #include <functional>
16 #include <iosfwd>
17 #include <memory>
18 
19 namespace Gaudi {
20  namespace Interfaces {
21  class IParticlePropertySvc;
22  }
23  class ParticleID;
24 } // namespace Gaudi
25 
26 namespace Gaudi::Decays {
35  class GAUDI_API iNode {
36  public:
41  virtual bool operator()( const Gaudi::ParticleID& pid ) const = 0;
42 
44  virtual iNode* clone() const = 0;
45 
50  virtual std::ostream& fillStream( std::ostream& s ) const = 0;
52  virtual bool valid() const = 0;
54  virtual bool operator!() const;
55 
61 
63  virtual std::string toString() const;
64 
66  virtual ~iNode() = default;
67  };
68 
74  class GAUDI_API Node : public iNode {
75  public:
77  Node( const Decays::iNode& node );
79  Node( const Decays::Node& right );
81  Node* clone() const override;
83  bool operator()( const Gaudi::ParticleID& p ) const override;
85  std::ostream& fillStream( std::ostream& s ) const override;
87  bool valid() const override;
89  StatusCode validate( const Gaudi::Interfaces::IParticlePropertySvc* svc ) const override;
90 
91  public:
92  Node& operator&=( const iNode& right ) { return op_and( right ); }
93  Node& operator|=( const iNode& right ) { return op_or( right ); }
94 
95  // get the underlying node
96  inline const iNode& node() const { return *m_node; }
97 
98  // evaluate the underlying node
99  inline bool node( const Gaudi::ParticleID& pid ) const { return node()( pid ); }
100 
102  Node& operator=( const Node& right );
104  Node& operator=( const iNode& right );
105 
106  private:
107  Node& op_and( const iNode& right );
108  Node& op_or( const iNode& right );
109 
112  };
113 
121  inline std::ostream& operator<<( std::ostream& s, const iNode& n ) { return n.fillStream( s ); }
122 
128  inline bool operator==( const Decays::iNode& node, const Gaudi::ParticleID& pid ) { return node( pid ); }
129 
135  inline bool operator==( const Gaudi::ParticleID& pid, const Decays::iNode& node ) { return node == pid; }
136 
142  inline bool operator!=( const Decays::iNode& node, const Gaudi::ParticleID& pid ) { return !( node == pid ); }
143 
149  inline bool operator!=( const Gaudi::ParticleID& pid, const Decays::iNode& node ) { return node != pid; }
150 
159  return n.validate( svc );
160  }
161 
170  return n.validate( svc );
171  }
172 } // namespace Gaudi::Decays
Gaudi::Decays::Node
Definition: iNode.h:74
Gaudi::Decays::operator!=
bool operator!=(const Decays::iNode &node, const Gaudi::ParticleID &pid)
non-equality The node is "equal" to the PID , if the given PID satisfies the node criteria
Definition: iNode.h:142
Gaudi::Decays::iNode::fillStream
virtual std::ostream & fillStream(std::ostream &s) const =0
printout of the stream
std::string
STL class.
Gaudi::Decays::iNode::clone
virtual iNode * clone() const =0
clone method ("virtual constructor")
ParticleID
Definition: ParticleID.py:1
Gaudi::Decays::operator+
StatusCode operator+(const Decays::iNode &n, const Gaudi::Interfaces::IParticlePropertySvc *svc)
"on-flight" validation of the node
Definition: iNode.h:158
Gaudi::Decays::Node::operator|=
Node & operator|=(const iNode &right)
Definition: iNode.h:93
gaudirun.s
string s
Definition: gaudirun.py:346
Gaudi::Interfaces::IParticlePropertySvc
Definition: IParticlePropertySvc.h:29
Gaudi::Decays::iNode::~iNode
virtual ~iNode()=default
virtual destructor
GaudiPartProp.Nodes.Node
Node
Definition: Nodes.py:247
Gaudi::Decays::iNode::validate
virtual StatusCode validate(const Gaudi::Interfaces::IParticlePropertySvc *svc) const =0
validate the decay node
StatusCode.h
operator!
bool operator!(const Gaudi::Time &t)
Definition: Time.icpp:191
Gaudi::Decays::iNode::valid
virtual bool valid() const =0
check the validity of the node
Gaudi::Decays::operator*
StatusCode operator*(const Decays::iNode &n, const Gaudi::Interfaces::IParticlePropertySvc *svc)
"on-flight" validation of the node
Definition: iNode.h:169
Gaudi::Decays::iNode::operator()
virtual bool operator()(const Gaudi::ParticleID &pid) const =0
the basic operation: comparison of the particle PID with the node
StatusCode
Definition: StatusCode.h:65
std::ostream
STL class.
Gaudi::Decays::validate
StatusCode validate(Iterator begin, Iterator end, const Gaudi::Interfaces::IParticlePropertySvc *svc)
validate trees/nodes
Definition: Nodes.h:53
Gaudi::Decays::Node::node
const iNode & node() const
Definition: iNode.h:96
Gaudi::Decays::operator<<
std::ostream & operator<<(std::ostream &s, const iNode &n)
printout to the output stream
Definition: iNode.h:121
Gaudi
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition: __init__.py:1
cpluginsvc.n
n
Definition: cpluginsvc.py:234
Gaudi::Decays
Definition: CC.h:17
Gaudi::Utils::toString
std::string toString(const TYPE &obj)
the generic implementation of the type conversion to the string
Definition: ToStream.h:353
Gaudi::Decays::valid
bool valid(Iterator begin, Iterator end)
check the validness of the trees or nodes
Definition: Nodes.h:36
Kernel.h
Gaudi::ParticleID
Definition: ParticleID.h:43
Gaudi::Decays::iNode
Definition: iNode.h:35
std::unique_ptr
STL class.
Gaudi::Decays::Node::m_node
std::unique_ptr< iNode > m_node
the node itself:
Definition: iNode.h:111
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:81
Gaudi::Decays::Node::node
bool node(const Gaudi::ParticleID &pid) const
Definition: iNode.h:99
Gaudi::Decays::operator==
bool operator==(const Decays::iNode &node, const Gaudi::ParticleID &pid)
equality The node is "equal" to the PID , if the given pid satisfies the node criteria
Definition: iNode.h:128
Gaudi::Decays::Node::operator&=
Node & operator&=(const iNode &right)
Definition: iNode.h:92