From 1b4aa98cdffb726683c5b2df9b070196d5f11070 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Tue, 7 Oct 2008 04:28:13 +0200 Subject: [PATCH] use the new stream type definitions to get ahead with the builder work --- .../renderstate.hpp => lib/refarray.hpp} | 39 ++++++------- src/proc/engine/buffhandle.hpp | 4 +- src/proc/engine/procnode.hpp | 15 ++--- src/proc/mobject/builder/renderstate.hpp | 55 +++++++++++++++++++ src/proc/state.hpp | 26 ++++----- .../components/proc/engine/bufftabletest.cpp | 4 +- 6 files changed, 95 insertions(+), 48 deletions(-) rename src/{proc/control/renderstate.hpp => lib/refarray.hpp} (56%) create mode 100644 src/proc/mobject/builder/renderstate.hpp diff --git a/src/proc/control/renderstate.hpp b/src/lib/refarray.hpp similarity index 56% rename from src/proc/control/renderstate.hpp rename to src/lib/refarray.hpp index d62e56628..d4efc126a 100644 --- a/src/proc/control/renderstate.hpp +++ b/src/lib/refarray.hpp @@ -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 @@ -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 + 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 diff --git a/src/proc/engine/buffhandle.hpp b/src/proc/engine/buffhandle.hpp index ece9bf365..76d1acacf 100644 --- a/src/proc/engine/buffhandle.hpp +++ b/src/proc/engine/buffhandle.hpp @@ -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_; }; diff --git a/src/proc/engine/procnode.hpp b/src/proc/engine/procnode.hpp index 4889c0041..b62f7947e 100644 --- a/src/proc/engine/procnode.hpp +++ b/src/proc/engine/procnode.hpp @@ -45,6 +45,7 @@ #include "proc/common.hpp" #include "proc/state.hpp" #include "proc/mobject/parameter.hpp" +#include "lib/refarray.hpp" #include @@ -60,12 +61,6 @@ namespace engine { typedef ProcNode* PNode; - template - 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& out; - RefArray& in; + lib::RefArray& out; + lib::RefArray& in; typedef void (ProcFunc) (BuffHandle::PBuff, uint); ProcFunc* processFunction; protected: - WiringDescriptor (RefArray& o, - RefArray& i, + WiringDescriptor (lib::RefArray& o, + lib::RefArray& i, ProcFunc pFunc) : out(o), in(i), processFunction(pFunc) diff --git a/src/proc/mobject/builder/renderstate.hpp b/src/proc/mobject/builder/renderstate.hpp new file mode 100644 index 000000000..6e99a99b1 --- /dev/null +++ b/src/proc/mobject/builder/renderstate.hpp @@ -0,0 +1,55 @@ +/* + RENDERSTATE.hpp - renderengine state management + + 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 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 diff --git a/src/proc/state.hpp b/src/proc/state.hpp index e021d5890..a20bc9cee 100644 --- a/src/proc/state.hpp +++ b/src/proc/state.hpp @@ -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 diff --git a/tests/components/proc/engine/bufftabletest.cpp b/tests/components/proc/engine/bufftabletest.cpp index 4806d5bb6..d50a95336 100644 --- a/tests/components/proc/engine/bufftabletest.cpp +++ b/tests/components/proc/engine/bufftabletest.cpp @@ -26,6 +26,7 @@ #include "proc/engine/procnode.hpp" #include "proc/engine/bufftable.hpp" +#include "lib/refarray.hpp" #include #include @@ -49,10 +50,11 @@ namespace engine { /** just some crap to pass in as ctor argument... */ template - struct DummyArray : RefArray + struct DummyArray : lib::RefArray { E decoy; E const& operator[] (uint) const { return decoy;} + size_t size() const { return CHUNK_MAX;} }; DummyArray dummy1; DummyArray dummy2;