ATLAS Offline Software
Loading...
Searching...
No Matches
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
6
7#ifndef EVENT_LOOP_ALGS__WHITE_BOARD_SVC_H
8#define EVENT_LOOP_ALGS__WHITE_BOARD_SVC_H
9
12
13
14
16
17#include <EventLoop/Algorithm.h>
18
19namespace EL
20{
28
29
30
32 {
33 //
34 // public interface
35 //
36
39 public:
40 void testInvariant () const;
41
42
49 public:
51
52
56 public:
57 bool hasVar (const std::string& name) const;
58
59
66 public:
67 float getFloat (const std::string& name) const;
68 void getArray (const std::string& name, std::size_t& size,
69 const float*& values) const;
70 TObject *getTObject (const std::string& name) const;
71
72
78 public:
79 template<class T> T *retrieve (const std::string& name) const;
80
81
88 public:
89 void setFloat (const std::string& name, float value);
90 void setArray (const std::string& name, const std::vector<float>& value);
91 void setArray (const std::string& name, std::size_t size,
92 const float *values);
93 void setTObject (TObject *object, bool swallow = true);
94
95
96
97 //
98 // interface inherited from Algorithm
99 //
100
103 public:
104 virtual const char *GetName () const;
105
106
107
108 //
109 // virtual interface
110 //
111
116 private:
117 virtual bool doHasVar (const std::string& name) const;
118
119
127 private:
128 virtual float doGetFloat (const std::string& name) const;
129 virtual void doGetArray (const std::string& name, std::size_t& size,
130 const float*& values) const;
131 virtual TObject *doGetTObject (const std::string& name) const;
132
133
141 private:
142 virtual void doSetFloat (const std::string& name, float value);
143 virtual void doSetArray (const std::string& name, std::size_t size,
144 const float *values);
145 virtual void doSetTObject (TObject *object, bool swallow);
146
147
148
149 //
150 // private interface
151 //
152
154 };
155}
156
157#include <RootCoreUtils/Assert.h>
158
159namespace EL
160{
161 //
162 // template methods
163 //
164
165 template<class T> T *WhiteBoardSvc ::
166 retrieve (const std::string& name) const
167 {
169 T *const result = dynamic_cast<T*>(getTObject (name));
170 RCU_ASSERT2_SOFT (result != 0, "object not of correct type");
171 return result;
172 }
173}
174
175#endif
#define RCU_ASSERT2_SOFT(x, y)
Definition Assert.h:164
size_t size() const
Number of registered mappings.
virtual const std::string & name() const
the interface for algorithms to access IWorker
Definition IWorker.h:40
T * retrieve(const std::string &name) const
returns: the content of the variable, casted to the given type guarantee: strong failures: variable n...
void setFloat(const std::string &name, float value)
returns: set/create a variable, assuming the given type guarantee: strong failures: given type not su...
void setTObject(TObject *object, bool swallow=true)
float getFloat(const std::string &name) const
returns: the content of the variable, assuming the given type guarantee: strong failures: variable no...
virtual TObject * doGetTObject(const std::string &name) const
void testInvariant() const
effects: test the invariant of this object guarantee: no-fail
ClassDef(WhiteBoardSvc, 1)
virtual const char * GetName() const
effects: return the name of this algorithm guarantee: no-fail
virtual void doGetArray(const std::string &name, std::size_t &size, const float *&values) const
void getArray(const std::string &name, std::size_t &size, const float *&values) const
virtual float doGetFloat(const std::string &name) const
returns: the content of the variable, assuming the given type guarantee: strong failures: variable no...
WhiteBoardSvc()
effects: standard constructor guarantee: strong failures: out of memory I rationale: this constructor...
virtual void doSetTObject(TObject *object, bool swallow)
void setArray(const std::string &name, const std::vector< float > &value)
void setArray(const std::string &name, std::size_t size, const float *values)
TObject * getTObject(const std::string &name) const
virtual void doSetArray(const std::string &name, std::size_t size, const float *values)
virtual bool doHasVar(const std::string &name) const
returns: whether we have the given variable guarantee: strong failures: out of memory II rationale: t...
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...
bool hasVar(const std::string &name) const
returns: whether we have the given variable guarantee: strong failures: out of memory II
This module defines the arguments passed from the BATCH driver to the BATCH worker.
WhiteBoardSvc * getWhiteBoardSvc(IWorker *worker)
effects: get the whiteboard service for this worker guarantee: strong failures: formula service not c...