Public Member Functions | Public Attributes | Private Types | Private Attributes

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

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

#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.

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

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 305 of file cmn_lockidbyown.h.


Member Typedef Documentation

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

Definition at line 306 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 309 of file cmn_lockidbyown.h.

        :
        m_cacheSize(a_cacheSize),
        m_lockIDvec_p(NULL)
    {
        m_lockIDvec_p = new _V[a_cacheSize];
        ivd_NULLCHK_m(m_lockIDvec_p, "new cmn_LockID_v[a_cacheSize]");
    }

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

Definition at line 320 of file cmn_lockidbyown.h.

    {
        if (m_lockIDvec_p != NULL) {
            delete [] m_lockIDvec_p;
        }
    }


Member Function Documentation

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

Definition at line 364 of file cmn_lockidbyown.h.

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

                                    {
        return HashFunc(a_ID).CanLockByID(a_ID);
    };

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 370 of file cmn_lockidbyown.h.

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

                                                        {
        return HashFunc(a_ID).CanLockByIDOwn(a_ID);
    };

Here is the caller graph for this function:

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 345 of file cmn_lockidbyown.h.

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

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

Definition at line 351 of file cmn_lockidbyown.h.

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

                                 {
        HashFunc(a_ID).LockByID(a_ID);
    };

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 357 of file cmn_lockidbyown.h.

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

                                               {

        HashFunc(a_ID).LockByIDOwn(a_ID);
    };

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 376 of file cmn_lockidbyown.h.

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

                                   {
        HashFunc(a_ID).UnLockByID(a_ID);
    }

Here is the caller graph for this function:


Member Data Documentation

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

Definition at line 338 of file cmn_lockidbyown.h.

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

Definition at line 332 of file cmn_lockidbyown.h.

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

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

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