Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
psi::PSIOManager Class Reference

#include <psio.hpp>

Public Member Functions

 PSIOManager ()
 Default constructor (does nothing) More...
 ~PSIOManager ()
 Default destructor (does nothing) More...
void mirror_to_disk ()
void build_from_disk ()
void set_default_path (const std::string &path)
void set_specific_path (int fileno, const std::string &path)
void set_specific_retention (int fileno, bool retain)
bool get_specific_retention (int fileno)
std::string get_file_path (int fileno)
std::string get_default_path ()
void write_scratch_file (const std::string &full_path, const std::string &text)
void open_file (const std::string &full_path, int fileno)
void close_file (const std::string &full_path, int fileno, bool keep)
void move_file (const std::string &old_full_path, const std::string &new_full_path)
void mark_file_for_retention (const std::string &full_path, bool retain)
void print (std::string out="outfile")
void print_out ()
void psiclean ()
void crashclean ()

Static Public Member Functions

static std::shared_ptr
< PSIOManager
shared_object ()
 The one and (should be) only instance of PSIOManager for a PSI4 instance. More...

Private Attributes

std::string default_path_
 Default path for unspec'd file numbers. More...
std::map< int, std::string > specific_paths_
 Specific paths for arbitrary file numbers. More...
std::set< int > specific_retains_
 Default retained files. More...
std::map< std::string, bool > files_
 Map of files, bool denotes open or closed. More...
std::set< std::string > retained_files_
 Set of files to retain after psiclean. More...
std::string pid_

Detailed Description

PSIOManager is a class designed to be used as a static object to track all PSIO operations in a given PSI4 computation

This will allow PSICLEAN to be trivially executed. Now supports a .psirc and interactive file placement

Constructor & Destructor Documentation

psi::PSIOManager::PSIOManager ( )

Default constructor (does nothing)

psi::PSIOManager::~PSIOManager ( )

Default destructor (does nothing)

Member Function Documentation

void psi::PSIOManager::build_from_disk ( )

Build from "psi.clean"

void psi::PSIOManager::close_file ( const std::string &  full_path,
int  fileno,
bool  keep 

Record the opening of a file

filenoPSI4 file number
keepTRUE : the file is closed and retained by PSIO FALSE: the file is closed and deleted by PSIO
void psi::PSIOManager::crashclean ( )

Clean from disk-mirrored image after crash NOT to be called during regular computation

std::string psi::PSIOManager::get_default_path ( )

Returns the default path.

the default path.
std::string psi::PSIOManager::get_file_path ( int  fileno)

Get the path for a specific file number

filenoPSI4 file number
the appropriate full path
bool psi::PSIOManager::get_specific_retention ( int  fileno)

Inquire whether a specific file number is set to be retained

filenoPSI4 file number
keeping or not?
void psi::PSIOManager::mark_file_for_retention ( const std::string &  full_path,
bool  retain 

Mark a file to be retained after a psiclean operation, ie for use in a later computation

retainkeep or not? (Allows override)
void psi::PSIOManager::mirror_to_disk ( )

Mirror the current delete-able files to "psi.clean"

void psi::PSIOManager::move_file ( const std::string &  old_full_path,
const std::string &  new_full_path 

Move a file from one location to another, retaining status Useful for changing namespaces

old_full_pathold filename
new_full_pathnew filename
void psi::PSIOManager::open_file ( const std::string &  full_path,
int  fileno 

Record the opening of a file

void psi::PSIOManager::print ( std::string  out = "outfile")

Print the current status of PSI4 files

outfile to print to
void psi::PSIOManager::print_out ( )

Print the current status of PSI4 files

void psi::PSIOManager::psiclean ( )

Execute the psiclean protocol, deleting all recorded files except for those currently marked for retention.

Those files marked for retention are not deleted, and their traces in the files_ set and retained_files set remain. Deleted files are removed from the files_ set.

This is useful for intermediate calls to psiclean

void psi::PSIOManager::set_default_path ( const std::string &  path)

Set the default path for files to be stored

pathfull path to scratch
void psi::PSIOManager::set_specific_path ( int  fileno,
const std::string &  path 

Set the path for specific file numbers

filenoPSI4 file number
pathfull path to file-specific scratch
void psi::PSIOManager::set_specific_retention ( int  fileno,
bool  retain 

Set the the specific file number to be retained

filenoPSI4 file number
retainkeep or not? (Allows override)
std::shared_ptr< PSIOManager > psi::PSIOManager::shared_object ( )

The one and (should be) only instance of PSIOManager for a PSI4 instance.

void psi::PSIOManager::write_scratch_file ( const std::string &  full_path,
const std::string &  text 

Write a string to a temporary file. The scratch file is opened and closed by this function.

full_pathThe fill path to the scratch file
textThe text to be placed in the file

Member Data Documentation

std::string psi::PSIOManager::default_path_

Default path for unspec'd file numbers.

std::map<std::string, bool> psi::PSIOManager::files_

Map of files, bool denotes open or closed.

std::string psi::PSIOManager::pid_
std::set<std::string> psi::PSIOManager::retained_files_

Set of files to retain after psiclean.

std::map<int, std::string> psi::PSIOManager::specific_paths_

Specific paths for arbitrary file numbers.

std::set<int> psi::PSIOManager::specific_retains_

Default retained files.

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