From 67b585149111b68afc250fec978620687892bb67 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Thu, 2 Aug 2012 18:32:23 -0700 Subject: [PATCH] We now have a real list of displays. displays can be dynamically added or removed, and the list is part of the SF's transaction. Change-Id: I4186ea39f1317c0e7c044f869004017738968fab --- include/utils/KeyedVector.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/include/utils/KeyedVector.h b/include/utils/KeyedVector.h index 20575ee3e..47c2c56de 100644 --- a/include/utils/KeyedVector.h +++ b/include/utils/KeyedVector.h @@ -56,7 +56,10 @@ public: inline size_t capacity() const { return mVector.capacity(); } //! setst the capacity. capacity can never be reduced less than size() inline ssize_t setCapacity(size_t size) { return mVector.setCapacity(size); } - + + // returns true if the arguments is known to be identical to this vector + inline bool isIdenticalTo(const KeyedVector& rhs) const; + /*! * accessors */ @@ -64,6 +67,7 @@ public: const VALUE& valueAt(size_t index) const; const KEY& keyAt(size_t index) const; ssize_t indexOfKey(const KEY& key) const; + const VALUE& operator[] (size_t index) const; /*! * modifying the array @@ -122,6 +126,11 @@ KeyedVector::KeyedVector() { } +template inline +bool KeyedVector::isIdenticalTo(const KeyedVector& rhs) const { + return mVector.array() == rhs.mVector.array(); +} + template inline ssize_t KeyedVector::indexOfKey(const KEY& key) const { return mVector.indexOf( key_value_pair_t(key) ); @@ -139,6 +148,11 @@ const VALUE& KeyedVector::valueAt(size_t index) const { return mVector.itemAt(index).value; } +template inline +const VALUE& KeyedVector::operator[] (size_t index) const { + return valueAt(index); +} + template inline const KEY& KeyedVector::keyAt(size_t index) const { return mVector.itemAt(index).key;