![]() |
Gray C++ Libraries
0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
|
#include <cXObjMgr.h>
Public Types | |
| enum | M_TYPE_ { M_QTY } |
Public Member Functions | |
| virtual cScriptableInterfaceDefPtr _stdcall | get_ScriptInterfaceDef () const |
| cXObjMgr (cXObjDef *pRoot=nullptr) | |
| virtual | ~cXObjMgr () |
| virtual HRESULT | InitXObjMgr (cXObjDef *pRoot) |
| virtual void | DisposeAllX () |
| virtual cXObjectPtr | FindByUID (UID_t uid) const |
| cXObjectPtr | GetAtHash (const cHashIterator &e) const |
| XOBJTIDX_TYPE | FindXObjTypeIdx (const ATOMCHAR_t *pszXObjTypeName) const |
| XOBJTIDX_TYPE | FindXObjTypeIdx (XOBJTID_t nXObjTypeId) const |
| cXObjTypeDef * | EnumXObjTypeDef (XOBJTIDX_TYPE index) const |
| cXObjTypeDef * | FindXObjTypeDef (const ATOMCHAR_t *pszXObjTypeName) const |
| cXObjTypeDef * | FindXObjTypeDef (XOBJTID_t nXObjTypeId) const |
| const ATOMCHAR_t * | FindXObjTypeName (XOBJTID_t nXObjTypeId) const |
| XOBJTID_t | FindXObjTypeId (const ATOMCHAR_t *pszXObjTypeName) const |
| bool | IsXObjTypeDemandLoaded (XOBJTID_t nXObjTypeId) const |
| XOBJTIDX_TYPE | RegisterXObjTypeDef (cXObjTypeDef *pXObjTypeDef) |
| ITERATE_t | UnloadXObjTypeDef (XOBJTID_t nXObjTypeId) |
| ITERATE_t | get_XObjCount () const |
| cXObjDefPtr | FindDefByUID (UID_t rid) const |
| HRESULT | AddXObjSymName (cXObjDef *pXObjDef) |
| bool | RemoveXObjSymName (const ATOMCHAR_t *pszSymName) |
| cXObjDefPtr | FindBySymName0 (const ATOMCHAR_t *pszSymName) const |
| cXObjDefPtr | FindBySymName (const ATOMCHAR_t *pszSymName) const |
| cXObjDefPtr | FindBySymNamePartial (const ATOMCHAR_t *pszNamePartial) const |
| cXObjectPtr | FindByVar (const cVariant &vID) const |
| virtual HRESULT | CreateXObjDef (OUT cXObjDefPtr &rpXObjDefNew, const cXObjTypeDef *pXObjTypeDef, cAtomRef aSymName) |
| virtual HRESULT | CreateXObjDefX (OUT cXObjDefPtr &rpXObjDefNew, const cXObjTypeDef *pXObjTypeDef, cAtomRef aSymName, IScriptableEnumerator *pProps) |
| virtual HRESULT | s_Invoke_GetObjTypes (OUT cVariant &vValRet) |
| virtual HRESULT | s_Invoke_FindObjects (const cVariant &vArgs, OUT cVariant &vValRet) |
| HRESULT | s_Invoke_DumpConst (const cVariant &vArgs) |
| virtual UID_t | MakeUID (XOBJTID_t nXObjTypeId, UIDINDEX_t nIndex) |
| HRESULT | AssignFreeUID (cXObject *pObj, UIDINDEX_t nIndex) |
| virtual HRESULT | AddXObj (cXObject *pXObj) |
| HRESULT | AddXObjCheck (cXObject *pXObj, UIDINDEX_t nIndex=k_HASHCODE_CLEAR) |
| virtual void | RemoveXObj (cXObject *pXObj) |
| virtual HRESULT | AddXObjDef (cXObjDef *pXObjDef) |
| HRESULT | AddXObjDefCheck (cXObjDef *pXObjDef, UIDINDEX_t nIndex) |
| virtual void | RemoveXObjDef (cXObjDef *pXObjDef) |
| STDMETHOD() | FindByUID (UID_t uid, OUT IXObject **ppObj) override |
| STDMETHOD() | FindByStr (const ATOMCHAR_t *pszID, OUT IXObject **ppObj) override |
| STDMETHOD() | FindBySymName (const ATOMCHAR_t *pszSymName, OUT IXObject **ppObj) override |
| STDMETHOD() | CreateInstance (IUnknown *pUnkOuter, const IID &riid, OUT void **ppvObject) override |
| STDMETHOD() | LockServer (BOOL fLock) override |
| STDMETHOD() | QueryInterface (const IID &riid, OUT void __RPC_FAR *__RPC_FAR *ppvObject) override |
| STDMETHOD() | s_Invoke (const cScriptableMethod *pMethod, const cVariant &vArgs, OUT cVariant &vValRet) |
| UNITTEST_FRIEND (cXObjMgr) | |
| IUNKNOWN_DISAMBIG_R (cRefBase) | |
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 HRESULT | CheckValidSignature (UINT32 nGrayLibVer, size_t nSizeofThis) |
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 TYPE * | get_SingleU () noexcept |
| static TYPE * | get_Single () |
| template<class TYPE2 > | |
| static TYPE2 *__stdcall | get_SingleCast () |
| static TYPE & | I () noexcept |
Static Public Member Functions inherited from Gray::cSingletonRegister | |
| static void __stdcall | ReleaseModule (HMODULE hMod) |
Public Attributes | |
| const cObjectSignature | m_Sig |
| Used to check for compatible config and alignments. More... | |
| cHashTableRef< cXObject, UID_t, 6 > | m_XObjHash |
| the hash of cXObject objects by UID. Some may be in private hash! cUIDManagerArray? IXObjModPlugin More... | |
Static Public Attributes | |
| static cScriptableMethod | sm_Methods [M_QTY+1] |
| static cScriptableInterfaceDef | sm_ScriptInterfaceDef |
| static cXObjTypeDef | sm_DEFAULT = { k_XOBJTID_DEFAULT, "Default", XOBJTYPF_0, nullptr, "Dynamic XObject" } |
| Used to create a bare XObject. More... | |
Static Public Attributes inherited from Gray::cSingletonRegister | |
| static cThreadLockFast | sm_LockSingle |
| common lock for all cSingleton. More... | |
Protected Attributes | |
| cArraySortSymName< cXObjDef > | m_aXObjSymNames |
| Store all cXObjDef(s) sorted by SymName or get_SymName() More... | |
| cThreadLockCount | m_LockXObj |
| used to lock access m_XObjHash More... | |
| cArrayPtr< cXObjTypeDef > | m_aXObjTypeDefs |
| Metadata info about the cXObject types i use. XOBJTID_t, XOBJTIDX_TYPE = index in this array. More... | |
Protected Attributes inherited from Gray::cSingletonRegister | |
| HMODULE | m_hModuleLoaded |
| What modules loaded this ? So singletons can be destroyed if DLL/SO unloads. More... | |
Friends | |
| class | cSingleton< cXObjMgr > |
Additional Inherited Members | |
Protected Member Functions inherited from Gray::cSingletonSmart< cXObjMgr > | |
| cSingletonSmart (cXObjMgr *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 () |
Static Protected Attributes inherited from Gray::cSingletonStatic< TYPE > | |
| static TYPE * | sm_pThe = nullptr |
| pointer to the one and only object of this TYPE. ASSUME automatically init to = nullptr. More... | |
A pool of indexed resource objects. Index resource objects by UID and SYMNAME. Allow alternate SYMNAME via cScriptContext::GetContextRoot(). define meta data for the resource types.
| GrayLib::cXObjMgr::cXObjMgr | ( | cXObjDef * | pRoot = nullptr | ) |
|
virtual |
Assume get_UIDValue() set, Add to the hashes.
| HRESULT GrayLib::cXObjMgr::AddXObjCheck | ( | cXObject * | pXObj, |
| UIDINDEX_t | nIndex = k_HASHCODE_CLEAR |
||
| ) |
Add a new cXObject based object to the UID hash table. if it doesn't already have a UID, find a free spot in the hash
Assume get_UIDValue(), SymName is already set. Add to the hashes.
| HRESULT GrayLib::cXObjMgr::AddXObjDefCheck | ( | cXObjDef * | pXObjDef, |
| UIDINDEX_t | nIndex | ||
| ) |
Add a new cXObjDef based object to the UID hash table and SymName table. if it doesn't already have a UID, find a free spot in the hash
Add this XObj to the hash with a given SYMNAME.
| HRESULT GrayLib::cXObjMgr::AssignFreeUID | ( | cXObject * | pObj, |
| UIDINDEX_t | nIndex | ||
| ) |
Make a new free UID for some object. Optionally incorporate UIDINDEX_t in UID.
|
inlinestatic |
Must be agreed to by all users. sizeof(cAppState) for checking alignments of structures. Ensure that some external DLL/SO caller has the same structure packing that we have.
|
override |
Create some type of object.
|
virtual |
|
virtual |
Create a cXObjDef object of a certain type. we are probably loading it from a script ? pProps
|
virtual |
Reimplemented in GrayLib::cXObjMgrPack.
| cXObjTypeDef * GrayLib::cXObjMgr::EnumXObjTypeDef | ( | XOBJTIDX_TYPE | index | ) | const |
|
override |
| cXObjDefPtr GrayLib::cXObjMgr::FindBySymName | ( | const ATOMCHAR_t * | pszSymName | ) | const |
Find SYMNAME for object.
|
override |
| cXObjDefPtr GrayLib::cXObjMgr::FindBySymName0 | ( | const ATOMCHAR_t * | pszSymName | ) | const |
Find by primary SymName and nothing else.
| cXObjDefPtr GrayLib::cXObjMgr::FindBySymNamePartial | ( | const ATOMCHAR_t * | pszNamePartial | ) | const |
Find a partial match of a SYMNAME
|
virtual |
Get the cXObject by its UID. This can be overridden to add support for special cUIDRangeMask ranges.
Reimplemented in GrayLib::cXObjMgrPack.
| cXObjectPtr GrayLib::cXObjMgr::FindByVar | ( | const cVariant & | vID | ) | const |
Find an object by SymName or UID. (or friendly name?) vID = SYMNAME or UID.
| cXObjDefPtr GrayLib::cXObjMgr::FindDefByUID | ( | UID_t | rid | ) | const |
Get the cXObjDef from a UID. e.g. cUID::k_ROOT
| cXObjTypeDef * GrayLib::cXObjMgr::FindXObjTypeDef | ( | const ATOMCHAR_t * | pszXObjTypeName | ) | const |
find the type by name.
| cXObjTypeDef * GrayLib::cXObjMgr::FindXObjTypeDef | ( | XOBJTID_t | nXObjTypeId | ) | const |
Find the FOURCC code for the XObject type in the XObject defs
| XOBJTID_t GrayLib::cXObjMgr::FindXObjTypeId | ( | const ATOMCHAR_t * | pszXObjTypeName | ) | const |
| XOBJTIDX_TYPE GrayLib::cXObjMgr::FindXObjTypeIdx | ( | const ATOMCHAR_t * | pszXObjTypeName | ) | const |
Find the cXObjTypeDef by name
| XOBJTIDX_TYPE GrayLib::cXObjMgr::FindXObjTypeIdx | ( | XOBJTID_t | nXObjTypeId | ) | const |
Find the cXObjTypeDef by XOBJTID_t (FOURCC)
| const ATOMCHAR_t * GrayLib::cXObjMgr::FindXObjTypeName | ( | XOBJTID_t | nXObjTypeId | ) | const |
Find the FOURCC code for the XObject type in the XObject defs.
|
inlinevirtual |
|
inline |
|
inline |
Walk hash table.
Create and Assign the k_ROOT object. ASSUME RegisterXObjTypeDef() already called.
Reimplemented in GrayLib::cXObjMgrPack.
| bool GrayLib::cXObjMgr::IsXObjTypeDemandLoaded | ( | XOBJTID_t | nXObjTypeId | ) | const |
Is this type loaded only when needed? (from db or file)
| GrayLib::cXObjMgr::IUNKNOWN_DISAMBIG_R | ( | cRefBase | ) |
|
override |
|
virtual |
Make a UID of a specific XOBJTID_t. We are about to create a new XObject.
|
override |
| XOBJTIDX_TYPE GrayLib::cXObjMgr::RegisterXObjTypeDef | ( | cXObjTypeDef * | pXObjTypeDef | ) |
Register a cXObjTypeDef definition. Assume static and never removed.
|
virtual |
called by DisposeThis
|
virtual |
called by DisposeThis
Reimplemented in GrayLib::cXObjMgrPack.
| bool GrayLib::cXObjMgr::RemoveXObjSymName | ( | const ATOMCHAR_t * | pszSymName | ) |
remove an object by SymName
| HRESULT GrayLib::cXObjMgr::s_Invoke | ( | const cScriptableMethod * | pMethod, |
| const cVariant & | vArgs, | ||
| OUT cVariant & | vValRet | ||
| ) |
ASSUME the root object exposes this.
Dump to current cScriptContext console or file.
|
virtual |
support CATOM_STATIC(FindObjects) method.
support CATOM_STATIC(GetObjTypes) method. Get a list of XObject types for FindObject.
| GrayLib::cXObjMgr::UNITTEST_FRIEND | ( | cXObjMgr | ) |
unload all XObject of this type.
|
friend |
|
protected |
Store all cXObjDef(s) sorted by SymName or get_SymName()
all cXObjDef sorted by symbolic resource name get_SymName()
|
protected |
Metadata info about the cXObject types i use. XOBJTID_t, XOBJTIDX_TYPE = index in this array.
|
mutableprotected |
used to lock access m_XObjHash
| const cObjectSignature GrayLib::cXObjMgr::m_Sig |
Used to check for compatible config and alignments.
Used to check for compatible config and alignments. _INC_GrayLibBase_H, sizeof(cXObjMgr)
| cHashTableRef<cXObject, UID_t, 6> GrayLib::cXObjMgr::m_XObjHash |
the hash of cXObject objects by UID. Some may be in private hash! cUIDManagerArray? IXObjModPlugin
Store cXObject and cXObjDef(s) sorted by UID.
|
static |
Used to create a bare XObject.
|
static |
|
static |