source: nrEngine/include/Result.h @ 27

Revision 27, 12.1 KB checked in by art, 12 years ago (diff)

nrScript: using of subscripts is now possible

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
64                //------------------------------------------------------------------------------
65
66                //! This is a general "group error" produced by work on the files
67                FILE_ERROR                      = NR_ERR_GROUP(2),
68
69                //! If file was not found, so this error will be given back
70                FILE_NOT_FOUND          = FILE_ERROR | (1 << 0),
71
72                //! If file has got errors by reading out of a line
73                FILE_ERROR_IN_LINE      = FILE_ERROR | (1 << 1),
74
75
76                //------------------------------------------------------------------------------
77
78                //! General error of the profile error group
79                PROFILE_ERROR           = NR_ERR_GROUP(3),
80
81                //! If the specified profile was not found
82                PROFILE_NOT_FOUND       = PROFILE_ERROR | (1 << 0),
83
84                //! If the specified profile is currently not loaded
85                PROFILE_NOT_LOADED      = PROFILE_ERROR | (1 << 1),
86
87                //! If the specified profile does not exists
88                PROFILE_NOT_EXISTS      = PROFILE_ERROR | (1 << 2),
89
90                //! If the profile you requesting already exists
91                PROFILE_ALREADY_EXISTS = PROFILE_ERROR | (1 << 3),
92
93
94                //------------------------------------------------------------------------------
95
96                //! This is an error defining the virtual file system error group
97                VFS_ERROR                               = NR_ERR_GROUP(4),
98
99                //! If you try to open the file system and it is already opened
100                VFS_ALREADY_OPEN                = VFS_ERROR | (1 << 0),
101
102                //! If the engine couldn't open the virtual file system
103                VFS_CANNOT_OPEN                 = VFS_ERROR | (1 << 1),
104
105                //! If the vfs subsystem couldn't be closed
106                VFS_CANNOT_CLOSE                = VFS_ERROR | (1 << 2),
107
108                //! Do you tried to request a file, but forgott to open the file system?
109                VFS_IS_NOT_OPEN                 = VFS_ERROR | (1 << 3),
110
111                //! The requested file was not found in the vfs
112                VFS_FILE_NOT_FOUND              = VFS_ERROR | (1 << 4),
113
114                //! You can not retrieve data from a file, if it was not opened before
115                VFS_FILE_NOT_OPEN               = VFS_ERROR | (1 << 5),
116
117                //! The reading of the file found an EOF signal
118                VFS_FILE_END_REACHED    = VFS_ERROR | (1 << 6),
119
120                //! File couldn't be readed for many of reasons
121                VFS_FILE_READ_ERROR             = VFS_ERROR | (1 << 7),
122
123                //! The line of a file couldn't be readed
124                VFS_LINE_READ_ERROR             = VFS_ERROR | (1 << 8),
125
126                //! Scan methof fails because of wrong readed data or so
127                VFS_SCAN_READ_ERROR             = VFS_ERROR | (1 << 9),
128
129                //! Seeking in the file failed, probably the seek position is to wide
130                VFS_SEEK_ERROR                  = VFS_ERROR | (1 << 10),
131
132                //! No such parameter exists
133                VFS_NO_PARAMETER                = VFS_ERROR | (1 << 11),
134
135
136                //------------------------------------------------------------------------------
137
138                //! Any error produced by the settings manager is in this group
139                SETTINGS_ERROR                  = NR_ERR_GROUP(5),
140
141                //! If you try to register a variable that already registered
142                SETTINGS_VAR_ALREADY_REGISTERED = SETTINGS_ERROR | (1 << 1),
143
144                //! The variable you requesting is not registered
145                SETTINGS_VAR_NOT_REGISTERED     = SETTINGS_ERROR | (1 << 2),
146
147
148                //------------------------------------------------------------------------------
149                //! Any error that is thrown in the kernel subsystem is in this group
150                KERNEL_ERROR                    = NR_ERR_GROUP(6),
151
152                //! There were no task found
153                KERNEL_NO_TASK_FOUND    = KERNEL_ERROR | (1 << 1),
154
155                //! You do not have rights for this operation
156                KERNEL_NO_RIGHTS                = KERNEL_ERROR | (1 << 2),
157
158                //! The appropriate task is not ready
159                KERNEL_TASK_NOT_READY   = KERNEL_ERROR | (1 << 3),
160
161                //! This error comes if there is a circuit dependencies in the kernel task list
162                KERNEL_CIRCULAR_DEPENDENCY = KERNEL_ERROR | (1 << 4),
163
164                //! If tasks are missing, that should be in the pipeline
165                KERNEL_TASK_MISSING             = KERNEL_ERROR | (1 << 5),
166
167                //! This error comes if an end of itarating is reached
168                KERNEL_END_REACHED              = KERNEL_ERROR | (1 << 6),
169
170                //! This error comes if the given task was already updated in this cycle
171                KERNEL_ALREADY_VISITED  = KERNEL_ERROR | (1 << 7),
172
173                //! We are on the leaf in the task dependency tree
174                KERNEL_LEAF_TASK        = KERNEL_ERROR | (1 << 8),
175
176                //------------------------------------------------------------------------------
177                //! Our clock subsystem has got also it's own error group
178                CLOCK_ERROR                             = NR_ERR_GROUP(7),
179
180                //! There is no time observer
181                CLOCK_OBSERVER_NOT_FOUND = CLOCK_ERROR | (1 << 1),
182
183                //! This observer is already observing the time
184                CLOCK_OBSERVER_ALREADY_ADDED = CLOCK_ERROR | (1 << 2),
185
186                //! No time source is currently bounded
187                CLOCK_NO_TIME_SOURCE            = CLOCK_ERROR | (1 << 3),
188
189
190                //------------------------------------------------------------------------------
191                //! There are errors produced by the engine's framework subsystem
192                FW_ERROR                                = NR_ERR_GROUP (8),
193
194                //! THe framework couldn't be initialized
195                FW_CANNOT_INITIALIZE    = FW_ERROR | (1 << 1),
196
197                //! The framework is failed to resize
198                FW_FAILED_TO_RESIZE             = FW_ERROR | (1 << 2),
199
200                //! The rendering context id you give is not valid
201                FW_INVALID_RC_ID                = FW_ERROR | (1 << 3),
202
203                //! The framework is already initialized
204                FW_ALREADY_INIT                 = FW_ERROR | (1 << 4),
205
206                //! The framework subsystem is not initialized at the moment
207                FW_NOT_INITIALIZED              = FW_ERROR | (1 << 5),
208
209                //! The rendering context couldn't setup the pixel format
210                FW_RC_CANNOT_SETUP_PIXEL_FORMAT = FW_ERROR | (1 << 6),
211
212
213
214                //------------------------------------------------------------------------------
215                //! Each error produced by the resource manager is in this group
216                RES_ERROR                               = NR_ERR_GROUP(9),
217
218                //! For this type of resources there is already a loader
219                RES_LOADER_ALREADY_EXISTS       = RES_ERROR | (1 << 1),
220
221                //! The loader is not registered
222                RES_LOADER_NOT_REGISTERED       = RES_ERROR | (1 << 2),
223
224                //! This resource alreaedy exists in the resource database
225                RES_ALREADY_EXISTS                      = RES_ERROR | (1 << 3),
226
227                //! The file type of the resource is not valid
228                RES_BAD_FILETYPE                        = RES_ERROR | (1 << 4),
229
230                //! Empty resource couldn't be loaded
231                RES_CAN_NOT_LOAD_EMPTY          = RES_ERROR | (1 << 5),
232
233                //! The requested resource was not found
234                RES_NOT_FOUND                           = RES_ERROR | (1 << 6),
235
236                //! There is no loader for such kind of resources
237                RES_LOADER_NOT_EXISTS           = RES_ERROR | (1 << 7),
238
239                //! This resource is empty
240                RES_IS_EMPTY                            = RES_ERROR | (1 << 8),
241
242                //! Such resource group was not found
243                RES_GROUP_NOT_FOUND                     = RES_ERROR | (1 << 9),
244
245                //! The pointer to the resource is equal to null
246                RES_PTR_IS_NULL                         = RES_ERROR | (1 << 10),
247
248                //! The resource type of the given resource is not supported
249                RES_TYPE_NOT_SUPPORTED          = RES_ERROR | (1 << 11),
250
251                //! We can not lock anymore, because the lock state stack is full
252                RES_LOCK_STATE_STACK_IS_FULL= RES_ERROR | (1 << 12),
253
254                //! No empty resource was created before
255                RES_NO_EMPTY_RES_FOUND          = RES_ERROR | (1 << 13),
256
257
258                //------------------------------------------------------------------------------
259                //! This are plugin managment errors
260                PLG_ERROR                       = NR_ERR_GROUP(10),
261
262                //! Plugin could not be loaded
263                PLG_COULD_NOT_LOAD              = PLG_ERROR | (1 << 0),
264
265                //! Plugin library could not been initialized
266                PLG_CANNOT_INITIALIZE   = PLG_ERROR | (1 << 1),
267
268                //! Plugin throws an error
269                PLG_EXTERNAL_ERROR              = PLG_ERROR | (1 << 2),
270
271                //! Plugin symbol is not defined
272                PLG_SYMBOL_NOT_FOUND    = PLG_ERROR | (1 << 3),
273
274                //! Plugin version does not accords to the engine's one
275                PLG_WRONG_VERSION               = PLG_ERROR | (1 << 4),
276
277                //! Plugin could not been unloaded properly
278                PLG_UNLOAD_ERROR                = PLG_ERROR | (1 << 5),
279
280
281                //------------------------------------------------------------------------------
282                //! Generic script error
283                SCRIPT_ERROR = NR_ERR_GROUP(11),
284
285                //! The given script could not be parsed
286                SCRIPT_PARSE_ERROR = SCRIPT_ERROR | (1 << 0),
287
288                //! The function you want register is already in the database
289                SCRIPT_FUNCTION_REGISTERED = SCRIPT_ERROR | (1 << 1),
290
291                //! The function you want access is is not in the database
292                SCRIPT_FUNCTION_NOT_REGISTERED = SCRIPT_ERROR | (1 << 2),
293
294                //! This function was not found in the script
295                SCRIPT_FUNCTION_NOT_FOUND = SCRIPT_ERROR | (1 << 3),
296
297                //! Wrong parameter value given
298                SCRIPT_WRONG_PARAMETER_VALUE = SCRIPT_ERROR | (1 << 4),
299
300                //! Script is already running
301                SCRIPT_ALREADY_RUNNING = SCRIPT_ERROR | (1 << 5),
302
303                //------------------------------------------------------------------------------
304                //! Generic event management error
305                EVENT_ERROR = NR_ERR_GROUP(12),
306
307                //! We already does have this event channel in our database
308                EVENT_CHANNEL_EXISTS = EVENT_ERROR | (1 << 0),
309
310                //! There is no channel whith the given name
311                EVENT_NO_CHANNEL_FOUND = EVENT_ERROR | (1 << 1),
312
313                //! The actor is already connected to a certain communication channel
314                EVENT_ALREADY_CONNECTED = EVENT_ERROR | (1 << 2),
315
316                //! The actor is not connected to a certain communication channel
317                EVENT_NOT_CONNECTED = EVENT_ERROR | (1 << 3),
318
319                //! We do not have this event channel in our database
320                EVENT_CHANNEL_NOT_EXISTS = EVENT_ERROR | (1 << 4),
321
322                //! Event of the given type could not be casted to another type
323                EVENT_COULD_NOT_CAST = EVENT_ERROR | (1 << 5),
324
325                //! A given factory name is already in the database
326                EVENT_FACTORY_FOUND = EVENT_ERROR | (1 << 6),
327
328                //! There is no such factory with the given name
329                EVENT_FACTORY_NOT_FOUND = EVENT_ERROR | (1 << 7),
330
331                //! Given actor is not valid
332                EVENT_NO_VALID_ACTOR = EVENT_ERROR | (1 << 8),
333
334                //------------------------------------------------------------------------------
335                //! Generic group for properties errors
336                PROPERTY_ERROR = NR_ERR_GROUP(13),
337
338                //! No such property exists
339                PROPERTY_NOT_EXISTS = PROPERTY_ERROR | (1 << 0),
340
341                //! Wrong property type, so cannot cast
342                PROPERTY_WRONG_TYPE = PROPERTY_ERROR | (1 << 1),
343
344                //------------------------------------------------------------------------------
345                //! This are general engine layer errors
346                ENGINE_ERROR                    = NR_ERR_GROUP(127)
347
348
349        };
350
351
352        //! The result code is only an integer in real \ingroup error
353        typedef uint32          Result;
354
355
356#undef NR_ERR_GROUP
357
358}; // end namespace
359
360
361#endif
362
Note: See TracBrowser for help on using the repository browser.