CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SonicClientBase.h
Go to the documentation of this file.
1 #ifndef HeterogeneousCore_SonicCore_SonicClientBase
2 #define HeterogeneousCore_SonicCore_SonicClientBase
3 
10 
11 #include <string>
12 #include <exception>
13 #include <memory>
14 #include <optional>
15 
16 enum class SonicMode { Sync = 1, Async = 2, PseudoAsync = 3 };
17 
19 public:
20  //constructor
22 
23  //destructor
24  virtual ~SonicClientBase() = default;
25 
26  const std::string& debugName() const { return debugName_; }
27  const std::string& clientName() const { return clientName_; }
28  SonicMode mode() const { return mode_; }
29 
30  //main operation
31  virtual void dispatch(edm::WaitingTaskWithArenaHolder holder) { dispatcher_->dispatch(std::move(holder)); }
32 
33  //alternate operation when ExternalWork is not used
34  virtual void dispatch() { dispatcher_->dispatch(); }
35 
36  //helper: does nothing by default
37  virtual void reset() {}
38 
39  //provide base params
40  static void fillBasePSetDescription(edm::ParameterSetDescription& desc, bool allowRetry = true);
41 
42 protected:
43  void setMode(SonicMode mode);
44 
45  virtual void evaluate() = 0;
46 
48 
49  void start();
50 
51  void finish(bool success, std::exception_ptr eptr = std::exception_ptr{});
52 
53  //members
55  std::unique_ptr<SonicDispatcher> dispatcher_;
56  unsigned allowedTries_, tries_;
57  std::optional<edm::WaitingTaskWithArenaHolder> holder_;
58 
59  //for logging/debugging
61 
62  friend class SonicDispatcher;
64 };
65 
66 #endif
SonicClientBase(const edm::ParameterSet &params, const std::string &debugName, const std::string &clientName)
SonicMode
virtual void dispatch(edm::WaitingTaskWithArenaHolder holder)
virtual void evaluate()=0
virtual void dispatch()
const std::string & debugName() const
void setMode(SonicMode mode)
std::string debugName_
void finish(bool success, std::exception_ptr eptr=std::exception_ptr{})
virtual ~SonicClientBase()=default
def move
Definition: eostools.py:511
SonicMode mode() const
std::optional< edm::WaitingTaskWithArenaHolder > holder_
static void fillBasePSetDescription(edm::ParameterSetDescription &desc, bool allowRetry=true)
const std::string & clientName() const
std::string clientName_
std::unique_ptr< SonicDispatcher > dispatcher_
std::string fullDebugName_
unsigned allowedTries_
virtual void reset()