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
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
25
26#include <EventLoop/Algorithm.h>
27
28namespace 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
168namespace 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
#define RCU_ASSERT2_SOFT(x, y)
Definition Assert.h:169
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...