use the new stream type definitions to get ahead with the builder work

This commit is contained in:
Fischlurch 2008-10-07 04:28:13 +02:00
parent 5c7e0d1870
commit 1b4aa98cdf
6 changed files with 95 additions and 48 deletions

View file

@ -1,5 +1,5 @@
/*
RENDERSTATE.hpp - renderengine state manager
REFARRAY.hpp - abstraction providing array-like access to a list of references
Copyright (C) Lumiera.org
2008, Hermann Vosseler <Ichthyostega@web.de>
@ -21,33 +21,28 @@
*/
#ifndef CONTROL_RENDERSTATE_H
#define CONTROL_RENDERSTATE_H
#include "proc/state.hpp"
#ifndef LIB_REFARRAY_H
#define LIB_REFARRAY_H
namespace control {
typedef proc_interface::State State;
namespace lib {
/**
* Encapsulates the logic used to get a "current render process"
* in accordance to the currently applicable controller settings.
* The provided StateProxy serves to hold any mutalbe state used
* in the render process, so the rest of the render engine
* can be stateless.
* @todo probably the state management will work different (6/08)
* Abstraction: Array of const references.
* Typically the return type is an interface,
* and the Implementation wraps some datastructure
* holding subclasses.
*/
class RenderState
template<class E>
struct RefArray
{
public:
State& getRenderProcess () ;
virtual E const& operator[] (uint i) const =0;
virtual size_t size() const =0;
virtual ~RefArray() {}
};
} // namespace control
} // namespace lib
#endif

View file

@ -54,7 +54,7 @@ namespace engine {
struct BuffHandle
{
typedef lumiera::StreamType::ImplFacade::DataBuffer Buff;
typedef Buff* PBuff;//////TODO define the Buffer type(s)
typedef Buff* PBuff;
PBuff
operator->() const
@ -81,7 +81,7 @@ namespace engine {
*/
struct BufferDescriptor
{
char typeID_; ///////TODO define the Buffer type(s)
lumiera::StreamType& sType_;
};

View file

@ -45,6 +45,7 @@
#include "proc/common.hpp"
#include "proc/state.hpp"
#include "proc/mobject/parameter.hpp"
#include "lib/refarray.hpp"
#include <vector>
@ -60,12 +61,6 @@ namespace engine {
typedef ProcNode* PNode;
template<class E>
struct RefArray ///< @todo need an implementation and then probably move it into library
{
virtual E const& operator[] (uint i) const =0;
virtual ~RefArray() {}
};
/**
* Interface: Description of the input and output ports,
@ -79,16 +74,16 @@ namespace engine {
virtual uint getNrI() const =0; ///////////TODO: indeed need a virtual function??
virtual uint getNrO() const =0;
RefArray<ChannelDescriptor>& out;
RefArray<InChanDescriptor>& in;
lib::RefArray<ChannelDescriptor>& out;
lib::RefArray<InChanDescriptor>& in;
typedef void (ProcFunc) (BuffHandle::PBuff, uint);
ProcFunc* processFunction;
protected:
WiringDescriptor (RefArray<ChannelDescriptor>& o,
RefArray<InChanDescriptor>& i,
WiringDescriptor (lib::RefArray<ChannelDescriptor>& o,
lib::RefArray<InChanDescriptor>& i,
ProcFunc pFunc)
: out(o), in(i),
processFunction(pFunc)

View file

@ -0,0 +1,55 @@
/*
RENDERSTATE.hpp - renderengine state management
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 MOBJECT_BUILDER_RENDERSTATE_H
#define MOBJECT_BUILDER_RENDERSTATE_H
#include "proc/state.hpp"
namespace mobject {
namespace builder {
typedef proc_interface::State State;
/**
* Encapsulates the logic used to get a "render process".
* The provided StateProxy serves to hold any mutalbe state used
* in the render process, so the rest of the render engine
* can be stateless.
* @todo probably the state management will work different (6/08)
*/
class RenderState
{
public:
State& getRenderProcess () ;
};
} // namespace mobject::session
} // namespace mobject
#endif

View file

@ -43,19 +43,6 @@ namespace engine {
class State
{
protected:
virtual ~State() {};
/** resolves to the State object currently "in charge".
* Intended as a performance shortcut to avoid calling
* up through a chain of virtual functions when deep down
* in chained ProcNode::pull() calls. This allows derived
* classes to proxy the state interface.
*/
virtual State& getCurrentImplementation () =0;
friend class engine::StateAdapter;
public:
/** allocate a new writable buffer with type and size according to
* the BufferDescriptor. The actual provider of this buffer depends
@ -86,6 +73,19 @@ namespace engine {
/** necessary for creating a local BuffTableChunk */
virtual BuffTableStorage& getBuffTableStorage() =0;
protected:
virtual ~State() {};
/** resolves to the State object currently "in charge".
* Intended as a performance shortcut to avoid calling
* up through a chain of virtual functions when deep down
* in chained ProcNode::pull() calls. This allows derived
* classes to proxy the state interface.
*/
virtual State& getCurrentImplementation () =0;
friend class engine::StateAdapter;
};
} // namespace engine

View file

@ -26,6 +26,7 @@
#include "proc/engine/procnode.hpp"
#include "proc/engine/bufftable.hpp"
#include "lib/refarray.hpp"
#include <boost/scoped_ptr.hpp>
#include <iostream>
@ -49,10 +50,11 @@ namespace engine {
/** just some crap to pass in as ctor argument... */
template<class E>
struct DummyArray : RefArray<E>
struct DummyArray : lib::RefArray<E>
{
E decoy;
E const& operator[] (uint) const { return decoy;}
size_t size() const { return CHUNK_MAX;}
};
DummyArray<ChannelDescriptor> dummy1;
DummyArray<InChanDescriptor> dummy2;