ORIGINAL
Loading...
Searching...
No Matches
transformStream.h
Go to the documentation of this file.
1#ifndef TRANSFORMSTREAM_H
2#define TRANSFORMSTREAM_H
3
10
11#include "transform.h"
12#include "chain.h"
13#include "refCntPtr.h"
14
15
16namespace original {
17
28 template<typename TYPE>
31
37 void pushEnd(const transform<TYPE>& t);
38
39 protected:
44 explicit transformStream();
45
46 public:
51 void operator()(TYPE& t);
52
56 ~transformStream() = default;
57
64
71
72 // Friend operators for stream construction
77 template<typename T>
79
84 template<typename T>
86 };
87
95 template<typename T>
97
105 template <typename T>
107}
108
109 template<typename TYPE>
111
112 template<typename TYPE>
113 auto original::transformStream<TYPE>::pushEnd(const transform<TYPE>& t) -> void
114 {
115 this->stream.pushEnd(strongPtr<transform<TYPE>>(t.clone()));
116 }
117
118 template<typename TYPE>
120 for (auto& transform : this->stream) {
121 (*transform)(t);
122 }
123 }
124
125 template <typename TYPE>
127 {
128 this->pushEnd(t);
129 return *this;
130 }
131
132 template <typename TYPE>
134 {
135 for (auto& transform: ts.stream)
136 {
137 this->pushEnd(*transform);
138 }
139 return *this;
140 }
141
142 template<typename TYPE>
145 ts + t1;
146 ts + t2;
147 return ts;
148 }
149
150 template <typename TYPE>
151 auto original::operator+(const transform<TYPE>& t, const transformStream<TYPE>& ots) -> transformStream<TYPE>
152 {
153 transformStream<TYPE> ts;
154 ts + t;
155 ts + ots;
156 return ts;
157 }
158
159#endif // TRANSFORMSTREAM_H
Non-cyclic doubly linked list implementation.
Non-cyclic doubly linked list container.
Definition chain.h:36
Shared ownership smart pointer with strong references.
Definition refCntPtr.h:100
Ordered sequence of transformation operations.
Definition transformStream.h:29
friend transformStream< T > operator+(const transform< T > &t, const transformStream< T > &ots)
Creates new stream from transformation and existing stream.
~transformStream()=default
Virtual destructor for the transformStream class.
transformStream & operator+(const transform< TYPE > &t)
Appends single transformation to stream.
Definition transformStream.h:126
friend transformStream< T > operator+(const transform< T > &t1, const transform< T > &t2)
Creates new stream from two transformations.
void operator()(TYPE &t)
Applies all transformations sequentially.
Definition transformStream.h:119
transformStream()
Protected constructor for factory pattern.
Definition transformStream.h:110
Base class for transformation operations.
Definition transform.h:28
Main namespace for the project Original.
Definition algorithms.h:21
auto operator+(const iterator< T > &it, integer steps) -> iterator< T > *
Adds a number of steps to the iterator's current position and returns a new iterator.
Reference-counted smart pointer hierarchy.
Transformation classes for various operations on elements.