diff --git a/src/proc/play/output-slot-connection.hpp b/src/proc/play/output-slot-connection.hpp index 570ca3ebf..93efd8ca9 100644 --- a/src/proc/play/output-slot-connection.hpp +++ b/src/proc/play/output-slot-connection.hpp @@ -181,7 +181,7 @@ namespace play { private: // Implementation details - DataSink + static DataSink connectOutputSink (CON& connection) { DataSink newSink; @@ -189,9 +189,10 @@ namespace play { return newSink; } - void - shutdownConnection (CON* toClose) + static void + shutdownConnection (void* toClose) { + ///////////////////////////////////////////////////////////TODO problem: is it possible to pass the concrete type???? UNIMPLEMENTED ("how to mark a connection as closed"); } }; diff --git a/tests/components/proc/play/diagnostic-output-slot.hpp b/tests/components/proc/play/diagnostic-output-slot.hpp index ffd1ce829..39105874c 100644 --- a/tests/components/proc/play/diagnostic-output-slot.hpp +++ b/tests/components/proc/play/diagnostic-output-slot.hpp @@ -32,15 +32,19 @@ #include "lib/error.hpp" +#include "include/logging.h" #include "proc/play/output-slot.hpp" +#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 "proc/engine/testframe.hpp" //#include "lib/sync.hpp" -//#include +#include //#include //#include -//#include +#include //#include @@ -48,14 +52,77 @@ namespace proc { namespace play { //using std::string; + using ::engine::BufferDescriptor; using ::engine::test::TestFrame; + using ::engine::TrackingHeapBlockProvider; //using std::vector; -//using std::tr1::shared_ptr; + using std::tr1::shared_ptr; //using boost::scoped_ptr; + class TrackingInMemoryBlockSequence + : public OutputSlot::Connection + { + + shared_ptr buffProvider_; + BufferDescriptor bufferType_; + + + /* === Connection API === */ + + void + lock (FrameID) + { + buffProvider_->lockBufferFor (bufferType_); + /////////////////////////////////////////////////TODO: should return that + } + + void + transfer (FrameID frameNr) + { + pushout (frameNr); + } + + void + pushout (FrameID) + { + UNIMPLEMENTED ("simulate output"); + } + + + public: + TrackingInMemoryBlockSequence() + : buffProvider_(new TrackingHeapBlockProvider()) + , bufferType_(buffProvider_->getDescriptor()) + { + INFO (engine_dbg, "building in-memory diagnostic output sequence"); + } + + virtual + ~TrackingInMemoryBlockSequence() + { + INFO (engine_dbg, "releasing diagnostic output sequence"); + } + }; + + + class SimulatedOutputSequences + : public ConnectionStateManager + , boost::noncopyable + { + TrackingInMemoryBlockSequence + buildConnection() + { + return TrackingInMemoryBlockSequence(); + } + }; + + + + + /******************************************************************** * Helper for unit tests: Mock output sink. * @@ -64,6 +131,14 @@ namespace play { class DiagnosticOutputSlot : public OutputSlot { + /* === hook into the OutputSlot frontend === */ + ConnectionState* + buildState() + { + return new SimulatedOutputSequences(); + } + + public: /** build a new Diagnostic Output Slot instance, * discard the existing one. Use the static query API