Back to index

nordugrid-arc-nox  1.1.0~rc6
GlobusErrorUtils.h
Go to the documentation of this file.
00001 #ifndef __ARC_GLOBUSERRORUTILS_H__
00002 #define __ARC_GLOBUSERRORUTILS_H__
00003 
00004 #include <iostream>
00005 #include <string>
00006 
00007 #ifdef WIN32
00008 #include <arc/win32.h>
00009 #endif
00010 
00011 
00012 #include <globus_common.h>
00013 
00014 namespace Arc {
00015 
00016   std::string globus_object_to_string(globus_object_t *err);
00017   std::ostream& operator<<(std::ostream& o, globus_object_t *err);
00018 
00019   class GlobusResult {
00020   public:
00021     GlobusResult()
00022       : r(GLOBUS_SUCCESS) {}
00023     GlobusResult(const globus_result_t result)
00024       : r(result) {}
00025     GlobusResult& operator=(const globus_result_t result) {
00026       r = result;
00027       return *this;
00028     }
00029     bool operator==(const GlobusResult& result) const {
00030       return (r == result.r);
00031     }
00032     bool operator!=(const GlobusResult& result) const {
00033       return (r != result.r);
00034     }
00035     operator bool() const {
00036       return (r == GLOBUS_SUCCESS);
00037     }
00038     bool operator!() const {
00039       return (r != GLOBUS_SUCCESS);
00040     }
00041     operator globus_result_t() const {
00042       return r;
00043     }
00044     std::string str() const;
00045   private:
00046     globus_result_t r;
00047   };
00048 
00049   std::ostream& operator<<(std::ostream& o, const GlobusResult& res);
00050 
00051 } // namespace Arc
00052 
00053 #endif // __ARC_GLOBUSERRORUTILS_H__