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