Params Class Reference

This class gets and processes parameters (general and GA-related) specified by the user. More...

#include <Params.h>

Collaboration diagram for Params:

Collaboration graph
[legend]

List of all members.

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


Detailed Description

This class gets and processes parameters (general and GA-related) specified by the user.

Member Typedef Documentation

For file/item sizes and Score/Evaluate functions.

  • double can hold usually a max integer of 2^53 = 8192TiB
  • long double can hold usually a max integer of 2^64 = 16777216TiB :)
  • long int = 2^32 = 4GiB :(
  • long long int = 2^64 = 16777216TiB :), but isn't ANSI C++ :(

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.


Constructor & Destructor Documentation

Params::Params ( int &  argc,
char **  argv 
) [inline]

Params' constructor.


Member Function Documentation

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 (  ) 

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]

References m_unit_power.

Referenced by GetSize(), Initialize(), and PrettySize().

double Params::MB ( double  power  )  const [inline, private]

double Params::MB (  )  const [inline, private]

References m_unit_power.

Referenced by GetSize(), Initialize(), and PrettySize().

double Params::GB ( double  power  )  const [inline, private]

double Params::GB (  )  const [inline, private]

References m_unit_power.

Referenced by GetSize(), Initialize(), and PrettySize().

double Params::TB ( double  power  )  const [inline, private]

double Params::TB (  )  const [inline, private]

References m_unit_power.

Referenced by GetSize(), Initialize(), and PrettySize().

static bool Params::StringToDouble ( Size_t d,
const std::string &  s 
) [inline, static]

Converts a given string to Size_t, checking for errors.

Referenced by GetSize().

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.


Member Data Documentation

Referenced by Initialize().

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().

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().

accept input from pipe.

Referenced by Initialize(), Input::LoadFiles(), and Input::ReadInput().

don't print the selected items.

Referenced by Initialize(), and Optimizer::Output().

don't print footer summary.

Referenced by Initialize(), and Optimizer::Output().

print file size.

Referenced by Initialize(), and Optimizer::Output().

also print size in bytes.

Referenced by Initialize(), and PrettySize().

accept "by hand" input (files not required).

Referenced by Initialize(), and Input::Initialize().

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().

ignore case distinctions when sorting.

Referenced by Initialize(), and Optimizer::Output().

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().

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().

Selection pressure

Referenced by GeneticAlgorithm::GeneticAlgorithm(), and Initialize().

Crossover probability

Referenced by GeneticAlgorithm::Generation(), and Initialize().

Mutation probability

Referenced by GeneticAlgorithm::Generation(), and Initialize().

stop if the theoretical minimum number of bins is reached

Referenced by GeneticAlgorithm::Evaluate(), and Initialize().

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().

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().


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