8 #ifndef SCARAB_PARAM_VALUE_HH_ 9 #define SCARAB_PARAM_VALUE_HH_ 45 virtual param* clone()
const;
49 virtual bool is_null()
const;
50 virtual bool is_value()
const;
52 virtual bool has_subset(
const param& a_subset )
const;
54 std::string
type()
const;
58 bool is_double()
const;
59 bool is_string()
const;
62 uint64_t as_uint()
const;
63 int64_t as_int()
const;
64 double as_double()
const;
65 const std::string& as_string()
const;
68 template<
typename XValType >
71 void set(
bool a_value );
72 void set( uint8_t a_value );
73 void set( uint16_t a_value );
74 void set( uint32_t a_value );
75 void set( uint64_t a_value );
76 void set( int8_t a_value );
77 void set( int16_t a_value );
78 void set( int32_t a_value );
79 void set( int64_t a_value );
80 void set(
float a_value );
81 void set(
double a_value );
82 void set(
const std::string& a_value );
83 void set(
const char* a_value );
120 inline bool param_value::get< bool >()
const 126 inline uint64_t param_value::get< uint64_t >()
const 132 inline int64_t param_value::get< int64_t >()
const 138 inline double param_value::get< double >()
const 155 template<
typename XValType >
158 if( f_value_type == k_bool )
return static_cast< XValType
>( as_bool() );
159 else if( f_value_type == k_uint )
return static_cast< XValType
>( as_uint() );
160 else if( f_value_type == k_int )
return static_cast< XValType
>( as_int() );
161 else if( f_value_type == k_double )
return static_cast< XValType
>( as_double() );
162 else if( f_value_type == k_string )
164 std::stringstream t_conv;
165 t_conv << *f_value.f_string;
192 return f_value_type == k_bool;
197 return f_value_type == k_uint;
202 return f_value_type == k_int;
207 return f_value_type == k_double;
212 return f_value_type == k_string;
217 if( f_value_type == k_string )
delete f_value.f_string;
218 f_value_type = k_bool;
219 f_value.f_bool = a_value;
225 if( f_value_type == k_string )
delete f_value.f_string;
226 f_value_type = k_uint;
227 f_value.f_uint = a_value;
233 if( f_value_type == k_string )
delete f_value.f_string;
234 f_value_type = k_uint;
235 f_value.f_uint = a_value;
241 if( f_value_type == k_string )
delete f_value.f_string;
242 f_value_type = k_uint;
243 f_value.f_uint = a_value;
249 if( f_value_type == k_string )
delete f_value.f_string;
250 f_value_type = k_uint;
251 f_value.f_uint = a_value;
257 if( f_value_type == k_string )
delete f_value.f_string;
258 f_value_type = k_int;
259 f_value.f_int = a_value;
265 if( f_value_type == k_string )
delete f_value.f_string;
266 f_value_type = k_int;
267 f_value.f_int = a_value;
273 if( f_value_type == k_string )
delete f_value.f_string;
274 f_value_type = k_int;
275 f_value.f_int = a_value;
281 if( f_value_type == k_string )
delete f_value.f_string;
282 f_value_type = k_int;
283 f_value.f_int = a_value;
289 if( f_value_type == k_string )
delete f_value.f_string;
290 f_value_type = k_double;
291 f_value.f_double = a_value;
297 if( f_value_type == k_string )
delete f_value.f_string;
298 f_value_type = k_double;
299 f_value.f_double = a_value;
305 if( f_value_type == k_string )
delete f_value.f_string;
306 f_value_type = k_string;
307 f_value.f_string =
new std::string( a_value );
313 if( f_value_type == k_string )
delete f_value.f_string;
314 f_value_type = k_string;
315 f_value.f_string =
new std::string( a_value );
virtual std::string to_string() const
std::string type(const x_type &a_param)
virtual bool is_value() const
std::string param_value::get< std::string >() const
SCARAB_API std::ostream & operator<<(std::ostream &out, const param_array &a_value)
scarab::path param_value::get< scarab::path >() const
virtual bool is_null() const
std::string to_string(std::uint64_t x)
virtual param * clone() const