Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
Buffer< T > Class Template Reference

Base class for all QMember types that hold data in an expandable format. More...

#include <Buffer.hxx>

Inheritance diagram for Buffer< T >:
BufferBase QMember

Public Types

typedef T value_type
 The type of payload this buffer contains.
 

Public Member Functions

Buffer< T > * ref ()
 Add another reference to the buffer.
 
void unref ()
 Decrement count.
 
T * data ()
 get a pointer to the start of the data.
 
- Public Member Functions inherited from BufferBase
uint16_t references ()
 
void set_done (BarrierNotifiable *done)
 Specifies that a given BarrierNotifiable must be called when the Buffer is deallocated (unreffed to zero, meaning that all owners have freed it).
 
BarrierNotifiablenew_child ()
 Creates a new child notifiable of the current done notifiable.
 
size_t size ()
 
- Public Member Functions inherited from QMember
void init ()
 Initiailize a QMember, in place of a public placement construction.
 

Private Member Functions

 Buffer (Pool *pool)
 Constructor.
 
 ~Buffer ()
 Destructor.
 
 DISALLOW_COPY_AND_ASSIGN (Buffer)
 

Private Attributes

data_
 user data
 

Friends

class Pool
 Allow Pool access to our constructor.
 
class DataBuffer
 Allow DataBuffer access to our constructor.
 

Additional Inherited Members

- Protected Member Functions inherited from BufferBase
Poolpool ()
 Get a pointer to the pool that this buffer belongs to.
 
 BufferBase (size_t size, Pool *pool)
 Constructor.
 
 ~BufferBase ()
 Destructor.
 
 DISALLOW_COPY_AND_ASSIGN (BufferBase)
 
- Protected Member Functions inherited from QMember
 QMember ()
 Constructor.
 
 ~QMember ()
 Destructor.
 
- Protected Attributes inherited from BufferBase
Poolpool_
 Reference to the pool from whence this buffer came.
 
BarrierNotifiabledone_
 Notifiable to call when the buffer has finished processing everywhere.
 
uint16_t size_
 size of data in bytes
 
std::atomic_uint_least16_t count_
 number of references in use
 
- Protected Attributes inherited from QMember
QMembernext
 pointer to the next member in the queue
 

Detailed Description

template<class T>
class Buffer< T >

Base class for all QMember types that hold data in an expandable format.

Definition at line 194 of file Buffer.hxx.

Member Typedef Documentation

◆ value_type

template<class T >
typedef T Buffer< T >::value_type

The type of payload this buffer contains.

Definition at line 198 of file Buffer.hxx.

Constructor & Destructor Documentation

◆ Buffer()

template<class T >
Buffer< T >::Buffer ( Pool pool)
inlineprivate

Constructor.

Parameters
poolpool this buffer belong to

Definition at line 224 of file Buffer.hxx.

◆ ~Buffer()

template<class T >
Buffer< T >::~Buffer ( )
inlineprivate

Destructor.

Definition at line 231 of file Buffer.hxx.

Member Function Documentation

◆ data()

template<class T >
T * Buffer< T >::data ( )
inline

get a pointer to the start of the data.

Definition at line 215 of file Buffer.hxx.

◆ ref()

template<class T >
Buffer< T > * Buffer< T >::ref ( )
inline

Add another reference to the buffer.

Returns
the referenced buffer pointer.

Definition at line 203 of file Buffer.hxx.

◆ unref()

template<class T >
void Buffer< T >::unref ( )
inline

Decrement count.

Definition at line 675 of file Buffer.hxx.

Friends And Related Symbol Documentation

◆ DataBuffer

template<class T >
friend class DataBuffer
friend

Allow DataBuffer access to our constructor.

Definition at line 240 of file Buffer.hxx.

◆ Pool

template<class T >
friend class Pool
friend

Allow Pool access to our constructor.

Definition at line 238 of file Buffer.hxx.

Member Data Documentation

◆ data_

template<class T >
T Buffer< T >::data_
private

user data

Definition at line 243 of file Buffer.hxx.


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