Xyce  6.1
N_DEV_DeviceBlock.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_DeviceBlock.h,v $
27 //
28 // Purpose :
29 //
30 // Special Notes :
31 //
32 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
33 //
34 // Creation Date : 02/28/00
35 //
36 // Revision Information:
37 // ---------------------
38 //
39 // Revision Number: $Revision: 1.40 $
40 //
41 // Revision Date : $Date: 2015/10/14 19:31:37 $
42 //
43 // Current Owner : $Author: tvrusso $
44 //-----------------------------------------------------------------------------
45 
46 
47 #ifndef Xyce_N_DEV_DeviceBlock_h
48 #define Xyce_N_DEV_DeviceBlock_h
49 
50 #include <string>
51 #include <vector>
52 #include <iosfwd>
53 
54 #include <N_DEV_Param.h>
55 #include <N_DEV_InstanceName.h>
56 #include <N_UTL_NetlistLocation.h>
57 
58 namespace Xyce {
59 namespace Device {
60 
61 //-----------------------------------------------------------------------------
62 // Class : ModelBlock
63 // Purpose :
64 // Special Notes :
65 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
66 // Creation Date : 3/31/00
67 //-----------------------------------------------------------------------------
68 ///
69 /// ModelBlock represents a .MODEL line from the netlist.
70 ///
72 {
73  friend class Pack<ModelBlock>;
74  friend std::ostream& operator<<(std::ostream& os, const ModelBlock & mb);
75 
76 public:
77  ModelBlock(const std::string &name = "", const std::string &type = "", int level = 1);
78 
79  ModelBlock(const ModelBlock & right);
80  ModelBlock &operator=(const ModelBlock & right);
81 
82  ~ModelBlock();
83 
84  const ModelName &getName() const
85  {
86  return name_;
87  }
88 
89  void setName(const ModelName &name)
90  {
91  name_ = name;
92  }
93 
94  const std::string &getType() const
95  {
96  return type_;
97  }
98 
99  void setType(const std::string &type)
100  {
101  type_ = type;
102  }
103 
104  int getLevel() const
105  {
106  return level_;
107  }
108 
109  void setLevel(int level)
110  {
111  level_ = level;
112  }
113 
114  const NetlistLocation &getNetlistLocation() const
115  {
116  return netlistLocation_;
117  }
118 
119  void setNetlistLocation(const NetlistLocation &netlist_location)
120  {
121  netlistLocation_ = netlist_location;
122  }
123 
124  bool operator==(const ModelBlock &right) const
125  {
126  return equal_nocase(name_, right.name_);
127  }
128 
129  bool operator!=(const ModelBlock &right) const
130  {
131  return !equal_nocase(name_, right.name_);
132  }
133 
134  void clear();
135 
136 private:
137  ModelName name_; ///< Model name
138  std::string type_; ///< Model type
139  int level_; ///< Device level
140  NetlistLocation netlistLocation_; ///< Path and line number of .MODEL command
141 
142 public:
143  std::vector<Param> params; ///< Parameters from the line
144 };
145 
146 //-----------------------------------------------------------------------------
147 // Class : InstanceBlock
148 // Purpose :
149 // Special Notes :
150 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
151 // Creation Date : 3/31/00
152 //-----------------------------------------------------------------------------
153 ///
154 /// InstanceBlock represent a device instance line from the netlist.
155 ///
157 {
158  friend class Pack<InstanceBlock>;
159  friend std::ostream& operator<<(std::ostream& os, const InstanceBlock & ib);
160 
161 public:
162  InstanceBlock(const std::string &name = std::string());
163 
164  InstanceBlock(const InstanceBlock &right);
165  InstanceBlock &operator=(const InstanceBlock &right);
166 
167  ~InstanceBlock();
168 
170  {
171  return name_;
172  }
173 
174  void setInstanceName(const InstanceName &name)
175  {
176  name_ = name;
177  }
178 
179  const ModelName &getModelName() const
180  {
181  return modelName_;
182  }
183 
184  void setModelName(const ModelName &modelName)
185  {
186  modelName_ = modelName;
187  }
188 
189  const NetlistLocation &getNetlistLocation() const
190  {
191  return netlistLocation_;
192  }
193 
194  void setNetlistLocation(const NetlistLocation &netlist_location)
195  {
196  netlistLocation_ = netlist_location;
197  }
198 
199  bool operator==(const InstanceBlock &right) const
200  {
201  return equal_nocase(name_.getEncodedName(), right.name_.getEncodedName());
202  }
203 
204  bool operator!=(const InstanceBlock &right) const
205  {
206  return !equal_nocase(name_.getEncodedName(), right.name_.getEncodedName());
207  }
208 
209  void clear ();
210 
211 private:
212  InstanceName name_; ///< Device instance name
213  ModelName modelName_; ///< Model name if provided
214  NetlistLocation netlistLocation_; ///< Path and line number of .MODEL command
215 
216 public:
217  std::vector<Param> params;
218 
223 
224  bool modelFlag;
227  bool offFlag;
228  bool off;
229 };
230 
231 } // namespace Device
232 } // namespace Xyce
233 
234 #endif
bool operator==(const ModelBlock &right) const
const ModelName & getName() const
void setNetlistLocation(const NetlistLocation &netlist_location)
ModelBlock(const std::string &name="", const std::string &type="", int level=1)
friend std::ostream & operator<<(std::ostream &os, const ModelBlock &mb)
Pure virtual class to augment a linear system.
Devices and models are each named.
const std::string & getEncodedName() const
Return the instance name encoded as: [s:]*xname [s:]*Ytype!name [s:]*Utype!name!count.
void setNetlistLocation(const NetlistLocation &netlist_location)
bool operator!=(const InstanceBlock &right) const
NetlistLocation netlistLocation_
Path and line number of .MODEL command.
ModelName name_
Model name.
bool operator!=(const ModelBlock &right) const
bool operator==(const InstanceBlock &right) const
std::vector< Param > params
Parameters from the line.
InstanceBlock(const std::string &name=std::string())
void setName(const ModelName &name)
void setType(const std::string &type)
ModelBlock & operator=(const ModelBlock &right)
std::string type_
Model type.
const std::string & getType() const
const ModelName & getModelName() const
const InstanceName & getInstanceName() const
const NetlistLocation & getNetlistLocation() const
void setInstanceName(const InstanceName &name)
InstanceName name_
Device instance name.
const NetlistLocation & getNetlistLocation() const
InstanceBlock & operator=(const InstanceBlock &right)
friend std::ostream & operator<<(std::ostream &os, const InstanceBlock &ib)
ModelBlock represents a .MODEL line from the netlist.
NetlistLocation netlistLocation_
Path and line number of .MODEL command.
std::string ModelName
Definition: N_DEV_fwd.h:165
InstanceBlock represent a device instance line from the netlist.
std::vector< Param > params
void setModelName(const ModelName &modelName)
ModelName modelName_
Model name if provided.