Scarab  v2.2.1
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 "logger.hh"
17 //LOGGER( dlog, "param_value" )
18 
19 namespace scarab
20 {
21 
23  param(),
24  f_value( false )
25  {
26  //LWARN( dlog, "param_value constructor: default (bool)" );
27  }
28 
29  param_value::param_value( bool a_value ) :
30  param(),
31  f_value( a_value )
32  {
33  f_value = a_value;
34  //LWARN( dlog, "param_value constructor: bool --> bool" );
35  }
36 
37  param_value::param_value( uint8_t a_value ) :
38  param(),
39  f_value( uint64_t(a_value) )
40  {
41  //LWARN( dlog, "param_value constructor: uint8 --> uint" );
42  }
43 
44  param_value::param_value( uint16_t a_value ) :
45  param(),
46  f_value( uint64_t(a_value) )
47  {
48  //LWARN( dlog, "param_value constructor: uint16 --> uint" );
49  }
50 
51  param_value::param_value( uint32_t a_value ) :
52  param(),
53  f_value( uint64_t(a_value) )
54  {
55  //LWARN( dlog, "param_value constructor: uint32 --> uint" );
56  }
57 
58  param_value::param_value( uint64_t a_value ) :
59  param(),
60  f_value( uint64_t(a_value) )
61  {
62  //LWARN( dlog, "param_value constructor: uint64 --> uint" );
63  }
64 
65  param_value::param_value( int8_t a_value ) :
66  param(),
67  f_value( int64_t(a_value) )
68  {
69  //LWARN( dlog, "param_value constructor: int8 --> int" );
70  }
71 
72  param_value::param_value( int16_t a_value ) :
73  param(),
74  f_value( int64_t(a_value) )
75  {
76  //LWARN( dlog, "param_value constructor: int16 --> int" );
77  }
78 
79 
80  param_value::param_value( int32_t a_value ) :
81  param(),
82  f_value( int64_t(a_value) )
83  {
84  //LWARN( dlog, "param_value constructor: int32 --> int" );
85  }
86 
87  param_value::param_value( int64_t a_value ) :
88  param(),
89  f_value( a_value )
90  {
91  //LWARN( dlog, "param_value constructor: int64 --> int" );
92  }
93 
94  param_value::param_value( float a_value ) :
95  param(),
96  f_value( double(a_value) )
97  {
98  //LWARN( dlog, "param_value constructor: float --> double" );
99  }
100 
101  param_value::param_value( double a_value ) :
102  param(),
103  f_value( a_value )
104  {
105  //LWARN( dlog, "param_value constructor: double --> double" );
106  }
107 
108  param_value::param_value( const char* a_value ) :
109  param(),
110  f_value( string( a_value ) )
111  {
112  //LWARN( dlog, "param_value constructor: char* --> k_string" );
113  }
114 
115  param_value::param_value( const string& a_value ) :
116  param(),
117  f_value( a_value )
118  {
119  //LWARN( dlog, "param_value constructor: string --> k_string" );
120  }
121 
123  param( orig ),
124  f_value( orig.f_value )
125  {
126  //LWARN( dlog, "param_value copy constructor: " << type() );
127  }
128 
130  param( std::move( orig ) ),
131  f_value( std::move( orig.f_value ) )
132  {
133  }
134 
136  {
137  }
138 
140  {
141  if( &rhs == this ) return *this;
142 
143  f_value = rhs.f_value;
144 
145  return *this;
146  }
147 
149  {
150  if( &rhs == this ) return *this;
151 
152  f_value = std::move( rhs.f_value );
153 
154  return *this;
155  }
156 
157  bool param_value::has_subset( const param& a_subset ) const
158  {
159  if( ! a_subset.is_value() ) return false;
160  return true;
161  }
162 
163  SCARAB_API std::ostream& operator<<(std::ostream& out, const param_value& a_value)
164  {
165  return out << a_value.as_string();
166  }
167 
168 } /* namespace scarab */
virtual bool has_subset(const param &a_subset) const
Definition: param_value.cc:157
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:102
std::string as_string() const
Definition: param_value.hh:491
SCARAB_API std::ostream & operator<<(std::ostream &out, const param_array &a_value)
Definition: param_array.cc:110
virtual ~param_value()
Definition: param_value.cc:135
param_value & operator=(const param_value &rhs)
Definition: param_value.cc:139