2008-06-24 05:19:11 +02:00
/*
NODEWIRING . hpp - Implementation of the node network and operation control
2010-12-17 23:28:49 +01:00
2008-06-24 05:19:11 +02:00
Copyright ( C ) Lumiera . org
2008 , Hermann Vosseler < Ichthyostega @ web . de >
2010-12-17 23:28:49 +01:00
2008-06-24 05:19:11 +02:00
This program is free software ; you can redistribute it and / or
modify it under the terms of the GNU General Public License as
2010-12-17 23:28:49 +01:00
published by the Free Software Foundation ; either version 2 of
the License , or ( at your option ) any later version .
2008-06-24 05:19:11 +02:00
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 .
2010-12-17 23:28:49 +01:00
2008-06-24 05:19:11 +02:00
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 0213 9 , USA .
2010-12-17 23:28:49 +01:00
2008-06-24 05:19:11 +02:00
*/
2016-11-03 18:22:31 +01:00
/** @file nodewiring.hpp
2016-11-09 19:50:16 +01:00
* * Mechanism to wire ProcNode instances for a render network
* * @ todo unfinished draft from 2009 regarding the render process
2024-06-24 23:49:55 +02:00
* * @ deprecated 2024 this header will likely be obsoleted
* * @ see node - wiring - builder . hpp for the rewritten node - builder
2016-11-03 18:20:10 +01:00
*/
2024-06-24 23:49:55 +02:00
# ifndef ENGINE_NODEWIRING_OBSOLETE_H
# define ENGINE_NODEWIRING_OBSOLETE_H
2008-06-24 05:19:11 +02:00
2024-06-24 23:49:55 +02:00
# include "steam/engine/connectivity-obsolete.hpp"
2010-12-18 00:58:19 +01:00
# include "lib/allocation-cluster.hpp"
2024-06-24 23:49:55 +02:00
# include "lib/ref-array.hpp"
# include "lib/util-foreach.hpp"
# include "lib/nocopy.hpp"
2008-06-24 05:19:11 +02:00
2017-01-05 00:56:46 +01:00
# include <memory>
2008-06-24 05:19:11 +02:00
2018-11-15 23:55:13 +01:00
namespace steam {
2008-06-24 05:19:11 +02:00
namespace engine {
2009-09-04 17:43:53 +02:00
2008-06-24 05:19:11 +02:00
class WiringFactory ;
2008-10-13 04:33:10 +02:00
namespace config { class WiringFactoryImpl ; }
2008-08-03 16:47:38 +02:00
2024-06-29 04:23:55 +02:00
/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : inlined here and then dropped in node-wiring-builder.hpp
2008-10-17 05:48:02 +02:00
using lib : : RefArray ;
2024-06-29 04:23:55 +02:00
/**
* 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 .
*
* \ par intended usage pattern
* The goal is to describe the constellation of a new node to be built .
* Thus , we start with one or several existing nodes , specifying which
* output should go to which input pin of the yet - to - be created new node .
* When intending to create a source node , a default WiringSituation
* should be used , without adding any connection information .
*
* @ deprecated WIP - WIP - WIP 2024 Node - Invocation is reworked from ground up for the » Playback Vertical Slice «
*/
class WiringSituation
: util : : NonCopyable
{
long flags_ ;
asset : : Proc : : ProcFunc * function_ ;
public : /* === API for querying collected data === */
RefArray < ChannelDescriptor > &
makeOutDescriptor ( ) const
{
UNIMPLEMENTED ( " build new output descriptors for the node under construction " ) ; //////////TODO: where to get the information about the output channels???
}
RefArray < InChanDescriptor > &
makeInDescriptor ( ) const
{
UNIMPLEMENTED ( " build new input descriptors for the node under construction " ) ;
}
Connectivity : : ProcFunc *
resolveProcessingFunction ( ) const
{
REQUIRE ( function_ ) ;
return function_ ;
}
lumiera : : NodeID const &
createNodeID ( ) const
{
UNIMPLEMENTED ( " initiate generation of a new unique node-ID " ) ; // see rendergraph.cpp
}
public : /* === API for specifying the desired wiring === */
/** A default WiringSituation doesn't specify any connections.
* It can be used as - is for building a source node , or augmented
* with connection information later on .
*/
WiringSituation ( )
: flags_ ( 0 )
, function_ ( 0 )
{
UNIMPLEMENTED ( " representation of the intended wiring " ) ;
}
/** Continue the wiring by hooking directly into the output
* of an existing predecessor node
*/
WiringSituation ( PNode predecessor )
: flags_ ( 0 )
, function_ ( 0 )
{
UNIMPLEMENTED ( " wiring representation; hook up connections 1:1 " ) ;
REQUIRE ( predecessor ) ;
//////////////////////////TODO: see Ticket 254
// for_each (predecessor->outputs(), ..... see also Ticket 183 (invoking member fun in for_each)
}
/** set up a connection leading to a specific input pin of the new node */
WiringSituation &
defineInput ( uint inPin , PNode pred , uint outPin )
{
UNIMPLEMENTED ( " wiring representation; define new connection " ) ;
return * this ;
}
/** set up the next input connection,
* originating at a specific output pin of the predecessor */
WiringSituation &
defineInput ( PNode pred , uint outPin )
{
UNIMPLEMENTED ( " wiring representation; define new connection " ) ;
return * this ;
}
/** set up the next input connection to a specific input pin,
* originating at a the next / sole output pin of the predecessor */
WiringSituation &
defineInput ( uint inPin , PNode pred )
{
UNIMPLEMENTED ( " wiring representation; define new connection " ) ;
return * this ;
}
/** set detail flags regarding the desired node operation mode */
WiringSituation &
setFlag ( long code )
{
flags_ | = code ;
return * this ;
}
long getFlags ( ) const { return flags_ ; }
/** trigger resolving of the actual processing function */
WiringSituation &
resolveProcessor ( asset : : Proc const & procAsset )
{
function_ = procAsset . resolveProcessor ( ) ;
ENSURE ( function_ ) ;
}
} ;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////TICKET #1367 : (END)inlined here and then dropped in node-wiring-builder.hpp
2008-10-17 05:48:02 +02:00
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-10-13 04:33:10 +02:00
* chosen while operating the node network for rendering .
2008-08-04 05:42:55 +02:00
* @ param STATE Invocation state object controlling the
2008-06-24 05:19:11 +02:00
* behaviour of callDown ( ) while rendering .
2008-08-04 05:42:55 +02:00
* @ see StateAdapter
2024-05-06 23:51:48 +02:00
* @ see NodeFactory
2008-06-24 05:19:11 +02:00
*/
template < class STATE >
class NodeWiring
2024-05-06 23:51:48 +02:00
: public Connectivity
2008-06-24 05:19:11 +02:00
{
2009-09-05 18:15:58 +02:00
public :
NodeWiring ( WiringSituation const & setup )
2024-05-06 23:51:48 +02:00
: Connectivity ( setup . makeOutDescriptor ( ) ,
2008-10-17 05:48:02 +02:00
setup . makeInDescriptor ( ) ,
setup . resolveProcessingFunction ( ) ,
setup . createNodeID ( ) )
2009-09-04 01:59:44 +02:00
{ }
2008-10-17 05:48:02 +02:00
2009-09-05 18:15:58 +02:00
private :
2008-06-29 15:32:19 +02:00
virtual BuffHandle
2024-06-21 16:14:24 +02:00
callDown ( StateClosure_OBSOLETE & currentProcess , uint requestedOutputNr ) const
2008-06-24 05:19:11 +02:00
{
2008-10-13 04:33:10 +02:00
STATE thisStep ( currentProcess , * this , requestedOutputNr ) ;
return thisStep . retrieve ( ) ; // fetch or calculate results
2008-06-24 05:19:11 +02:00
}
} ;
2009-09-04 17:43:53 +02:00
2008-06-24 05:19:11 +02:00
class WiringFactory
{
2009-08-30 14:50:40 +02:00
lib : : AllocationCluster & alloc_ ;
2017-01-05 00:56:46 +01:00
std : : unique_ptr < config : : WiringFactoryImpl > pImpl_ ;
2008-08-03 16:47:38 +02:00
2008-06-24 05:19:11 +02:00
public :
2009-08-30 14:50:40 +02:00
WiringFactory ( lib : : AllocationCluster & a ) ;
2009-09-05 04:10:51 +02:00
~ WiringFactory ( ) ;
2009-08-30 14:50:40 +02:00
2024-05-06 23:51:48 +02:00
Connectivity &
2009-09-05 04:10:51 +02:00
operator ( ) ( WiringSituation const & setup ) ;
2008-06-24 05:19:11 +02:00
} ;
2018-11-15 23:55:13 +01:00
} } // namespace steam::engine
2008-06-24 05:19:11 +02:00
# endif