foobar2000 SDK  2015-08-03
Public Member Functions | Protected Member Functions
mem_block_containerabstract

#include <mem_block_container.h>

+ Inheritance diagram for mem_block_container:

Public Member Functions

void copy (const mem_block_container &p_source)
 
void from_stream (stream_reader *p_stream, t_size p_bytes, abort_callback &p_abort)
 
virtual const void * get_ptr () const =0
 
virtual void * get_ptr ()=0
 
virtual t_size get_size () const =0
 
const mem_block_containeroperator= (const mem_block_container &p_source)
 
void reset ()
 
void set (const void *p_buffer, t_size p_size)
 
void set (const mem_block_container &source)
 
template<typename t_source >
void set (const t_source &source)
 
virtual void set_size (t_size p_size)=0
 

Protected Member Functions

 mem_block_container ()
 
 ~mem_block_container ()
 

Detailed Description

Generic interface for a memory block; used by various other interfaces to return memory blocks while allowing caller to allocate.

Definition at line 2 of file mem_block_container.h.

Constructor & Destructor Documentation

mem_block_container::mem_block_container ( )
inlineprotected

Definition at line 24 of file mem_block_container.h.

24 {}
mem_block_container::~mem_block_container ( )
inlineprotected

Definition at line 25 of file mem_block_container.h.

25 {}

Member Function Documentation

void mem_block_container::copy ( const mem_block_container p_source)
inline

Definition at line 18 of file mem_block_container.h.

18 {set(p_source.get_ptr(),p_source.get_size());}
virtual const void * get_ptr() const =0
virtual t_size get_size() const =0
void mem_block_container::from_stream ( stream_reader p_stream,
t_size  p_bytes,
abort_callback p_abort 
)

Definition at line 3 of file mem_block_container.cpp.

3  {
4  if (p_bytes == 0) {set_size(0);}
5  set_size(p_bytes);
6  p_stream->read_object(get_ptr(),p_bytes,p_abort);
7 }
virtual void set_size(t_size p_size)=0
virtual const void * get_ptr() const =0
virtual const void* mem_block_container::get_ptr ( ) const
pure virtual
virtual void* mem_block_container::get_ptr ( )
pure virtual
virtual t_size mem_block_container::get_size ( ) const
pure virtual
const mem_block_container& mem_block_container::operator= ( const mem_block_container p_source)
inline

Definition at line 21 of file mem_block_container.h.

21 {copy(p_source);return *this;}
void copy(const mem_block_container &p_source)
void mem_block_container::reset ( )
inline

Definition at line 19 of file mem_block_container.h.

19 {set_size(0);}
virtual void set_size(t_size p_size)=0
void mem_block_container::set ( const void *  p_buffer,
t_size  p_size 
)

Definition at line 9 of file mem_block_container.cpp.

9  {
10  set_size(p_size);
11  memcpy(get_ptr(),p_buffer,p_size);
12 }
virtual void set_size(t_size p_size)=0
virtual const void * get_ptr() const =0
void mem_block_container::set ( const mem_block_container source)
inline

Definition at line 12 of file mem_block_container.h.

12 {copy(source);}
void copy(const mem_block_container &p_source)
template<typename t_source >
void mem_block_container::set ( const t_source &  source)
inline

Definition at line 13 of file mem_block_container.h.

13  {
14  PFC_STATIC_ASSERT( sizeof(source[0]) == 1 );
15  set(source.get_ptr(), source.get_size());
16  }
virtual void mem_block_container::set_size ( t_size  p_size)
pure virtual

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