From 38014a888ed1a64d4ef3b18a703717f7c9764ad3 Mon Sep 17 00:00:00 2001 From: lpbeliveau-silabs Date: Wed, 9 Nov 2022 10:12:53 -0500 Subject: [PATCH] Refactored the name of Iterator class to CommonIterator --- src/credentials/GroupDataProvider.h | 40 +++---------------- .../support/{Iterator.h => CommonIterator.h} | 6 +-- 2 files changed, 9 insertions(+), 37 deletions(-) rename src/lib/support/{Iterator.h => CommonIterator.h} (93%) diff --git a/src/credentials/GroupDataProvider.h b/src/credentials/GroupDataProvider.h index e56dd30d3ba3ce..9b694d82c3a7a6 100644 --- a/src/credentials/GroupDataProvider.h +++ b/src/credentials/GroupDataProvider.h @@ -25,7 +25,7 @@ #include #include #include -#include +#include namespace chip { namespace Credentials { @@ -187,39 +187,11 @@ class GroupDataProvider virtual void OnGroupRemoved(FabricIndex fabric_index, const GroupInfo & old_group) = 0; }; - /** - * Template used to iterate the stored group data - */ - template - class Iterator - { - public: - virtual ~Iterator() = default; - /** - * @retval The number of entries in total that will be iterated. - */ - virtual size_t Count() = 0; - /** - * @param[out] item Value associated with the next element in the iteration. - * @retval true if the next entry is successfully retrieved. - * @retval false if no more entries can be found. - */ - virtual bool Next(T & item) = 0; - /** - * Release the memory allocated by this iterator. - * Must be called before the pointer goes out of scope. - */ - virtual void Release() = 0; - - protected: - Iterator() = default; - }; - - using GroupInfoIterator = Iterator; - using GroupKeyIterator = Iterator; - using EndpointIterator = Iterator; - using KeySetIterator = Iterator; - using GroupSessionIterator = Iterator; + using GroupInfoIterator = CommonIterator; + using GroupKeyIterator = CommonIterator; + using EndpointIterator = CommonIterator; + using KeySetIterator = CommonIterator; + using GroupSessionIterator = CommonIterator; GroupDataProvider(uint16_t maxGroupsPerFabric = CHIP_CONFIG_MAX_GROUPS_PER_FABRIC, uint16_t maxGroupKeysPerFabric = CHIP_CONFIG_MAX_GROUP_KEYS_PER_FABRIC) : diff --git a/src/lib/support/Iterator.h b/src/lib/support/CommonIterator.h similarity index 93% rename from src/lib/support/Iterator.h rename to src/lib/support/CommonIterator.h index 2ce9624f0426ef..689625aa292a94 100644 --- a/src/lib/support/Iterator.h +++ b/src/lib/support/CommonIterator.h @@ -28,10 +28,10 @@ namespace chip { * Template used to generate a custom iterator */ template -class Iterator +class CommonIterator { public: - virtual ~Iterator() = default; + virtual ~CommonIterator() = default; /** * @retval The number of entries in total that will be iterated. */ @@ -49,7 +49,7 @@ class Iterator virtual void Release() = 0; protected: - Iterator() = default; + CommonIterator() = default; }; } // namespace chip