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

#include <QueryTree.h>

Public Member Functions

 Path ()=default
 
auto numNodes () const
 
const auto & nodes () const
 
auto begin () const
 
auto end () const
 
std::shared_ptr< FormulatoFormula () const
 
 Path ()=default
 
auto numNodes () const
 
const auto & nodes () const
 
auto begin () const
 
auto end () const
 
std::shared_ptr< FormulatoFormula () const
 

Protected Attributes

std::vector< FormulaPtrnodes_
 

Friends

class QueryTree
 

Detailed Description

A path in a QueryTree from root of the tree to a leaf.

Definition at line 71 of file QueryTree.h.

Constructor & Destructor Documentation

◆ Path() [1/2]

knowrob::QueryTree::Path::Path ( )
default

◆ Path() [2/2]

knowrob::QueryTree::Path::Path ( )
default

Member Function Documentation

◆ begin() [1/2]

auto knowrob::QueryTree::Path::begin ( ) const
inline
Returns
begin iterator over literals in a path.

Definition at line 88 of file QueryTree.h.

88 { return nodes_.begin(); }
std::vector< FormulaPtr > nodes_
Definition: QueryTree.h:98

◆ begin() [2/2]

auto knowrob::QueryTree::Path::begin ( ) const
inline
Returns
begin iterator over literals in a path.

Definition at line 88 of file QueryTree.h.

88 { return nodes_.begin(); }

◆ end() [1/2]

auto knowrob::QueryTree::Path::end ( ) const
inline
Returns
end iterator over literals in a path.

Definition at line 93 of file QueryTree.h.

93 { return nodes_.end(); }

◆ end() [2/2]

auto knowrob::QueryTree::Path::end ( ) const
inline
Returns
end iterator over literals in a path.

Definition at line 93 of file QueryTree.h.

93 { return nodes_.end(); }

◆ nodes() [1/2]

const auto& knowrob::QueryTree::Path::nodes ( ) const
inline
Returns
list of literals

Definition at line 83 of file QueryTree.h.

83 { return nodes_; }

◆ nodes() [2/2]

const auto& knowrob::QueryTree::Path::nodes ( ) const
inline
Returns
list of literals

Definition at line 83 of file QueryTree.h.

83 { return nodes_; }

◆ numNodes() [1/2]

auto knowrob::QueryTree::Path::numNodes ( ) const
inline
Returns
number of literals in this path

Definition at line 78 of file QueryTree.h.

78 { return nodes_.size(); }

◆ numNodes() [2/2]

auto knowrob::QueryTree::Path::numNodes ( ) const
inline
Returns
number of literals in this path

Definition at line 78 of file QueryTree.h.

78 { return nodes_.size(); }

◆ toFormula() [1/2]

std::shared_ptr< Formula > QueryTree::Path::toFormula ( ) const

Definition at line 200 of file QueryTree.cpp.

200  {
201  if (nodes_.empty()) {
202  return Top::get();
203  } else if (nodes_.size() == 1) {
204  return nodes_.front();
205  } else {
206  return std::make_shared<Conjunction>(nodes_);
207  }
208 }
static const std::shared_ptr< Top > & get()
Definition: Top.cpp:11

◆ toFormula() [2/2]

std::shared_ptr<Formula> knowrob::QueryTree::Path::toFormula ( ) const

Friends And Related Function Documentation

◆ QueryTree

QueryTree
friend

Definition at line 100 of file QueryTree.h.

Member Data Documentation

◆ nodes_

std::vector< FormulaPtr > knowrob::QueryTree::Path::nodes_
protected

Definition at line 98 of file QueryTree.h.


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