MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / setCastValue_

Method setCastValue_

src/openms/source/FORMAT/MRMFeaturePickerFile.cpp:95–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93 }
94
95 void MRMFeaturePickerFile::setCastValue_(const String& key, const String& value, Param& params) const
96 {
97 if (value.empty()) // if the value is empty, don't set it
98 {
99 return;
100 }
101 const std::vector<String> double_headers = {
102 "gauss_width", "peak_width", "signal_to_noise", "sn_win_len", "stop_after_intensity_ratio",
103 "min_peak_width", "recalculate_peaks_max_z", "minimal_quality", "resample_boundary"
104 };
105 const std::vector<String> bool_headers = {
106 "use_gauss", "write_sn_log_messages", "remove_overlapping_peaks", "recalculate_peaks",
107 "use_precursors", "compute_peak_quality", "compute_peak_shape_metrics"
108 };
109 const std::vector<String> uint_headers = {
110 "sgolay_frame_length", "sgolay_polynomial_order", "sn_bin_count"
111 };
112 const std::vector<String> int_headers = {
113 "stop_after_feature"
114 };
115 if (std::find(double_headers.begin(), double_headers.end(), key) != double_headers.end())
116 {
117 params.setValue(key, value.toDouble());
118 }
119 else if (std::find(bool_headers.begin(), bool_headers.end(), key) != bool_headers.end())
120 {
121 params.setValue(key, value == "true" || value == "TRUE" ? "true" : "false");
122 }
123 else if (std::find(uint_headers.begin(), uint_headers.end(), key) != uint_headers.end())
124 {
125 params.setValue(key, static_cast<UInt>(value.toDouble()));
126 }
127 else if (std::find(int_headers.begin(), int_headers.end(), key) != int_headers.end())
128 {
129 params.setValue(key, value.toInt());
130 }
131 else // no conversion for class' parameters of type String
132 {
133 params.setValue(key, value);
134 }
135 }
136}

Callers

nothing calls this directly

Calls 6

toDoubleMethod · 0.80
toIntMethod · 0.80
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
setValueMethod · 0.45

Tested by

no test coverage detected