diff options
| author | 2011-06-28 19:09:31 -0700 | |
|---|---|---|
| committer | 2011-06-29 15:05:41 -0700 | |
| commit | 698c0873cf2e07bdc7fd1e72169aee2a19fa40d7 (patch) | |
| tree | cf1a8a26a6568ad5dd1fa30d238b9651e09d3800 /include/utils | |
| parent | 0748907d6a9a052fe54541cd7f6ec66b998fec3b (diff) | |
SF transactions are now O(1) wrt IPC instead of O(N).
Change-Id: I57669852cbf6aabae244ea86940a08a5a27ffc43
Diffstat (limited to 'include/utils')
| -rw-r--r-- | include/utils/SortedVector.h | 2 | ||||
| -rw-r--r-- | include/utils/Vector.h | 26 |
2 files changed, 27 insertions, 1 deletions
diff --git a/include/utils/SortedVector.h b/include/utils/SortedVector.h index 8beec57320..0e98aeb05f 100644 --- a/include/utils/SortedVector.h +++ b/include/utils/SortedVector.h @@ -32,6 +32,8 @@ namespace android { template <class TYPE> class SortedVector : private SortedVectorImpl { + friend class Vector<TYPE>; + public: typedef TYPE value_type; diff --git a/include/utils/Vector.h b/include/utils/Vector.h index f1e87e6090..b908e2ab2e 100644 --- a/include/utils/Vector.h +++ b/include/utils/Vector.h @@ -29,6 +29,9 @@ namespace android { +template <typename TYPE> +class SortedVector; + /*! * The main templated vector class ensuring type safety * while making use of VectorImpl. @@ -47,13 +50,17 @@ public: Vector(); Vector(const Vector<TYPE>& rhs); + explicit Vector(const SortedVector<TYPE>& rhs); virtual ~Vector(); /*! copy operator */ const Vector<TYPE>& operator = (const Vector<TYPE>& rhs) const; Vector<TYPE>& operator = (const Vector<TYPE>& rhs); - /* + const Vector<TYPE>& operator = (const SortedVector<TYPE>& rhs) const; + Vector<TYPE>& operator = (const SortedVector<TYPE>& rhs); + + /* * empty the vector */ @@ -215,6 +222,11 @@ Vector<TYPE>::Vector(const Vector<TYPE>& rhs) } template<class TYPE> inline +Vector<TYPE>::Vector(const SortedVector<TYPE>& rhs) + : VectorImpl(static_cast<const VectorImpl&>(rhs)) { +} + +template<class TYPE> inline Vector<TYPE>::~Vector() { finish_vector(); } @@ -227,6 +239,18 @@ Vector<TYPE>& Vector<TYPE>::operator = (const Vector<TYPE>& rhs) { template<class TYPE> inline const Vector<TYPE>& Vector<TYPE>::operator = (const Vector<TYPE>& rhs) const { + VectorImpl::operator = (static_cast<const VectorImpl&>(rhs)); + return *this; +} + +template<class TYPE> inline +Vector<TYPE>& Vector<TYPE>::operator = (const SortedVector<TYPE>& rhs) { + VectorImpl::operator = (static_cast<const VectorImpl&>(rhs)); + return *this; +} + +template<class TYPE> inline +const Vector<TYPE>& Vector<TYPE>::operator = (const SortedVector<TYPE>& rhs) const { VectorImpl::operator = (rhs); return *this; } |