MCPcopy Create free account
hub / github.com/aethersdr/AetherSDR / exportWisdomAtomically

Function exportWisdomAtomically

src/core/SpectralNR.cpp:61–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59
60#ifdef HAVE_FFTW3
61bool exportWisdomAtomically(const std::string& directory)
62{
63 const std::string wisdomFile = wisdomPathForDirectory(directory);
64 const std::string tempFile = wisdomTempPathForDirectory(directory);
65
66 std::remove(tempFile.c_str());
67 if (!fftw_export_wisdom_to_filename(tempFile.c_str())) {
68 std::remove(tempFile.c_str());
69 qCWarning(lcDsp) << "SpectralNR: failed to export FFTW wisdom to"
70 << QString::fromStdString(tempFile);
71 return false;
72 }
73
74 std::remove(wisdomFile.c_str());
75 if (std::rename(tempFile.c_str(), wisdomFile.c_str()) != 0) {
76 qCWarning(lcDsp) << "SpectralNR: failed to install FFTW wisdom at"
77 << QString::fromStdString(wisdomFile);
78 std::remove(tempFile.c_str());
79 return false;
80 }
81
82 return true;
83}
84#endif
85
86} // namespace

Callers 1

generateWisdomMethod · 0.85

Calls 2

wisdomPathForDirectoryFunction · 0.85

Tested by

no test coverage detected