Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #if !defined (octave_oct_spparms_h)
00025 #define octave_oct_spparms_h 1
00026
00027 #include <cassert>
00028 #include <cstddef>
00029
00030 #include <iosfwd>
00031
00032 #include "str-vec.h"
00033 #include "dColVector.h"
00034 #include "dNDArray.h"
00035
00036 #define OCTAVE_SPARSE_CONTROLS_SIZE 13
00037
00038 class
00039 OCTAVE_API
00040 octave_sparse_params
00041 {
00042 protected:
00043
00044 octave_sparse_params (void)
00045 : params (OCTAVE_SPARSE_CONTROLS_SIZE),
00046 keys (OCTAVE_SPARSE_CONTROLS_SIZE)
00047 {
00048 init_keys ();
00049 do_defaults ();
00050 }
00051
00052 public:
00053
00054 octave_sparse_params (const octave_sparse_params& a)
00055 : params (a.params), keys (a.keys) { }
00056
00057 octave_sparse_params& operator = (const octave_sparse_params& a)
00058 {
00059 if (&a != this)
00060 {
00061 params = a.params;
00062 keys = a.keys;
00063 }
00064
00065 return *this;
00066 }
00067
00068 ~octave_sparse_params (void) { }
00069
00070 static bool instance_ok (void);
00071
00072 static void defaults (void);
00073
00074 static void tight (void);
00075
00076 static string_vector get_keys (void);
00077
00078 static ColumnVector get_vals (void);
00079
00080 static bool set_vals (const NDArray& vals);
00081
00082 static bool set_key (const std::string& key, const double& val);
00083
00084 static double get_key (const std::string& key);
00085
00086 static double get_bandden (void);
00087
00088 static void print_info (std::ostream& os, const std::string& prefix);
00089
00090 private:
00091
00092 ColumnVector params;
00093
00094 string_vector keys;
00095
00096 static octave_sparse_params *instance;
00097
00098 static void cleanup_instance (void) { delete instance; instance = 0; }
00099
00100 void do_defaults (void);
00101
00102 void do_tight (void);
00103
00104 string_vector do_get_keys (void) const { return keys; }
00105
00106 ColumnVector do_get_vals (void) const { return params; }
00107
00108 bool do_set_vals (const NDArray& vals);
00109
00110 bool do_set_key (const std::string& key, const double& val);
00111
00112 double do_get_key (const std::string& key);
00113
00114 double do_get_bandden (void);
00115
00116 void do_print_info (std::ostream& os, const std::string& prefix) const;
00117
00118 void init_keys (void);
00119 };
00120
00121 #endif