24#ifndef _PARAMTYPES_HPP_
25#define _PARAMTYPES_HPP_
33#include <boost/shared_ptr.hpp>
52 value(
boost::lexical_cast<
std::string>(_value)),
58 value(
boost::lexical_cast<
std::string>(_value)),
64 value(
boost::lexical_cast<
std::string>(_value)),
70 value(
boost::lexical_cast<
std::string>(_value)),
76 value(
boost::lexical_cast<
std::string>(_value)),
82 value(
boost::lexical_cast<
std::string>(_value)),
100 : cvid(_cvid), value(_value ?
"true" :
"false"), units(_units)
111 template<
typename value_type>
114 return !value.empty() ? boost::lexical_cast<value_type>(value)
115 : boost::lexical_cast<value_type>(0);
139 return !operator==(that);
175inline bool CVParam::valueAs<bool>()
const
177 return value ==
"true";
200 const std::string& _value =
"",
201 const std::string& _type =
"",
213 template<
typename value_type>
216 return !value.empty() ? boost::lexical_cast<value_type>(value)
217 : boost::lexical_cast<value_type>(0);
233inline bool UserParam::valueAs<bool>()
const
235 return value ==
"true";
271 template<
typename ValueT>
282 template<
typename ValueT>
285 CVParam p = cvParamChild(cvid);
316 template <
typename value_type>
319 set(cvid, boost::lexical_cast<std::string>(value), units);
339inline void ParamContainer::set<bool>(CVID cvid,
bool value, CVID units)
341 set(cvid, (value ?
"true" :
"false"), units);
PWIZ_API_DECL bool cvIsA(CVID child, CVID parent)
returns true iff child IsA parent in the CV
std::ostream & operator<<(std::ostream &os, const Diff< object_type, config_type > &diff)
stream insertion of Diff results
boost::shared_ptr< ParamGroup > ParamGroupPtr
represents a tag-value pair, where the tag comes from the controlled vocabulary
std::string valueFixedNotation() const
convenience function to return value without scientific notation (throws if not a double)
CVParam(CVID _cvid, std::string _value, CVID _units=CVID_Unknown)
std::string unitsName() const
convenience function to return string for the units
CVParam(CVID _cvid=CVID_Unknown)
constructor for non-valued CVParams
double timeInSeconds() const
convenience function to return time in seconds (throws if units not a time unit)
CVParam(CVID _cvid, bool _value, CVID _units=CVID_Unknown)
special case for bool (no lexical_cast)
CVParam(CVID _cvid, double _value, CVID _units=CVID_Unknown)
bool operator!=(const CVParam &that) const
inequality operator
CVParam(CVID _cvid, const char *_value, CVID _units=CVID_Unknown)
std::string name() const
convenience function to return string for the cvid
value_type valueAs() const
templated value access with type conversion
CVParam(CVID _cvid, int _value, CVID _units=CVID_Unknown)
CVParam(CVID _cvid, unsigned int _value, CVID _units=CVID_Unknown)
CVParam(CVID _cvid, unsigned long _value, CVID _units=CVID_Unknown)
CVParam(CVID _cvid, long _value, CVID _units=CVID_Unknown)
CVParam(CVID _cvid, float _value, CVID _units=CVID_Unknown)
bool operator==(const CVParam &that) const
equality operator
functor for finding children of a specified CVID in a collection of CVParams:
bool operator()(const CVParam ¶m) const
CVParamIsChildOf(CVID cvid)
functor for finding CVParam with specified exact CVID in a collection of CVParams:
bool operator()(const CVParam ¶m) const
The base class for elements that may contain cvParams, userParams, or paramGroup references.
bool empty() const
returns true iff the element contains no params or param groups
void set(CVID cvid, const std::string &value="", CVID units=CVID_Unknown)
set/add a CVParam (not recursive)
void set(CVID cvid, double value, CVID units=CVID_Unknown)
set/add a CVParam (not recursive)
std::vector< ParamGroupPtr > paramGroupPtrs
a collection of references to ParamGroups
void set(CVID cvid, int value, CVID units=CVID_Unknown)
set/add a CVParam (not recursive)
bool hasCVParamChild(CVID cvid) const
returns true iff cvParams contains a child (is_a) of cvid (recursive)
bool operator!=(const ParamContainer &that) const
returns !(this==that)
CVParam cvParam(CVID cvid) const
finds cvid in the container:
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms
bool operator==(const ParamContainer &that) const
returns true iff this and that have the exact same cvParams and userParams
UserParam userParam(const std::string &) const
finds UserParam with specified name
std::vector< CVParam > cvParamChildren(CVID cvid) const
finds all children of cvid in the container:
void clear()
clears the collections
ValueT cvParamValueOrDefault(CVID cvid, ValueT defaultValue) const
finds cvid in the container:
std::vector< UserParam > userParams
a collection of uncontrolled user terms
CVParam cvParamChild(CVID cvid) const
finds child of cvid in the container:
bool hasCVParam(CVID cvid) const
returns true iff cvParams contains exact cvid (recursive)
void set(CVID cvid, value_type value, CVID units=CVID_Unknown)
set/add a CVParam (not recursive)
ValueT cvParamChildValueOrDefault(CVID cvid, ValueT defaultValue) const
finds child of cvid in the container:
A collection of CVParam and UserParam elements that can be referenced from elsewhere in this mzML doc...
ParamGroup(const std::string &_id="")
std::string id
the identifier with which to reference this ReferenceableParamGroup.
bool empty() const
returns true iff the element contains no params or param groups
Uncontrolled user parameters (essentially allowing free text). Before using these,...
UserParam(const std::string &_name="", const std::string &_value="", const std::string &_type="", CVID _units=CVID_Unknown)
bool operator!=(const UserParam &that) const
returns !(this==that)
UserParam & operator=(const UserParam &rhs)
CVID units
an optional CV parameter for the unit term associated with the value, if any (e.g....
bool operator==(const UserParam &that) const
returns true iff name, value, type, and units are all pairwise equal
value_type valueAs() const
Templated value access with type conversion.
UserParam(const UserParam &other)
std::string value
the value for the parameter, where appropriate.
bool empty() const
returns true iff name, value, type, and units are all empty
std::string name
the name for the parameter.
double timeInSeconds() const
convenience function to return time in seconds (throws if units not a time unit)
std::string type
the datatype of the parameter, where appropriate (e.g.: xsd:float).