Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
fc::detail::mmap_struct_base Class Reference

#include <mmap_struct.hpp>

Inheritance diagram for fc::detail::mmap_struct_base:

Public Member Functions

size_t size () const
 
void flush ()
 

Protected Member Functions

void open (const fc::path &file, size_t s, bool create)
 

Protected Attributes

std::unique_ptr< fc::file_mapping_file_mapping
 
std::unique_ptr< fc::mapped_region_mapped_region
 

Detailed Description

Base class used to hide common implementation details.

Definition at line 13 of file mmap_struct.hpp.

Member Function Documentation

◆ flush()

void fc::detail::mmap_struct_base::flush ( )

Definition at line 14 of file mmap_struct.cpp.

15 {
16 _mapped_region->flush();
17 }
std::unique_ptr< fc::mapped_region > _mapped_region

◆ open()

void fc::detail::mmap_struct_base::open ( const fc::path & file,
size_t s,
bool create )
protected

Definition at line 19 of file mmap_struct.cpp.

20 {
21 if( !fc::exists( file ) || fc::file_size(file) != s )
22 {
23 std::ofstream out( file.generic_string().c_str() );
24 char buffer[1024];
25 memset( buffer, 0, sizeof(buffer) );
26
27 size_t bytes_left = s;
28 while( bytes_left > 0 )
29 {
30 size_t to_write = std::min<size_t>(bytes_left, sizeof(buffer) );
31 out.write( buffer, to_write );
32 bytes_left -= to_write;
33 }
34 }
35
36 std::string filePath = file.to_native_ansi_path();
37
38 _file_mapping.reset( new fc::file_mapping( filePath.c_str(), fc::read_write ) );
40 }
std::unique_ptr< fc::file_mapping > _file_mapping
@ read_write
bool exists(const path &p)
uint64_t file_size(const path &p)
char * s
memset(pInfo->slotDescription, ' ', 64)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ size()

size_t fc::detail::mmap_struct_base::size ( ) const

Definition at line 13 of file mmap_struct.cpp.

13{ return _mapped_region->get_size(); }

Member Data Documentation

◆ _file_mapping

std::unique_ptr<fc::file_mapping> fc::detail::mmap_struct_base::_file_mapping
protected

Definition at line 21 of file mmap_struct.hpp.

◆ _mapped_region

std::unique_ptr<fc::mapped_region> fc::detail::mmap_struct_base::_mapped_region
protected

Definition at line 22 of file mmap_struct.hpp.


The documentation for this class was generated from the following files: