8#include "Arp/Base/Core/Exception.hpp" 
    9#include "Arp/Base/Core/Detail/Enumerator.hxx" 
   11namespace Arp { 
namespace Base { 
namespace Core
 
   17template<
class Predicate>
 
   22    Filter(
const Filter& arg) = 
delete;
 
   43template<
class Predicate>
 
   50template<
class Predicate>
 
   55template<
class Predicate>
 
   62template<
class Predicate>
 
   64    : source(
std::move(source)), filter(
std::move(filter))
 
   68        throw Exception(
"Enumerator<T>::Filter<Predicate>::Filter(): Argument 'source' is null.");
 
   74template<
class Predicate>
 
   77    while (this->source->MoveNext())
 
   79        if (this->filter(this->source->GetCurrent()))
 
   89template<
class Predicate>
 
   92    return this->source->GetCurrent();
 
  103template<
class Predicate>
 
  106    return std::make_shared<Enumerator<T>::Filter<Predicate>>(std::move(source), std::move(filter));
 
This class implements a filtering enumerator. It enumerates all nodes of the source enumerator matchi...
Definition: Enumerator.Filter.hxx:19
 
Filter(Filter &&arg) noexcept
Move constructor.
 
~Filter(void) override
Destructs this instance and frees all resources.
 
Filter & operator=(Filter &&arg) noexcept
Move assignment operator.
 
This class defines a base class for all enumerator implementations and some predefined enumerators as...
Definition: Enumerator.hxx:24
 
static IEnumerator< T >::Ptr CreateFilter(typename IEnumerator< T >::Ptr source, Predicate predicate)
Creates a filtering adapter enumerating only the nodes matching a given predicate.
Definition: Enumerator.Filter.hxx:104
 
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
 
Namespace of the C++ standard library