2008-06-24 05:19:11 +02:00
|
|
|
/*
|
|
|
|
|
NODEWIRING.hpp - Implementation of the node network and operation control
|
|
|
|
|
|
|
|
|
|
Copyright (C) Lumiera.org
|
|
|
|
|
2008, Hermann Vosseler <Ichthyostega@web.de>
|
|
|
|
|
|
|
|
|
|
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"
|
|
|
|
|
|
2008-08-03 16:47:38 +02:00
|
|
|
#include <boost/scoped_ptr.hpp>
|
2008-06-24 05:19:11 +02:00
|
|
|
#include <cstddef>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace engine {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class WiringFactory;
|
|
|
|
|
|
2008-08-03 16:47:38 +02:00
|
|
|
namespace { class WiringFactoryImpl; }
|
|
|
|
|
|
2008-06-24 05:19:11 +02:00
|
|
|
|
|
|
|
|
/**
|
2008-07-05 18:50:54 +02:00
|
|
|
* Actual implementation of the link between nodes,
|
|
|
|
|
* also acting as "track switch" for the execution path
|
2008-06-29 15:32:19 +02:00
|
|
|
* choosen while operating the node network for rendering.
|
2008-06-24 05:19:11 +02:00
|
|
|
* @param STATE StateAdapter object controlling the
|
|
|
|
|
* behaviour of callDown() while rendering.
|
|
|
|
|
* @see NodeFactory
|
|
|
|
|
*/
|
|
|
|
|
template<class STATE>
|
|
|
|
|
class NodeWiring
|
|
|
|
|
: public WiringDescriptor
|
|
|
|
|
{
|
2008-07-16 05:09:04 +02:00
|
|
|
const uint siz_;
|
|
|
|
|
const uint nrO_;
|
2008-06-24 05:19:11 +02:00
|
|
|
|
|
|
|
|
friend class WiringFactory;
|
|
|
|
|
|
2008-07-16 05:09:04 +02:00
|
|
|
public:
|
|
|
|
|
virtual uint getNrI() const { return siz_ - nrO_; }
|
|
|
|
|
virtual uint getNrO() const { return nrO_; }
|
|
|
|
|
|
|
|
|
|
|
2008-06-24 05:19:11 +02:00
|
|
|
protected:
|
2008-06-29 15:32:19 +02:00
|
|
|
virtual BuffHandle
|
|
|
|
|
callDown (State& currentProcess, uint requiredOutputNr) const
|
2008-06-24 05:19:11 +02:00
|
|
|
{
|
|
|
|
|
STATE thisStep (currentProcess, *this);
|
|
|
|
|
return thisStep.retrieve (requiredOutputNr); // fetch or calculate results
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class WiringFactory
|
|
|
|
|
{
|
2008-08-03 16:47:38 +02:00
|
|
|
boost::scoped_ptr<WiringFactoryImpl> pImpl_;
|
|
|
|
|
|
2008-06-24 05:19:11 +02:00
|
|
|
public:
|
|
|
|
|
WiringDescriptor&
|
|
|
|
|
operator() (uint nrOut, uint nrIn, bool cache);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace engine
|
|
|
|
|
#endif
|