Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
fc::mmap_struct< T > Class Template Reference

A struct that has been mapped from a file. More...

#include <mmap_struct.hpp>

Inheritance diagram for fc::mmap_struct< T >:
Collaboration diagram for fc::mmap_struct< T >:

Public Member Functions

 mmap_struct ()
 
void open (const fc::path &file, bool create=false)
 
Toperator-> ()
 
const Toperator-> () const
 
Toperator* ()
 
const Toperator* () const
 
- Public Member Functions inherited from fc::detail::mmap_struct_base
size_t size () const
 
void flush ()
 

Additional Inherited Members

- Protected Member Functions inherited from fc::detail::mmap_struct_base
void open (const fc::path &file, size_t s, bool create)
 
- Protected Attributes inherited from fc::detail::mmap_struct_base
std::unique_ptr< fc::file_mapping_file_mapping
 
std::unique_ptr< fc::mapped_region_mapped_region
 

Detailed Description

template<typename T>
class fc::mmap_struct< T >
Note
T must be POD

Definition at line 33 of file mmap_struct.hpp.

Constructor & Destructor Documentation

◆ mmap_struct()

template<typename T >
fc::mmap_struct< T >::mmap_struct ( )
inline

Definition at line 36 of file mmap_struct.hpp.

36:_mapped_struct(nullptr){}

Member Function Documentation

◆ open()

template<typename T >
void fc::mmap_struct< T >::open ( const fc::path & file,
bool create = false )
inline

Create the file if it does not exist or is of the wrong size if create is true, then maps the file to memory.

Exceptions
anexception if the file does not exist or is the wrong size and create is false

Definition at line 43 of file mmap_struct.hpp.

44 {
45 detail::mmap_struct_base::open( file, sizeof(T), create );
46 _mapped_struct = (T*)_mapped_region->get_address();
47 }
void open(const fc::path &file, size_t s, bool create)
std::unique_ptr< fc::mapped_region > _mapped_region
#define T(meth, val, expected)
Here is the call graph for this function:

◆ operator*() [1/2]

template<typename T >
T & fc::mmap_struct< T >::operator* ( )
inline

Definition at line 52 of file mmap_struct.hpp.

52{ return *_mapped_struct; }

◆ operator*() [2/2]

template<typename T >
const T & fc::mmap_struct< T >::operator* ( ) const
inline

Definition at line 53 of file mmap_struct.hpp.

53{ return *_mapped_struct; }

◆ operator->() [1/2]

template<typename T >
T * fc::mmap_struct< T >::operator-> ( )
inline

Definition at line 49 of file mmap_struct.hpp.

49{ return _mapped_struct; }

◆ operator->() [2/2]

template<typename T >
const T * fc::mmap_struct< T >::operator-> ( ) const
inline

Definition at line 50 of file mmap_struct.hpp.

50{ return _mapped_struct; }

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