 |
Shiokaze Framework
A research-oriented fluid solver for computer graphics
|
|
Go to the documentation of this file.
25 #ifndef SHKZ_CONFIGURATION_H
26 #define SHKZ_CONFIGURATION_H
52 configuration( std::map<std::string,std::string> dictionary );
92 bool check_set ( std::string name )
const;
97 static void print_bar( std::string str=
"" );
128 std::string argument_name=
"",
129 std::string author=
"",
130 std::string address=
"",
131 std::tuple<int,int,int> date=std::tuple<int,int,int>(0,0,0),
134 config.
push_group(name,argument_name,author,address,date,version);
196 std::string argument_name=
"",
197 std::string author=
"",
198 std::string address=
"",
199 std::tuple<int,int,int> date=std::tuple<int,int,int>(0,0,0),
200 double version=0.0 );
216 bool get_integer( std::string name,
int &value, std::string description=std::string() );
245 bool get_unsigned( std::string name,
unsigned &value, std::string description=std::string() );
274 bool get_bool( std::string name,
bool &value, std::string description=std::string() );
283 void set_bool( std::string name,
bool value );
303 double get_double( std::string name,
double &value, std::string description=std::string() );
312 void set_double( std::string name,
double value );
332 bool get_real( std::string name,
Real &value, std::string description=std::string() );
361 bool get_vec2i( std::string name,
int value[2], std::string description=std::string() );
370 void set_vec2i( std::string name,
const int value[2] );
390 bool get_vec2d( std::string name,
double value[2], std::string description=std::string() );
399 void set_vec2d( std::string name,
const double value[2] );
419 bool get_vec3i( std::string name,
int value[3], std::string description=std::string() );
428 void set_vec3i( std::string name,
const int value[3] );
448 bool get_vec3d( std::string name,
double value[3], std::string description=std::string());
457 void set_vec3d( std::string name,
const double value[3] );
477 bool get_vec4d( std::string name,
double value[4], std::string description=std::string());
486 void set_vec4d( std::string name,
const double value[4] );
506 bool get_string( std::string name, std::string &value, std::string description=std::string() );
515 void set_string( std::string name, std::string value );
533 bool exist( std::string name )
const;
540 const std::map<std::string,std::string> &
get_dictionary()
const {
return m_dictionary; }
544 struct double2 {
double v[2]; };
545 struct double3 {
double v[3]; };
546 struct double4 {
double v[4]; };
547 struct int2 {
int v[2]; };
548 struct int3 {
int v[3]; };
550 std::map<std::string,int> default_integer;
551 std::map<std::string,unsigned> default_unsigned;
552 std::map<std::string,bool> default_bool;
553 std::map<std::string,double> default_double;
554 std::map<std::string,Real> default_real;
555 std::map<std::string,double2> default_vec2d;
556 std::map<std::string,double3> default_vec3d;
557 std::map<std::string,double4> default_vec4d;
558 std::map<std::string,int2> default_vec2i;
559 std::map<std::string,int3> default_vec3i;
560 std::map<std::string,std::string> default_string;
566 std::string description;
572 std::tuple<int,int,int> date;
574 std::map<std::string,Entry> entries;
579 std::string argument_name;
581 bool operator<(
const Title &a )
const {
return id < a.id; }
584 void register_variables ( std::string name,
bool is_default, std::string type, std::string value, std::string description );
586 void print_credit(
const Group &group )
const;
587 void print_groupbar(
const Title &group_title,
const Group &group )
const;
588 std::string concated_name( std::string name )
const;
590 std::map<std::string,std::string> m_dictionary;
591 std::map<Title,Group> m_groups;
592 std::stack<Title> m_group_stack;
593 unsigned m_label_index;
double get_double(std::string name, double &value, std::string description=std::string())
Get the parameter of double type.
void print_help() const
Print a help manual of the currently set parameters.
bool get_real(std::string name, Real &value, std::string description=std::string())
Get the parameter of Real type.
static void print_center(std::string str)
Print the input message at the center of the line.
void set_default_vec3i(std::string name, const int value[3])
Set default parameter of vec3i type.
void set_default_unsigned(std::string name, unsigned value)
Set default unsgined integer parameter.
void set_unsigned(std::string name, unsigned value)
Set the unsigned integer parameter.
void push_group(const credit &info)
Push the group to the top of the group stack.
~auto_group()
Destructor for auto_group.
Definition: configuration.h:151
void set_default_vec3d(std::string name, const double value[3])
Set default parameter of vec3d type.
bool get_integer(std::string name, int &value, std::string description=std::string())
Get the integer parameter.
void set_real(std::string name, Real value)
Set the parameter of Real type.
bool get_vec4d(std::string name, double value[4], std::string description=std::string())
Get the parameter of vec4d type.
void print_variables() const
Print the currently set parameters.
bool is_parameter_set(std::string name) const
Check if a parameter with the name is set via command line.
void set_bool(std::string name, bool value)
Set the boolean parameter.
void set_default_bool(std::string name, bool value)
Set default boolean parameter.
bool exist(std::string name) const
Get if the parameter of the input name exists.
void set_vec4d(std::string name, const double value[4])
Set the parameter of vec4d type.
static void print_bar(std::string str="")
Print the input message surrounded by --—.
void set_default_real(std::string name, Real value)
Set default parameter of Real type.
#define SHKZ_BEGIN_NAMESPACE
Name space beggining definition for shiokaze.
Definition: common.h:39
void set_integer(std::string name, int value)
Set the integer parameter.
void set_default_vec2d(std::string name, const double value[2])
Set default parameter of vec2d type.
auto_group(configuration &config, std::string name, std::string argument_name="", std::string author="", std::string address="", std::tuple< int, int, int > date=std::tuple< int, int, int >(0, 0, 0), double version=0.0)
Constructor for auto_group.
Definition: configuration.h:126
void set_default_vec4d(std::string name, const double value[4])
Set default parameter of vec4d type.
void print_splash() const
Print splash greeting messsages.
bool get_unsigned(std::string name, unsigned &value, std::string description=std::string())
Get the unsigned integer parameter.
bool get_string(std::string name, std::string &value, std::string description=std::string())
Get the string parameter.
void set_vec3i(std::string name, const int value[3])
Set the parameter of vec3i type.
bool get_bool(std::string name, bool &value, std::string description=std::string())
Get the boolean parameter.
void set_vec3d(std::string name, const double value[3])
Set the parameter of vec3d type.
float Real
Precision of the general floating point number. You may change here to double to increase the precisi...
Definition: config.h:34
bool get_vec3d(std::string name, double value[3], std::string description=std::string())
Get the parameter of vec3d type.
void set_default_string(std::string name, std::string value)
Set default string parameter.
bool get_vec2d(std::string name, double value[2], std::string description=std::string())
Get the parameter of vec2d type.
void set_default_vec2i(std::string name, const int value[2])
Set default parameter of vec2i type.
configuration()
Default constructor for configuration.
std::string get_current_group_name(bool argument_name=false) const
Get the name of the currently focused group (or argument name).
void set_vec2d(std::string name, const double value[2])
Set the parameter of vec2d type.
void set_default_double(std::string name, double value)
Set default parameter of double type.
Class that automates the push and pop groups.
Definition: configuration.h:107
void set_double(std::string name, double value)
Set the parameter of double type.
bool get_vec3i(std::string name, int value[3], std::string description=std::string())
Get the parameter of vec3i type.
void check_touched() const
Check if all the parameters are loaded by the program.
Class that defines the name, argument name, author's name, email address, date and the version of the...
Definition: credit.h:47
bool check_set(std::string name) const
Check if a parameter with the name is set.
Class that controls the settings of the program.
Definition: configuration.h:39
void pop_group()
Remove the current group from the gruop stack.
#define SHKZ_END_NAMESPACE
Name space end definition for shiokaze.
Definition: common.h:44
bool stack_empty() const
Get if the group stack is empty.
Definition: configuration.h:170
void set_vec2i(std::string name, const int value[2])
Set the parameter of vec2i type.
void set_default_integer(std::string name, int value)
Set default integer parameter.
void set_string(std::string name, std::string value)
Set string parameter.
auto_group(configuration &config, const credit &info)
Constructor for auto_group.
Definition: configuration.h:144
bool get_vec2i(std::string name, int value[2], std::string description=std::string())
Get the parameter of vec2i type.
const std::map< std::string, std::string > & get_dictionary() const
Get the dictionary of parameter.
Definition: configuration.h:540