Xyce  6.1
N_DEV_Param.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 // Copyright Notice
3 //
4 // Copyright 2002 Sandia Corporation. Under the terms
5 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S.
6 // Government retains certain rights in this software.
7 //
8 // Xyce(TM) Parallel Electrical Simulator
9 // Copyright (C) 2002-2015 Sandia Corporation
10 //
11 // This program is free software: you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation, either version 3 of the License, or
14 // (at your option) any later version.
15 //
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 //-----------------------------------------------------------------------------
24 
25 //-------------------------------------------------------------------------
26 // Filename : $RCSfile: N_DEV_Param.h,v $
27 //
28 // Purpose :
29 //
30 // Special Notes :
31 //
32 // Creator : Eric Keiter
33 //
34 // Creation Date : 5/22/00
35 //
36 // Revision Information:
37 // ---------------------
38 //
39 // Revision Number: $Revision: 1.36 $
40 //
41 // Revision Date : $Date: 2015/05/13 22:28:55 $
42 //
43 // Current Owner : $Author: dgbaur $
44 //-------------------------------------------------------------------------
45 
46 #ifndef N_DEV_PARAM_H
47 #define N_DEV_PARAM_H
48 
49 #include <iosfwd>
50 #include <string>
51 #include <vector>
52 #include <map>
53 
54 #include <N_DEV_fwd.h>
55 #include <N_UTL_NoCase.h>
56 #include <N_UTL_Param.h>
57 
58 namespace Xyce {
59 namespace Device {
60 
61 //-----------------------------------------------------------------------------
62 // Class : N_DEV_Param
63 // Purpose :
64 // Special Notes :
65 // Creator : Rob Hoekstra, SNL, Parallel Computational Sciences
66 // Creation Date : 5/10/01
67 //-----------------------------------------------------------------------------
68 class Param : public Util::Param
69 {
70  friend class Pack<Param>;
71 
72 public:
74  : Util::Param(),
75  isGiven_(false),
76  isDefault_(false)
77  {}
78 
79  template <class T>
80  Param(const std::string &tag, const T &value, bool is_given = false)
81  : Util::Param(tag, value),
82  isGiven_(is_given),
83  isDefault_(false)
84  {}
85 
86  Param(const Param &rhsParam)
87  : Util::Param(rhsParam),
88  isGiven_(rhsParam.isGiven_),
89  isDefault_(rhsParam.isDefault_)
90  {}
91 
92  Param &operator=(const Param &rhsParam)
93  {
94  Util::Param::operator=(rhsParam);
95  isGiven_ = rhsParam.isGiven_;
96  isDefault_ = rhsParam.isDefault_;
97 
98  return *this;
99  }
100 
101  virtual ~Param()
102  {}
103 
104  void setGiven(bool is_given)
105  {
106  isGiven_ = is_given;
107  }
108 
109  void setDefault(bool is_default)
110  {
111  isDefault_ = is_default;
112  }
113 
114  bool given() const
115  {
116  return isGiven_;
117  }
118 
119  bool default_val() const
120  {
121  return isDefault_;
122  }
123 
124 private:
125  bool isGiven_;
127 };
128 
129 inline void setParamValue(Param &param, const Param &from_param)
130 {
131  param.setVal(static_cast<const Util::Param &>(from_param));
132 }
133 
134 inline void setParam(Param &param, const std::string &tag, const Param &from_param)
135 {
136  param.set(tag, static_cast<const Util::Param &>(from_param));
137 }
138 
139 } // namespace Device
140 } // namespace Xyce
141 
142 #endif
Param(const Param &rhsParam)
Definition: N_DEV_Param.h:86
Pure virtual class to augment a linear system.
void setParam(Param &param, const std::string &tag, const Param &from_param)
Definition: N_DEV_Param.h:134
const T & value(const ParameterBase &entity, const Descriptor &descriptor)
Returns the value of the parameter for the entity.
Definition: N_DEV_Pars.h:1224
void setDefault(bool is_default)
Definition: N_DEV_Param.h:109
bool given() const
Definition: N_DEV_Param.h:114
void setGiven(bool is_given)
Definition: N_DEV_Param.h:104
Param(const std::string &tag, const T &value, bool is_given=false)
Definition: N_DEV_Param.h:80
Param & operator=(const Param &rhsParam)
Definition: N_DEV_Param.h:92
void setParamValue(Param &param, const Param &from_param)
Definition: N_DEV_Param.h:129
bool default_val() const
Definition: N_DEV_Param.h:119