/* NODEWIRING.hpp - Implementation of the node network and operation control Copyright (C) Lumiera.org 2008, Hermann Vosseler This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef ENGINE_NODEWIRING_H #define ENGINE_NODEWIRING_H #include "proc/engine/procnode.hpp" #include #include #include namespace engine { class WiringFactory; 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& makeOutDescriptor() ; RefArray& makeInDescriptor() ; WiringDescriptor::ProcFunc* resolveProcessingFunction() ; lumiera::NodeID const& createNodeID() ; }; /** * Actual implementation of the link between nodes, * also acting as "track switch" for the execution path * chosen while operating the node network for rendering. * @param STATE Invocation state object controlling the * behaviour of callDown() while rendering. * @see StateAdapter * @see NodeFactory */ template class NodeWiring : public WiringDescriptor { NodeWiring(WiringInstaller& setup) : WiringDescriptor(setup.makeOutDescriptor(), setup.makeInDescriptor(), setup.resolveProcessingFunction(), setup.createNodeID()) { nrO = out.size(); nrI = in.size(); } friend class WiringFactory; protected: virtual BuffHandle callDown (State& currentProcess, uint requestedOutputNr) const { STATE thisStep (currentProcess, *this, requestedOutputNr); return thisStep.retrieve (); // fetch or calculate results } }; class WiringFactory { boost::scoped_ptr pImpl_; public: WiringDescriptor& operator() (WiringInstaller& setup, bool cache); }; } // namespace engine #endif