* \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.
*
* 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.
*
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<JobStatus>((void*)&in);
+ if (!destroy) flesh->use();
}
JobStatus &
return attr_names[attr];
}
+JobStatus::Attr JobStatus::attrByName(std::string const & name)
+{
+ int a;
+ for (a=0; a<ATTR_MAX; a++) {
+ if (strcasecmp(attr_names[a].c_str(),name.c_str()) == 0) return (JobStatus::Attr) a;
+ }
+ STACK_ADD;
+ throw(Exception(EXCEPTION_MANDATORY,EINVAL,"no such attribute"));
+}
+
typedef std::pair<JobStatus::Attr,JobStatus::AttrType> tpair;
static std::vector<tpair> attrs;