7 #ifndef CVMFS_BIGVECTOR_H_
8 #define CVMFS_BIGVECTOR_H_
50 Item
At(
const size_t index)
const {
55 const Item *
AtPtr(
const size_t index)
const {
67 void Replace(
size_t index,
const Item &item) {
93 for (
size_t i = 0; i <
size_; ++i)
94 new (
buffer_ + i) Item(old_buffer[i]);
96 FreeBuffer(old_buffer, size_, old_large_alloc);
104 if (static_cast<float>(
size_) >= (0.25 * static_cast<float>(
capacity_)))
109 for (
size_t i = 0; i <
size_; ++i)
110 new (new_buffer + i) Item(
buffer_[i]);
128 Item *
Alloc(
const size_t num_elements) {
130 size_t num_bytes =
sizeof(Item) * num_elements;
132 result =
static_cast<Item *
>(smmap(num_bytes));
135 result =
static_cast<Item *
>(smalloc(num_bytes));
150 for (
size_t i = 0; i <
size; ++i)
164 for (
size_t i = 0; i < other.
size_; ++i) {
178 #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