mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 22:53:33 +08:00
First step towards introducing the global RX object buffer
This commit is contained in:
@@ -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(); }
|
||||
|
||||
Reference in New Issue
Block a user