FD.io VPP  v19.01.3-6-g70449b9b9
Vector Packet Processing
VOM::event_cmd< WANT, EVENT > Class Template Referenceabstract

An Event command base class. More...

+ Inheritance diagram for VOM::event_cmd< WANT, EVENT >:
+ Collaboration diagram for VOM::event_cmd< WANT, EVENT >:

Public Types

typedef vapi::Event_registration< EVENT >::resp_type event_t
 Typedef for the event type. More...
 
typedef vapi::Event_registration< EVENT > reg_t
 
typedef vapi::Result_set< typename reg_t::resp_type >::const_iterator const_iterator
 
- Public Types inherited from VOM::rpc_cmd< HW::item< bool >, WANT >
typedef WANT msg_t
 convenient typedef More...
 

Public Member Functions

 event_cmd (HW::item< bool > &b)
 Default constructor. More...
 
virtual ~event_cmd ()
 Default destructor. More...
 
const_iterator begin ()
 
const_iterator end ()
 
void lock ()
 
void unlock ()
 
void flush ()
 flush/free all the events thus far reeived. More...
 
virtual void retire (connection &con)=0
 Retire the command. More...
 
vapi_error_e operator() (reg_t &dl)
 
- Public Member Functions inherited from VOM::rpc_cmd< HW::item< bool >, WANT >
 rpc_cmd (HW::item< bool > &item)
 Constructor taking the HW item that will be updated by the command. More...
 
virtual ~rpc_cmd ()
 Desructor. More...
 
HW::item< bool > & item ()
 return the HW item the command updates More...
 
const HW::item< bool > & item () const
 return the const HW item the command updates More...
 
void fulfill (const HW::item< bool > &d)
 Fulfill the commands promise. More...
 
rc_t wait ()
 Wait on the commands promise. More...
 
virtual void succeeded ()
 Called by the HW Command Q when it is disabled to indicate the command can be considered successful without issuing it to HW. More...
 
virtual vapi_error_e operator() (WANT &reply)
 call operator used as a callback by VAPI when the reply is available More...
 
- Public Member Functions inherited from VOM::cmd
 cmd ()
 Default constructor. More...
 
virtual ~cmd ()
 Virtual destructor. More...
 
virtual rc_t issue (connection &con)=0
 Issue the command to VPP/HW. More...
 
virtual std::string to_string () const =0
 convert to string format for debug purposes More...
 

Protected Member Functions

virtual void notify ()=0
 Notify the command that data from VPP has arrived and been stored. More...
 

Protected Attributes

std::unique_ptr< vapi::Event_registration< EVENT > > m_reg
 The VAPI event registration. More...
 
std::mutex m_mutex
 Mutex protection for the events. More...
 
- Protected Attributes inherited from VOM::rpc_cmd< HW::item< bool >, WANT >
HW::item< bool > & m_hw_item
 A reference to an object's HW::item that the command will update. More...
 
std::promise< HW::item< bool > > m_promise
 The promise that implements the synchronous issue. More...
 

Detailed Description

template<typename WANT, typename EVENT>
class VOM::event_cmd< WANT, EVENT >

An Event command base class.

Events are one of the sub-set of command type to VPP. A client performs a one time 'registration/subsription' to VPP for the event in question and then is notified asynchronously when those events occur. The model here then is that the lifetime of the event command represensts the during of the clients subscription. When the command is 'issued' the subscription begins, when it is 'retired' the subscription ends. For the subscription duration the client will be notified as events are recieved. The client can then 'pop' these events from this command object.

Definition at line 39 of file event_cmd.hpp.

Member Typedef Documentation

◆ const_iterator

template<typename WANT, typename EVENT>
typedef vapi::Result_set<typename reg_t::resp_type>::const_iterator VOM::event_cmd< WANT, EVENT >::const_iterator

Definition at line 62 of file event_cmd.hpp.

◆ event_t

template<typename WANT, typename EVENT>
typedef vapi::Event_registration<EVENT>::resp_type VOM::event_cmd< WANT, EVENT >::event_t

Typedef for the event type.

Definition at line 58 of file event_cmd.hpp.

◆ reg_t

template<typename WANT, typename EVENT>
typedef vapi::Event_registration<EVENT> VOM::event_cmd< WANT, EVENT >::reg_t

Definition at line 59 of file event_cmd.hpp.

Constructor & Destructor Documentation

◆ event_cmd()

template<typename WANT, typename EVENT>
VOM::event_cmd< WANT, EVENT >::event_cmd ( HW::item< bool > &  b)
inline

Default constructor.

Definition at line 45 of file event_cmd.hpp.

◆ ~event_cmd()

template<typename WANT, typename EVENT>
virtual VOM::event_cmd< WANT, EVENT >::~event_cmd ( )
inlinevirtual

Default destructor.

Definition at line 53 of file event_cmd.hpp.

Member Function Documentation

◆ begin()

template<typename WANT, typename EVENT>
const_iterator VOM::event_cmd< WANT, EVENT >::begin ( )
inline

Definition at line 64 of file event_cmd.hpp.

◆ end()

template<typename WANT, typename EVENT>
const_iterator VOM::event_cmd< WANT, EVENT >::end ( )
inline

Definition at line 66 of file event_cmd.hpp.

◆ flush()

template<typename WANT, typename EVENT>
void VOM::event_cmd< WANT, EVENT >::flush ( )
inline

flush/free all the events thus far reeived.

Call with the lock held!

Definition at line 75 of file event_cmd.hpp.

◆ lock()

template<typename WANT, typename EVENT>
void VOM::event_cmd< WANT, EVENT >::lock ( )
inline

Definition at line 68 of file event_cmd.hpp.

◆ notify()

template<typename WANT, typename EVENT>
virtual void VOM::event_cmd< WANT, EVENT >::notify ( )
protectedpure virtual

Notify the command that data from VPP has arrived and been stored.

The command should now inform its clients/listeners.

Implemented in VOM::interface_cmds::events_cmd, and VOM::dhcp_client_cmds::events_cmd.

+ Here is the caller graph for this function:

◆ operator()()

template<typename WANT, typename EVENT>
vapi_error_e VOM::event_cmd< WANT, EVENT >::operator() ( reg_t dl)
inline

Definition at line 83 of file event_cmd.hpp.

◆ retire()

template<typename WANT, typename EVENT>
virtual void VOM::event_cmd< WANT, EVENT >::retire ( connection con)
pure virtual

Retire the command.

This is only appropriate for Event Commands As they persist until retired.

Reimplemented from VOM::rpc_cmd< HW::item< bool >, WANT >.

Implemented in VOM::interface_cmds::events_cmd, and VOM::dhcp_client_cmds::events_cmd.

+ Here is the caller graph for this function:

◆ unlock()

template<typename WANT, typename EVENT>
void VOM::event_cmd< WANT, EVENT >::unlock ( )
inline

Definition at line 69 of file event_cmd.hpp.

Field Documentation

◆ m_mutex

template<typename WANT, typename EVENT>
std::mutex VOM::event_cmd< WANT, EVENT >::m_mutex
protected

Mutex protection for the events.

Definition at line 105 of file event_cmd.hpp.

◆ m_reg

template<typename WANT, typename EVENT>
std::unique_ptr<vapi::Event_registration<EVENT> > VOM::event_cmd< WANT, EVENT >::m_reg
protected

The VAPI event registration.

Definition at line 100 of file event_cmd.hpp.


The documentation for this class was generated from the following file: