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 |
5893
|
38 octave_sparse_params |
5164
|
39 { |
5893
|
40 protected: |
5164
|
41 |
5893
|
42 octave_sparse_params (void) |
|
43 : params (OCTAVE_SPARSE_CONTROLS_SIZE), |
|
44 keys (OCTAVE_SPARSE_CONTROLS_SIZE) |
|
45 { |
|
46 init_keys (); |
|
47 do_defaults (); |
|
48 } |
|
49 |
|
50 public: |
|
51 |
|
52 static bool instance_ok (void); |
|
53 |
|
54 static void defaults (void); |
|
55 |
|
56 static void tight (void); |
5164
|
57 |
5893
|
58 static string_vector get_keys (void); |
5164
|
59 |
5893
|
60 static ColumnVector get_vals (void); |
5164
|
61 |
5893
|
62 static bool set_vals (const NDArray& vals); |
5164
|
63 |
5893
|
64 static bool set_key (const std::string& key, const double& val); |
5164
|
65 |
5893
|
66 static double get_key (const std::string& key); |
5164
|
67 |
5893
|
68 static void print_info (std::ostream& os, const std::string& prefix); |
|
69 |
|
70 private: |
5164
|
71 |
|
72 ColumnVector params; |
|
73 |
|
74 string_vector keys; |
5893
|
75 |
|
76 static octave_sparse_params *instance; |
|
77 |
|
78 void do_defaults (void); |
|
79 |
|
80 void do_tight (void); |
|
81 |
|
82 string_vector do_get_keys (void) const { return keys; } |
|
83 |
|
84 ColumnVector do_get_vals (void) const { return params; } |
5164
|
85 |
5893
|
86 bool do_set_vals (const NDArray& vals); |
|
87 |
|
88 bool do_set_key (const std::string& key, const double& val); |
|
89 |
|
90 double do_get_key (const std::string& key); |
|
91 |
|
92 void do_print_info (std::ostream& os, const std::string& prefix) const; |
|
93 |
|
94 void init_keys (void); |
|
95 }; |
5164
|
96 |
|
97 #endif |
|
98 |
|
99 /* |
|
100 ;;; Local Variables: *** |
|
101 ;;; mode: C++ *** |
|
102 ;;; End: *** |
|
103 */ |