idfxx 1.0.0
Modern C++23 components for ESP-IDF
Loading...
Searching...
No Matches
idfxx::partition::mmap_handle Class Reference

A memory-mapped partition region. More...

Public Member Functions

 mmap_handle ()=default
 Constructs an invalid (unmapped) handle.
 
 ~mmap_handle ()
 
 mmap_handle (const mmap_handle &)=delete
 
mmap_handleoperator= (const mmap_handle &)=delete
 
 mmap_handle (mmap_handle &&other) noexcept
 Move constructor.
 
mmap_handleoperator= (mmap_handle &&other) noexcept
 Move assignment.
 
 operator bool () const
 Returns true if this handle has a mapped region.
 
const voiddata () const
 Returns a pointer to the mapped memory region.
 
size_t size () const
 Returns the size of the mapped region in bytes.
 
template<typename T >
std::span< Tas_span () const
 Returns a typed span over the mapped memory region.
 
esp_partition_mmap_handle_t release () noexcept
 Releases ownership without unmapping.
 

Friends

class partition
 

Detailed Description

A memory-mapped partition region.

Provides direct memory access to partition contents. The mapped region is automatically unmapped on destruction. Move-only.

auto mapped = part.mmap(0, part.size());
auto bytes = mapped.as_span<const uint8_t>();
static partition find(enum type type, enum subtype subtype=subtype::any, std::string_view label={})
Finds the first partition matching the given criteria.
@ data
Data partition.
@ data_fat
FAT filesystem data.
std::expected< T, std::error_code > result
result type wrapping a value or error code.
Definition error.hpp:120

Definition at line 534 of file partition.hpp.

Constructor & Destructor Documentation

◆ mmap_handle() [1/3]

idfxx::partition::mmap_handle::mmap_handle ( )
default

Constructs an invalid (unmapped) handle.

◆ ~mmap_handle()

idfxx::partition::mmap_handle::~mmap_handle ( )

◆ mmap_handle() [2/3]

idfxx::partition::mmap_handle::mmap_handle ( const mmap_handle )
delete

◆ mmap_handle() [3/3]

idfxx::partition::mmap_handle::mmap_handle ( mmap_handle &&  other)
noexcept

Move constructor.

Member Function Documentation

◆ as_span()

template<typename T >
std::span< T > idfxx::partition::mmap_handle::as_span ( ) const
inline

Returns a typed span over the mapped memory region.

Template Parameters
TElement type (must be const-qualified).
Returns
A span covering the mapped region.

Definition at line 567 of file partition.hpp.

◆ data()

const void * idfxx::partition::mmap_handle::data ( ) const
inline

Returns a pointer to the mapped memory region.

Definition at line 554 of file partition.hpp.

◆ operator bool()

idfxx::partition::mmap_handle::operator bool ( ) const
inlineexplicit

Returns true if this handle has a mapped region.

Definition at line 551 of file partition.hpp.

◆ operator=() [1/2]

mmap_handle & idfxx::partition::mmap_handle::operator= ( const mmap_handle )
delete

◆ operator=() [2/2]

mmap_handle & idfxx::partition::mmap_handle::operator= ( mmap_handle &&  other)
noexcept

Move assignment.

Unmaps any previously mapped region.

◆ release()

esp_partition_mmap_handle_t idfxx::partition::mmap_handle::release ( )
noexcept

Releases ownership without unmapping.

After calling this, the caller is responsible for unmapping the region.

Returns
The underlying mmap handle for manual lifecycle management.

◆ size()

size_t idfxx::partition::mmap_handle::size ( ) const
inline

Returns the size of the mapped region in bytes.

Definition at line 557 of file partition.hpp.

Referenced by idfxx::partition::mmap().

Friends And Related Symbol Documentation

◆ partition

Definition at line 582 of file partition.hpp.


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