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

Method get_JSONstring

src/Backends/Cubics/CubicsLibrary.cpp:83–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81 };
82
83 std::string get_JSONstring(const std::string& key) {
84 std::string uppercase_identifier = upper(key);
85 // Try to find it
86 auto it = JSONstring_map.find(uppercase_identifier);
87 // If it is found
88 if (it == JSONstring_map.end()) {
89 auto italias = aliases_map.find(uppercase_identifier);
90 if (italias != aliases_map.end()) {
91 // Alias was found, use it to get the fluid name, and then the cubic values
92 it = JSONstring_map.find(italias->second);
93 } else {
94 throw ValueError(format("Fluid identifier [%s] was not found in CubicsLibrary", uppercase_identifier.c_str()));
95 }
96 }
97 // Then, wrap the single fluid object in an array, as callers expect
98 nlohmann::json doc = cpjson::parse(it->second);
99 nlohmann::json doc2 = nlohmann::json::array();
100 doc2.push_back(doc);
101 return doc2.dump();
102 }
103
104 CubicsValues get(const std::string& identifier) {
105 std::string uppercase_identifier = upper(identifier);

Callers 1

get_fluid_as_JSONstringFunction · 0.45

Calls 3

upperFunction · 0.85
parseFunction · 0.85
formatFunction · 0.50

Tested by

no test coverage detected