PLCnext API Documentation
22.9.0.33
|
This class defines a base class for all enumerator implementations and some predefined enumerators as nested classes. More...
#include <Enumerator.hxx>
Classes | |
class | Composite |
Use this class to build a single enumerator by two given enumerator, e.g. to enumerate multiple container/collections or trees. More... | |
class | Empty |
Implements an empty enumerator, that is, the first call of MoveNext() will return false . More... | |
class | StackComposite |
Use this class to build a single enumerator by two given enumerator, e.g. to enumerate multiple container/collections. More... | |
class | StlAdapter |
This class implements an enumerator adapter for STL container based on iterators. More... | |
Public Member Functions | |
Enumerator (void)=default | |
Constructs an Enumerator instance. More... | |
Enumerator (const Enumerator &arg)=default | |
Copy constructor. More... | |
Enumerator & | operator= (const Enumerator &arg)=default |
Assignment operator. More... | |
virtual | ~Enumerator (void)=default |
Destructs this instance and frees all resources. More... | |
virtual bool | MoveNext (void)=0 |
Moves this enumerator to the next position. More... | |
T | GetCurrent (void) override |
Gets the element at the current position. More... | |
Static Public Member Functions | |
static IEnumerator< T >::Ptr | CreateEmpty (void) |
Creates an empty enumerator. More... | |
static IEnumerator< T >::Ptr | CreateComposite (typename IEnumerator< T >::Ptr first, typename IEnumerator< T >::Ptr second) |
Creates a composite enumerator from the two given enumerators, e.g. to enumerate trees easily. More... | |
template<class TIterator > | |
static IEnumerator< T >::Ptr | CreateStlAdapter (TIterator begin, TIterator end) |
Creates an enumerator adapter from the given STL iterators. More... | |
template<class TContainer > | |
static IEnumerator< T >::Ptr | CreateStlAdapter (TContainer &c) |
Creates an enumerator adapter from the given STL container. More... | |
template<class TContainer > | |
static IEnumerator< T >::Ptr | CreateKeysAdapter (TContainer &c) |
Creates an enumerator adapter from the given STL map enumerating the keys. More... | |
template<class TContainer > | |
static IEnumerator< T >::Ptr | CreateKeysAdapter (const TContainer &c) |
Creates an enumerator adapter from the given const STL map enumerating the keys. More... | |
template<class TContainer > | |
static IEnumerator< T >::Ptr | CreateMappedAdapter (TContainer &c) |
Creates an enumerator adapter from the given STL map enumerating the mapped items. More... | |
template<class TContainer > | |
static IEnumerator< T >::Ptr | CreateMappedAdapter (const TContainer &c) |
Creates an enumerator adapter from the given const STL map enumerating the mapped items. More... | |
template<class Predicate > | |
static IEnumerator< T >::Ptr | CreateFilter (typename IEnumerator< T >::Ptr source, Predicate predicate) |
Creates a filtering adapter enumerating only the nodes matching a given predicate. More... | |
template<class SourceEnumerator , class TransformOperation > | |
static IEnumerator< T >::Ptr | CreateTransform (std::shared_ptr< SourceEnumerator > source, TransformOperation transformOp) |
Creates a transforming adapter enumerating applying a transform operation to each element. More... | |
Static Public Attributes | |
static Empty | Null |
A static empty enumerator instance. More... | |
Protected Attributes | |
TCurrent | current |
The current field of this enumerator. | |
Additional Inherited Members | |
![]() | |
typedef std::shared_ptr< IEnumerator > | Ptr |
The smart pointer tpye of this interface. More... | |
![]() | |
IEnumerator (void)=default | |
Constructs an IEnumerator instance. More... | |
virtual | ~IEnumerator (void)=default |
Destructs this instance and frees all resources. More... | |
IEnumerator (const IEnumerator &arg)=default | |
Copies an IEnumerator instance. More... | |
IEnumerator & | operator= (const IEnumerator &arg)=default |
Assigns an IEnumerator instance. More... | |
This class defines a base class for all enumerator implementations and some predefined enumerators as nested classes.
T | The element type of the container or collection, respectively. |
Derive a specialized enumerator implementation by this class to inherit the current
field an its getter operation GetCurrent(). Override the MoveNext() operations to implement specific enumeration logic.
|
default |
Constructs an Enumerator instance.
|
default |
Copy constructor.
arg | The argument to copy. |
|
virtualdefault |
Destructs this instance and frees all resources.
|
inlinestatic |
Creates a composite enumerator from the two given enumerators, e.g. to enumerate trees easily.
first | The first enumerator to create a composite from. |
second | The second enumerator to create a composite from. |
When enumerating trees using this operations, it is possible to traverse them in DFS (depth-first-search) manner or in BFS (breadth-first-search) manner, depending on the order of passed arguments: If the first enumerator is the one of the current node and the second is the new enumerator of the node childs, the tree is enumerated in DFS manner. If the arguments are passed vice-versa, the tree is enumerated in BFS manner.
|
inlinestatic |
Creates an empty enumerator.
|
inlinestatic |
Creates a filtering adapter enumerating only the nodes matching a given predicate.
source | The source enumerator. |
predicate | The predicate to apply to each element of the source. |
Predicate | The type of the predicate to apply to each element. |
|
inlinestatic |
Creates an enumerator adapter from the given const STL map enumerating the keys.
c | The const STL map to enumerate. |
TContainer | The type of the map. |
|
inlinestatic |
Creates an enumerator adapter from the given STL map enumerating the keys.
c | The STL map to enumerate. |
TContainer | The type of the map. |
|
inlinestatic |
Creates an enumerator adapter from the given const STL map enumerating the mapped items.
c | The const STL map to enumerate. |
TContainer | The type of the map. |
|
inlinestatic |
Creates an enumerator adapter from the given STL map enumerating the mapped items.
c | The STL map to enumerate. |
TContainer | The type of the map. |
|
inlinestatic |
Creates an enumerator adapter from the given STL container.
c | The container to enumerate. |
TContainer | The type of the container. |
|
inlinestatic |
Creates an enumerator adapter from the given STL iterators.
begin | The begin iterator of the container to enumerate. |
end | The end iterator of the container to enumerate. |
TIterator | The iterator type of the container. |
|
inlinestatic |
Creates a transforming adapter enumerating applying a transform operation to each element.
source | The source enumerator. |
transformOp | The transform operation to apply to each element of the source. |
SourceEnumerator | The type of the source enumerator. This may differ from the result enumerator. |
TransformOperation | The type of the transform operation. This may be a function, function object or lambda. |
|
inlineoverridevirtual |
Gets the element at the current position.
Depending an the template parameter type of this interface, a reference or even const reference might be returned.
Implements Arp::IEnumerator< T >.
|
pure virtual |
Moves this enumerator to the next position.
false
if the end of the container/collections was reached and the enumerator was not moved, otherwise false
.See comments of interface declaration for more information about this operation.
Implements Arp::IEnumerator< T >.
Implemented in Arp::System::Commons::Configuration::PlaceholderExpression::Enumerator, Arp::Plc::Commons::Meta::TypeSystem::TypeDomain::TypeInfoEnumerator, and Arp::Plc::Commons::Meta::TypeSystem::TypeDefinition::ChildTypeInfoEnumerator.
|
default |
Assignment operator.
arg | The argument to assign to this instance. |
|
static |
A static empty enumerator instance.