ProteoWizard
Public Member Functions | Public Attributes | List of all members
pwiz::data::CVParam Struct Reference

represents a tag-value pair, where the tag comes from the controlled vocabulary More...

#include <ParamTypes.hpp>

Inheritance diagram for pwiz::data::CVParam:
pwiz::identdata::ContactRole pwiz::identdata::IonType

Public Member Functions

 CVParam (CVID _cvid, float _value, CVID _units=CVID_Unknown)
 
 CVParam (CVID _cvid, double _value, CVID _units=CVID_Unknown)
 
 CVParam (CVID _cvid, int _value, CVID _units=CVID_Unknown)
 
 CVParam (CVID _cvid, long _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, std::string _value, CVID _units=CVID_Unknown)
 
 CVParam (CVID _cvid, const char *_value, CVID _units=CVID_Unknown)
 
 CVParam (CVID _cvid, bool _value, CVID _units=CVID_Unknown)
 special case for bool (no lexical_cast) More...
 
 CVParam (CVID _cvid=CVID_Unknown)
 constructor for non-valued CVParams More...
 
 ~CVParam ()
 
template<typename value_type >
value_type valueAs () const
 templated value access with type conversion More...
 
std::string name () const
 convenience function to return string for the cvid More...
 
std::string unitsName () const
 convenience function to return string for the units More...
 
double timeInSeconds () const
 convenience function to return time in seconds (throws if units not a time unit) More...
 
std::string valueFixedNotation () const
 convenience function to return value without scientific notation (throws if not a double) More...
 
bool operator== (const CVParam &that) const
 equality operator More...
 
bool operator!= (const CVParam &that) const
 inequality operator More...
 
bool empty () const
 
template<>
bool valueAs () const
 special case for bool (no lexical_cast) (this has to be outside the class for gcc 3.4, inline for msvc) More...
 

Public Attributes

CVID cvid
 
std::string value
 
CVID units
 

Detailed Description

represents a tag-value pair, where the tag comes from the controlled vocabulary

Definition at line 44 of file ParamTypes.hpp.

Constructor & Destructor Documentation

§ CVParam() [1/10]

pwiz::data::CVParam::CVParam ( CVID  _cvid,
float  _value,
CVID  _units = CVID_Unknown 
)
inline

Definition at line 50 of file ParamTypes.hpp.

51  : cvid(_cvid),
52  value(boost::lexical_cast<std::string>(_value)),
53  units(_units)
54  {}
std::string value
Definition: ParamTypes.hpp:47

§ CVParam() [2/10]

pwiz::data::CVParam::CVParam ( CVID  _cvid,
double  _value,
CVID  _units = CVID_Unknown 
)
inline

Definition at line 56 of file ParamTypes.hpp.

57  : cvid(_cvid),
58  value(boost::lexical_cast<std::string>(_value)),
59  units(_units)
60  {}
std::string value
Definition: ParamTypes.hpp:47

§ CVParam() [3/10]

pwiz::data::CVParam::CVParam ( CVID  _cvid,
int  _value,
CVID  _units = CVID_Unknown 
)
inline

Definition at line 62 of file ParamTypes.hpp.

63  : cvid(_cvid),
64  value(boost::lexical_cast<std::string>(_value)),
65  units(_units)
66  {}
std::string value
Definition: ParamTypes.hpp:47

§ CVParam() [4/10]

pwiz::data::CVParam::CVParam ( CVID  _cvid,
long  _value,
CVID  _units = CVID_Unknown 
)
inline

Definition at line 68 of file ParamTypes.hpp.

69  : cvid(_cvid),
70  value(boost::lexical_cast<std::string>(_value)),
71  units(_units)
72  {}
std::string value
Definition: ParamTypes.hpp:47

§ CVParam() [5/10]

pwiz::data::CVParam::CVParam ( CVID  _cvid,
unsigned int  _value,
CVID  _units = CVID_Unknown 
)
inline

Definition at line 74 of file ParamTypes.hpp.

75  : cvid(_cvid),
76  value(boost::lexical_cast<std::string>(_value)),
77  units(_units)
78  {}
std::string value
Definition: ParamTypes.hpp:47

§ CVParam() [6/10]

pwiz::data::CVParam::CVParam ( CVID  _cvid,
unsigned long  _value,
CVID  _units = CVID_Unknown 
)
inline

Definition at line 80 of file ParamTypes.hpp.

81  : cvid(_cvid),
82  value(boost::lexical_cast<std::string>(_value)),
83  units(_units)
84  {}
std::string value
Definition: ParamTypes.hpp:47

§ CVParam() [7/10]

pwiz::data::CVParam::CVParam ( CVID  _cvid,
std::string  _value,
CVID  _units = CVID_Unknown 
)
inline

Definition at line 86 of file ParamTypes.hpp.

87  : cvid(_cvid),
88  value(_value),
89  units(_units)
90  {}
std::string value
Definition: ParamTypes.hpp:47

§ CVParam() [8/10]

pwiz::data::CVParam::CVParam ( CVID  _cvid,
const char *  _value,
CVID  _units = CVID_Unknown 
)
inline

Definition at line 92 of file ParamTypes.hpp.

93  : cvid(_cvid),
94  value(_value),
95  units(_units)
96  {}
std::string value
Definition: ParamTypes.hpp:47

§ CVParam() [9/10]

pwiz::data::CVParam::CVParam ( CVID  _cvid,
bool  _value,
CVID  _units = CVID_Unknown 
)
inline

special case for bool (no lexical_cast)

Definition at line 99 of file ParamTypes.hpp.

100  : cvid(_cvid), value(_value ? "true" : "false"), units(_units)
101  {}
std::string value
Definition: ParamTypes.hpp:47

§ CVParam() [10/10]

pwiz::data::CVParam::CVParam ( CVID  _cvid = CVID_Unknown)
inline

constructor for non-valued CVParams

Definition at line 104 of file ParamTypes.hpp.

105  : cvid(_cvid), units(CVID_Unknown)
106  {}
CVID_Unknown
Definition: cv.hpp:97

§ ~CVParam()

pwiz::data::CVParam::~CVParam ( )

Member Function Documentation

§ valueAs() [1/2]

template<typename value_type >
value_type pwiz::data::CVParam::valueAs ( ) const
inline

templated value access with type conversion

Definition at line 112 of file ParamTypes.hpp.

References boost::lexical_cast(), and pwiz::msdata::id::value().

Referenced by EvenMS2Predicate::accept(), MSLevelSorter::less(), test(), testParamContainer(), testPrecursor(), verifyPrecursorMZ(), and verifyScanInfo().

113  {
114  return !value.empty() ? boost::lexical_cast<value_type>(value)
115  : boost::lexical_cast<value_type>(0);
116  }
std::string value
Definition: ParamTypes.hpp:47
float lexical_cast(const std::string &str)

§ name()

std::string pwiz::data::CVParam::name ( ) const

convenience function to return string for the cvid

§ unitsName()

std::string pwiz::data::CVParam::unitsName ( ) const

§ timeInSeconds()

double pwiz::data::CVParam::timeInSeconds ( ) const

convenience function to return time in seconds (throws if units not a time unit)

Referenced by test().

§ valueFixedNotation()

std::string pwiz::data::CVParam::valueFixedNotation ( ) const

convenience function to return value without scientific notation (throws if not a double)

§ operator==()

bool pwiz::data::CVParam::operator== ( const CVParam that) const
inline

equality operator

Definition at line 131 of file ParamTypes.hpp.

References cvid, units, and value.

132  {
133  return that.cvid==cvid && that.value==value && that.units==units;
134  }
std::string value
Definition: ParamTypes.hpp:47

§ operator!=()

bool pwiz::data::CVParam::operator!= ( const CVParam that) const
inline

inequality operator

Definition at line 137 of file ParamTypes.hpp.

References pwiz::data::operator==().

138  {
139  return !operator==(that);
140  }
bool operator==(const CVParam &that) const
equality operator
Definition: ParamTypes.hpp:131

§ empty()

bool pwiz::data::CVParam::empty ( ) const
inline

§ valueAs() [2/2]

template<>
bool pwiz::data::CVParam::valueAs ( ) const
inline

special case for bool (no lexical_cast) (this has to be outside the class for gcc 3.4, inline for msvc)

Definition at line 175 of file ParamTypes.hpp.

References pwiz::data::operator<<(), PWIZ_API_DECL, and pwiz::msdata::id::value().

176 {
177  return value == "true";
178 }
std::string value
Definition: ParamTypes.hpp:47

Member Data Documentation

§ cvid

CVID pwiz::data::CVParam::cvid

§ value

std::string pwiz::data::CVParam::value

§ units

CVID pwiz::data::CVParam::units

The documentation for this struct was generated from the following file: