5164
|
1 /* |
|
2 |
|
3 Copyright (C) 2004 David Bateman |
|
4 Copyright (C) 1998-2004 Andy Adler |
|
5 |
|
6 Octave is free software; you can redistribute it and/or modify it |
|
7 under the terms of the GNU General Public License as published by the |
|
8 Free Software Foundation; either version 2, or (at your option) any |
|
9 later version. |
|
10 |
|
11 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 for more details. |
|
15 |
|
16 You should have received a copy of the GNU General Public License |
5307
|
17 along with this program; see the file COPYING. If not, write to the |
|
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
|
19 Boston, MA 02110-1301, USA. |
5164
|
20 |
|
21 */ |
|
22 |
|
23 #if !defined (octave_oct_spparms_h) |
|
24 #define octave_oct_spparms_h 1 |
|
25 |
|
26 #include <cassert> |
|
27 #include <cstddef> |
|
28 |
|
29 #include <iostream> |
|
30 |
|
31 #include "str-vec.h" |
|
32 #include "dColVector.h" |
5893
|
33 #include "dNDArray.h" |
5164
|
34 |
|
35 #define OCTAVE_SPARSE_CONTROLS_SIZE 12 |
|
36 |
|
37 class |
6108
|
38 OCTAVE_API |
5893
|
39 octave_sparse_params |
5164
|
40 { |
5893
|
41 protected: |
5164
|
42 |
5893
|
43 octave_sparse_params (void) |
|
44 : params (OCTAVE_SPARSE_CONTROLS_SIZE), |
|
45 keys (OCTAVE_SPARSE_CONTROLS_SIZE) |
|
46 { |
|
47 init_keys (); |
|
48 do_defaults (); |
|
49 } |
|
50 |
|
51 public: |
|
52 |
6482
|
53 octave_sparse_params (const octave_sparse_params& a) |
|
54 : params (a.params), keys (a.keys) { } |
|
55 |
|
56 octave_sparse_params& operator = (const octave_sparse_params& a) |
|
57 { |
|
58 if (&a != this) |
|
59 { |
|
60 params = a.params; |
|
61 keys = a.keys; |
|
62 } |
|
63 |
|
64 return *this; |
|
65 } |
|
66 |
|
67 ~octave_sparse_params (void) { } |
|
68 |
5893
|
69 static bool instance_ok (void); |
|
70 |
|
71 static void defaults (void); |
|
72 |
|
73 static void tight (void); |
5164
|
74 |
5893
|
75 static string_vector get_keys (void); |
5164
|
76 |
5893
|
77 static ColumnVector get_vals (void); |
5164
|
78 |
5893
|
79 static bool set_vals (const NDArray& vals); |
5164
|
80 |
5893
|
81 static bool set_key (const std::string& key, const double& val); |
5164
|
82 |
5893
|
83 static double get_key (const std::string& key); |
5164
|
84 |
6460
|
85 static double get_bandden (void); |
|
86 |
5893
|
87 static void print_info (std::ostream& os, const std::string& prefix); |
|
88 |
|
89 private: |
5164
|
90 |
|
91 ColumnVector params; |
|
92 |
|
93 string_vector keys; |
5893
|
94 |
|
95 static octave_sparse_params *instance; |
|
96 |
|
97 void do_defaults (void); |
|
98 |
|
99 void do_tight (void); |
|
100 |
|
101 string_vector do_get_keys (void) const { return keys; } |
|
102 |
|
103 ColumnVector do_get_vals (void) const { return params; } |
5164
|
104 |
5893
|
105 bool do_set_vals (const NDArray& vals); |
|
106 |
|
107 bool do_set_key (const std::string& key, const double& val); |
|
108 |
|
109 double do_get_key (const std::string& key); |
|
110 |
6460
|
111 double do_get_bandden (void); |
|
112 |
5893
|
113 void do_print_info (std::ostream& os, const std::string& prefix) const; |
|
114 |
|
115 void init_keys (void); |
|
116 }; |
5164
|
117 |
|
118 #endif |
|
119 |
|
120 /* |
|
121 ;;; Local Variables: *** |
|
122 ;;; mode: C++ *** |
|
123 ;;; End: *** |
|
124 */ |