forked from project-chip/connectedhomeip
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/common storage class (project-chip#23409)
* Moved structures from group data that could be re-used in scenes in a comon location: PersistentData.h * Refactored the name of Iterator class to CommonIterator Co-authored-by: Andrei Litvin <andy314@gmail.com>
- Loading branch information
Showing
6 changed files
with
268 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* | ||
* Copyright (c) 2022 Project CHIP Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/** | ||
* @file | ||
* Contains a standard iterator class. | ||
*/ | ||
|
||
#pragma once | ||
|
||
namespace chip { | ||
|
||
/** | ||
* Template used to generate a custom iterator | ||
*/ | ||
template <typename T> | ||
class CommonIterator | ||
{ | ||
public: | ||
virtual ~CommonIterator() = 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 iterator goes out of scope in the iterator was dynamically allocated. | ||
*/ | ||
virtual void Release() = 0; | ||
|
||
protected: | ||
CommonIterator() = default; | ||
}; | ||
|
||
} // namespace chip |
Oops, something went wrong.