Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
Gray::CSmartReadPtr< TYPE > Class Template Reference

#include <cThreadLockRW.h>

Inheritance diagram for Gray::CSmartReadPtr< TYPE >:
Gray::cRefPtr< TYPE > Gray::cThreadGuardRead Gray::cPtrFacade< TYPE > Gray::cLockerT< cThreadLockRW > Gray::cPtrFacade< TYPE >

Additional Inherited Members

- Public Member Functions inherited from Gray::cRefPtr< TYPE >
 cRefPtr () noexcept
 
 cRefPtr (const TYPE *p2)
 
 cRefPtr (const THIS_t &ref)
 
 cRefPtr (const TYPE *p2, TIMESYSD_t dwWaitMS)
 
 ~cRefPtr ()
 
bool isValidPtr () const
 
bool isCorruptPtr () const
 
void put_Ptr (TYPE *p)
 
void ReleasePtr ()
 
int get_RefCount () const
 
THIS_toperator= (const TYPE *p2)
 
THIS_toperator= (const THIS_t &ref)
 
 operator cRefPtr< _TYPE_2 > () const
 
- Public Member Functions inherited from Gray::cPtrFacade< TYPE >
 cPtrFacade (TYPE *p=nullptr) noexcept
 
 cPtrFacade (THIS_t &&ref) noexcept
 
bool isValidPtr () const noexcept
 
TYPE ** get_PPtr ()
 
TYPEget_Ptr () const noexcept
 
void put_Ptr (TYPE *p) noexcept
 
void ReleasePtr () noexcept
 
void AttachPtr (TYPE *p) noexcept
 
TYPEDetachPtr () noexcept
 
THIS_toperator= (TYPE *p) noexcept
 
THIS_toperator= (THIS_t &&ref) noexcept
 
 operator TYPE * () const noexcept
 
TYPEget_Ref () const
 
TYPEoperator* () const
 
TYPEoperator-> () const
 
bool operator! () const noexcept
 Comparison ops. More...
 
bool operator!= (TYPE *p2) const noexcept
 
bool operator== (TYPE *p2) const noexcept
 
- Public Member Functions inherited from Gray::cThreadGuardRead
 cThreadGuardRead (cThreadLockRW &rLock)
 
- Public Member Functions inherited from Gray::cLockerT< cThreadLockRW >
 cLockerT (cThreadLockRW *pLock, bool bLockSuccess) noexcept
 
 cLockerT (cThreadLockRW &rLock)
 
 ~cLockerT ()
 
- Protected Member Functions inherited from Gray::cRefPtr< TYPE >
void IncRefFirst ()
 
- Protected Attributes inherited from Gray::cPtrFacade< TYPE >
TYPEm_p
 Pointer to some object of TYPE. More...
 

Detailed Description

template<class TYPE>
class Gray::CSmartReadPtr< TYPE >

I promise to only read from the cThreadLockableRW based object. If another thread is open writing then we must wait. If any thread has other read opens then it's OK. No need to lock an object if 2 threads are just reading it! we MUST record the read action in case a writer (on another thread) comes along.

Note
this only returns 'const' pointers of course.

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