OmniSciDB  baf940c279
anonymous_namespace{RelAlgDagBuilder.cpp}::RANodeIterator Class Reference
+ Inheritance diagram for anonymous_namespace{RelAlgDagBuilder.cpp}::RANodeIterator:
+ Collaboration diagram for anonymous_namespace{RelAlgDagBuilder.cpp}::RANodeIterator:

Public Types

enum  AdvancingMode { AdvancingMode::DUChain, AdvancingMode::InOrder }
 

Public Member Functions

 RANodeIterator (const Container &nodes)
 
 operator size_t ()
 
RANodeIterator operator++ ()=delete
 
void advance (AdvancingMode mode)
 
bool allVisited ()
 
const ElementTypeoperator* ()
 
const ElementTypeoperator-> ()
 

Private Types

using ElementType = std::shared_ptr< RelAlgNode >
 
using Super = std::vector< ElementType >::const_iterator
 
using Container = std::vector< ElementType >
 

Private Attributes

const Containerowner_
 
const size_t nodeCount_
 
std::unordered_set< size_t > visited_
 

Detailed Description

Definition at line 1422 of file RelAlgDagBuilder.cpp.

Member Typedef Documentation

◆ Container

using anonymous_namespace{RelAlgDagBuilder.cpp}::RANodeIterator::Container = std::vector<ElementType>
private

Definition at line 1425 of file RelAlgDagBuilder.cpp.

◆ ElementType

using anonymous_namespace{RelAlgDagBuilder.cpp}::RANodeIterator::ElementType = std::shared_ptr<RelAlgNode>
private

Definition at line 1423 of file RelAlgDagBuilder.cpp.

◆ Super

using anonymous_namespace{RelAlgDagBuilder.cpp}::RANodeIterator::Super = std::vector<ElementType>::const_iterator
private

Definition at line 1424 of file RelAlgDagBuilder.cpp.

Member Enumeration Documentation

◆ AdvancingMode

enum anonymous_namespace{RelAlgDagBuilder.cpp}::RANodeIterator::AdvancingMode
strong
Enumerator
DUChain 
InOrder 

Definition at line 1428 of file RelAlgDagBuilder.cpp.

1428 { DUChain, InOrder };

Constructor & Destructor Documentation

◆ RANodeIterator()

anonymous_namespace{RelAlgDagBuilder.cpp}::RANodeIterator::RANodeIterator ( const Container nodes)
inlineexplicit

Definition at line 1430 of file RelAlgDagBuilder.cpp.

1431  : Super(nodes.begin()), owner_(nodes), nodeCount_([&nodes]() -> size_t {
1432  size_t non_zero_count = 0;
1433  for (const auto& node : nodes) {
1434  if (node) {
1435  ++non_zero_count;
1436  }
1437  }
1438  return non_zero_count;
1439  }()) {}
std::vector< ElementType >::const_iterator Super

Member Function Documentation

◆ advance()

void anonymous_namespace{RelAlgDagBuilder.cpp}::RANodeIterator::advance ( AdvancingMode  mode)
inline

Definition at line 1447 of file RelAlgDagBuilder.cpp.

References CHECK.

1447  {
1448  Super& super = *this;
1449  switch (mode) {
1450  case AdvancingMode::DUChain: {
1451  size_t use_count = 0;
1452  Super only_use = owner_.end();
1453  for (Super nodeIt = std::next(super); nodeIt != owner_.end(); ++nodeIt) {
1454  if (!*nodeIt) {
1455  continue;
1456  }
1457  for (size_t i = 0; i < (*nodeIt)->inputCount(); ++i) {
1458  if ((*super) == (*nodeIt)->getAndOwnInput(i)) {
1459  ++use_count;
1460  if (1 == use_count) {
1461  only_use = nodeIt;
1462  } else {
1463  super = owner_.end();
1464  return;
1465  }
1466  }
1467  }
1468  }
1469  super = only_use;
1470  break;
1471  }
1473  for (size_t i = 0; i != owner_.size(); ++i) {
1474  if (!visited_.count(i)) {
1475  super = owner_.begin();
1476  std::advance(super, i);
1477  return;
1478  }
1479  }
1480  super = owner_.end();
1481  break;
1482  default:
1483  CHECK(false);
1484  }
1485  }
std::vector< ElementType >::const_iterator Super
#define CHECK(condition)
Definition: Logger.h:197

◆ allVisited()

bool anonymous_namespace{RelAlgDagBuilder.cpp}::RANodeIterator::allVisited ( )
inline

Definition at line 1487 of file RelAlgDagBuilder.cpp.

Referenced by anonymous_namespace{RelAlgDagBuilder.cpp}::coalesce_nodes().

+ Here is the caller graph for this function:

◆ operator size_t()

anonymous_namespace{RelAlgDagBuilder.cpp}::RANodeIterator::operator size_t ( )
inlineexplicit

Definition at line 1441 of file RelAlgDagBuilder.cpp.

1441  {
1442  return std::distance(owner_.begin(), *static_cast<Super*>(this));
1443  }
std::vector< ElementType >::const_iterator Super

◆ operator*()

const ElementType& anonymous_namespace{RelAlgDagBuilder.cpp}::RANodeIterator::operator* ( )
inline

Definition at line 1489 of file RelAlgDagBuilder.cpp.

1489  {
1490  visited_.insert(size_t(*this));
1491  Super& super = *this;
1492  return *super;
1493  }
std::vector< ElementType >::const_iterator Super

◆ operator++()

RANodeIterator anonymous_namespace{RelAlgDagBuilder.cpp}::RANodeIterator::operator++ ( )
delete

◆ operator->()

const ElementType* anonymous_namespace{RelAlgDagBuilder.cpp}::RANodeIterator::operator-> ( )
inline

Definition at line 1495 of file RelAlgDagBuilder.cpp.

1495 { return &(operator*()); }

Member Data Documentation

◆ nodeCount_

const size_t anonymous_namespace{RelAlgDagBuilder.cpp}::RANodeIterator::nodeCount_
private

Definition at line 1499 of file RelAlgDagBuilder.cpp.

◆ owner_

const Container& anonymous_namespace{RelAlgDagBuilder.cpp}::RANodeIterator::owner_
private

Definition at line 1498 of file RelAlgDagBuilder.cpp.

◆ visited_

std::unordered_set<size_t> anonymous_namespace{RelAlgDagBuilder.cpp}::RANodeIterator::visited_
private

Definition at line 1500 of file RelAlgDagBuilder.cpp.


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