00001 #ifndef EDG_WORKLOAD_COMMON_CLIENT_JOBID_H
00002 #define EDG_WORKLOAD_COMMON_CLIENT_JOBID_H
00003
00004
00005
00006
00007
00008
00009
00010 #include <string>
00011 #include <iosfwd>
00012 #include "edg/workload/common/common_namespace.h"
00013 #include "edg/workload/common/jobid/jobid.h"
00014 typedef struct _edg_wlc_jobid_s* edg_wlc_jobid_t;
00015 #define COMMON_JOBID_NAMESPACE_BEGIN namespace edg { namespace workload { namespace common {namespace jobid{
00016 COMMON_JOBID_NAMESPACE_BEGIN
00029 class JobId {
00030 public:
00034 JobId() ;
00040 JobId(const std::string& job_id_string ) ;
00041 JobId(const JobId&);
00042 JobId(const edg_wlc_JobId&);
00047 ~JobId() ;
00049
00053 void clear() ;
00058 bool isSet() { return ( m_JobId != 0 ) ; }
00065 void setJobId(const std::string& lb_server, int port = 0, const std::string& unique = "");
00067
00071 std::string getServer() const;
00074 std::string getUnique() const;
00076
00080 void fromString ( const std::string& dg_JobId );
00083 std::string toString() const;
00084 operator const edg_wlc_JobId() const { return m_JobId; }
00085 JobId & operator=(JobId const &);
00086 JobId & operator=(const edg_wlc_JobId &);
00087 edg_wlc_JobId getId() const ;
00088 private:
00089
00090 edg_wlc_JobId m_JobId;
00091 mutable char* m_pStr;
00092 mutable char* m_pBkserver;
00093 mutable char* m_pUnique;
00094
00095 friend bool operator<(JobId const& lhs, JobId const& rhs);
00096 friend bool operator==(JobId const& lhs, JobId const& rhs);
00097 };
00098
00099 inline bool operator<(JobId const& lhs, JobId const& rhs)
00100 {
00101 return strcmp ( lhs.m_pStr , rhs.m_pStr ) <0 ;
00102 }
00103
00104 inline bool operator==(JobId const& lhs, JobId const& rhs)
00105 {
00106 return strcmp ( lhs.m_pStr , rhs.m_pStr ) ==0 ;
00107 }
00108
00109 std::ostream& operator<<(std::ostream& os, JobId const& id);
00110
00111 } COMMON_NAMESPACE_END }
00112
00113 #endif // EDG_WORKLOAD_COMMON_CLIENT_JOBID_H