OmniSciDB  b24e664e58
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RowSetMemoryOwner Class Reference

#include <RowSetMemoryOwner.h>

+ Inheritance diagram for RowSetMemoryOwner:
+ Collaboration diagram for RowSetMemoryOwner:

Classes

struct  CountDistinctBitmapBuffer
 

Public Member Functions

void addCountDistinctBuffer (int8_t *count_distinct_buffer, const size_t bytes, const bool system_allocated)
 
void addCountDistinctSet (std::set< int64_t > *count_distinct_set)
 
void addGroupByBuffer (int64_t *group_by_buffer)
 
void addVarlenBuffer (void *varlen_buffer)
 
std::string * addString (const std::string &str)
 
std::vector< int64_t > * addArray (const std::vector< int64_t > &arr)
 
StringDictionaryProxyaddStringDict (std::shared_ptr< StringDictionary > str_dict, const int dict_id, const ssize_t generation)
 
StringDictionaryProxygetStringDictProxy (const int dict_id) const
 
void addLiteralStringDictProxy (std::shared_ptr< StringDictionaryProxy > lit_str_dict_proxy)
 
StringDictionaryProxygetLiteralStringDictProxy () const
 
void addColBuffer (const void *col_buffer)
 
 ~RowSetMemoryOwner ()
 

Private Attributes

std::vector
< CountDistinctBitmapBuffer
count_distinct_bitmaps_
 
std::vector< std::set< int64_t > * > count_distinct_sets_
 
std::vector< int64_t * > group_by_buffers_
 
std::vector< void * > varlen_buffers_
 
std::list< std::string > strings_
 
std::list< std::vector< int64_t > > arrays_
 
std::unordered_map< int,
StringDictionaryProxy * > 
str_dict_proxy_owned_
 
std::shared_ptr
< StringDictionaryProxy
lit_str_dict_proxy_
 
std::vector< void * > col_buffers_
 
std::mutex state_mutex_
 

Friends

class ResultSet
 

Detailed Description

Definition at line 33 of file RowSetMemoryOwner.h.

Constructor & Destructor Documentation

RowSetMemoryOwner::~RowSetMemoryOwner ( )
inline

Definition at line 109 of file RowSetMemoryOwner.h.

References col_buffers_, count_distinct_bitmaps_, count_distinct_sets_, group_by_buffers_, str_dict_proxy_owned_, and varlen_buffers_.

109  {
110  for (const auto& count_distinct_buffer : count_distinct_bitmaps_) {
111  if (count_distinct_buffer.system_allocated) {
112  free(count_distinct_buffer.ptr);
113  }
114  }
115  for (auto count_distinct_set : count_distinct_sets_) {
116  delete count_distinct_set;
117  }
118  for (auto group_by_buffer : group_by_buffers_) {
119  free(group_by_buffer);
120  }
121  for (auto varlen_buffer : varlen_buffers_) {
122  free(varlen_buffer);
123  }
124  for (auto col_buffer : col_buffers_) {
125  free(col_buffer);
126  }
127 
128  for (auto dict_proxy : str_dict_proxy_owned_) {
129  delete dict_proxy.second;
130  }
131  }
std::vector< std::set< int64_t > * > count_distinct_sets_
std::vector< CountDistinctBitmapBuffer > count_distinct_bitmaps_
std::vector< void * > col_buffers_
std::unordered_map< int, StringDictionaryProxy * > str_dict_proxy_owned_
std::vector< void * > varlen_buffers_
std::vector< int64_t * > group_by_buffers_

Member Function Documentation

std::vector<int64_t>* RowSetMemoryOwner::addArray ( const std::vector< int64_t > &  arr)
inline

Definition at line 64 of file RowSetMemoryOwner.h.

References arrays_, and state_mutex_.

64  {
65  std::lock_guard<std::mutex> lock(state_mutex_);
66  arrays_.emplace_back(arr);
67  return &arrays_.back();
68  }
std::list< std::vector< int64_t > > arrays_
void RowSetMemoryOwner::addColBuffer ( const void *  col_buffer)
inline

Definition at line 104 of file RowSetMemoryOwner.h.

References col_buffers_, and state_mutex_.

Referenced by JoinHashTable::getAllColumnFragments(), and BaselineJoinHashTable::getAllColumnFragments().

104  {
105  std::lock_guard<std::mutex> lock(state_mutex_);
106  col_buffers_.push_back(const_cast<void*>(col_buffer));
107  }
std::vector< void * > col_buffers_

+ Here is the caller graph for this function:

void RowSetMemoryOwner::addCountDistinctBuffer ( int8_t *  count_distinct_buffer,
const size_t  bytes,
const bool  system_allocated 
)
inline

Definition at line 35 of file RowSetMemoryOwner.h.

References count_distinct_bitmaps_, and state_mutex_.

37  {
38  std::lock_guard<std::mutex> lock(state_mutex_);
39  count_distinct_bitmaps_.emplace_back(
40  CountDistinctBitmapBuffer{count_distinct_buffer, bytes, system_allocated});
41  }
std::vector< CountDistinctBitmapBuffer > count_distinct_bitmaps_
void RowSetMemoryOwner::addCountDistinctSet ( std::set< int64_t > *  count_distinct_set)
inline

Definition at line 43 of file RowSetMemoryOwner.h.

References count_distinct_sets_, and state_mutex_.

43  {
44  std::lock_guard<std::mutex> lock(state_mutex_);
45  count_distinct_sets_.push_back(count_distinct_set);
46  }
std::vector< std::set< int64_t > * > count_distinct_sets_
void RowSetMemoryOwner::addGroupByBuffer ( int64_t *  group_by_buffer)
inline

Definition at line 48 of file RowSetMemoryOwner.h.

References group_by_buffers_, and state_mutex_.

48  {
49  std::lock_guard<std::mutex> lock(state_mutex_);
50  group_by_buffers_.push_back(group_by_buffer);
51  }
std::vector< int64_t * > group_by_buffers_
void RowSetMemoryOwner::addLiteralStringDictProxy ( std::shared_ptr< StringDictionaryProxy lit_str_dict_proxy)
inline

Definition at line 93 of file RowSetMemoryOwner.h.

References lit_str_dict_proxy_, and state_mutex_.

94  {
95  std::lock_guard<std::mutex> lock(state_mutex_);
96  lit_str_dict_proxy_ = lit_str_dict_proxy;
97  }
std::shared_ptr< StringDictionaryProxy > lit_str_dict_proxy_
std::string* RowSetMemoryOwner::addString ( const std::string &  str)
inline

Definition at line 58 of file RowSetMemoryOwner.h.

References state_mutex_, and strings_.

58  {
59  std::lock_guard<std::mutex> lock(state_mutex_);
60  strings_.emplace_back(str);
61  return &strings_.back();
62  }
std::list< std::string > strings_
StringDictionaryProxy* RowSetMemoryOwner::addStringDict ( std::shared_ptr< StringDictionary str_dict,
const int  dict_id,
const ssize_t  generation 
)
inline

Definition at line 70 of file RowSetMemoryOwner.h.

References CHECK_EQ, state_mutex_, and str_dict_proxy_owned_.

72  {
73  std::lock_guard<std::mutex> lock(state_mutex_);
74  auto it = str_dict_proxy_owned_.find(dict_id);
75  if (it != str_dict_proxy_owned_.end()) {
76  CHECK_EQ(it->second->getDictionary(), str_dict.get());
77  it->second->updateGeneration(generation);
78  return it->second;
79  }
80  StringDictionaryProxy* str_dict_proxy =
81  new StringDictionaryProxy(str_dict, generation);
82  str_dict_proxy_owned_.emplace(dict_id, str_dict_proxy);
83  return str_dict_proxy;
84  }
#define CHECK_EQ(x, y)
Definition: Logger.h:198
std::unordered_map< int, StringDictionaryProxy * > str_dict_proxy_owned_
void RowSetMemoryOwner::addVarlenBuffer ( void *  varlen_buffer)
inline

Definition at line 53 of file RowSetMemoryOwner.h.

References state_mutex_, and varlen_buffers_.

53  {
54  std::lock_guard<std::mutex> lock(state_mutex_);
55  varlen_buffers_.push_back(varlen_buffer);
56  }
std::vector< void * > varlen_buffers_
StringDictionaryProxy* RowSetMemoryOwner::getLiteralStringDictProxy ( ) const
inline

Definition at line 99 of file RowSetMemoryOwner.h.

References lit_str_dict_proxy_, and state_mutex_.

99  {
100  std::lock_guard<std::mutex> lock(state_mutex_);
101  return lit_str_dict_proxy_.get();
102  }
std::shared_ptr< StringDictionaryProxy > lit_str_dict_proxy_
StringDictionaryProxy* RowSetMemoryOwner::getStringDictProxy ( const int  dict_id) const
inline

Definition at line 86 of file RowSetMemoryOwner.h.

References CHECK(), state_mutex_, and str_dict_proxy_owned_.

86  {
87  std::lock_guard<std::mutex> lock(state_mutex_);
88  auto it = str_dict_proxy_owned_.find(dict_id);
89  CHECK(it != str_dict_proxy_owned_.end());
90  return it->second;
91  }
CHECK(cgen_state)
std::unordered_map< int, StringDictionaryProxy * > str_dict_proxy_owned_

+ Here is the call graph for this function:

Friends And Related Function Documentation

friend class ResultSet
friend

Definition at line 151 of file RowSetMemoryOwner.h.

Member Data Documentation

std::list<std::vector<int64_t> > RowSetMemoryOwner::arrays_
private

Definition at line 145 of file RowSetMemoryOwner.h.

Referenced by addArray().

std::vector<void*> RowSetMemoryOwner::col_buffers_
private

Definition at line 148 of file RowSetMemoryOwner.h.

Referenced by addColBuffer(), and ~RowSetMemoryOwner().

std::vector<CountDistinctBitmapBuffer> RowSetMemoryOwner::count_distinct_bitmaps_
private

Definition at line 140 of file RowSetMemoryOwner.h.

Referenced by addCountDistinctBuffer(), and ~RowSetMemoryOwner().

std::vector<std::set<int64_t>*> RowSetMemoryOwner::count_distinct_sets_
private

Definition at line 141 of file RowSetMemoryOwner.h.

Referenced by addCountDistinctSet(), and ~RowSetMemoryOwner().

std::vector<int64_t*> RowSetMemoryOwner::group_by_buffers_
private

Definition at line 142 of file RowSetMemoryOwner.h.

Referenced by addGroupByBuffer(), and ~RowSetMemoryOwner().

std::shared_ptr<StringDictionaryProxy> RowSetMemoryOwner::lit_str_dict_proxy_
private

Definition at line 147 of file RowSetMemoryOwner.h.

Referenced by addLiteralStringDictProxy(), and getLiteralStringDictProxy().

std::unordered_map<int, StringDictionaryProxy*> RowSetMemoryOwner::str_dict_proxy_owned_
private

Definition at line 146 of file RowSetMemoryOwner.h.

Referenced by addStringDict(), getStringDictProxy(), and ~RowSetMemoryOwner().

std::list<std::string> RowSetMemoryOwner::strings_
private

Definition at line 144 of file RowSetMemoryOwner.h.

Referenced by addString().

std::vector<void*> RowSetMemoryOwner::varlen_buffers_
private

Definition at line 143 of file RowSetMemoryOwner.h.

Referenced by addVarlenBuffer(), and ~RowSetMemoryOwner().


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