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)
 
 CVParam (CVID _cvid=CVID_Unknown)
 constructor for non-valued CVParams
 
 ~CVParam ()
 
template<typename value_type >
value_type valueAs () const
 templated value access with type conversion
 
std::string name () const
 convenience function to return string for the cvid
 
std::string unitsName () const
 convenience function to return string for the units
 
double timeInSeconds () const
 convenience function to return time in seconds (throws if units not a time unit)
 
std::string valueFixedNotation () const
 convenience function to return value without scientific notation (throws if not a double)
 
bool operator== (const CVParam &that) const
 equality operator
 
bool operator!= (const CVParam &that) const
 inequality operator
 
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)
 

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 {}

◆ 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 {}

◆ 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 {}

◆ 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 {}

◆ 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 {}

◆ 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 {}

◆ 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 {}

◆ 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 {}

◆ 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 {}

◆ 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:114

◆ ~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.

113 {
114 return !value.empty() ? boost::lexical_cast<value_type>(value)
115 : boost::lexical_cast<value_type>(0);
116 }
toType lexical_cast(const std::string &str, bool &success)

Referenced by EvenMS2Predicate::accept(), pwiz::data::ParamContainer::cvParamChildValueOrDefault(), pwiz::data::ParamContainer::cvParamValueOrDefault(), MSLevelSorter::less(), test(), test(), test_v3(), testParamContainer(), verifyPrecursorInfo(), verifyPrecursorInfo(), verifyPrecursorMZ(), and verifyScanInfo().

◆ 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.

132 {
133 return that.cvid==cvid && that.value==value && that.units==units;
134 }

References cvid, units, and value.

◆ operator!=()

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

inequality operator

Definition at line 137 of file ParamTypes.hpp.

138 {
139 return !operator==(that);
140 }
bool operator==(const CVParam &that) const
equality operator

◆ 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.

176{
177 return value == "true";
178}

References value.

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: