GCC Code Coverage Report


Directory: codebase/
File: codebase/interface/include/public/api.Iterable.hpp
Date: 2023-03-16 04:37:09
Exec Total Coverage
Lines: 1 1 100.0%
Functions: 2 2 100.0%
Branches: 0 0 -%

Line Branch Exec Source
1 /**
2 * @file api.Iterable.hpp
3 * @author Sergey Baigudin, sergey@baigudin.software
4 * @copyright 2016-2022, Sergey Baigudin, Baigudin Software
5 */
6 #ifndef API_ITERABLE_HPP_
7 #define API_ITERABLE_HPP_
8
9 #include "api.Object.hpp"
10 #include "api.Iterator.hpp"
11
12 namespace eoos
13 {
14 namespace api
15 {
16
17 /**
18 * @class Iterable<T>
19 * @brief Iterable interface.
20 *
21 * @tparam T Data type of element.
22 */
23 template <typename T>
24 class Iterable : public Object
25 {
26
27 public:
28
29 /**
30 * @brief Destructor.
31 */
32 virtual ~Iterable() = 0;
33
34 /**
35 * @brief Returns an iterator of elements.
36 *
37 * @note Either the delete operator must be called for returned value when
38 * the iterating of a collection has been completed, or returned raw pointer
39 * assigned to a smart pointer.
40 *
41 * @note Modification of the list by the list functions is not desirable
42 * if operability of the returned iterator has to be.
43 *
44 * @return Pointer to new iterator.
45 *
46 * @todo Declare constant function to satisfy MISRA-C++:2008 Rule 9–3–1
47 */
48 virtual Iterator<T>* getIterator() = 0;
49
50 };
51
52 template <typename T> ///< SCA MISRA-C++:2008 Defected Rule 7-3-1
53 152 inline Iterable<T>::~Iterable() {}
54
55 } // namespace api
56 } // namespace eoos
57 #endif // API_ITERABLE_HPP_
58