00001
00002
00003 #ifndef ACE_VECTOR_T_C
00004 #define ACE_VECTOR_T_C
00005
00006 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00007 # pragma once
00008 #endif
00009
00010 #include "ace/Vector_T.h"
00011
00012 #if !defined (__ACE_INLINE__)
00013 #include "ace/Vector_T.i"
00014 #endif
00015
00016 ACE_RCSID(ace, Vector_T, "$Id: Vector_T.cpp,v 1.1.1.1 2003/02/21 18:36:32 chad Exp $")
00017
00018 ACE_ALLOC_HOOK_DEFINE(ACE_Vector)
00019
00020 template <class T, size_t DEFAULT_SIZE>
00021 void ACE_Vector<T, DEFAULT_SIZE>::resize (const size_t new_size,
00022 const T& t)
00023 {
00024 ACE_Array<T>::size (new_size);
00025 if (new_size > length_)
00026 for (size_t i = length_; i < new_size; ++i)
00027 (*this)[i]=t;
00028
00029 curr_max_size_ = this->max_size ();
00030 length_ = new_size;
00031 }
00032
00033 template <class T, size_t DEFAULT_SIZE>
00034 void ACE_Vector<T, DEFAULT_SIZE>::push_back (const T& elem)
00035 {
00036 if (length_ == curr_max_size_)
00037 {
00038 ACE_Array<T>::size (curr_max_size_ * 2);
00039 curr_max_size_ = this->max_size ();
00040 }
00041 ++length_;
00042 (*this)[length_-1] = elem;
00043 }
00044
00045 template <class T, size_t DEFAULT_SIZE>
00046 void ACE_Vector<T, DEFAULT_SIZE>::dump (void) const
00047 {
00048 #if 0
00049
00050
00051 for (size_t i = 0; i < this->size (); ++i)
00052 (*this)[i].dump ();
00053 #endif
00054 }
00055
00056 #if 0
00057 template<class T>
00058 int compare(const ACE_Vector<T>& v1,
00059 const ACE_Vector<T>& v2,
00060 const size_t from_ndx,
00061 const size_t to_ndx)
00062 {
00063 size_t last1 = v1.size () - 1;
00064 size_t last2 = v2.size () - 1;
00065 if(last1 < from_ndx || last1 < to_ndx)
00066 {
00067 return false;
00068 }
00069 if (last2 < from_ndx || last2 < to_ndx)
00070 {
00071 return false;
00072 }
00073 if (last1 != last2)
00074 {
00075 return false;
00076 }
00077
00078
00079 for (size_t i = from_ndx; i <= to_ndx; ++i)
00080 {
00081
00082
00083
00084 if (v1[i] != v2[i])
00085 {
00086 return false;
00087 }
00088 }
00089
00090 return true;
00091 }
00092
00093 template<class T>
00094 int partial_compare(const ACE_Vector<T>& v1,
00095 const ACE_Vector<T>& v2,
00096 const size_t from_ndx,
00097 const size_t to_ndx)
00098 {
00099 size_t last1 = v1.size () - 1;
00100 size_t last2 = v2.size () - 1;
00101 if (last1 < from_ndx || last1 < to_ndx)
00102 {
00103 return false;
00104 }
00105 if (last2 < from_ndx || last2 < to_ndx)
00106 {
00107 return false;
00108 }
00109
00110 for (size_t i = from_ndx; i <= to_ndx; ++i)
00111 {
00112
00113
00114
00115 if (v1[i] != v2[i])
00116 {
00117 return false;
00118 }
00119 }
00120
00121 return true;
00122 }
00123 #endif
00124
00125 #endif