![]()  | 
  
    MySQL 8.0.44
    
   Source Code Documentation 
   | 
 
Description of a heuristic to determine how much memory to allocate. More...
#include <grow_constraint.h>
Public Types | |
| using | Size_t = std::size_t | 
| using | Result_t = std::pair< bool, Size_t > | 
| Return type for compute_new_size.  More... | |
Public Member Functions | |
| Grow_constraint ()=default | |
| Grow_constraint (const Grow_constraint &other)=default | |
| Grow_constraint (Grow_constraint &&other)=default | |
| Grow_constraint & | operator= (const Grow_constraint &other)=default | 
| Grow_constraint & | operator= (Grow_constraint &&other)=default | 
| virtual | ~Grow_constraint ()=default | 
| void | set_max_size (Size_t max_size) | 
| Set the maximum size.  More... | |
| Size_t | get_max_size () const | 
| void | set_grow_factor (double grow_factor) | 
| Set the grow factor.  More... | |
| double | get_grow_factor () const | 
| void | set_grow_increment (Size_t grow_increment) | 
| Set the grow increment.  More... | |
| Size_t | get_grow_increment () const | 
| void | set_block_size (Size_t block_size) | 
| Set the block size.  More... | |
| Size_t | get_block_size () const | 
| std::string | debug_string () const | 
| In debug mode, return a string that describes the internal structure of this object, to use for debugging.  More... | |
| template<class T > | |
| T | combine_with (const T &other) const | 
| Combine the constraints of this object with another Grow_constraint or Grow_calculator object.  More... | |
Static Public Attributes | |
| static constexpr Size_t | machine_max_size = std::numeric_limits<Size_t>::max() | 
| Maximum allowed value for the application max size.  More... | |
Private Attributes | |
| Size_t | m_max_size {machine_max_size} | 
| Size must not exceed this number.  More... | |
| double | m_grow_factor {default_grow_factor} | 
| Size_t | m_grow_increment {default_grow_increment} | 
| Size_t | m_block_size {default_block_size} | 
Static Private Attributes | |
| static constexpr double | default_grow_factor = 1.0 | 
| By default, don't constrain the grow factor.  More... | |
| static constexpr Size_t | default_grow_increment = 0 | 
| By default, don't constrain the grow increment.  More... | |
| static constexpr Size_t | default_block_size = 1 | 
| By default, don't constrain the block size.  More... | |
Description of a heuristic to determine how much memory to allocate.
This may be used in diverse contexts such as growing a memory buffer, or growing a pool of objects.
This encapsulates several common heuristics for growth:
| using mysqlns::buffer::Grow_constraint::Result_t = std::pair<bool, Size_t> | 
Return type for compute_new_size.
| using mysqlns::buffer::Grow_constraint::Size_t = std::size_t | 
      
  | 
  default | 
      
  | 
  default | 
      
  | 
  default | 
      
  | 
  virtualdefault | 
      
  | 
  inline | 
Combine the constraints of this object with another Grow_constraint or Grow_calculator object.
This will return a new object of the same type as the argument. The returned object will have the smallest max_size among this and other, and the largest grow_factor, grow_increment, and block_size. 
      
  | 
  inline | 
In debug mode, return a string that describes the internal structure of this object, to use for debugging.
| Grow_constraint::Size_t mysqlns::buffer::Grow_constraint::get_block_size | ( | ) | const | 
| double mysqlns::buffer::Grow_constraint::get_grow_factor | ( | ) | const | 
| Grow_constraint::Size_t mysqlns::buffer::Grow_constraint::get_grow_increment | ( | ) | const | 
| Grow_constraint::Size_t mysqlns::buffer::Grow_constraint::get_max_size | ( | ) | const | 
      
  | 
  default | 
      
  | 
  default | 
| void mysqlns::buffer::Grow_constraint::set_block_size | ( | Size_t | block_size | ) | 
Set the block size.
The size should be kept to a multiple of this number.
| void mysqlns::buffer::Grow_constraint::set_grow_factor | ( | double | grow_factor | ) | 
Set the grow factor.
Whenever the size needs to increase, it should increase it by at least this factor.
Using a value > 1 ensures that successive calls to reserve() with sizes increasing up to N take amortized linear time in N; a value equal to 1 may result in execution time that is quadratic in N.
| void mysqlns::buffer::Grow_constraint::set_grow_increment | ( | Size_t | grow_increment | ) | 
Set the grow increment.
Whenever the size needs to increase, it should increase by at least this amount.
| void mysqlns::buffer::Grow_constraint::set_max_size | ( | Size_t | max_size | ) | 
Set the maximum size.
Whenever more than this is requested, the response should be to fail. This is an inclusive upper bound, so requests for exactly this size are allowed.
      
  | 
  staticconstexprprivate | 
By default, don't constrain the block size.
      
  | 
  staticconstexprprivate | 
By default, don't constrain the grow factor.
      
  | 
  staticconstexprprivate | 
By default, don't constrain the grow increment.
      
  | 
  private | 
      
  | 
  private | 
      
  | 
  private | 
      
  | 
  private | 
Size must not exceed this number.
      
  | 
  staticconstexpr | 
Maximum allowed value for the application max size.