FEI  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
fei_Param.cpp
1 /*--------------------------------------------------------------------*/
2 /* Copyright 2005 Sandia Corporation. */
3 /* Under the terms of Contract DE-AC04-94AL85000, there is a */
4 /* non-exclusive license for use of this work by or on behalf */
5 /* of the U.S. Government. Export of this program may require */
6 /* a license from the United States Government. */
7 /*--------------------------------------------------------------------*/
8 
9 
10 #include <fei_macros.hpp>
11 
12 #include <fei_Param.hpp>
13 
14 fei::Param::Param(const char* name,
15  const char* value)
16  : type_(STRING),
17  name_(),
18  string_value_(),
19  double_value_(0.0),
20  int_value_(0),
21  bool_value_(false),
22  void_value_(NULL)
23 {
24  if (name != 0) name_ = name;
25  if (value != 0) string_value_ = value;
26 }
27 
28 fei::Param::Param(const char* name,
29  double value)
30  : type_(DOUBLE),
31  name_(),
32  string_value_(),
33  double_value_(value),
34  int_value_(0),
35  bool_value_(false),
36  void_value_(NULL)
37 {
38  if (name != 0) name_ = name;
39 }
40 
41 fei::Param::Param(const char* name,
42  int value)
43  : type_(INT),
44  name_(),
45  string_value_(),
46  double_value_(0.0),
47  int_value_(value),
48  bool_value_(false),
49  void_value_(NULL)
50 {
51  if (name != 0) name_ = name;
52 }
53 
54 fei::Param::Param(const char* name,
55  bool value)
56  : type_(BOOL),
57  name_(),
58  string_value_(),
59  double_value_(0.0),
60  int_value_(0),
61  bool_value_(value),
62  void_value_(NULL)
63 {
64  if (name != 0) name_ = name;
65 }
66 
67 fei::Param::Param(const char* name,
68  const void* value)
69  : type_(VOID),
70  name_(),
71  string_value_(),
72  double_value_(0.0),
73  int_value_(0),
74  bool_value_(false),
75  void_value_(value)
76 {
77  if (name != 0) name_ = name;
78 }
79 
80 fei::Param::Param(const fei::Param& src)
81  : type_(src.type_),
82  name_(),
83  string_value_(),
84  double_value_(0.0),
85  int_value_(0),
86  void_value_(NULL)
87 {
88  *this = src;
89 }
90 
92 {
93 }
94 
96 {
97  name_ = src.name_;
98  switch(type_) {
99  case STRING:
100  string_value_ = src.string_value_; break;
101  case DOUBLE:
102  double_value_ = src.double_value_; break;
103  case INT:
104  int_value_ = src.int_value_; break;
105  case VOID:
106  void_value_ = src.void_value_; break;
107  case BOOL:
108  bool_value_ = src.bool_value_; break;
109  case BAD_TYPE:
110  break;
111  }
112 
113  return(*this);
114 }
virtual ~Param()
Definition: fei_Param.cpp:91
Param(const char *name, const char *value)
Definition: fei_Param.cpp:14
Param & operator=(const Param &src)
Definition: fei_Param.cpp:95