Qucs-core  0.0.19
sweep.h
Go to the documentation of this file.
00001 /*
00002  * sweep.h - variable sweep class definitions
00003  *
00004  * Copyright (C) 2004, 2008 Stefan Jahn <stefan@lkcc.org>
00005  *
00006  * This is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2, or (at your option)
00009  * any later version.
00010  *
00011  * This software is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this package; see the file COPYING.  If not, write to
00018  * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
00019  * Boston, MA 02110-1301, USA.
00020  *
00021  * $Id$
00022  *
00023  */
00024 
00025 #ifndef __SWEEP_H__
00026 #define __SWEEP_H__
00027 
00028 namespace qucs {
00029 
00030 enum sweep_type {
00031   SWEEP_UNKNOWN = -1, // not yet defined
00032   SWEEP_CONSTANT,     // constant value
00033   SWEEP_LINEAR,       // linear
00034   SWEEP_LOGARITHMIC,  // logarithmic
00035   SWEEP_LIST          // list of values
00036 };
00037 
00038 class object;
00039 
00040 class sweep : public object
00041 {
00042  public:
00043   sweep ();
00044   sweep (const std::string&);
00045   sweep (sweep &);
00046   ~sweep ();
00047   int getSize (void) { return size; }
00048   int getType (void) { return type; }
00049   nr_double_t get (int);
00050   nr_double_t next (void);
00051   nr_double_t prev (void);
00052   void set (int, nr_double_t);
00053   void setSize (int);
00054   char * toString (void);
00055   void reverse (void);
00056   void reset (void) { counter = 0; };
00057   object * getParent (void) { return parent; }
00058   void setParent (object * p) { parent = p; }
00059 
00060  protected:
00061   int type;
00062 
00063  private:
00064   nr_double_t * data;
00065   int size;
00066   char * txt;
00067   int counter;
00068   object * parent;
00069 };
00070 
00071 class linsweep : public sweep
00072 {
00073  public:
00074   linsweep ();
00075   linsweep (const std::string &);
00076   ~linsweep ();
00077   void create (nr_double_t, nr_double_t, int);
00078 };
00079 
00080 class logsweep : public sweep
00081 {
00082  public:
00083   logsweep ();
00084   logsweep (const std::string &);
00085   ~logsweep ();
00086   void create (nr_double_t, nr_double_t, int);
00087 };
00088 
00089 class consweep : public sweep
00090 {
00091  public:
00092   consweep ();
00093   consweep (const std::string &);
00094   ~consweep ();
00095   void create (nr_double_t);
00096 };
00097 
00098 class lstsweep : public sweep
00099 {
00100  public:
00101   lstsweep ();
00102   lstsweep (const std::string &);
00103   ~lstsweep ();
00104   void create (int);
00105 };
00106 
00107 } // namespace qucs
00108 
00109 #endif /* __SWEEP_H__ */