Skip to content

Commit

Permalink
Various refactoring code style.
Browse files Browse the repository at this point in the history
  • Loading branch information
bingmann committed Sep 27, 2014
1 parent 4cbde6c commit 20bfe2b
Show file tree
Hide file tree
Showing 7 changed files with 165 additions and 146 deletions.
86 changes: 43 additions & 43 deletions include/stxxl/bits/containers/map.h
Expand Up @@ -83,7 +83,7 @@ class map : private noncopyable
{
typedef btree::btree<KeyType, DataType, CompareType, RawNodeSize, RawLeafSize, PDAllocStrategy> impl_type;

impl_type Impl;
impl_type impl;

public:
typedef typename impl_type::node_block_type node_block_type;
Expand All @@ -109,10 +109,10 @@ class map : private noncopyable
//! \name Iterators
//! \{

iterator begin() { return Impl.begin(); }
iterator end() { return Impl.end(); }
const_iterator begin() const { return Impl.begin(); }
const_iterator end() const { return Impl.end(); }
iterator begin() { return impl.begin(); }
iterator end() { return impl.end(); }
const_iterator begin() const { return impl.begin(); }
const_iterator end() const { return impl.end(); }
const_iterator cbegin() const { return begin(); }
const_iterator cend() const { return end(); }

Expand Down Expand Up @@ -146,17 +146,17 @@ class map : private noncopyable
//! \name Capacity
//! \{

size_type size() const { return Impl.size(); }
size_type max_size() const { return Impl.max_size(); }
bool empty() const { return Impl.empty(); }
size_type size() const { return impl.size(); }
size_type max_size() const { return impl.max_size(); }
bool empty() const { return impl.empty(); }

//! \}

//! \name Observers
//! \{

key_compare key_comp() const { return Impl.key_comp(); }
value_compare value_comp() const { return Impl.value_comp(); }
key_compare key_comp() const { return impl.key_comp(); }
value_compare value_comp() const { return impl.value_comp(); }

//! \}

Expand All @@ -168,7 +168,7 @@ class map : private noncopyable
//! \param leaf_cache_size_in_bytes size of leaf cache in bytes (btree implementation)
map(unsigned_type node_cache_size_in_bytes,
unsigned_type leaf_cache_size_in_bytes
) : Impl(node_cache_size_in_bytes, leaf_cache_size_in_bytes)
) : impl(node_cache_size_in_bytes, leaf_cache_size_in_bytes)
{ }

//! A constructor
Expand All @@ -178,7 +178,7 @@ class map : private noncopyable
map(const key_compare& c_,
unsigned_type node_cache_size_in_bytes,
unsigned_type leaf_cache_size_in_bytes
) : Impl(c_, node_cache_size_in_bytes, leaf_cache_size_in_bytes)
) : impl(c_, node_cache_size_in_bytes, leaf_cache_size_in_bytes)
{ }

//! Constructs a map from a given input range
Expand All @@ -198,7 +198,7 @@ class map : private noncopyable
bool range_sorted = false,
double node_fill_factor = 0.75,
double leaf_fill_factor = 0.6
) : Impl(b, e, node_cache_size_in_bytes, leaf_cache_size_in_bytes,
) : impl(b, e, node_cache_size_in_bytes, leaf_cache_size_in_bytes,
range_sorted, node_fill_factor, leaf_fill_factor)
{ }

Expand All @@ -221,7 +221,7 @@ class map : private noncopyable
bool range_sorted = false,
double node_fill_factor = 0.75,
double leaf_fill_factor = 0.6
) : Impl(b, e, c_, node_cache_size_in_bytes, leaf_cache_size_in_bytes,
) : impl(b, e, c_, node_cache_size_in_bytes, leaf_cache_size_in_bytes,
range_sorted, node_fill_factor, leaf_fill_factor)
{ }

Expand All @@ -230,35 +230,35 @@ class map : private noncopyable
//! \name Modifiers
//! \{

void swap(map& obj) { std::swap(Impl, obj.Impl); }
void swap(map& obj) { std::swap(impl, obj.impl); }
std::pair<iterator, bool> insert(const value_type& x)
{
return Impl.insert(x);
return impl.insert(x);
}
iterator insert(iterator pos, const value_type& x)
{
return Impl.insert(pos, x);
return impl.insert(pos, x);
}
template <class InputIterator>
void insert(InputIterator b, InputIterator e)
{
Impl.insert(b, e);
impl.insert(b, e);
}
void erase(iterator pos)
{
Impl.erase(pos);
impl.erase(pos);
}
size_type erase(const key_type& k)
{
return Impl.erase(k);
return impl.erase(k);
}
void erase(iterator first, iterator last)
{
Impl.erase(first, last);
impl.erase(first, last);
}
void clear()
{
Impl.clear();
impl.clear();
}

//! \}
Expand All @@ -268,39 +268,39 @@ class map : private noncopyable

iterator find(const key_type& k)
{
return Impl.find(k);
return impl.find(k);
}
const_iterator find(const key_type& k) const
{
return Impl.find(k);
return impl.find(k);
}
size_type count(const key_type& k)
{
return Impl.count(k);
return impl.count(k);
}
iterator lower_bound(const key_type& k)
{
return Impl.lower_bound(k);
return impl.lower_bound(k);
}
const_iterator lower_bound(const key_type& k) const
{
return Impl.lower_bound(k);
return impl.lower_bound(k);
}
iterator upper_bound(const key_type& k)
{
return Impl.upper_bound(k);
return impl.upper_bound(k);
}
const_iterator upper_bound(const key_type& k) const
{
return Impl.upper_bound(k);
return impl.upper_bound(k);
}
std::pair<iterator, iterator> equal_range(const key_type& k)
{
return Impl.equal_range(k);
return impl.equal_range(k);
}
std::pair<const_iterator, const_iterator> equal_range(const key_type& k) const
{
return Impl.equal_range(k);
return impl.equal_range(k);
}

//! \}
Expand All @@ -310,7 +310,7 @@ class map : private noncopyable

data_type& operator [] (const key_type& k)
{
return Impl[k];
return impl[k];
}

//! \}
Expand All @@ -321,31 +321,31 @@ class map : private noncopyable
//! Enables leaf prefetching during scanning
void enable_prefetching()
{
Impl.enable_prefetching();
impl.enable_prefetching();
}

//! Disables leaf prefetching during scanning
void disable_prefetching()
{
Impl.disable_prefetching();
impl.disable_prefetching();
}

//! Returns the status of leaf prefetching during scanning
bool prefetching_enabled()
{
return Impl.prefetching_enabled();
return impl.prefetching_enabled();
}

//! Prints cache statistics
void print_statistics(std::ostream& o) const
{
Impl.print_statistics(o);
impl.print_statistics(o);
}

//! Resets cache statistics
void reset_statistics()
{
Impl.reset_statistics();
impl.reset_statistics();
}

//! \}
Expand Down Expand Up @@ -417,7 +417,7 @@ template <class KeyType,
inline bool operator == (const map<KeyType, DataType, CompareType, RawNodeSize, RawLeafSize, PDAllocStrategy>& a,
const map<KeyType, DataType, CompareType, RawNodeSize, RawLeafSize, PDAllocStrategy>& b)
{
return a.Impl == b.Impl;
return a.impl == b.impl;
}

template <class KeyType,
Expand All @@ -430,7 +430,7 @@ template <class KeyType,
inline bool operator < (const map<KeyType, DataType, CompareType, RawNodeSize, RawLeafSize, PDAllocStrategy>& a,
const map<KeyType, DataType, CompareType, RawNodeSize, RawLeafSize, PDAllocStrategy>& b)
{
return a.Impl < b.Impl;
return a.impl < b.impl;
}

template <class KeyType,
Expand All @@ -443,7 +443,7 @@ template <class KeyType,
inline bool operator > (const map<KeyType, DataType, CompareType, RawNodeSize, RawLeafSize, PDAllocStrategy>& a,
const map<KeyType, DataType, CompareType, RawNodeSize, RawLeafSize, PDAllocStrategy>& b)
{
return a.Impl > b.Impl;
return a.impl > b.impl;
}

template <class KeyType,
Expand All @@ -456,7 +456,7 @@ template <class KeyType,
inline bool operator != (const map<KeyType, DataType, CompareType, RawNodeSize, RawLeafSize, PDAllocStrategy>& a,
const map<KeyType, DataType, CompareType, RawNodeSize, RawLeafSize, PDAllocStrategy>& b)
{
return a.Impl != b.Impl;
return a.impl != b.impl;
}

template <class KeyType,
Expand All @@ -469,7 +469,7 @@ template <class KeyType,
inline bool operator <= (const map<KeyType, DataType, CompareType, RawNodeSize, RawLeafSize, PDAllocStrategy>& a,
const map<KeyType, DataType, CompareType, RawNodeSize, RawLeafSize, PDAllocStrategy>& b)
{
return a.Impl <= b.Impl;
return a.impl <= b.impl;
}

template <class KeyType,
Expand All @@ -482,7 +482,7 @@ template <class KeyType,
inline bool operator >= (const map<KeyType, DataType, CompareType, RawNodeSize, RawLeafSize, PDAllocStrategy>& a,
const map<KeyType, DataType, CompareType, RawNodeSize, RawLeafSize, PDAllocStrategy>& b)
{
return a.Impl >= b.Impl;
return a.impl >= b.impl;
}

//! \}
Expand Down
20 changes: 10 additions & 10 deletions include/stxxl/bits/containers/pq_ext_merger.h
Expand Up @@ -120,23 +120,23 @@ class short_sequence : public std::pair<Iterator, Iterator>
* External merger, based on the loser tree data structure.
* \param Arity_ maximum arity of merger, does not need to be a power of 2
*/
template <class BlockType_,
class Cmp_,
unsigned Arity_,
class AllocStr_ = STXXL_DEFAULT_ALLOC_STRATEGY>
template <class BlockType,
class Cmp,
unsigned Arity,
class AllocStr = STXXL_DEFAULT_ALLOC_STRATEGY>
class ext_merger : private noncopyable
{
public:
typedef stxxl::uint64 size_type;
typedef BlockType_ block_type;
typedef BlockType block_type;
typedef typename block_type::bid_type bid_type;
typedef typename block_type::value_type value_type;
typedef Cmp_ comparator_type;
typedef AllocStr_ alloc_strategy;
typedef Cmp comparator_type;
typedef AllocStr alloc_strategy;
typedef read_write_pool<block_type> pool_type;

// arity_bound / 2 < arity <= arity_bound
enum { arity = Arity_, arity_bound = 1UL << (LOG2<Arity_>::ceil) };
enum { arity = Arity, arity_bound = 1UL << (LOG2<Arity>::ceil) };

protected:
comparator_type cmp;
Expand Down Expand Up @@ -582,8 +582,8 @@ class ext_merger : private noncopyable
std::vector<sequence> seqs;
std::vector<unsigned_type> orig_seq_index;

Cmp_ cmp;
priority_queue_local::invert_order<Cmp_, value_type, value_type> inv_cmp(cmp);
Cmp cmp;
priority_queue_local::invert_order<Cmp, value_type, value_type> inv_cmp(cmp);

for (unsigned_type i = 0; i < k; ++i) //initialize sequences
{
Expand Down

0 comments on commit 20bfe2b

Please sign in to comment.