Scippy

SoPlex

Sequential object-oriented simPlex

buffer< T > Class Template Referenceabstract

#include <core.h>

Public Types

using value_type = T
 
using const_reference = const T &
 

Public Member Functions

 buffer (const buffer &)=delete
 
void operator= (const buffer &)=delete
 
virtual ~buffer ()=default
 
T * begin () FMT_NOEXCEPT
 
T * end () FMT_NOEXCEPT
 
std::size_t size () const FMT_NOEXCEPT
 
std::size_t capacity () const FMT_NOEXCEPT
 
T * data () FMT_NOEXCEPT
 
const T * data () const FMT_NOEXCEPT
 
void resize (std::size_t new_size)
 
void clear ()
 
void reserve (std::size_t new_capacity)
 
void push_back (const T &value)
 
template<typename U >
void append (const U *begin, const U *end)
 
T & operator[] (std::size_t index)
 
const T & operator[] (std::size_t index) const
 

Protected Member Functions

 buffer (std::size_t sz) FMT_NOEXCEPT
 
 buffer (T *p=nullptr, std::size_t sz=0, std::size_t cap=0) FMT_NOEXCEPT
 
void set (T *buf_data, std::size_t buf_capacity) FMT_NOEXCEPT
 
virtual void grow (std::size_t capacity)=0
 

Private Attributes

T * ptr_
 
std::size_t size_
 
std::size_t capacity_
 

Detailed Description

template<typename T>
class internal::buffer< T >

A contiguous memory buffer with an optional growing ability.

Definition at line 571 of file core.h.

Member Typedef Documentation

◆ const_reference

using const_reference = const T&

Definition at line 597 of file core.h.

◆ value_type

using value_type = T

Definition at line 596 of file core.h.

Constructor & Destructor Documentation

◆ buffer() [1/3]

buffer ( std::size_t  sz)
protected

Definition at line 579 of file core.h.

◆ buffer() [2/3]

buffer ( T *  p = nullptr,
std::size_t  sz = 0,
std::size_t  cap = 0 
)
protected

Definition at line 581 of file core.h.

◆ buffer() [3/3]

buffer ( const buffer< T > &  )
delete

◆ ~buffer()

virtual ~buffer ( )
virtualdefault

Member Function Documentation

◆ append()

void append ( const U *  begin,
const U *  end 
)

Appends data to the end of the buffer.

Definition at line 527 of file format.h.

Referenced by internal::reset_color(), internal::vformat_to(), and formatbuf< Char >::xsputn().

◆ begin()

T* begin ( )

Definition at line 603 of file core.h.

Referenced by formatter< std::tm, Char >::format().

◆ capacity()

std::size_t capacity ( ) const

Returns the capacity of this buffer.

Definition at line 610 of file core.h.

Referenced by formatter< std::tm, Char >::format(), basic_memory_buffer< Char >::move(), internal::snprintf_float(), and bigint::~bigint().

◆ clear()

void clear ( )

Clears this buffer.

Definition at line 627 of file core.h.

◆ data() [1/2]

◆ data() [2/2]

const T* data ( ) const

Returns a pointer to the buffer data.

Definition at line 616 of file core.h.

◆ end()

T* end ( )

Definition at line 604 of file core.h.

Referenced by formatter< std::tm, Char >::format().

◆ grow()

virtual void grow ( std::size_t  capacity)
protectedpure virtual

◆ operator=()

void operator= ( const buffer< T > &  )
delete

◆ operator[]() [1/2]

T& operator[] ( std::size_t  index)

Definition at line 642 of file core.h.

◆ operator[]() [2/2]

const T& operator[] ( std::size_t  index) const

Definition at line 643 of file core.h.

◆ push_back()

void push_back ( const T &  value)

◆ reserve()

void reserve ( std::size_t  new_capacity)

Reserves space to store at least capacity elements.

Definition at line 630 of file core.h.

Referenced by formatter< std::tm, Char >::format(), and internal::snprintf_float().

◆ resize()

◆ set()

void set ( T *  buf_data,
std::size_t  buf_capacity 
)
protected

Sets the buffer data and capacity.

Definition at line 587 of file core.h.

Referenced by basic_memory_buffer< Char >::move().

◆ size()

Member Data Documentation

◆ capacity_

std::size_t capacity_
private

Definition at line 575 of file core.h.

◆ ptr_

T* ptr_
private

Definition at line 573 of file core.h.

◆ size_

std::size_t size_
private

Definition at line 574 of file core.h.