Main Page Namespace List Compound List File List Namespace Members Compound Members File Members

# tnt_array2d.h

Go to the documentation of this file.

    00001 /*
    00002 *
    00003 * Template Numerical Toolkit (TNT)
    00004 *
    00005 * Mathematical and Computational Sciences Division
    00006 * National Institute of Technology,
    00007 * Gaithersburg, MD USA
    00008 *
    00009 *
    00010 * This software was developed at the National Institute of Standards and
    00011 * Technology (NIST) by employees of the Federal Government in the course
    00012 * of their official duties. Pursuant to title 17 Section 105 of the
    00013 * United States Code, this software is not subject to copyright protection
    00014 * and is in the public domain. NIST assumes no responsibility whatsoever for
    00015 * its use by other parties, and makes no guarantees, expressed or implied,
    00016 * about its quality, reliability, or any other characteristic.
    00017 *
    00018 */
    00019
    00020
    00021
    00022 #ifndef TNT_ARRAY2D_INTERFACE_H
    00023 #define TNT_ARRAY2D_INTERFACE_H
    00024
    00025 #include <cstdlib>
    00026 #include <iostream>
    00027 #ifdef TNT_BOUNDS_CHECK
    00028 #include <assert.h>
    00029 #endif
    00030
    00031
    00032 namespace TNT
    00033 {
    00034
    00059 template <class T>
    00060 class Array2D
    00061 {
    00062
    00063
    00064   private:
    00065
    00066         /* define private members here */
    00067
    00068
    00069
    00070
    00071   public:
    00072
    00086     typedef         T   value_type;
    00087
    00092                Array2D();
    00093
    00094
    00101                Array2D(int m, int n);
    00102
    00103
    00104
    00116                Array2D(int m, int n,  T *a);
    00117
    00118
    00128                Array2D(int m, int n, const T &a);
    00129
    00130
    00131
    00132
    00145     inline Array2D(const Array2D &A);
    00146
    00147
    00148
    00149
    00169 inline operator T**();
    00170
    00171
    00172
    00192 inline operator const T**();
    00193
    00194
    00198         inline Array2D & operator=(const T &a);
    00199
    00200
    00204         inline Array2D & operator=(const Array2D &A);
    00205
    00206
    00207
    00218         inline Array2D & ref(const Array2D &A);
    00219
    00220
    00221
    00228                Array2D copy() const;
    00229
    00230
    00231
    00255                    Array2D & inject(const Array2D & A);
    00256
    00257
    00269         inline T* operator[](int i);
    00270         inline const T* operator[](int i) const;
    00271
    00276         inline int dim1() const;
    00277
    00278
    00283         inline int dim2() const;
    00284
    00291      ~Array2D();
    00292
    00293
    00294
    00295
    00296
    00297 };
    00298
    00299
    00300
    00301
    00302
    00303 } /* namespace TNT */
    00304
    00305 #endif
    00306 /* TNT_ARRAY2D_INTERFACE_H */
    00307