First step towards introducing the global RX object buffer

This commit is contained in:
Pavel Kirienko
2015-05-28 13:49:01 +03:00
parent 954ab2491a
commit d4e49d518a
4 changed files with 25 additions and 23 deletions
@@ -18,7 +18,8 @@ class UAVCAN_EXPORT IMarshalBuffer : public ITransferBuffer
{
public:
virtual const uint8_t* getDataPtr() const = 0;
virtual unsigned getDataLength() const = 0;
virtual unsigned getMaxWritePos() const = 0;
virtual unsigned getSize() const = 0;
};
/**
@@ -43,10 +44,8 @@ public:
/**
* Default implementation of marshal buffer provider.
* This implementation provides the buffer large enough to
* serialize any UAVCAN data structure.
*/
template <unsigned MaxSize_ = MaxPossibleTransferPayloadLen>
template <unsigned MaxSize_>
class UAVCAN_EXPORT MarshalBufferProvider : public IMarshalBufferProvider
{
class Buffer : public IMarshalBuffer
@@ -65,7 +64,9 @@ class UAVCAN_EXPORT MarshalBufferProvider : public IMarshalBufferProvider
virtual const uint8_t* getDataPtr() const { return buf_.getRawPtr(); }
virtual unsigned getDataLength() const { return buf_.getMaxWritePos(); }
virtual unsigned getMaxWritePos() const { return buf_.getMaxWritePos(); }
virtual unsigned getSize() const { return MaxSize_; }
public:
void reset() { buf_.reset(); }