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

# tnt_array1d.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_ARRAY1D_H
    00023 #define TNT_ARRAY1D_H
    00024
    00025 #include <cstdlib>
    00026 #include <iostream>
    00027
    00028 #ifdef TNT_BOUNDS_CHECK
    00029 #include <assert.h>
    00030 #endif
    00031
    00032
    00033
    00034
    00035 namespace TNT
    00036 {
    00037
    00061 template <class T>
    00062 class Array1D
    00063 {
    00064
    00065   private:
    00066
    00067           /* Define private data members here. */
    00068
    00069   public:
    00070
    00071     typedef         T   value_type;
    00072
    00077
    00078                  Array1D();
    00079
    00080
    00092         explicit Array1D(int n);
    00093
    00094
    00095
    00096
    00105                  Array1D(int n, const T &a);
    00106
    00107
    00117                  Array1D(int n,  T *a);
    00118
    00119
    00126     inline   Array1D(const Array1D &A);
    00127
    00128
    00129
    00130
    00150         inline operator T*();
    00151
    00171         inline operator const T*();
    00172
    00173
    00177         inline   Array1D & operator=(const T &a);
    00178
    00179
    00183         inline   Array1D & operator=(const Array1D &A);
    00184
    00185
    00196         inline   Array1D & ref(const Array1D &A);
    00197
    00198
    00205                  Array1D copy() const;
    00206
    00207
    00208
    00232                      Array1D & inject(const Array1D & A);
    00233
    00234
    00240         inline   T& operator[](int i);
    00241
    00247         inline   const T& operator[](int i) const;
    00248
    00249
    00254         inline   int dim1() const;
    00255
    00260         inline   int dim() const;
    00261
    00262
    00266                ~Array1D();
    00267
    00268
    00269 /* EXTEND INTERFACE: ADD OTHER FUNCTIONS HERE */
    00270
    00271 };
    00272
    00273
    00274 } /* namespace TNT */
    00275
    00276 #endif
    00277 /* TNT_ARRAY1D_H */
    00278