OmniSciDB  95562058bd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
InsertionOrderedMap Struct Reference

#include <InsertionOrderedMap.h>

Classes

struct  Iterator
 

Public Member Functions

auto & operator[] (llvm::Value *key)
 
void replace (llvm::Value *key1, llvm::Value *key2)
 
auto begin ()
 
auto end ()
 
auto find (llvm::Value *key)
 
std::pair< Iterator, bool > emplace (llvm::Value *key, llvm::Value *val)
 

Public Attributes

std::unordered_map
< llvm::Value *, llvm::Value * > 
m_
 
std::vector< llvm::Value * > v_
 

Detailed Description

Definition at line 35 of file InsertionOrderedMap.h.

Member Function Documentation

auto InsertionOrderedMap::begin ( )
inline

Definition at line 89 of file InsertionOrderedMap.h.

References v_.

Referenced by Executor::redeclareFilterFunction().

89 { return Iterator{this, v_.begin()}; }
std::vector< llvm::Value * > v_

+ Here is the caller graph for this function:

std::pair<Iterator, bool> InsertionOrderedMap::emplace ( llvm::Value *  key,
llvm::Value *  val 
)
inline

Definition at line 100 of file InsertionOrderedMap.h.

References end(), find(), m_, and v_.

100  {
101  auto it = find(key);
102  if (it != end()) {
103  return std::pair(it, false);
104  } else {
105  m_.emplace(key, val);
106  v_.push_back(key);
107  return std::pair(Iterator{this, v_.end() - 1}, true);
108  }
109  }
std::vector< llvm::Value * > v_
auto find(llvm::Value *key)
std::unordered_map< llvm::Value *, llvm::Value * > m_

+ Here is the call graph for this function:

auto InsertionOrderedMap::end ( )
inline

Definition at line 90 of file InsertionOrderedMap.h.

References v_.

Referenced by emplace(), and Executor::redeclareFilterFunction().

90 { return Iterator{this, v_.end()}; }
std::vector< llvm::Value * > v_

+ Here is the caller graph for this function:

auto InsertionOrderedMap::find ( llvm::Value *  key)
inline

Definition at line 92 of file InsertionOrderedMap.h.

References m_, and v_.

Referenced by emplace(), and Executor::redeclareFilterFunction().

92  {
93  if (m_.count(key)) {
94  return Iterator{this, std::find(v_.begin(), v_.end(), key)};
95  } else {
96  return Iterator{this, v_.end()};
97  }
98  }
std::vector< llvm::Value * > v_
std::unordered_map< llvm::Value *, llvm::Value * > m_

+ Here is the caller graph for this function:

auto& InsertionOrderedMap::operator[] ( llvm::Value *  key)
inline

Definition at line 39 of file InsertionOrderedMap.h.

References m_, and v_.

39  {
40  auto m_it = m_.find(key);
41  if (m_it == m_.end()) {
42  v_.push_back(key);
43  return m_[key];
44  }
45  return m_it->second;
46  }
std::vector< llvm::Value * > v_
std::unordered_map< llvm::Value *, llvm::Value * > m_
void InsertionOrderedMap::replace ( llvm::Value *  key1,
llvm::Value *  key2 
)
inline

Definition at line 48 of file InsertionOrderedMap.h.

References m_, and v_.

48  {
49  if (m_.count(key2)) {
50  return;
51  }
52  auto m_it = m_.find(key1);
53  if (m_it == m_.end()) {
54  return;
55  }
56  auto v_it = std::find(v_.begin(), v_.end(), key1);
57  if (v_it == v_.end()) {
58  return;
59  }
60  *v_it = key2;
61  m_[key2] = m_it->second;
62  m_.erase(m_it);
63  }
std::vector< llvm::Value * > v_
std::unordered_map< llvm::Value *, llvm::Value * > m_

Member Data Documentation

std::unordered_map<llvm::Value*, llvm::Value*> InsertionOrderedMap::m_

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