From 65e174e42c9c64edb5365b754727d21cb4ef18e4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ale=C5=A1=20K=C5=99enek?= Date: Wed, 27 Feb 2008 12:45:31 +0000 Subject: [PATCH] - added attrByName() method - XXX: option to disable flesh free()ing --- org.glite.lb.client/interface/JobStatus.h.T | 10 +++++++++- org.glite.lb.client/src/JobStatus.cpp.T | 13 ++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) 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; -- 1.8.2.3