knowrob  2.1.0
A Knowledge Base System for Cognition-enabled Robots
knowrob::ProxyTripleContainer Class Reference

#include <TripleContainer.h>

Inheritance diagram for knowrob::ProxyTripleContainer:
Collaboration diagram for knowrob::ProxyTripleContainer:

Public Member Functions

 ProxyTripleContainer (const std::vector< TriplePtr > *triples)
 
 ProxyTripleContainer (const std::vector< TriplePtr > &triples)
 
ConstGenerator cgenerator () const override
 
 ProxyTripleContainer (const std::vector< TriplePtr > *triples)
 
 ProxyTripleContainer (const std::vector< TriplePtr > &triples)
 
ConstGenerator cgenerator () const override
 
- Public Member Functions inherited from knowrob::TripleContainer
virtual ~TripleContainer ()=default
 
iterator begin () const
 
bool empty () const
 
virtual bool isMutable () const
 
virtual ~TripleContainer ()=default
 
iterator begin () const
 
bool empty () const
 
virtual bool isMutable () const
 

Protected Attributes

const std::vector< TriplePtr > * triples_
 
const std::vector< TriplePtrtriplesData_
 

Additional Inherited Members

- Public Types inherited from knowrob::TripleContainer
using ConstGenerator = std::function< const TriplePtr *()>
 
using ConstGenerator = std::function< const TriplePtr *()>
 
- Static Public Member Functions inherited from knowrob::TripleContainer
static iterator end ()
 
static iterator end ()
 

Detailed Description

A triple container that loops over a pointer of a vector of framed triples.

Definition at line 139 of file TripleContainer.h.

Constructor & Destructor Documentation

◆ ProxyTripleContainer() [1/4]

ProxyTripleContainer::ProxyTripleContainer ( const std::vector< TriplePtr > *  triples)
explicit

Definition at line 11 of file TripleContainer.cpp.

12  : triples_(triples) {
13 }
const std::vector< TriplePtr > * triples_

◆ ProxyTripleContainer() [2/4]

ProxyTripleContainer::ProxyTripleContainer ( const std::vector< TriplePtr > &  triples)
explicit

Definition at line 15 of file TripleContainer.cpp.

16  : triples_(&triplesData_), triplesData_(triples) {
17  // take the ownership of the triples
18  for (uint32_t i = 0; i < triples.size(); ++i) {
19  if (triples[i].owned) {
20  triplesData_[i].owned = true;
21  triples[i].owned = false;
22  }
23  }
24 }
const std::vector< TriplePtr > triplesData_

◆ ProxyTripleContainer() [3/4]

knowrob::ProxyTripleContainer::ProxyTripleContainer ( const std::vector< TriplePtr > *  triples)
explicit

◆ ProxyTripleContainer() [4/4]

knowrob::ProxyTripleContainer::ProxyTripleContainer ( const std::vector< TriplePtr > &  triples)
explicit

Member Function Documentation

◆ cgenerator() [1/2]

TripleContainer::ConstGenerator ProxyTripleContainer::cgenerator ( ) const
overridevirtual
Returns
a generator function that returns a const pointer to a triple.

Implements knowrob::TripleContainer.

Definition at line 26 of file TripleContainer.cpp.

26  {
27  return [it = triples_->begin(), end = triples_->end()]()
28  mutable -> const TriplePtr * {
29  if (it == end) {
30  return nullptr;
31  }
32  auto &ptr = *it;
33  ++it;
34  return &ptr;
35  };
36 }
static iterator end()

◆ cgenerator() [2/2]

ConstGenerator knowrob::ProxyTripleContainer::cgenerator ( ) const
overridevirtual
Returns
a generator function that returns a const pointer to a triple.

Implements knowrob::TripleContainer.

Member Data Documentation

◆ triples_

const std::vector< TriplePtr > * knowrob::ProxyTripleContainer::triples_
protected

Definition at line 149 of file TripleContainer.h.

◆ triplesData_

const std::vector< TriplePtr > knowrob::ProxyTripleContainer::triplesData_
protected

Definition at line 150 of file TripleContainer.h.


The documentation for this class was generated from the following files: