ATLAS Offline Software
WhiteBoardSvc.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef EVENT_LOOP_ALGS__WHITE_BOARD_SVC_H
6 #define EVENT_LOOP_ALGS__WHITE_BOARD_SVC_H
7 
8 //
9 // Distributed under the Boost Software License, Version 1.0.
10 // (See accompanying file LICENSE_1_0.txt or copy at
11 // http://www.boost.org/LICENSE_1_0.txt)
12 
13 // Please feel free to contact me (krumnack@iastate.edu) for bug
14 // reports, feature suggestions, praise and complaints.
15 
16 
21 
22 
23 
24 #include <EventLoopAlgs/Global.h>
25 
26 #include <EventLoop/Algorithm.h>
27 
28 namespace EL
29 {
37 
38 
39 
41  {
42  //
43  // public interface
44  //
45 
48  public:
49  void testInvariant () const;
50 
51 
58  public:
60 
61 
65  public:
66  bool hasVar (const std::string& name) const;
67 
68 
75  public:
76  float getFloat (const std::string& name) const;
77  void getArray (const std::string& name, std::size_t& size,
78  const float*& values) const;
79  TObject *getTObject (const std::string& name) const;
80 
81 
87  public:
88  template<class T> T *retrieve (const std::string& name) const;
89 
90 
97  public:
98  void setFloat (const std::string& name, float value);
99  void setArray (const std::string& name, const std::vector<float>& value);
100  void setArray (const std::string& name, std::size_t size,
101  const float *values);
102  void setTObject (TObject *object, bool swallow = true);
103 
104 
105 
106  //
107  // interface inherited from Algorithm
108  //
109 
112  public:
113  virtual const char *GetName () const;
114 
115 
116 
117  //
118  // virtual interface
119  //
120 
125  private:
126  virtual bool doHasVar (const std::string& name) const;
127 
128 
136  private:
137  virtual float doGetFloat (const std::string& name) const;
138  virtual void doGetArray (const std::string& name, std::size_t& size,
139  const float*& values) const;
140  virtual TObject *doGetTObject (const std::string& name) const;
141 
142 
150  private:
151  virtual void doSetFloat (const std::string& name, float value);
152  virtual void doSetArray (const std::string& name, std::size_t size,
153  const float *values);
154  virtual void doSetTObject (TObject *object, bool swallow);
155 
156 
157 
158  //
159  // private interface
160  //
161 
163  };
164 }
165 
166 #include <RootCoreUtils/Assert.h>
167 
168 namespace EL
169 {
170  //
171  // template methods
172  //
173 
174  template<class T> T *WhiteBoardSvc ::
175  retrieve (const std::string& name) const
176  {
178  T *const result = dynamic_cast<T*>(getTObject (name));
179  RCU_ASSERT2_SOFT (result != 0, "object not of correct type");
180  return result;
181  }
182 }
183 
184 #endif
get_generator_info.result
result
Definition: get_generator_info.py:21
EL::WhiteBoardSvc::doGetArray
virtual void doGetArray(const std::string &name, std::size_t &size, const float *&values) const
EL::WhiteBoardSvc::doHasVar
virtual bool doHasVar(const std::string &name) const
returns: whether we have the given variable guarantee: strong failures: out of memory II rationale: t...
EL::WhiteBoardSvc::doGetTObject
virtual TObject * doGetTObject(const std::string &name) const
EL::WhiteBoardSvc::ClassDef
ClassDef(WhiteBoardSvc, 1)
athena.value
value
Definition: athena.py:124
EL::WhiteBoardSvc::setArray
void setArray(const std::string &name, std::size_t size, const float *values)
EL::WhiteBoardSvc::testInvariant
void testInvariant() const
effects: test the invariant of this object guarantee: no-fail
Assert.h
Global.h
python.Bindings.values
values
Definition: Control/AthenaPython/python/Bindings.py:805
EL::WhiteBoardSvc::getTObject
TObject * getTObject(const std::string &name) const
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
RCU_ASSERT2_SOFT
#define RCU_ASSERT2_SOFT(x, y)
Definition: Assert.h:169
EL::Algorithm
Definition: Algorithm.h:22
EL::WhiteBoardSvc::getArray
void getArray(const std::string &name, std::size_t &size, const float *&values) const
Algorithm.h
EL::WhiteBoardSvc::setArray
void setArray(const std::string &name, const std::vector< float > &value)
EL::IWorker
the interface for algorithms to access IWorker
Definition: IWorker.h:40
EL::WhiteBoardSvc::getFloat
float getFloat(const std::string &name) const
returns: the content of the variable, assuming the given type guarantee: strong failures: variable no...
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition: AlgorithmWorkerData.h:24
EL::WhiteBoardSvc::GetName
virtual const char * GetName() const
effects: return the name of this algorithm guarantee: no-fail
EL::Algorithm::name
virtual const std::string & name() const
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
EL::WhiteBoardSvc::doSetFloat
virtual void doSetFloat(const std::string &name, float value)
returns: set/create a variable, assuming the given type guarantee: strong failures: given type not su...
EL::WhiteBoardSvc::WhiteBoardSvc
WhiteBoardSvc()
effects: standard constructor guarantee: strong failures: out of memory I rationale: this constructor...
EL::WhiteBoardSvc::setTObject
void setTObject(TObject *object, bool swallow=true)
EL::WhiteBoardSvc::doSetArray
virtual void doSetArray(const std::string &name, std::size_t size, const float *values)
EL::WhiteBoardSvc::hasVar
bool hasVar(const std::string &name) const
returns: whether we have the given variable guarantee: strong failures: out of memory II
EL::WhiteBoardSvc::doSetTObject
virtual void doSetTObject(TObject *object, bool swallow)
EL::WhiteBoardSvc::setFloat
void setFloat(const std::string &name, float value)
returns: set/create a variable, assuming the given type guarantee: strong failures: given type not su...
EL::getWhiteBoardSvc
WhiteBoardSvc * getWhiteBoardSvc(IWorker *worker)
effects: get the whiteboard service for this worker guarantee: strong failures: formula service not c...
EL::WhiteBoardSvc
Definition: WhiteBoardSvc.h:41
EL::WhiteBoardSvc::retrieve
T * retrieve(const std::string &name) const
returns: the content of the variable, casted to the given type guarantee: strong failures: variable n...
Definition: WhiteBoardSvc.h:175
EL::WhiteBoardSvc::doGetFloat
virtual float doGetFloat(const std::string &name) const
returns: the content of the variable, assuming the given type guarantee: strong failures: variable no...