Fawkes API Fawkes Development Version
exceptions.h
1
2/***************************************************************************
3 * exceptions.h - BlackBoard exceptions
4 *
5 * Generated: Wed Oct 04 18:37:50 2006
6 * Copyright 2006 Tim Niemueller [www.niemueller.de]
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. A runtime exception applies to
14 * this software (see LICENSE.GPL_WRE file mentioned below for details).
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Library General Public License for more details.
20 *
21 * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22 */
23
24#ifndef _BLACKBOARD_EXCEPTIONS_H_
25#define _BLACKBOARD_EXCEPTIONS_H_
26
27#include <core/exception.h>
28
29namespace fawkes {
30
31/** A NULL pointer was supplied where not allowed.
32 * Throw this exception if a pointer to NULL has been supplied where this is
33 * not allowed.
34 */
36{
37public:
38 /** Constructor */
40 {
41 }
42};
43
44/** Thrown when BlackBoard memory has been corupted
45 * This exception is thrown by the memory manager if the memory has been
46 * corrupted, for example if there are bytes that belong to neither a free chunk nor
47 * a allocated chunk.
48 */
50{
51public:
52 /** Constructor
53 * @param msg message, appended to exception, base message "Memory corruption detected"
54 */
55 BBInconsistentMemoryException(const char *msg) : Exception("Memory corruption detected")
56 {
57 append(msg);
58 }
59};
60
61/** Thrown if BlackBoard is not master and master operation has been requested.
62 * This exception is thrown by the memory manager if the memory is not owned but
63 * master mode is required. The interface manager throws it if you try to create
64 * a new interface but are not master.
65 * corrupted, for example if there are bytes that belong to neither a free chunk nor
66 * a allocated chunk.
67 */
69{
70public:
71 /** Constructor
72 * @param msg message, appended to exception, base message "Memory corruption detected"
73 */
74 BBNotMasterException(const char *msg) : Exception("Not BlackBoard Master!")
75 {
76 append(msg);
77 }
78};
79
80/** Thrown if shared memory could not be opened. Can happen only if opening the
81 * segment as non-master.
82 */
84{
85public:
86 /** Constructor */
87 BBMemMgrCannotOpenException() : Exception("Cannot open shared memory segment")
88 {
89 }
90};
91
92/** Thrown if no definition of interface or interface generator found.
93 */
95{
96public:
97 /** Constructor
98 * @param type type of interface that could not be found
99 * @param add_msg additional message, add a space as first character
100 */
101 BlackBoardInterfaceNotFoundException(const char *type, const char *add_msg = "")
102 : Exception("Interface of type '%s' not found.%s", type, add_msg)
103 {
104 }
105};
106
107/** Thrown if versions do not match.
108 * If the hashes of two interfaces of the very same type do not match they
109 * are incompatible.
110 */
112{
113public:
114 /** Constructor. */
116 : Exception("Interface versions do not match, need to update and recompile interfaces?")
117 {
118 }
119};
120
121/** Thrown if a writer is already active on an interface that writing has
122 * been requested for.
123 */
125{
126public:
127 /** Constructor
128 * @param type type of interface that could not be found
129 * @param id identifier of the interface
130 */
131 BlackBoardWriterActiveException(const char *id, const char *type) : Exception()
132 {
133 append("There is already a writer on interface '%s' of type '%s'", id, type);
134 }
135};
136
137/** Thrown if BlackBoard is opened as non-master with no master alive.
138 */
140{
141public:
142 /** Constructor*/
143 BlackBoardNoMasterAliveException() : Exception("No master BlackBoard alive")
144 {
145 }
146};
147
148/** Thrown if no writer interface is alive.
149 */
151{
152public:
153 /** Constructor.
154 * @param type interface type string
155 * @param id interface ID
156 */
157 BlackBoardNoWritingInstanceException(const char *type, const char *id) : Exception()
158 {
159 append("No writing instance for interface %s::%s", type, id);
160 }
161};
162
163} // end namespace fawkes
164
165#endif
Thrown when BlackBoard memory has been corupted This exception is thrown by the memory manager if the...
Definition: exceptions.h:50
BBInconsistentMemoryException(const char *msg)
Constructor.
Definition: exceptions.h:55
Thrown if shared memory could not be opened.
Definition: exceptions.h:84
BBMemMgrCannotOpenException()
Constructor.
Definition: exceptions.h:87
Thrown if BlackBoard is not master and master operation has been requested.
Definition: exceptions.h:69
BBNotMasterException(const char *msg)
Constructor.
Definition: exceptions.h:74
Thrown if no definition of interface or interface generator found.
Definition: exceptions.h:95
BlackBoardInterfaceNotFoundException(const char *type, const char *add_msg="")
Constructor.
Definition: exceptions.h:101
A NULL pointer was supplied where not allowed.
Definition: exceptions.h:36
Thrown if BlackBoard is opened as non-master with no master alive.
Definition: exceptions.h:140
Thrown if no writer interface is alive.
Definition: exceptions.h:151
BlackBoardNoWritingInstanceException(const char *type, const char *id)
Constructor.
Definition: exceptions.h:157
Thrown if a writer is already active on an interface that writing has been requested for.
Definition: exceptions.h:125
BlackBoardWriterActiveException(const char *id, const char *type)
Constructor.
Definition: exceptions.h:131
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
Fawkes library namespace.