source: nrEngine/include/Result.h @ 32

Revision 32, 12.1 KB checked in by art, 12 years ago (diff)
Line 
1/***************************************************************************
2 *                                                                         *
3 *   (c) Art Tevs, MPI Informatik Saarbruecken                             *
4 *       mailto: <tevs@mpi-sb.mpg.de>                                      *
5 *                                                                         *
6 *   This program is free software; you can redistribute it and/or modify  *
7 *   it under the terms of the GNU General Public License as published by  *
8 *   the Free Software Foundation; either version 2 of the License, or     *
9 *   (at your option) any later version.                                   *
10 *                                                                         *
11 ***************************************************************************/
12
13#ifndef __NR_ENGINE_RESULT_H_
14#define __NR_ENGINE_RESULT_H_
15
16//----------------------------------------------------------------------------------
17// Includes
18//----------------------------------------------------------------------------------
19#include "Prerequisities.h"
20
21namespace nrEngine{
22
23        /*!
24        * \defgroup error Exception & Errors
25        *
26        * In every application as in our engine there will be some exceptions
27        * and errors that should be managed. Our engine does use return codes
28        * to define if any exception occurs. This is used for performance and
29        * coding style reasons. So here you can find the definition adn description
30        * of the error codes that could be given back by a function.<br>
31        * But sometimes engine can not return an error code back (i.e. if error
32        * occurs in a constructor). In this case an exception will be thrown.
33        * Each exception is of the Exception - class.
34        **/
35
36#define NR_ERR_GROUP(a) 0x01000000 * a
37
38        /**
39        * nrEngine's error codes returned back by some functions.<br>
40        * You can combine error codes of different groups
41        * in binary manner (e.g. BAD_PARAMETERS | OUT_OF_MEMORY).
42        * \ingroup error
43        **/
44        enum  ResultCode {
45
46                //------------------------------------------------------------------------------
47
48                //! Don't worry, no error occurs. That is fine :-)
49                OK                                      = 0,
50
51                //! Will be given back if the engine can not detect what kind of error does occurs
52                UNKNOWN_ERROR           = 0xFFFFFFFF,
53
54                //! The parameters given to the function are not valid
55                BAD_PARAMETERS          = 1 << 0,
56
57                //! Engine couldn't allocate a block of memory because (prob.) no memory available
58                OUT_OF_MEMORY           = 1 << 1,
59
60                //! The dator does not contain valid data
61                NOT_VALID_DATOR         = 1 << 2,
62
63                //! Generic time out error
64                TIME_OUT                = 1 << 3,
65               
66                //------------------------------------------------------------------------------
67
68                //! This is a general "group error" produced by work on the files
69                FILE_ERROR                      = NR_ERR_GROUP(2),
70
71                //! If file was not found, so this error will be given back
72                FILE_NOT_FOUND          = FILE_ERROR | (1 << 0),
73
74                //! If file has got errors by reading out of a line
75                FILE_ERROR_IN_LINE      = FILE_ERROR | (1 << 1),
76
77
78                //------------------------------------------------------------------------------
79
80                //! General error of the profile error group
81                PROFILE_ERROR           = NR_ERR_GROUP(3),
82
83                //! If the specified profile was not found
84                PROFILE_NOT_FOUND       = PROFILE_ERROR | (1 << 0),
85
86                //! If the specified profile is currently not loaded
87                PROFILE_NOT_LOADED      = PROFILE_ERROR | (1 << 1),
88
89                //! If the specified profile does not exists
90                PROFILE_NOT_EXISTS      = PROFILE_ERROR | (1 << 2),
91
92                //! If the profile you requesting already exists
93                PROFILE_ALREADY_EXISTS = PROFILE_ERROR | (1 << 3),
94
95
96                //------------------------------------------------------------------------------
97
98                //! This is an error defining the virtual file system error group
99                VFS_ERROR                               = NR_ERR_GROUP(4),
100
101                //! If you try to open the file system and it is already opened
102                VFS_ALREADY_OPEN                = VFS_ERROR | (1 << 0),
103
104                //! If the engine couldn't open the virtual file system
105                VFS_CANNOT_OPEN                 = VFS_ERROR | (1 << 1),
106
107                //! If the vfs subsystem couldn't be closed
108                VFS_CANNOT_CLOSE                = VFS_ERROR | (1 << 2),
109
110                //! Do you tried to request a file, but forgott to open the file system?
111                VFS_IS_NOT_OPEN                 = VFS_ERROR | (1 << 3),
112
113                //! The requested file was not found in the vfs
114                VFS_FILE_NOT_FOUND              = VFS_ERROR | (1 << 4),
115
116                //! You can not retrieve data from a file, if it was not opened before
117                VFS_FILE_NOT_OPEN               = VFS_ERROR | (1 << 5),
118
119                //! The reading of the file found an EOF signal
120                VFS_FILE_END_REACHED    = VFS_ERROR | (1 << 6),
121
122                //! File couldn't be readed for many of reasons
123                VFS_FILE_READ_ERROR             = VFS_ERROR | (1 << 7),
124
125                //! The line of a file couldn't be readed
126                VFS_LINE_READ_ERROR             = VFS_ERROR | (1 << 8),
127
128                //! Scan methof fails because of wrong readed data or so
129                VFS_SCAN_READ_ERROR             = VFS_ERROR | (1 << 9),
130
131                //! Seeking in the file failed, probably the seek position is to wide
132                VFS_SEEK_ERROR                  = VFS_ERROR | (1 << 10),
133
134                //! No such parameter exists
135                VFS_NO_PARAMETER                = VFS_ERROR | (1 << 11),
136
137
138                //------------------------------------------------------------------------------
139
140                //! Any error produced by the settings manager is in this group
141                SETTINGS_ERROR                  = NR_ERR_GROUP(5),
142
143                //! If you try to register a variable that already registered
144                SETTINGS_VAR_ALREADY_REGISTERED = SETTINGS_ERROR | (1 << 1),
145
146                //! The variable you requesting is not registered
147                SETTINGS_VAR_NOT_REGISTERED     = SETTINGS_ERROR | (1 << 2),
148
149
150                //------------------------------------------------------------------------------
151                //! Any error that is thrown in the kernel subsystem is in this group
152                KERNEL_ERROR                    = NR_ERR_GROUP(6),
153
154                //! There were no task found
155                KERNEL_NO_TASK_FOUND    = KERNEL_ERROR | (1 << 1),
156
157                //! You do not have rights for this operation
158                KERNEL_NO_RIGHTS                = KERNEL_ERROR | (1 << 2),
159
160                //! The appropriate task is not ready
161                KERNEL_TASK_NOT_READY   = KERNEL_ERROR | (1 << 3),
162
163                //! This error comes if there is a circuit dependencies in the kernel task list
164                KERNEL_CIRCULAR_DEPENDENCY = KERNEL_ERROR | (1 << 4),
165
166                //! If tasks are missing, that should be in the pipeline
167                KERNEL_TASK_MISSING             = KERNEL_ERROR | (1 << 5),
168
169                //! This error comes if an end of itarating is reached
170                KERNEL_END_REACHED              = KERNEL_ERROR | (1 << 6),
171
172                //! This error comes if the given task was already updated in this cycle
173                KERNEL_ALREADY_VISITED  = KERNEL_ERROR | (1 << 7),
174
175                //! We are on the leaf in the task dependency tree
176                KERNEL_LEAF_TASK        = KERNEL_ERROR | (1 << 8),
177
178                //------------------------------------------------------------------------------
179                //! Our clock subsystem has got also it's own error group
180                CLOCK_ERROR                             = NR_ERR_GROUP(7),
181
182                //! There is no time observer
183                CLOCK_OBSERVER_NOT_FOUND = CLOCK_ERROR | (1 << 1),
184
185                //! This observer is already observing the time
186                CLOCK_OBSERVER_ALREADY_ADDED = CLOCK_ERROR | (1 << 2),
187
188                //! No time source is currently bounded
189                CLOCK_NO_TIME_SOURCE            = CLOCK_ERROR | (1 << 3),
190
191
192                //------------------------------------------------------------------------------
193                //! There are errors produced by the engine's framework subsystem
194                FW_ERROR                                = NR_ERR_GROUP (8),
195
196                //! THe framework couldn't be initialized
197                FW_CANNOT_INITIALIZE    = FW_ERROR | (1 << 1),
198
199                //! The framework is failed to resize
200                FW_FAILED_TO_RESIZE             = FW_ERROR | (1 << 2),
201
202                //! The rendering context id you give is not valid
203                FW_INVALID_RC_ID                = FW_ERROR | (1 << 3),
204
205                //! The framework is already initialized
206                FW_ALREADY_INIT                 = FW_ERROR | (1 << 4),
207
208                //! The framework subsystem is not initialized at the moment
209                FW_NOT_INITIALIZED              = FW_ERROR | (1 << 5),
210
211                //! The rendering context couldn't setup the pixel format
212                FW_RC_CANNOT_SETUP_PIXEL_FORMAT = FW_ERROR | (1 << 6),
213
214
215
216                //------------------------------------------------------------------------------
217                //! Each error produced by the resource manager is in this group
218                RES_ERROR                               = NR_ERR_GROUP(9),
219
220                //! For this type of resources there is already a loader
221                RES_LOADER_ALREADY_EXISTS       = RES_ERROR | (1 << 1),
222
223                //! The loader is not registered
224                RES_LOADER_NOT_REGISTERED       = RES_ERROR | (1 << 2),
225
226                //! This resource alreaedy exists in the resource database
227                RES_ALREADY_EXISTS                      = RES_ERROR | (1 << 3),
228
229                //! The file type of the resource is not valid
230                RES_BAD_FILETYPE                        = RES_ERROR | (1 << 4),
231
232                //! Empty resource couldn't be loaded
233                RES_CAN_NOT_LOAD_EMPTY          = RES_ERROR | (1 << 5),
234
235                //! The requested resource was not found
236                RES_NOT_FOUND                           = RES_ERROR | (1 << 6),
237
238                //! There is no loader for such kind of resources
239                RES_LOADER_NOT_EXISTS           = RES_ERROR | (1 << 7),
240
241                //! This resource is empty
242                RES_IS_EMPTY                            = RES_ERROR | (1 << 8),
243
244                //! Such resource group was not found
245                RES_GROUP_NOT_FOUND                     = RES_ERROR | (1 << 9),
246
247                //! The pointer to the resource is equal to null
248                RES_PTR_IS_NULL                         = RES_ERROR | (1 << 10),
249
250                //! The resource type of the given resource is not supported
251                RES_TYPE_NOT_SUPPORTED          = RES_ERROR | (1 << 11),
252
253                //! We can not lock anymore, because the lock state stack is full
254                RES_LOCK_STATE_STACK_IS_FULL= RES_ERROR | (1 << 12),
255
256                //! No empty resource was created before
257                RES_NO_EMPTY_RES_FOUND          = RES_ERROR | (1 << 13),
258
259
260                //------------------------------------------------------------------------------
261                //! This are plugin managment errors
262                PLG_ERROR                       = NR_ERR_GROUP(10),
263
264                //! Plugin could not be loaded
265                PLG_COULD_NOT_LOAD              = PLG_ERROR | (1 << 0),
266
267                //! Plugin library could not been initialized
268                PLG_CANNOT_INITIALIZE   = PLG_ERROR | (1 << 1),
269
270                //! Plugin throws an error
271                PLG_EXTERNAL_ERROR              = PLG_ERROR | (1 << 2),
272
273                //! Plugin symbol is not defined
274                PLG_SYMBOL_NOT_FOUND    = PLG_ERROR | (1 << 3),
275
276                //! Plugin version does not accords to the engine's one
277                PLG_WRONG_VERSION               = PLG_ERROR | (1 << 4),
278
279                //! Plugin could not been unloaded properly
280                PLG_UNLOAD_ERROR                = PLG_ERROR | (1 << 5),
281
282
283                //------------------------------------------------------------------------------
284                //! Generic script error
285                SCRIPT_ERROR = NR_ERR_GROUP(11),
286
287                //! The given script could not be parsed
288                SCRIPT_PARSE_ERROR = SCRIPT_ERROR | (1 << 0),
289
290                //! The function you want register is already in the database
291                SCRIPT_FUNCTION_REGISTERED = SCRIPT_ERROR | (1 << 1),
292
293                //! The function you want access is is not in the database
294                SCRIPT_FUNCTION_NOT_REGISTERED = SCRIPT_ERROR | (1 << 2),
295
296                //! This function was not found in the script
297                SCRIPT_FUNCTION_NOT_FOUND = SCRIPT_ERROR | (1 << 3),
298
299                //! Wrong parameter value given
300                SCRIPT_WRONG_PARAMETER_VALUE = SCRIPT_ERROR | (1 << 4),
301
302                //! Script is already running
303                SCRIPT_ALREADY_RUNNING = SCRIPT_ERROR | (1 << 5),
304
305                //------------------------------------------------------------------------------
306                //! Generic event management error
307                EVENT_ERROR = NR_ERR_GROUP(12),
308
309                //! We already does have this event channel in our database
310                EVENT_CHANNEL_EXISTS = EVENT_ERROR | (1 << 0),
311
312                //! There is no channel whith the given name
313                EVENT_NO_CHANNEL_FOUND = EVENT_ERROR | (1 << 1),
314
315                //! The actor is already connected to a certain communication channel
316                EVENT_ALREADY_CONNECTED = EVENT_ERROR | (1 << 2),
317
318                //! The actor is not connected to a certain communication channel
319                EVENT_NOT_CONNECTED = EVENT_ERROR | (1 << 3),
320
321                //! We do not have this event channel in our database
322                EVENT_CHANNEL_NOT_EXISTS = EVENT_ERROR | (1 << 4),
323
324                //! Event of the given type could not be casted to another type
325                EVENT_COULD_NOT_CAST = EVENT_ERROR | (1 << 5),
326
327                //! A given factory name is already in the database
328                EVENT_FACTORY_FOUND = EVENT_ERROR | (1 << 6),
329
330                //! There is no such factory with the given name
331                EVENT_FACTORY_NOT_FOUND = EVENT_ERROR | (1 << 7),
332
333                //! Given actor is not valid
334                EVENT_NO_VALID_ACTOR = EVENT_ERROR | (1 << 8),
335
336                //------------------------------------------------------------------------------
337                //! Generic group for properties errors
338                PROPERTY_ERROR = NR_ERR_GROUP(13),
339
340                //! No such property exists
341                PROPERTY_NOT_EXISTS = PROPERTY_ERROR | (1 << 0),
342
343                //! Wrong property type, so cannot cast
344                PROPERTY_WRONG_TYPE = PROPERTY_ERROR | (1 << 1),
345
346                //------------------------------------------------------------------------------
347                //! This are general engine layer errors
348                ENGINE_ERROR                    = NR_ERR_GROUP(127)
349
350
351        };
352
353
354        //! The result code is only an integer in real \ingroup error
355        typedef uint32          Result;
356
357
358#undef NR_ERR_GROUP
359
360}; // end namespace
361
362
363#endif
364
Note: See TracBrowser for help on using the repository browser.