37 template <
typename options_type>
38 bool bool_option(
const options_type& options,
const char* name,
const bool val)
40 return ( (options.find( std::string(name) ) != options.end()) ?
41 atoi( options.find(std::string(name))->second.c_str() ) :
45 template <
typename options_type>
46 bool bool_option(
const options_type& options,
const char* name1,
const char* name2,
const bool val)
49 (options.find( std::string(name1) ) != options.end()) ?
50 atoi( options.find(std::string(name1))->second.c_str() ) :
51 (options.find( std::string(name2) ) != options.end()) ?
52 atoi( options.find(std::string(name2))->second.c_str() ) :
56 template <
typename options_type>
59 return (options.find( std::string(name) ) != options.end()) ?
60 atoi( options.find(std::string(name))->second.c_str() ) :
64 template <
typename options_type>
68 (options.find( std::string(name1) ) != options.end()) ?
69 atoi( options.find(std::string(name1))->second.c_str() ) :
70 (options.find( std::string(name2) ) != options.end()) ?
71 atoi( options.find(std::string(name2))->second.c_str() ) :
75 template <
typename options_type>
78 return (options.find( std::string(name) ) != options.end()) ?
79 atoi( options.find(std::string(name))->second.c_str() ) :
83 template <
typename options_type>
87 (options.find( std::string(name1) ) != options.end()) ?
88 atoi( options.find(std::string(name1))->second.c_str() ) :
89 (options.find( std::string(name2) ) != options.end()) ?
90 atoi( options.find(std::string(name2))->second.c_str() ) :
94 template <
typename options_type>
97 return (options.find( std::string(name) ) != options.end()) ?
98 atoi( options.find(std::string(name))->second.c_str() ) :
102 template <
typename options_type>
106 (options.find( std::string(name1) ) != options.end()) ?
107 atoi( options.find(std::string(name1))->second.c_str() ) :
108 (options.find( std::string(name2) ) != options.end()) ?
109 atoi( options.find(std::string(name2))->second.c_str() ) :
113 template <
typename options_type>
114 float float_option(
const options_type& options,
const char* name,
const float val)
116 return (options.find( std::string(name) ) != options.end()) ?
117 (
float)atof( options.find(std::string(name))->second.c_str() ) :
121 template <
typename options_type>
122 float float_option(
const options_type& options,
const char* name1,
const char* name2,
const uint32 val)
125 (options.find( std::string(name1) ) != options.end()) ?
126 atof( options.find(std::string(name1))->second.c_str() ) :
127 (options.find( std::string(name2) ) != options.end()) ?
128 atof( options.find(std::string(name2))->second.c_str() ) :
132 template <
typename options_type>
133 std::string
string_option(
const options_type& options,
const char* name,
const char* val)
135 return (options.find( std::string(name) ) != options.end()) ?
136 options.find(std::string(name))->second :
140 template <
typename options_type>
141 std::string
string_option(
const options_type& options,
const char* name1,
const char* name2,
const char* val)
144 (options.find( std::string(name1) ) != options.end()) ?
145 options.find(std::string(name1))->second :
146 (options.find( std::string(name2) ) != options.end()) ?
147 options.find(std::string(name2))->second :
151 template <
typename options_type>
152 int2
int2_option(
const options_type& options,
const char* name,
const int2 val)
154 if (options.find( std::string(name) ) != options.end())
156 const std::string str = options.find(std::string(name))->second;
157 const size_t c = str.find(
',');
158 if (c == std::string::npos)
160 log_warning( stderr,
"int2_option() : parsing error, missing comma\n" );
163 const std::string num1 = str.substr( 0, c );
164 const std::string num2 = str.substr( c + 1, str.size() );
165 return make_int2( atoi( num1.c_str() ), atoi( num2.c_str() ) );