NCBI C++ ToolKit
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
CSimpleBufferT< T, ResizeStrategy > Class Template Reference

Search Toolkit Book for CSimpleBufferT

Reallocable memory buffer (no memory copy overhead) Mimics vector<>, without the overhead of explicit initialization of all items. More...

#include <util/simple_buffer.hpp>

+ Inheritance diagram for CSimpleBufferT< T, ResizeStrategy >:
+ Collaboration diagram for CSimpleBufferT< T, ResizeStrategy >:

Public Types

typedef T value_type
 
typedef size_t size_type
 

Public Member Functions

 CSimpleBufferT (size_type new_size=0)
 
 ~CSimpleBufferT ()
 
 CSimpleBufferT (const CSimpleBufferT &sb)
 
CSimpleBufferToperator= (const CSimpleBufferT &sb)
 
CSimpleBufferTappend (const void *buf, size_t len)
 
size_type size () const
 
size_type capacity () const
 
void reserve (size_type new_size)
 
void resize (size_type new_size)
 
void resize_mem (size_type new_size)
 Resize the buffer. No data preservation. More...
 
void swap (CSimpleBufferT< T > &other)
 
void reserve_mem (size_type new_size)
 Reserve memory. No data preservation guarantees. More...
 
void clear ()
 
const value_typeoperator[] (size_type i) const
 
value_typeoperator[] (size_type i)
 
const value_typedata () const
 
value_typedata ()
 

Private Member Functions

void x_Fill (value_type *buffer, int value, size_t elem)
 
void x_Deallocate ()
 
value_typex_Allocate (size_t elem)
 

Private Attributes

value_typem_Buffer
 
size_type m_Size
 
size_type m_Capacity
 

Detailed Description

template<typename T = unsigned char, typename ResizeStrategy = CPowerOfTwoResizeStrategy>
class CSimpleBufferT< T, ResizeStrategy >

Reallocable memory buffer (no memory copy overhead) Mimics vector<>, without the overhead of explicit initialization of all items.

Examples
/home/coremake/doxygen/cxx/include/util/buffer_writer.hpp, and /home/coremake/doxygen/cxx/src/objtools/data_loaders/asn_cache/buffer_writer.hpp.

Definition at line 84 of file simple_buffer.hpp.

Member Typedef Documentation

◆ size_type

template<typename T = unsigned char, typename ResizeStrategy = CPowerOfTwoResizeStrategy>
typedef size_t CSimpleBufferT< T, ResizeStrategy >::size_type

Definition at line 88 of file simple_buffer.hpp.

◆ value_type

template<typename T = unsigned char, typename ResizeStrategy = CPowerOfTwoResizeStrategy>
typedef T CSimpleBufferT< T, ResizeStrategy >::value_type

Definition at line 87 of file simple_buffer.hpp.

Constructor & Destructor Documentation

◆ CSimpleBufferT() [1/2]

template<typename T = unsigned char, typename ResizeStrategy = CPowerOfTwoResizeStrategy>
CSimpleBufferT< T, ResizeStrategy >::CSimpleBufferT ( size_type  new_size = 0)
inlineexplicit

Definition at line 90 of file simple_buffer.hpp.

◆ ~CSimpleBufferT()

template<typename T = unsigned char, typename ResizeStrategy = CPowerOfTwoResizeStrategy>
CSimpleBufferT< T, ResizeStrategy >::~CSimpleBufferT ( )
inline

Definition at line 98 of file simple_buffer.hpp.

◆ CSimpleBufferT() [2/2]

template<typename T = unsigned char, typename ResizeStrategy = CPowerOfTwoResizeStrategy>
CSimpleBufferT< T, ResizeStrategy >::CSimpleBufferT ( const CSimpleBufferT< T, ResizeStrategy > &  sb)
inline

Definition at line 103 of file simple_buffer.hpp.

Member Function Documentation

◆ append()

template<typename T = unsigned char, typename ResizeStrategy = CPowerOfTwoResizeStrategy>
CSimpleBufferT& CSimpleBufferT< T, ResizeStrategy >::append ( const void *  buf,
size_t  len 
)
inline

Definition at line 135 of file simple_buffer.hpp.

Referenced by CNCBlobStorage::WriteBlobList(), and TNCBufferType::WriteText().

◆ capacity()

template<typename T = unsigned char, typename ResizeStrategy = CPowerOfTwoResizeStrategy>
size_type CSimpleBufferT< T, ResizeStrategy >::capacity ( void  ) const
inline

◆ clear()

template<typename T = unsigned char, typename ResizeStrategy = CPowerOfTwoResizeStrategy>
void CSimpleBufferT< T, ResizeStrategy >::clear ( void  )
inline

◆ data() [1/2]

template<typename T = unsigned char, typename ResizeStrategy = CPowerOfTwoResizeStrategy>
value_type* CSimpleBufferT< T, ResizeStrategy >::data ( void  )
inline

Definition at line 240 of file simple_buffer.hpp.

◆ data() [2/2]

template<typename T = unsigned char, typename ResizeStrategy = CPowerOfTwoResizeStrategy>
const value_type* CSimpleBufferT< T, ResizeStrategy >::data ( void  ) const
inline

◆ operator=()

template<typename T = unsigned char, typename ResizeStrategy = CPowerOfTwoResizeStrategy>
CSimpleBufferT& CSimpleBufferT< T, ResizeStrategy >::operator= ( const CSimpleBufferT< T, ResizeStrategy > &  sb)
inline

Definition at line 116 of file simple_buffer.hpp.

◆ operator[]() [1/2]

template<typename T = unsigned char, typename ResizeStrategy = CPowerOfTwoResizeStrategy>
value_type& CSimpleBufferT< T, ResizeStrategy >::operator[] ( size_type  i)
inline

Definition at line 228 of file simple_buffer.hpp.

◆ operator[]() [2/2]

template<typename T = unsigned char, typename ResizeStrategy = CPowerOfTwoResizeStrategy>
const value_type& CSimpleBufferT< T, ResizeStrategy >::operator[] ( size_type  i) const
inline

Definition at line 222 of file simple_buffer.hpp.

◆ reserve()

template<typename T = unsigned char, typename ResizeStrategy = CPowerOfTwoResizeStrategy>
void CSimpleBufferT< T, ResizeStrategy >::reserve ( size_type  new_size)
inline

◆ reserve_mem()

template<typename T = unsigned char, typename ResizeStrategy = CPowerOfTwoResizeStrategy>
void CSimpleBufferT< T, ResizeStrategy >::reserve_mem ( size_type  new_size)
inline

Reserve memory. No data preservation guarantees.

Definition at line 207 of file simple_buffer.hpp.

Referenced by CNCBlobStorage::WriteBlobList().

◆ resize()

template<typename T = unsigned char, typename ResizeStrategy = CPowerOfTwoResizeStrategy>
void CSimpleBufferT< T, ResizeStrategy >::resize ( size_type  new_size)
inline

◆ resize_mem()

template<typename T = unsigned char, typename ResizeStrategy = CPowerOfTwoResizeStrategy>
void CSimpleBufferT< T, ResizeStrategy >::resize_mem ( size_type  new_size)
inline

◆ size()

template<typename T = unsigned char, typename ResizeStrategy = CPowerOfTwoResizeStrategy>
size_type CSimpleBufferT< T, ResizeStrategy >::size ( void  ) const
inline

◆ swap()

template<typename T = unsigned char, typename ResizeStrategy = CPowerOfTwoResizeStrategy>
void CSimpleBufferT< T, ResizeStrategy >::swap ( CSimpleBufferT< T > &  other)
inline

Definition at line 199 of file simple_buffer.hpp.

◆ x_Allocate()

template<typename T = unsigned char, typename ResizeStrategy = CPowerOfTwoResizeStrategy>
value_type* CSimpleBufferT< T, ResizeStrategy >::x_Allocate ( size_t  elem)
inlineprivate

◆ x_Deallocate()

template<typename T = unsigned char, typename ResizeStrategy = CPowerOfTwoResizeStrategy>
void CSimpleBufferT< T, ResizeStrategy >::x_Deallocate ( )
inlineprivate

◆ x_Fill()

template<typename T = unsigned char, typename ResizeStrategy = CPowerOfTwoResizeStrategy>
void CSimpleBufferT< T, ResizeStrategy >::x_Fill ( value_type buffer,
int  value,
size_t  elem 
)
inlineprivate

Member Data Documentation

◆ m_Buffer

template<typename T = unsigned char, typename ResizeStrategy = CPowerOfTwoResizeStrategy>
value_type* CSimpleBufferT< T, ResizeStrategy >::m_Buffer
private

◆ m_Capacity

template<typename T = unsigned char, typename ResizeStrategy = CPowerOfTwoResizeStrategy>
size_type CSimpleBufferT< T, ResizeStrategy >::m_Capacity
private

◆ m_Size

template<typename T = unsigned char, typename ResizeStrategy = CPowerOfTwoResizeStrategy>
size_type CSimpleBufferT< T, ResizeStrategy >::m_Size
private

The documentation for this class was generated from the following file:
Modified on Mon Jul 15 05:31:49 2024 by modify_doxy.py rev. 669887