16 #ifndef __VOM_RPC_CMD_H__ 17 #define __VOM_RPC_CMD_H__ 37 template <
typename HWITEM,
typename DATA,
typename MSG>
91 std::future_status status;
92 std::future<DATA> result;
95 status = result.wait_for(std::chrono::seconds(5));
97 if (status != std::future_status::ready) {
101 return (result.get());
115 int retval = reply.get_response().get_payload().retval;
HWITEM & m_hw_item
A reference to an object's HW::item that the command will update.
virtual std::string to_string() const =0
convert to string format for debug purposes
static const rc_t & from_vpp_retval(int32_t rv)
Get the rc_t from the VPP API value.
std::promise< DATA > m_promise
The promise that implements the synchronous issue.
static const log_level_t DEBUG
virtual void succeeded()
Called by the HW Command Q when it is disabled to indicate the command can be considered successful w...
virtual void retire(connection &con)
Retire/cancel a long running command.
const HWITEM & item() const
return the const HW item the command updates
A representation of the connection to VPP.
rpc_cmd(HWITEM &item)
Constructor taking the HW item that will be updated by the command.
virtual vapi_error_e operator()(MSG &reply)
call operator used as a callback by VAPI when the reply is available
HWITEM & item()
return the HW item the command updates
virtual ~rpc_cmd()
Desructor.
A base class for all RPC commands to VPP.
static const rc_t OK
The HW write was successfull.
void fulfill(const DATA &d)
Fulfill the commands promise.
The VPP Object Model (VOM) library.
A representation of a method call to VPP.
MSG msg_t
convenient typedef
DATA wait()
Wait on the commands promise.
static const rc_t TIMEOUT
HW write timedout - VPP did not respond within a timely manner.