Files
OpenVulkano/openVulkanoCpp/IO/MemMappedFile.cpp

27 lines
706 B
C++

/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#include "MemMappedFile.hpp"
#include "Base/Logger.hpp"
#include "MemMappedFileInternal.hpp"
namespace OpenVulkano
{
MemMappedFile::MemMappedFile(const std::filesystem::path& path, FileMode fileMode)
: m_data(nullptr), m_size(0)
{
std::string file = path.string();
m_internal = std::make_shared<MemMappedFileInternal>(file.c_str(), fileMode);
m_data = m_internal->address;
m_size = (m_data) ? m_internal->size : 0;
}
void MemMappedFile::Close()
{
m_internal->Close();
}
}