this code executes the user function CP_get_mixture_binary_pair_data, which is a wrapper for the CoolProp.get_mixture_binary_pair_data() function, used to get the requested binary pair interaction parameter (always returned as a string).
| 658 | // the CoolProp.get_mixture_binary_pair_data() function, used to get the requested binary pair |
| 659 | // interaction parameter (always returned as a string). |
| 660 | static LRESULT CP_get_mixture_binary_pair_data(LPMCSTRING Value, // output string (string contains value of parameter) |
| 661 | LPCMCSTRING CAS1, // First component |
| 662 | LPCMCSTRING CAS2, // Second component |
| 663 | LPCMCSTRING Key) // name of the binary pair parameter (string) to retrieve |
| 664 | { |
| 665 | std::string s; |
| 666 | // Invoke the std::string form of get_global_param_string() function, save result to a new string s |
| 667 | try { |
| 668 | s = CoolProp::get_mixture_binary_pair_data(CAS1->str, CAS2->str, Key->str); |
| 669 | } catch (const CoolProp::ValueError& e) { |
| 670 | std::string emsg(e.what()); |
| 671 | CoolProp::set_error_string(emsg); |
| 672 | if (emsg.find("parameter") != std::string::npos) |
| 673 | return MAKELRESULT(BAD_PARAMETER, 3); |
| 674 | else if (emsg.find("binary pair") != std::string::npos) |
| 675 | return MAKELRESULT(BAD_BINARY_PAIR, 1); |
| 676 | else |
| 677 | return MAKELRESULT(UNKNOWN, 1); |
| 678 | } |
| 679 | |
| 680 | // Must use MathcadAllocate(size) so Mathcad can track and release, using Helper routine above |
| 681 | char* c = AllocMathcadString(s); |
| 682 | // assign the string to the function's output parameter |
| 683 | Value->str = c; |
| 684 | |
| 685 | // normal return |
| 686 | return 0; |
| 687 | } |
| 688 | |
| 689 | // Helper: centralize check for predefined-mixture-not-found error messages |
| 690 | static inline bool PredefinedMixtureNotFound(const std::string& emsg) { |
nothing calls this directly
no test coverage detected