PLCnext API Documentation 25.0.2.69
Enumerator.Empty.hxx
1
2//
3// Copyright Phoenix Contact GmbH & Co. KG
4//
6#pragma once
8#include "Arp/Base/Core/Exception.hpp"
9#include "Arp/Base/Core/Detail/Enumerator.hxx"
10#include <stack>
11
12namespace Arp { namespace Base { namespace Core
13{
14
20template<class T>
21class Enumerator<T>::Empty : public IEnumerator<T>
22{
23public: // construction/destruction
24 Empty(void);
25 Empty(const Empty& arg) = delete;
26 Empty(Empty&& arg)noexcept;
27 Empty& operator=(const Empty& arg) = delete;
28 Empty& operator=(Empty&& arg)noexcept;
29 ~Empty(void)override;
30
31public: // overridden operations
32 bool MoveNext(void)override;
33 T GetCurrent(void)override;
34};
35
37// inline methods of class Enumerator<T>::Empty
38
41template<class T>
42inline Enumerator<T>::Empty::Empty(Empty&& arg)noexcept = default;
43
47template<class T>
48inline typename Enumerator<T>::Empty& Enumerator<T>::Empty::operator=(Empty&& arg)noexcept = default;
49
51template<class T>
52inline Enumerator<T>::Empty::~Empty() = default;
53
55template<class T>
56inline Enumerator<T>::Empty::Empty() = default;
57
58// inherited doc
59template<class T>
61{
62 return false;
63}
64
65// inherited doc
66template<class T>
68{
69 throw Exception("Enumerator<T>::Empty::GetCurrent() is not supported by empty enumerators");
70}
71
72// Implementation of factory operation of class Enumerator<T>
73
76template<class T>
78{
79 return std::make_shared<Empty>();
80}
81
82}}} // end of namespace Arp::Base::Core
Implements an empty enumerator, that is, every call to Enumerator<T>::Empty::MoveNext() will return f...
Definition: Enumerator.Empty.hxx:22
Empty & operator=(Empty &&arg) noexcept
Move assignment operator.
bool MoveNext(void) override
Moves this enumerator to the next position.
Definition: Enumerator.Empty.hxx:60
~Empty(void) override
Destructs this instance and frees all resources.
T GetCurrent(void) override
Gets the element at the current position.
Definition: Enumerator.Empty.hxx:67
Empty(Empty &&arg) noexcept
Move constructor.
Empty(void)
Constructs an Enumerator<T>::Empty instance.
This class defines a base class for all enumerator implementations and some predefined enumerators as...
Definition: Enumerator.hxx:24
static IEnumerator< T >::Ptr CreateEmpty(void)
Creates an empty enumerator.
Definition: Enumerator.Empty.hxx:77
T GetCurrent(void) override
Gets the element at the current position.
Definition: Enumerator.hxx:113
This is the base class of all Arp exception classes.
Definition: Exception.hpp:21
Declares the interface of the enumerator pattern, which is leaned on .NET enumerator idiom.
Definition: IEnumerator.hxx:49
virtual bool MoveNext(void)=0
Moves this enumerator to the next position.
std::shared_ptr< IEnumerator > Ptr
The smart pointer type of this interface.
Definition: IEnumerator.hxx:52
Root namespace for the PLCnext API