FIX::shared_array< T > Class Template Reference

Shared array with atomic reference count. More...

`#include <SharedArray.h>`

Inheritance diagram for FIX::shared_array< T >:
[legend]

## Public Member Functions

| shared_array ()
| shared_array (const shared_array &rhs)
| ~shared_array ()
shared_array & | operator= (const shared_array &rhs)
std::size_t | size () const
bool | empty () const
| operator T* () const

## Static Public Member Functions

static shared_array | create (const std::size_t nSize)

## Private Member Functions

| shared_array (T *buff, std::size_t nSize, void *pCtr)
atomic_count * | get_counter () const
void | increment_reference_count () const
long | decrement_reference_count () const
void | attach () const
void | release ()

## Private Attributes

std::size_t | m_size
T * | m_buffer
void * | m_pCtr

## Detailed Description

### template<typename T>
class FIX::shared_array< T >

Shared array with atomic reference count.

Definition at line 174 of file SharedArray.h.

## Constructor & Destructor Documentation

## shared_array() [1/3]

template<typename T >

FIX::shared_array< T >::shared_array | ( |  | ) |

inline

Definition at line 194 of file SharedArray.h.

{ return m_buffer == 0; }
operator T* () const
{ return m_buffer; }

Referenced by FIX::shared_array< int >::shared_array().

## shared_array() [2/3]

template<typename T >

FIX::shared_array< T >::shared_array | ( | const shared_array< T > & | rhs | ) |

inline

Definition at line 200 of file SharedArray.h.

{
if(nSize <= 0)
return shared_array();

## ~shared_array()

template<typename T >

FIX::shared_array< T >::~shared_array | ( |  | ) |

inline

Definition at line 207 of file SharedArray.h.

## shared_array() [3/3]

template<typename T >

FIX::shared_array< T >::shared_array | ( | T * | buff,
|  | std::size_t | nSize,
|  | void * | pCtr
| ) |  |

inline private

Definition at line 259 of file SharedArray.h.

{
T * tmpBuff = m_buffer;
atomic_count* tmpCounter = get_counter();

## Member Function Documentation

## attach()

template<typename T >

void FIX::shared_array< T >::attach | ( |  | ) | const

inline private

Definition at line 284 of file SharedArray.h.

## create()

template<typename T >

static shared_array FIX::shared_array< T >::create | ( | const std::size_t | nSize | ) |

inline static

Definition at line 235 of file SharedArray.h.

{
atomic_count* counter = get_counter();
++(*counter);
}
long decrement_reference_count() const
{
atomic_count* counter = get_counter();
return --(*counter);
}
void attach() const
{
if( !empty() )
increment_reference_count();
}

Referenced by FIX::message_order::message_order().

## decrement_reference_count()

template<typename T >

long FIX::shared_array< T >::decrement_reference_count | ( |  | ) | const

inline private

Definition at line 278 of file SharedArray.h.

## empty()

template<typename T >

bool FIX::shared_array< T >::empty | ( |  | ) | const

inline

Definition at line 228 of file SharedArray.h.

{

Referenced by FIX::message_order::operator()().

## get_counter()

template<typename T >

atomic_count* FIX::shared_array< T >::get_counter | ( |  | ) | const

inline private

Definition at line 267 of file SharedArray.h.

Referenced by FIX::shared_array< int >::shared_array().

## increment_reference_count()

template<typename T >

void FIX::shared_array< T >::increment_reference_count | ( |  | ) | const

inline private

Definition at line 272 of file SharedArray.h.

## operator T*()

template<typename T >

FIX::shared_array< T >::operator T* | ( |  | ) | const

inline

Definition at line 231 of file SharedArray.h.

{

## operator=()

template<typename T >

shared_array& FIX::shared_array< T >::operator= | ( | const shared_array< T > & | rhs | ) |

inline

Definition at line 210 of file SharedArray.h.

:

## release()

template<typename T >

void FIX::shared_array< T >::release | ( |  | ) |

inline private

Definition at line 290 of file SharedArray.h.

## size()

template<typename T >

std::size_t FIX::shared_array< T >::size | ( |  | ) | const

inline

Definition at line 225 of file SharedArray.h.

: m_size(nSize)

## Member Data Documentation

## m_buffer

template<typename T >

T* FIX::shared_array< T >::m_buffer

private

Definition at line 312 of file SharedArray.h.

Referenced by FIX::shared_array< int >::shared_array().

## m_pCtr

template<typename T >

void* FIX::shared_array< T >::m_pCtr

private

Definition at line 313 of file SharedArray.h.

## m_size

template<typename T >

std::size_t FIX::shared_array< T >::m_size

private

Definition at line 311 of file SharedArray.h.

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

- SharedArray.h

FIX::shared_array::get_counter
atomic_count * get_counter() const
Definition: SharedArray.h:267
FIX::shared_array::increment_reference_count
void increment_reference_count() const
Definition: SharedArray.h:272
FIX::shared_array::decrement_reference_count
long decrement_reference_count() const
Definition: SharedArray.h:278
FIX::shared_array::m_size
std::size_t m_size
Definition: SharedArray.h:311
FIX::shared_array::m_buffer
T * m_buffer
Definition: SharedArray.h:312
FIX::shared_array::shared_array
shared_array()
Definition: SharedArray.h:194
FIX::shared_array::attach
void attach() const
Definition: SharedArray.h:284
FIX::shared_array::empty
bool empty() const
Definition: SharedArray.h:228