#include <deque>
#include <map>
+#include <queue>
#include <sstream>
#include <string>
#include <thread>
-#include <vapi/vapi.hpp>
-#include <vapi/vpe.api.vapi.hpp>
-
+#include "vom/cmd.hpp"
#include "vom/connection.hpp"
-#include "vom/rpc_cmd.hpp"
+#include "vom/types.hpp"
namespace VOM {
+
+class cmd;
class HW
{
public:
{
}
+ /**
+ * Destructor
+ */
+ ~item() = default;
+
/**
* Comparison operator
*/
*/
virtual void enqueue(std::queue<cmd*>& c);
- /**
- * dequeue a command from the Q.
- */
- virtual void dequeue(cmd* c);
-
- /**
- * dequeue a command from the Q.
- */
- virtual void dequeue(std::shared_ptr<cmd> c);
-
/**
* Write all the commands to HW
*/
/**
* Blocking Connect to VPP - call once at bootup
*/
- void connect();
+ virtual bool connect();
+
+ /**
+ * Disconnect to VPP
+ */
+ virtual void disconnect();
/**
* Disable the passing of commands to VPP. Whilst disabled all
*/
static void enqueue(std::queue<cmd*>& c);
- /**
- * dequeue A command for execution
- */
- static void dequeue(cmd* f);
-
- /**
- * dequeue A command for execution
- */
- static void dequeue(std::shared_ptr<cmd> c);
-
/**
* Write/Execute all commands hitherto enqueued.
*/
/**
* Blocking Connect to VPP
*/
- static void connect();
+ static bool connect();
+
+ /**
+ * Disconnect to VPP
+ */
+ static void disconnect();
/**
* Blocking pool of the HW connection
* Only the OM can enable/disable HW
*/
friend class OM;
-
- /**
- * A command pool the HW for liveness
- */
- class Poll : public rpc_cmd<HW::item<bool>, rc_t, vapi::Control_ping>
- {
- public:
- /**
- * Constructor taking the HW::item to update
- */
- Poll(HW::item<bool>& item);
-
- /**
- * Issue the command to VPP/HW
- */
- rc_t issue(connection& con);
-
- /**
- * convert to string format for debug purposes
- */
- std::string to_string() const;
-
- /**
- * Comparison operator - only used for UT
- */
- bool operator==(const Poll& i) const;
- };
};
/**