Program Listing for File SlotPool.hpp¶
↰ Return to documentation for file (umpire/strategy/SlotPool.hpp
)
//////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2018, Lawrence Livermore National Security, LLC.
// Produced at the Lawrence Livermore National Laboratory
//
// Created by David Beckingsale, david@llnl.gov
// LLNL-CODE-747640
//
// All rights reserved.
//
// This file is part of Umpire.
//
// For details, see https://github.com/LLNL/Umpire
// Please also see the LICENSE file for MIT license.
//////////////////////////////////////////////////////////////////////////////
#ifndef UMPIRE_SlotPool_HPP
#define UMPIRE_SlotPool_HPP
#include <memory>
#include <vector>
#include "umpire/strategy/AllocationStrategy.hpp"
#include "umpire/Allocator.hpp"
namespace umpire {
namespace strategy {
class SlotPool :
public AllocationStrategy
{
public:
SlotPool(
const std::string& name,
int id,
size_t slots,
Allocator allocator);
void* allocate(size_t bytes);
void deallocate(void* ptr);
long getCurrentSize();
long getHighWatermark();
Platform getPlatform();
private:
void init();
void** m_pointers;
size_t* m_lengths;
long m_current_size;
long m_highwatermark;
size_t m_slots;
std::shared_ptr<umpire::strategy::AllocationStrategy> m_allocator;
};
} // end of namespace strategy
} // end namespace umpire
#endif // UMPIRE_SlotPool_HPP