start drafting a (dummy) output slot implementation
this implicates a first attempt to build a dummy buffer provider implementation. Mostly just defining stubs here....
This commit is contained in:
parent
c8458ab397
commit
59dfb7c660
2 changed files with 82 additions and 6 deletions
|
|
@ -181,7 +181,7 @@ namespace play {
|
||||||
|
|
||||||
private: // Implementation details
|
private: // Implementation details
|
||||||
|
|
||||||
DataSink
|
static DataSink
|
||||||
connectOutputSink (CON& connection)
|
connectOutputSink (CON& connection)
|
||||||
{
|
{
|
||||||
DataSink newSink;
|
DataSink newSink;
|
||||||
|
|
@ -189,9 +189,10 @@ namespace play {
|
||||||
return newSink;
|
return newSink;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
shutdownConnection (CON* toClose)
|
shutdownConnection (void* toClose)
|
||||||
{
|
{
|
||||||
|
///////////////////////////////////////////////////////////TODO problem: is it possible to pass the concrete type????
|
||||||
UNIMPLEMENTED ("how to mark a connection as closed");
|
UNIMPLEMENTED ("how to mark a connection as closed");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -32,15 +32,19 @@
|
||||||
|
|
||||||
|
|
||||||
#include "lib/error.hpp"
|
#include "lib/error.hpp"
|
||||||
|
#include "include/logging.h"
|
||||||
#include "proc/play/output-slot.hpp"
|
#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 "lib/iter-source.hpp" ////////////TODO really going down that path...?
|
||||||
#include "proc/engine/testframe.hpp"
|
#include "proc/engine/testframe.hpp"
|
||||||
//#include "lib/sync.hpp"
|
//#include "lib/sync.hpp"
|
||||||
|
|
||||||
//#include <boost/noncopyable.hpp>
|
#include <boost/noncopyable.hpp>
|
||||||
//#include <string>
|
//#include <string>
|
||||||
//#include <vector>
|
//#include <vector>
|
||||||
//#include <tr1/memory>
|
#include <tr1/memory>
|
||||||
//#include <boost/scoped_ptr.hpp>
|
//#include <boost/scoped_ptr.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -48,14 +52,77 @@ namespace proc {
|
||||||
namespace play {
|
namespace play {
|
||||||
|
|
||||||
//using std::string;
|
//using std::string;
|
||||||
|
using ::engine::BufferDescriptor;
|
||||||
using ::engine::test::TestFrame;
|
using ::engine::test::TestFrame;
|
||||||
|
using ::engine::TrackingHeapBlockProvider;
|
||||||
|
|
||||||
//using std::vector;
|
//using std::vector;
|
||||||
//using std::tr1::shared_ptr;
|
using std::tr1::shared_ptr;
|
||||||
//using boost::scoped_ptr;
|
//using boost::scoped_ptr;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class TrackingInMemoryBlockSequence
|
||||||
|
: public OutputSlot::Connection
|
||||||
|
{
|
||||||
|
|
||||||
|
shared_ptr<BufferProvider> 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<TestFrame>())
|
||||||
|
{
|
||||||
|
INFO (engine_dbg, "building in-memory diagnostic output sequence");
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual
|
||||||
|
~TrackingInMemoryBlockSequence()
|
||||||
|
{
|
||||||
|
INFO (engine_dbg, "releasing diagnostic output sequence");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class SimulatedOutputSequences
|
||||||
|
: public ConnectionStateManager<TrackingInMemoryBlockSequence>
|
||||||
|
, boost::noncopyable
|
||||||
|
{
|
||||||
|
TrackingInMemoryBlockSequence
|
||||||
|
buildConnection()
|
||||||
|
{
|
||||||
|
return TrackingInMemoryBlockSequence();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
* Helper for unit tests: Mock output sink.
|
* Helper for unit tests: Mock output sink.
|
||||||
*
|
*
|
||||||
|
|
@ -64,6 +131,14 @@ namespace play {
|
||||||
class DiagnosticOutputSlot
|
class DiagnosticOutputSlot
|
||||||
: public OutputSlot
|
: public OutputSlot
|
||||||
{
|
{
|
||||||
|
/* === hook into the OutputSlot frontend === */
|
||||||
|
ConnectionState*
|
||||||
|
buildState()
|
||||||
|
{
|
||||||
|
return new SimulatedOutputSequences();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** build a new Diagnostic Output Slot instance,
|
/** build a new Diagnostic Output Slot instance,
|
||||||
* discard the existing one. Use the static query API
|
* discard the existing one. Use the static query API
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue