Equalizer  1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
fabric/error.h
1 
2 /* Copyright (c) 2010-2014, Stefan Eilemann <eile@eyescale.ch>
3  *
4  * This library is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License version 2.1 as published
6  * by the Free Software Foundation.
7  *
8  * This library is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11  * details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this library; if not, write to the Free Software Foundation, Inc.,
15  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16  */
17 
18 #ifndef EQFABRIC_ERROR_H
19 #define EQFABRIC_ERROR_H
20 
21 #include <eq/fabric/api.h>
22 #include <lunchbox/types.h>
23 
24 namespace eq
25 {
26 namespace fabric
27 {
30 {
31  ERROR_NONE = 0,
32  ERROR_FBO_UNSUPPORTED,
33  ERROR_FRAMEBUFFER_STATUS,
34  ERROR_FRAMEBUFFER_UNSUPPORTED,
35  ERROR_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT,
36  ERROR_FRAMEBUFFER_INCOMPLETE_ATTACHMENT,
37  ERROR_FRAMEBUFFER_INCOMPLETE_DIMENSIONS,
38  ERROR_FRAMEBUFFER_INCOMPLETE_FORMATS,
39  ERROR_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER,
40  ERROR_FRAMEBUFFER_INCOMPLETE_READ_BUFFER,
41  ERROR_FRAMEBUFFER_INITIALIZED,
42  ERROR_CUDACONTEXT_DEVICE_NOTFOUND,
43  ERROR_CUDACONTEXT_INIT_FAILED,
44  ERROR_CUDACONTEXT_MISSING_SUPPORT,
45  ERROR_WINDOWSYSTEM_UNKNOWN,
46  ERROR_NODE_LAUNCH,
47  ERROR_NODE_CONNECT,
48  ERROR_PIPE_NODE_NOTRUNNING,
49  ERROR_SYSTEMPIPE_PIXELFORMAT_NOTFOUND,
50  ERROR_SYSTEMPIPE_CREATECONTEXT_FAILED,
51  ERROR_SYSTEMPIPE_CREATEWINDOW_FAILED,
52  ERROR_AGLPIPE_DISPLAYS_NOTFOUND,
53  ERROR_AGLPIPE_DEVICE_NOTFOUND,
54  ERROR_GLXPIPE_DEVICE_NOTFOUND,
55  ERROR_GLXPIPE_GLX_NOTFOUND,
56  ERROR_GLXPIPE_GLXEWINIT_FAILED,
57  ERROR_WGL_CREATEAFFINITYDC_FAILED,
58  ERROR_WGLPIPE_ENUMDISPLAYS_FAILED,
59  ERROR_WGLPIPE_CREATEDC_FAILED,
60  ERROR_WGLPIPE_ENUMGPUS_FAILED,
61  ERROR_WGLPIPE_REGISTERCLASS_FAILED,
62  ERROR_WGLPIPE_SETPF_FAILED,
63  ERROR_WGLPIPE_WGLEWINIT_FAILED,
64  ERROR_WINDOW_PIPE_NOTRUNNING,
65  ERROR_WINDOW_PVP_INVALID,
66  ERROR_SYSTEMWINDOW_PIXELFORMAT_NOTFOUND,
67  ERROR_SYSTEMWINDOW_NO_PIXELFORMAT,
68  ERROR_SYSTEMWINDOW_ARB_FLOAT_FB_REQUIRED,
69  ERROR_AGLWINDOW_NO_CONTEXT,
70  ERROR_AGLWINDOW_CREATECONTEXT_FAILED,
71  ERROR_AGLWINDOW_CREATEPBUFFER_FAILED,
72  ERROR_AGLWINDOW_SETPBUFFER_FAILED,
73  ERROR_AGLWINDOW_CREATEWINDOW_FAILED,
74  ERROR_AGLWINDOW_SETWINDOW_FAILED,
75  ERROR_GLXWINDOW_NO_DRAWABLE,
76  ERROR_GLXWINDOW_NO_DISPLAY,
77  ERROR_GLXWINDOW_CREATECONTEXT_FAILED,
78  ERROR_GLXWINDOW_CREATEWINDOW_FAILED,
79  ERROR_GLXWINDOW_GLXQUERYVERSION_FAILED,
80  ERROR_GLXWINDOW_GLX_1_3_REQUIRED,
81  ERROR_GLXWINDOW_NO_FBCONFIG,
82  ERROR_GLXWINDOW_NO_VISUAL,
83  ERROR_GLXWINDOW_CREATEPBUFFER_FAILED,
84  ERROR_GLXWINDOW_FBCONFIG_REQUIRED,
85  ERROR_WGLWINDOW_NO_DRAWABLE,
86  ERROR_WGLWINDOW_SETPIXELFORMAT_FAILED,
87  ERROR_WGLWINDOW_REGISTERCLASS_FAILED,
88  ERROR_WGLWINDOW_FULLSCREEN_FAILED,
89  ERROR_WGLWINDOW_CREATEWINDOW_FAILED,
90  ERROR_WGLWINDOW_ARB_PBUFFER_REQUIRED,
91  ERROR_WGLWINDOW_CREATEPBUFFER_FAILED,
92  ERROR_WGLWINDOW_SETAFFINITY_PF_FAILED,
93  ERROR_WGLWINDOW_CHOOSE_PF_ARB_FAILED,
94  ERROR_WGLWINDOW_CREATECONTEXT_FAILED,
95  ERROR_CHANNEL_WINDOW_NOTRUNNING,
96  ERROR_PBO_UNSUPPORTED,
97  ERROR_PBO_NOT_INITIALIZED,
98  ERROR_PBO_SIZE_TOO_SMALL,
99  ERROR_PBO_TYPE_UNSUPPORTED,
100 
101  ERROR_CUSTOM = LB_64KB, // 0x10000
102 };
103 
105 class Error
106 {
107  typedef void (Error::*bool_t)() const;
108  void bool_true() const {}
109 
110 public:
112  explicit Error( const uint32_t code ) : code_( code ) {}
113 
115  Error& operator = ( const ErrorCode code ) { code_ = code; return *this; }
116 
118  operator bool_t() { return code_ == ERROR_NONE ? &Error::bool_true : 0; }
119 
121  bool operator ! () { return code_ != ERROR_NONE; }
122 
124  uint32_t getCode() const { return code_; }
125 
127  operator uint32_t() const { return code_; }
128 
130  bool operator == ( const Error& rhs ) const { return code_ == rhs.code_; }
131 
133  bool operator != ( const Error& rhs ) const { return code_ != rhs.code_; }
134 
136  bool operator == ( const uint32_t code ) const { return code_ == code; }
137 
139  bool operator != ( const uint32_t code ) const { return code_ != code; }
140 
141 private:
142  uint32_t code_;
143 };
144 
146 EQFABRIC_API std::ostream& operator << ( std::ostream& os, const Error& );
147 
148 }
149 }
150 #endif // EQFABRIC_ERROR_H
bool operator!=(const Error &rhs) const
Definition: fabric/error.h:133
Error(const uint32_t code)
Construct a new error.
Definition: fabric/error.h:112
bool operator==(const Error &rhs) const
Definition: fabric/error.h:130
ErrorCode
Defines errors produced by Equalizer classes.
Definition: fabric/error.h:29
Error & operator=(const ErrorCode code)
Assign the given error code.
Definition: fabric/error.h:115
A wrapper for error codes to allow intuitive bool-like usage.
Definition: fabric/error.h:105
uint32_t getCode() const
Definition: fabric/error.h:124