7 #ifndef CVMFS_BIGVECTOR_H_
8 #define CVMFS_BIGVECTOR_H_
48 Item
At(
const size_t index)
const {
53 const Item *
AtPtr(
const size_t index)
const {
65 void Replace(
size_t index,
const Item &item) {
89 for (
size_t i = 0; i <
size_; ++i)
90 new (
buffer_ + i) Item(old_buffer[i]);
92 FreeBuffer(old_buffer, size_, old_large_alloc);
100 if (static_cast<float>(
size_) >= (0.25 * static_cast<float>(
capacity_)))
105 for (
size_t i = 0; i <
size_; ++i)
106 new (new_buffer + i) Item(
buffer_[i]);
124 Item *
Alloc(
const size_t num_elements) {
126 size_t num_bytes =
sizeof(Item) * num_elements;
128 result =
static_cast<Item *
>(smmap(num_bytes));
131 result =
static_cast<Item *
>(smalloc(num_bytes));
146 for (
size_t i = 0; i <
size; ++i)
160 for (
size_t i = 0; i < other.
size_; ++i) {
174 #endif // CVMFS_BIGVECTOR_H_
Item At(const size_t index) const
void ShareBuffer(Item **duplicate, bool *large_alloc)
assert((mem||(size==0))&&"Out Of Memory")
void FreeBuffer(Item *buf, const size_t size, const bool large)
BigVector(const BigVector< Item > &other)
void CopyFrom(const BigVector< Item > &other)
BigVector< Item > & operator=(const BigVector< Item > &other)
void SetSize(const size_t new_size)
BigVector(const size_t num_items)
static const size_t kNumInit
void PushBack(const Item &item)
static const size_t kMmapThreshold
Item * Alloc(const size_t num_elements)
void Replace(size_t index, const Item &item)
const Item * AtPtr(const size_t index) const