feat(cpp-object-oriented-modular-refactoring): step 23 - hdf5-writer-modules

This commit is contained in:
KOKO\Mimi
2026-08-16 13:28:06 +09:00
parent 5e4e3f2a5b
commit feaddd9e83
15 changed files with 3004 additions and 2300 deletions
+37
View File
@@ -0,0 +1,37 @@
#ifndef FESA_IO_HDF5_HDF5_ATOMIC_FILE_H_
#define FESA_IO_HDF5_HDF5_ATOMIC_FILE_H_
#include <filesystem>
#include "fesa/core/status.h"
namespace fesa::hdf5_internal {
/// @brief Removes an uncommitted same-directory candidate on failure.
class CandidateFileGuard {
public:
explicit CandidateFileGuard(std::filesystem::path path);
CandidateFileGuard(const CandidateFileGuard&) = delete;
CandidateFileGuard& operator=(const CandidateFileGuard&) = delete;
~CandidateFileGuard();
void Release() noexcept;
private:
std::filesystem::path path_;
bool active_{true};
};
/// @brief Selects a unique same-directory candidate path.
std::filesystem::path MakeCandidatePath(
const std::filesystem::path& output_path);
/// @brief Publishes only a successfully self-checked candidate.
/// @note Validation failure removes the candidate and preserves any final.
Status AtomicFinalizeValidatedCandidate(
const std::filesystem::path& candidate_path,
const std::filesystem::path& output_path, const Status& validation);
} // namespace fesa::hdf5_internal
#endif // FESA_IO_HDF5_HDF5_ATOMIC_FILE_H_