-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathIterator.hpp
84 lines (76 loc) · 2.73 KB
/
Iterator.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/* =============================================================================
* Vader Modular Fuzzer (VMF)
* Copyright (c) 2021-2024 The Charles Stark Draper Laboratory, Inc.
* <vmf@draper.com>
*
* Effort sponsored by the U.S. Government under Other Transaction number
* W9124P-19-9-0001 between AMTC and the Government. The U.S. Government
* Is authorized to reproduce and distribute reprints for Governmental purposes
* notwithstanding any copyright notation thereon.
*
* The views and conclusions contained herein are those of the authors and
* should not be interpreted as necessarily representing the official policies
* or endorsements, either expressed or implied, of the U.S. Government.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 (only) as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @license GPL-2.0-only <https://spdx.org/licenses/GPL-2.0-only.html>
* ===========================================================================*/
#pragma once
#include "Iterator.hpp"
namespace vmf
{
/**
* @brief Enables iterating through a set of StorageEntries retrieved from the StorageModule
* Each implementation of StorageModule should provide a companion implementation of Iterator.
*
*/
class Iterator
{
public:
/**
* @brief Get the Next object
*
* @return StorageEntry* The next storage entry
*/
virtual StorageEntry* getNext() = 0;
/**
* @brief Returns true if there are more elements in the iterator
*
* @return true if there are more elements
* @return false otherwise
*/
virtual bool hasNext() = 0;
/**
* @brief Returns the total number of elements in the iterator
*
* @return int the size
*/
virtual int getSize() = 0;
/**
* @brief Returns the storage entry at this index
* This call advances the iterator to this position. Subsequent calls
* to getNext and hasNext will be relative to this position.
*
* @param index the index to go to (0 to getSize()-1)
* @return StorageEntry* the storage entry at this index
*/
virtual StorageEntry* setIndexTo(int index) = 0;
/**
* @brief Resets the iterator to the starting position
*
*/
virtual void resetIndex() = 0;
virtual ~Iterator() {};
};
}