TECA
The Toolkit for Extreme Climate Analysis
teca_file_util.h File Reference
#include <vector>
#include <deque>
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <sys/stat.h>
Include dependency graph for teca_file_util.h:

Go to the source code of this file.

Classes

struct  teca_file_util::line_buffer
 

Namespaces

 teca_file_util
 Codes dealing with low level file system API's.
 

Macros

#define PATH_SEP   "/"
 

Functions

int teca_file_util::read_stream (const char *file_name, const char *header, teca_binary_stream &stream, bool verbose=true)
 
int teca_file_util::write_stream (const char *file_name, int flags, const char *header, const teca_binary_stream &stream, bool verbose=true)
 
void teca_file_util::replace_timestep (std::string &file_name, unsigned long time_step, int width=6)
 replace t% with the given value More...
 
int teca_file_util::replace_time (std::string &file_name, double t, const std::string &calendar, const std::string &units, const std::string &format)
 replace t% with the time t in calendar with units in the strftime format More...
 
void teca_file_util::replace_extension (std::string &file_name, const std::string &ext)
 replace e% with the given string More...
 
void teca_file_util::replace_identifier (std::string &file_name, const std::string &id)
 replace s% with the given string More...
 
void teca_file_util::to_lower (std::string &in)
 return string converted to lower case More...
 
int teca_file_util::file_exists (const char *path)
 return 0 if the file does not exist More...
 
int teca_file_util::file_writable (const char *path)
 return 0 if the file/directory is not writeable More...
 
std::string teca_file_util::path (const std::string &filename)
 
std::string teca_file_util::base_filename (const std::string &filename)
 
std::string teca_file_util::filename (const std::string &filename)
 
std::string teca_file_util::extension (const std::string &filename)
 Returns the extension from the given filename. More...
 
size_t teca_file_util::load_lines (const char *filename, std::vector< std::string > &lines)
 read the lines of the ascii file into a vector More...
 
size_t teca_file_util::load_text (const std::string &filename, std::string &text)
 read the file into a string More...
 
int teca_file_util::write_text (std::string &filename, std::string &text)
 write the string to the named file More...
 
int teca_file_util::search_and_replace (const std::string &search_for, const std::string &replace_with, std::string &in_text)
 Search and replace with in a string of text. More...
 
int teca_file_util::locate_files (const std::string &path, const std::string &re, std::vector< std::string > &file_list)
 Locate files in path that match a regular expression. More...
 
template<typename T >
size_t teca_file_util::load_bin (const char *filename, size_t dlen, T *buffer)
 Load a binary file into memory. More...
 
template<typename T >
int teca_file_util::name_value (std::vector< std::string > &lines, std::string name, T &value)
 extract a name-value pair from the given set of lines. More...
 
template<typename T >
size_t teca_file_util::parse_value (std::string &in, size_t at, std::string key, T &value)