Skip to content

Commit

Permalink
cleaning and tidying up
Browse files Browse the repository at this point in the history
  • Loading branch information
hossein.moein@kensho.com committed Aug 30, 2019
1 parent 2da1c42 commit 9d4e594
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 34 deletions.
10 changes: 6 additions & 4 deletions include/DataFrame/MMap/ObjectVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class ObjectVector : protected B {
using size_type = typename BaseClass::size_type;
using value_type = T;
using difference_type = std::ptrdiff_t;
using ponter = value_type *;
using pointer = value_type *;
using const_pointer = const value_type *;
using const_pointer_const = const value_type *const;
using reference = value_type &;
Expand Down Expand Up @@ -181,7 +181,7 @@ class ObjectVector : protected B {

mutable size_type cached_object_count_ { 0 };

inline void setup_();
inline void setup_ ();
inline size_type tell_ () const noexcept;
inline void unlink_ () { BaseClass::unlink (); }
inline int write_ (const value_type *data_ele, size_type count);
Expand Down Expand Up @@ -708,11 +708,13 @@ class ObjectVector : protected B {
inline reverse_iterator
rend() noexcept { return (reverse_iterator (&((*this)[0]) - 1)); }

inline const_reverse_iterator rbegin () const noexcept {
inline const_reverse_iterator
rbegin () const noexcept {

return (const_reverse_iterator (&((*this)[size() - 1])));
}
inline const_reverse_iterator rend () const noexcept {
inline const_reverse_iterator
rend () const noexcept {

return (const_reverse_iterator (&((*this)[0]) - 1));
}
Expand Down
4 changes: 2 additions & 2 deletions include/DataFrame/MMap/ObjectVector.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -348,10 +348,10 @@ template<typename T, typename B>
template<typename I>
void ObjectVector<T, B>::insert (iterator pos, I first, I last) {

const long int to_add = &(*last) - &(*first);
const size_type to_add = &(*last) - &(*first);
const size_type pos_index = &(*pos) - &(*begin ());

BaseClass::truncate (BaseClass::_file_size + to_add * sizeof (value_type));
BaseClass::truncate(BaseClass::_file_size + to_add * sizeof (value_type));

const iterator new_pos = begin() + pos_index;

Expand Down
25 changes: 10 additions & 15 deletions include/DataFrame/Vectors/VectorPtrView.h
Original file line number Diff line number Diff line change
Expand Up @@ -581,26 +581,21 @@ class VectorPtrView {

public:

inline iterator begin () noexcept {

return (iterator (&(*(vector_.begin()))));
}
inline iterator
begin () noexcept { return (iterator (&(*(vector_.begin())))); }
inline iterator
end () noexcept { return (iterator(&(*(vector_.end())))); }
inline const_iterator begin () const noexcept {

return (const_iterator (&(*(vector_.begin()))));
}
inline const_iterator end () const noexcept {

return (const_iterator(&(*(vector_.end()))));
}

inline const_reverse_iterator rbegin () const noexcept {
inline const_iterator
begin() const noexcept { return (const_iterator (&(*(vector_.begin())))); }
inline const_iterator
end () const noexcept { return (const_iterator(&(*(vector_.end())))); }

inline const_reverse_iterator
rbegin () const noexcept {
return (const_reverse_iterator (&(*(vector_.rbegin()))));
}
inline const_reverse_iterator rend () const noexcept {
inline const_reverse_iterator
rend () const noexcept {

return (const_reverse_iterator (&(*(vector_.rend()))));
}
Expand Down
31 changes: 18 additions & 13 deletions include/DataFrame/Vectors/VectorView.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@ class VectorView {

public:

inline VectorView() = default;
VectorView() = default;
VectorView(const VectorView &) = default;
VectorView(VectorView &&) = default;
VectorView &operator= (const VectorView &) = default;
VectorView &operator= (VectorView &&) = default;
~VectorView() = default;

inline VectorView (value_type *bp, value_type *ep) noexcept
: begin_ptr_(bp), end_ptr_(ep) { }

Expand All @@ -45,6 +51,9 @@ class VectorView {
}
inline void clear () noexcept { begin_ptr_ = end_ptr_ = nullptr; }

inline reference at (size_type i) noexcept { return (*(begin_ptr_ + i)); }
inline const_reference
at (size_type i) const noexcept { return (*(begin_ptr_ + i)); }
inline reference operator [] (size_type i) noexcept {

return (*(begin_ptr_ + i));
Expand All @@ -58,9 +67,10 @@ class VectorView {
inline reference back() noexcept { return (*(end_ptr_ - 1)); }
inline const_reference back() const noexcept { return (*(end_ptr_ - 1)); }

// This is to match the std::vector interface, so things will compile
// These are to match the std::vector interface, so things will compile
//
inline void shrink_to_fit() { }
inline void reserve (size_type) { }

inline void swap (VectorView &rhs) noexcept {

Expand Down Expand Up @@ -219,7 +229,7 @@ class VectorView {

private:

const_pointer node_ {nullptr};
const_pointer node_ { nullptr };
};

class iterator;
Expand Down Expand Up @@ -351,7 +361,7 @@ class VectorView {

private:

const_pointer node_ {nullptr};
const_pointer node_ { nullptr };

friend class VectorView::const_reverse_iterator;
};
Expand Down Expand Up @@ -466,7 +476,7 @@ class VectorView {

private:

pointer node_ {nullptr};
pointer node_ { nullptr };

friend class VectorView::const_iterator;
};
Expand All @@ -481,14 +491,9 @@ class VectorView {
end () const noexcept { return (const_iterator (end_ptr_)); }

inline const_reverse_iterator
rbegin () const noexcept {

return (const_reverse_iterator (end_ptr_ - 1));
}
inline const_reverse_iterator rend () const noexcept {

return (const_reverse_iterator (begin_ptr_ - 1));
}
rbegin() const noexcept { return (const_reverse_iterator(end_ptr_ - 1)); }
inline const_reverse_iterator
rend() const noexcept { return (const_reverse_iterator(begin_ptr_ - 1)); }
};

} // namespace hmdf
Expand Down

0 comments on commit 9d4e594

Please sign in to comment.