mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-05 22:20:39 +08:00
Scope hiding fixes
This commit is contained in:
@@ -38,13 +38,13 @@ struct UAVCAN_EXPORT CanFrame
|
||||
std::fill(data, data + MaxDataLen, 0);
|
||||
}
|
||||
|
||||
CanFrame(uint32_t id, const uint8_t* data, uint8_t data_len)
|
||||
: id(id)
|
||||
CanFrame(uint32_t arg_id, const uint8_t* arg_data, uint8_t data_len)
|
||||
: id(arg_id)
|
||||
, dlc((data_len > MaxDataLen) ? MaxDataLen : data_len)
|
||||
{
|
||||
assert(data != NULL);
|
||||
assert(arg_data != NULL);
|
||||
assert(data_len == dlc);
|
||||
std::copy(data, data + dlc, this->data);
|
||||
(void)std::copy(arg_data, arg_data + dlc, this->data);
|
||||
}
|
||||
|
||||
bool operator!=(const CanFrame& rhs) const { return !operator==(rhs); }
|
||||
|
||||
@@ -32,9 +32,9 @@ class UAVCAN_EXPORT MapBase : Noncopyable
|
||||
Key key;
|
||||
Value value;
|
||||
KVPair() { }
|
||||
KVPair(const Key& key, const Value& value)
|
||||
: key(key)
|
||||
, value(value)
|
||||
KVPair(const Key& arg_key, const Value& arg_value)
|
||||
: key(arg_key)
|
||||
, value(arg_value)
|
||||
{ }
|
||||
bool match(const Key& rhs) const { return rhs == key; }
|
||||
};
|
||||
|
||||
@@ -39,10 +39,10 @@ struct UAVCAN_EXPORT ServiceCallResult
|
||||
NodeID server_node_id;
|
||||
ResponseFieldType& response; ///< Either response contents or unspecified response structure
|
||||
|
||||
ServiceCallResult(Status status, NodeID server_node_id, ResponseFieldType& response)
|
||||
: status(status)
|
||||
, server_node_id(server_node_id)
|
||||
, response(response)
|
||||
ServiceCallResult(Status arg_status, NodeID arg_server_node_id, ResponseFieldType& arg_response)
|
||||
: status(arg_status)
|
||||
, server_node_id(arg_server_node_id)
|
||||
, response(arg_response)
|
||||
{
|
||||
assert(server_node_id.isUnicast());
|
||||
assert(status == Success || status == ErrorTimeout);
|
||||
|
||||
@@ -30,9 +30,9 @@ struct UAVCAN_EXPORT TimerEvent
|
||||
MonotonicTime scheduled_time;
|
||||
MonotonicTime real_time;
|
||||
|
||||
TimerEvent(MonotonicTime scheduled_time, MonotonicTime real_time)
|
||||
: scheduled_time(scheduled_time)
|
||||
, real_time(real_time)
|
||||
TimerEvent(MonotonicTime arg_scheduled_time, MonotonicTime arg_real_time)
|
||||
: scheduled_time(arg_scheduled_time)
|
||||
, real_time(arg_real_time)
|
||||
{ }
|
||||
};
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ class UAVCAN_EXPORT GlobalTimeSyncMaster : protected LoopbackFrameListenerBase
|
||||
class IfaceMaster
|
||||
{
|
||||
Publisher<protocol::GlobalTimeSync> pub_;
|
||||
MonotonicTime prev_pub_mono_;
|
||||
MonotonicTime iface_prev_pub_mono_;
|
||||
UtcTime prev_tx_utc_;
|
||||
const uint8_t iface_index_;
|
||||
|
||||
|
||||
@@ -50,11 +50,11 @@ public:
|
||||
uint8_t qos;
|
||||
CanIOFlags flags;
|
||||
|
||||
Entry(const CanFrame& frame, MonotonicTime deadline, Qos qos, CanIOFlags flags)
|
||||
: deadline(deadline)
|
||||
, frame(frame)
|
||||
, qos(uint8_t(qos))
|
||||
, flags(flags)
|
||||
Entry(const CanFrame& arg_frame, MonotonicTime arg_deadline, Qos arg_qos, CanIOFlags arg_flags)
|
||||
: deadline(arg_deadline)
|
||||
, frame(arg_frame)
|
||||
, qos(uint8_t(arg_qos))
|
||||
, flags(arg_flags)
|
||||
{
|
||||
assert((qos == Volatile) || (qos == Persistent));
|
||||
IsDynamicallyAllocatable<Entry>::check();
|
||||
|
||||
@@ -97,12 +97,12 @@ class UAVCAN_EXPORT TransferListenerBase : public LinkedListNode<TransferListene
|
||||
class TimedOutReceiverPredicate
|
||||
{
|
||||
const MonotonicTime ts_;
|
||||
ITransferBufferManager& bufmgr_;
|
||||
ITransferBufferManager& parent_bufmgr_;
|
||||
|
||||
public:
|
||||
TimedOutReceiverPredicate(MonotonicTime ts, ITransferBufferManager& bufmgr)
|
||||
: ts_(ts)
|
||||
, bufmgr_(bufmgr)
|
||||
TimedOutReceiverPredicate(MonotonicTime arg_ts, ITransferBufferManager& arg_bufmgr)
|
||||
: ts_(arg_ts)
|
||||
, parent_bufmgr_(arg_bufmgr)
|
||||
{ }
|
||||
|
||||
bool operator()(const TransferBufferManagerKey& key, const TransferReceiver& value) const;
|
||||
@@ -186,9 +186,9 @@ public:
|
||||
assert(!src_node_id.isValid());
|
||||
}
|
||||
|
||||
ExpectedResponseParams(NodeID src_node_id, TransferID transfer_id)
|
||||
: src_node_id(src_node_id)
|
||||
, transfer_id(transfer_id)
|
||||
ExpectedResponseParams(NodeID arg_src_node_id, TransferID arg_transfer_id)
|
||||
: src_node_id(arg_src_node_id)
|
||||
, transfer_id(arg_transfer_id)
|
||||
{
|
||||
assert(src_node_id.isUnicast());
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ bool DeadlineHandler::isRunning() const
|
||||
struct MonotonicDeadlineHandlerInsertionComparator
|
||||
{
|
||||
const MonotonicTime ts;
|
||||
explicit MonotonicDeadlineHandlerInsertionComparator(MonotonicTime ts) : ts(ts) { }
|
||||
explicit MonotonicDeadlineHandlerInsertionComparator(MonotonicTime arg_ts) : ts(arg_ts) { }
|
||||
bool operator()(const DeadlineHandler* t) const
|
||||
{
|
||||
return t->getDeadline() > ts;
|
||||
|
||||
@@ -50,8 +50,8 @@ int GlobalTimeSyncMaster::IfaceMaster::publish(TransferID tid, MonotonicTime cur
|
||||
assert(pub_.getTransferSender()->getCanIOFlags() == CanIOFlagLoopback);
|
||||
assert(pub_.getTransferSender()->getIfaceMask() == (1 << iface_index_));
|
||||
|
||||
const MonotonicDuration since_prev_pub = current_time - prev_pub_mono_;
|
||||
prev_pub_mono_ = current_time;
|
||||
const MonotonicDuration since_prev_pub = current_time - iface_prev_pub_mono_;
|
||||
iface_prev_pub_mono_ = current_time;
|
||||
assert(since_prev_pub.isPositive());
|
||||
const bool long_period = since_prev_pub.toMSec() >= protocol::GlobalTimeSync::MAX_PUBLICATION_PERIOD_MS;
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ bool TransferListenerBase::TimedOutReceiverPredicate::operator()(const TransferB
|
||||
* destroy the buffers manually.
|
||||
* Maybe it is not good that the predicate has side effects, but I ran out of better ideas.
|
||||
*/
|
||||
bufmgr_.remove(key);
|
||||
parent_bufmgr_.remove(key);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -95,10 +95,10 @@ class SocketCanIface : public uavcan::ICanIface
|
||||
: flags(0)
|
||||
{ }
|
||||
|
||||
TxItem(const uavcan::CanFrame& frame, uavcan::MonotonicTime deadline, uavcan::CanIOFlags flags)
|
||||
: frame(frame)
|
||||
, deadline(deadline)
|
||||
, flags(flags)
|
||||
TxItem(const uavcan::CanFrame& arg_frame, uavcan::MonotonicTime arg_deadline, uavcan::CanIOFlags arg_flags)
|
||||
: frame(arg_frame)
|
||||
, deadline(arg_deadline)
|
||||
, flags(arg_flags)
|
||||
{ }
|
||||
|
||||
bool operator<(const TxItem& rhs) const { return frame.priorityLowerThan(rhs.frame); }
|
||||
@@ -190,7 +190,7 @@ class SocketCanIface : public uavcan::ICanIface
|
||||
struct Control
|
||||
{
|
||||
cmsghdr cm;
|
||||
std::uint8_t control[sizeof(::timeval)];
|
||||
std::uint8_t data[sizeof(::timeval)];
|
||||
};
|
||||
auto control = Control();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user