#ifndef __STRING_OPERATIONS__
#define __STRING_OPERATIONS__

#include <string>

/** Collection of usefull utilities.
 *
 * A number of utilities, usefull for debugging, mathematics and other areas.
 */
namespace Utilities {

    /** String to boolean.
     *
     * We interpret a string as a boolean by the following
     * True : "1", "true", "True", "TRUE"
     * False: "0", "false", "False", "FALSE"
     */
    bool stob(const std::string &input);
    /** Error handling.
     *
     * Print the given message to stderr with a reference to where the error
     * occurred.
     *
     * @remark MPI Safe
     *
     * @param filename often should be "__FILE__".
     * @param line_number often should be "__LINE__".
     * @param message that should be printed to stderr.
     */
    void error(const std::string &filename, const int &line_number,
               const std::string &message);
    /** Warning function.
     *
     * Print the given message to stdout with a reference to where the warning
     * arose.
     *
     * @remark MPI Safe
     *
     * @param filename often should be "__FILE__".
     * @param line_number often should be "__LINE__".
     * @param message that should be printed to stdout.
     */
    void warning(const std::string &filename, const int &line_number,
                 const std::string &message);
    /** Debug information.
     *
     * This function will print a debug message to stdout. The toggle can be
     * used to supress the output if it is not wanted at all times.
     *
     * @remark MPI Safe
     *
     * @param message that should be printed to stdout.
     * @param toggle if text should be printed
     */
    void debug_info(const std::string &message, const bool &toggle = true);
    /** Debug information.
     *
     * This function will print a debug message to stdout with information on
     * where it is called from. The toggle can be used to supress the output if
     * it is not wanted at all times.
     *
     * @remark MPI Safe
     *
     * @param filename often should be "__FILE__".
     * @param line_number often should be "__LINE__".
     * @param message that should be printed to stdout.
     * @param toggle if text should be printed
     */
    void debug_info(const std::string &filename, const int &line_number,
                    const std::string &message, const bool &toggle = true);
    /** Ensure directory is valid.
     *
     * Check if a directory is valid.
     *
     * @remark MPI Safe
     *
     * @param foldername that should be created if it does not exist.
     */
    void valid_directory(const std::string &foldername);

} // namespace Utilities

#endif /* __STRING_OPERATIONS__ */