Mercurial > hg > octave-nkf
diff liboctave/oct-spparms.h @ 5893:d73ffe42f2c8
[project @ 2006-07-16 07:48:19 by jwe]
author | jwe |
---|---|
date | Sun, 16 Jul 2006 07:49:03 +0000 |
parents | 4c8a2e4e0717 |
children | 143b556ce725 |
line wrap: on
line diff
--- a/liboctave/oct-spparms.h +++ b/liboctave/oct-spparms.h @@ -30,45 +30,69 @@ #include "str-vec.h" #include "dColVector.h" +#include "dNDArray.h" #define OCTAVE_SPARSE_CONTROLS_SIZE 12 class -SparseParams +octave_sparse_params { - public: - SparseParams (void) : params (ColumnVector (OCTAVE_SPARSE_CONTROLS_SIZE)), - keys (string_vector (OCTAVE_SPARSE_CONTROLS_SIZE)) - { defaults (); init_keys (); } - - void defaults (void); +protected: - void tight (void); - - SparseParams& operator = (const SparseParams& a); + octave_sparse_params (void) + : params (OCTAVE_SPARSE_CONTROLS_SIZE), + keys (OCTAVE_SPARSE_CONTROLS_SIZE) + { + init_keys (); + do_defaults (); + } + +public: + + static bool instance_ok (void); + + static void defaults (void); + + static void tight (void); - double& operator () (int n) { return params (n); } - double operator () (int n) const { return params (n); } + static string_vector get_keys (void); - string_vector get_keys (void) const { return keys; } + static ColumnVector get_vals (void); - ColumnVector get_vals (void) const { return params; } + static bool set_vals (const NDArray& vals); - bool set_key (const std::string key, const double& val); + static bool set_key (const std::string& key, const double& val); - double get_key (const std::string key); + static double get_key (const std::string& key); - void print_info (std::ostream& os, const std::string& prefix) const; - - private: - void init_keys (void); + static void print_info (std::ostream& os, const std::string& prefix); + +private: ColumnVector params; string_vector keys; -}; + + static octave_sparse_params *instance; + + void do_defaults (void); + + void do_tight (void); + + string_vector do_get_keys (void) const { return keys; } + + ColumnVector do_get_vals (void) const { return params; } -extern SparseParams Voctave_sparse_controls; + bool do_set_vals (const NDArray& vals); + + bool do_set_key (const std::string& key, const double& val); + + double do_get_key (const std::string& key); + + void do_print_info (std::ostream& os, const std::string& prefix) const; + + void init_keys (void); +}; #endif