MCPcopy Create free account
hub / github.com/chrxh/alien / deserializeSimulationFromFiles

Method deserializeSimulationFromFiles

source/PersisterInterface/SerializerService.cpp:886–916  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

884}
885
886bool SerializerService::deserializeSimulationFromFiles(DeserializedSimulation& data, std::filesystem::path const& filename)
887{
888 try {
889 log(Priority::Important, "load simulation from " + filename.string());
890 std::filesystem::path settingsFilename(filename);
891 settingsFilename.replace_extension(std::filesystem::path(".settings.json"));
892 std::filesystem::path statisticsFilename(filename);
893 statisticsFilename.replace_extension(std::filesystem::path(".statistics.csv"));
894
895 if (!deserializeDataDescription(data.mainData, filename)) {
896 return false;
897 }
898 {
899 std::ifstream stream(settingsFilename.string(), std::ios::binary);
900 if (!stream) {
901 return false;
902 }
903 deserializeAuxiliaryData(data.auxiliaryData, stream);
904 }
905 {
906 std::ifstream stream(statisticsFilename.string(), std::ios::binary);
907 if (!stream) {
908 return true;
909 }
910 deserializeStatistics(data.statistics, stream);
911 }
912 return true;
913 } catch (...) {
914 return false;
915 }
916}
917
918bool SerializerService::deleteSimulation(std::filesystem::path const& filename)
919{

Callers 2

processRequestMethod · 0.80
mainFunction · 0.80

Calls 1

logFunction · 0.85

Tested by

no test coverage detected