svn-gvsig-desktop / trunk / libraries / libjni-mrsid / include / support / lt_status.h @ 3539
History | View | Annotate | Download (4.5 KB)
1 |
/* $Id: lt_status.h 3539 2006-01-09 12:23:20Z nacho $ */
|
---|---|
2 |
/* //////////////////////////////////////////////////////////////////////////
|
3 |
// //
|
4 |
// This code is Copyright (c) 2004 LizardTech, Inc, 1008 Western Avenue, //
|
5 |
// Suite 200, Seattle, WA 98104. Unauthorized use or distribution //
|
6 |
// prohibited. Access to and use of this code is permitted only under //
|
7 |
// license from LizardTech, Inc. Portions of the code are protected by //
|
8 |
// US and foreign patents and other filings. All Rights Reserved. //
|
9 |
// //
|
10 |
////////////////////////////////////////////////////////////////////////// */
|
11 |
/* PUBLIC */
|
12 |
|
13 |
/**
|
14 |
* @file
|
15 |
*
|
16 |
* Declaration of the LT_STATUS type and some commonly used status codes.
|
17 |
*
|
18 |
* @note This file is C-callable.
|
19 |
*/
|
20 |
|
21 |
#ifndef LT_STATUS_H
|
22 |
#define LT_STATUS_H
|
23 |
|
24 |
#if defined(LT_COMPILER_MS)
|
25 |
#pragma warning(push,4) |
26 |
#endif
|
27 |
|
28 |
/**
|
29 |
* @typedef LT_STATUS
|
30 |
*
|
31 |
* An integral status code.
|
32 |
*
|
33 |
* This value is explicitly sized, i.e. @ref lt_uint32 and not an "unsigned
|
34 |
* long", so it can be passed safely between pre-compiled libraries. Each
|
35 |
* LizardTech project/library is assigned ranges of values, e.g. 1000-1999,
|
36 |
* for project-specific, local usage. Values 0-100 are general,
|
37 |
* LizardTech-wide codes. Values 65000-65535 are reserved for customer use.
|
38 |
*/
|
39 |
typedef lt_uint32 LT_STATUS;
|
40 |
|
41 |
|
42 |
/**
|
43 |
* @name Common status codes
|
44 |
*/
|
45 |
/*@{*/
|
46 |
|
47 |
/**
|
48 |
* status code indicating success
|
49 |
*
|
50 |
* This status code indicates the function completed sucessfully.
|
51 |
*/
|
52 |
#define LT_STS_Success ((LT_STATUS)0) |
53 |
|
54 |
/**
|
55 |
* status code indicating failure
|
56 |
*
|
57 |
* This status code indicates general, nonspecific failure. Use sparingly;
|
58 |
* project-specific codes are preferred where possible.
|
59 |
*/
|
60 |
#define LT_STS_Failure ((LT_STATUS)1) |
61 |
|
62 |
/**
|
63 |
* status code indicating unintialized variable
|
64 |
*
|
65 |
* This status code is only used as a sentinal value for initializing
|
66 |
* LT_STATUS variables: it is the "-1" for status codes. A conformant
|
67 |
* function should _never_ return this value.
|
68 |
*/
|
69 |
#define LT_STS_Uninit ((LT_STATUS)2) |
70 |
|
71 |
/**
|
72 |
* status code indicating bad function parameter
|
73 |
*
|
74 |
* This status code indicates that one of the parameters passed to the
|
75 |
* function was invalid, according to the documented interface rules.
|
76 |
* Examples: an integer value is out of the allowed range, or a pointer
|
77 |
*
|
78 |
*/
|
79 |
#define LT_STS_BadParam ((LT_STATUS)3) |
80 |
|
81 |
/**
|
82 |
* status code indicating bad calling context for function
|
83 |
*
|
84 |
* This status code indicates that the function was called in some
|
85 |
* unexpected fashion: not that there was anything wrong with the
|
86 |
* parameters per se, it's just that the world was not set up for
|
87 |
* you to make this particular call in this particular way right now --
|
88 |
* you've violated a documented execution constraint of some sort.
|
89 |
* Examples: calling a class's member function before calling initialize(),
|
90 |
* calling decode before setting a scene or an output buffer, etc.
|
91 |
* (Contrast this with LT_STS_BadParam, which is a more specific
|
92 |
* kind of problem.)
|
93 |
*/
|
94 |
#define LT_STS_BadContext ((LT_STATUS)4) |
95 |
|
96 |
/**
|
97 |
* status code indicating 3rd-party library error
|
98 |
*
|
99 |
* This status code indicates an unknown or otherwise undiagnosable
|
100 |
* exception or error was generated by a call into a 3rd party library.
|
101 |
*/
|
102 |
#define LT_STS_ForeignError ((LT_STATUS)5) |
103 |
|
104 |
/**
|
105 |
* status code indicating unreachable code
|
106 |
*
|
107 |
* This status code is used for code that by definition should not or
|
108 |
* cannot be reached, e.g. the default case in a switch statement for
|
109 |
* which you think you've covered the full range of legal case values,
|
110 |
* where you're left with a dangling return statement. A return of
|
111 |
* LT_STS_NotReached is often preceeded by "LT_ASSERT(false)".
|
112 |
*/
|
113 |
#define LT_STS_NotReached ((LT_STATUS)6) |
114 |
|
115 |
/**
|
116 |
* status code indicating bad NULL pointer dereference
|
117 |
*
|
118 |
* This status code is used when checking a pointer to make sure that
|
119 |
* it is not NULL, prior to dereferencing it.
|
120 |
*/
|
121 |
#define LT_STS_NullPointer ((LT_STATUS)7) |
122 |
|
123 |
/**
|
124 |
* status code indicating new/malloc/calloc failed
|
125 |
*
|
126 |
* This status code is used when allocating memory returns a NULL
|
127 |
* pointer.
|
128 |
*/
|
129 |
#define LT_STS_OutOfMemory ((LT_STATUS)8) |
130 |
|
131 |
/*@}*/
|
132 |
|
133 |
|
134 |
/**
|
135 |
* @name Macros for checking status codes
|
136 |
*/
|
137 |
/*@{*/
|
138 |
|
139 |
/** checks return value for success status */
|
140 |
#define LT_SUCCESS( err ) ((err)==LT_STS_Success)
|
141 |
/** checks return value for failure status */
|
142 |
#define LT_FAILURE( err ) ((err)!=LT_STS_Success)
|
143 |
|
144 |
/*@}*/
|
145 |
|
146 |
|
147 |
#if defined(LT_COMPILER_MS)
|
148 |
#pragma warning(pop)
|
149 |
#endif
|
150 |
|
151 |
#endif /* LT_STATUS_H */ |