Equalizer  2.1.0
Parallel Rendering Framework
eq/fabric/error.h
1 
2 /* Copyright (c) 2010-2017, Stefan Eilemann <eile@eyescale.ch>
3  * Daniel Nachbaur <danielnachbaur@gmail.com>
4  *
5  * This library is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU Lesser General Public License version 2.1 as published
7  * by the Free Software Foundation.
8  *
9  * This library is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12  * details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this library; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef EQFABRIC_ERROR_H
20 #define EQFABRIC_ERROR_H
21 
22 #include <eq/fabric/api.h>
23 #include <eq/fabric/types.h>
24 #include <lunchbox/bitOperation.h> // inline template specialization
25 
26 namespace eq
27 {
28 namespace fabric
29 {
31 class Error
32 {
33  typedef void (Error::*bool_t)() const;
34  void bool_true() const {}
35 public:
37  EQFABRIC_API Error(const uint32_t code,
38  const uint128_t& originator = uint128_t());
39 
41  EQFABRIC_API Error& operator=(const ErrorCode code);
42 
44  EQFABRIC_API operator bool_t() const;
45 
47  EQFABRIC_API bool operator!() const;
48 
50  EQFABRIC_API uint32_t getCode() const;
51 
53  EQFABRIC_API const uint128_t& getOriginator() const;
54 
56  EQFABRIC_API bool operator==(const Error& rhs) const;
57 
59  EQFABRIC_API bool operator!=(const Error& rhs) const;
60 
62  EQFABRIC_API bool operator==(const uint32_t code) const;
63 
65  EQFABRIC_API bool operator!=(const uint32_t code) const;
66 
67  EQFABRIC_API Error();
68  EQFABRIC_API void serialize(co::DataOStream& os) const;
69  EQFABRIC_API void deserialize(co::DataIStream& is);
70 
71 private:
72  uint32_t _code;
73  uint128_t _originator;
74 };
75 
77 EQFABRIC_API std::ostream& operator<<(std::ostream& os, const Error&);
78 }
79 }
80 
81 #endif // EQFABRIC_ERROR_H
Defines export visibility macros for library EqualizerFabric.
EQFABRIC_API const uint128_t & getOriginator() const
EQFABRIC_API uint32_t getCode() const
ErrorCode
Defines errors produced by Equalizer classes.
Definition: errorCodes.h:29
A wrapper for error codes to allow intuitive bool-like usage.
The Equalizer client library.
Definition: eq/agl/types.h:23
std::ostream & operator<<(std::ostream &os, const AxisEvent &event)
Print the axis event to the given output stream.
Definition: axisEvent.h:49
EQFABRIC_API bool operator==(const Error &rhs) const
EQFABRIC_API bool operator!=(const Error &rhs) const
EQFABRIC_API Error & operator=(const ErrorCode code)
Assign the given error code.
EQFABRIC_API bool operator!() const