My Project  0.0.16
QUCS Mapping
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
environment.h
Go to the documentation of this file.
1 /*
2  * environment.h - variable environment class definitions
3  *
4  * Copyright (C) 2004, 2006, 2007, 2009 Stefan Jahn <stefan@lkcc.org>
5  *
6  * This is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * This software is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this package; see the file COPYING. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  *
21  * $Id: environment.h 1825 2011-03-11 20:42:14Z ela $
22  *
23  */
24 
25 #ifndef __ENVIRONMENT_H__
26 #define __ENVIRONMENT_H__
27 
28 class variable;
29 class checker;
30 class solver;
31 class dataset;
32 template <class type_t> class ptrlist;
33 
35 {
36  public:
37  environment ();
38  environment (const char *);
39  environment (const environment &);
40  virtual ~environment ();
41  void copy (const environment &);
42  void setName (char *);
43  char * getName (void);
44  void print (bool all = false);
45  void setDefinitions (struct definition_t * d) { defs = d; }
46  struct definition_t * getDefinitions (void) { return defs; }
47 
48  // variable specific functionality
49  void copyVariables (variable *);
50  void deleteVariables (void);
51  void addVariable (variable *, bool pass = true);
52  variable * getVariable (char *);
53 
54  // equation specific functionality
55  void setChecker (eqn::checker * c) { checkee = c; }
56  eqn::checker * getChecker (void) { return checkee; }
57  void setSolver (eqn::solver * s) { solvee = s; }
58  eqn::solver * getSolver (void) { return solvee; }
59  int equationChecker (int noundefined = 1);
60  int equationSolver (dataset *);
61  int runSolver (void);
62  void equationSolver (void);
63 
64  // subcircuit specific
65  vector getVector (char *);
66  void setDoubleConstant (char *, nr_double_t);
67  nr_double_t getDoubleConstant (char *);
68  void setDouble (char *, nr_double_t);
69  nr_double_t getDouble (char *);
70  void setDoubleReference (char *, char *);
71  char * getDoubleReference (char *);
73  void passConstants (void);
74  void fetchConstants (void);
75  variable * findValue (char *);
76  void setValue (char *, eqn::constant *);
77  void saveResults (void);
78 
79  // children functionality
80  void delChild (environment *);
81  void addChild (environment *);
82 
83  private:
84  char * name;
85  variable * root;
86  eqn::checker * checkee;
87  eqn::solver * solvee;
88  ptrlist<environment> * children;
89  bool iscopy;
90  struct definition_t * defs;
91 };
92 
93 #endif /* __ENVIRONMENT_H__ */