home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / octave-1.1.1p1-base.tgz / octave-1.1.1p1-base.tar / fsf / octave / src / oct-obj.h < prev    next >
C/C++ Source or Header  |  1995-01-03  |  3KB  |  119 lines

  1. // oct-obj.h                                            -*- C -*-
  2. /*
  3.  
  4. Copyright (C) 1994, 1995 John W. Eaton
  5.  
  6. This file is part of Octave.
  7.  
  8. Octave is free software; you can redistribute it and/or modify it
  9. under the terms of the GNU General Public License as published by the
  10. Free Software Foundation; either version 2, or (at your option) any
  11. later version.
  12.  
  13. Octave is distributed in the hope that it will be useful, but WITHOUT
  14. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  15. FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  16. for more details.
  17.  
  18. You should have received a copy of the GNU General Public License
  19. along with Octave; see the file COPYING.  If not, write to the Free
  20. Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  
  22. */
  23.  
  24. #if !defined (octave_oct_obj_h)
  25. #define octave_oct_obj_h 1
  26.  
  27. #include "Array.h"
  28. #include "mx-base.h"
  29.  
  30. class tree_constant;
  31. class Matrix;
  32. class RowVector;
  33. class ColumnVector;
  34. class DiagMatrix;
  35. class ComplexMatrix;
  36. class ComplexRowVector;
  37. class ComplexColumnVector;
  38. class ComplexDiagMatrix;
  39. class Range;
  40.  
  41. class
  42. Octave_object : public Array<tree_constant>
  43. {
  44. public:
  45.  
  46.   Octave_object (void) : Array<tree_constant> () { }
  47.   Octave_object (int n, const tree_constant& val)
  48.     : Array<tree_constant> (n, val) { }
  49.  
  50.   Octave_object (const tree_constant& tc) : Array<tree_constant> (1, tc) { }
  51.  
  52.   Octave_object (double d);
  53.   Octave_object (const Matrix& m);
  54.   Octave_object (const DiagMatrix& d);
  55.   Octave_object (const RowVector& v, int pcv = -1);
  56.   Octave_object (const ColumnVector& v, int pcv = -1);
  57.  
  58.   Octave_object (const Complex& c);
  59.   Octave_object (const ComplexMatrix& m);
  60.   Octave_object (const ComplexDiagMatrix& d);
  61.   Octave_object (const ComplexRowVector& v, int pcv = -1);
  62.   Octave_object (const ComplexColumnVector& v, int pcv = -1);
  63.  
  64.   Octave_object (const char *s);
  65.  
  66.   Octave_object (double base, double limit, double inc);
  67.   Octave_object (const Range& r);
  68.  
  69.   Octave_object (const Octave_object& obj) : Array<tree_constant> (obj) { }
  70.  
  71.   Octave_object& operator = (const Octave_object& obj)
  72.     {
  73.       Array<tree_constant>::operator = (obj);
  74.       return *this;
  75.     }
  76.  
  77. // Assignment will resize on range errors.
  78.  
  79.   tree_constant& operator () (int n);
  80.  
  81.   tree_constant operator () (int n) const;
  82.  
  83. private:
  84.  
  85. // This constructor is private with no definition to keep statements
  86. // like
  87. //
  88. //   Octave_object foo = 5;
  89. //   Octave_object foo = 5.0;
  90. //
  91. // from doing different things.  Instead, you have to use the
  92. // constructor
  93. //
  94. //   Octave_object (n, val);
  95. //
  96. // and supply a default value to create a vector-valued Octave_object.
  97.  
  98.   Octave_object (int n);
  99.  
  100.   void maybe_resize (int n);
  101.  
  102.   tree_constant& elem (int n);
  103.   tree_constant& checkelem (int n);
  104.  
  105.   tree_constant& xelem (int n);
  106.  
  107.   tree_constant elem (int n) const;
  108.   tree_constant checkelem (int n) const;
  109. };
  110.  
  111. #endif
  112.  
  113. /*
  114. ;;; Local Variables: ***
  115. ;;; mode: C++ ***
  116. ;;; page-delimiter: "^/\\*" ***
  117. ;;; End: ***
  118. */
  119.