OmniSciDB  85c2d10cdc
 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 1428 of file RelAlgDagBuilder.cpp.

Member Typedef Documentation

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

Definition at line 1431 of file RelAlgDagBuilder.cpp.

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

Definition at line 1429 of file RelAlgDagBuilder.cpp.

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

Definition at line 1430 of file RelAlgDagBuilder.cpp.

Member Enumeration Documentation

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

Definition at line 1434 of file RelAlgDagBuilder.cpp.

1434 { DUChain, InOrder };

Member Function Documentation

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

Definition at line 1453 of file RelAlgDagBuilder.cpp.

References CHECK, and i.

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

Definition at line 1493 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 1495 of file RelAlgDagBuilder.cpp.

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

Definition at line 1501 of file RelAlgDagBuilder.cpp.

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

Member Data Documentation

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

Definition at line 1439 of file RelAlgDagBuilder.cpp.

1439  : nodes) {
1440  if (node) {
1441  ++non_zero_count;
1442  }
1443  }
const size_t anonymous_namespace{RelAlgDagBuilder.cpp}::RANodeIterator::nodeCount_
private

Definition at line 1505 of file RelAlgDagBuilder.cpp.

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

Definition at line 1444 of file RelAlgDagBuilder.cpp.

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

Definition at line 1504 of file RelAlgDagBuilder.cpp.

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

Definition at line 1506 of file RelAlgDagBuilder.cpp.


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