OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmm::io::CheckpointDirectory Class Reference

#include <CheckpointDirectory.hpp>

Collaboration diagram for openswmm::io::CheckpointDirectory:

Public Member Functions

 CheckpointDirectory (std::filesystem::path destination)
 Reserve an exclusive sibling directory for a checkpoint bundle.
 
 ~CheckpointDirectory ()
 Recursively remove the owned staging directory if not published.
 
 CheckpointDirectory (const CheckpointDirectory &)=delete
 
CheckpointDirectory & operator= (const CheckpointDirectory &)=delete
 
const std::filesystem::path & staging () const
 Expose the reserved private directory for writing bundle contents.
 
void publish ()
 Publish the complete reserved bundle by exclusive rename.
 

Detailed Description

Own an exclusively created private directory. Publish the complete bundle without replacing an existing destination, including an empty directory.

Constructor & Destructor Documentation

◆ CheckpointDirectory() [1/2]

openswmm::io::CheckpointDirectory::CheckpointDirectory ( std::filesystem::path destination)
explicit

Reserve an exclusive sibling directory for a checkpoint bundle.

Parameters
[in]destinationFinal bundle path, which must not already exist. The parent must exist and allow creation of a sibling staging directory.
Exceptions
std::runtime_errorThe destination exists or 32 reservation attempts fail.
std::filesystem::filesystem_errorFilesystem inspection or creation fails.

The instance owns its newly created staging directory until publish() succeeds; destruction recursively removes an unpublished bundle.

Here is the caller graph for this function:

◆ ~CheckpointDirectory()

openswmm::io::CheckpointDirectory::~CheckpointDirectory ( )

Recursively remove the owned staging directory if not published.

Note
Cleanup uses error_code and ignores removal failures. A successfully published destination is never removed by this destructor.

◆ CheckpointDirectory() [2/2]

openswmm::io::CheckpointDirectory::CheckpointDirectory ( const CheckpointDirectory & )
delete
Here is the call graph for this function:

Member Function Documentation

◆ operator=()

CheckpointDirectory & openswmm::io::CheckpointDirectory::operator= ( const CheckpointDirectory & )
delete
Here is the call graph for this function:

◆ publish()

void openswmm::io::CheckpointDirectory::publish ( )

Publish the complete reserved bundle by exclusive rename.

Exceptions
std::runtime_errorStaging ownership was already released or exclusive publication fails. Filesystem failures may also propagate.
Postcondition
On success the instance releases cleanup ownership. On failure it continues owning the staging tree so destruction can clean it up.
Here is the call graph for this function:

◆ staging()

const std::filesystem::path & openswmm::io::CheckpointDirectory::staging ( ) const
inline

Expose the reserved private directory for writing bundle contents.

Returns
Borrowed path valid for this object's lifetime. After publish(), this old staging name no longer identifies the published directory.

The documentation for this class was generated from the following files: