artdaq  v3_10_02
Commandable_sm.cpp
1 //
2 // ex: set ro:
3 // DO NOT EDIT.
4 // generated by smc (http://smc.sourceforge.net/)
5 // from file : Commandable.sm
6 //
7 
8 #include "artdaq/Application/detail/Commandable_sm.h"
9 #include "artdaq/Application/Commandable.hh"
10 
11 using namespace statemap;
12 
13 #pragma GCC diagnostic push
14 #pragma GCC diagnostic ignored "-Wunused-parameter"
15 
16 namespace artdaq {
17 // Static class declarations.
18 Main_Booted Main::Booted("Main::Booted", 0);
19 Main_Initialized Main::Initialized("Main::Initialized", 1);
20 InitializedMap_Ready InitializedMap::Ready("InitializedMap::Ready", 2);
21 InitializedMap_InRun InitializedMap::InRun("InitializedMap::InRun", 3);
22 InRunMap_Running InRunMap::Running("InRunMap::Running", 4);
23 InRunMap_Paused InRunMap::Paused("InRunMap::Paused", 5);
24 InRunMap_InRunError InRunMap::InRunError("InRunMap::InRunError", 6);
25 
26 void CommandableState::in_run_failure(CommandableContext& context)
27 {
28  Default(context);
29 }
30 
31 void CommandableState::init(CommandableContext& context, fhicl::ParameterSet const& pset, uint64_t timeout, uint64_t timestamp)
32 {
33  Default(context);
34 }
35 
36 void CommandableState::pause(CommandableContext& context, uint64_t timeout, uint64_t timestamp)
37 {
38  Default(context);
39 }
40 
41 void CommandableState::reinit(CommandableContext& context, fhicl::ParameterSet const& pset, uint64_t timeout, uint64_t timestamp)
42 {
43  Default(context);
44 }
45 
46 void CommandableState::resume(CommandableContext& context, uint64_t timeout, uint64_t timestamp)
47 {
48  Default(context);
49 }
50 
51 void CommandableState::shutdown(CommandableContext& context, uint64_t timeout)
52 {
53  Default(context);
54 }
55 
56 void CommandableState::soft_init(CommandableContext& context, fhicl::ParameterSet const& pset, uint64_t timeout, uint64_t timestamp)
57 {
58  Default(context);
59 }
60 
61 void CommandableState::start(CommandableContext& context, art::RunID id, uint64_t timeout, uint64_t timestamp)
62 {
63  Default(context);
64 }
65 
66 void CommandableState::stop(CommandableContext& context, uint64_t timeout, uint64_t timestamp)
67 {
68  Default(context);
69 }
70 
71 void CommandableState::Default(CommandableContext& context)
72 {
73  throw(
75  context.getState().getName(),
76  context.getTransition()));
77 }
78 
79 void Main_Default::init(CommandableContext& context, fhicl::ParameterSet const& pset, uint64_t timeout, uint64_t timestamp)
80 {
81  Commandable& ctxt = context.getOwner();
82 
83  CommandableState& endState = context.getState();
84 
85  context.clearState();
86  try
87  {
88  ctxt.badTransition(__func__);
89  context.setState(endState);
90  }
91  catch (...)
92  {
93  context.setState(endState);
94  throw;
95  }
96 }
97 
98 void Main_Default::start(CommandableContext& context, art::RunID id, uint64_t timeout, uint64_t timestamp)
99 {
100  Commandable& ctxt = context.getOwner();
101 
102  CommandableState& endState = context.getState();
103 
104  context.clearState();
105  try
106  {
107  ctxt.badTransition(__func__);
108  context.setState(endState);
109  }
110  catch (...)
111  {
112  context.setState(endState);
113  throw;
114  }
115 }
116 
117 void Main_Default::stop(CommandableContext& context, uint64_t timeout, uint64_t timestamp)
118 {
119  Commandable& ctxt = context.getOwner();
120 
121  CommandableState& endState = context.getState();
122 
123  context.clearState();
124  try
125  {
126  ctxt.badTransition(__func__);
127  context.setState(endState);
128  }
129  catch (...)
130  {
131  context.setState(endState);
132  throw;
133  }
134 }
135 
136 void Main_Default::pause(CommandableContext& context, uint64_t timeout, uint64_t timestamp)
137 {
138  Commandable& ctxt = context.getOwner();
139 
140  CommandableState& endState = context.getState();
141 
142  context.clearState();
143  try
144  {
145  ctxt.badTransition(__func__);
146  context.setState(endState);
147  }
148  catch (...)
149  {
150  context.setState(endState);
151  throw;
152  }
153 }
154 
155 void Main_Default::resume(CommandableContext& context, uint64_t timeout, uint64_t timestamp)
156 {
157  Commandable& ctxt = context.getOwner();
158 
159  CommandableState& endState = context.getState();
160 
161  context.clearState();
162  try
163  {
164  ctxt.badTransition(__func__);
165  context.setState(endState);
166  }
167  catch (...)
168  {
169  context.setState(endState);
170  throw;
171  }
172 }
173 
174 void Main_Default::shutdown(CommandableContext& context, uint64_t timeout)
175 {
176  Commandable& ctxt = context.getOwner();
177 
178  CommandableState& endState = context.getState();
179 
180  context.clearState();
181  try
182  {
183  ctxt.badTransition(__func__);
184  context.setState(endState);
185  }
186  catch (...)
187  {
188  context.setState(endState);
189  throw;
190  }
191 }
192 
193 void Main_Default::soft_init(CommandableContext& context, fhicl::ParameterSet const& pset, uint64_t timeout, uint64_t timestamp)
194 {
195  Commandable& ctxt = context.getOwner();
196 
197  CommandableState& endState = context.getState();
198 
199  context.clearState();
200  try
201  {
202  ctxt.badTransition(__func__);
203  context.setState(endState);
204  }
205  catch (...)
206  {
207  context.setState(endState);
208  throw;
209  }
210 }
211 
212 void Main_Default::reinit(CommandableContext& context, fhicl::ParameterSet const& pset, uint64_t timeout, uint64_t timestamp)
213 {
214  Commandable& ctxt = context.getOwner();
215 
216  CommandableState& endState = context.getState();
217 
218  context.clearState();
219  try
220  {
221  ctxt.badTransition(__func__);
222  context.setState(endState);
223  }
224  catch (...)
225  {
226  context.setState(endState);
227  throw;
228  }
229 }
230 
231 void Main_Booted::Entry(CommandableContext& context)
232 
233 {
234  Commandable& ctxt = context.getOwner();
235 
236  ctxt.BootedEnter();
237 }
238 
239 void Main_Booted::init(CommandableContext& context, fhicl::ParameterSet const& pset, uint64_t timeout, uint64_t timestamp)
240 {
241  Commandable& ctxt = context.getOwner();
242 
243  if (ctxt.do_initialize(pset, timeout, timestamp))
244  {
245  context.getState().Exit(context);
246  // No actions.
247  context.setState(Main::Initialized);
248 
249  context.getState().Entry(context);
250  context.pushState(InitializedMap::Ready);
251  context.getState().Entry(context);
252  }
253  else
254  {
255  }
256 }
257 
258 void Main_Booted::reinit(CommandableContext& context, fhicl::ParameterSet const& pset, uint64_t timeout, uint64_t timestamp)
259 {
260  Commandable& ctxt = context.getOwner();
261 
262  if (ctxt.do_initialize(pset, timeout, timestamp))
263  {
264  context.getState().Exit(context);
265  // No actions.
266  context.setState(Main::Initialized);
267 
268  context.getState().Entry(context);
269  context.pushState(InitializedMap::Ready);
270  context.getState().Entry(context);
271  }
272  else
273  {
274  }
275 }
276 
277 void Main_Booted::shutdown(CommandableContext& context, uint64_t timeout)
278 {
279  context.getState().Exit(context);
280  context.setState(Main::Booted);
281  context.getState().Entry(context);
282 }
283 
284 void Main_Initialized::init(CommandableContext& context, fhicl::ParameterSet const& pset, uint64_t timeout, uint64_t timestamp)
285 {
286  Commandable& ctxt = context.getOwner();
287 
288  if (ctxt.do_initialize(pset, timeout, timestamp))
289  {
290  context.getState().Exit(context);
291  // No actions.
292  context.setState(Main::Initialized);
293 
294  context.getState().Entry(context);
295  context.pushState(InitializedMap::Ready);
296  context.getState().Entry(context);
297  }
298  else
299  {
300  context.getState().Exit(context);
301  context.setState(Main::Booted);
302  context.getState().Entry(context);
303  }
304 }
305 
306 void Main_Initialized::reinit(CommandableContext& context, fhicl::ParameterSet const& pset, uint64_t timeout, uint64_t timestamp)
307 {
308  Commandable& ctxt = context.getOwner();
309 
310  if (ctxt.do_initialize(pset, timeout, timestamp))
311  {
312  context.getState().Exit(context);
313  // No actions.
314  context.setState(Main::Initialized);
315 
316  context.getState().Entry(context);
317  context.pushState(InitializedMap::Ready);
318  context.getState().Entry(context);
319  }
320  else
321  {
322  context.getState().Exit(context);
323  context.setState(Main::Booted);
324  context.getState().Entry(context);
325  }
326 }
327 
328 void Main_Initialized::shutdown(CommandableContext& context, uint64_t timeout)
329 {
330  Commandable& ctxt = context.getOwner();
331 
332  if (ctxt.do_shutdown(timeout))
333  {
334  context.getState().Exit(context);
335  // No actions.
336  context.setState(Main::Booted);
337  context.getState().Entry(context);
338  }
339  else
340  {
341  Main_Default::shutdown(context, timeout);
342  }
343 }
344 
345 void InitializedMap_Default::init(CommandableContext& context, fhicl::ParameterSet const& pset, uint64_t timeout, uint64_t timestamp)
346 {
347  Commandable& ctxt = context.getOwner();
348 
349  CommandableState& endState = context.getState();
350 
351  context.clearState();
352  try
353  {
354  ctxt.badTransition(__func__);
355  context.setState(endState);
356  }
357  catch (...)
358  {
359  context.setState(endState);
360  throw;
361  }
362 }
363 
364 void InitializedMap_Default::start(CommandableContext& context, art::RunID id, uint64_t timeout, uint64_t timestamp)
365 {
366  Commandable& ctxt = context.getOwner();
367 
368  CommandableState& endState = context.getState();
369 
370  context.clearState();
371  try
372  {
373  ctxt.badTransition(__func__);
374  context.setState(endState);
375  }
376  catch (...)
377  {
378  context.setState(endState);
379  throw;
380  }
381 }
382 
383 void InitializedMap_Default::stop(CommandableContext& context, uint64_t timeout, uint64_t timestamp)
384 {
385  Commandable& ctxt = context.getOwner();
386 
387  CommandableState& endState = context.getState();
388 
389  context.clearState();
390  try
391  {
392  ctxt.badTransition(__func__);
393  context.setState(endState);
394  }
395  catch (...)
396  {
397  context.setState(endState);
398  throw;
399  }
400 }
401 
402 void InitializedMap_Default::pause(CommandableContext& context, uint64_t timeout, uint64_t timestamp)
403 {
404  Commandable& ctxt = context.getOwner();
405 
406  CommandableState& endState = context.getState();
407 
408  context.clearState();
409  try
410  {
411  ctxt.badTransition(__func__);
412  context.setState(endState);
413  }
414  catch (...)
415  {
416  context.setState(endState);
417  throw;
418  }
419 }
420 
421 void InitializedMap_Default::resume(CommandableContext& context, uint64_t timeout, uint64_t timestamp)
422 {
423  Commandable& ctxt = context.getOwner();
424 
425  CommandableState& endState = context.getState();
426 
427  context.clearState();
428  try
429  {
430  ctxt.badTransition(__func__);
431  context.setState(endState);
432  }
433  catch (...)
434  {
435  context.setState(endState);
436  throw;
437  }
438 }
439 
440 void InitializedMap_Default::shutdown(CommandableContext& context, uint64_t timeout)
441 {
442  Commandable& ctxt = context.getOwner();
443 
444  CommandableState& endState = context.getState();
445 
446  context.clearState();
447  try
448  {
449  ctxt.badTransition(__func__);
450  context.setState(endState);
451  }
452  catch (...)
453  {
454  context.setState(endState);
455  throw;
456  }
457 }
458 
459 void InitializedMap_Default::soft_init(CommandableContext& context, fhicl::ParameterSet const& pset, uint64_t timeout, uint64_t timestamp)
460 {
461  Commandable& ctxt = context.getOwner();
462 
463  CommandableState& endState = context.getState();
464 
465  context.clearState();
466  try
467  {
468  ctxt.badTransition(__func__);
469  context.setState(endState);
470  }
471  catch (...)
472  {
473  context.setState(endState);
474  throw;
475  }
476 }
477 
478 void InitializedMap_Default::reinit(CommandableContext& context, fhicl::ParameterSet const& pset, uint64_t timeout, uint64_t timestamp)
479 {
480  Commandable& ctxt = context.getOwner();
481 
482  CommandableState& endState = context.getState();
483 
484  context.clearState();
485  try
486  {
487  ctxt.badTransition(__func__);
488  context.setState(endState);
489  }
490  catch (...)
491  {
492  context.setState(endState);
493  throw;
494  }
495 }
496 
497 void InitializedMap_Ready::init(CommandableContext& context, fhicl::ParameterSet const& pset, uint64_t timeout, uint64_t timestamp)
498 {
499  context.getState().Exit(context);
500  context.popState();
501  context.init(pset, timeout, timestamp);
502 }
503 
504 void InitializedMap_Ready::reinit(CommandableContext& context, fhicl::ParameterSet const& pset, uint64_t timeout, uint64_t timestamp)
505 {
506  Commandable& ctxt = context.getOwner();
507 
508  CommandableState& endState = context.getState();
509 
510  context.clearState();
511  try
512  {
513  ctxt.do_reinitialize(pset, timeout, timestamp);
514  context.setState(endState);
515  }
516  catch (...)
517  {
518  context.setState(endState);
519  throw;
520  }
521 }
522 
523 void InitializedMap_Ready::shutdown(CommandableContext& context, uint64_t timeout)
524 {
525  context.getState().Exit(context);
526  context.popState();
527  context.shutdown(timeout);
528 }
529 
530 void InitializedMap_Ready::soft_init(CommandableContext& context, fhicl::ParameterSet const& pset, uint64_t timeout, uint64_t timestamp)
531 {
532  Commandable& ctxt = context.getOwner();
533 
534  CommandableState& endState = context.getState();
535 
536  context.clearState();
537  try
538  {
539  ctxt.do_soft_initialize(pset, timeout, timestamp);
540  context.setState(endState);
541  }
542  catch (...)
543  {
544  context.setState(endState);
545  throw;
546  }
547 }
548 
549 void InitializedMap_Ready::start(CommandableContext& context, art::RunID id, uint64_t timeout, uint64_t timestamp)
550 {
551  Commandable& ctxt = context.getOwner();
552 
553  if (ctxt.do_start(id, timeout, timestamp))
554  {
555  context.getState().Exit(context);
556  // No actions.
557  context.setState(InitializedMap::InRun);
558 
559  context.getState().Entry(context);
560  context.pushState(InRunMap::Running);
561  context.getState().Entry(context);
562  }
563  else
564  {
565  }
566 }
567 
568 void InitializedMap_InRun::Exit(CommandableContext& context)
569 
570 {
571  Commandable& ctxt = context.getOwner();
572 
573  ctxt.InRunExit();
574 }
575 
576 void InitializedMap_InRun::stop(CommandableContext& context, uint64_t timeout, uint64_t timestamp)
577 {
578  Commandable& ctxt = context.getOwner();
579 
580  if (ctxt.do_stop(timeout, timestamp))
581  {
582  context.getState().Exit(context);
583  // No actions.
584  context.setState(InitializedMap::Ready);
585  context.getState().Entry(context);
586  }
587  else
588  {
589  InitializedMap_Default::stop(context, timeout, timestamp);
590  }
591 }
592 
593 void InRunMap_Default::init(CommandableContext& context, fhicl::ParameterSet const& pset, uint64_t timeout, uint64_t timestamp)
594 {
595  Commandable& ctxt = context.getOwner();
596 
597  CommandableState& endState = context.getState();
598 
599  context.clearState();
600  try
601  {
602  ctxt.badTransition(__func__);
603  context.setState(endState);
604  }
605  catch (...)
606  {
607  context.setState(endState);
608  throw;
609  }
610 }
611 
612 void InRunMap_Default::start(CommandableContext& context, art::RunID id, uint64_t timeout, uint64_t timestamp)
613 {
614  Commandable& ctxt = context.getOwner();
615 
616  CommandableState& endState = context.getState();
617 
618  context.clearState();
619  try
620  {
621  ctxt.badTransition(__func__);
622  context.setState(endState);
623  }
624  catch (...)
625  {
626  context.setState(endState);
627  throw;
628  }
629 }
630 
631 void InRunMap_Default::stop(CommandableContext& context, uint64_t timeout, uint64_t timestamp)
632 {
633  Commandable& ctxt = context.getOwner();
634 
635  CommandableState& endState = context.getState();
636 
637  context.clearState();
638  try
639  {
640  ctxt.badTransition(__func__);
641  context.setState(endState);
642  }
643  catch (...)
644  {
645  context.setState(endState);
646  throw;
647  }
648 }
649 
650 void InRunMap_Default::pause(CommandableContext& context, uint64_t timeout, uint64_t timestamp)
651 {
652  Commandable& ctxt = context.getOwner();
653 
654  CommandableState& endState = context.getState();
655 
656  context.clearState();
657  try
658  {
659  ctxt.badTransition(__func__);
660  context.setState(endState);
661  }
662  catch (...)
663  {
664  context.setState(endState);
665  throw;
666  }
667 }
668 
669 void InRunMap_Default::resume(CommandableContext& context, uint64_t timeout, uint64_t timestamp)
670 {
671  Commandable& ctxt = context.getOwner();
672 
673  CommandableState& endState = context.getState();
674 
675  context.clearState();
676  try
677  {
678  ctxt.badTransition(__func__);
679  context.setState(endState);
680  }
681  catch (...)
682  {
683  context.setState(endState);
684  throw;
685  }
686 }
687 
688 void InRunMap_Default::shutdown(CommandableContext& context, uint64_t timeout)
689 {
690  Commandable& ctxt = context.getOwner();
691 
692  CommandableState& endState = context.getState();
693 
694  context.clearState();
695  try
696  {
697  ctxt.badTransition(__func__);
698  context.setState(endState);
699  }
700  catch (...)
701  {
702  context.setState(endState);
703  throw;
704  }
705 }
706 
707 void InRunMap_Default::soft_init(CommandableContext& context, fhicl::ParameterSet const& pset, uint64_t timeout, uint64_t timestamp)
708 {
709  Commandable& ctxt = context.getOwner();
710 
711  CommandableState& endState = context.getState();
712 
713  context.clearState();
714  try
715  {
716  ctxt.badTransition(__func__);
717  context.setState(endState);
718  }
719  catch (...)
720  {
721  context.setState(endState);
722  throw;
723  }
724 }
725 
726 void InRunMap_Default::reinit(CommandableContext& context, fhicl::ParameterSet const& pset, uint64_t timeout, uint64_t timestamp)
727 {
728  Commandable& ctxt = context.getOwner();
729 
730  CommandableState& endState = context.getState();
731 
732  context.clearState();
733  try
734  {
735  ctxt.badTransition(__func__);
736  context.setState(endState);
737  }
738  catch (...)
739  {
740  context.setState(endState);
741  throw;
742  }
743 }
744 
745 void InRunMap_Running::in_run_failure(CommandableContext& context)
746 {
747  context.getState().Exit(context);
748  context.setState(InRunMap::InRunError);
749  context.getState().Entry(context);
750 }
751 
752 void InRunMap_Running::pause(CommandableContext& context, uint64_t timeout, uint64_t timestamp)
753 {
754  Commandable& ctxt = context.getOwner();
755 
756  if (ctxt.do_pause(timeout, timestamp))
757  {
758  context.getState().Exit(context);
759  // No actions.
760  context.setState(InRunMap::Paused);
761  context.getState().Entry(context);
762  }
763  else
764  {
765  }
766 }
767 
768 void InRunMap_Running::stop(CommandableContext& context, uint64_t timeout, uint64_t timestamp)
769 {
770  context.getState().Exit(context);
771  context.popState();
772  context.stop(timeout, timestamp);
773 }
774 
775 void InRunMap_Paused::resume(CommandableContext& context, uint64_t timeout, uint64_t timestamp)
776 {
777  Commandable& ctxt = context.getOwner();
778 
779  if (ctxt.do_resume(timeout, timestamp))
780  {
781  context.getState().Exit(context);
782  // No actions.
783  context.setState(InRunMap::Running);
784  context.getState().Entry(context);
785  }
786  else
787  {
788  }
789 }
790 
791 void InRunMap_Paused::stop(CommandableContext& context, uint64_t timeout, uint64_t timestamp)
792 {
793  context.getState().Exit(context);
794  context.popState();
795  context.stop(timeout, timestamp);
796 }
797 
798 void InRunMap_InRunError::pause(CommandableContext& context, uint64_t timeout, uint64_t timestamp)
799 {
800  Commandable& ctxt = context.getOwner();
801 
802  if (ctxt.do_pause(timeout, timestamp))
803  {
804  context.getState().Exit(context);
805  // No actions.
806  context.setState(InRunMap::Paused);
807  context.getState().Entry(context);
808  }
809  else
810  {
811  }
812 }
813 
814 void InRunMap_InRunError::stop(CommandableContext& context, uint64_t timeout, uint64_t timestamp)
815 {
816  context.getState().Exit(context);
817  context.popState();
818  context.stop(timeout, timestamp);
819 }
820 } // namespace artdaq
821 
822 #pragma GCC diagnostic pop
823 //
824 // Local variables:
825 // buffer-read-only: t
826 // End:
827 //