Lumiera  0.pre.03
»edit your freedom«
activity-lang.hpp
Go to the documentation of this file.
1 /*
2  ACTIVITY-LANG.hpp - definition language framework for scheduler activities
3 
4  Copyright (C)
5  2023, Hermann Vosseler <Ichthyostega@web.de>
6 
7   **Lumiera** is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published by the
9   Free Software Foundation; either version 2 of the License, or (at your
10   option) any later version. See the file COPYING for further details.
11 
12 */
13 
14 
28 #ifndef SRC_VAULT_GEAR_ACTIVITY_LANG_H_
29 #define SRC_VAULT_GEAR_ACTIVITY_LANG_H_
30 
31 
32 #include "vault/gear/activity.hpp"
35 
36 
37 namespace vault{
38 namespace gear {
39 
40  using BlockFlowAlloc = BlockFlow<blockFlow::RenderConfig>;
41 
42 
43 
44  /*************************************************************************************/
70  {
71  BlockFlowAlloc& mem_;
72 
73  public:
74  explicit
75  ActivityLang (BlockFlowAlloc& memManager)
76  : mem_{memManager}
77  { }
78 
79  // using default copy/assignment
80 
81 
86  buildCalculationJob (Job job, Time start, Time deadline)
87  {
88  return setupActivityScheme (activity::Term::CALC_JOB, job, start, deadline);
89  }
90 
95  buildAsyncLoadJob (Job job, Time start, Time deadline)
96  {
97  return setupActivityScheme (activity::Term::LOAD_JOB, job, start, deadline);
98  }
99 
104  buildMetaJob (Job job, Time start, Time deadline)
105  {
106  return setupActivityScheme (activity::Term::META_JOB, job, start, deadline);
107  }
108 
109 
111  Activity& createTick (Time deadline){ return mem_.until(deadline).create (Activity::TICK); }
112 
114  void discardBefore (Time deadline) { mem_.discardBefore (deadline); }
115 
118 
119 
123  template<class EXE>
124  static activity::Proc
125  dispatchChain (Activity* chain, EXE& executionCtx)
126  {
127  if (!chain) return activity::PASS;
128  activity::Proc res = chain->dispatch (executionCtx.getSchedTime(), executionCtx);
129  if (activity::PASS == res)
130  res = activateChain (chain->next, executionCtx);
131  else if (activity::SKIP == res)
132  res = activity::PASS;
133  return res;
134  }
135 
139  template<class EXE>
140  static activity::Proc
141  activateChain (Activity* chain, EXE& executionCtx)
142  {
143  activity::Proc res{activity::PASS};
144  while (chain and activity::PASS == res)
145  {
146  res = chain->activate (executionCtx.getSchedTime(), executionCtx);
147  chain = chain->next;
148  }
149  if (activity::SKIP == res)// SKIP has been handled
150  res = activity::PASS; // just by aborting the loop
151  return res;
152  }
153 
154  private:
158  {
159  return activity::Term{ mem_.until(dead)
160  , schemeKind
161  , start
162  , dead
163  , job
164  };
165  }
166  };
167 
168 
169 }} // namespace vault::gear
170 #endif /*SRC_VAULT_GEAR_ACTIVITY_LANG_H_*/
Record to describe an Activity, to happen within the Scheduler&#39;s control flow.
Definition: activity.hpp:226
activity::Term buildCalculationJob(Job job, Time start, Time deadline)
Builder-API: initiate definition of render activities for a media calculation job.
Memory management scheme for activities and parameter data passed through the Scheduler within the Lu...
Framerate specified as frames per second.
Definition: timevalue.hpp:655
void announceLoad(FrameRate fps)
activity::Proc activate(Time now, EXE &executionCtx)
Core Operation: Activate and perform this Activity.
Definition: activity.hpp:626
activity::Term buildAsyncLoadJob(Job job, Time start, Time deadline)
Builder-API: initiate definition of IO data loading activities.
scheme for a synchronous media calculation job
Lumiera&#39;s internal time value datatype.
Definition: timevalue.hpp:299
Term builder and execution framework to perform chains of scheduler Activities.
scheme for an asynchronous data retrieval job
A Term of the »Activity Language«, describing the steps necessary to perform the calculation of a sin...
void announceAdditionalFlow(FrameRate additionalFps)
provide a hint to the self-regulating allocation scheme.
Definition: block-flow.hpp:652
activity::Term setupActivityScheme(activity::Term::Template schemeKind, Job job, Time start, Time dead)
activity::Proc dispatch(Time now, EXE &executionCtx)
Entrance point for an activation, which has been dispatched indirectly through the dispatch and/or pr...
Definition: activity.hpp:676
Activity * next
Activities are organised into chains to represent relations based on verbs.
Definition: activity.hpp:249
internal engine »heart beat« for internal maintenance hook(s)
Definition: activity.hpp:240
scheme for planning and organisational job
void discardBefore(Time deadline)
void discardBefore(Time deadline)
Clean-up all storage related to activities before the given deadline.
Definition: block-flow.hpp:574
static activity::Proc dispatchChain(Activity *chain, EXE &executionCtx)
Execution Framework: dispatch performance of a chain of Activities.
Proc
Result instruction from Activity activation.
Definition: activity.hpp:140
A term of the activity language describing interconnected scheduler activities.
Activity & createTick(Time deadline)
Individual frame rendering task, forwarding to a closure.
Definition: job.h:268
Vault-Layer implementation namespace root.
activity::Term buildMetaJob(Job job, Time start, Time deadline)
Builder-API: initiate definition of internal/planning job.
static activity::Proc activateChain(Activity *chain, EXE &executionCtx)
Execution Framework: successive activation of Activities in a chain.
AllocatorHandle until(Time deadline)
initiate allocations for activities to happen until some deadline
Definition: block-flow.hpp:516
Descriptor for a piece of operational logic performed by the scheduler.