#include <Params.h>
Public Types | |
typedef double | Size_t |
For file/item sizes and Score/Evaluate functions. | |
typedef long double | BigFloat |
typedef long long | BigInt |
typedef unsigned long long | UBigInt |
Public Member Functions | |
Params (int &argc, char **argv) | |
Params' constructor. | |
void | ShowVersion () const |
void | ShowUsage (const char *) const |
bool | Initialize () |
std::string | PrettySize (Size_t) const |
bool | GetSize (const std::string &, Size_t &) const |
double | DI_Factor () const |
Static Public Member Functions | |
static bool | StringToDouble (Size_t &d, const std::string &s) |
Public Attributes | |
int & | m_argc |
char ** | m_argv |
std::list< const char * > | m_cmdline_items |
Size_t | m_target |
Size_t | m_min_size |
Size_t | m_max_size |
unsigned | m_max_bins |
int | m_block_size |
bool | m_verbose |
bool | m_pipe |
bool | m_hide_items |
bool | m_hide_summary |
bool | m_show_size |
bool | m_show_bytes |
bool | m_direct_input |
bool | m_no_metric |
bool | m_sort_by_size |
bool | m_sort_reverse |
bool | m_no_case |
bool | m_null_data |
char | m_bins_separator |
char | m_enclose_chr |
bool | m_enclose |
char | m_delimit_chr |
unsigned | m_ga_pop_size |
int | m_ga_num_gens |
long | m_ga_seed |
int | m_ga_sel_pressure |
float | m_ga_cross_prob |
float | m_ga_mut_prob |
bool | m_theoretical |
unsigned | m_bins_theo |
bool | m_approximate |
bool | m_split |
Private Member Functions | |
double | KB (double power) const |
double | KB () const |
double | MB (double power) const |
double | MB () const |
double | GB (double power) const |
double | GB () const |
double | TB (double power) const |
double | TB () const |
Private Attributes | |
char | m_unit_symbol |
float | m_unit_power |
double | m_di_factor |
For file/item sizes and Score/Evaluate functions.
typedef long double Params::BigFloat |
big float datatype.
typedef long long Params::BigInt |
big signed int.
typedef unsigned long long Params::UBigInt |
big unsigned int. Must have at least off_t (from stat.h) bits.
Params::Params | ( | int & | argc, | |
char ** | argv | |||
) | [inline] |
Params' constructor.
void Params::ShowVersion | ( | ) | const |
Print gaffitter version and exit
Referenced by Initialize().
void Params::ShowUsage | ( | const char * | app = "gaffitter" |
) | const |
Show a brief help text and exit.
Referenced by Initialize().
bool Params::Initialize | ( | ) |
Set gaffitter options from user args.
References CmdLine::Parser::Bool, CmdLine::Parser::Char, CmdLine::Parser::Float, GB(), GetSize(), CmdLine::Parser::Int, KB(), m_approximate, m_argc, m_argv, m_bins_separator, m_bins_theo, m_block_size, m_cmdline_items, m_delimit_chr, m_di_factor, m_direct_input, m_enclose, m_enclose_chr, m_ga_cross_prob, m_ga_mut_prob, m_ga_num_gens, m_ga_pop_size, m_ga_seed, m_ga_sel_pressure, m_hide_items, m_hide_summary, m_max_bins, m_max_size, m_min_size, m_no_case, m_no_metric, m_null_data, m_pipe, m_show_bytes, m_show_size, m_sort_by_size, m_sort_reverse, m_split, m_target, m_theoretical, m_unit_power, m_unit_symbol, m_verbose, MB(), CmdLine::NO_VALUE, CmdLine::OUT_OF_RANGE, CmdLine::Parser::Process(), ShowUsage(), ShowVersion(), CmdLine::SILENT, CmdLine::Parser::String, and TB().
Referenced by main().
std::string Params::PrettySize | ( | Size_t | size | ) | const |
Print filesizes using Bytes, KiB, MiB or GiB units ("human" readable form); KB, MB or GB if '--si' option is set. Also, if Gaffitter is using direct input without units then PrettySize will just print the raw size (no suffixes).
If --show-bytes is set then PrettySize prints output sizes in bytes too (except for direct input without a metric).
References GB(), KB(), m_no_metric, m_show_bytes, m_unit_symbol, MB(), and TB().
Referenced by Optimizer::Output(), and Optimizer::Write().
double Params::KB | ( | double | power | ) | const [inline, private] |
double Params::KB | ( | ) | const [inline, private] |
double Params::MB | ( | double | power | ) | const [inline, private] |
double Params::MB | ( | ) | const [inline, private] |
double Params::GB | ( | double | power | ) | const [inline, private] |
double Params::GB | ( | ) | const [inline, private] |
double Params::TB | ( | double | power | ) | const [inline, private] |
double Params::TB | ( | ) | const [inline, private] |
static bool Params::StringToDouble | ( | Size_t & | d, | |
const std::string & | s | |||
) | [inline, static] |
bool Params::GetSize | ( | const std::string & | size_unit, | |
Params::Size_t & | value | |||
) | const |
Get the correct size for target, min and max values. This function already applies the correct factor.
References GB(), KB(), MB(), StringToDouble(), and TB().
Referenced by Initialize().
double Params::DI_Factor | ( | ) | const [inline] |
References m_di_factor.
int& Params::m_argc |
Referenced by Initialize().
char** Params::m_argv |
Referenced by Initialize().
std::list<const char*> Params::m_cmdline_items |
A list of pointers to characters ("list of strings"). This list holds the arguments that could not be identified from the command-line (argv). Its values are probably files or item names.
Referenced by Initialize(), Input::LoadFiles(), and Input::ReadInput().
target in bytes (or just a number if "no metric").
Referenced by Split::Evolve(), BestFit::Evolve(), Initialize(), Optimizer::Optimizer(), and Optimizer::Write().
Referenced by Initialize().
min and max size for the input files/items.
Referenced by Initialize().
unsigned Params::m_max_bins |
max number of desired bins (volumes). After the process finishes, the m_max_bins better filled bins are printed.
Referenced by Initialize(), and Optimizer::Output().
the smallest amount of bytes a file can occupy.
Referenced by Initialize(), and Input::Input().
bool Params::m_verbose |
switch to verbose mode.
Referenced by GeneticAlgorithm::Evaluate(), Split::Evolve(), GeneticAlgorithm::Evolve(), BestFit::Evolve(), Initialize(), Input::Initialize(), Optimizer::Optimizer(), and Optimizer::Output().
bool Params::m_pipe |
accept input from pipe.
Referenced by Initialize(), Input::LoadFiles(), and Input::ReadInput().
bool Params::m_hide_items |
don't print the selected items.
Referenced by Initialize(), and Optimizer::Output().
don't print footer summary.
Referenced by Initialize(), and Optimizer::Output().
bool Params::m_show_size |
print file size.
Referenced by Initialize(), and Optimizer::Output().
bool Params::m_show_bytes |
also print size in bytes.
Referenced by Initialize(), and PrettySize().
accept "by hand" input (files not required).
Referenced by Initialize(), and Input::Initialize().
bool Params::m_no_metric |
direct input does not require a metric (KB, MB...).
Referenced by Initialize(), and PrettySize().
sort output by size instead of by name.
Referenced by Initialize(), and Optimizer::Output().
reverse order while sorting.
Referenced by Initialize(), and Optimizer::Output().
bool Params::m_no_case |
ignore case distinctions when sorting.
Referenced by Initialize(), and Optimizer::Output().
bool Params::m_null_data |
assumes NULL (\0) as the delimiter of input files
Referenced by Initialize(), Input::LoadFiles(), and Input::ReadInput().
char to separate the bins (default = newline)
Referenced by Initialize(), and Optimizer::Output().
char to enclose the filenames (default = none)
Referenced by Initialize(), and Optimizer::Output().
bool Params::m_enclose |
don't print anything if "--ew" was not used
Referenced by Initialize(), and Optimizer::Output().
char to delimit lines (default = newline)
Referenced by Initialize(), and Optimizer::Output().
unsigned Params::m_ga_pop_size |
Population size
Referenced by GeneticAlgorithm::Crossover(), GeneticAlgorithm::GeneticAlgorithm(), Initialize(), and GeneticAlgorithm::InitPopulation().
Number of generations
Referenced by GeneticAlgorithm::Evolve(), GeneticAlgorithm::GeneticAlgorithm(), and Initialize().
long Params::m_ga_seed |
GA seed
Referenced by GeneticAlgorithm::GeneticAlgorithm(), and Initialize().
Selection pressure
Referenced by GeneticAlgorithm::GeneticAlgorithm(), and Initialize().
float Params::m_ga_cross_prob |
Crossover probability
Referenced by GeneticAlgorithm::Generation(), and Initialize().
float Params::m_ga_mut_prob |
Mutation probability
Referenced by GeneticAlgorithm::Generation(), and Initialize().
stop if the theoretical minimum number of bins is reached
Referenced by GeneticAlgorithm::Evaluate(), and Initialize().
unsigned Params::m_bins_theo |
holds the theoretical minimum number of bins (can be entered by the user). It differs from m_max_bins in the sense that if m_bins_theo is reached, then the process stops immediately and does not try to optimize (fill better) the bins.
Referenced by GeneticAlgorithm::Evaluate(), Initialize(), Optimizer::Optimizer(), and Optimizer::Write().
Local approximation using Best First search (non-optimal but very fast).
Referenced by Initialize(), and main().
bool Params::m_split |
Split "Search" (very fast, but just split sequentially the input according to target.
Referenced by Initialize(), main(), and Optimizer::Output().
char Params::m_unit_symbol [private] |
XiB ou XB (if SI), where X is K, M or G.
Referenced by Initialize(), and PrettySize().
float Params::m_unit_power [private] |
power equal 1000 if --si is set; 1024 otherwise.
Referenced by GB(), Initialize(), KB(), MB(), and TB().
double Params::m_di_factor [private] |
Factor to convert in bytes a size in KB, MB or GB. (for direct input).
Referenced by DI_Factor(), and Initialize().