Fawkes API Fawkes Development Version
exceptions.h
1/***************************************************************************
2 * exceptions.h - SyncPoint exceptions
3 *
4 * Created: Wed Jan 15 11:09:55 2014
5 * Copyright 2014 Till Hofmann
6 *
7 *
8 ****************************************************************************/
9
10/* This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Library General Public License for more details.
19 *
20 * Read the full text in the LICENSE.GPL file in the doc directory.
21 */
22
23#ifndef _SYNCPOINT_EXCEPTIONS_H_
24#define _SYNCPOINT_EXCEPTIONS_H_
25
26#include <core/exception.h>
27
28namespace fawkes {
29
30/** A component which is watching a SyncPoint, called get_syncpoint() for the
31 * same identifier
32 */
34{
35public:
36 /** Constructor.
37 * @param component The calling component
38 * @param identifier The identifier of the SyncPoint
39 */
40 SyncPointAlreadyOpenedException(const char *component, const char *identifier)
41 {
42 append("Component '%s' called get_syncpoint() for identifier '%s', but is already watching",
43 component,
44 identifier);
45 }
46};
47
48/** Emit was called by a component which isn't in the watcher set
49 * (or wrong component argument was passed)
50 */
52{
53public:
54 /** Constructor.
55 * @param component The calling component
56 * @param identifier The identifier of the SyncPoint
57 */
58 SyncPointNonWatcherCalledEmitException(const char *component, const char *identifier)
59 {
60 append("Component '%s' called emit for SyncPoint '%s', but is not a watcher",
61 component,
62 identifier);
63 }
64};
65
66/** Emit was called by a component which isn't in the watcher set
67 * (or wrong component argument was passed)
68 */
70{
71public:
72 /** Constructor.
73 * @param component The calling component
74 * @param identifier The identifier of the SyncPoint
75 */
76 SyncPointNonWatcherCalledWaitException(const char *component, const char *identifier)
77 {
78 append("Component '%s' called wait for SyncPoint '%s', but is not a watcher",
79 component,
80 identifier);
81 }
82};
83
84/** Release was called on a non-existing SyncPoint
85 *
86 */
88{
89public:
90 /** Constructor.
91 * @param component The calling component
92 * @param identifier The identifier of the SyncPoint
93 */
94 SyncPointReleasedDoesNotExistException(const char *component, const char *identifier)
95 {
96 append("Component '%s' tried to release non-existing SyncPoint '%s'", component, identifier);
97 }
98};
99
100/** Release was called by a component which isn't a watcher
101 *
102 */
104{
105public:
106 /** Constructor.
107 * @param component The calling component
108 * @param identifier The identifier of the SyncPoint
109 */
110 SyncPointReleasedByNonWatcherException(const char *component, const char *identifier)
111 {
112 append("Component '%s' tried to release SyncPoint '%s' but is not a watcher",
113 component,
114 identifier);
115 }
116};
117
118/** Invalid identifier used (i.e. an empty string)
119 *
120 */
122{
123public:
124 /** Constructor.
125 * @param identifier The identifier of the SyncPoint
126 */
128 {
129 append("Tried to construct a SyncPoint with invalid identifier ('%s'). "
130 "Identifier must be a non-empty absolute path (e.g. '/path/to/syncpoint')"
131 " and may not end with '/'",
132 identifier);
133 }
134};
135
136/** Invalid component name used (i.e. an empty string)
137 *
138 */
140{
141public:
142 /** Constructor.
143 * @param component The calling component
144 * @param identifier The identifier of the SyncPoint
145 */
146 SyncPointInvalidComponentException(const char *component, const char *identifier)
147 {
148 append("Invalid component name '%s' while accessing SyncPoint '%s'", component, identifier);
149 }
150};
151
152/** A component called wait() but is already waiting
153 *
154 */
156{
157public:
158 /** Constructor.
159 * @param component The calling component
160 * @param identifier The identifier of the SyncPoint
161 */
162 SyncPointMultipleWaitCallsException(const char *component, const char *identifier)
163 {
164 append("Component '%s' called wait() on SyncPoint '%s', but is already waiting",
165 component,
166 identifier);
167 }
168};
169
170/** Emit was called on a SyncBarrier but the calling component is not registered
171 * as emitter
172 */
174{
175public:
176 /** Constructor.
177 * @param component The calling component
178 * @param identifier The identifier of the SyncPoint
179 */
180 SyncPointNonEmitterCalledEmitException(const char *component, const char *identifier)
181 {
182 append("Component '%s' called emit for SyncPoint '%s', "
183 "but is not a registered emitter",
184 component,
185 identifier);
186 }
187};
188
189/** Invalid SyncPoint type.
190 */
192{
193public:
194 /** Constructor. */
196 {
197 append("Invalid SyncPoint Wakeup type.");
198 }
199};
200
201/** The component called release but is still registered as emitter. */
203{
204public:
205 /** Constructor.
206 * @param component The calling component
207 * @param identifier The identifier of the SyncPoint
208 */
209 SyncPointCannotReleaseEmitter(const char *component, const char *identifier)
210 {
211 append("Component '%s' called emit for SyncPoint '%s', "
212 "but is still registered as emitter",
213 component,
214 identifier);
215 }
216};
217
218} // namespace fawkes
219
220#endif
Base class for exceptions in Fawkes.
Definition: exception.h:36
void append(const char *format,...) noexcept
Append messages to the message list.
Definition: exception.cpp:333
A component which is watching a SyncPoint, called get_syncpoint() for the same identifier.
Definition: exceptions.h:34
SyncPointAlreadyOpenedException(const char *component, const char *identifier)
Constructor.
Definition: exceptions.h:40
The component called release but is still registered as emitter.
Definition: exceptions.h:203
SyncPointCannotReleaseEmitter(const char *component, const char *identifier)
Constructor.
Definition: exceptions.h:209
Invalid component name used (i.e.
Definition: exceptions.h:140
SyncPointInvalidComponentException(const char *component, const char *identifier)
Constructor.
Definition: exceptions.h:146
Invalid identifier used (i.e.
Definition: exceptions.h:122
SyncPointInvalidIdentifierException(const char *identifier)
Constructor.
Definition: exceptions.h:127
A component called wait() but is already waiting.
Definition: exceptions.h:156
SyncPointMultipleWaitCallsException(const char *component, const char *identifier)
Constructor.
Definition: exceptions.h:162
Emit was called on a SyncBarrier but the calling component is not registered as emitter.
Definition: exceptions.h:174
SyncPointNonEmitterCalledEmitException(const char *component, const char *identifier)
Constructor.
Definition: exceptions.h:180
Emit was called by a component which isn't in the watcher set (or wrong component argument was passed...
Definition: exceptions.h:52
SyncPointNonWatcherCalledEmitException(const char *component, const char *identifier)
Constructor.
Definition: exceptions.h:58
Emit was called by a component which isn't in the watcher set (or wrong component argument was passed...
Definition: exceptions.h:70
SyncPointNonWatcherCalledWaitException(const char *component, const char *identifier)
Constructor.
Definition: exceptions.h:76
Release was called by a component which isn't a watcher.
Definition: exceptions.h:104
SyncPointReleasedByNonWatcherException(const char *component, const char *identifier)
Constructor.
Definition: exceptions.h:110
Release was called on a non-existing SyncPoint.
Definition: exceptions.h:88
SyncPointReleasedDoesNotExistException(const char *component, const char *identifier)
Constructor.
Definition: exceptions.h:94
Fawkes library namespace.