rpa::obuf_guard< Mutex > Class Template Reference

Encapsulates the mutex and the maximum size of per-threads buffers. More...

#include <common.h>

Inheritance diagram for rpa::obuf_guard< Mutex >:

rpa::obuf_iterator< IterOut, Buffer, IterBuf, Mutex > rpa::obuf_iterator< IterOut, Buffer, void, Mutex > List of all members.

Public Member Functions

void check (void) const
 obuf_guard (Mutex *aMtx, size_t aMaxSz)
 Only important explicit constructor.
 obuf_guard (const obuf_guard &aOIG)
size_t max_size (void) const

Private Member Functions

 obuf_guard ()
 No default constructor because of the pointer.
obuf_guardoperator= (const obuf_guard &)

Private Attributes

Mutex * _Mtx
 Points to any mutex as long as it is conformant to the mutex interface.
size_t _maxSz
 The maximum number of elements to be written into the output buffer.

Classes

class  inner_guard

Detailed Description

template<class Mutex>
class rpa::obuf_guard< Mutex >

Encapsulates the mutex and the maximum size of per-threads buffers.

When the size of buffers is limited, we need a mutex. Otherwise not. Therefore, the two things are grouped together.


Constructor & Destructor Documentation

template<class Mutex>
rpa::obuf_guard< Mutex >::obuf_guard (  )  [private]

No default constructor because of the pointer.

template<class Mutex>
rpa::obuf_guard< Mutex >::obuf_guard ( Mutex *  aMtx,
size_t  aMaxSz 
) [inline]

Only important explicit constructor.

template<class Mutex>
rpa::obuf_guard< Mutex >::obuf_guard ( const obuf_guard< Mutex > &  aOIG  )  [inline]

Simple copy constructor. Note that the mutex pointer is copied as is, because the mutex object is not managed by us.


Member Function Documentation

template<class Mutex>
void rpa::obuf_guard< Mutex >::check ( void   )  const [inline]

Run_time check, for debugging. Mainly checks whether the maximum number of elements is a reasonable size, or it is the usual max size of a dynamic container. This number is temporary only and should be replaced by a clean constant. Is it equal to 'size_type(-1)' ? Check standard.

template<class Mutex>
size_t rpa::obuf_guard< Mutex >::max_size ( void   )  const [inline]

When a buffer reaches the maximum size, the mutex is locked, and the buffer is flushed into the output iterator.

template<class Mutex>
obuf_guard& rpa::obuf_guard< Mutex >::operator= ( const obuf_guard< Mutex > &   )  [private]


Member Data Documentation

template<class Mutex>
size_t rpa::obuf_guard< Mutex >::_maxSz [private]

The maximum number of elements to be written into the output buffer.

template<class Mutex>
Mutex* rpa::obuf_guard< Mutex >::_Mtx [private]

Points to any mutex as long as it is conformant to the mutex interface.


The documentation for this class was generated from the following file:
Generated on Tue Sep 25 10:20:35 2007 for rpa by  doxygen 1.4.7