ppforest2 v0.1.0
Projection Pursuit Decision Trees and Random Forests
Loading...
Searching...
No Matches
TempFile Class Reference

RAII temporary file with automatic cleanup. More...

#include <TempFile.hpp>

Public Member Functions

 TempFile (std::string const &suffix=".json")
 
 TempFile (TempFile &&other) noexcept
 
 TempFile (TempFile const &)=delete
 
 ~TempFile ()
 
void clear () const
 Remove the file so the path can be used as a fresh output target.
 
TempFileoperator= (TempFile &&other) noexcept
 
TempFileoperator= (TempFile const &)=delete
 
std::string const & path () const
 
std::string read () const
 Read the entire file contents as a string.
 

Detailed Description

RAII temporary file with automatic cleanup.

Creates a unique temporary file on construction and deletes it in the destructor. Provides helpers to read content back or clear() the file so the path can be used as a fresh output target.

Constructor & Destructor Documentation

◆ TempFile() [1/3]

ppforest2::io::TempFile::TempFile ( std::string const & suffix = ".json")
inline

◆ TempFile() [2/3]

ppforest2::io::TempFile::TempFile ( TempFile const & )
delete

◆ TempFile() [3/3]

ppforest2::io::TempFile::TempFile ( TempFile && other)
inlinenoexcept

◆ ~TempFile()

ppforest2::io::TempFile::~TempFile ( )
inline

Member Function Documentation

◆ clear()

void ppforest2::io::TempFile::clear ( ) const
inline

Remove the file so the path can be used as a fresh output target.

◆ operator=() [1/2]

TempFile & ppforest2::io::TempFile::operator= ( TempFile && other)
inlinenoexcept

◆ operator=() [2/2]

TempFile & ppforest2::io::TempFile::operator= ( TempFile const & )
delete

◆ path()

std::string const & ppforest2::io::TempFile::path ( ) const
inline

◆ read()

std::string ppforest2::io::TempFile::read ( ) const
inline

Read the entire file contents as a string.


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