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) Lumiera.org
5  2023, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 */
22 
23 
37 #ifndef SRC_VAULT_GEAR_ACTIVITY_LANG_H_
38 #define SRC_VAULT_GEAR_ACTIVITY_LANG_H_
39 
40 
41 #include "vault/gear/activity.hpp"
44 
45 
46 namespace vault{
47 namespace gear {
48 
49  using BlockFlowAlloc = BlockFlow<blockFlow::RenderConfig>;
50 
51 
52 
53  /*************************************************************************************/
79  {
80  BlockFlowAlloc& mem_;
81 
82  public:
83  explicit
84  ActivityLang (BlockFlowAlloc& memManager)
85  : mem_{memManager}
86  { }
87 
88  // using default copy/assignment
89 
90 
95  buildCalculationJob (Job job, Time start, Time deadline)
96  {
97  return setupActivityScheme (activity::Term::CALC_JOB, job, start, deadline);
98  }
99 
104  buildAsyncLoadJob (Job job, Time start, Time deadline)
105  {
106  return setupActivityScheme (activity::Term::LOAD_JOB, job, start, deadline);
107  }
108 
113  buildMetaJob (Job job, Time start, Time deadline)
114  {
115  return setupActivityScheme (activity::Term::META_JOB, job, start, deadline);
116  }
117 
118 
120  Activity& createTick (Time deadline){ return mem_.until(deadline).create (Activity::TICK); }
121 
123  void discardBefore (Time deadline) { mem_.discardBefore (deadline); }
124 
127 
128 
132  template<class EXE>
133  static activity::Proc
134  dispatchChain (Activity* chain, EXE& executionCtx)
135  {
136  if (!chain) return activity::PASS;
137  activity::Proc res = chain->dispatch (executionCtx.getSchedTime(), executionCtx);
138  if (activity::PASS == res)
139  res = activateChain (chain->next, executionCtx);
140  else if (activity::SKIP == res)
141  res = activity::PASS;
142  return res;
143  }
144 
148  template<class EXE>
149  static activity::Proc
150  activateChain (Activity* chain, EXE& executionCtx)
151  {
152  activity::Proc res{activity::PASS};
153  while (chain and activity::PASS == res)
154  {
155  res = chain->activate (executionCtx.getSchedTime(), executionCtx);
156  chain = chain->next;
157  }
158  if (activity::SKIP == res)// SKIP has been handled
159  res = activity::PASS; // just by aborting the loop
160  return res;
161  }
162 
163  private:
167  {
168  return activity::Term{ mem_.until(dead)
169  , schemeKind
170  , start
171  , dead
172  , job
173  };
174  }
175  };
176 
177 
178 }} // namespace vault::gear
179 #endif /*SRC_VAULT_GEAR_ACTIVITY_LANG_H_*/
Record to describe an Activity, to happen within the Scheduler&#39;s control flow.
Definition: activity.hpp:235
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:664
void announceLoad(FrameRate fps)
activity::Proc activate(Time now, EXE &executionCtx)
Core Operation: Activate and perform this Activity.
Definition: activity.hpp:635
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:308
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:661
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:685
Activity * next
Activities are organised into chains to represent relations based on verbs.
Definition: activity.hpp:258
internal engine »heart beat« for internal maintenance hook(s)
Definition: activity.hpp:249
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:583
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:149
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:277
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:525
Descriptor for a piece of operational logic performed by the scheduler.