Lumiera  0.pre.03
»edit your freedom«
exit-node.hpp
Go to the documentation of this file.
1 /*
2  EXIT-NODE.hpp - top-level node of the render network to pull generated media
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 
21 #ifndef ENGINE_EXIT_NODE_H
22 #define ENGINE_EXIT_NODE_H
23 
24 #include "lib/error.hpp"
25 #include "lib/nocopy.hpp"
26 #include "lib/hash-value.h"
27 #include "lib/iter-adapter-stl.hpp"
28 #include "lib/time/timevalue.hpp"
29 #include "vault/gear/job.h"
30 
31 #include <utility>
32 #include <deque>
33 
34 using lib::HashVal;
35 using lib::time::FSecs;
37 
38 
39 namespace steam {
40 namespace engine {
41 
42  class ExitNode;
43  using ExitNodes = std::deque<engine::ExitNode>;
44 
46 
47  namespace {// hard wired placeholder config....
48  const Duration DUMMY_JOB_RUNTIME{FSecs{1,50}};
49  }
50 
51 
63  class ExitNode
65  {
66  HashVal pipelineIdentity_;
67  Duration runtimeBound_;
68  ExitNodes prerequisites_;
69  JobFunctor* action_{nullptr};
70 
71  public:
72  ExitNode()
73  : pipelineIdentity_{0}
74  , runtimeBound_{DUMMY_JOB_RUNTIME}
75  , prerequisites_{}
76  { }
77 
78  ExitNode (HashVal id
79  ,Duration jobRuntime
80  ,ExitNodes&& prereq =ExitNodes{}
81  ,JobFunctor* functor =nullptr)
82  : pipelineIdentity_{id}
83  , runtimeBound_{jobRuntime}
84  , prerequisites_{std::move (prereq)}
85  , action_{functor}
86  { }
87 
88  explicit
89  ExitNode (HashVal id
90  ,ExitNodes&& prereq =ExitNodes{})
91  : ExitNode{id, DUMMY_JOB_RUNTIME, std::move(prereq)}
92  { }
93 
94  static ExitNode NIL;
95 
96 
97  bool
98  empty() const
99  {
100  return 0 == pipelineIdentity_
101  or not action_;
102  }
103 
104  bool
105  isValid() const
106  {
107  return true;
108  }
109 
110 
111  HashVal
112  getPipelineIdentity() const
113  {
114  return pipelineIdentity_;
115  }
116 
117  auto
118  getPrerequisites() const
119  {
120  return lib::iter_stl::eachElm (prerequisites_);
121  }
122 
123  JobFunctor&
124  getInvocationFunctor() const
125  {
126  REQUIRE (action_);
127  return *action_;
128  }
129 
130  Duration
131  getUpperBoundRuntime() const
132  {
134  return runtimeBound_;
135  }
136  };
137 
138 
139 }} // namespace steam::engine
140 #endif /*ENGINE_EXIT_NODE_H*/
Steam-Layer implementation namespace root.
Mix-Ins to allow or prohibit various degrees of copying and cloning.
A top-level point in the render node network where data generation can be driven. ...
Definition: exit-node.hpp:63
boost::rational< int64_t > FSecs
rational representation of fractional seconds
Definition: timevalue.hpp:220
Definition of a render job.
Lumiera error handling (C++ interface).
Hash value types and utilities.
size_t HashVal
a STL compatible hash value
Definition: hash-value.h:52
Duration is the internal Lumiera time metric.
Definition: timevalue.hpp:468
Preconfigured adapters for some STL container standard usage situations.
a family of time value like entities and their relationships.
static ExitNode NIL
storage for the »inactive« ExitNode marker
Definition: exit-node.hpp:94
Types marked with this mix-in may be created and moved liberally at construction, while any further a...
Definition: nocopy.hpp:79