3#include "nalchi/export.hpp"
8struct SteamNetworkingMessage_t;
21 using ref_count_t = std::atomic<std::int32_t>;
22 using alloc_size_t = std::uint32_t;
43 NALCHI_API
auto size() const -> alloc_size_t;
73 void set_used_bit_stream(
bool);
78 NALCHI_API
void add_to_message(SteamNetworkingMessage_t* msg,
int logical_bytes_length);
80 void increase_ref_count();
81 void decrease_ref_count_and_deallocate_if_zero();
83 static
void decrease_ref_count_and_deallocate_if_zero_callback(SteamNetworkingMessage_t* msg);
86 auto ref_count() -> ref_count_t&;
87 auto ref_count() const -> const ref_count_t&;
89 auto payload_size_and_bit_stream_used_flag() -> alloc_size_t&;
90 auto payload_size_and_bit_stream_used_flag() const -> const alloc_size_t&;
Helper stream to write bits to your buffer.
Definition bit_stream.hpp:90
Extensions for ISteamNetworkingSockets.
Definition socket_extensions.hpp:21
Shared payload to store data to send.
Definition shared_payload.hpp:20
bool used_bit_stream() const
Check if this payload used bit_stream_writer to fill its content.
auto size() const -> alloc_size_t
Gets the requested allocation size of the payload.
auto word_ceiled_size() const -> alloc_size_t
Gets the payload size that's ceiled to bit_stream_writer::word_size, which is guaranteed to be safe t...
static shared_payload allocate(alloc_size_t size)
Allocates a shared payload that can be used to send some data.
void * ptr
Pointer to the payload, allocated by nalchi.
Definition shared_payload.hpp:24
auto internal_alloc_size() const -> alloc_size_t
Gets the actual allocated size, which includes hidden ref count & size fields.
static void force_deallocate(shared_payload payload)
Force deallocates the shared payload without sending it.