Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

marray.h

Go to the documentation of this file.
00001 //----------------------------------------------------------------------
00002 //               The Motion Strategy Library (MSL)
00003 //----------------------------------------------------------------------
00004 //
00005 // Copyright (c) University of Illinois and Steven M. 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 // The University of Illinois 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 #ifdef WIN32
00023         #include <vector>
00024         using namespace std;
00025 #else
00026         #include <vector.h>
00027 #endif
00028 
00029 #include "mslio.h"
00030 
00032 
00033 template<class E> class MultiArray {
00035   vector<E> A;
00036 
00038   vector<int> Offsets;
00039 
00041   vector<int> Dimensions;
00042 
00044   int Dimension;
00045 
00047   int Size;
00048 
00049  public:
00051   int MaxSize;
00052   
00054   MultiArray(const vector<int> &dims, const E &x);
00055 
00057   MultiArray(const vector<int> &dims);
00058 
00060   MultiArray() {};
00061   ~MultiArray() {};
00062 
00064   inline E& operator[](const vector<int> &indices);
00065 
00067   inline bool Increment(vector<int> &indices);
00068 
00070   friend istream& operator>> (istream &is, MultiArray &ma) 
00071     { is >> ma.A; return is; }
00072 
00074   friend ostream& operator<< (ostream &os, const MultiArray &ma)
00075     { os << ma.A; return os; }
00076 };
00077 
00078  
00079 #endif
Motion Strategy Library


Web page maintained by Steve LaValle
Partial support provided by NSF CAREER Award IRI-970228 (LaValle), Honda Research.
Contributors: Anna Atramentov, Peng Cheng, James Kuffner, Steve LaValle, and Libo Yang.