stubbing of basic buffer provider functionality
This commit is contained in:
parent
ca615b9933
commit
cafe271830
5 changed files with 121 additions and 8 deletions
|
|
@ -63,6 +63,13 @@ namespace engine {
|
|||
return provider_->verifyValidity(*this);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BuffHandle::release()
|
||||
{
|
||||
UNIMPLEMENTED ("forward buffer release call to buffer provider");
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace engine
|
||||
|
|
|
|||
|
|
@ -132,9 +132,16 @@ namespace engine {
|
|||
// using standard copy operations
|
||||
|
||||
|
||||
|
||||
void release();
|
||||
|
||||
|
||||
template<typename BU>
|
||||
BU& create();
|
||||
|
||||
template<typename BU>
|
||||
BU& accessAs();
|
||||
|
||||
|
||||
Buff&
|
||||
operator* () const
|
||||
|
|
@ -175,6 +182,18 @@ namespace engine {
|
|||
}
|
||||
|
||||
|
||||
/** convenience shortcuts: access the buffer contents in a typesafe fashion.
|
||||
* This is equivalent to a plain dereferentiation with additional metadata check
|
||||
* @throw error::Logic in case of type mismatch \c LUMIERA_ERROR_WRONG_TYPE
|
||||
*/
|
||||
template<typename BU>
|
||||
BU&
|
||||
BuffHandle::accessAs()
|
||||
{
|
||||
UNIMPLEMENTED ("convenience shortcut to access buffer contents typesafe");
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace engine
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -47,6 +47,23 @@ namespace engine {
|
|||
class DiagnosticBufferProvider
|
||||
: public BufferProvider
|
||||
{
|
||||
|
||||
|
||||
/* === BufferProvider Implementation === */
|
||||
|
||||
virtual BuffHandle
|
||||
lockBufferFor (BufferDescriptor const& descriptor)
|
||||
{
|
||||
UNIMPLEMENTED ("lock buffer for exclusive use");
|
||||
}
|
||||
|
||||
virtual void
|
||||
releaseBuffer (BuffHandle const& handle)
|
||||
{
|
||||
UNIMPLEMENTED ("release a buffer and invalidate the handle");
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
/** build a new Diagnostic Buffer Provider instance,
|
||||
* discard the existing one. Use the static query API
|
||||
|
|
@ -57,6 +74,60 @@ namespace engine {
|
|||
UNIMPLEMENTED ("Diagnostic Buffer Provider instance");
|
||||
}
|
||||
|
||||
|
||||
/** access the diagnostic API of the buffer provider
|
||||
* @throw error::Invalid if the given provider doesn't allow
|
||||
* for diagnostic access or wasn't registered beforehand.
|
||||
*/
|
||||
static DiagnosticBufferProvider&
|
||||
access (BufferProvider const& provider)
|
||||
{
|
||||
UNIMPLEMENTED ("access existing instance linked to the given provider");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* === diagnostic API === */
|
||||
|
||||
bool
|
||||
buffer_was_used (uint bufferID)
|
||||
{
|
||||
UNIMPLEMENTED ("check usage flag of a specific buffer");
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
buffer_was_closed (uint bufferID)
|
||||
{
|
||||
UNIMPLEMENTED ("check closed-flag of a specific buffer");
|
||||
}
|
||||
|
||||
|
||||
template<typename BU>
|
||||
bool
|
||||
object_was_attached (uint bufferID)
|
||||
{
|
||||
UNIMPLEMENTED ("verify object attachment status of a specific buffer");
|
||||
}
|
||||
|
||||
|
||||
template<typename BU>
|
||||
bool
|
||||
object_was_destroyed (uint bufferID)
|
||||
{
|
||||
UNIMPLEMENTED ("verify object attachment status of a specific buffer");
|
||||
}
|
||||
|
||||
|
||||
void*
|
||||
accessStorage (uint bufferID)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -88,22 +88,20 @@ namespace test {
|
|||
CHECK (sizeof(TestFrame) <= buff.size());
|
||||
buff.create<TestFrame>() = testData(0);
|
||||
|
||||
#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #829
|
||||
TestFrame* storage = *buff;
|
||||
CHECK (testData(0) == *storage);
|
||||
TestFrame& storage = buff.accessAs<TestFrame>();
|
||||
CHECK (testData(0) == storage);
|
||||
|
||||
buff.release();
|
||||
CHECK (!buff.isValid());
|
||||
VERIFY_ERROR (LIFECYCLE, *buff );
|
||||
VERIFY_ERROR (LIFECYCLE, buff.accessAs<TestFrame>() );
|
||||
|
||||
DiagnosticBufferProvider checker = DiagnosticBufferProvider::access(provider);
|
||||
DiagnosticBufferProvider& checker = DiagnosticBufferProvider::access(provider);
|
||||
CHECK (checker.buffer_was_used (0));
|
||||
CHECK (checker.buffer_was_closed (0));
|
||||
CHECK (checker.object_was_attached<TestFrame> ());
|
||||
CHECK (checker.object_was_destroyed<TestFrame> ());
|
||||
CHECK (checker.object_was_attached<TestFrame> (0));
|
||||
CHECK (checker.object_was_destroyed<TestFrame> (0));
|
||||
|
||||
CHECK (testData(0) == checker.accessStorage (0));
|
||||
#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #829
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -55,6 +55,24 @@ namespace test {
|
|||
{
|
||||
|
||||
public:
|
||||
|
||||
bool
|
||||
operator== (void* memLocation)
|
||||
{
|
||||
UNIMPLEMENTED ("verify contents of an arbitrary memory location");
|
||||
}
|
||||
|
||||
friend bool
|
||||
operator== (TestFrame const& f1, TestFrame const& f2)
|
||||
{
|
||||
UNIMPLEMENTED ("equality of test data frames");
|
||||
}
|
||||
|
||||
friend bool
|
||||
operator!= (TestFrame const& f1, TestFrame const& f2)
|
||||
{
|
||||
return !(f1 == f2);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue