6 #ifndef KNOWROB_TRIPLE_CONTAINER_H
7 #define KNOWROB_TRIPLE_CONTAINER_H
9 #include <boost/iterator/iterator_facade.hpp>
14 #include "knowrob/semweb/Triple.h"
22 class TripleContainer {
33 struct iterator : boost::iterator_facade<iterator, const TriplePtr, boost::forward_traversal_tag> {
35 : generator_(generator), ptr_(generator_()) {
62 return iterator([] {
return nullptr; });
97 struct iterator : boost::iterator_facade<iterator, TriplePtr, boost::forward_traversal_tag> {
99 : generator_(std::move(
generator)), ptr_(generator_()) {
124 return iterator([] {
return nullptr; });
139 class ProxyTripleContainer :
public TripleContainer {
149 const std::vector<TriplePtr> *
triples_;
185 std::vector<TriplePtr>
data_;
bool isMutable() const override
virtual MutableGenerator generator()=0
std::function< TriplePtr *()> MutableGenerator
const std::vector< TriplePtr > * triples_
const std::vector< TriplePtr > triplesData_
ConstGenerator cgenerator() const override
ProxyTripleContainer(const std::vector< TriplePtr > *triples)
ProxyTripleContainer(const std::vector< TriplePtr > &triples)
virtual ~TripleContainer()=default
virtual bool isMutable() const
std::function< const TriplePtr *()> ConstGenerator
virtual ConstGenerator cgenerator() const =0
TripleViewBatch(uint32_t batchSize)
std::vector< TriplePtr > data_
void add(const TriplePtr &triple)
ConstGenerator cgenerator() const override
MutableGenerator generator() override
FunctionRule & function()
std::function< void(const TriplePtr &)> TripleVisitor
std::function< void(const MutableTripleContainerPtr &)> MutableTripleHandler
std::shared_ptr< TripleContainer > TripleContainerPtr
std::function< bool(const Triple &)> TripleFilter
std::shared_ptr< MutableTripleContainer > MutableTripleContainerPtr
std::function< void(const TripleContainerPtr &)> TripleHandler
iterator(MutableGenerator generator)
TriplePtr & dereference() const
bool equal(iterator const &other) const
iterator(const ConstGenerator &generator)
const TriplePtr & dereference() const
bool equal(iterator const &other) const