#include <cmn_lockidbyown.h>


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 |
typedef cmn_IDOwn<_T> cmn_LockIDHash< _V, _T >::cmn_LockEl_t [private] |
Definition at line 292 of file cmn_lockidbyown.h.
| 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 } //============================================================================//
| 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 }
| _V& cmn_LockIDHash< _V, _T >::HashFunc | ( | const cmn_LockEl_t & | a_ID | ) | const [inline] |
Definition at line 327 of file cmn_lockidbyown.h.
Referenced by cmn_LockIDHash< cmn_LockIDbyOwn, _T >::CanLockByID(), cmn_LockIDHash< cmn_LockIDbyOwn, _T >::CanLockByIDOwn(), cmn_LockIDHash< cmn_LockIDbyOwn, _T >::LockByID(), fio_TransGroupLock< _T, _defTransEl >::LockByIDOwn(), cmn_LockIDHash< cmn_LockIDbyOwn, _T >::LockByIDOwn(), and cmn_LockIDHash< cmn_LockIDbyOwn, _T >::UnLockByID().
00327 { 00328 return *(m_lockIDvec_p + (a_ID % m_cacheSize)); 00329 };

| _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 };
| 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 };

| 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 };

| 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 };

| 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 };

| 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 }

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().
_V* cmn_LockIDHash< _V, _T >::m_lockIDvec_p [private] |
Definition at line 319 of file cmn_lockidbyown.h.
Referenced by cmn_LockIDHash< cmn_LockIDbyOwn, _T >::cmn_LockIDHash(), cmn_LockIDHash< cmn_LockIDbyOwn, _T >::HashFunc(), and cmn_LockIDHash< cmn_LockIDbyOwn, _T >::~cmn_LockIDHash().
| cmn_LockIDHash< _V, _T >::log_CLASSID_m |
Definition at line 324 of file cmn_lockidbyown.h.
1.5.6