DABC (Data Acquisition Backbone Core)  2.9.9
RunModule.h
Go to the documentation of this file.
1 // $Id: RunModule.h 4601 2020-10-02 09:11:11Z linev $
2 
3 /************************************************************
4  * The Data Acquisition Backbone Core (DABC) *
5  ************************************************************
6  * Copyright (C) 2009 - *
7  * GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
8  * Planckstr. 1, 64291 Darmstadt, Germany *
9  * Contact: http://dabc.gsi.de *
10  ************************************************************
11  * This software can be used under the GPL license *
12  * agreements as stated in LICENSE.txt file *
13  * which is part of the distribution. *
14  ************************************************************/
15 
16 #ifndef STREAM_RunModule
17 #define STREAM_RunModule
18 
19 #ifndef DABC_ModuleAsync
20 #include "dabc/ModuleAsync.h"
21 #endif
22 
23 #include "dabc/timing.h"
24 
25 
26 namespace stream {
27 
28  class DabcProcMgr;
29 
30 
36  class RunModule : public dabc::ModuleAsync {
37 
38  protected:
39  int fParallel;
40  void *fInitFunc;
41  int fStopMode;
43  std::string fAsf;
44  std::string fFileUrl;
45  bool fDidMerge;
46  long unsigned fTotalSize;
47  long unsigned fTotalEvnts;
48  long unsigned fTotalOutEvnts;
50 
51  virtual int ExecuteCommand(dabc::Command cmd);
52 
53  virtual void OnThreadAssigned();
54 
55  bool ProcessNextEvent(void* evnt, unsigned evntsize);
56 
57  bool ProcessNextBuffer();
58 
59  bool RedistributeBuffers();
60 
62 
63  void SaveHierarchy(dabc::Buffer buf);
64 
65  void GenerateEOF(dabc::Buffer buf);
66 
67  public:
68  RunModule(const std::string &name, dabc::Command cmd = nullptr);
69  virtual ~RunModule();
70 
71  virtual bool ProcessRecv(unsigned port);
72 
73  virtual bool ProcessSend(unsigned) { return RedistributeBuffers(); }
74 
75  virtual void ProcessTimerEvent(unsigned);
76 
77  virtual void BeforeModuleStart();
78 
79  virtual void AfterModuleStop();
80  };
81 }
82 
83 
84 #endif
Reference on memory from memory pool.
Definition: Buffer.h:135
Represents command with its arguments.
Definition: Command.h:99
Base class for user-derived code, implementing event-processing.
Definition: ModuleAsync.h:32
Runs code of stream framework.
Definition: RunModule.h:36
void * fInitFunc
how many parallel processes to start
Definition: RunModule.h:40
virtual bool ProcessRecv(unsigned port)
Method called by framework when at least one buffer available in input port.
Definition: RunModule.cxx:567
void GenerateEOF(dabc::Buffer buf)
Definition: RunModule.cxx:505
virtual void AfterModuleStop()
Definition: RunModule.cxx:413
virtual void BeforeModuleStart()
Definition: RunModule.cxx:379
virtual bool ProcessSend(unsigned)
Method called by framework when at least one buffer can be send to output port.
Definition: RunModule.h:73
virtual int ExecuteCommand(dabc::Command cmd)
Main method where commands are executed.
Definition: RunModule.cxx:328
virtual void ProcessTimerEvent(unsigned)
Method called by framework when timer event is produced.
Definition: RunModule.cxx:575
bool ProcessNextEvent(void *evnt, unsigned evntsize)
Definition: RunModule.cxx:430
std::string fFileUrl
! configured file URL - module used to produce output
Definition: RunModule.h:44
virtual void OnThreadAssigned()
Definition: RunModule.cxx:193
bool RedistributeBuffers()
Definition: RunModule.cxx:517
int fDefaultFill
! default fill color for 1-D histograms
Definition: RunModule.h:49
virtual ~RunModule()
Definition: RunModule.cxx:182
bool ProcessNextBuffer()
Definition: RunModule.cxx:470
long unsigned fTotalSize
Definition: RunModule.h:46
long unsigned fTotalEvnts
Definition: RunModule.h:47
DabcProcMgr * fProcMgr
for central module waiting that others finish
Definition: RunModule.h:42
std::string fAsf
Definition: RunModule.h:43
RunModule(const std::string &name, dabc::Command cmd=nullptr)
Definition: RunModule.cxx:42
int fStopMode
init function
Definition: RunModule.h:41
void SaveHierarchy(dabc::Buffer buf)
Definition: RunModule.cxx:386
void ProduceMergedHierarchy()
Definition: RunModule.cxx:259
long unsigned fTotalOutEvnts
Definition: RunModule.h:48
Support for stream framework in DABC
Definition: DabcProcMgr.h:25