Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

FcvArray.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Array_Trait_FcvArray_h
00002 #define Impala_Core_Array_Trait_FcvArray_h
00003 
00004 namespace Impala
00005 {
00006 namespace Core
00007 {
00008 namespace Array
00009 {
00010 namespace Trait
00011 {
00012 
00013 // TODO : remove this class
00014 
00015 template <class T>
00016 class FcvArray {
00017 private:
00018     T *ptr;
00019     int nr;
00020     int index;
00021     FcvArray(const FcvArray &);
00022     FcvArray& operator = (const FcvArray &);
00023 public:
00024     FcvArray(int n=1000) : index(0), nr(n) { ptr=new T[nr]; }
00025     ~FcvArray() { delete []ptr; }
00026     void clear() { index=0; }
00027     void push_back(const T &val) { ptr[index++]=val; }
00028     int size() const { return index; }
00029     T & operator [] (int i) { return ptr[i]; }
00030     const T & operator [] (int i) const { return ptr[i]; }
00031     bool empty() const { return index==0; }
00032     //leon added this
00033     bool isThere(const T &val)
00034     {for(int i=0;i<index;i++) if(ptr[i]==val) return true; return false;}
00035     void setSize(int s) { nr=s; ptr=new T[nr]; }
00036     
00037 };
00038 
00039 } // namespace Trait
00040 } // namespace Array
00041 } // namespace Core
00042 } // namespace Impala
00043 
00044 #endif

Generated on Fri Mar 19 09:30:49 2010 for ImpalaSrc by  doxygen 1.5.1