00001 //---------------------------------------------------------------------- 00002 // The Motion Strategy Library (MSL) 00003 //---------------------------------------------------------------------- 00004 // 00005 // Copyright (c) 1998-2000 Iowa State University and Steve LaValle. 00006 // All Rights Reserved. 00007 // 00008 // Permission to use, copy, and distribute this software and its 00009 // documentation is hereby granted free of charge, provided that 00010 // (1) it is not a component of a commercial product, and 00011 // (2) this notice appears in all copies of the software and 00012 // related documentation. 00013 // 00014 // Iowa State University and the author make no representations 00015 // about the suitability or fitness of this software for any purpose. 00016 // It is provided "as is" without express or implied warranty. 00017 //---------------------------------------------------------------------- 00018 00019 #ifndef MSL_MARRAY_H 00020 #define MSL_MARRAY_H 00021 00022 #include <LEDA/array.h> 00023 00024 #include <LEDA/REDEFINE_NAMES.h> 00025 00027 00028 template<class E> class MultiArray { 00030 array<E> A; 00031 00033 array<int> Offsets; 00034 00036 array<int> Dimensions; 00037 00039 int Dimension; 00040 00042 int Size; 00043 00044 public: 00046 int MaxSize; 00047 00049 MultiArray(const array<int> &dims, const E &x); 00050 00052 MultiArray(const array<int> &dims); 00053 00055 MultiArray() {}; 00056 ~MultiArray() {}; 00057 00059 inline E& operator[](const array<int> &indices); 00060 00062 friend istream& operator>> (istream &is, MultiArray &ma) 00063 { is >> ma.A; return is; } 00064 00066 friend ostream& operator<< (ostream &os, const MultiArray &ma) 00067 { os << ma.A; return os; } 00068 }; 00069 00070 00071 #include <LEDA/UNDEFINE_NAMES.h> 00072 00073 #endif