Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
handling-patterns.hpp
Go to the documentation of this file.
1/*
2 HANDLILNG-PATTERNS.hpp - Collection of predefined command handling patterns
3
4 Copyright (C)
5 2009, 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 CONTROL_HANDLING_PATTERNS_DEF_H
34#define CONTROL_HANDLING_PATTERNS_DEF_H
35
36#include "lib/error.hpp"
37#include "lib/multifact.hpp"
40
41
42
43namespace steam {
44namespace control {
45
46 namespace { // concrete command handling patterns
47
48
49
50
57 : public HandlingPattern
58 {
59 bool isValid() const override { return true; }
60
61 void
63 {
64 REQUIRE (command.canExec());
65 command.invokeCapture();
66 command.invokeOperation();
67 }
68
69 void
71 {
72 REQUIRE (command.canUndo());
73 command.invokeUndo();
74 }
75 };
76
77
78
86 {
87 void
89 {
90 UNIMPLEMENTED ("actually invoke a command, according to this pattern");
91 }
92
93 void
95 {
96 UNIMPLEMENTED ("actually undo the effect of a command, according to this pattern");
97 }
98
99 bool
100 isValid() const override
101 {
102 UNIMPLEMENTED ("is this pattern currently able to handle commands?");
103 }
104 };
105
106
107
115 : public BasicHandlingPattern
116 {
117 void
119 {
120 UNIMPLEMENTED ("actually invoke a command, according to this pattern");
121 }
122
123 void
125 {
126 UNIMPLEMENTED ("actually undo the effect of a command, according to this pattern");
127 }
128
129 bool
130 isValid() const override
131 {
132 UNIMPLEMENTED ("is this pattern currently able to handle commands?");
133 }
134 };
135
136
137
145 : public BasicHandlingPattern
146 {
147 void
149 {
150 UNIMPLEMENTED ("actually invoke a command, according to this pattern");
151 }
152
153 void
155 {
156 UNIMPLEMENTED ("actually undo the effect of a command, according to this pattern");
157 }
158
159 bool
160 isValid() const override
161 {
162 UNIMPLEMENTED ("is this pattern currently able to handle commands?");
163 }
164 };
165
166
167
168
169
170
171 /* ======== Handling Pattern Table ========== */
172
174
177
182
183
185 inline HandlingPattern const&
187 {
189
190 return patternTable (id);
191 }
192
193
194 } // (END) definition of concrete handling patterns
195
196
197
198
199
200
201
202}} // namespace steam::control
203#endif
Convenience shortcut for automatically setting up a production line, to fabricate a singleton instanc...
Factory for creating a family of objects by ID.
bool contains(ID id) const
Steam-Layer Command implementation.
Interface: Operation Skeleton how to invoke or undo a command.
Handling Pattern Foundation: invoke command directly and without any external intervention.
Handling Pattern: just schedule command to be invoked asynchronously.
Handling Pattern: invoke blocking, translate exceptions into an error state.
Handling Pattern: invoke blocking, propagating any exceptions immediately.
Top level of the command implementation.
Lumiera error handling (C++ interface).
Pre-defined command execution skeletons.
Framework for building a configurable factory, to generate families of related objects.
enable_if_c< Cond::value, T >::type enable_if
SFINAE helper to control the visibility of specialisations and overloads.
Definition meta/util.hpp:87
HandlingPatternFactory patternTable
holds singleton pattern instances by ID
HandlingPatternFactory::Singleton< InvokeSyncNoThrow > holder1(patternTable, HandlingPattern::SYNC)
HandlingPatternFactory::Singleton< InvokeSyncThrow > holder2(patternTable, HandlingPattern::SYNC_THROW)
HandlingPatternFactory::Singleton< InvokeAsync > holder3(patternTable, HandlingPattern::ASYNC)
HandlingPatternFactory::Singleton< BasicHandlingPattern > holder4(patternTable, HandlingPattern::DUMMY)
HandlingPattern const & getPatternInstance(HandlingPattern::ID id)
access the singleton instance for a given ID
Steam-Layer implementation namespace root.