TPIE

v1.1rc1-6-g0c97303
tpie::temp_file Class Reference

Class representing the existence of a temporary file. More...

#include <tpie/tempname.h>

Inherits noncopyable.

Public Member Functions

bool is_persistent () const
 
void set_persistent (bool p)
 Set persistence. More...
 
 temp_file (const std::string &path, bool persist=false)
 Create a temp_file associated with a specific file. More...
 
void set_path (const std::string &path, bool persist=false)
 Associate with a specific file. More...
 
void update_recorded_size (stream_size_type size)
 
 temp_file ()
 Create a temp_file and generate a random temporary file name. More...
 
 ~temp_file ()
 temp_file destructor. More...
 
const std::string & path ()
 Get the path of the associated file. More...
 
void free ()
 If not persistent, unlink the associated file. More...
 

Detailed Description

Class representing the existence of a temporary file.

When a temp_file object goes out of scope and is not set to persistent, the associated temporary file will be deleted.

Definition at line 152 of file tempname.h.

Constructor & Destructor Documentation

tpie::temp_file::temp_file ( const std::string &  path,
bool  persist = false 
)

Create a temp_file associated with a specific file.

tpie::temp_file::temp_file ( )

Create a temp_file and generate a random temporary file name.

tpie::temp_file::~temp_file ( )

temp_file destructor.

If not persistent, unlink the associated file.

Member Function Documentation

void tpie::temp_file::free ( )

If not persistent, unlink the associated file.

bool tpie::temp_file::is_persistent ( ) const
inline
Returns
Whether this file should not be deleted when this object goes out of scope.

Definition at line 162 of file tempname.h.

Referenced by tpie::ami::stack< T >::persist(), and tpie::ami::stream< T >::persist().

162 {return m_persist;}
void tpie::temp_file::set_path ( const std::string &  path,
bool  persist = false 
)

Associate with a specific file.

void tpie::temp_file::set_persistent ( bool  p)
inline

Set persistence.

When true, the file will not be deleted when this goes out of scope.

Definition at line 168 of file tempname.h.

Referenced by tpie::ami::stack< T >::persist(), tpie::ami::stream< T >::persist(), and tpie::queue< T >::queue().

168 {m_persist=p;}

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