summaryrefslogtreecommitdiff
path: root/ace/Vector_T.cpp
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>2002-01-19 17:28:45 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>2002-01-19 17:28:45 +0000
commit117b280ef91102b246605babd59e4e3d3349809c (patch)
tree3d129967648a10944839a013f00b21c85792264b /ace/Vector_T.cpp
parentdab619fdcf1e701a63cb839ed18b5530c77fd880 (diff)
downloadATCD-117b280ef91102b246605babd59e4e3d3349809c.tar.gz
ChangeLogTag:Sat Jan 19 10:23:39 2002 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu>
Diffstat (limited to 'ace/Vector_T.cpp')
-rw-r--r--ace/Vector_T.cpp122
1 files changed, 122 insertions, 0 deletions
diff --git a/ace/Vector_T.cpp b/ace/Vector_T.cpp
new file mode 100644
index 00000000000..7241c182642
--- /dev/null
+++ b/ace/Vector_T.cpp
@@ -0,0 +1,122 @@
+// $Id$
+
+#ifndef ACE_VECTOR_T_C
+#define ACE_VECTOR_T_C
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Vector_T.h"
+
+#if !defined (__ACE_INLINE__)
+#include "ace/Vector_T.i"
+#endif /* __ACE_INLINE__ */
+
+ACE_RCSID(ace, Vector_T, "$Id$")
+
+ACE_ALLOC_HOOK_DEFINE(ACE_Vector)
+
+template <class T, const size_t DEFAULT_SIZE>
+void ACE_Vector<T, DEFAULT_SIZE>::resize (const size_t new_size,
+ const T& t)
+{
+ ACE_Array<T>::size (new_size);
+ if (new_size > length_)
+ for (size_t i = length_ - 1; i < new_size; ++i)
+ (*this)[i]=t;
+
+ curr_max_size_ = this->max_size ();
+ length_ = new_size;
+}
+
+template <class T, const size_t DEFAULT_SIZE>
+void ACE_Vector<T, DEFAULT_SIZE>::push_back (const T& elem)
+{
+ if (length_ == curr_max_size_)
+ {
+ ACE_Array<T>::size (curr_max_size_ * 2);
+ curr_max_size_ = this->max_size ();
+ }
+ ++length_;
+ (*this)[length_-1] = elem;
+}
+
+template <class T, const size_t DEFAULT_SIZE>
+void ACE_Vector<T, DEFAULT_SIZE>::dump (void) const
+{
+ for (size_t i; i < size(); ++i)
+ (*this)[i]->dump();
+}
+
+#if 0
+template<class T>
+bool compare(const ACE_Vector<T>& v1,
+ const ACE_Vector<T>& v2,
+ const size_t from_ndx,
+ const size_t to_ndx)
+{
+ size_t last1 = v1.size () - 1;
+ size_t last2 = v2.size () - 1;
+ if(last1 < from_ndx || last1 < to_ndx)
+ {
+ return false;
+ }
+ if (last2 < from_ndx || last2 < to_ndx)
+ {
+ return false;
+ }
+ if (last1 != last2)
+ {
+ return false;
+ }
+
+ // cout<<"compare() <================="<<endl;
+ for (size_t i = from_ndx; i <= to_ndx; ++i)
+ {
+ // cout<<"V1["<<i<<"]="<<v1[i];
+ // cout<<", V2["<<i<<"]="<<v2[i];
+ // cout<<": NOT EQUAL == "<<(v1[i]!=v2[i])<<endl;
+ if (v1[i] != v2[i])
+ {
+ return false;
+ }
+ }
+ // cout<<"compare() ====================>"<<endl;
+ return true;
+}
+
+template<class T>
+bool partial_compare(const ACE_Vector<T>& v1,
+ const ACE_Vector<T>& v2,
+ const size_t from_ndx,
+ const size_t to_ndx)
+{
+ size_t last1 = v1.size () - 1;
+ size_t last2 = v2.size () - 1;
+ if (last1 < from_ndx || last1 < to_ndx)
+ {
+ return false;
+ }
+ if (last2 < from_ndx || last2 < to_ndx)
+ {
+ return false;
+ }
+ // cout<<"partial_compare() <================="<<endl;
+ for (size_t i = from_ndx; i <= to_ndx; ++i)
+ {
+ // cout<<"V1["<<i<<"]="<<v1[i];
+ // cout<<", V2["<<i<<"]="<<v2[i];
+ // cout<<": NOT EQUAL == "<<(v1[i]!=v2[i])<<endl;
+ if (v1[i] != v2[i])
+ {
+ return false;
+ }
+ }
+ // cout<<"partial_compare() ====================>"<<endl;
+ return true;
+}
+#endif
+
+#endif /* ACE_VECTOR_T_C */
+