chNDArray.h

Go to the documentation of this file.
00001 /*
00002 
00003 Copyright (C) 2003-2012 John W. Eaton
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_charNDArray_h)
00024 #define octave_charNDArray_h 1
00025 
00026 #include "Array.h"
00027 #include "chMatrix.h"
00028 
00029 #include "mx-defs.h"
00030 #include "mx-op-decl.h"
00031 #include "bsxfun-decl.h"
00032 
00033 class
00034 OCTAVE_API
00035 charNDArray : public Array<char>
00036 {
00037 public:
00038 
00039   typedef charMatrix matrix_type;
00040 
00041   charNDArray (void) : Array<char> () { }
00042 
00043   charNDArray (const dim_vector& dv) : Array<char> (dv) { }
00044 
00045   charNDArray (const dim_vector& dv, char val) : Array<char> (dv, val) { }
00046 
00047   charNDArray (const charNDArray& a) : Array<char> (a) { }
00048 
00049   charNDArray (const charMatrix& a) : Array<char> (a) { }
00050 
00051   charNDArray (char c) : Array<char> (charMatrix (c)) { }
00052 
00053   charNDArray (const char *s) : Array<char> (charMatrix (s)) { }
00054 
00055   charNDArray (const std::string& s) : Array<char> (charMatrix (s)) { }
00056 
00057   charNDArray (const string_vector& s) : Array<char> (charMatrix (s)) { }
00058 
00059   charNDArray (const Array<char>& a) : Array<char> (a) { }
00060 
00061   charNDArray& operator = (const charNDArray& a)
00062     {
00063       Array<char>::operator = (a);
00064       return *this;
00065     }
00066 
00067   bool any_element_is_nan (void) const { return false; }
00068 
00069   // FIXME -- this is not quite the right thing.
00070 
00071   boolNDArray all (int dim = -1) const;
00072   boolNDArray any (int dim = -1) const;
00073   charNDArray concat (const charNDArray& rb, const Array<octave_idx_type>& ra_idx);
00074   charNDArray concat (const NDArray& rb, const Array<octave_idx_type>& ra_idx);
00075 
00076   charNDArray& insert (const charNDArray& a, octave_idx_type r, octave_idx_type c);
00077   charNDArray& insert (const charNDArray& a, const Array<octave_idx_type>& ra_idx);
00078 
00079   charMatrix matrix_value (void) const;
00080 
00081   charNDArray squeeze (void) const { return Array<char>::squeeze (); }
00082 
00083   static void increment_index (Array<octave_idx_type>& ra_idx,
00084                                const dim_vector& dimensions,
00085                                int start_dimension = 0);
00086 
00087   static octave_idx_type compute_index (Array<octave_idx_type>& ra_idx,
00088                             const dim_vector& dimensions);
00089 
00090   // i/o
00091 
00092   // friend std::ostream& operator << (std::ostream& os, const charNDArray& a);
00093   // friend std::istream& operator >> (std::istream& is, charNDArray& a);
00094 
00095   static char resize_fill_value (void) { return '\0'; }
00096 
00097   charNDArray diag (octave_idx_type k = 0) const;
00098 
00099 };
00100 
00101 NDS_CMP_OP_DECLS (charNDArray, char, OCTAVE_API)
00102 NDS_BOOL_OP_DECLS (charNDArray, char, OCTAVE_API)
00103 
00104 SND_CMP_OP_DECLS (char, charNDArray, OCTAVE_API)
00105 SND_BOOL_OP_DECLS (char, charNDArray, OCTAVE_API)
00106 
00107 NDND_CMP_OP_DECLS (charNDArray, charNDArray, OCTAVE_API)
00108 NDND_BOOL_OP_DECLS (charNDArray, charNDArray, OCTAVE_API)
00109 
00110 BSXFUN_STDREL_DECLS (charNDArray, OCTAVE_API)
00111 
00112 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines