23 template <
typename Prod_actor,
typename Filt_actor,
typename Cons_actor>
27 Prod_actor *fProducer;
29 Cons_actor *fConsumer;
36 std::string fPathProd;
37 std::string fPathFilt;
38 std::string fPathCons;
56 virtual Bool_t
Init(
const Char_t *rootafp)
60 virtual Bool_t
Init(Int_t which_run,
const char *experiment,
const char *which_adf_data,
const char *run_pat, Option_t *opt_adf_pattern)
65 virtual Bool_t Init();
66 virtual Bool_t Run(UInt_t max_loop =
kMaxUInt_t);
69 template <
typename Prod_actor,
typename Filt_actor,
typename Cons_actor>
83 template <
typename Prod_actor,
typename Filt_actor,
typename Cons_actor>
94 template <
typename Prod_actor,
typename Filt_actor,
typename Cons_actor>
100 NarvalInterface::process_config(fPathProd.data(),&err);
107 Prod_actor::process_config(fPathProd.data(),&err);
111 fProducer =
new Prod_actor();
112 fProducer->process_initialise(&err);
118 Filt_actor::process_config(fPathFilt.data(),&err);
122 fFilter =
new Filt_actor() ;
123 fFilter->process_initialise(&err);
129 Cons_actor::process_config(fPathCons.data(),&err);
133 fConsumer =
new Cons_actor();
134 fConsumer->process_initialise(&err);
143 template <
typename Prod_actor,
typename Filt_actor,
typename Cons_actor>
146 printf(
"************** EMULATOR MAIN LOOP ************** \n");
149 UInt_t nb_loop = 0u, err = 0u, nb_try = 0;
150 while ( err == 0u ) {
154 int Prodstatus = fProducer->ProcessBlock(fBProd);
155 int ProdSize = fBProd.GetSize();
161 if ( ProdSize == 0u ) {
172 int Filterstatus = fFilter->ProcessBlock(fBProd,fBFilt);
173 int FilterSize = fBFilt.GetSize();
178 if ( FilterSize == 0u )
break;
180 int ConsStatus = fConsumer->ProcessBlock(fBFilt);
184 if(Prodstatus != 0 || Filterstatus !=0 || ConsStatus != 0u)
break;
187 if ( nb_loop == max_loop )
190 printf(
"nb_loop %d error %d\n",nb_loop,err);
191 printf(
"************** EMULATOR MAIN LOOP ************** \n");
194 if(StogsProd) StogsProd->
Print();
199 template <
typename Prod_actor,
typename Cons_actor>
203 Prod_actor *fProducer;
204 Cons_actor *fConsumer;
210 std::string fPathProd;
211 std::string fPathCons;
219 {
return fProducer; }
222 {
return fConsumer; }
225 {
return fConsumer; }
228 {
return fProducer; }
231 virtual Bool_t
Init(
const Char_t *rootafp)
235 virtual Bool_t
Init(Int_t which_run,
const char *experiment,
const char *which_adf_data,
const char *run_name_pattern, Option_t *opt_adf_pattern)
239 virtual Bool_t
Init();
243 template <
typename Prod_actor,
typename Cons_actor>
255 template <
typename Prod_actor,
typename Cons_actor>
264 template <
typename Prod_actor,
typename Cons_actor>
270 NarvalInterface::process_config(fPathProd.data(),&err);
277 Prod_actor::process_config(fPathProd.data(),&err);
281 fProducer =
new Prod_actor();
282 fProducer->process_initialise(&err);
288 Cons_actor::process_config(fPathCons.data(),&err);
292 fConsumer =
new Cons_actor();
293 fConsumer->process_initialise(&err);
301 template <
typename Prod_actor,
typename Cons_actor>
304 printf(
"\n*********** EMULATOR MAIN LOOP : START ... \n\n");
306 UInt_t nb_loop = 0u, err = 0u, nb_try = 0;
307 while ( err == 0u ) {
310 if ( fProducer->ProcessBlock(fBProd) != 0u )
312 fConsumer->ProcessBlock(fBProd);
315 if ( fBProd.GetSize() == 0u ) {
329 if ( fConsumer->ProcessBlock(fBProd) != 0u )
333 if ( nb_loop == max_loop )
336 printf(
"\n*********** EMULATOR MAIN LOOP : ... STOP after %d loops (error %d)\n\n",nb_loop,err);
339 if(StogsProd) StogsProd->
Print();
NarvalProducer * GetBaseProducer()
virtual Bool_t Run(UInt_t max_loop=kMaxUInt_t)
loop
printf("******************************************************************** \n")
header file for FrameBlock.cpp
It defines the interface needed to be a narval actor (producer).
It implements an expandable block of Frame.
EmulatorPC(const char *path, UInt_t bsize=aMByte)
Prod_actor * GetProducer()
virtual Bool_t Run(UInt_t max_loop=kMaxUInt_t)
loop
virtual Bool_t Init()
It should be overwritten !
virtual Bool_t Init(Int_t which_run, const char *experiment, const char *which_adf_data, const char *run_name_pattern, Option_t *opt_adf_pattern)
NarvalProducer * GetBaseProducer()
Cons_actor * GetConsumer()
EmulatorPFC(const char *path, UInt_t bsize=aMByte)
virtual Bool_t Init()
It should be overwritten !
virtual Bool_t Init(const Char_t *rootafp)
Init the emulator using a different root afp file for the producer.
NarvalConsumer * GetBaseConsumer()
It defines the interface needed to be a consumer.
to have a common base class to be able to control the emulator through a TTask
virtual Bool_t Init(Int_t which_run, const char *experiment, const char *which_adf_data, const char *run_pat, Option_t *opt_adf_pattern)
NarvalConsumer * GetBaseConsumer()
virtual Bool_t Init(const Char_t *rootafp)
Init the emulator using a different root afp file for the producer.
Cons_actor * GetConsumer()
virtual Bool_t Init()
It should be overwritten !
It implements an in-memory block of Frames.