FastMM documentation
FastMM C++ API 0.6.0
Public headers, tier 1 and tier 2
Loading...
Searching...
No Matches
fastmm::venues::EventSink Class Reference

#include <fastmm/venues/event_sink.hpp>

Public Types

using OverflowFn = void(*)(void *ctx, const EventSink &sink) noexcept
 
using DrainFn = void(*)(void *ctx) noexcept
 

Public Member Functions

 EventSink () noexcept=default
 
 EventSink (MsgRing *ring, SinkPolicy policy, std::uint32_t spin_limit=1 '000 '000) noexcept
 
void attach (MsgRing *ring, SinkPolicy policy, std::uint32_t spin_limit=1 '000 '000) noexcept
 
void attach (ShmRing *ring, SinkPolicy policy, std::uint32_t spin_limit=1 '000 '000) noexcept
 A ring another process reads (fastmm-gateway).
 
void set_overflow_callback (OverflowFn fn, void *ctx) noexcept
 
void set_drain_hook (DrainFn fn, void *ctx, bool on_commit) noexcept
 
bool attached () const noexcept
 
MsgRing * ring () const noexcept
 
ShmRing * shm_ring () const noexcept
 
template<MessageLike M>
M * reserve (std::uint32_t len=static_cast< std::uint32_t >(sizeof(M))) noexcept
 In-place construction: reserve, fill, commit.
 
std::byte * reserve_bytes (std::uint32_t len) noexcept
 
void commit () noexcept
 
bool push (const EventHeader &m) noexcept
 Copy-in: m.len bytes starting at the header.
 
std::uint64_t pushed () const noexcept
 
std::uint64_t overflows () const noexcept
 
SinkPolicy policy () const noexcept
 

Member Typedef Documentation

◆ OverflowFn

using fastmm::venues::EventSink::OverflowFn = void (*)(void* ctx, const EventSink& sink) noexcept

◆ DrainFn

using fastmm::venues::EventSink::DrainFn = void (*)(void* ctx) noexcept

Constructor & Destructor Documentation

◆ EventSink() [1/2]

fastmm::venues::EventSink::EventSink ( )
defaultnoexcept

◆ EventSink() [2/2]

fastmm::venues::EventSink::EventSink ( MsgRing *  ring,
SinkPolicy  policy,
std::uint32_t  spin_limit = 1'000'000 
)
inlinenoexcept

Member Function Documentation

◆ attach() [1/2]

void fastmm::venues::EventSink::attach ( MsgRing *  ring,
SinkPolicy  policy,
std::uint32_t  spin_limit = 1'000'000 
)
inlinenoexcept

◆ attach() [2/2]

void fastmm::venues::EventSink::attach ( ShmRing *  ring,
SinkPolicy  policy,
std::uint32_t  spin_limit = 1'000'000 
)
inlinenoexcept

A ring another process reads (fastmm-gateway).

◆ set_overflow_callback()

void fastmm::venues::EventSink::set_overflow_callback ( OverflowFn  fn,
void *  ctx 
)
inlinenoexcept

◆ set_drain_hook()

void fastmm::venues::EventSink::set_drain_hook ( DrainFn  fn,
void *  ctx,
bool  on_commit 
)
inlinenoexcept

◆ attached()

bool fastmm::venues::EventSink::attached ( ) const
inlinenoexcept

◆ ring()

MsgRing * fastmm::venues::EventSink::ring ( ) const
inlinenoexcept

◆ shm_ring()

ShmRing * fastmm::venues::EventSink::shm_ring ( ) const
inlinenoexcept

◆ reserve()

template<MessageLike M>
M * fastmm::venues::EventSink::reserve ( std::uint32_t  len = static_cast<std::uint32_t>(sizeof(M)))
inlinenoexcept

In-place construction: reserve, fill, commit.

nullptr when the ring is full (after the policy's spin) or detached; the caller must not commit then.

◆ reserve_bytes()

std::byte * fastmm::venues::EventSink::reserve_bytes ( std::uint32_t  len)
inlinenoexcept

The consumer is this thread: spinning frees nothing.

◆ commit()

void fastmm::venues::EventSink::commit ( )
inlinenoexcept

◆ push()

bool fastmm::venues::EventSink::push ( const EventHeader &  m)
inlinenoexcept

Copy-in: m.len bytes starting at the header.

◆ pushed()

std::uint64_t fastmm::venues::EventSink::pushed ( ) const
inlinenoexcept

◆ overflows()

std::uint64_t fastmm::venues::EventSink::overflows ( ) const
inlinenoexcept

◆ policy()

SinkPolicy fastmm::venues::EventSink::policy ( ) const
inlinenoexcept