|
Grassroots Infrastructure
The Grassroots Infrastructure is a suite of computing tools to help users and developers use scientific data infrastructure that can easily be interconnected.
|
Create a temporary file to read and write data to. More...
#include <temp_file.hpp>
Public Member Functions | |
| ~TempFile () | |
| The TempFile destructor. More... | |
| const char * | GetFilename () const |
| Get the filename being used by this TempFile. More... | |
| bool | Open (const char *mode_s) |
| Open the TempFile. More... | |
| int | Close () |
| Close the TempFile. More... | |
| bool | Print (const char *arg_s) |
| Print a c-style string to the TempFile. More... | |
| const char * | GetData () |
| Get the contents of the TempFile as a c-style string. More... | |
| void | ClearData () |
| Clear the data from the underlying file. More... | |
| bool | IsOpen () const |
| Check if a TempFile is currently open. More... | |
| ~TempFile () | |
| The TempFile destructor. More... | |
| const char * | GetFilename () const |
| Get the filename being used by this TempFile. More... | |
| bool | Open (const char *mode_s) |
| Open the TempFile. More... | |
| int | Close () |
| Close the TempFile. More... | |
| bool | Print (const char *arg_s) |
| Print a c-style string to the TempFile. More... | |
| const char * | GetData () |
| Get the contents of the TempFile as a c-style string. More... | |
| void | ClearData () |
| Clear the data from the underlying file. More... | |
| bool | IsOpen () const |
| Check if a TempFile is currently open. More... | |
| char * | GetTempFilenameBuffer (const char *const working_directory_s, const char *const prefix_s, const char *const temp_suffix_s) |
| Create a buffer of the required length to be used by TempFile *GetTempFile (const char *template_s, const bool temp_flag). More... | |
Static Public Member Functions | |
| static TempFile * | GetTempFile (const char *template_s, const bool temp_flag) |
| Create a TempFile. More... | |
| static TempFile * | GetTempFile (const char *working_dir_s, const uuid_t id, const char *const suffix_s) |
| Create a TempFile. More... | |
| static TempFile * | GetTempFile (const char *template_s, const bool temp_flag) |
| Create a TempFile. More... | |
| static TempFile * | GetTempFile (const char *working_dir_s, const uuid_t id, const char *const suffix_s) |
| Create a TempFile. More... | |
Create a temporary file to read and write data to.
|
static |
Create a TempFile.
The filename used will be of the form
<working_dir_s>/<id>.<suffix_s>.
| template_s | The template for the filename. The filename generated from this will depend upon the value of tenp_flag. |
| temp_flag | If this is true then template_s will be passed to tmpnam. If not, template_s will be used as is for the filename. |
| const char* GetFilename | ( | ) | const |
Get the filename being used by this TempFile.
| bool Open | ( | const char * | mode_s | ) |
Open the TempFile.
| mode_s | The mode string which is the same as the c standard library mode string used by fopen. |
true if the file was opened successfully, false otherwise. | int Close | ( | ) |
Close the TempFile.
| bool Print | ( | const char * | arg_s | ) |
Print a c-style string to the TempFile.
| arg_s | The strng to print. |
true if the string was printed successfully, false otherwise. | const char* GetData | ( | ) |
Get the contents of the TempFile as a c-style string.
| void ClearData | ( | ) |
Clear the data from the underlying file.
| bool IsOpen | ( | ) | const |
Check if a TempFile is currently open.
true if the file is open false otherwise.
|
static |
Create a TempFile.
The filename used will be of the form
<working_dir_s>/<id>.<suffix_s>.
| template_s | The template for the filename. The filename generated from this will depend upon the value of tenp_flag. |
| temp_flag | If this is true then template_s will be passed to tmpnam. If not, template_s will be used as is for the filename. |
| const char* GetFilename | ( | ) | const |
Get the filename being used by this TempFile.
| bool Open | ( | const char * | mode_s | ) |
Open the TempFile.
| mode_s | The mode string which is the same as the c standard library mode string used by fopen. |
true if the file was opened successfully, false otherwise. | int Close | ( | ) |
Close the TempFile.
| bool Print | ( | const char * | arg_s | ) |
Print a c-style string to the TempFile.
| arg_s | The strng to print. |
true if the string was printed successfully, false otherwise. | const char* GetData | ( | ) |
Get the contents of the TempFile as a c-style string.
| void ClearData | ( | ) |
Clear the data from the underlying file.
| bool IsOpen | ( | ) | const |
Check if a TempFile is currently open.
true if the file is open false otherwise. | char * GetTempFilenameBuffer | ( | const char *const | working_directory_s, |
| const char *const | prefix_s, | ||
| const char *const | temp_suffix_s | ||
| ) |
Create a buffer of the required length to be used by TempFile *GetTempFile (const char *template_s, const bool temp_flag).
The filename used will be of the form
<working_dir_s>/<id>.<suffix_s>.
| working_directory_s | The directory where the underlying file will be created. |
| prefix_s | The prefix of the filename. |
| temp_suffix_s | The suffix of the filename |
NULL upon error.