RESTinio
|
A special class that allows to hold a copy of small-size method_matchers or a pointer to dynamically allocated large-size method_matchers. More...
#include <method_matcher.hpp>
Public Member Functions | |
buffered_matcher_holder_t ()=default | |
~buffered_matcher_holder_t () noexcept | |
buffered_matcher_holder_t (const buffered_matcher_holder_t &)=delete | |
buffered_matcher_holder_t & | operator= (const buffered_matcher_holder_t &)=delete |
buffered_matcher_holder_t (buffered_matcher_holder_t &&other) noexcept | |
buffered_matcher_holder_t & | operator= (buffered_matcher_holder_t &&other) noexcept |
template<typename Target_Type , typename... Args> | |
void | assign (Args &&... args) |
Creates an instance of Target_Type and initializes it with arguments Args. More... | |
RESTINIO_NODISCARD method_matcher_t * | get () const noexcept |
Get the pointer to actual matcher inside the holder. More... | |
RESTINIO_NODISCARD method_matcher_t * | operator-> () const noexcept |
Get the pointer to actual matcher inside the holder. More... | |
RESTINIO_NODISCARD method_matcher_t & | operator* () const noexcept |
Get a reference to actual matcher inside the holder. More... | |
Private Types | |
using | pfn_move_t = method_matcher_t *(*)(void *object, void *buffer) |
A type of free function to be used to move a value of an object to the specified buffer. More... | |
Private Member Functions | |
void | cleanup () |
void | move_from (buffered_matcher_holder_t &other) |
Private Attributes | |
method_matcher_t * | m_matcher { nullptr } |
A pointer to actual matcher allocated inside the internall buffer. More... | |
std::array< char, buffer_size > | m_buffer |
The internal buffer. More... | |
pfn_move_t | m_mover { nullptr } |
An actual move-function. More... | |
Static Private Attributes | |
static constexpr std::size_t | buffer_size |
The size of the internal buffer. More... | |
static constexpr std::size_t | alignment |
Alignment to be used by the internal buffer. More... | |
Friends | |
void | assign (buffered_matcher_holder_t &holder, http_method_id_t method) |
template<typename Arg > | |
void | assign (buffered_matcher_holder_t &holder, Arg &&method_matcher) |
A special class that allows to hold a copy of small-size method_matchers or a pointer to dynamically allocated large-size method_matchers.
An instance of this class looks like a smart pointer to method_matcher_t. This smart pointer is moveable, but not copyable (it's like unique_ptr).
A value is set by assign() method:
Definition at line 224 of file method_matcher.hpp.
|
private |
A type of free function to be used to move a value of an object to the specified buffer.
This function should allocate a new instance in buffer and move the content of object into it. The pointer to the allocated instance should be returned.
Definition at line 245 of file method_matcher.hpp.
|
default |
|
inlinenoexcept |
Definition at line 285 of file method_matcher.hpp.
|
delete |
|
inlinenoexcept |
Definition at line 297 of file method_matcher.hpp.
|
inline |
Creates an instance of Target_Type and initializes it with arguments Args.
Previous value of buffered_matcher_holder_t will be destroyed.
A new object is created in the internal buffer if its size is not greater than buffer_size. Otherwise a new object is created in dynamic memory and allocated_matcher_proxy_t for it is placed into the internal buffer.
Definition at line 329 of file method_matcher.hpp.
|
inlineprivate |
Definition at line 264 of file method_matcher.hpp.
|
inlinenoexcept |
Get the pointer to actual matcher inside the holder.
Definition at line 358 of file method_matcher.hpp.
|
inlineprivate |
Definition at line 270 of file method_matcher.hpp.
|
inlinenoexcept |
Get a reference to actual matcher inside the holder.
Definition at line 368 of file method_matcher.hpp.
|
inlinenoexcept |
Get the pointer to actual matcher inside the holder.
Definition at line 363 of file method_matcher.hpp.
|
inlinenoexcept |
Definition at line 304 of file method_matcher.hpp.
|
delete |
|
friend |
Definition at line 378 of file method_matcher.hpp.
|
friend |
Definition at line 371 of file method_matcher.hpp.
|
staticconstexprprivate |
Alignment to be used by the internal buffer.
Definition at line 231 of file method_matcher.hpp.
|
staticconstexprprivate |
The size of the internal buffer.
Definition at line 227 of file method_matcher.hpp.
|
private |
The internal buffer.
Definition at line 255 of file method_matcher.hpp.
|
private |
A pointer to actual matcher allocated inside the internall buffer.
Can be nullptr. For example: just after the creation and before the call to assign(). Or after a move-constructor or move-operator.
Definition at line 252 of file method_matcher.hpp.
|
private |
An actual move-function.
Can be nullptr if assign() is not called yet.
Definition at line 261 of file method_matcher.hpp.