memgraph/include/utils/iterator/iterator_base.hpp

40 lines
757 B
C++
Raw Normal View History

#pragma once
2016-08-30 12:29:30 +08:00
#include "utils/iterator/count.hpp"
#include "utils/option.hpp"
2016-08-30 12:29:30 +08:00
class EdgeType;
// Base iterator for next() kind iterator.
// T - type of return value
template <class T>
class IteratorBase
{
public:
2016-08-28 22:47:13 +08:00
virtual ~IteratorBase(){};
virtual Option<T> next() = 0;
2016-08-30 12:29:30 +08:00
virtual Count count() { return Count(0, ~((size_t)0)); }
template <class OP>
auto map(OP &&op);
template <class OP>
auto filter(OP &&op);
// Maps with call to method to() and filters with call to fill.
auto to();
// Filters with call to method fill()
auto fill();
// Filters with type
template <class TYPE>
auto type(TYPE const &type);
// For all items calls OP.
template <class OP>
void for_all(OP &&op);
};