Free Electron
OrchestratorI.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #pragma once
8 
9 namespace fe
10 {
11 namespace ext
12 {
13 
14 typedef int t_note_id;
15 
16 class SystemI;
17 
18 typedef enum
19 {
20  e_step_none = 0,
21  e_step_dt = 1, ///< take a single time step
22  e_step_no_more_than, ///< as close as possible but not over via DT's
23  e_step_at_least, ///< as close as possible but not under via DT's
24  e_step_count,
25 } t_step_mode;
26 
27 /// @brief Orchestrate signalling of SystemI components
28 class FE_DL_EXPORT OrchestratorI
29  : virtual public Component,
30  public CastableAs<OrchestratorI>
31 {
32  public:
33  /** Signal SystemI's appended on matching id */
34 virtual void perform(const char *a_label) = 0;
35 virtual void perform(const t_note_id &a_note_id) = 0;
36 virtual t_note_id note_id(const char *a_label) = 0;
37 virtual t_note_id connect(SystemI *a_system, const char *a_label) = 0;
38 virtual t_note_id connect(sp<SystemI> a_system,
39  const char *a_label) = 0;
40 
41  /** Append a SystemI to be signaled. */
42 virtual void append(sp<SystemI> a_system) = 0;
43  /** Initialize based on a dataset */
44 virtual void datasetInitialize(sp<RecordGroup> a_rg_dataset) = 0;
45  /** Get the dataset */
46 virtual sp<RecordGroup> dataset(void) = 0;
47 
48  /** Set time step */
49 virtual void setDT(t_moa_real a_dt) = 0;
50  /** Get time step */
51 virtual t_moa_real getDT(void) = 0;
52  /** Step time. */
53 virtual void step(const t_step_mode &a_step_mode=e_step_dt,
54  t_moa_real a_time=0.0) = 0;
55  /** Get time */
56 virtual t_moa_real getTime(void) = 0;
57 
58 typedef std::function<void(const t_note_id &)> t_note_perform;
59 virtual t_note_id connect(t_note_perform a_perform, const char *a_label) = 0;
60 
61  template <class F, class S>
62  t_note_id connect(S *s, F&& f, const char *a_label)
63  {
64  t_note_perform fn = std::bind(f, s, std::placeholders::_1);
65  return connect(fn, a_label);
66  }
67 
68  /** Compile internal structures of systems.
69  */
70 virtual bool compile(void) = 0;
71 };
72 
73 } /* namespace ext */
74 } /* namespace fe */
Orchestrate signalling of SystemI components.
Definition: OrchestratorI.h:28
as close as possible but not under via DT&#39;s
Definition: OrchestratorI.h:23
kernel
Definition: namespace.dox:3
t_step_mode
Definition: OrchestratorI.h:18
as close as possible but not over via DT&#39;s
Definition: OrchestratorI.h:22
take a single time step
Definition: OrchestratorI.h:21
Base for all interfacable components.
Definition: Component.h:20
Intrusive Smart Pointer.
Definition: src/core/ptr.h:53
System Interface for MOA.
Definition: SystemI.h:18
Per-class participation non-RTTI fallback dynamic casting mechanism.
Definition: Castable.h:192