92 return (item_data == i.item_data);
100 item_data = other.item_data;
101 item_rc = other.item_rc;
109 T&
data() {
return (item_data); }
114 const T&
data()
const {
return (item_data); }
138 bool need_hw_update =
false;
151 need_hw_update = (item_data != desired.
data() ||
rc_t::OK !=
rc());
153 item_data = desired.
data();
155 return (need_hw_update);
163 std::ostringstream os;
166 <<
"rc:" << item_rc.
to_string() <<
" data:" << item_data.to_string()
211 virtual void enqueue(std::shared_ptr<cmd> c);
216 virtual void enqueue(std::queue<cmd*>& c);
249 std::deque<std::shared_ptr<cmd>> m_queue;
256 std::map<cmd*, std::shared_ptr<cmd>> m_pending;
266 std::unique_ptr<std::thread> m_rx_thread;
309 static void enqueue(std::shared_ptr<cmd>
c);
314 static void enqueue(std::queue<cmd*>& c);
345 static cmd_q* m_cmdQ;
361 static void disable();
367 static void enable();
static void read_stats()
read stats from stat segment
bool update(const item &desired)
update the item to the desired state.
A HW::item is data that is either to be written to or read from VPP/HW.
static rc_t write()
Write/Execute all commands hitherto enqueued.
rc_t rc() const
Get the HW return code.
Error codes that VPP will return during a HW write.
T & data()
Return the data read/written.
std::string to_string() const
convert to string format for debug purposes
~item()=default
Destructor.
static bool connect()
Blocking Connect to VPP.
A representation of the connection to VPP.
The pipe to VPP into which we write the commands.
const T & data() const
Const reference to the data.
bool operator==(const item< T > &i) const
Comparison operator.
const std::string & to_string() const
convert to string format for debug purposes
item(const T &data)
Constructor.
static void init()
Initialise the HW.
static const rc_t OK
The HW write was successfull.
static void enqueue(cmd *f)
Enqueue A command for execution.
static void disconnect()
Disconnect to VPP.
The interface to writing objects into VPP OM.
item(rc_t rc)
Constructor.
item & operator=(const item &other)
Copy assignment.
The VPP Object Model (VOM) library.
Stat reader: single interface to get stats.
A representation of a method call to VPP.
static const rc_t UNSET
The value un-set.
item(const T &data, rc_t rc)
Constructor.
static bool poll()
Blocking pool of the HW connection.