From 41c632afdbd99279f6ef36aa11daf3ed2e38a7d6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michal=20Voc=C5=AF?= Date: Tue, 4 Dec 2007 15:25:20 +0000 Subject: [PATCH] disambiguate constructors by using Hostname --- org.glite.jobid.api-cpp/interface/JobId.h | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/org.glite.jobid.api-cpp/interface/JobId.h b/org.glite.jobid.api-cpp/interface/JobId.h index 469078b..d07e622 100755 --- a/org.glite.jobid.api-cpp/interface/JobId.h +++ b/org.glite.jobid.api-cpp/interface/JobId.h @@ -1,10 +1,11 @@ #ifndef GLITE_JOBID_JOBID_H #define GLITE_JOBID_JOBID_H -#include #include #include #include +#include +#include #include "glite/jobid/cjobid.h" @@ -41,6 +42,13 @@ public: class JobId { public: + class Hostname { + public: + std::string const& name; + Hostname(std::string const& n) : name(n) + {} + }; + //@name Constructors/Destructor //@{ @@ -57,7 +65,7 @@ public: * \param port * \param unique */ - explicit JobId(std::string const& host = std::string("localhost"), + explicit JobId(Hostname const& host = Hostname("localhost"), int port = GLITE_JOBID_DEFAULT_PORT, std::string const& unique = std::string("")); @@ -159,18 +167,18 @@ JobId::JobId(std::string const& job_id_string) inline -JobId::JobId(std::string const& host, int port, std::string const& unique) +JobId::JobId(JobId::Hostname const& host, int port, std::string const& unique) { if(port < 0) { throw JobIdError("negative port"); } - int ret = glite_jobid_recreate(host.c_str(), port, + int ret = glite_jobid_recreate(host.name.c_str(), port, unique.empty() ? NULL : unique.c_str(), &m_jobid); switch(ret) { case EINVAL: - throw JobIdError(host); + throw JobIdError(host.name); case ENOMEM: throw std::bad_alloc(); -- 1.8.2.3