diff --git a/src/lib/multifact.hpp b/src/lib/multifact.hpp index b598a198d..29bef6bce 100644 --- a/src/lib/multifact.hpp +++ b/src/lib/multifact.hpp @@ -21,7 +21,7 @@ */ /** @file multifact.hpp - ** Building blocks of a configurable factory, generating families of related objects. + ** Building blocks to create a configurable factory, generating families of related objects. ** Serving the "classical" factory situation: obtaining objects of various kinds, which ** are related somehow (usually through an common interface). The creation of these ** objects is non-trivial while number and exact parametrisation aren't known beforehand @@ -70,7 +70,7 @@ namespace lib { namespace factory { - //////TODO: couldn't these wrappers be extracted into a separate header? + /////////////////////////////////TICKET #470 : couldn't these wrappers be extracted into a separate header? /** * Dummy "wrapper", diff --git a/src/proc/engine/buffhandle-attach.hpp b/src/proc/engine/buffhandle-attach.hpp index aee29c386..f0447bcad 100644 --- a/src/proc/engine/buffhandle-attach.hpp +++ b/src/proc/engine/buffhandle-attach.hpp @@ -25,7 +25,7 @@ ** This extension is mostly helpful for writing unit-tests, and beyond that for the ** rather unusual case where we need to place an full-blown object into the buffer, ** instead of just plain data. A possible use case for this mechanism is to allow for - ** state pre calculation stream, feeding this local state to the individual render node + ** state per calculation stream, feeding this local state to the individual render node ** embedded into a "state frame". Some effect processors indeed need to maintain state ** beyond the single frame (e.g. averaging, integrating, sound compression), which usually ** is handled by applying an "instance" of that processor to the frames to be calculated diff --git a/src/proc/engine/diagnostic-buffer-provider.hpp b/src/proc/engine/diagnostic-buffer-provider.hpp index 8355188b6..9d1f3f303 100644 --- a/src/proc/engine/diagnostic-buffer-provider.hpp +++ b/src/proc/engine/diagnostic-buffer-provider.hpp @@ -21,7 +21,7 @@ */ /** @file diagnostic-buffer-provider.hpp - ** An facility for writing unit-tests targeting the BufferProvider interface. + ** A facility for writing unit-tests targeting the BufferProvider interface. ** ** @see buffer-provider-protocol-test.cpp */ diff --git a/src/proc/engine/tracking-heap-block-provider.cpp b/src/proc/engine/tracking-heap-block-provider.cpp index c9f96aa28..695f5674c 100644 --- a/src/proc/engine/tracking-heap-block-provider.cpp +++ b/src/proc/engine/tracking-heap-block-provider.cpp @@ -309,7 +309,7 @@ namespace engine { TrackingHeapBlockProvider::locateBlock (HashVal typeID, void* storage) { diagn::BlockPool& pool = getBlockPoolFor (typeID); - diagn::Block* block4buffer = pool.find (storage); + diagn::Block* block4buffer = pool.find (storage); ////////////////////////////////TICKET #856 return block4buffer? block4buffer : searchInOutSeqeuence (storage); } @@ -317,7 +317,7 @@ namespace engine { diagn::Block* TrackingHeapBlockProvider::searchInOutSeqeuence (void* blockLocation) { - return pick_Block_by_storage (outSeq_, blockLocation); + return pick_Block_by_storage (outSeq_, blockLocation); ////////////////////////////////TICKET #856 } diff --git a/src/proc/engine/tracking-heap-block-provider.hpp b/src/proc/engine/tracking-heap-block-provider.hpp index d9aa53c26..a6db03431 100644 --- a/src/proc/engine/tracking-heap-block-provider.hpp +++ b/src/proc/engine/tracking-heap-block-provider.hpp @@ -66,7 +66,7 @@ namespace engine { /** - * Helper for a diagnostic BufferProvider: + * Helper for implementing a diagnostic BufferProvider: * A block of heap allocated storage, with the capability * to store some additional tracking information. */ diff --git a/src/proc/play/output-slot-connection.hpp b/src/proc/play/output-slot-connection.hpp index 4ab5bdc8b..e4e9b6787 100644 --- a/src/proc/play/output-slot-connection.hpp +++ b/src/proc/play/output-slot-connection.hpp @@ -52,7 +52,7 @@ #include #include //#include -//#include +#include //#include @@ -66,7 +66,7 @@ namespace play { using lib::transform; using lib::iter_stl::eachElm; -//using std::vector; + using std::vector; //using std::tr1::shared_ptr; using boost::scoped_ptr; @@ -145,7 +145,7 @@ namespace play { : public OutputSlot::ConnectionState , public vector { - + typedef vector Connections; typedef OutputSlot::OpenedSinks OpenedSinks; @@ -161,7 +161,7 @@ namespace play { bool isActive() { - return 0 < vector::size(); + return 0 < Connections::size(); } diff --git a/src/proc/play/output-slot.hpp b/src/proc/play/output-slot.hpp index 095bfb5e1..6fe5b09a2 100644 --- a/src/proc/play/output-slot.hpp +++ b/src/proc/play/output-slot.hpp @@ -82,7 +82,7 @@ namespace play { protected: - /** Table to maintain connection state */ + /** active connections through this OutputSlot */ class ConnectionState; scoped_ptr state_; diff --git a/tests/components/proc/play/diagnostic-output-slot.hpp b/tests/components/proc/play/diagnostic-output-slot.hpp index e3c45cac1..4023132c2 100644 --- a/tests/components/proc/play/diagnostic-output-slot.hpp +++ b/tests/components/proc/play/diagnostic-output-slot.hpp @@ -37,7 +37,8 @@ #include "proc/play/output-slot-connection.hpp" #include "proc/engine/buffhandle.hpp" #include "proc/engine/tracking-heap-block-provider.hpp" -#include "lib/iter-source.hpp" ////////////TODO really going down that path...? +#include "lib/scoped-ptrvect.hpp" +#include "lib/iter-source.hpp" #include "proc/engine/testframe.hpp" //#include "lib/sync.hpp" @@ -55,6 +56,7 @@ namespace play { using proc::engine::BufferDescriptor; using proc::engine::test::TestFrame; using proc::engine::TrackingHeapBlockProvider; + namespace diagn = proc::engine::diagn; //using std::vector; using std::tr1::shared_ptr; @@ -127,12 +129,34 @@ namespace play { { INFO (engine_dbg, "releasing diagnostic output sequence"); } + + + /* === Diagnostic API === */ + + TestFrame* + accessEmittedFrame (uint frameNo) const + { + REQUIRE (buffProvider_); + if (frameNo <= buffProvider_->emittedCnt()) + return &buffProvider_->accessAs (frameNo); + else + return 0; ////////////////////////////////TICKET #856 + } + + diagn::Block* + accessEmittedBuffer (uint bufferNo) const + { + REQUIRE (buffProvider_); + if (bufferNo <= buffProvider_->emittedCnt()) + return buffProvider_->access_emitted (bufferNo); + else + return 0; + } }; class SimulatedOutputSequences : public ConnectionStateManager - , boost::noncopyable { TrackingInMemoryBlockSequence buildConnection() @@ -162,13 +186,28 @@ namespace play { static const uint MAX_CHANNELS = 5; - /* === hook into the OutputSlot frontend === */ + /** hook into the OutputSlot frontend */ ConnectionState* buildState() { return new SimulatedOutputSequences(MAX_CHANNELS); } + /** @internal is self-managed and non-copyable. + * Clients use #build() to get an instance */ + DiagnosticOutputSlot() { } + + /** @internal access the implementation object + * representing a single stream connection + */ + TrackingInMemoryBlockSequence const& + accessSequence (uint channel) + { + REQUIRE (!isFree(), "diagnostic OutputSlot not (yet) connected"); + REQUIRE (channel <= MAX_CHANNELS); + return static_cast (*state_).at(channel); + } + public: /** build a new Diagnostic Output Slot instance, @@ -177,50 +216,81 @@ namespace play { static OutputSlot& build() { - UNIMPLEMENTED ("Diagnostic Output Slot instance"); + static lib::ScopedPtrVect diagnosticSlots; + return diagnosticSlots.manage(new DiagnosticOutputSlot); } static DiagnosticOutputSlot& access (OutputSlot& to_investigate) { - UNIMPLEMENTED ("access the diagnostics data for the given OutputSlot instance"); + return dynamic_cast (to_investigate); } + /* === diagnostics API === */ /** - * diagnostic facility to verify - * test data frames written to this - * Test/Dummy "output" + * diagnostic facility to verify test data frames + * written to this Test/Dummy "output". It exposes + * the emitted Data as a sequence of TestFrame objects. */ - struct OutputStreamProtocol - : lib::IterSource + class OutputFramesLog + : public lib::IterSource + , boost::noncopyable { - /////////////TODO: implement the extension points required to drive an IterSource + TrackingInMemoryBlockSequence const& outSeq_; + uint currentFrame_; + + + virtual Pos + firstResult () + { + REQUIRE (0 == currentFrame_); + return outSeq_.accessEmittedFrame (currentFrame_); + } + + virtual void + nextResult (Pos& pos) + { + ++currentFrame_; + pos = outSeq_.accessEmittedFrame(currentFrame_); + } + + public: + OutputFramesLog (TrackingInMemoryBlockSequence const& bs) + : outSeq_(bs) + , currentFrame_(0) + { } }; - typedef OutputStreamProtocol::iterator OutFrames; + typedef OutputFramesLog::iterator OutFrames; OutFrames getChannel (uint channel) { - UNIMPLEMENTED ("access output stream tracing entry"); + REQUIRE (channel < MAX_CHANNELS); + return OutputFramesLog::build( + new OutputFramesLog ( + accessSequence(channel))); } bool buffer_was_used (uint channel, FrameID frame) { - UNIMPLEMENTED ("determine if the denoted buffer was indeed used"); + diagn::Block* block = accessSequence(channel) + .accessEmittedBuffer(frame); + return block + && block->was_used(); } bool buffer_unused (uint channel, FrameID frame) { - UNIMPLEMENTED ("determine if the specified buffer was never touched/locked for use"); + return !buffer_was_used(channel, frame); } diff --git a/tests/components/proc/play/output-slot-protocol-test.cpp b/tests/components/proc/play/output-slot-protocol-test.cpp index ac92dd62e..480b664c8 100644 --- a/tests/components/proc/play/output-slot-protocol-test.cpp +++ b/tests/components/proc/play/output-slot-protocol-test.cpp @@ -63,7 +63,6 @@ namespace test { virtual void run (Arg) { - UNIMPLEMENTED ("build a mock output slot and perform a full lifecycle"); verifyStandardCase(); }