MCPcopy Create free account
hub / github.com/CoolProp/CoolProp / CP_get_global_param_string

Function CP_get_global_param_string

wrappers/MathCAD/CoolPropMathcad.cpp:189–212  ·  view source on GitHub ↗

This code executes the user function CP_get_global_param_string, which is a wrapper for the CoolProp.get_global_param_string() function, used to get a global string parameter from CoolProp

Source from the content-addressed store, hash-verified

187// This code executes the user function CP_get_global_param_string, which is a wrapper for
188// the CoolProp.get_global_param_string() function, used to get a global string parameter from CoolProp
189static LRESULT CP_get_global_param_string(LPMCSTRING ParamValue, // output (value of parameter)
190 LPCMCSTRING ParamName) // name of parameter (string) to retrieve
191{
192 std::string s;
193 // Invoke the std::string form of get_global_param_string() function, save result to a new string s
194 try {
195 s = CoolProp::get_global_param_string(ParamName->str);
196 } catch (const CoolProp::ValueError& e) {
197 std::string emsg(e.what());
198 CoolProp::set_error_string(emsg);
199 if (emsg.find("parameter") != std::string::npos)
200 return MAKELRESULT(BAD_PARAMETER, 1);
201 else
202 return MAKELRESULT(UNKNOWN, 1);
203 }
204
205 // Must use MathcadAllocate(size) so Mathcad can track and release, using Helper routine above
206 char* c = AllocMathcadString(s);
207 // assign the string to the function's output parameter
208 ParamValue->str = c;
209
210 // normal return
211 return 0;
212}
213
214// This code executes the user function CP_get_fluid_param_string, which is a wrapper for
215// the CoolProp.get_fluid_param_string() function, used to get a fluid string parameter from CoolProp

Callers

nothing calls this directly

Calls 4

get_global_param_stringFunction · 0.85
set_error_stringFunction · 0.85
AllocMathcadStringFunction · 0.85
whatMethod · 0.80

Tested by

no test coverage detected