00001 #ifndef _posix_check_h
00002 #define _posix_check_h
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include <cerrno>
00026 #include <string>
00027 #include "qpid/QpidError.h"
00028
00029 namespace qpid {
00030 namespace sys {
00031
00035 class PosixError : public qpid::QpidError
00036 {
00037 public:
00038 static std::string getMessage(int errNo);
00039
00040 PosixError(int errNo, const qpid::SrcLine& location) throw();
00041
00042 ~PosixError() throw() {}
00043
00044 int getErrNo() { return errNo; }
00045
00046 Exception* clone() const throw() { return new PosixError(*this); }
00047
00048 void throwSelf() const { throw *this; }
00049
00050 private:
00051 int errNo;
00052 };
00053
00054 }}
00055
00057 #define QPID_POSIX_ERROR(errNo) ::qpid::sys::PosixError(errNo, SRCLINE)
00058
00060 #define QPID_POSIX_THROW_IF(ERRNO) \
00061 if ((ERRNO) != 0) throw QPID_POSIX_ERROR((ERRNO))
00062 #endif