1 /*
2 // CVRes.h Result codes definitions for CodeVis.
3 // Written by Michael Ellison
4 //-------------------------------------------------------------------------
5 //                      CodeVis's Free License
6 //                         www.codevis.com
7 //
8 // Copyright (c) 2003 by Michael Ellison (mike@codevis.com)
9 // All rights reserved.
10 //
11 // You may use this software in source and/or binary form, with or without
12 // modification, for commercial or non-commercial purposes, provided that
13 // you comply with the following conditions:
14 //
15 // * Redistributions of source code must retain the above copyright notice,
16 //   this list of conditions and the following disclaimer.
17 //
18 // * Redistributions of modified source must be clearly marked as modified,
19 //   and due notice must be placed in the modified source indicating the
20 //   type of modification(s) and the name(s) of the person(s) performing
21 //   said modification(s).
22 //
23 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
29 // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 //
35 //---------------------------------------------------------------------------
36 // Modifications:
37 //
38 //---------------------------------------------------------------------------
39 /// \file CVRes.h Result codes definitions for CodeVis.
40 /// \brief This header defines the basic error codes for most CodeVis functions,
41 /// provides macros to interpret them, and defines the group values for
42 /// other CVRes* files for subsystems.
43 ///
44 /// Define CVRES_VIDCAP_OFFSET to offset all of the result codes if you wish
45 /// to use it alongside a similar error system without collisions.
46 ///
47 /// $RCSfile: CVRes.h,v $
48 /// $Date: 2004/02/08 23:47:37 $
49 /// $Revision: 1.1.1.1 $
50 /// $Author: mikeellison $
51 */
52 #ifndef _CVRES_H_
53 #define _CVRES_H_
54 
55 /*! Result type for most CodeVis functions. */
56 typedef unsigned long CVRES;
57 
58 #define CVHIGHBIT 0x80000000
59 
60 /*
61 /// CVSUCCESS returns true if a CVRES result successful.
62 /// This includes status result codes.
63 */
64 #define CVSUCCESS(x) ( ((x) & CVHIGHBIT) == 0 )
65 
66 /*! CVFAILED returns true if a CVRES result failed. */
67 #define CVFAILED(x)  ( ((x) & CVHIGHBIT) != 0 )
68 
69 /*
70 // Code groups
71 //
72 // These define result code ranges for each
73 // subsystem.  The actual defines for the result
74 // codes are elsewhere as specified
75 //
76 // We split them out so that we don't have to recompile the entire
77 // project when error codes change - just the subsystem who's codes
78 // changed.
79 //
80 */
81 #ifndef CVRES_VIDCAP_OFFSET
82    /*
83    /// Defines an offset that may be used to simplify integration of
84    /// CVRES result codesinto a larger system using similar
85    /// codes.  If defined, all codes except for CVRES_SUCCESS are
86    /// offset by CVRES_VIDCAP_OFFSET.
87    ///
88    /// NOTE: DO NOT DEFINE AN OFFSET IF YOU ARE USING THE DLL!
89    /// Or at least - not if you want to ever use the standard release
90    /// .DLL..... It's compiled with an offset of 0.
91    */
92    #define CVRES_VIDCAP_OFFSET 0
93 #endif
94 
95 /*! Video capture result code group - Defined in CVResVidCap.h. */
96 #define CVRES_VIDCAP_GROUP 0x1000 + CVRES_VIDCAP_OFFSET
97 
98 /*! Imaging result code group - Defined in CVResImage.h. */
99 #define CVRES_IMAGE_GROUP  0x2000 + CVRES_VIDCAP_OFFSET
100 
101 /*! File result code group - Defined in CVResFile.h. */
102 #define CVRES_FILE_GROUP   0x3000 + CVRES_VIDCAP_OFFSET
103 
104 /*! DLL result code group - Defined in CVResDll.h */
105 #define CVRES_DLL_GROUP    0x4000 + CVRES_VIDCAP_OFFSET
106 
107 /*
108 /// Core CVRES result code and group definitions.
109 /// Success = 0
110 /// Status is nonzero with high bit unset
111 /// Error  is nonzero with high bit set
112 */
113 enum CVRES_CORE_ENUM
114 {
115 
116    /*! Operation was successful (0) */
117    CVRES_SUCCESS        = 0,
118 
119    /*------------------------------------------------------------------------
120    // Status definitions
121    */
122 
123    /*! Core status code group. */
124    CVRES_STATUS         = 1 + CVRES_VIDCAP_OFFSET,
125 
126    /*! Video capture status group. */
127    CVRES_VIDCAP_STATUS  = CVRES_VIDCAP_GROUP,
128 
129    /*! Imaging status group. */
130    CVRES_IMAGE_STATUS   = CVRES_IMAGE_GROUP,
131 
132    /*! File status group. */
133    CVRES_FILE_STATUS    = CVRES_FILE_GROUP,
134 
135    /*! DLL status group */
136    CVRES_DLL_STATUS     = CVRES_DLL_GROUP,
137 
138    /*------------------------------------------------------------------------
139    // Error definitions
140    */
141 
142    /*! Generic error - try not to use this one. */
143    CVRES_ERROR          =  CVHIGHBIT + CVRES_VIDCAP_OFFSET,
144 
145    /*! Function or feature is not yet implemented. */
146    CVRES_NOT_IMPLEMENTED,
147 
148    /*! Out of memory! */
149    CVRES_OUT_OF_MEMORY,
150 
151    /*! Out of handles! */
152    CVRES_OUT_OF_HANDLES,
153 
154    /*! Out of threads! */
155    CVRES_OUT_OF_THREADS,
156 
157    /*! Invalid parameter passed to function. */
158    CVRES_INVALID_PARAMETER,
159 
160    /*! Video capture error group. */
161    CVRES_VIDCAP_ERROR   = CVRES_ERROR +
162                           CVRES_VIDCAP_GROUP,
163 
164    /*! Imaging error group. */
165    CVRES_IMAGE_ERROR    = CVRES_ERROR +
166                           CVRES_IMAGE_GROUP,
167 
168    /*! File error group. */
169    CVRES_FILE_ERROR     = CVRES_ERROR +
170                           CVRES_FILE_GROUP,
171 
172    /*! DLL error  group */
173    CVRES_DLL_ERROR      = CVRES_ERROR +
174                           CVRES_DLL_GROUP
175 };
176 
177 #endif /* _CVRES_H_ */
178 
179