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) Lumiera.org
5  2016, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 */
22 
23 
42 #ifndef STEAM_CONTROL_COMMAND_QUEUE_H
43 #define STEAM_CONTROL_COMMAND_QUEUE_H
44 
46 #include "lib/iter-stack.hpp"
47 #include "lib/format-string.hpp"
48 #include "lib/util.hpp"
49 
50 
51 namespace steam {
52 namespace control {
53 
54  namespace error = lumiera::error;
55 
56  using util::_Fmt;
57  using lib::unConst;
58 
59 
60 
66  : public lib::IterQueue<Command>
67  {
68 
69  public:
70  CommandQueue() { }
71 
72 
74  feed (Command&& cmd)
75  {
76  if (not cmd.canExec())
77  throw error::Logic(_Fmt("Reject '%s'. Not suitably prepared for invocation: %s")
78  % cmd.getID() % cmd
79  , LERR_(UNBOUND_ARGUMENTS));
80 
82  return *this;
83  }
84 
85  void
86  clear()
87  {
88  this->stateCore().clear();
89  }
90  };
91 
92 
93 
94 }} // namespace steam::control
95 #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:197
Derived specific exceptions within Lumiera&#39;s exception hierarchy.
Definition: error.hpp:199
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:124