Result.h

00001 /***************************************************************************
00002  *                                                                         *
00003  *   (c) Art Tevs, MPI Informatik Saarbruecken                             *
00004  *       mailto: <tevs@mpi-sb.mpg.de>                                      *
00005  *                                                                         *
00006  *   This program is free software; you can redistribute it and/or modify  *
00007  *   it under the terms of the GNU General Public License as published by  *
00008  *   the Free Software Foundation; either version 2 of the License, or     *
00009  *   (at your option) any later version.                                   *
00010  *                                                                         *
00011  ***************************************************************************/
00012 
00013 #ifndef __NR_ENGINE_RESULT_H_
00014 #define __NR_ENGINE_RESULT_H_
00015 
00016 //----------------------------------------------------------------------------------
00017 // Includes
00018 //----------------------------------------------------------------------------------
00019 #include "Prerequisities.h"
00020 
00021 namespace nrEngine{
00022 
00023         /*!
00024         * \defgroup error Exception & Errors
00025         *
00026         * In every application as in our engine there will be some exceptions
00027         * and errors that should be managed. Our engine does use return codes
00028         * to define if any exception occurs. This is used for performance and
00029         * coding style reasons. So here you can find the definition adn description
00030         * of the error codes that could be given back by a function.<br>
00031         * But sometimes engine can not return an error code back (i.e. if error
00032         * occurs in a constructor). In this case an exception will be thrown.
00033         * Each exception is of the Exception - class.
00034         **/
00035 
00036 #define NR_ERR_GROUP(a) 0x01000000 * a
00037 
00038         /**
00039         * nrEngine's error codes returned back by some functions.<br>
00040         * You can combine error codes of different groups
00041         * in binary manner (e.g. BAD_PARAMETERS | OUT_OF_MEMORY).
00042         * \ingroup error
00043         **/
00044         enum  ResultCode {
00045 
00046                 //------------------------------------------------------------------------------
00047 
00048                 //! Don't worry, no error occurs. That is fine :-)
00049                 OK                                      = 0,
00050 
00051                 //! Will be given back if the engine can not detect what kind of error does occurs
00052                 UNKNOWN_ERROR           = 0xFFFFFFFF,
00053 
00054                 //! The parameters given to the function are not valid
00055                 BAD_PARAMETERS          = 1 << 0,
00056 
00057                 //! Engine couldn't allocate a block of memory because (prob.) no memory available
00058                 OUT_OF_MEMORY           = 1 << 1,
00059 
00060                 //! The dator does not contain valid data
00061                 NOT_VALID_DATOR         = 1 << 2,
00062 
00063                 //! Generic time out error 
00064                 TIME_OUT                = 1 << 3,
00065                 
00066                 //------------------------------------------------------------------------------
00067 
00068                 //! This is a general "group error" produced by work on the files
00069                 FILE_ERROR                      = NR_ERR_GROUP(2),
00070 
00071                 //! If file was not found, so this error will be given back
00072                 FILE_NOT_FOUND          = FILE_ERROR | (1 << 0),
00073 
00074                 //! If file has got errors by reading out of a line
00075                 FILE_ERROR_IN_LINE      = FILE_ERROR | (1 << 1),
00076 
00077 
00078                 //------------------------------------------------------------------------------
00079 
00080                 //! General error of the profile error group
00081                 PROFILE_ERROR           = NR_ERR_GROUP(3),
00082 
00083                 //! If the specified profile was not found
00084                 PROFILE_NOT_FOUND       = PROFILE_ERROR | (1 << 0),
00085 
00086                 //! If the specified profile is currently not loaded
00087                 PROFILE_NOT_LOADED      = PROFILE_ERROR | (1 << 1),
00088 
00089                 //! If the specified profile does not exists
00090                 PROFILE_NOT_EXISTS      = PROFILE_ERROR | (1 << 2),
00091 
00092                 //! If the profile you requesting already exists
00093                 PROFILE_ALREADY_EXISTS = PROFILE_ERROR | (1 << 3),
00094 
00095 
00096                 //------------------------------------------------------------------------------
00097 
00098                 //! This is an error defining the virtual file system error group
00099                 VFS_ERROR                               = NR_ERR_GROUP(4),
00100 
00101                 //! If you try to open the file system and it is already opened
00102                 VFS_ALREADY_OPEN                = VFS_ERROR | (1 << 0),
00103 
00104                 //! If the engine couldn't open the virtual file system
00105                 VFS_CANNOT_OPEN                 = VFS_ERROR | (1 << 1),
00106 
00107                 //! If the vfs subsystem couldn't be closed
00108                 VFS_CANNOT_CLOSE                = VFS_ERROR | (1 << 2),
00109 
00110                 //! Do you tried to request a file, but forgott to open the file system?
00111                 VFS_IS_NOT_OPEN                 = VFS_ERROR | (1 << 3),
00112 
00113                 //! The requested file was not found in the vfs
00114                 VFS_FILE_NOT_FOUND              = VFS_ERROR | (1 << 4),
00115 
00116                 //! You can not retrieve data from a file, if it was not opened before
00117                 VFS_FILE_NOT_OPEN               = VFS_ERROR | (1 << 5),
00118 
00119                 //! The reading of the file found an EOF signal
00120                 VFS_FILE_END_REACHED    = VFS_ERROR | (1 << 6),
00121 
00122                 //! File couldn't be readed for many of reasons
00123                 VFS_FILE_READ_ERROR             = VFS_ERROR | (1 << 7),
00124 
00125                 //! The line of a file couldn't be readed
00126                 VFS_LINE_READ_ERROR             = VFS_ERROR | (1 << 8),
00127 
00128                 //! Scan methof fails because of wrong readed data or so
00129                 VFS_SCAN_READ_ERROR             = VFS_ERROR | (1 << 9),
00130 
00131                 //! Seeking in the file failed, probably the seek position is to wide
00132                 VFS_SEEK_ERROR                  = VFS_ERROR | (1 << 10),
00133 
00134                 //! No such parameter exists
00135                 VFS_NO_PARAMETER                = VFS_ERROR | (1 << 11),
00136 
00137 
00138                 //------------------------------------------------------------------------------
00139 
00140                 //! Any error produced by the settings manager is in this group
00141                 SETTINGS_ERROR                  = NR_ERR_GROUP(5),
00142 
00143                 //! If you try to register a variable that already registered
00144                 SETTINGS_VAR_ALREADY_REGISTERED = SETTINGS_ERROR | (1 << 1),
00145 
00146                 //! The variable you requesting is not registered
00147                 SETTINGS_VAR_NOT_REGISTERED     = SETTINGS_ERROR | (1 << 2),
00148 
00149 
00150                 //------------------------------------------------------------------------------
00151                 //! Any error that is thrown in the kernel subsystem is in this group
00152                 KERNEL_ERROR                    = NR_ERR_GROUP(6),
00153 
00154                 //! There were no task found
00155                 KERNEL_NO_TASK_FOUND    = KERNEL_ERROR | (1 << 1),
00156 
00157                 //! You do not have rights for this operation
00158                 KERNEL_NO_RIGHTS                = KERNEL_ERROR | (1 << 2),
00159 
00160                 //! The appropriate task is not ready
00161                 KERNEL_TASK_NOT_READY   = KERNEL_ERROR | (1 << 3),
00162 
00163                 //! This error comes if there is a circuit dependencies in the kernel task list
00164                 KERNEL_CIRCULAR_DEPENDENCY = KERNEL_ERROR | (1 << 4),
00165 
00166                 //! If tasks are missing, that should be in the pipeline
00167                 KERNEL_TASK_MISSING             = KERNEL_ERROR | (1 << 5),
00168 
00169                 //! This error comes if an end of itarating is reached
00170                 KERNEL_END_REACHED              = KERNEL_ERROR | (1 << 6),
00171 
00172                 //! This error comes if the given task was already updated in this cycle
00173                 KERNEL_ALREADY_VISITED  = KERNEL_ERROR | (1 << 7),
00174 
00175                 //! We are on the leaf in the task dependency tree
00176                 KERNEL_LEAF_TASK        = KERNEL_ERROR | (1 << 8),
00177 
00178                 //------------------------------------------------------------------------------
00179                 //! Our clock subsystem has got also it's own error group
00180                 CLOCK_ERROR                             = NR_ERR_GROUP(7),
00181 
00182                 //! There is no time observer
00183                 CLOCK_OBSERVER_NOT_FOUND = CLOCK_ERROR | (1 << 1),
00184 
00185                 //! This observer is already observing the time
00186                 CLOCK_OBSERVER_ALREADY_ADDED = CLOCK_ERROR | (1 << 2),
00187 
00188                 //! No time source is currently bounded
00189                 CLOCK_NO_TIME_SOURCE            = CLOCK_ERROR | (1 << 3),
00190 
00191 
00192                 //------------------------------------------------------------------------------
00193                 //! There are errors produced by the engine's framework subsystem
00194                 FW_ERROR                                = NR_ERR_GROUP (8),
00195 
00196                 //! THe framework couldn't be initialized
00197                 FW_CANNOT_INITIALIZE    = FW_ERROR | (1 << 1),
00198 
00199                 //! The framework is failed to resize
00200                 FW_FAILED_TO_RESIZE             = FW_ERROR | (1 << 2),
00201 
00202                 //! The rendering context id you give is not valid
00203                 FW_INVALID_RC_ID                = FW_ERROR | (1 << 3),
00204 
00205                 //! The framework is already initialized
00206                 FW_ALREADY_INIT                 = FW_ERROR | (1 << 4),
00207 
00208                 //! The framework subsystem is not initialized at the moment
00209                 FW_NOT_INITIALIZED              = FW_ERROR | (1 << 5),
00210 
00211                 //! The rendering context couldn't setup the pixel format
00212                 FW_RC_CANNOT_SETUP_PIXEL_FORMAT = FW_ERROR | (1 << 6),
00213 
00214 
00215 
00216                 //------------------------------------------------------------------------------
00217                 //! Each error produced by the resource manager is in this group
00218                 RES_ERROR                               = NR_ERR_GROUP(9),
00219 
00220                 //! For this type of resources there is already a loader
00221                 RES_LOADER_ALREADY_EXISTS       = RES_ERROR | (1 << 1),
00222 
00223                 //! The loader is not registered
00224                 RES_LOADER_NOT_REGISTERED       = RES_ERROR | (1 << 2),
00225 
00226                 //! This resource alreaedy exists in the resource database
00227                 RES_ALREADY_EXISTS                      = RES_ERROR | (1 << 3),
00228 
00229                 //! The file type of the resource is not valid
00230                 RES_BAD_FILETYPE                        = RES_ERROR | (1 << 4),
00231 
00232                 //! Empty resource couldn't be loaded
00233                 RES_CAN_NOT_LOAD_EMPTY          = RES_ERROR | (1 << 5),
00234 
00235                 //! The requested resource was not found
00236                 RES_NOT_FOUND                           = RES_ERROR | (1 << 6),
00237 
00238                 //! There is no loader for such kind of resources
00239                 RES_LOADER_NOT_EXISTS           = RES_ERROR | (1 << 7),
00240 
00241                 //! This resource is empty
00242                 RES_IS_EMPTY                            = RES_ERROR | (1 << 8),
00243 
00244                 //! Such resource group was not found
00245                 RES_GROUP_NOT_FOUND                     = RES_ERROR | (1 << 9),
00246 
00247                 //! The pointer to the resource is equal to null
00248                 RES_PTR_IS_NULL                         = RES_ERROR | (1 << 10),
00249 
00250                 //! The resource type of the given resource is not supported
00251                 RES_TYPE_NOT_SUPPORTED          = RES_ERROR | (1 << 11),
00252 
00253                 //! We can not lock anymore, because the lock state stack is full
00254                 RES_LOCK_STATE_STACK_IS_FULL= RES_ERROR | (1 << 12),
00255 
00256                 //! No empty resource was created before
00257                 RES_NO_EMPTY_RES_FOUND          = RES_ERROR | (1 << 13),
00258 
00259 
00260                 //------------------------------------------------------------------------------
00261                 //! This are plugin managment errors
00262                 PLG_ERROR                       = NR_ERR_GROUP(10),
00263 
00264                 //! Plugin could not be loaded
00265                 PLG_COULD_NOT_LOAD              = PLG_ERROR | (1 << 0),
00266 
00267                 //! Plugin library could not been initialized
00268                 PLG_CANNOT_INITIALIZE   = PLG_ERROR | (1 << 1),
00269 
00270                 //! Plugin throws an error
00271                 PLG_EXTERNAL_ERROR              = PLG_ERROR | (1 << 2),
00272 
00273                 //! Plugin symbol is not defined
00274                 PLG_SYMBOL_NOT_FOUND    = PLG_ERROR | (1 << 3),
00275 
00276                 //! Plugin version does not accords to the engine's one
00277                 PLG_WRONG_VERSION               = PLG_ERROR | (1 << 4),
00278 
00279                 //! Plugin could not been unloaded properly
00280                 PLG_UNLOAD_ERROR                = PLG_ERROR | (1 << 5),
00281 
00282 
00283                 //------------------------------------------------------------------------------
00284                 //! Generic script error
00285                 SCRIPT_ERROR = NR_ERR_GROUP(11),
00286 
00287                 //! The given script could not be parsed
00288                 SCRIPT_PARSE_ERROR = SCRIPT_ERROR | (1 << 0),
00289 
00290                 //! The function you want register is already in the database
00291                 SCRIPT_FUNCTION_REGISTERED = SCRIPT_ERROR | (1 << 1),
00292 
00293                 //! The function you want access is is not in the database
00294                 SCRIPT_FUNCTION_NOT_REGISTERED = SCRIPT_ERROR | (1 << 2),
00295 
00296                 //! This function was not found in the script
00297                 SCRIPT_FUNCTION_NOT_FOUND = SCRIPT_ERROR | (1 << 3),
00298 
00299                 //! Wrong parameter value given
00300                 SCRIPT_WRONG_PARAMETER_VALUE = SCRIPT_ERROR | (1 << 4),
00301 
00302                 //! Script is already running
00303                 SCRIPT_ALREADY_RUNNING = SCRIPT_ERROR | (1 << 5),
00304 
00305                 //------------------------------------------------------------------------------
00306                 //! Generic event management error
00307                 EVENT_ERROR = NR_ERR_GROUP(12),
00308 
00309                 //! We already does have this event channel in our database
00310                 EVENT_CHANNEL_EXISTS = EVENT_ERROR | (1 << 0),
00311 
00312                 //! There is no channel whith the given name
00313                 EVENT_NO_CHANNEL_FOUND = EVENT_ERROR | (1 << 1),
00314 
00315                 //! The actor is already connected to a certain communication channel
00316                 EVENT_ALREADY_CONNECTED = EVENT_ERROR | (1 << 2),
00317 
00318                 //! The actor is not connected to a certain communication channel
00319                 EVENT_NOT_CONNECTED = EVENT_ERROR | (1 << 3),
00320 
00321                 //! We do not have this event channel in our database
00322                 EVENT_CHANNEL_NOT_EXISTS = EVENT_ERROR | (1 << 4),
00323 
00324                 //! Event of the given type could not be casted to another type
00325                 EVENT_COULD_NOT_CAST = EVENT_ERROR | (1 << 5),
00326 
00327                 //! A given factory name is already in the database
00328                 EVENT_FACTORY_FOUND = EVENT_ERROR | (1 << 6),
00329 
00330                 //! There is no such factory with the given name
00331                 EVENT_FACTORY_NOT_FOUND = EVENT_ERROR | (1 << 7),
00332 
00333                 //! Given actor is not valid
00334                 EVENT_NO_VALID_ACTOR = EVENT_ERROR | (1 << 8),
00335 
00336                 //------------------------------------------------------------------------------
00337                 //! Generic group for properties errors
00338                 PROPERTY_ERROR = NR_ERR_GROUP(13),
00339 
00340                 //! No such property exists
00341                 PROPERTY_NOT_EXISTS = PROPERTY_ERROR | (1 << 0),
00342 
00343                 //! Wrong property type, so cannot cast
00344                 PROPERTY_WRONG_TYPE = PROPERTY_ERROR | (1 << 1),
00345 
00346                 //------------------------------------------------------------------------------
00347                 //! This are general engine layer errors
00348                 ENGINE_ERROR                    = NR_ERR_GROUP(127)
00349 
00350 
00351         };
00352 
00353 
00354         //! The result code is only an integer in real \ingroup error
00355         typedef uint32          Result;
00356 
00357 
00358 #undef NR_ERR_GROUP
00359 
00360 }; // end namespace
00361 
00362 
00363 #endif
00364 

Generated on Wed Sep 12 23:19:42 2007 for nrEngine by  doxygen 1.5.1