diff --git a/src/proc/engine/buffer-provider.hpp b/src/proc/engine/buffer-provider.hpp index 02f6ff262..bbb7766ef 100644 --- a/src/proc/engine/buffer-provider.hpp +++ b/src/proc/engine/buffer-provider.hpp @@ -77,6 +77,9 @@ namespace engine { virtual BuffHandle lockBufferFor (BufferDescriptor const&) =0; virtual void releaseBuffer (BuffHandle const&) =0; + template + BuffHandle lockBufferFor (); + /** describe the kind of buffer managed by this provider */ BufferDescriptor getDefaultDescriptor(); //////////////TODO really? there is no sensible "default" @@ -87,7 +90,25 @@ namespace engine { bool verifyValidity (BufferDescriptor const&); }; + + + + + /* === Implementation === */ + /** convenience shortcut: + * prepare and claim ("lock") a buffer suitable + * to hold an object of the given type. + * @return a handle embedding a suitably configured + * buffer descriptor. The corresponding buffer + * has been allocated and marked for exclusive use + */ + template + BuffHandle + BufferProvider::lockBufferFor() + { + UNIMPLEMENTED ("convenience shortcut to announce and lock for a specific object type"); + } } // namespace engine diff --git a/src/proc/engine/buffhandle.hpp b/src/proc/engine/buffhandle.hpp index f2e9646fb..889638724 100644 --- a/src/proc/engine/buffhandle.hpp +++ b/src/proc/engine/buffhandle.hpp @@ -132,6 +132,10 @@ namespace engine { // using standard copy operations + template + BU& create(); + + Buff& operator* () const { @@ -146,9 +150,30 @@ namespace engine { && descriptor_.verifyValidity(); } + size_t + size() const + { + UNIMPLEMENTED ("forward to the buffer provider for storage size diagnostics"); + } + }; + /* === Implementation details === */ + + /** convenience shortcut: place and maintain an object within the buffer. + * This operation performs the necessary steps to attach an object; + * if the buffer isn't locked yet, it will do so. Moreover, the created + * object will be owned by the buffer management facilities, i.e. the + * destructor is registered as cleanup function. + */ + template + BU& + BuffHandle::create() + { + UNIMPLEMENTED ("convenience shortcut to attach/place an object in one sway"); + } + } // namespace engine diff --git a/tests/components/proc/engine/buffer-provider-protocol-test.cpp b/tests/components/proc/engine/buffer-provider-protocol-test.cpp index a50ceb2a5..38f65568d 100644 --- a/tests/components/proc/engine/buffer-provider-protocol-test.cpp +++ b/tests/components/proc/engine/buffer-provider-protocol-test.cpp @@ -26,6 +26,7 @@ #include "lib/test/test-helper.hpp" #include "lib/util-foreach.hpp" //#include "proc/play/diagnostic-output-slot.hpp" +#include "proc/engine/testframe.hpp" #include "proc/engine/diagnostic-buffer-provider.hpp" #include "proc/engine/buffhandle.hpp" #include "proc/engine/bufftable.hpp" @@ -77,7 +78,6 @@ namespace test { void verifySimpleUsage() { -#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #829 // Create Test fixture. // In real usage, a suitable memory/frame/buffer provider // will be preconfigured, depending on the usage context @@ -88,6 +88,7 @@ namespace test { CHECK (sizeof(TestFrame) <= buff.size()); buff.create() = testData(0); +#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #829 TestFrame* storage = *buff; CHECK (testData(0) == *storage); diff --git a/tests/components/proc/engine/testframe.hpp b/tests/components/proc/engine/testframe.hpp new file mode 100644 index 000000000..0ea6a8d75 --- /dev/null +++ b/tests/components/proc/engine/testframe.hpp @@ -0,0 +1,81 @@ +/* + TESTFRAME.hpp - test data frame (stub) for checking Render engine functionality + + Copyright (C) Lumiera.org + 2011, 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 PROC_ENGINE_TESTFRAME_H +#define PROC_ENGINE_TESTFRAME_H + + +//#include "lib/time/timevalue.hpp" + +//#include + + +//using std::tr1::shared_ptr; +//using std::string; + + +namespace engine { +namespace test { + + +//class TestPlacement; + + /** + * Mock data frame for simulated rendering. + * A test frame can be created and placed instead of a real data frame. + * It doesn't depend on any external libraries and will be self-maintaining. + * Placeholder functions are provided for assignment (simulating the actual + * calculations); additional diagnostic functions allow to verify the + * performed operations after-the fact + * + * @todo WIP-WIP-WIP 9/11 + * + */ + class TestFrame + { + + public: + }; + + + + TestFrame + testData (uint seqNr) + { + UNIMPLEMENTED ("build, memorise and expose test data frames on demand"); + } + + TestFrame + testData (uint chanNr, uint seqNr) + { + UNIMPLEMENTED ("build, memorise and expose test data frames on demand (multi-channel)"); + } + + + + /* == some test data to check == */ + // extern const lib::time::Duration LENGTH_TestClip; + + +}} // namespace engine::test +#endif