CGEM BOSS 6.6.5.i
BESIII Offline Software System
Loading...
Searching...
No Matches
AutoEnlargeBuffer Class Reference

#include <AutoEnlargeBuffer.h>

Public Member Functions

 AutoEnlargeBuffer (int size=128 *1024)
 
 ~AutoEnlargeBuffer ()
 
void copy (void *src, int size)
 
int size ()
 
void * data ()
 

Detailed Description

Definition at line 7 of file AutoEnlargeBuffer.h.

Constructor & Destructor Documentation

◆ AutoEnlargeBuffer()

AutoEnlargeBuffer::AutoEnlargeBuffer ( int size = 128*1024)
inline

Definition at line 28 of file AutoEnlargeBuffer.h.

29 : m_SIZE( size ),
30 m_size( 0 )
31{
32 m_buffer = malloc(size);
33}

◆ ~AutoEnlargeBuffer()

AutoEnlargeBuffer::~AutoEnlargeBuffer ( )
inline

Definition at line 35 of file AutoEnlargeBuffer.h.

36{
37 free( m_buffer );
38}

Member Function Documentation

◆ copy()

void AutoEnlargeBuffer::copy ( void * src,
int size )
inline

Definition at line 40 of file AutoEnlargeBuffer.h.

41{
42 if ( size > m_SIZE ) {
43 do {
44 m_SIZE *= 2;
45 }
46 while ( size > m_SIZE );
47
48 free( m_buffer );
49 m_buffer = malloc(m_SIZE);
50 }
51
52 m_size = size;
53 memcpy(m_buffer, src, size);
54}

Referenced by DimRpcReader::nextEvent().

◆ data()

void * AutoEnlargeBuffer::data ( )
inline

Definition at line 18 of file AutoEnlargeBuffer.h.

18{ return m_buffer; }

Referenced by DimRpcReader::currentEvent(), and DimRpcReader::nextEvent().

◆ size()

int AutoEnlargeBuffer::size ( )
inline

Definition at line 17 of file AutoEnlargeBuffer.h.

17{ return m_size; }

Referenced by AutoEnlargeBuffer(), and copy().


The documentation for this class was generated from the following file: