24#ifndef MYSQL_CONTAINERS_BUFFERS_GROW_CONSTRAINT_H
25#define MYSQL_CONTAINERS_BUFFERS_GROW_CONSTRAINT_H
130 ss <<
"Grow_constraint(ptr=" << (
const void *)
this
151 ret.set_max_size(std::min(
get_max_size(), other.get_max_size()));
152 ret.set_grow_factor(std::max(
get_grow_factor(), other.get_grow_factor()));
153 ret.set_grow_increment(
155 ret.set_block_size(std::max(
get_block_size(), other.get_block_size()));
Description of a heuristic to determine how much memory to allocate.
Definition: grow_constraint.h:66
T combine_with(const T &other) const
Combine the constraints of this object with another Grow_constraint or Grow_calculator object.
Definition: grow_constraint.h:149
std::size_t Size_t
Definition: grow_constraint.h:68
Grow_constraint & operator=(const Grow_constraint &other)=default
Size_t get_grow_increment() const
Definition: grow_constraint.cpp:48
Size_t m_grow_increment
Definition: grow_constraint.h:176
Grow_constraint & operator=(Grow_constraint &&other)=default
static constexpr Size_t default_grow_increment
By default, don't constrain the grow increment.
Definition: grow_constraint.h:167
void set_grow_factor(double grow_factor)
Set the grow factor.
Definition: grow_constraint.cpp:36
double m_grow_factor
Definition: grow_constraint.h:173
std::pair< bool, Size_t > Result_t
Return type for compute_new_size.
Definition: grow_constraint.h:70
std::string debug_string() const
In debug mode, return a string that describes the internal structure of this object,...
Definition: grow_constraint.h:124
Size_t m_max_size
Size must not exceed this number.
Definition: grow_constraint.h:161
Size_t get_block_size() const
Definition: grow_constraint.cpp:56
Grow_constraint(Grow_constraint &&other)=default
static constexpr double default_grow_factor
By default, don't constrain the grow factor.
Definition: grow_constraint.h:164
Grow_constraint(const Grow_constraint &other)=default
double get_grow_factor() const
Definition: grow_constraint.cpp:41
Size_t m_block_size
Definition: grow_constraint.h:179
Size_t get_max_size() const
Definition: grow_constraint.cpp:32
static constexpr Size_t default_block_size
By default, don't constrain the block size.
Definition: grow_constraint.h:170
virtual ~Grow_constraint()=default
static constexpr Size_t machine_max_size
Maximum allowed value for the application max size.
Definition: grow_constraint.h:72
void set_max_size(Size_t max_size)
Set the maximum size.
Definition: grow_constraint.cpp:30
void set_grow_increment(Size_t grow_increment)
Set the grow increment.
Definition: grow_constraint.cpp:43
void set_block_size(Size_t block_size)
Set the block size.
Definition: grow_constraint.cpp:52
Grow_constraint()=default
Definition: buffer_sequence_view.h:51
std::basic_ostringstream< char, std::char_traits< char >, ut::allocator< char > > ostringstream
Specialization of basic_ostringstream which uses ut::allocator.
Definition: ut0new.h:2872
#define NODISCARD
The function attribute [[NODISCARD]] is a replacement for [[nodiscard]] to workaround a gcc bug.
Definition: nodiscard.h:47