Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
art::WorkerT< T > Class Template Reference

#include <WorkerT.h>

Inheritance diagram for art::WorkerT< T >:
art::Worker

Public Types

using ModuleType = T
 
- Public Types inherited from art::Worker
enum  State {
  Ready, Pass, Fail, Working,
  ExceptionThrown
}
 

Public Member Functions

 WorkerT (std::shared_ptr< T >, ModuleDescription const &, WorkerParams const &)
 
- Public Member Functions inherited from art::Worker
virtual ~Worker ()=default
 
 Worker (ModuleDescription const &, WorkerParams const &)
 
void beginJob (detail::SharedResources const &)
 
void endJob ()
 
void respondToOpenInputFile (FileBlock const &fb)
 
void respondToCloseInputFile (FileBlock const &fb)
 
void respondToOpenOutputFiles (FileBlock const &fb)
 
void respondToCloseOutputFiles (FileBlock const &fb)
 
bool doWork (Transition, Principal &, ModuleContext const &)
 
void doWork_event (hep::concurrency::WaitingTaskPtr workerInPathDoneTask, EventPrincipal &, ModuleContext const &)
 
void doWork_event (EventPrincipal &, ModuleContext const &)
 
ScheduleID scheduleID () const
 
ModuleDescription const & description () const
 
std::string const & label () const
 
bool returnCode () const
 
hep::concurrency::SerialTaskQueueChain * serialTaskQueueChain () const
 
void reset ()
 
std::size_t timesVisited () const
 
std::size_t timesRun () const
 
std::size_t timesPassed () const
 
std::size_t timesFailed () const
 
std::size_t timesExcept () const
 
void runWorker (EventPrincipal &, ModuleContext const &)
 

Protected Member Functions

T & module ()
 
T const & module () const
 

Private Member Functions

std::string workerType () const override
 
hep::concurrency::SerialTaskQueueChain * implSerialTaskQueueChain () const override
 
void implBeginJob (detail::SharedResources const &) override
 
void implEndJob () override
 
void implRespondToOpenInputFile (FileBlock const &) override
 
void implRespondToCloseInputFile (FileBlock const &) override
 
void implRespondToOpenOutputFiles (FileBlock const &) override
 
void implRespondToCloseOutputFiles (FileBlock const &) override
 
bool implDoBegin (RunPrincipal &, ModuleContext const &) override
 
bool implDoEnd (RunPrincipal &, ModuleContext const &) override
 
bool implDoBegin (SubRunPrincipal &, ModuleContext const &) override
 
bool implDoEnd (SubRunPrincipal &, ModuleContext const &) override
 
bool implDoProcess (EventPrincipal &, ModuleContext const &) override
 

Private Attributes

std::shared_ptr< T > module_
 

Friends

class PathManager
 

Additional Inherited Members

- Protected Attributes inherited from art::Worker
std::atomic< std::size_t > counts_visited_ {}
 
std::atomic< std::size_t > counts_run_ {}
 
std::atomic< std::size_t > counts_passed_ {}
 
std::atomic< std::size_t > counts_failed_ {}
 
std::atomic< std::size_t > counts_thrown_ {}
 

Detailed Description

template<typename T>
class art::WorkerT< T >

Definition at line 20 of file WorkerT.h.

Member Typedef Documentation

template<typename T>
using art::WorkerT< T >::ModuleType = T

Definition at line 25 of file WorkerT.h.

Constructor & Destructor Documentation

template<typename T>
art::WorkerT< T >::WorkerT ( std::shared_ptr< T >  module,
ModuleDescription const &  md,
WorkerParams const &  wp 
)

Definition at line 72 of file WorkerT.h.

75  : Worker{md, wp}, module_{module}
76  {
77  if (wp.scheduleID_ == ScheduleID::first()) {
78  // We only want to register the products (and any shared
79  // resources) once, not once for every schedule...
80  module_->registerProducts(wp.producedProducts_, md);
81  if constexpr (std::is_base_of_v<detail::SharedModule, T>) {
82  wp.resources_.registerSharedResources(module_->sharedResources());
83  }
84  } else {
85  // ...but we need to fill product descriptions for each module
86  // copy.
87  module_->fillDescriptions(md);
88  }
89  }
std::shared_ptr< T > module_
Definition: WorkerT.h:62
static constexpr ScheduleID first()
Definition: ScheduleID.h:50
Worker(ModuleDescription const &, WorkerParams const &)
Definition: Worker.cc:105
T & module()
Definition: WorkerT.h:33

Member Function Documentation

template<typename T >
void art::WorkerT< T >::implBeginJob ( detail::SharedResources const &  resources)
overrideprivatevirtual

Implements art::Worker.

Definition at line 110 of file WorkerT.h.

111  {
112  module_->doBeginJob(resources);
113  }
std::shared_ptr< T > module_
Definition: WorkerT.h:62
template<typename T >
bool art::WorkerT< T >::implDoBegin ( RunPrincipal rp,
ModuleContext const &  mc 
)
overrideprivatevirtual

Implements art::Worker.

Definition at line 152 of file WorkerT.h.

153  {
154  return module_->doBeginRun(rp, mc);
155  }
std::shared_ptr< T > module_
Definition: WorkerT.h:62
template<typename T >
bool art::WorkerT< T >::implDoBegin ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
overrideprivatevirtual

Implements art::Worker.

Definition at line 166 of file WorkerT.h.

167  {
168  return module_->doBeginSubRun(srp, mc);
169  }
std::shared_ptr< T > module_
Definition: WorkerT.h:62
template<typename T >
bool art::WorkerT< T >::implDoEnd ( RunPrincipal rp,
ModuleContext const &  mc 
)
overrideprivatevirtual

Implements art::Worker.

Definition at line 159 of file WorkerT.h.

160  {
161  return module_->doEndRun(rp, mc);
162  }
std::shared_ptr< T > module_
Definition: WorkerT.h:62
template<typename T >
bool art::WorkerT< T >::implDoEnd ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
overrideprivatevirtual

Implements art::Worker.

Definition at line 173 of file WorkerT.h.

174  {
175  return module_->doEndSubRun(srp, mc);
176  }
std::shared_ptr< T > module_
Definition: WorkerT.h:62
template<typename T >
bool art::WorkerT< T >::implDoProcess ( EventPrincipal ep,
ModuleContext const &  mc 
)
overrideprivatevirtual

Implements art::Worker.

Definition at line 180 of file WorkerT.h.

181  {
182  // Note, only filters ever return false, and when they do it means
183  // they have rejected.
184  return module_->doEvent(
186  }
std::shared_ptr< T > module_
Definition: WorkerT.h:62
std::atomic< std::size_t > counts_run_
Definition: Worker.h:147
std::atomic< std::size_t > counts_passed_
Definition: Worker.h:148
std::atomic< std::size_t > counts_failed_
Definition: Worker.h:149
template<typename T >
void art::WorkerT< T >::implEndJob ( )
overrideprivatevirtual

Implements art::Worker.

Definition at line 117 of file WorkerT.h.

118  {
119  module_->doEndJob();
120  }
std::shared_ptr< T > module_
Definition: WorkerT.h:62
template<typename T >
void art::WorkerT< T >::implRespondToCloseInputFile ( FileBlock const &  fb)
overrideprivatevirtual

Implements art::Worker.

Definition at line 131 of file WorkerT.h.

132  {
133  module_->doRespondToCloseInputFile(fb);
134  }
std::shared_ptr< T > module_
Definition: WorkerT.h:62
template<typename T >
void art::WorkerT< T >::implRespondToCloseOutputFiles ( FileBlock const &  fb)
overrideprivatevirtual

Implements art::Worker.

Definition at line 145 of file WorkerT.h.

146  {
147  module_->doRespondToCloseOutputFiles(fb);
148  }
std::shared_ptr< T > module_
Definition: WorkerT.h:62
template<typename T >
void art::WorkerT< T >::implRespondToOpenInputFile ( FileBlock const &  fb)
overrideprivatevirtual

Implements art::Worker.

Definition at line 124 of file WorkerT.h.

125  {
126  module_->doRespondToOpenInputFile(fb);
127  }
std::shared_ptr< T > module_
Definition: WorkerT.h:62
template<typename T >
void art::WorkerT< T >::implRespondToOpenOutputFiles ( FileBlock const &  fb)
overrideprivatevirtual

Implements art::Worker.

Definition at line 138 of file WorkerT.h.

139  {
140  module_->doRespondToOpenOutputFiles(fb);
141  }
std::shared_ptr< T > module_
Definition: WorkerT.h:62
template<typename T >
hep::concurrency::SerialTaskQueueChain * art::WorkerT< T >::implSerialTaskQueueChain ( ) const
overrideprivatevirtual

Implements art::Worker.

Definition at line 100 of file WorkerT.h.

101  {
102  if constexpr (std::is_base_of_v<detail::SharedModule, T>) {
103  return module_->serialTaskQueueChain();
104  }
105  return nullptr;
106  }
std::shared_ptr< T > module_
Definition: WorkerT.h:62
template<typename T>
T& art::WorkerT< T >::module ( )
inlineprotected

Definition at line 33 of file WorkerT.h.

34  {
35  return *module_;
36  }
std::shared_ptr< T > module_
Definition: WorkerT.h:62
template<typename T>
T const& art::WorkerT< T >::module ( ) const
inlineprotected

Definition at line 38 of file WorkerT.h.

39  {
40  return *module_;
41  }
std::shared_ptr< T > module_
Definition: WorkerT.h:62
template<typename T >
std::string art::WorkerT< T >::workerType ( ) const
overrideprivatevirtual

Implements art::Worker.

Definition at line 93 of file WorkerT.h.

94  {
95  return module_->workerType();
96  }
std::shared_ptr< T > module_
Definition: WorkerT.h:62

Friends And Related Function Documentation

template<typename T>
friend class PathManager
friend

Definition at line 22 of file WorkerT.h.

Member Data Documentation

template<typename T>
std::shared_ptr<T> art::WorkerT< T >::module_
private

Definition at line 62 of file WorkerT.h.


The documentation for this class was generated from the following file: