MCPcopy Create free account
hub / github.com/ERGO-Code/HiGHS / readSolutionFileHashKeywordIntLineOk

Function readSolutionFileHashKeywordIntLineOk

highs/lp_data/HighsLpUtils.cpp:2536–2561  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2534}
2535
2536bool readSolutionFileHashKeywordIntLineOk(std::string& hash,
2537 std::string& keyword,
2538 std::string& value_string,
2539 HighsInt& value,
2540 std::ifstream& in_file) {
2541 hash = "";
2542 keyword = "";
2543 value_string = "";
2544 // Read the hash symbol
2545 if (in_file.eof()) return false;
2546 in_file >> hash; // #
2547 if (hash != "#") return false;
2548
2549 // Read the keyword
2550 if (in_file.eof()) return false;
2551 in_file >> keyword; // keyword
2552
2553 // Read the value
2554 if (in_file.eof()) return false;
2555 // Read as a string, and then check it only contains digits
2556 in_file >> value_string;
2557 if (value_string[std::strspn(value_string.c_str(), "-0123456789")])
2558 return false;
2559 value = std::stoi(value_string); // integer value
2560 return true;
2561}
2562
2563bool readSolutionFileIdIgnoreLineOk(std::string& id, std::ifstream& in_file) {
2564 if (in_file.eof()) return false;

Callers 1

readSolutionFileFunction · 0.85

Calls 1

c_strMethod · 0.80

Tested by

no test coverage detected