osrm-backend/include/engine/datafacade/process_memory_allocator.hpp

36 lines
1.0 KiB
C++
Raw Normal View History

#ifndef OSRM_ENGINE_DATAFACADE_PROCESS_MEMORY_ALLOCATOR_HPP_
#define OSRM_ENGINE_DATAFACADE_PROCESS_MEMORY_ALLOCATOR_HPP_
#include "storage/storage_config.hpp"
#include "engine/datafacade/contiguous_block_allocator.hpp"
#include <memory>
namespace osrm::engine::datafacade
{
/**
* This allocator uses a process-local memory block to load
* data into. The structure and layout is the same as when using
* shared memory.
* This class holds a unique_ptr to the memory block, so it
* is auto-freed upon destruction.
*/
2022-06-27 19:14:28 -04:00
class ProcessMemoryAllocator final : public ContiguousBlockAllocator
{
public:
explicit ProcessMemoryAllocator(const storage::StorageConfig &config);
~ProcessMemoryAllocator() override final;
// interface to give access to the datafacades
2018-04-04 19:05:34 -04:00
const storage::SharedDataIndex &GetIndex() override final;
private:
2018-04-04 19:05:34 -04:00
storage::SharedDataIndex index;
std::unique_ptr<char[]> internal_memory;
};
2022-12-20 12:00:11 -05:00
} // namespace osrm::engine::datafacade
#endif // OSRM_ENGINE_DATAFACADE_PROCESS_MEMORY_ALLOCATOR_HPP_