Lumiera  0.pre.03
»edityourfreedom«
command-queue.hpp
Go to the documentation of this file.
1 /*
2  COMMAND-QUEUE.hpp - organise ordering of commands within ProcDispatcher
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 PROC_CONTROL_COMMAND_QUEUE_H
43 #define PROC_CONTROL_COMMAND_QUEUE_H
44 
45 #include "proc/control/command.hpp"
46 #include "lib/iter-stack.hpp"
47 #include "lib/format-string.hpp"
48 #include "lib/util.hpp"
49 
50 
51 namespace proc {
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:
71 
72 
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
87  {
88  this->stateCore().clear();
89  }
90  };
91 
92 
93 
94 }} // namespace proc::control
95 #endif /*PROC_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.
IterQueue & feed(TY const &elm)
Definition: iter-stack.hpp:198
A front-end for using printf-style formatting.
A Queue which can be pulled by iterating.
Definition: iter-stack.hpp:191
Derived specific exceptions within Lumiera&#39;s exception hierarchy.
Definition: error.hpp:196
#define LERR_(_NAME_)
Definition: error.hpp:58
Implementation of the Session&#39;s command queue.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
Proc-Layer command frontend.
OBJ * unConst(const OBJ *o)
shortcut to save some typing when having to define const and non-const variants of member functions ...
Definition: util.hpp:319
CommandQueue & feed(Command &&cmd)
Handle object representing a single Command instance to be used by client code.
Definition: command.hpp:125
Proc-Layer implementation namespace root.
Definition: id-scheme.hpp:63