Qucs-core  0.0.18
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
states.h
Go to the documentation of this file.
1 /*
2  * states.h - save-state variable class definitions
3  *
4  * Copyright (C) 2004 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 __STATES_H__
26 #define __STATES_H__
27 
28 namespace qucs {
29 
37 template <class state_type_t>
38 class states
39 {
40  public:
41  // constructor and destructor set
42  states ();
43  states (const states &);
44  ~states ();
45 
46  // save-state variables for transient analysis
47  state_type_t getState (int, int n = 0);
48  void setState (int, state_type_t, int n = 0);
49  void initStates (void);
50  void clearStates (void);
51  int getStates (void) { return nstates; }
52  void setStates (int n) { nstates = n; }
53  void nextState (void);
54  void prevState (void);
55  void fillState (int, state_type_t);
56  void saveState (int, state_type_t *);
57  void inputState (int, state_type_t *);
58 
59  private:
60  // stateval: array for holding all the sets of states. Multiple sets of
61  // states are stored in one large array which is indexed appropriately
62  // to get the right state set and value
63  state_type_t * stateval;
64  int nstates; // the number of sets of states stored
66 };
67 
68 } // namespace qucs
69 
70 #include "states.cpp"
71 
72 #endif /* __STATES_H__ */
int currentstate
Definition: states.h:65
void fillState(int, state_type_t)
Definition: states.cpp:132
void setStates(int n)
Definition: states.h:52
void prevState(void)
Definition: states.cpp:124
state_type_t * stateval
Definition: states.h:63
n
Definition: parse_citi.y:147
void initStates(void)
Definition: states.cpp:75
template class for storing state variables.
Definition: states.h:38
void nextState(void)
Definition: states.cpp:117
state_type_t getState(int, int n=0)
Definition: states.cpp:99
int getStates(void)
Definition: states.h:51
void saveState(int, state_type_t *)
Definition: states.cpp:146
void inputState(int, state_type_t *)
Definition: states.cpp:159
void clearStates(void)
Definition: states.cpp:88
int nstates
Definition: states.h:64
void setState(int, state_type_t, int n=0)
Definition: states.cpp:109