view liboctave/oct-spparms.h @ 5301:9302581b820d ss-2-9-2

[project @ 2005-04-22 17:08:07 by jwe]
author jwe
date Fri, 22 Apr 2005 17:09:11 +0000
parents 57077d0ddc8e
children 4c8a2e4e0717
line wrap: on
line source

/*

Copyright (C) 2004 David Bateman
Copyright (C) 1998-2004 Andy Adler

Octave is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.

Octave is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with this program; see the file COPYING.  If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

*/

#if !defined (octave_oct_spparms_h)
#define octave_oct_spparms_h 1

#include <cassert>
#include <cstddef>

#include <iostream>

#include "str-vec.h"
#include "dColVector.h"

#define OCTAVE_SPARSE_CONTROLS_SIZE 12

class
SparseParams
{
 public:
  SparseParams (void) : params (ColumnVector (OCTAVE_SPARSE_CONTROLS_SIZE)), 
    keys (string_vector (OCTAVE_SPARSE_CONTROLS_SIZE)) 
    { defaults (); init_keys (); }
  
  void defaults (void);

  void tight (void);
  
  SparseParams& operator = (const SparseParams& a);
  
  double& operator () (int n) { return params (n); }
  double operator () (int n) const { return params (n); }

  string_vector get_keys (void) const { return keys; }

  ColumnVector get_vals (void) const { return params; }

  bool set_key (const std::string key, const double& val);

  double get_key (const std::string key);

  void print_info (std::ostream& os, const std::string& prefix) const;
  
 private:
  void init_keys (void);

  ColumnVector params;

  string_vector keys;
};

extern SparseParams Voctave_sparse_controls;

#endif

/*
;;; Local Variables: ***
;;; mode: C++ ***
;;; End: ***
*/