Branch data Line data Source code
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 : :
30 : : /*! \class states
31 : : * \brief template class for storing state variables.
32 : : *
33 : : * This class is used for storing sets of states for use
34 : : * by the transient integrators.
35 : : *
36 : : */
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 : 2708 : int getStates (void) { return nstates; }
52 : 229 : 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
65 : : int currentstate;
66 : : };
67 : :
68 : : } // namespace qucs
69 : :
70 : : #include "states.cpp"
71 : :
72 : : #endif /* __STATES_H__ */
|