Qucs-core  0.0.18
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
variable.h
Go to the documentation of this file.
1 /*
2  * variable.h - generic variable class definitions
3  *
4  * Copyright (C) 2004, 2007 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$
22  *
23  */
24 
25 #ifndef __VARIABLE_H__
26 #define __VARIABLE_H__
27 
29 #include "analysis.h"
30 #include "equation.h"
31 
32 //using namespace qucs::eqn;
33 namespace qucs {
34 
35 // Enumerate possible types of variables.
37  VAR_UNKNOWN = -1, // not yet defined
38  VAR_CONSTANT, // equation constant
39  VAR_REFERENCE, // equation reference
40  VAR_SUBSTRATE, // substrate definition
41  VAR_VALUE, // equation result
42  VAR_ANALYSIS // analysis
43 };
44 
45 class substrate;
46 class analysis;
47 
48 namespace eqn {
49  class equation;
50  class constant;
51 }
52 
53 
54 class variable
55 {
56  public:
57  variable ();
58  variable (char *);
59  variable (const variable &);
60  virtual ~variable ();
61  void setName (char *);
62  char * getName (void);
63  void setNext (variable * v) { next = v; }
64  variable * getNext (void) { return next; }
65 
66  void setType (int t) { type = t; }
67  int getType (void) { return type; }
68  void setConstant (eqn::constant * c) { type = VAR_CONSTANT; value.c = c; }
69  eqn::constant * getConstant (void) { return value.c; }
70  void setReference (eqn::reference * r) { type = VAR_REFERENCE; value.r = r; }
71  eqn::reference * getReference (void) { return value.r; }
73  substrate * getSubstrate (void) { return value.s; }
74  void setValue (eqn::constant * v) { type = VAR_VALUE; value.v = v; }
75  eqn::constant * getValue (void) { return value.v; }
76  void setAnalysis (analysis * a) { type = VAR_ANALYSIS; value.a = a; }
77  analysis * getAnalysis (void) { return value.a; }
78  char * toString (void);
79  void setPassing (bool p) { pass = p; }
80  bool getPassing (void) { return pass; }
81 
82  private:
83  char * name;
84  char * text;
85  bool pass;
86  int type;
87  union value_t {
88  eqn::constant * c; // equation constant
89  eqn::reference * r; // equation reference
90  substrate * s; // substrate definition
91  eqn::constant * v; // equation result
92  analysis * a; // analysis
93  } value;
95 };
96 
97 } // namespace qucs
98 
99 #endif /* __VARIABLE_H__ */
bool getPassing(void)
Definition: variable.h:80
void setPassing(bool p)
Definition: variable.h:79
void setAnalysis(analysis *a)
Definition: variable.h:76
eqn::constant * c
Definition: variable.h:88
t
Definition: parse_vcd.y:290
variable * getNext(void)
Definition: variable.h:64
char * text
Definition: variable.h:84
r
Definition: parse_mdl.y:515
eqn::reference * r
Definition: variable.h:89
char * toString(void)
Definition: variable.cpp:88
void setType(int t)
Definition: variable.h:66
variable * next
Definition: variable.h:94
char * name
Definition: variable.h:83
eqn::reference * getReference(void)
Definition: variable.h:71
void setSubstrate(substrate *s)
Definition: variable.h:72
char * getName(void)
Definition: variable.cpp:83
analysis * getAnalysis(void)
Definition: variable.h:77
The analysis class header file.
union qucs::variable::value_t value
substrate * getSubstrate(void)
Definition: variable.h:73
void setValue(eqn::constant *v)
Definition: variable.h:74
eqn::constant * getConstant(void)
Definition: variable.h:69
eqn::constant * getValue(void)
Definition: variable.h:75
v
Definition: parse_zvr.y:141
virtual ~variable()
Destructor deletes an instance of the variable class.
Definition: variable.cpp:71
void setConstant(eqn::constant *c)
Definition: variable.h:68
variably_type
Definition: variable.h:36
void setReference(eqn::reference *r)
Definition: variable.h:70
void setName(char *)
Definition: variable.cpp:77
eqn::constant * v
Definition: variable.h:91
int getType(void)
Definition: variable.h:67
void setNext(variable *v)
Definition: variable.h:63