cmn_LockIDHash< _V, _T > Class Template Reference
[Common, basic classes, functions and types]

#include <cmn_lockidbyown.h>

Inheritance diagram for cmn_LockIDHash< _V, _T >:

Inheritance graph
[legend]
Collaboration diagram for cmn_LockIDHash< _V, _T >:

Collaboration graph
[legend]

List of all members.


Detailed Description

template<class _V, class _T>
class cmn_LockIDHash< _V, _T >

Template cmn_LockIDHash use many small cmn_LockIDbyOwn classes to store lock elements.

This is an inprovement of cmn_LockID for huge number of locks (more than 1000) at same time. Lock element has to have implemented ==, %, << (write to stream) operations operation % represent hash function operation == tell if element is already locked (is in hash) operation << is used in debug mode to write element

Hash table doesn't need mutex. a cmn_LockIDbyOwn take care about multy use.

Definition at line 291 of file cmn_lockidbyown.h.


Public Member Functions

 cmn_LockIDHash (int a_cacheSize)
 ~cmn_LockIDHash ()
_V & HashFunc (const cmn_LockEl_t &a_ID) const
_V & HashFunc (_T a_ID) const
void LockByID (const _T a_ID)
void LockByIDOwn (const cmn_LockEl_t &a_ID)
bool CanLockByID (const _T a_ID)
cmn_Lock_e CanLockByIDOwn (const cmn_LockEl_t &a_ID)
void UnLockByID (const _T a_ID)

Public Attributes

 log_CLASSID_m

Private Types

typedef cmn_IDOwn< _T > cmn_LockEl_t

Private Attributes

int m_cacheSize
_V * m_lockIDvec_p

Member Typedef Documentation

template<class _V, class _T>
typedef cmn_IDOwn<_T> cmn_LockIDHash< _V, _T >::cmn_LockEl_t [private]

Definition at line 292 of file cmn_lockidbyown.h.


Constructor & Destructor Documentation

template<class _V, class _T>
cmn_LockIDHash< _V, _T >::cmn_LockIDHash ( int  a_cacheSize  )  [inline]

Definition at line 295 of file cmn_lockidbyown.h.

00296         :
00297         m_cacheSize(a_cacheSize),
00298         m_lockIDvec_p(NULL)
00299     {
00300         m_lockIDvec_p = new _V[a_cacheSize];
00301         ivd_NULLCHK_m(m_lockIDvec_p, "new cmn_LockID_v[a_cacheSize]");
00302     }
//============================================================================//

template<class _V, class _T>
cmn_LockIDHash< _V, _T >::~cmn_LockIDHash (  )  [inline]

Definition at line 306 of file cmn_lockidbyown.h.

00307     {
00308         if (m_lockIDvec_p != NULL) {
00309             delete [] m_lockIDvec_p;
00310         }
00311     }


Member Function Documentation

template<class _V, class _T>
_V& cmn_LockIDHash< _V, _T >::HashFunc ( const cmn_LockEl_t a_ID  )  const [inline]

template<class _V, class _T>
_V& cmn_LockIDHash< _V, _T >::HashFunc ( _T  a_ID  )  const [inline]

Definition at line 331 of file cmn_lockidbyown.h.

00331                                   {
00332         return *(m_lockIDvec_p + (a_ID % m_cacheSize));
00333     };

template<class _V, class _T>
void cmn_LockIDHash< _V, _T >::LockByID ( const _T  a_ID  )  [inline]

Definition at line 337 of file cmn_lockidbyown.h.

Referenced by fio_TransGroupLock< _T, _defTransEl >::LockByID().

00337                                  {
00338         HashFunc(a_ID).LockByID(a_ID);
00339     };

Here is the caller graph for this function:

template<class _V, class _T>
void cmn_LockIDHash< _V, _T >::LockByIDOwn ( const cmn_LockEl_t a_ID  )  [inline]

Definition at line 343 of file cmn_lockidbyown.h.

Referenced by fio_TransGroupLock< _T, _defTransEl >::LockByIDOwn().

00343                                                {
00344 
00345         HashFunc(a_ID).LockByIDOwn(a_ID);
00346     };

Here is the caller graph for this function:

template<class _V, class _T>
bool cmn_LockIDHash< _V, _T >::CanLockByID ( const _T  a_ID  )  [inline]

Definition at line 350 of file cmn_lockidbyown.h.

Referenced by fio_TransGroupLock< _T, _defTransEl >::CanLockByID().

00350                                     {
00351         return HashFunc(a_ID).CanLockByID(a_ID);
00352     };

Here is the caller graph for this function:

template<class _V, class _T>
cmn_Lock_e cmn_LockIDHash< _V, _T >::CanLockByIDOwn ( const cmn_LockEl_t a_ID  )  [inline]

Definition at line 356 of file cmn_lockidbyown.h.

Referenced by fio_TransGroupLock< _T, _defTransEl >::CanLockByIDOwn().

00356                                                         {
00357         return HashFunc(a_ID).CanLockByIDOwn(a_ID);
00358     };

Here is the caller graph for this function:

template<class _V, class _T>
void cmn_LockIDHash< _V, _T >::UnLockByID ( const _T  a_ID  )  [inline]

Definition at line 362 of file cmn_lockidbyown.h.

Referenced by fio_TransGroupLock< _T, _defTransEl >::UnLockByID(), and fio_TransGroupLock< _T, _defTransEl >::UnLockByOwn().

00362                                    {
00363         HashFunc(a_ID).UnLockByID(a_ID);
00364     }

Here is the caller graph for this function:


Member Data Documentation

template<class _V, class _T>
int cmn_LockIDHash< _V, _T >::m_cacheSize [private]

Definition at line 318 of file cmn_lockidbyown.h.

Referenced by cmn_LockIDHash< cmn_LockIDbyOwn, _T >::HashFunc().

template<class _V, class _T>
_V* cmn_LockIDHash< _V, _T >::m_lockIDvec_p [private]

template<class _V, class _T>
cmn_LockIDHash< _V, _T >::log_CLASSID_m

Definition at line 324 of file cmn_lockidbyown.h.


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

Generated on Mon Feb 27 19:05:13 2012 for OPENARCHIVE by  doxygen 1.5.6