SimpleApiErrors.h

Go to the documentation of this file.
00001 /*
00002  * The information in this file is
00003  * Copyright(c) 2007 Ball Aerospace & Technologies Corporation
00004  * and is subject to the terms and conditions of the
00005  * GNU Lesser General Public License Version 2.1
00006  * The license text is available from   
00007  * http://www.gnu.org/licenses/lgpl.html
00008  */
00009 
00010 #ifndef SIMPLEAPIERRORS_H__
00011 #define SIMPLEAPIERRORS_H__
00012 
00013 #include "AppConfig.h"
00014 
00015 #ifdef __cplusplus
00016 extern "C"
00017 {
00018 #endif
00019    /** \defgroup simple_api Simple datacentric API */
00020    /*@{*/
00021 
00022    /**
00023     * @file SimpleApiErrors.h
00024     * Error reporting for the simple API.
00025     */
00026 
00027    /**
00028     * Get the error code for the most recent error.
00029     *
00030     * @return The error code for the most recent error.
00031     *
00032     * @see getErrorString()
00033     */
00034    EXPORT_SYMBOL int getLastError();
00035 
00036    /**
00037     * Translate an error code into a string which can be displayed to the user.
00038     *
00039     * @param code
00040     *        The error code to translate. Usually obtained with getLastError().
00041     *
00042     * @return A string which can be displayed to the user. This is a static string and should not be freed.
00043     *
00044     * @see getLastError()
00045     */
00046    EXPORT_SYMBOL const char* getErrorString(int code);
00047 
00048    /**
00049     * Set the error code for the most recent error.
00050     *
00051     * If an API function wishes to define a new code, an appropriate \#define
00052     * should be added to SimpleApiErrors and a message should be added to
00053     * SimpleApiError.cpp.
00054     *
00055     * @param code
00056     *        The error code to set.
00057     */
00058    EXPORT_SYMBOL void setLastError(int code);
00059 
00060    /** No error occurred */
00061    #define SIMPLE_NO_ERROR 0
00062    /** Wrong or invalid type */
00063    #define SIMPLE_WRONG_TYPE 1
00064    /** Requested item not found */
00065    #define SIMPLE_NOT_FOUND 2
00066    /** Bad parameters specified */
00067    #define SIMPLE_BAD_PARAMS 3
00068    /** Buffer is too small */
00069    #define SIMPLE_BUFFER_SIZE 4
00070    /** Not enough memory to process the request */
00071    #define SIMPLE_NO_MEM 5
00072    /** The element already exists */
00073    #define SIMPLE_EXISTS 6
00074    /** A SpatialDataView is required.
00075        This is a common View/Layer error so it is distinct from SIMPLE_WRONG_TYPE */
00076    #define SIMPLE_WRONG_VIEW_TYPE 7
00077    /** Unknown or unclassified error */
00078    #define SIMPLE_OTHER_FAILURE -1
00079 
00080    /*@}*/
00081 #ifdef __cplusplus
00082 }
00083 #endif
00084 
00085 #endif

Software Development Kit - Opticks 4.9.0 Build 16218