Octave-Forge - Extra packages for GNU Octave | |
Home · Packages · Developers · Documentation · FAQ · Bugs · Mailing Lists · Links · Code |
00001 /* 00002 00003 Copyright (C) 2008 Jaroslav Hajek 00004 00005 This file is part of Octave. 00006 00007 Octave is free software; you can redistribute it and/or modify it 00008 under the terms of the GNU General Public License as published by the 00009 Free Software Foundation; either version 3 of the License, or (at your 00010 option) any later version. 00011 00012 Octave is distributed in the hope that it will be useful, but WITHOUT 00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00014 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00015 for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with Octave; see the file COPYING. If not, see 00019 <http://www.gnu.org/licenses/>. 00020 00021 */ 00022 00023 #if !defined (octave_null_matrix_h) 00024 #define octave_null_matrix_h 1 00025 00026 #include "ov.h" 00027 #include "ov-re-mat.h" 00028 #include "ov-str-mat.h" 00029 00030 // Design rationale: 00031 // The constructors are hidden. There is only one null matrix (or null string) object, 00032 // that can have shallow copies. Cloning the object returns just a normal empty matrix, 00033 // so all the shallow copies are, in fact, read-only. This conveniently ensures that any 00034 // attempt to fiddle with the null matrix destroys its special status. 00035 00036 // The special [] value. 00037 00038 class 00039 OCTINTERP_API 00040 octave_null_matrix : public octave_matrix 00041 { 00042 octave_null_matrix (void) : octave_matrix () { } 00043 00044 public: 00045 00046 static const octave_value instance; 00047 00048 bool is_null_value (void) const { return true; } 00049 00050 type_conv_info numeric_conversion_function (void) const; 00051 00052 private: 00053 00054 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA 00055 }; 00056 00057 // The special "" value 00058 00059 class 00060 OCTINTERP_API 00061 octave_null_str : public octave_char_matrix_str 00062 { 00063 octave_null_str (void) : octave_char_matrix_str () { } 00064 00065 public: 00066 00067 static const octave_value instance; 00068 00069 bool is_null_value (void) const { return true; } 00070 00071 type_conv_info numeric_conversion_function (void) const; 00072 00073 00074 private: 00075 00076 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA 00077 }; 00078 00079 // The special '' value 00080 00081 class 00082 OCTINTERP_API 00083 octave_null_sq_str : public octave_char_matrix_sq_str 00084 { 00085 octave_null_sq_str (void) : octave_char_matrix_sq_str () { } 00086 00087 public: 00088 00089 static const octave_value instance; 00090 00091 bool is_null_value (void) const { return true; } 00092 00093 type_conv_info numeric_conversion_function (void) const; 00094 00095 private: 00096 00097 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA 00098 }; 00099 00100 #endif