Array.hh
Go to the documentation of this file.
00001 
00005 #ifndef P_ARRAY_HH
00006 #define P_ARRAY_HH
00007 
00008 #include <stdarg.h>
00009 #include <blort/Recognizer3D/PNamespace.hh>
00010 #include <blort/Recognizer3D/Except.hh>
00011 
00012 namespace P
00013 {
00014 
00021 template <class Elem> class Array
00022 {
00023 private:
00024   static const unsigned DEFAULT_SIZE = 10;
00025  
00026   Elem *array;        
00027   unsigned size;      
00028   unsigned capacity;  
00029 
00030   void CheckIndex(unsigned i) const throw(Except);
00031   void EnsureCapacity(unsigned need_size) throw(Except);
00032 
00033 public:
00034   Array(unsigned s = 0) throw(Except);
00035   Array(const Array &a);
00036   ~Array();
00037   Array& operator=(const Array &a) {DeepCopy(a); return *this;}
00038   Elem& operator[](unsigned i);
00039   const Elem& operator[](unsigned i) const;
00040   bool Empty() {return size == 0;}
00041   Elem& First() throw(Except);
00042   const Elem& First() const throw(Except);
00043   Elem& Last() throw(Except);
00044   const Elem& Last() const throw(Except);
00045   void PushFront(const Elem &el);
00046   void PushBack(const Elem &el);
00047   void InsertBefore(unsigned i, const Elem &el);
00048   void InsertAfter(unsigned i, const Elem &el);
00049   void InsertSorted(const Elem &el, int(*compar)(const void *, const void *));
00050   unsigned Size() const {return size;}
00051   void Resize(unsigned new_size);
00052   void Sort(int(*compar)(const void *, const void *));
00053   bool Contains(const Elem &el) const;
00054   bool ContainsBackwards(const Elem &el) const;
00055   unsigned Find(const Elem &el);
00056   unsigned Find(unsigned start, const Elem &el);
00057   unsigned FindBackwards(const Elem &el);
00058   void Swap(unsigned i, unsigned j);
00059   void Set(const Elem &el);
00060   void Clear() {Resize(0);}
00061   void DeepCopy(const Array &a);
00062   unsigned CircularNext(unsigned i);
00063   unsigned CircularPrev(unsigned i);
00064   void Erase(unsigned i);
00065   void EraseFirst();
00066   void EraseLast();
00067   void Reverse();
00068   bool Intersect(const Array &a);
00069   void* Data();
00070 };
00071 
00072 }
00073 
00074 #include "Array.ic"
00075 
00076 #endif
00077 


blort
Author(s): Michael Zillich, Thomas Mörwald, Johann Prankl, Andreas Richtsfeld, Bence Magyar (ROS version)
autogenerated on Thu Jan 2 2014 11:38:25