WIP still trying to invent chicken and egg together....
This commit is contained in:
parent
ff8be4493c
commit
25a7d75ad9
4 changed files with 89 additions and 15 deletions
|
|
@ -24,12 +24,58 @@
|
|||
#include "proc/engine/nodefactory.hpp"
|
||||
#include "proc/mobject/session/effect.hpp"
|
||||
|
||||
namespace engine {
|
||||
#include "proc/engine/nodewiring.hpp"
|
||||
|
||||
namespace engine {
|
||||
|
||||
namespace { // Details of node fabrication
|
||||
|
||||
class Alloc {}; ///////////////TODO
|
||||
|
||||
template<class NODE>
|
||||
NODE &
|
||||
makeNode ()
|
||||
{
|
||||
////TODO: this is a draft how it /might/ work
|
||||
////TODO: of course this can't be hard wired....
|
||||
|
||||
ProcNode * predecessor1, predecessor2;
|
||||
|
||||
WiringInstaller setup;
|
||||
setup.defineInput (4, predecessor1, 2);
|
||||
setup.defineInput (2, predecessor2);
|
||||
|
||||
WiringFactory* wFac;
|
||||
|
||||
Alloc allocator;
|
||||
bool doCache = (2 == 2); // find out Cache should be used for this node
|
||||
|
||||
WiringDescriptor & wDesc = (*wFac)(setup,doCache);
|
||||
|
||||
NODE *newNode = new(allocator()) NODE (wDesc); // actually this line needs to be atomic
|
||||
|
||||
return *newNode;
|
||||
|
||||
/*
|
||||
* Problems to be solved:
|
||||
* - write a generic allocator, which later on can be augmented to do block wise bulk allocation
|
||||
* - the allocator needs to keep track of the objects; actually he owns the objects
|
||||
* - we need to access the wiring descriptor of the predecessor nodes. Which means, the code
|
||||
* must be in the body of NodeFactory (because the latter is friend of ProcNode and can access the wiring descriptor)
|
||||
* - btw reconsider if this level of protection is necessary, or if the const WiringDescriptor cant be just on the public interface of ProcNode
|
||||
* - find out how the Caching/ReadInput/InPlace detection can work
|
||||
* - think about a sensible Ctor for NodeFactory. This one must create the WiringFactory and pass the Allocator.
|
||||
* - all of this will be installed into the ToolFactory, i.e. it is part of the build process
|
||||
*/
|
||||
}
|
||||
|
||||
} // (END) Details of node fabrication
|
||||
|
||||
|
||||
using mobject::Placement;
|
||||
using mobject::session::Effect;
|
||||
|
||||
|
||||
|
||||
/** create a processing node able to render an effect */
|
||||
PTrafo
|
||||
NodeFactory::operator() (Placement<Effect> const&)
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ namespace engine {
|
|||
* the new processing node to be wired up.
|
||||
*/
|
||||
WiringDescriptor&
|
||||
WiringFactory::operator() (uint nrOut, uint nrIn, bool cache)
|
||||
WiringFactory::operator() (WiringInstaller& setup, bool cache)
|
||||
{
|
||||
UNIMPLEMENTED ("build the actual wiring descriptor based on given operation options");
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include "proc/engine/procnode.hpp"
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
|
|
@ -39,6 +40,28 @@ namespace engine {
|
|||
|
||||
namespace config { class WiringFactoryImpl; }
|
||||
|
||||
using lib::RefArray;
|
||||
|
||||
|
||||
/**
|
||||
* Finding out about a concrete way of wiring up a
|
||||
* ProcNode about to be built. Such a (temporary) setup object
|
||||
* is used while building the low-level model. It is loaded with
|
||||
* information concerning the intended connections to be made
|
||||
* and then used to initialise the wiring descriptor, which
|
||||
* in turn allows us to setup the ProcNode.
|
||||
*/
|
||||
class WiringInstaller : boost::noncopyable
|
||||
{
|
||||
public:
|
||||
RefArray<ChannelDescriptor>& makeOutDescriptor() ;
|
||||
RefArray<InChanDescriptor>& makeInDescriptor() ;
|
||||
WiringDescriptor::ProcFunc* resolveProcessingFunction() ;
|
||||
lumiera::NodeID const& createNodeID() ;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Actual implementation of the link between nodes,
|
||||
|
|
@ -54,6 +77,16 @@ namespace engine {
|
|||
: public WiringDescriptor
|
||||
{
|
||||
|
||||
NodeWiring(WiringInstaller& setup)
|
||||
: WiringDescriptor(setup.makeOutDescriptor(),
|
||||
setup.makeInDescriptor(),
|
||||
setup.resolveProcessingFunction(),
|
||||
setup.createNodeID())
|
||||
{
|
||||
nrO = out.size();
|
||||
nrI = in.size();
|
||||
}
|
||||
|
||||
friend class WiringFactory;
|
||||
|
||||
|
||||
|
|
@ -65,10 +98,6 @@ namespace engine {
|
|||
return thisStep.retrieve (); // fetch or calculate results
|
||||
}
|
||||
|
||||
|
||||
//////
|
||||
//////TODO: push "almost everything" up into an ABC
|
||||
////////// and create an ctor to set up the RefArrays
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -79,7 +108,7 @@ namespace engine {
|
|||
|
||||
public:
|
||||
WiringDescriptor&
|
||||
operator() (uint nrOut, uint nrIn, bool cache);
|
||||
operator() (WiringInstaller& setup, bool cache);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@
|
|||
#include "proc/state.hpp"
|
||||
#include "proc/mobject/parameter.hpp"
|
||||
#include "common/frameid.hpp"
|
||||
#include "lib/refarray.hpp"
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
|
@ -58,8 +59,6 @@ namespace engine {
|
|||
using lumiera::NodeID;
|
||||
|
||||
class ProcNode;
|
||||
class NodeFactory;
|
||||
|
||||
typedef ProcNode* PNode;
|
||||
|
||||
|
||||
|
|
@ -70,11 +69,11 @@ namespace engine {
|
|||
class WiringDescriptor
|
||||
{
|
||||
public:
|
||||
uint nrI;
|
||||
uint nrO;
|
||||
uint nrI;
|
||||
|
||||
ChannelDescriptor out[];
|
||||
InChanDescriptor in[];
|
||||
lib::RefArray<ChannelDescriptor>& out;
|
||||
lib::RefArray<InChanDescriptor>& in;
|
||||
|
||||
typedef void (ProcFunc) (BuffHandle::PBuff);
|
||||
|
||||
|
|
@ -85,8 +84,8 @@ namespace engine {
|
|||
virtual ~WiringDescriptor() {}
|
||||
|
||||
protected:
|
||||
WiringDescriptor (ChannelDescriptor* o,
|
||||
InChanDescriptor* i,
|
||||
WiringDescriptor (lib::RefArray<ChannelDescriptor>& o,
|
||||
lib::RefArray<InChanDescriptor>& i,
|
||||
ProcFunc pFunc, NodeID const& nID)
|
||||
: out(o), in(i),
|
||||
procFunction(pFunc),
|
||||
|
|
|
|||
Loading…
Reference in a new issue