Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
websocketpp::transport::asio::handler_allocator Class Reference

#include <base.hpp>

Collaboration diagram for websocketpp::transport::asio::handler_allocator:

Public Member Functions

 handler_allocator ()
 
void * allocate (std::size_t memsize)
 
void deallocate (void *pointer)
 

Static Public Attributes

static const size_t size = 1024
 

Detailed Description

Definition at line 52 of file base.hpp.

Constructor & Destructor Documentation

◆ handler_allocator()

websocketpp::transport::asio::handler_allocator::handler_allocator ( )
inline

Definition at line 56 of file base.hpp.

56: m_in_use(false) {}

Member Function Documentation

◆ allocate()

void * websocketpp::transport::asio::handler_allocator::allocate ( std::size_t memsize)
inline

Definition at line 63 of file base.hpp.

63 {
64 if (!m_in_use && memsize < size) {
65 m_in_use = true;
66 return static_cast<void*>(&m_storage);
67 } else {
68 return ::operator new(memsize);
69 }
70 }

◆ deallocate()

void websocketpp::transport::asio::handler_allocator::deallocate ( void * pointer)
inline

Definition at line 72 of file base.hpp.

72 {
73 if (pointer == &m_storage) {
74 m_in_use = false;
75 } else {
76 ::operator delete(pointer);
77 }
78 }
const GenericPointer< typename T::ValueType > & pointer
Definition pointer.h:1181

Member Data Documentation

◆ size

const size_t websocketpp::transport::asio::handler_allocator::size = 1024
static

Definition at line 54 of file base.hpp.


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