OmniSciDB  04ee39c94c
anonymous_namespace{RelAlgAbstractInterpreter.cpp}::RANodeIterator Class Reference
+ Inheritance diagram for anonymous_namespace{RelAlgAbstractInterpreter.cpp}::RANodeIterator:
+ Collaboration diagram for anonymous_namespace{RelAlgAbstractInterpreter.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 1103 of file RelAlgAbstractInterpreter.cpp.

Member Typedef Documentation

◆ Container

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

Definition at line 1106 of file RelAlgAbstractInterpreter.cpp.

◆ ElementType

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

Definition at line 1104 of file RelAlgAbstractInterpreter.cpp.

◆ Super

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

Definition at line 1105 of file RelAlgAbstractInterpreter.cpp.

Member Enumeration Documentation

◆ AdvancingMode

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

Definition at line 1109 of file RelAlgAbstractInterpreter.cpp.

1109 { DUChain, InOrder };

Constructor & Destructor Documentation

◆ RANodeIterator()

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

Definition at line 1111 of file RelAlgAbstractInterpreter.cpp.

1112  : Super(nodes.begin()), owner_(nodes), nodeCount_([&nodes]() -> size_t {
1113  size_t non_zero_count = 0;
1114  for (const auto& node : nodes) {
1115  if (node) {
1116  ++non_zero_count;
1117  }
1118  }
1119  return non_zero_count;
1120  }()) {}

Member Function Documentation

◆ advance()

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

Definition at line 1128 of file RelAlgAbstractInterpreter.cpp.

References CHECK.

1128  {
1129  Super& super = *this;
1130  switch (mode) {
1131  case AdvancingMode::DUChain: {
1132  size_t use_count = 0;
1133  Super only_use = owner_.end();
1134  for (Super nodeIt = std::next(super); nodeIt != owner_.end(); ++nodeIt) {
1135  if (!*nodeIt) {
1136  continue;
1137  }
1138  for (size_t i = 0; i < (*nodeIt)->inputCount(); ++i) {
1139  if ((*super) == (*nodeIt)->getAndOwnInput(i)) {
1140  ++use_count;
1141  if (1 == use_count) {
1142  only_use = nodeIt;
1143  } else {
1144  super = owner_.end();
1145  return;
1146  }
1147  }
1148  }
1149  }
1150  super = only_use;
1151  break;
1152  }
1154  for (size_t i = 0; i != owner_.size(); ++i) {
1155  if (!visited_.count(i)) {
1156  super = owner_.begin();
1157  std::advance(super, i);
1158  return;
1159  }
1160  }
1161  super = owner_.end();
1162  break;
1163  default:
1164  CHECK(false);
1165  }
1166  }
#define CHECK(condition)
Definition: Logger.h:187

◆ allVisited()

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

Definition at line 1168 of file RelAlgAbstractInterpreter.cpp.

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

+ Here is the caller graph for this function:

◆ operator size_t()

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

Definition at line 1122 of file RelAlgAbstractInterpreter.cpp.

1122  {
1123  return std::distance(owner_.begin(), *static_cast<Super*>(this));
1124  }

◆ operator*()

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

Definition at line 1170 of file RelAlgAbstractInterpreter.cpp.

1170  {
1171  visited_.insert(size_t(*this));
1172  Super& super = *this;
1173  return *super;
1174  }

◆ operator++()

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

◆ operator->()

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

Member Data Documentation

◆ nodeCount_

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

Definition at line 1180 of file RelAlgAbstractInterpreter.cpp.

◆ owner_

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

Definition at line 1179 of file RelAlgAbstractInterpreter.cpp.

◆ visited_

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

Definition at line 1181 of file RelAlgAbstractInterpreter.cpp.


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