4 #ifndef IBIS_UTILIDOR_H
5 #define IBIS_UTILIDOR_H
39 void FASTBIT_CXX_DLLSPEC
40 reorder(array_t<T> &arr,
const array_t<uint32_t> &ind);
41 void FASTBIT_CXX_DLLSPEC
42 reorder(std::vector<std::string> &arr,
const array_t<uint32_t> &ind);
45 void FASTBIT_CXX_DLLSPEC
46 reorder(array_t<T*> &arr,
const array_t<uint32_t> &ind);
50 template <
typename T1,
typename T2>
51 void FASTBIT_CXX_DLLSPEC
52 sortAll(array_t<T1>& arr1, array_t<T2>& arr2);
55 int64_t FASTBIT_CXX_DLLSPEC
56 sortMerge(std::vector<std::string>& valR, array_t<uint32_t>& indR,
57 std::vector<std::string>& valS, array_t<uint32_t>& indS);
60 template <
typename T> int64_t FASTBIT_CXX_DLLSPEC
61 sortMerge(array_t<T>& valR, array_t<uint32_t>& indR,
62 array_t<T>& valS, array_t<uint32_t>& indS);
66 template <
typename T> int64_t FASTBIT_CXX_DLLSPEC
67 sortMerge(array_t<T>& valR, array_t<uint32_t>& indR,
68 array_t<T>& valS, array_t<uint32_t>& indS,
69 double delta1,
double delta2);
73 template <
typename T1,
typename T2>
74 void FASTBIT_CXX_DLLSPEC
75 sortKeys(array_t<T1>& keys, array_t<T2>& vals);
77 void FASTBIT_CXX_DLLSPEC
78 sortStrings(std::vector<std::string>& keys, array_t<uint32_t>& vals);
80 void FASTBIT_CXX_DLLSPEC
81 sortStrings(std::vector<std::string>& keys, array_t<uint32_t>& vals,
82 uint32_t begin, uint32_t end);
84 void FASTBIT_CXX_DLLSPEC
85 sortStrings(array_t<const char*>& keys, array_t<uint32_t>& vals);
87 void FASTBIT_CXX_DLLSPEC
88 sortStrings(array_t<const char*>& keys, array_t<uint32_t>& vals,
89 uint32_t begin, uint32_t end);
91 template <
typename T>
size_t
92 find(
const std::vector<T>&,
const T&,
size_t);
93 template <
typename T>
size_t
94 find(
const array_t<T>&,
const T&,
size_t);
95 template <
typename T> uint32_t
96 find(
const array_t<T>&,
const array_t<uint32_t>&,
const T&, uint32_t);
99 template <
typename T,
class C>
111 bool empty()
const {
return data_.empty();}
114 size_t size()
const {
return data_.size();}
120 T*
top()
const {
return data_[0];}
125 std::push_heap(data_.begin(), data_.end(),
comp_);
130 const size_t oldsize = data_.size();
131 std::pop_heap(data_.begin(), data_.end(),
comp_);
132 data_.resize(oldsize-1);
void sortAll(array_t< T1 > &arr1, array_t< T2 > &arr2)
Sort two arrays together.
Definition: utilidor.cpp:285
size_t size() const
The number of elements in the heap.
Definition: utilidor.h:114
void pop()
Remove the top element from the heap.
Definition: utilidor.h:129
std::vector< T * > data_
A vector to hold pointers to the underlying data.
Definition: utilidor.h:102
void sortRIDsq(ibis::RIDSet &, uint32_t, uint32_t)
Sort a portion of the RIDSet with quick sort.
Definition: utilidor.cpp:126
size_t find(const std::vector< T > &, const T &, size_t)
Find the first position where the value is no less than val.
Definition: utilidor.cpp:3795
The current implementation of FastBit is code named IBIS; most data structures and functions are in t...
Definition: bord.h:16
bool empty() const
Is the heap empty. Returns true if yes.
Definition: utilidor.h:111
void push(T *v)
Add a new element to the heap.
Definition: utilidor.h:123
void sortStrings(std::vector< std::string > &keys, array_t< uint32_t > &vals)
Sorting function with string as keys and uint32_t as payload.
Definition: utilidor.cpp:1244
void reserve(size_t n)
Reserve space.
Definition: utilidor.h:117
void sortKeys(array_t< T1 > &keys, array_t< T2 > &vals)
Sorting function with payload.
Definition: utilidor.cpp:564
void reorder(array_t< T > &arr, const array_t< uint32_t > &ind)
Reorder the array arr according to the indices given in ind.
Definition: utilidor.cpp:224
void sortRIDs(ibis::RIDSet &)
Sort RID lists.
Definition: utilidor.cpp:117
void sortRIDsi(ibis::RIDSet &, uint32_t, uint32_t)
Sort a portion of the RIDset with insertion sort.
Definition: utilidor.cpp:195
const C comp_
An object of the comparator type.
Definition: utilidor.h:104
A simple heap based on std::push_heap and std::pop_heap.
Definition: utilidor.h:100
T * top() const
The top element. No error checking!
Definition: utilidor.h:120
int64_t sortMerge(std::vector< std::string > &valR, array_t< uint32_t > &indR, std::vector< std::string > &valS, array_t< uint32_t > &indS)
An in-memory sort merge join function with string values.
Definition: utilidor.cpp:3346