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

#include <TriplePattern.h>

Inheritance diagram for knowrob::TriplePatternContainer:
Collaboration diagram for knowrob::TriplePatternContainer:

Public Member Functions

 TriplePatternContainer ()=default
 
 ~TriplePatternContainer ()
 
 TriplePatternContainer (const TriplePatternContainer &other)=delete
 
void push_back (const TriplePatternPtr &q)
 
ConstGenerator cgenerator () const override
 
MutableGenerator generator () override
 
 TriplePatternContainer ()=default
 
 ~TriplePatternContainer ()
 
 TriplePatternContainer (const TriplePatternContainer &other)=delete
 
void push_back (const TriplePatternPtr &q)
 
ConstGenerator cgenerator () const override
 
MutableGenerator generator () override
 
- Public Member Functions inherited from knowrob::MutableTripleContainer
iterator begin ()
 
bool isMutable () const override
 
iterator begin ()
 
bool isMutable () const override
 
- Public Member Functions inherited from knowrob::TripleContainer
virtual ~TripleContainer ()=default
 
iterator begin () const
 
bool empty () const
 
virtual ~TripleContainer ()=default
 
iterator begin () const
 
bool empty () const
 

Protected Attributes

std::vector< TriplePtr * > data_
 
std::vector< TriplePatternPtrstatements_
 

Additional Inherited Members

- Public Types inherited from knowrob::MutableTripleContainer
using MutableGenerator = std::function< TriplePtr *()>
 
using MutableGenerator = std::function< TriplePtr *()>
 
- 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::MutableTripleContainer
static iterator end ()
 
static iterator end ()
 
- Static Public Member Functions inherited from knowrob::TripleContainer
static iterator end ()
 
static iterator end ()
 

Detailed Description

A container that maps a vector of framed triple patterns into a vector of framed triples.

Definition at line 288 of file TriplePattern.h.

Constructor & Destructor Documentation

◆ TriplePatternContainer() [1/4]

knowrob::TriplePatternContainer::TriplePatternContainer ( )
default

◆ ~TriplePatternContainer() [1/2]

TriplePatternContainer::~TriplePatternContainer ( )

Definition at line 408 of file TriplePattern.cpp.

408  {
409  for (auto d: data_) {
410  delete d;
411  }
412 }
std::vector< TriplePtr * > data_

◆ TriplePatternContainer() [2/4]

knowrob::TriplePatternContainer::TriplePatternContainer ( const TriplePatternContainer other)
delete

◆ TriplePatternContainer() [3/4]

knowrob::TriplePatternContainer::TriplePatternContainer ( )
default

◆ ~TriplePatternContainer() [2/2]

knowrob::TriplePatternContainer::~TriplePatternContainer ( )

◆ TriplePatternContainer() [4/4]

knowrob::TriplePatternContainer::TriplePatternContainer ( const TriplePatternContainer other)
delete

Member Function Documentation

◆ cgenerator() [1/2]

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

Implements knowrob::TripleContainer.

Definition at line 425 of file TriplePattern.cpp.

425  {
426  return [this, i = std::size_t(0)]() mutable -> const TriplePtr * {
427  if (i < data_.size()) return data_[i++];
428  return nullptr;
429  };
430 }

◆ cgenerator() [2/2]

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

Implements knowrob::TripleContainer.

◆ generator() [1/2]

MutableTripleContainer::MutableGenerator TriplePatternContainer::generator ( )
overridevirtual
Returns
a generator function that returns a pointer to a triple.

Implements knowrob::MutableTripleContainer.

Definition at line 432 of file TriplePattern.cpp.

432  {
433  return [this, i = std::size_t(0)]() mutable -> TriplePtr * {
434  if (i < data_.size()) return data_[i++];
435  return nullptr;
436  };
437 }

◆ generator() [2/2]

MutableGenerator knowrob::TriplePatternContainer::generator ( )
overridevirtual
Returns
a generator function that returns a pointer to a triple.

Implements knowrob::MutableTripleContainer.

◆ push_back() [1/2]

void TriplePatternContainer::push_back ( const TriplePatternPtr q)
Parameters
qa triple query.

Definition at line 414 of file TriplePattern.cpp.

414  {
415  statements_.emplace_back(q);
416  auto data = new TriplePtr;
417  data_.push_back(data);
418  data->ptr = new TripleView();
419  data->owned = true;
420  if (!q->instantiateInto(*data->ptr)) {
421  data_.pop_back();
422  }
423 }
std::vector< TriplePatternPtr > statements_
TripleTemplate< std::string_view > TripleView
Definition: Triple.h:581

◆ push_back() [2/2]

void knowrob::TriplePatternContainer::push_back ( const TriplePatternPtr q)
Parameters
qa triple query.

Member Data Documentation

◆ data_

std::vector< TriplePtr * > knowrob::TriplePatternContainer::data_
protected

Definition at line 308 of file TriplePattern.h.

◆ statements_

std::vector< TriplePatternPtr > knowrob::TriplePatternContainer::statements_
protected

Definition at line 309 of file TriplePattern.h.


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