Lumiera  0.pre.03
»edit your freedom«
command-queue.hpp
Go to the documentation of this file.
1 /*
2  COMMAND-QUEUE.hpp - organise ordering of commands within SteamDispatcher
3 
4  Copyright (C)
5  2016, Hermann Vosseler <Ichthyostega@web.de>
6 
7   **Lumiera** is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published by the
9   Free Software Foundation; either version 2 of the License, or (at your
10   option) any later version. See the file COPYING for further details.
11 
12 */
13 
14 
33 #ifndef STEAM_CONTROL_COMMAND_QUEUE_H
34 #define STEAM_CONTROL_COMMAND_QUEUE_H
35 
37 #include "lib/iter-stack.hpp"
38 #include "lib/format-string.hpp"
39 #include "lib/util.hpp"
40 
41 
42 namespace steam {
43 namespace control {
44 
45  namespace error = lumiera::error;
46 
47  using util::_Fmt;
48  using lib::unConst;
49 
50 
51 
57  : public lib::IterQueue<Command>
58  {
59 
60  public:
61  CommandQueue() { }
62 
63 
65  feed (Command&& cmd)
66  {
67  if (not cmd.canExec())
68  throw error::Logic(_Fmt("Reject '%s'. Not suitably prepared for invocation: %s")
69  % cmd.getID() % cmd
70  , LERR_(UNBOUND_ARGUMENTS));
71 
73  return *this;
74  }
75 
76  void
77  clear()
78  {
79  this->stateCore().clear();
80  }
81  };
82 
83 
84 
85 }} // namespace steam::control
86 #endif /*STEAM_CONTROL_COMMAND_QUEUE_H*/
iter::IterDequeStorage< Command > & stateCore()
allow derived classes to access state representation
Conveniently iterable stack and queue containers.
Front-end for printf-style string template interpolation.
Steam-Layer implementation namespace root.
A front-end for using printf-style formatting.
A Queue which can be pulled by iterating.
Definition: iter-stack.hpp:188
Derived specific exceptions within Lumiera&#39;s exception hierarchy.
Definition: error.hpp:190
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
Steam-Layer command frontend.
Implementation of the Session&#39;s command queue.
Handle object representing a single Command instance to be used by client code.
Definition: command.hpp:115