ampsci
High-precision calculations for one- and two-valence atomic systems
IO Namespace Reference

Detailed Description

In-out (timers, profilers, and read/write data)

Namespaces

namespace  FRW
 File read/write utilities: text parsing and binary I/O.
 

Classes

class  ChronoTimer
 Class that uses std::chrono to easily time code. More...
 
class  InputBlock
 Holds a named list of key=value options and nested InputBlocks. More...
 
struct  IsArray
 Compile-time trait: IsArray<T>::v is true if T is std::array. IsArray<T>::t is the element type; IsArray<T>::size is the extent. More...
 
struct  IsVector
 Compile-time trait: IsVector<T>::v is true if T is std::vector. IsVector<T>::t is the element type. More...
 
struct  Option
 Simple struct; holds key-value pair, both strings. == compares key. More...
 

Functions

void unkown_option (std::string_view test_string, const std::vector< std::string > &list)
 Prints unkown option warning, with suggested alternative.
 
std::string removeSpaces (std::string str)
 Removes all white space (space, tab, newline), except for those in quotes.
 
std::string removeQuoteMarks (std::string str)
 Removes all quote marks.
 
void removeBlockComments (std::string &input)
 Removes all c++ style block comments from a string.
 
std::string removeComments (const std::string &input)
 Removes all c++ style comments from a string (block and line)
 
std::string expandIncludes (std::string input)
 Expands "#include" files.
 
template<typename T >
parse_str_to_T (const std::string &value_as_str)
 Parses a string to type T by stringstream.
 
std::string file_to_string (const std::istream &file)
 Parses entire file into string. Note: v. inefficient.
 
void print_line (const char c=' *', const int num=80)
 Prints a line of 'c' characters (dflt '*'), num chars long (dflt 80) to cout.
 
std::string time_date ()
 Returns current local date and time as a string, e.g. "2026-05-14 13:01:02".
 
std::string date ()
 Returns current local date as a string, e.g. "2026-05-14".
 
std::string time ()
 Returns current local time as a string, e.g. "13:01:02".
 
bool operator== (InputBlock block, std::string_view name)
 
bool operator== (std::string_view name, InputBlock block)
 
bool operator!= (InputBlock block, std::string_view name)
 
bool operator!= (std::string_view name, InputBlock block)
 

Function Documentation

◆ unkown_option()

void IO::unkown_option ( std::string_view  test_string,
const std::vector< std::string > &  list 
)
inline

Prints unkown option warning, with suggested alternative.

◆ removeSpaces()

std::string IO::removeSpaces ( std::string  str)
inline

Removes all white space (space, tab, newline), except for those in quotes.

◆ removeQuoteMarks()

std::string IO::removeQuoteMarks ( std::string  str)
inline

Removes all quote marks.

◆ removeBlockComments()

void IO::removeBlockComments ( std::string &  input)
inline

Removes all c++ style block comments from a string.

◆ removeComments()

std::string IO::removeComments ( const std::string &  input)
inline

Removes all c++ style comments from a string (block and line)

◆ expandIncludes()

std::string IO::expandIncludes ( std::string  input)
inline

Expands "#include" files.

◆ parse_str_to_T()

template<typename T >
T IO::parse_str_to_T ( const std::string &  value_as_str)
inline

Parses a string to type T by stringstream.

◆ file_to_string()

std::string IO::file_to_string ( const std::istream &  file)
inline

Parses entire file into string. Note: v. inefficient.

◆ print_line()

void IO::print_line ( const char  c = '*',
const int  num = 80 
)
inline

Prints a line of 'c' characters (dflt '*'), num chars long (dflt 80) to cout.

◆ time_date()

std::string IO::time_date ( )
inline

Returns current local date and time as a string, e.g. "2026-05-14 13:01:02".

◆ date()

std::string IO::date ( )
inline

Returns current local date as a string, e.g. "2026-05-14".

◆ time()

std::string IO::time ( )
inline

Returns current local time as a string, e.g. "13:01:02".