Thread portable class


Gate portable class


Timer class


Pool class


Terimber 2.0


About C++


Downloads Products & Services Support Clients Open Source About



Home / Open source / Terimber 2.0

byte_tank< N > Class Template Reference

class supports byte memory management allocated block will have 4 hidden leading bytes 1st byte = backet number [4-12], 2nd - byte = offset/state [0-255], 3rd-4th bytes = page number [0-64K], for allocation out of backet More...

#include <byterep.h>

List of all members.

Public Types

enum  BACKET { LENGTH = (1<<N) + 4, ROOMS = 8*sizeof(rooms_type_t) }
 backet constants More...

Public Member Functions

 byte_tank (byte_allocator &all)
 constructor
bool full () const
 checks if the backet is full
bool empty () const
 checks if the backet is empty
char * get_chunk ()
 gets available chunk
void put_chunk (char *ptr)
 returns back chunk
void reset ()
 ready to reuse chunks

Private Types

typedef ub8_t rooms_type_t
 64 bits

Private Attributes

char * _head
 memory pointer
rooms_type_t _states
 bitset, bit = 1 - busy, bit = 0 free


Detailed Description

template<unsigned char N>
class byte_tank< N >

class supports byte memory management allocated block will have 4 hidden leading bytes 1st byte = backet number [4-12], 2nd - byte = offset/state [0-255], 3rd-4th bytes = page number [0-64K], for allocation out of backet

Definition at line 43 of file byterep.h.


Member Typedef Documentation

template<unsigned char N>
byte_tank< N >::rooms_type_t [private]

64 bits

Definition at line 47 of file byterep.h.


Member Enumeration Documentation

template<unsigned char N>
enum byte_tank::BACKET

backet constants

Enumerator:
LENGTH  length of backet chunk
ROOMS  availbale chunks

Definition at line 51 of file byterep.h.


Constructor & Destructor Documentation

template<unsigned char N>
BEGIN_TERIMBER_NAMESPACE byte_tank< N >::byte_tank ( byte_allocator all  )  [inline]

constructor

Parameters:
all  external allocator

Definition at line 43 of file byterep.hpp.

References byte_tank< N >::_head, byte_allocator::allocate(), byte_tank< N >::LENGTH, and byte_tank< N >::ROOMS.


Member Function Documentation

template<unsigned char N>
bool byte_tank< N >::full (  )  const [inline]

checks if the backet is full

Definition at line 50 of file byterep.hpp.

References byte_tank< N >::_states.

template<unsigned char N>
bool byte_tank< N >::empty (  )  const [inline]

checks if the backet is empty

Definition at line 57 of file byterep.hpp.

References byte_tank< N >::_states.

Referenced by byte_tank< N >::get_chunk().

template<unsigned char N>
char * byte_tank< N >::get_chunk (  )  [inline]

gets available chunk

Definition at line 64 of file byterep.hpp.

References byte_tank< N >::_head, byte_tank< N >::_states, byte_tank< N >::empty(), and byte_tank< N >::LENGTH.

template<unsigned char N>
void byte_tank< N >::put_chunk ( char *  ptr  )  [inline]

returns back chunk

Parameters:
ptr  pointer to the chunk

Definition at line 143 of file byterep.hpp.

References byte_tank< N >::_states.

template<unsigned char N>
void byte_tank< N >::reset (  )  [inline]

ready to reuse chunks

Definition at line 178 of file byterep.hpp.

References byte_tank< N >::_states.


Member Data Documentation

template<unsigned char N>
char* byte_tank< N >::_head [private]

memory pointer

Definition at line 84 of file byterep.h.

Referenced by byte_tank< N >::byte_tank(), and byte_tank< N >::get_chunk().

template<unsigned char N>
rooms_type_t byte_tank< N >::_states [private]


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


© Copyright Terimber 2003-.