Merge branch 'testing-uf' into master-uf
[gnucap-felix.git] / lib / e_paramlist.cc
blob4bc9226b7ac3fc8a0afb36a9f0c78cdd8770b04a
1 /*$Id: e_paramlist.cc 2016/09/16 $ -*- C++ -*-
2 * Copyright (C) 2001 Albert Davis
3 * Author: Albert Davis <aldavis@gnu.org>
5 * This file is part of "Gnucap", the Gnu Circuit Analysis Package
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3, or (at your option)
10 * any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 * 02110-1301, USA.
21 *------------------------------------------------------------------
23 //testing=script 2016.09.16
24 #include "e_paramlist.h"
25 /*--------------------------------------------------------------------------*/
26 int COMMON_PARAMLIST::_count = -1;
27 /*--------------------------------------------------------------------------*/
28 bool COMMON_PARAMLIST::operator==(const COMMON_COMPONENT& x)const
30 const COMMON_PARAMLIST* p = dynamic_cast<const COMMON_PARAMLIST*>(&x);
31 bool rv = p
32 && _params == p->_params
33 && COMMON_COMPONENT::operator==(x);
34 return rv;
36 /*--------------------------------------------------------------------------*/
37 bool COMMON_PARAMLIST::param_is_printable(int i)const
39 assert(i < COMMON_PARAMLIST::param_count());
40 if (i >= COMMON_COMPONENT::param_count()) {
41 return _params.is_printable(COMMON_PARAMLIST::param_count() - 1 - i);
42 }else{
43 return COMMON_COMPONENT::param_is_printable(i);
46 /*--------------------------------------------------------------------------*/
47 std::string COMMON_PARAMLIST::param_name(int i)const
49 assert(i < COMMON_PARAMLIST::param_count());
50 if (i >= COMMON_COMPONENT::param_count()) {
51 return _params.name(COMMON_PARAMLIST::param_count() - 1 - i);
52 }else{untested();
53 return COMMON_COMPONENT::param_name(i);
56 /*--------------------------------------------------------------------------*/
57 std::string COMMON_PARAMLIST::param_name(int i, int j)const
58 {untested();
59 assert(i < COMMON_PARAMLIST::param_count());
60 if (j == 0) {untested();
61 return param_name(i);
62 }else if (i >= COMMON_COMPONENT::param_count()) {untested();
63 return "";
64 }else{untested();
65 return COMMON_COMPONENT::param_name(i);
68 /*--------------------------------------------------------------------------*/
69 std::string COMMON_PARAMLIST::param_value(int i)const
71 assert(i < COMMON_PARAMLIST::param_count());
72 if (i >= COMMON_COMPONENT::param_count()) {
73 return _params.value(COMMON_PARAMLIST::param_count() - 1 - i);
74 }else{untested();
75 return COMMON_COMPONENT::param_value(i);
78 /*--------------------------------------------------------------------------*/
79 void COMMON_PARAMLIST::precalc_first(const CARD_LIST* Scope)
81 assert(Scope);
82 COMMON_COMPONENT::precalc_first(Scope);
83 _mfactor = _params.deep_lookup("m");
84 //BUG// _mfactor must be in precalc_first
86 /*--------------------------------------------------------------------------*/
87 void COMMON_PARAMLIST::precalc_last(const CARD_LIST* Scope)
89 assert(Scope);
90 COMMON_COMPONENT::precalc_last(Scope);
92 for (PARAM_LIST::iterator i = _params.begin(); i != _params.end(); ++i) {
93 i->second.e_val(NOT_INPUT,Scope);
96 /*--------------------------------------------------------------------------*/
97 /*--------------------------------------------------------------------------*/
98 // vim:ts=8:sw=2:noet: