[6916] Fixed typos in spell checking code.
[getmangos.git] / dep / ACE_wrappers / ace / Vector_T.cpp
blob006e6db1b4a697bb3868cb87461219fb54331c57
1 // $Id: Vector_T.cpp 80826 2008-03-04 14:51:23Z wotte $
3 #ifndef ACE_VECTOR_T_CPP
4 #define ACE_VECTOR_T_CPP
6 #if !defined (ACE_LACKS_PRAGMA_ONCE)
7 # pragma once
8 #endif /* ACE_LACKS_PRAGMA_ONCE */
10 #include "ace/Vector_T.h"
12 #if !defined (__ACE_INLINE__)
13 #include "ace/Vector_T.inl"
14 #endif /* __ACE_INLINE__ */
16 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
18 ACE_ALLOC_HOOK_DEFINE(ACE_Vector)
20 template <class T, size_t DEFAULT_SIZE>
21 void ACE_Vector<T, DEFAULT_SIZE>::resize (const size_t new_size,
22 const T& t)
24 ACE_Array<T>::size (new_size);
25 if (new_size > length_)
26 for (size_t i = length_; i < new_size; ++i)
27 (*this)[i]=t;
29 curr_max_size_ = this->max_size ();
30 length_ = new_size;
33 template <class T, size_t DEFAULT_SIZE>
34 void ACE_Vector<T, DEFAULT_SIZE>::push_back (const T& elem)
36 if (length_ == curr_max_size_)
38 ACE_Array<T>::size (curr_max_size_ * 2);
39 curr_max_size_ = this->max_size ();
41 else
42 ACE_Array<T>::size (length_ + 1);
44 ++length_;
45 (*this)[length_-1] = elem;
48 template <class T, size_t DEFAULT_SIZE>
49 void ACE_Vector<T, DEFAULT_SIZE>::dump (void) const
51 #if defined (ACE_HAS_DUMP)
52 #if 0
53 // Can't do this unless the vector is an object with a dump
54 // function.
55 for (size_t i = 0; i < this->size (); ++i)
56 (*this)[i].dump ();
57 #endif /* 0 */
58 #endif /* ACE_HAS_DUMP */
61 // Compare this vector with <s> for equality.
62 template <class T, size_t DEFAULT_SIZE> bool
63 ACE_Vector<T, DEFAULT_SIZE>::operator== (const ACE_Vector<T, DEFAULT_SIZE> &s) const
65 if (this == &s)
66 return true;
67 else if (this->size () != s.size ())
68 return false;
70 const size_t len = s.size ();
71 for (size_t slot = 0; slot < len; ++slot)
72 if ((*this)[slot] != s[slot])
73 return false;
75 return true;
78 #if 0
79 template<class T>
80 int compare(const ACE_Vector<T>& v1,
81 const ACE_Vector<T>& v2,
82 const size_t from_ndx,
83 const size_t to_ndx)
85 size_t last1 = v1.size () - 1;
86 size_t last2 = v2.size () - 1;
87 if (last1 < from_ndx || last1 < to_ndx)
88 return false;
89 if (last2 < from_ndx || last2 < to_ndx)
90 return false;
91 if (last1 != last2)
92 return false;
94 // cout<<"compare() <================="<<endl;
95 for (size_t i = from_ndx; i <= to_ndx; ++i)
96 // cout<<"V1["<<i<<"]="<<v1[i];
97 // cout<<", V2["<<i<<"]="<<v2[i];
98 // cout<<": NOT EQUAL == "<<(v1[i]!=v2[i])<<endl;
99 if (v1[i] != v2[i])
100 return false;
102 // cout<<"compare() ====================>"<<endl;
103 return true;
106 template<class T>
107 int partial_compare(const ACE_Vector<T>& v1,
108 const ACE_Vector<T>& v2,
109 const size_t from_ndx,
110 const size_t to_ndx)
112 size_t last1 = v1.size () - 1;
113 size_t last2 = v2.size () - 1;
115 if (last1 < from_ndx || last1 < to_ndx)
116 return false;
117 if (last2 < from_ndx || last2 < to_ndx)
118 return false;
120 // cout<<"partial_compare() <================="<<endl;
121 for (size_t i = from_ndx; i <= to_ndx; ++i)
122 // cout<<"V1["<<i<<"]="<<v1[i];
123 // cout<<", V2["<<i<<"]="<<v2[i];
124 // cout<<": NOT EQUAL == "<<(v1[i]!=v2[i])<<endl;
125 if (v1[i] != v2[i])
126 return false;
128 // cout<<"partial_compare() ====================>"<<endl;
129 return true;
131 #endif
133 // ****************************************************************
135 template <class T, size_t DEFAULT_SIZE> int
136 ACE_Vector_Iterator<T, DEFAULT_SIZE>::next (T *&item)
138 // ACE_TRACE ("ACE_Vector_Iterator<T>::next");
140 if (this->done ())
142 item = 0;
143 return 0;
145 else
147 item = &vector_[current_];
148 return 1;
152 ACE_END_VERSIONED_NAMESPACE_DECL
154 #endif /* ACE_VECTOR_T_CPP */