CommandQueue: basic queue behaviour implemented and tested

This commit is contained in:
Fischlurch 2016-12-25 21:52:52 +01:00
parent b58427e49f
commit 3010c87008
3 changed files with 13 additions and 4 deletions

View file

@ -42,8 +42,10 @@
#define PROC_CONTROL_COMMAND_QUEUE_H
#include "proc/control/command.hpp"
#include "lib/iter-stack.hpp"
//#include "common/subsys.hpp"
//#include "lib/depend.hpp"
#include "lib/util.hpp"
//#include <memory>
//#include <functional>
@ -55,6 +57,7 @@ namespace control {
// using lib::Symbol;
// using std::bind;
using lib::unConst;
@ -62,6 +65,7 @@ namespace control {
* @todo Type-comment
*/
class CommandQueue
: public lib::IterQueue<Command>
{
public:
@ -69,14 +73,18 @@ namespace control {
{ }
void
clear()
{
this->stateCore().clear();
}
/* == diagnostics == */
size_t
size() const
{
TODO ("implement queue");
return 0;
return unConst(this)->stateCore().size();
}
bool

View file

@ -134,7 +134,8 @@ namespace control {
~CommandRegistry()
{
INFO (command, "Shutting down Command system...");
if (0 < index_size())
INFO (command, "Shutting down Command system...");
//////////////////////TICKET #295 : possibly remotely trigger Command mass suicide here....
ridx_.clear();
index_.clear();

View file

@ -122,7 +122,7 @@ namespace test {
Command x = queue.pop();
CHECK (1 == queue.size());
CHECK (COMMAND_1 == x.getID());
CHECK (x == com11);
queue.clear();
CHECK (0 == queue.size());