From: Aleš Křenek Date: Wed, 27 Feb 2008 12:45:31 +0000 (+0000) Subject: - added attrByName() method X-Git-Tag: glite-yaim-myproxy_R_4_0_1_4~21 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=65e174e42c9c64edb5365b754727d21cb4ef18e4;p=jra1mw.git - added attrByName() method - XXX: option to disable flesh free()ing --- diff --git a/org.glite.lb.client/interface/JobStatus.h.T b/org.glite.lb.client/interface/JobStatus.h.T index d8e1128..49a263b 100644 --- a/org.glite.lb.client/interface/JobStatus.h.T +++ b/org.glite.lb.client/interface/JobStatus.h.T @@ -223,6 +223,13 @@ public: * \throws LoggingException Invalid attribute name. */ static const std::string& getAttrName(Attr name); + + /** Find attribute by name (case insensitive) + * \param[in] name String name. + * \returns enum attr value. + * \throws LoggingException Invalid attribute name. + */ + static Attr attrByName(std::string const &); /** List of attributes and their types valid for this * instance. @@ -271,8 +278,9 @@ public: * * Encapsulates the given struct. * \param[in] src C struct that holds the status. + * \param[in] destroy destroy src after use. */ - JobStatus(const edg_wll_JobStat &src); + JobStatus(const edg_wll_JobStat &src,int destroy = 1); /** Assignment from the C type. * diff --git a/org.glite.lb.client/src/JobStatus.cpp.T b/org.glite.lb.client/src/JobStatus.cpp.T index c2b3619..104cc44 100644 --- a/org.glite.lb.client/src/JobStatus.cpp.T +++ b/org.glite.lb.client/src/JobStatus.cpp.T @@ -74,10 +74,11 @@ JobStatus::operator=(const JobStatus & in) return *this; } -JobStatus::JobStatus(const edg_wll_JobStat & in) +JobStatus::JobStatus(const edg_wll_JobStat & in,int destroy) { status = (Code)in.state; flesh = new CountRef((void*)&in); + if (!destroy) flesh->use(); } JobStatus & @@ -428,6 +429,16 @@ JobStatus::getAttrName(JobStatus::Attr attr) return attr_names[attr]; } +JobStatus::Attr JobStatus::attrByName(std::string const & name) +{ + int a; + for (a=0; a tpair; static std::vector attrs;