mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-17 04:23:34 +08:00
ServiceClient<>::getCallIDByIndex()
This commit is contained in:
@@ -341,6 +341,12 @@ public:
|
||||
*/
|
||||
bool hasPendingCallToServer(NodeID server_node_id) const;
|
||||
|
||||
/**
|
||||
* This method allows to traverse pending calls. If the index is out of range, an invalid call ID will be returned.
|
||||
* Warning: average complexity is O(index); worst case complexity is O(size).
|
||||
*/
|
||||
ServiceCallID getCallIDByIndex(unsigned index) const;
|
||||
|
||||
/**
|
||||
* Service response callback must be set prior service call.
|
||||
*/
|
||||
@@ -556,6 +562,13 @@ bool ServiceClient<DataType_, Callback_, NumStaticCalls_>::hasPendingCallToServe
|
||||
return NULL != call_registry_.find(ServerSearchPredicate(server_node_id));
|
||||
}
|
||||
|
||||
template <typename DataType_, typename Callback_, unsigned NumStaticCalls_>
|
||||
ServiceCallID ServiceClient<DataType_, Callback_, NumStaticCalls_>::getCallIDByIndex(unsigned index) const
|
||||
{
|
||||
const CallState* const id = call_registry_.getByIndex(index);
|
||||
return (id == NULL) ? ServiceCallID() : id->getCallID();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // UAVCAN_NODE_SERVICE_CLIENT_HPP_INCLUDED
|
||||
|
||||
Reference in New Issue
Block a user