1 //*******************************************************************
2 //
3 // License:  See top level LICENSE.txt file.
4 //
5 // Author:  David Burken
6 //
7 // Description:
8 //
9 // Contains class declaration with common error codes and methods to go
10 // from code to string and string to code.
11 //
12 //*************************************************************************
13 // $Id: ossimErrorCodes.h 14789 2009-06-29 16:48:14Z dburken $
14 
15 #ifndef ossimErrorCodes_HEADER
16 #define ossimErrorCodes_HEADER
17 
18 #include <ossim/base/ossimConstants.h>
19 #include <ossim/base/ossimString.h>
20 
21 
22 /*!
23  *  class ossimErrorCodes
24  *  Contains class declaration with common error codes and methods to go
25  *  from code to string and string to code.
26  */
27 class OSSIMDLLEXPORT ossimErrorCodes
28 {
29 public:
30 
31    ~ossimErrorCodes();
32 
33    /*!
34     *  Returns a pointer to "theInstance".
35     */
36    static ossimErrorCodes* instance();
37 
38    /*!
39     *  Returns the error code from a string.  Returns OSSIM_ERROR_UNKNOWN if
40     *  the string does not match.
41     */
42    ossimErrorCode getErrorCode(const ossimString& error_string) const;
43 
44    /*!
45     *  Returns the string matching the error code.
46     *  Returns "OSSIM_ERROR_UNKNOWN" if code is not valid.
47     */
48    ossimString getErrorString(ossimErrorCode error_code) const;
49 
50    static const ossimErrorCode OSSIM_OK;
51    static const ossimErrorCode OSSIM_NO_ERROR;
52    static const ossimErrorCode OSSIM_WARNING;
53    static const ossimErrorCode OSSIM_ERROR;
54    static const ossimErrorCode OSSIM_ERROR_STD_PARALLEL_1;
55    static const ossimErrorCode OSSIM_LAT_ERROR;
56    static const ossimErrorCode OSSIM_LON_ERROR;
57    static const ossimErrorCode OSSIM_NORTHING_ERROR;
58    static const ossimErrorCode OSSIM_ORIGIN_LAT_ERROR;
59    static const ossimErrorCode OSSIM_CENT_MER_ERROR;
60    static const ossimErrorCode OSSIM_A_ERROR;
61    static const ossimErrorCode OSSIM_B_ERROR;
62    static const ossimErrorCode OSSIM_A_LESS_B_ERROR;
63    static const ossimErrorCode OSSIM_FIRST_STDP_ERROR;
64    static const ossimErrorCode OSSIM_SEC_STDP_ERROR;
65    static const ossimErrorCode OSSIM_FIRST_SECOND_ERROR;
66    static const ossimErrorCode OSSIM_HEMISPHERE_ERROR;
67    static const ossimErrorCode OSSIM_EASTING_ERROR;
68    static const ossimErrorCode OSSIM_RADIUS_ERROR;
69    static const ossimErrorCode OSSIM_ORIGIN_LON_ERROR;
70    static const ossimErrorCode OSSIM_ORIENTATION_ERROR;
71    static const ossimErrorCode OSSIM_SCALE_FACTOR_ERROR;
72    static const ossimErrorCode OSSIM_ZONE_ERROR;
73    static const ossimErrorCode OSSIM_ZONE_OVERRIDE_ERROR;
74    static const ossimErrorCode OSSIM_INVALID_FILE_ERROR;
75    static const ossimErrorCode OSSIM_OPEN_FILE_ERROR;
76    static const ossimErrorCode OSSIM_WRITE_FILE_ERROR;
77    static const ossimErrorCode OSSIM_ERROR_UNKNOWN;
78 
79 protected:
80    // Only allow instantiation through the "instance()" method.
81    ossimErrorCodes();
82    ossimErrorCodes(const ossimErrorCodes& rhs);
83    const ossimErrorCodes& operator=(const ossimErrorCodes &rhs);
84 
85    static ossimErrorCodes* theInstance;
86 };
87 
88 #endif
89