OmniSciDB  bf83d84833
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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

void advance (AdvancingMode mode)
 
bool allVisited ()
 
const ElementTypeoperator* ()
 
const ElementTypeoperator-> ()
 

Public Attributes

RANodeIterator(const Container
&nodes) 
for (const auto &node:nodes)
 
return non_zero_count
 

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 1424 of file RelAlgDagBuilder.cpp.

Member Typedef Documentation

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

Definition at line 1427 of file RelAlgDagBuilder.cpp.

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

Definition at line 1425 of file RelAlgDagBuilder.cpp.

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

Definition at line 1426 of file RelAlgDagBuilder.cpp.

Member Enumeration Documentation

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

Definition at line 1430 of file RelAlgDagBuilder.cpp.

1430 { DUChain, InOrder };

Member Function Documentation

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

Definition at line 1449 of file RelAlgDagBuilder.cpp.

References CHECK.

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

Definition at line 1489 of file RelAlgDagBuilder.cpp.

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

+ Here is the caller graph for this function:

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

Definition at line 1491 of file RelAlgDagBuilder.cpp.

1491  {
1492  visited_.insert(size_t(*this));
1493  Super& super = *this;
1494  return *super;
1495  }
std::vector< ElementType >::const_iterator Super
const ElementType* anonymous_namespace{RelAlgDagBuilder.cpp}::RANodeIterator::operator-> ( )
inline

Definition at line 1497 of file RelAlgDagBuilder.cpp.

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

Member Data Documentation

RANodeIterator (const Container& nodes) anonymous_namespace{RelAlgDagBuilder.cpp}::RANodeIterator::for(const auto &node:nodes)
inlineexplicit

Definition at line 1435 of file RelAlgDagBuilder.cpp.

1435  : nodes) {
1436  if (node) {
1437  ++non_zero_count;
1438  }
1439  }
const size_t anonymous_namespace{RelAlgDagBuilder.cpp}::RANodeIterator::nodeCount_
private

Definition at line 1501 of file RelAlgDagBuilder.cpp.

return anonymous_namespace{RelAlgDagBuilder.cpp}::RANodeIterator::non_zero_count

Definition at line 1440 of file RelAlgDagBuilder.cpp.

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

Definition at line 1500 of file RelAlgDagBuilder.cpp.

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

Definition at line 1502 of file RelAlgDagBuilder.cpp.


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