Lumiera  0.pre.03
»edit your freedom«
nodeinvocation-obsolete.hpp
Go to the documentation of this file.
1 /*
2  NODEINVOCATION.hpp - Organise the invocation state within a single pull() call
3 
4  Copyright (C)
5  2008, 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 
47 #ifndef ENGINE_NODEINVOCATION_H
48 #define ENGINE_NODEINVOCATION_H
49 
50 
51 //#include "steam/engine/proc-node.hpp" ///////////////////////////////TODO clarify if required further on
53 #include "steam/engine/state-closure-obsolete.hpp"
56 
57 
58 
59 
60 namespace steam {
61 namespace engine {
62 
63 
73  : public StateClosure_OBSOLETE
74  {
75  protected:
76  StateClosure_OBSOLETE& parent_;
77  StateClosure_OBSOLETE& current_;
78 
79  StateAdapter (StateClosure_OBSOLETE& callingProcess)
80  : parent_ (callingProcess),
81  current_(callingProcess.getCurrentImplementation())
82  { }
83 
84  virtual StateClosure_OBSOLETE& getCurrentImplementation () { return current_; }
85 
86 
87 
88  public: /* === proxying the StateClosure interface === */
89 
90  virtual void releaseBuffer (BuffHandle& bh) { current_.releaseBuffer (bh); }
91 
92  virtual void is_calculated (BuffHandle const& bh) { current_.is_calculated (bh); }
93 
94  virtual BuffHandle fetch (FrameID const& fID) { return current_.fetch (fID); }
95 
96  virtual BuffTableStorage& getBuffTableStorage() { return current_.getBuffTableStorage(); }
97 
98  // note: allocateBuffer() is chosen specifically based on the actual node wiring
99 
100  };
101 
102 
103 
104 
105 
118  struct Invocation
119  : StateAdapter
120  {
121  Connectivity const& wiring;
122  const uint outNr;
123 
124  FeedManifold* feedManifold;
125 
126  protected:
128  Invocation (StateClosure_OBSOLETE& callingProcess, Connectivity const& w, uint o)
129  : StateAdapter(callingProcess),
130  wiring(w), outNr(o),
131  feedManifold(0)
132  { }
133 
134  public:
135  uint nrO() const { return wiring.nrO; }
136  uint nrI() const { return wiring.nrI; }
137  uint buffTabSize() const { return nrO()+nrI(); }
138 
140  void setBuffTab (FeedManifold* b) { this->feedManifold = b; }
141 
142  bool
143  buffTab_isConsistent ()
144  {
145  return (feedManifold)
146  && (0 < buffTabSize())
147  && (nrO()+nrI() <= buffTabSize())
148  && (feedManifold->inBuff == &feedManifold->outBuff[nrO()] )
149  && (feedManifold->inHandle == &feedManifold->outHandle[nrO()])
150  ;
151  }
152 
153 
154  public:
157  virtual FrameID const&
159  {
160  return current_.genFrameID(wiring.nodeID, outNr);
161  }
162 
163  virtual FrameID const&
164  genFrameID (NodeID const& nID, uint chanNo)
165  {
166  return current_.genFrameID (nID,chanNo);
167  }
168 
169  };
170 
171 
174  : Invocation
175  {
176  AllocBufferFromParent (StateClosure_OBSOLETE& sta, Connectivity const& w, const uint outCh)
177  : Invocation(sta, w, outCh) {}
178 
179  virtual BuffHandle
180  allocateBuffer (const lumiera::StreamType* ty) { return parent_.allocateBuffer(ty); }
181  };
182 
184  : Invocation
185  {
186  AllocBufferFromCache (StateClosure_OBSOLETE& sta, Connectivity const& w, const uint outCh)
187  : Invocation(sta, w, outCh) {}
188 
189  virtual BuffHandle
190  allocateBuffer (const lumiera::StreamType* ty) { return current_.allocateBuffer(ty); }
191  };
192 
193 
209  template<class Strategy, class BufferProvider>
211  : public BufferProvider
212  , private Strategy
213  {
214  public:
215  ActualInvocationProcess (StateClosure_OBSOLETE& callingProcess, Connectivity const& w, const uint outCh)
216  : BufferProvider(callingProcess, w, outCh)
217  { }
218 
224  {
225  return Strategy::step (*this);
226  }
227  };
228 
229 
230 
231 
232 }} // namespace steam::engine
233 #endif
Identification tuple for addressing frames unambiguously.
Definition: frameid.hpp:72
Invocation(StateClosure_OBSOLETE &callingProcess, Connectivity const &w, uint o)
creates a new invocation context state, without FeedManifold
virtual StateClosure_OBSOLETE & getCurrentImplementation()=0
resolves to the StateClosure object currently "in charge".
Obsolete, to be rewritten /////TICKET #826.
Obsolete, to be rewritten /////TICKET #826.
Adapter to shield the ProcNode from the actual buffer management, allowing the processing function wi...
Representation of the Media type of a data channel used within the engine.
Steam-Layer implementation namespace root.
virtual BuffHandle fetch(FrameID const &fID)
try to fetch an existing buffer containing the denoted frame from a cache or similar backing system (...
virtual void is_calculated(BuffHandle const &)=0
declare the data contained in the Buffer to be ready.
virtual BuffHandle allocateBuffer(const lumiera::StreamType *ty)
allocate a new writable buffer with type and size according to the BuffDescr.
Abstraction to access the state of a currently ongoing render/calculation process, as it is tied to the supporting facilities of the vault layer.
virtual StateClosure_OBSOLETE & getCurrentImplementation()
resolves to the StateClosure object currently "in charge".
void setBuffTab(FeedManifold *b)
setup the link to an externally allocated buffer table
virtual BuffHandle allocateBuffer(const lumiera::StreamType *ty)
allocate a new writable buffer with type and size according to the BuffDescr.
Invocation context state.
virtual void releaseBuffer(BuffHandle &bh)
resign control of the buffer denoted by the handle
< using the parent StateAdapter for buffer allocations
< using the global current StateClosure, which will delegate to Cache
virtual FrameID const & genFrameID(NodeID const &nID, uint chanNo)
generate (or calculate) an ID denoting a media data frame appearing at the given position in the rend...
Handle for a buffer for processing data, abstracting away the actual implementation.
Definition: buffhandle.hpp:111
virtual FrameID const & genFrameID()
specialised version filling in the additional information, i.e the concrete node id and the channel n...
Interface: Description of the input and output ports, processing function and predecessor nodes for a...
virtual BuffTableStorage & getBuffTableStorage()=0
necessary for creating a local BuffTableChunk
Identification tuple for denoting render nodes unambiguously.
Definition: frameid.hpp:45
virtual BuffHandle fetch(FrameID const &)=0
try to fetch an existing buffer containing the denoted frame from a cache or similar backing system (...
virtual BuffTableStorage & getBuffTableStorage()
necessary for creating a local BuffTableChunk
Interface: a facility providing and managing working buffers for media calculations.
virtual void releaseBuffer(BuffHandle &)=0
resign control of the buffer denoted by the handle
BuffHandle retrieve()
contains the details of Cache query and recursive calls to the predecessor node(s), eventually followed by the ProcNode::process() callback
The real invocation context state implementation.
virtual void is_calculated(BuffHandle const &bh)
declare the data contained in the Buffer to be ready.