Scarab  v2.4.6
Project 8 C++ Utility Library
param_value.cc
Go to the documentation of this file.
1 /*
2  * param_value.cc
3  *
4  * Created on: Jan 14, 2014
5  * Author: nsoblath
6  */
7 
8 #define SCARAB_API_EXPORTS
9 
10 #include <sstream>
11 using std::string;
12 using std::stringstream;
13 
14 #include "param_value.hh"
15 
16 #include "param_base_impl.hh"
17 
18 //#include "logger.hh"
19 //LOGGER( dlog, "param_value" )
20 
21 namespace scarab
22 {
23 
25  param(),
26  f_value( false )
27  {
28  //LWARN( dlog, "param_value constructor: default (bool)" );
29  }
30 
31  param_value::param_value( bool a_value ) :
32  param(),
33  f_value( a_value )
34  {
35  f_value = a_value;
36  //LWARN( dlog, "param_value constructor: bool --> bool" );
37  }
38 
39  param_value::param_value( uint8_t a_value ) :
40  param(),
41  f_value( uint64_t(a_value) )
42  {
43  //LWARN( dlog, "param_value constructor: uint8 --> uint" );
44  }
45 
46  param_value::param_value( uint16_t a_value ) :
47  param(),
48  f_value( uint64_t(a_value) )
49  {
50  //LWARN( dlog, "param_value constructor: uint16 --> uint" );
51  }
52 
53  param_value::param_value( uint32_t a_value ) :
54  param(),
55  f_value( uint64_t(a_value) )
56  {
57  //LWARN( dlog, "param_value constructor: uint32 --> uint" );
58  }
59 
60  param_value::param_value( uint64_t a_value ) :
61  param(),
62  f_value( uint64_t(a_value) )
63  {
64  //LWARN( dlog, "param_value constructor: uint64 --> uint" );
65  }
66 
67  param_value::param_value( int8_t a_value ) :
68  param(),
69  f_value( int64_t(a_value) )
70  {
71  //LWARN( dlog, "param_value constructor: int8 --> int" );
72  }
73 
74  param_value::param_value( int16_t a_value ) :
75  param(),
76  f_value( int64_t(a_value) )
77  {
78  //LWARN( dlog, "param_value constructor: int16 --> int" );
79  }
80 
81 
82  param_value::param_value( int32_t a_value ) :
83  param(),
84  f_value( int64_t(a_value) )
85  {
86  //LWARN( dlog, "param_value constructor: int32 --> int" );
87  }
88 
89  param_value::param_value( int64_t a_value ) :
90  param(),
91  f_value( a_value )
92  {
93  //LWARN( dlog, "param_value constructor: int64 --> int" );
94  }
95 
96  param_value::param_value( float a_value ) :
97  param(),
98  f_value( double(a_value) )
99  {
100  //LWARN( dlog, "param_value constructor: float --> double" );
101  }
102 
103  param_value::param_value( double a_value ) :
104  param(),
105  f_value( a_value )
106  {
107  //LWARN( dlog, "param_value constructor: double --> double" );
108  }
109 
110  param_value::param_value( const char* a_value ) :
111  param(),
112  f_value( string( a_value ) )
113  {
114  //LWARN( dlog, "param_value constructor: char* --> k_string" );
115  }
116 
117  param_value::param_value( const string& a_value ) :
118  param(),
119  f_value( a_value )
120  {
121  //LWARN( dlog, "param_value constructor: string --> k_string" );
122  }
123 
125  param( orig ),
126  f_value( orig.f_value )
127  {
128  //LWARN( dlog, "param_value copy constructor: " << type() );
129  }
130 
132  param( std::move( orig ) ),
133  f_value( std::move( orig.f_value ) )
134  {
135  }
136 
138  {
139  }
140 
142  {
143  if( &rhs == this ) return *this;
144 
145  f_value = rhs.f_value;
146 
147  return *this;
148  }
149 
151  {
152  if( &rhs == this ) return *this;
153 
154  f_value = std::move( rhs.f_value );
155 
156  return *this;
157  }
158 
159  bool param_value::has_subset( const param& a_subset ) const
160  {
161  if( ! a_subset.is_value() ) return false;
162  return true;
163  }
164 
165  SCARAB_API std::ostream& operator<<(std::ostream& out, const param_value& a_value)
166  {
167  return out << a_value.as_string();
168  }
169 
170 } /* namespace scarab */
virtual bool is_value() const
#define SCARAB_API
Definition: scarab_api.hh:24
STL namespace.
boost::variant< bool, uint64_t, int64_t, double, std::string > f_value
Definition: param_value.hh:89
virtual bool has_subset(const param &a_subset) const
Definition: param_value.cc:159
SCARAB_API std::ostream & operator<<(std::ostream &out, const param_array &a_value)
Definition: param_array.cc:167
virtual ~param_value()
Definition: param_value.cc:137
std::string as_string() const
Definition: param_value.hh:478
param_value & operator=(const param_value &rhs)
Definition: param_value.cc:141