microfmt
Zero-allocation C++ formatting for constrained environments
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | List of all members
microfmt::memory_pattern_scanner_ref Class Reference

Type-erased, zero-allocation handle to a memory pattern scanner. More...

#include <memory_pattern_scanner.hpp>

Classes

struct  vtable
 

Public Member Functions

constexpr memory_pattern_scanner_ref () noexcept=default
 Constructs an empty (invalid) handle.
 
template<typename Tag , typename Traits = memory_pattern_scanner_traits<Tag>, std::enable_if_t< std::is_void_v< typename Traits::context_type >, int > = 0>
constexpr memory_pattern_scanner_ref (Tag) noexcept
 Constructs a handle for a stateless scanner tag.
 
template<typename Tag , typename Context , typename Traits = memory_pattern_scanner_traits<Tag>, std::enable_if_t<!std::is_void_v< typename Traits::context_type > &&std::is_convertible_v< const Context *, const typename Traits::context_type * >, int > = 0>
constexpr memory_pattern_scanner_ref (Tag, const Context &ctx RELOCO_LIFETIMEBOUND RELOCO_LIFETIME_CAPTURE_BY_THIS) noexcept
 Constructs a handle for a stateful scanner tag.
 
template<typename Tag , typename Context , std::enable_if_t<!std::is_lvalue_reference_v< Context >, int > = 0>
constexpr memory_pattern_scanner_ref (Tag, Context &&)=delete
 
expected< memory_scan_result, address_space_error > scan (uintptr_t start_addr, size_t search_length, span< const std::byte > pattern, span< const std::byte > mask={}) const noexcept
 Executes a type-erased pattern scan across remote memory.
 
constexpr operator bool () const noexcept
 Reports whether the handle is bound to a valid scanner context.
 

Static Public Member Functions

template<typename Tag , typename Traits = memory_pattern_scanner_traits<Tag>, std::enable_if_t< std::is_void_v< typename Traits::context_type >, int > = 0>
static constexpr memory_pattern_scanner_ref make () noexcept
 
template<typename Tag , typename Context , typename Traits = memory_pattern_scanner_traits<Tag>, std::enable_if_t<!std::is_void_v< typename Traits::context_type >, int > = 0>
static constexpr memory_pattern_scanner_ref make (const Context &ctx RELOCO_LIFETIMEBOUND) noexcept
 
template<typename Tag , typename Context , std::enable_if_t<!std::is_lvalue_reference_v< Context >, int > = 0>
static memory_pattern_scanner_ref make (Context &&)=delete
 

Detailed Description

Type-erased, zero-allocation handle to a memory pattern scanner.

Borrows the scanner context and exposes a generic scan operation, abstracting the underlying memory traversal and chunking mechanics.

Constructor & Destructor Documentation

◆ memory_pattern_scanner_ref() [1/4]

constexpr microfmt::memory_pattern_scanner_ref::memory_pattern_scanner_ref ( )
constexprdefaultnoexcept

Constructs an empty (invalid) handle.

◆ memory_pattern_scanner_ref() [2/4]

template<typename Tag , typename Traits = memory_pattern_scanner_traits<Tag>, std::enable_if_t< std::is_void_v< typename Traits::context_type >, int > = 0>
constexpr microfmt::memory_pattern_scanner_ref::memory_pattern_scanner_ref ( Tag  )
inlineexplicitconstexprnoexcept

Constructs a handle for a stateless scanner tag.

◆ memory_pattern_scanner_ref() [3/4]

template<typename Tag , typename Context , typename Traits = memory_pattern_scanner_traits<Tag>, std::enable_if_t<!std::is_void_v< typename Traits::context_type > &&std::is_convertible_v< const Context *, const typename Traits::context_type * >, int > = 0>
constexpr microfmt::memory_pattern_scanner_ref::memory_pattern_scanner_ref ( Tag  ,
const Context &ctx RELOCO_LIFETIMEBOUND  RELOCO_LIFETIME_CAPTURE_BY_THIS 
)
inlineconstexprnoexcept

Constructs a handle for a stateful scanner tag.

Parameters
ctxContext object providing the memory reading capabilities.

◆ memory_pattern_scanner_ref() [4/4]

template<typename Tag , typename Context , std::enable_if_t<!std::is_lvalue_reference_v< Context >, int > = 0>
constexpr microfmt::memory_pattern_scanner_ref::memory_pattern_scanner_ref ( Tag  ,
Context &&   
)
constexprdelete

Member Function Documentation

◆ make() [1/3]

template<typename Tag , typename Traits = memory_pattern_scanner_traits<Tag>, std::enable_if_t< std::is_void_v< typename Traits::context_type >, int > = 0>
static constexpr memory_pattern_scanner_ref microfmt::memory_pattern_scanner_ref::make ( )
inlinestaticconstexprnoexcept

◆ make() [2/3]

template<typename Tag , typename Context , typename Traits = memory_pattern_scanner_traits<Tag>, std::enable_if_t<!std::is_void_v< typename Traits::context_type >, int > = 0>
static constexpr memory_pattern_scanner_ref microfmt::memory_pattern_scanner_ref::make ( const Context &ctx  RELOCO_LIFETIMEBOUND)
inlinestaticconstexprnoexcept

◆ make() [3/3]

template<typename Tag , typename Context , std::enable_if_t<!std::is_lvalue_reference_v< Context >, int > = 0>
static memory_pattern_scanner_ref microfmt::memory_pattern_scanner_ref::make ( Context &&  )
staticdelete

◆ operator bool()

constexpr microfmt::memory_pattern_scanner_ref::operator bool ( ) const
inlineexplicitconstexprnoexcept

Reports whether the handle is bound to a valid scanner context.

◆ scan()

expected< memory_scan_result, address_space_error > microfmt::memory_pattern_scanner_ref::scan ( uintptr_t  start_addr,
size_t  search_length,
span< const std::byte >  pattern,
span< const std::byte >  mask = {} 
) const
inlinenoexcept

Executes a type-erased pattern scan across remote memory.

Parameters
start_addrAbsolute memory address to begin searching.
search_lengthMaximum number of bytes to search.
patternThe specific byte sequence to find.
maskOptional bitmask of the same size as pattern. Bits set to 1 are matched; bits set to 0 are ignored (wildcards). If empty, performs an exact match.
Returns
Result containing the matching address if found, or an address space error on read failure.

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