Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
GrayLib::cNetSystem Class Reference

#include <cNetSystem.h>

Inheritance diagram for GrayLib::cNetSystem:
Gray::cSingletonSmart< cNetSystem > Gray::cSingleton< TYPE > Gray::cRefBase Gray::cSingletonStatic< TYPE > Gray::cSingletonRegister IUnknown Gray::CObject Gray::cHeapObject Gray::IHeapObject

Public Member Functions

bool isInitNet () const noexcept
 
const WSADATA * get_NetData () const noexcept
 
- Public Member Functions inherited from Gray::CObject
virtual ~CObject ()
 
virtual bool isValidCheck () const noexcept
 < memory allocation and structure definitions are valid. More...
 
virtual void AssertValid () const
 < memory allocation and structure definitions are valid. More...
 
virtual void Serialize (cArchive &a)
 
- Public Member Functions inherited from Gray::cHeapObject
 cHeapObject ()
 
virtual ~cHeapObject ()
 
bool IsValidInsideN (INT_PTR index) const
 
bool IsValidInsidePtr (void const *pTest) const
 
virtual size_t GetHeapStatsThis (OUT ITERATE_t &iAllocCount) const
 
virtual bool isValidCheck () const noexcept
 
- Public Member Functions inherited from Gray::cRefBase
 cRefBase (int iRefCount=0) noexcept
 
virtual ~cRefBase ()
 
int get_RefCount () const noexcept
 
HASHCODE_t get_HashCode () const noexcept
 
 STDMETHOD_ (HASHCODE_t, get_HashCodeX)() const noexcept
 
virtual void onFinalRelease ()
 
bool isValidObj () const noexcept
 
 STDMETHOD_ (ULONG, AddRef)(void) override
 
 STDMETHOD_ (ULONG, Release)(void) override
 
STDMETHOD() QueryInterface (const IID &riid, void __RPC_FAR *__RPC_FAR *ppvObject) override
 
void IncRefCount ()
 
void DecRefCount ()
 
bool isStaticConstruct () const noexcept
 
void StaticConstruct ()
 
void StaticDestruct ()
 
bool isDestructing () noexcept
 
void SetDestructing ()
 

Static Public Member Functions

static bool IsInitNetCalls ()
 
static HRESULT GetLastError ()
 
static HRESULT GetLastErrorDef (HRESULT hResDef=E_FAIL)
 
- Static Public Member Functions inherited from Gray::cSingleton< TYPE >
static TYPE *__stdcall get_Single ()
 
template<class TYPE2 >
static TYPE2 *__stdcall get_SingleT ()
 
static TYPE &__stdcall I ()
 
- Static Public Member Functions inherited from Gray::cSingletonStatic< TYPE >
static bool isSingleCreated () noexcept
 
static TYPEget_SingleU () noexcept
 
static TYPEget_Single ()
 
template<class TYPE2 >
static TYPE2 *__stdcall get_SingleCast ()
 
static TYPEI () noexcept
 
- Static Public Member Functions inherited from Gray::cSingletonRegister
static void __stdcall ReleaseModule (HMODULE hMod)
 

Protected Member Functions

 cNetSystem ()
 
 ~cNetSystem ()
 
- Protected Member Functions inherited from Gray::cSingletonSmart< cNetSystem >
 cSingletonSmart (cNetSystem *pObject, const TYPEINFO_t &rAddrCode, int iRefCountStart=0)
 
const void * get_HeapPtr () const noexcept override
 Get the top level (outermost, freeable) class pointer. I can delete get_HeapPtr(). More...
 
- Protected Member Functions inherited from Gray::cSingleton< TYPE >
 cSingleton (TYPE *pObject, const TYPEINFO_t &rAddrCode=typeid(TYPE)) noexcept
 
virtual ~cSingleton ()
 
- Protected Member Functions inherited from Gray::cSingletonStatic< TYPE >
 cSingletonStatic (TYPE *pObject) noexcept
 
virtual ~cSingletonStatic () noexcept
 
- Protected Member Functions inherited from Gray::cSingletonRegister
 cSingletonRegister (const TYPEINFO_t &rAddrCode) noexcept
 
virtual ~cSingletonRegister ()
 
void RegisterSingleton ()
 

Friends

class cSingleton< cNetSystem >
 

Additional Inherited Members

- Static Public Attributes inherited from Gray::cSingletonRegister
static cThreadLockFast sm_LockSingle
 common lock for all cSingleton. More...
 
- Protected Attributes inherited from Gray::cSingletonRegister
HMODULE m_hModuleLoaded
 What modules loaded this ? So singletons can be destroyed if DLL/SO unloads. More...
 
- Static Protected Attributes inherited from Gray::cSingletonStatic< TYPE >
static TYPEsm_pThe = nullptr
 pointer to the one and only object of this TYPE. ASSUME automatically init to = nullptr. More...
 

Detailed Description

Must call WSAStartup() for any of the network code to work. (cNetSocket or cNetHost lookup) Must use cNetSystemPtr to reference this. Only does something for _WIN32. linux doesn't need this.

Constructor & Destructor Documentation

◆ cNetSystem()

GrayLib::cNetSystem::cNetSystem ( )
protected

WSAStartup() calls are counted under the hood. _WIN32 only!

sm_nInitNetCalls is not really needed.

◆ ~cNetSystem()

GrayLib::cNetSystem::~cNetSystem ( )
protected

_WIN32 only! counted exit calls.

Note
This doesn't actually seem to do anything. the 6 threads created do not go away.

Member Function Documentation

◆ get_NetData()

const WSADATA* GrayLib::cNetSystem::get_NetData ( ) const
inlinenoexcept

◆ GetLastError()

static HRESULT GrayLib::cNetSystem::GetLastError ( )
inlinestatic

Get last network error for this thread. _WIN32 needs different call for last error. WSAGetLastError!=normal GetLastError, no idea why. I hear under the hood is just forwarded to GetLastError.

◆ GetLastErrorDef()

static HRESULT GrayLib::cNetSystem::GetLastErrorDef ( HRESULT  hResDef = E_FAIL)
inlinestatic

An error occurred. try to find out why.

◆ isInitNet()

bool GrayLib::cNetSystem::isInitNet ( ) const
inlinenoexcept

relevant for _WIN32 only! Init Failed!

◆ IsInitNetCalls()

static bool GrayLib::cNetSystem::IsInitNetCalls ( )
inlinestatic

global check for anyone calling cNetSystem relevant for _WIN32 only!

Friends And Related Function Documentation

◆ cSingleton< cNetSystem >

friend class cSingleton< cNetSystem >
friend

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