A toolkit for working with phylogenetic data.
v0.18.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Options Class Reference

#include <genesis/utils/core/options.hpp>

Detailed Description

Simple Options class for application-wide configuration and settings.

Definition at line 48 of file options.hpp.

Public Member Functions

bool allow_file_overwriting () const
 Get whether Genesis is allowed to overwrite files when outputting data. More...
 
void allow_file_overwriting (bool value)
 Set whether Genesis is allowed to overwrite files when outputting data. More...
 
std::vector< std::string > command_line () const
 Returns an array of strings containing the program's command line arguments. More...
 
void command_line (int const argc, char const *const *argv)
 Set arguments to the program's command line options. More...
 
std::string command_line_string () const
 Returns a string containing the program's command line arguments. More...
 
std::string info () const
 Return a list with compile time and run time options with their values. More...
 
unsigned int number_of_threads () const
 Returns the number of threads. More...
 
void number_of_threads (const unsigned int number)
 Overwrite the system given number of threads. More...
 
std::default_random_engine & random_engine ()
 Returns the default engine for random number generation. More...
 
unsigned random_seed () const
 Returns the random seed that was used to initialize the engine. More...
 
void random_seed (const unsigned seed)
 Set a specific seed for the random engine. More...
 
bool stderr_is_terminal () const
 Return true iff the standard error stream is a terminal, and false if not, i.e., if it is a file or a pipe. More...
 
bool stdin_is_terminal () const
 Return true iff the standard input stream is a terminal, and false if not, i.e., if it is a file or a pipe. More...
 
bool stdout_is_terminal () const
 Return true iff the standard output stream is a terminal, and false if not, i.e., if it is a file or a pipe. More...
 
bool using_openmp () const
 Return whether the binary was compiled using OpenMP. More...
 
bool using_pthreads () const
 Return whether the binary was compiled using Pthreads. More...
 

Static Public Member Functions

static std::string build_type ()
 Return the build type that was used to compile the binary, i.e., "debug" or "release". More...
 
static std::string compiler_family ()
 Return the compiler family (name) that was used to compile genesis. More...
 
static std::string compiler_version ()
 Return the compiler version that was used to compile genesis. More...
 
static std::string cpp_version ()
 Return the CPP version that was used to compile genesis. More...
 
static Optionsget ()
 Returns a single instance of this class. More...
 
static bool is_big_endian ()
 Return whether the system uses big endian memory. More...
 
static bool is_debug ()
 Return whether the binary was compiled with build type DEBUG. More...
 
static bool is_little_endian ()
 Return whether the system uses little endian memory. More...
 
static bool is_release ()
 Return whether the binary was compiled with build type RELEASE. More...
 
static std::string platform ()
 Return the platform under which genesis was compiled. More...
 

Member Function Documentation

bool allow_file_overwriting ( ) const
inline

Get whether Genesis is allowed to overwrite files when outputting data.

See allow_file_overwriting( bool ) for details.

Definition at line 165 of file options.hpp.

void allow_file_overwriting ( bool  value)
inline

Set whether Genesis is allowed to overwrite files when outputting data.

The option is false by default, which causes Genesis to throw an execption when it attempts to write to a file that is already existing.

By setting this option to true, files are silently overwritten in case they already exist. This has to be activated explicitly in order to avoid losing files by accident.

See Also
file_output_stream()

Definition at line 181 of file options.hpp.

std::string build_type ( )
static

Return the build type that was used to compile the binary, i.e., "debug" or "release".

Definition at line 297 of file options.cpp.

std::vector<std::string> command_line ( ) const
inline

Returns an array of strings containing the program's command line arguments.

Definition at line 72 of file options.hpp.

void command_line ( int const  argc,
char const *const *  argv 
)

Set arguments to the program's command line options.

If the program is run from the command line, this method has to be used to properly propagate the command line options to this options class.

Definition at line 99 of file options.cpp.

std::string command_line_string ( ) const

Returns a string containing the program's command line arguments.

Definition at line 89 of file options.cpp.

std::string compiler_family ( )
static

Return the compiler family (name) that was used to compile genesis.

See compiler_version() to get the version of the compiler.

Definition at line 217 of file options.cpp.

std::string compiler_version ( )
static

Return the compiler version that was used to compile genesis.

See compiler_family() to get the corresponding compiler name.

Definition at line 240 of file options.cpp.

std::string cpp_version ( )
static

Return the CPP version that was used to compile genesis.

Definition at line 266 of file options.cpp.

static Options& get ( )
inlinestatic

Returns a single instance of this class.

Definition at line 59 of file options.hpp.

std::string info ( ) const

Return a list with compile time and run time options with their values.

Definition at line 312 of file options.cpp.

bool is_big_endian ( )
static

Return whether the system uses big endian memory.

Definition at line 194 of file options.cpp.

bool is_debug ( )
static

Return whether the binary was compiled with build type DEBUG.

Definition at line 279 of file options.cpp.

bool is_little_endian ( )
static

Return whether the system uses little endian memory.

Definition at line 188 of file options.cpp.

bool is_release ( )
static

Return whether the binary was compiled with build type RELEASE.

Definition at line 288 of file options.cpp.

unsigned int number_of_threads ( ) const
inline

Returns the number of threads.

Definition at line 97 of file options.hpp.

void number_of_threads ( const unsigned int  number)

Overwrite the system given number of threads.

On startup, the value is initialized with the actual number of cores available in the system using std::thread::hardware_concurrency(). This method overwrites this value.

Definition at line 112 of file options.cpp.

std::string platform ( )
static

Return the platform under which genesis was compiled.

This can be either "Win32", "Linux", "Apple", "Unix" or "Unknown".

Definition at line 200 of file options.cpp.

std::default_random_engine& random_engine ( )
inline

Returns the default engine for random number generation.

Caveat: This is not intended for the use in more than one thread. As the order of execution in threads is not deterministic, results would not be reproducible, even when using a fixed seed. Furthermore, it might be a speed bottleneck to add a mutex to this method.

If in the future there is need for multi-threaded random engines, they needed to be outfitted with separate seeds each (otherwise they would all produce the same results). Thus, for now we simply assume single-threaded use.

Definition at line 151 of file options.hpp.

unsigned random_seed ( ) const
inline

Returns the random seed that was used to initialize the engine.

Definition at line 127 of file options.hpp.

void random_seed ( const unsigned  seed)

Set a specific seed for the random engine.

On startup, the random engine is initialized using the current system time. This value can be overwritten using this method.

Definition at line 146 of file options.cpp.

bool stderr_is_terminal ( ) const

Return true iff the standard error stream is a terminal, and false if not, i.e., if it is a file or a pipe.

Definition at line 175 of file options.cpp.

bool stdin_is_terminal ( ) const

Return true iff the standard input stream is a terminal, and false if not, i.e., if it is a file or a pipe.

Definition at line 156 of file options.cpp.

bool stdout_is_terminal ( ) const

Return true iff the standard output stream is a terminal, and false if not, i.e., if it is a file or a pipe.

Definition at line 166 of file options.cpp.

bool using_openmp ( ) const

Return whether the binary was compiled using OpenMP.

Definition at line 133 of file options.cpp.

bool using_pthreads ( ) const

Return whether the binary was compiled using Pthreads.

Definition at line 124 of file options.cpp.


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