00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _APRBase_
00022 #define _APRBase_
00023
00024 #include <string>
00025 #include <apr_thread_mutex.h>
00026 #include <apr_errno.h>
00027
00028 namespace qpid {
00029 namespace sys {
00030
00038 class APRBase{
00039 static APRBase* instance;
00040 apr_pool_t* pool;
00041 apr_thread_mutex_t* mutex;
00042 int count;
00043
00044 APRBase();
00045 ~APRBase();
00046 static APRBase* getInstance();
00047 bool _increment();
00048 void _decrement();
00049 public:
00050 static void increment();
00051 static void decrement();
00052 };
00053
00054
00055 void check(apr_status_t status, const char* file, const int line);
00056 std::string get_desc(apr_status_t status);
00057
00058 #define CHECK_APR_SUCCESS(A) qpid::sys::check(A, __FILE__, __LINE__);
00059
00060 }
00061 }
00062
00063
00064 void inline qpid::sys::check(apr_status_t status, const char* file, const int line){
00065 if (status != APR_SUCCESS){
00066 char tmp[256];
00067 throw Exception(QPID_MSG(apr_strerror(status, tmp, size)))
00068 }
00069 }
00070
00071
00072
00073
00074 #endif