mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-04 20:01:36 +08:00
Add override keyword to those methods requiring it
This commit is contained in:
@@ -74,10 +74,10 @@ public:
|
|||||||
|
|
||||||
PoolAllocator();
|
PoolAllocator();
|
||||||
|
|
||||||
virtual void* allocate(std::size_t size);
|
virtual void* allocate(std::size_t size) override;
|
||||||
virtual void deallocate(const void* ptr);
|
virtual void deallocate(const void* ptr) override;
|
||||||
|
|
||||||
virtual uint16_t getBlockCapacity() const { return NumBlocks; }
|
virtual uint16_t getBlockCapacity() const override { return NumBlocks; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the number of blocks that are currently allocated/unallocated.
|
* Return the number of blocks that are currently allocated/unallocated.
|
||||||
@@ -124,10 +124,10 @@ public:
|
|||||||
UAVCAN_ASSERT(max_blocks_ > 0);
|
UAVCAN_ASSERT(max_blocks_ > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void* allocate(std::size_t size);
|
virtual void* allocate(std::size_t size) override;
|
||||||
virtual void deallocate(const void* ptr);
|
virtual void deallocate(const void* ptr) override;
|
||||||
|
|
||||||
virtual uint16_t getBlockCapacity() const;
|
virtual uint16_t getBlockCapacity() const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ public:
|
|||||||
* Takes a block from the reserve, unless it's empty.
|
* Takes a block from the reserve, unless it's empty.
|
||||||
* In the latter case, allocates a new block in the heap.
|
* In the latter case, allocates a new block in the heap.
|
||||||
*/
|
*/
|
||||||
virtual void* allocate(std::size_t size)
|
virtual void* allocate(std::size_t size) override
|
||||||
{
|
{
|
||||||
if (size > BlockSize)
|
if (size > BlockSize)
|
||||||
{
|
{
|
||||||
@@ -140,7 +140,7 @@ public:
|
|||||||
* Puts the block back to reserve.
|
* Puts the block back to reserve.
|
||||||
* The block will not be free()d automatically; see @ref shrink().
|
* The block will not be free()d automatically; see @ref shrink().
|
||||||
*/
|
*/
|
||||||
virtual void deallocate(const void* ptr)
|
virtual void deallocate(const void* ptr) override
|
||||||
{
|
{
|
||||||
if (ptr != UAVCAN_NULLPTR)
|
if (ptr != UAVCAN_NULLPTR)
|
||||||
{
|
{
|
||||||
@@ -158,7 +158,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* The soft limit.
|
* The soft limit.
|
||||||
*/
|
*/
|
||||||
virtual uint16_t getBlockCapacity() const { return capacity_soft_limit_; }
|
virtual uint16_t getBlockCapacity() const override { return capacity_soft_limit_; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The hard limit.
|
* The hard limit.
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ class UAVCAN_EXPORT GenericSubscriber : public GenericSubscriberBase
|
|||||||
{
|
{
|
||||||
SelfType& obj_;
|
SelfType& obj_;
|
||||||
|
|
||||||
void handleIncomingTransfer(IncomingTransfer& transfer)
|
void handleIncomingTransfer(IncomingTransfer& transfer) override
|
||||||
{
|
{
|
||||||
obj_.handleIncomingTransfer(transfer);
|
obj_.handleIncomingTransfer(transfer);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ class UAVCAN_EXPORT Node : public INode
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void registerInternalFailure(const char* msg)
|
virtual void registerInternalFailure(const char* msg) override
|
||||||
{
|
{
|
||||||
internal_failure_cnt_++;
|
internal_failure_cnt_++;
|
||||||
UAVCAN_TRACE("Node", "Internal failure: %s", msg);
|
UAVCAN_TRACE("Node", "Internal failure: %s", msg);
|
||||||
@@ -112,10 +112,10 @@ public:
|
|||||||
commonInit();
|
commonInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual typename RemoveReference<Allocator>::Type& getAllocator() { return pool_allocator_; }
|
virtual typename RemoveReference<Allocator>::Type& getAllocator() override { return pool_allocator_; }
|
||||||
|
|
||||||
virtual Scheduler& getScheduler() { return scheduler_; }
|
virtual Scheduler& getScheduler() override { return scheduler_; }
|
||||||
virtual const Scheduler& getScheduler() const { return scheduler_; }
|
virtual const Scheduler& getScheduler() const override { return scheduler_; }
|
||||||
|
|
||||||
int spin(MonotonicTime deadline)
|
int spin(MonotonicTime deadline)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ protected:
|
|||||||
const ServiceCallID id_;
|
const ServiceCallID id_;
|
||||||
bool timed_out_;
|
bool timed_out_;
|
||||||
|
|
||||||
virtual void handleDeadline(MonotonicTime);
|
virtual void handleDeadline(MonotonicTime) override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CallState(INode& node, ServiceClientBase& owner, ServiceCallID call_id)
|
CallState(INode& node, ServiceClientBase& owner, ServiceCallID call_id)
|
||||||
@@ -262,13 +262,13 @@ private:
|
|||||||
PublisherType publisher_;
|
PublisherType publisher_;
|
||||||
Callback callback_;
|
Callback callback_;
|
||||||
|
|
||||||
virtual bool shouldAcceptFrame(const RxFrame& frame) const; // Called from the transfer listener
|
virtual bool shouldAcceptFrame(const RxFrame& frame) const override; // Called from the transfer listener
|
||||||
|
|
||||||
void invokeCallback(ServiceCallResultType& result);
|
void invokeCallback(ServiceCallResultType& result);
|
||||||
|
|
||||||
virtual void handleReceivedDataStruct(ReceivedDataStructure<ResponseType>& response);
|
virtual void handleReceivedDataStruct(ReceivedDataStructure<ResponseType>& response) override;
|
||||||
|
|
||||||
virtual void handleDeadline(MonotonicTime);
|
virtual void handleDeadline(MonotonicTime) override;
|
||||||
|
|
||||||
int addCallState(ServiceCallID call_id);
|
int addCallState(ServiceCallID call_id);
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ private:
|
|||||||
Callback callback_;
|
Callback callback_;
|
||||||
uint32_t response_failure_count_;
|
uint32_t response_failure_count_;
|
||||||
|
|
||||||
virtual void handleReceivedDataStruct(ReceivedDataStructure<RequestType>& request)
|
virtual void handleReceivedDataStruct(ReceivedDataStructure<RequestType>& request) override
|
||||||
{
|
{
|
||||||
UAVCAN_ASSERT(request.getTransferType() == TransferTypeServiceRequest);
|
UAVCAN_ASSERT(request.getTransferType() == TransferTypeServiceRequest);
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ private:
|
|||||||
|
|
||||||
Callback callback_;
|
Callback callback_;
|
||||||
|
|
||||||
virtual void handleReceivedDataStruct(ReceivedDataStructure<DataType_>& msg)
|
virtual void handleReceivedDataStruct(ReceivedDataStructure<DataType_>& msg) override
|
||||||
{
|
{
|
||||||
if (coerceOrFallback<bool>(callback_, true))
|
if (coerceOrFallback<bool>(callback_, true))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class UAVCAN_EXPORT TimerBase : private DeadlineHandler
|
|||||||
{
|
{
|
||||||
MonotonicDuration period_;
|
MonotonicDuration period_;
|
||||||
|
|
||||||
virtual void handleDeadline(MonotonicTime current);
|
virtual void handleDeadline(MonotonicTime current) override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using DeadlineHandler::stop;
|
using DeadlineHandler::stop;
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ class UAVCAN_EXPORT DynamicNodeIDClient : private TimerBase
|
|||||||
|
|
||||||
void restartTimer(const Mode mode);
|
void restartTimer(const Mode mode);
|
||||||
|
|
||||||
virtual void handleTimerEvent(const TimerEvent&);
|
virtual void handleTimerEvent(const TimerEvent&) override;
|
||||||
|
|
||||||
void handleAllocation(const ReceivedDataStructure<protocol::dynamic_node_id::Allocation>& msg);
|
void handleAllocation(const ReceivedDataStructure<protocol::dynamic_node_id::Allocation>& msg);
|
||||||
|
|
||||||
|
|||||||
@@ -50,12 +50,12 @@ class Server : public AbstractServer
|
|||||||
/*
|
/*
|
||||||
* Methods of IAllocationRequestHandler
|
* Methods of IAllocationRequestHandler
|
||||||
*/
|
*/
|
||||||
virtual bool canPublishFollowupAllocationResponse() const
|
virtual bool canPublishFollowupAllocationResponse() const override
|
||||||
{
|
{
|
||||||
return true; // Because there's only one Centralized server in the system
|
return true; // Because there's only one Centralized server in the system
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void handleAllocationRequest(const UniqueID& unique_id, const NodeID preferred_node_id)
|
virtual void handleAllocationRequest(const UniqueID& unique_id, const NodeID preferred_node_id) override
|
||||||
{
|
{
|
||||||
const NodeID existing_node_id = storage_.getNodeIDForUniqueID(unique_id);
|
const NodeID existing_node_id = storage_.getNodeIDForUniqueID(unique_id);
|
||||||
if (existing_node_id.isValid())
|
if (existing_node_id.isValid())
|
||||||
@@ -90,17 +90,17 @@ class Server : public AbstractServer
|
|||||||
/*
|
/*
|
||||||
* Methods of INodeDiscoveryHandler
|
* Methods of INodeDiscoveryHandler
|
||||||
*/
|
*/
|
||||||
virtual bool canDiscoverNewNodes() const
|
virtual bool canDiscoverNewNodes() const override
|
||||||
{
|
{
|
||||||
return true; // Because there's only one Centralized server in the system
|
return true; // Because there's only one Centralized server in the system
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual NodeAwareness checkNodeAwareness(NodeID node_id) const
|
virtual NodeAwareness checkNodeAwareness(NodeID node_id) const override
|
||||||
{
|
{
|
||||||
return storage_.isNodeIDOccupied(node_id) ? NodeAwarenessKnownAndCommitted : NodeAwarenessUnknown;
|
return storage_.isNodeIDOccupied(node_id) ? NodeAwarenessKnownAndCommitted : NodeAwarenessUnknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void handleNewNodeDiscovery(const UniqueID* unique_id_or_null, NodeID node_id)
|
virtual void handleNewNodeDiscovery(const UniqueID* unique_id_or_null, NodeID node_id) override
|
||||||
{
|
{
|
||||||
if (storage_.isNodeIDOccupied(node_id))
|
if (storage_.isNodeIDOccupied(node_id))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ class NodeDiscoverer : TimerBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleTimerEvent(const TimerEvent&)
|
void handleTimerEvent(const TimerEvent&) override
|
||||||
{
|
{
|
||||||
if (get_node_info_client_.hasPendingCalls())
|
if (get_node_info_client_.hasPendingCalls())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ class UAVCAN_EXPORT NodeStatusProvider : private TimerBase
|
|||||||
|
|
||||||
int publish();
|
int publish();
|
||||||
|
|
||||||
virtual void handleTimerEvent(const TimerEvent&);
|
virtual void handleTimerEvent(const TimerEvent&) override;
|
||||||
void handleGetNodeInfoRequest(const protocol::GetNodeInfo::Request&, protocol::GetNodeInfo::Response& rsp);
|
void handleGetNodeInfoRequest(const protocol::GetNodeInfo::Request&, protocol::GetNodeInfo::Response& rsp);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ public:
|
|||||||
max_write_pos_(0)
|
max_write_pos_(0)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
virtual int read(unsigned offset, uint8_t* data, unsigned len) const;
|
virtual int read(unsigned offset, uint8_t* data, unsigned len) const override;
|
||||||
virtual int write(unsigned offset, const uint8_t* data, unsigned len);
|
virtual int write(unsigned offset, const uint8_t* data, unsigned len) override;
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
@@ -138,8 +138,8 @@ public:
|
|||||||
static TransferBufferManagerEntry* instantiate(IPoolAllocator& allocator, uint16_t max_size);
|
static TransferBufferManagerEntry* instantiate(IPoolAllocator& allocator, uint16_t max_size);
|
||||||
static void destroy(TransferBufferManagerEntry*& obj, IPoolAllocator& allocator);
|
static void destroy(TransferBufferManagerEntry*& obj, IPoolAllocator& allocator);
|
||||||
|
|
||||||
virtual int read(unsigned offset, uint8_t* data, unsigned len) const;
|
virtual int read(unsigned offset, uint8_t* data, unsigned len) const override;
|
||||||
virtual int write(unsigned offset, const uint8_t* data, unsigned len);
|
virtual int write(unsigned offset, const uint8_t* data, unsigned len) override;
|
||||||
|
|
||||||
void reset(const TransferBufferManagerKey& key = TransferBufferManagerKey());
|
void reset(const TransferBufferManagerKey& key = TransferBufferManagerKey());
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class UAVCAN_EXPORT IncomingTransfer : public ITransferBuffer
|
|||||||
uint8_t iface_index_;
|
uint8_t iface_index_;
|
||||||
|
|
||||||
/// That's a no-op, asserts in debug builds
|
/// That's a no-op, asserts in debug builds
|
||||||
virtual int write(unsigned offset, const uint8_t* data, unsigned len);
|
virtual int write(unsigned offset, const uint8_t* data, unsigned len) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
IncomingTransfer(MonotonicTime ts_mono, UtcTime ts_utc, TransferPriority transfer_priority,
|
IncomingTransfer(MonotonicTime ts_mono, UtcTime ts_utc, TransferPriority transfer_priority,
|
||||||
@@ -76,8 +76,8 @@ class UAVCAN_EXPORT SingleFrameIncomingTransfer : public IncomingTransfer
|
|||||||
const uint8_t payload_len_;
|
const uint8_t payload_len_;
|
||||||
public:
|
public:
|
||||||
explicit SingleFrameIncomingTransfer(const RxFrame& frm);
|
explicit SingleFrameIncomingTransfer(const RxFrame& frm);
|
||||||
virtual int read(unsigned offset, uint8_t* data, unsigned len) const;
|
virtual int read(unsigned offset, uint8_t* data, unsigned len) const override;
|
||||||
virtual bool isAnonymousTransfer() const;
|
virtual bool isAnonymousTransfer() const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -89,8 +89,8 @@ class UAVCAN_EXPORT MultiFrameIncomingTransfer : public IncomingTransfer, Noncop
|
|||||||
public:
|
public:
|
||||||
MultiFrameIncomingTransfer(MonotonicTime ts_mono, UtcTime ts_utc, const RxFrame& last_frame,
|
MultiFrameIncomingTransfer(MonotonicTime ts_mono, UtcTime ts_utc, const RxFrame& last_frame,
|
||||||
TransferBufferAccessor& tba);
|
TransferBufferAccessor& tba);
|
||||||
virtual int read(unsigned offset, uint8_t* data, unsigned len) const;
|
virtual int read(unsigned offset, uint8_t* data, unsigned len) const override;
|
||||||
virtual void release() { buf_acc_.remove(); }
|
virtual void release() override { buf_acc_.remove(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -174,7 +174,7 @@ class UAVCAN_EXPORT TransferListenerWithFilter : public TransferListener
|
|||||||
{
|
{
|
||||||
const ITransferAcceptanceFilter* filter_;
|
const ITransferAcceptanceFilter* filter_;
|
||||||
|
|
||||||
virtual void handleFrame(const RxFrame& frame);
|
virtual void handleFrame(const RxFrame& frame) override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TransferListenerWithFilter(TransferPerfCounter& perf, const DataTypeDescriptor& data_type,
|
TransferListenerWithFilter(TransferPerfCounter& perf, const DataTypeDescriptor& data_type,
|
||||||
|
|||||||
Reference in New Issue
Block a user