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

#include <cXObjMgrPack.h>

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

Public Member Functions

 cXObjMgrPack (cXObjDef *pRoot=nullptr)
 
virtual ~cXObjMgrPack ()
 
cStringF get_ScriptDir () const noexcept
 
void put_ScriptDir (cStringF sDir)
 
virtual HRESULT InitXObjMgr (cXObjDef *pRoot) override
 
virtual void DisposeAllX () override
 
virtual void AddFactory (cXObjPackFactory *pFactory)
 
virtual bool RemoveFactory (cXObjPackFactory *pFactory)
 
virtual void RemoveXObjDef (cXObjDef *pObj) override
 
cXObjPackPtr FindXObjPack (const FILECHAR_t *pszFilePath) const
 
HRESULT LoadXObjPack (const FILECHAR_t *pszFilePath)
 
virtual cXObjectPtr FindByUID (UID_t uid) const override
 
virtual HRESULT CreateXObjDefX (cXObjDefPtr &rpObjNew, const cXObjTypeDef *pXObjTypeDef, cAtomRef aSymName, IScriptableEnumerator *rProps)
 
virtual HRESULT CreateXObjFromS (cXObjectPtr &rpObj, const ATOMCHAR_t *pszXObjType, const ATOMCHAR_t *pszSymName, IScriptableEnumerator &rProps)
 
HRESULT LoadXObjRoot ()
 
HRESULT LoadAllScripts (bool bForce)
 
HRESULT ReadXObjDir (const FILECHAR_t *pszDirName, const FILECHAR_t *pszWildcardFile=nullptr)
 
 UNITTEST_FRIEND (cXObjMgrPack)
 
- Public Member Functions inherited from GrayLib::cXObjMgr
virtual cScriptableInterfaceDefPtr _stdcall get_ScriptInterfaceDef () const
 
 cXObjMgr (cXObjDef *pRoot=nullptr)
 
virtual ~cXObjMgr ()
 
cXObjectPtr GetAtHash (const cHashIterator &e) const
 
XOBJTIDX_TYPE FindXObjTypeIdx (const ATOMCHAR_t *pszXObjTypeName) const
 
XOBJTIDX_TYPE FindXObjTypeIdx (XOBJTID_t nXObjTypeId) const
 
cXObjTypeDefEnumXObjTypeDef (XOBJTIDX_TYPE index) const
 
cXObjTypeDefFindXObjTypeDef (const ATOMCHAR_t *pszXObjTypeName) const
 
cXObjTypeDefFindXObjTypeDef (XOBJTID_t nXObjTypeId) const
 
const ATOMCHAR_tFindXObjTypeName (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)
 
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 cXObjMgrPackget_Single ()
 
static cXObjMgrPackI ()
 
- Static Public Member Functions inherited from GrayLib::cXObjMgr
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 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)
 

Public Attributes

TIMESYSD_t m_iScriptCacheTime
 Params for control. More...
 
- Public Attributes inherited from GrayLib::cXObjMgr
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...
 

Protected Member Functions

HRESULT ReadXObjPack (const FILECHAR_t *pszPathName, const cFileStatus &status)
 Manually load a new resource file by name. More...
 
cXObjPackFactoryFindXObjFactory (const FILECHAR_t *pszTitle) const
 
- 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 ()
 

Protected Attributes

cArraySortSymName< cXObjPackm_aXObjPacks
 All package files we need to get script blocks from. SYMNAME sorted. More...
 
cArrayRef< cXObjPackm_aXObjPacksToLoad
 Files queued to be read later. (load order used at startup) More...
 
cArrayRef< cXObjModulem_aXObjModulesToLoad
 plug-in DLL/SO's are dangerous and must be treated special. Read order is important here (they may cascade)! sorted by insert order. More...
 
cArrayPtr< cXObjPackFactorym_aPackFactories
 what file extensions can we handle for packages? How to load each type. More...
 
cStringF m_sScriptDir
 default base directory for script/DLL/SO/Module resource files/packs More...
 
cScriptContext m_ScriptContextRoot
 global/default/Root context. PLEVEL_Owner More...
 
cScriptExec m_ScriptExecBest
 set sm_pExpExecBest with a default value. Preferred script execution/evaluation engine. More...
 
- Protected Attributes inherited from GrayLib::cXObjMgr
cArraySortSymName< cXObjDefm_aXObjSymNames
 Store all cXObjDef(s) sorted by SymName or get_SymName() More...
 
cThreadLockCount m_LockXObj
 used to lock access m_XObjHash More...
 
cArrayPtr< cXObjTypeDefm_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...
 

Additional Inherited Members

- Public Types inherited from GrayLib::cXObjMgr
enum  M_TYPE_ { M_QTY }
 
- Static Public Attributes inherited from GrayLib::cXObjMgr
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...
 
- 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

overload cXObjMgr to Manage all my XObject files and resource XObj indexed here. Loads packages / Modules / Plug-ins and scripts to create system objects.

Note
m_aPackFactories can get overloaded to supply more resource storage options.

Constructor & Destructor Documentation

◆ cXObjMgrPack()

GrayLib::cXObjMgrPack::cXObjMgrPack ( cXObjDef pRoot = nullptr)

◆ ~cXObjMgrPack()

GrayLib::cXObjMgrPack::~cXObjMgrPack ( )
virtual

Member Function Documentation

◆ AddFactory()

void GrayLib::cXObjMgrPack::AddFactory ( cXObjPackFactory pFactory)
virtual

What file types do i know how to enumerate? e.g. cJSXEngine,

Note
ASSUME RegisterXObjTypeDef( cXObjTypeDef(k_XObjTypeId)) is already called.

◆ CreateXObjDefX()

HRESULT GrayLib::cXObjMgrPack::CreateXObjDefX ( cXObjDefPtr rpObjNew,
const cXObjTypeDef pXObjTypeDef,
cAtomRef  aSymName,
IScriptableEnumerator rProps 
)
virtual

Create an object of some type from a IScriptableEnumerator. ASSUME SetObjStateLoaded is called.

◆ CreateXObjFromS()

HRESULT GrayLib::cXObjMgrPack::CreateXObjFromS ( cXObjectPtr rpObj,
const ATOMCHAR_t pszXObjType,
const ATOMCHAR_t pszSymName,
IScriptableEnumerator rProps 
)
virtual

Load XObject or params from script file. ASSUME SetObjStateLoaded is called.

◆ DisposeAllX()

void GrayLib::cXObjMgrPack::DisposeAllX ( )
overridevirtual

IXObjMgr Dispose of all my objects. Assume i am closing.

Reimplemented from GrayLib::cXObjMgr.

◆ FindByUID()

cXObjectPtr GrayLib::cXObjMgrPack::FindByUID ( UID_t  uid) const
overridevirtual

Get the cXObject by its UID. This can be overridden to add support for special cUIDRangeMask ranges.

Reimplemented from GrayLib::cXObjMgr.

◆ FindXObjFactory()

cXObjPackFactory * GrayLib::cXObjMgrPack::FindXObjFactory ( const FILECHAR_t pszTitle) const
protected

Find the cXObjPackFactory to support this type of file by extension.

◆ FindXObjPack()

cXObjPackPtr GrayLib::cXObjMgrPack::FindXObjPack ( const FILECHAR_t pszFilePath) const

Just match the symbolic titles (not the whole path) "x.ini" is not in here.

◆ get_ScriptDir()

cStringF GrayLib::cXObjMgrPack::get_ScriptDir ( ) const
inlinenoexcept

◆ get_Single()

static cXObjMgrPack* GrayLib::cXObjMgrPack::get_Single ( )
inlinestatic

◆ I()

static cXObjMgrPack& GrayLib::cXObjMgrPack::I ( )
inlinestatic

◆ InitXObjMgr()

HRESULT GrayLib::cXObjMgrPack::InitXObjMgr ( cXObjDef pRoot)
overridevirtual

IXObjMgr Set up the scripting system. Connect cUID::k_ROOT object to the default context.

Note
ASSUME RegisterXObjTypeDef( cXObjTypeDef(k_XObjTypeId)) is already called.

Reimplemented from GrayLib::cXObjMgr.

◆ LoadAllScripts()

HRESULT GrayLib::cXObjMgrPack::LoadAllScripts ( bool  bForce)

Attempt to resync / reload all the resources. maybe scripts have changed?

◆ LoadXObjPack()

HRESULT GrayLib::cXObjMgrPack::LoadXObjPack ( const FILECHAR_t pszFilePath)

Manually add a file/directory to the list of things to load. add to my list of resource files and load immediately.

  • pszFilePath = may be relative path or full path.

◆ LoadXObjRoot()

HRESULT GrayLib::cXObjMgrPack::LoadXObjRoot ( )
inline

Load and read all scripts from the script root directory.

◆ put_ScriptDir()

void GrayLib::cXObjMgrPack::put_ScriptDir ( cStringF  sDir)

◆ ReadXObjDir()

HRESULT GrayLib::cXObjMgrPack::ReadXObjDir ( const FILECHAR_t pszDirName,
const FILECHAR_t pszWildcardFile = nullptr 
)

Add a bunch of files in a directory to my resource file list. Load the scripts as we go.

Note
don't descend directories by default!
Returns
number of files.

◆ ReadXObjPack()

HRESULT GrayLib::cXObjMgrPack::ReadXObjPack ( const FILECHAR_t pszPathName,
const cFileStatus status 
)
protected

Manually load a new resource file by name.

protected. Read a specific file by its full path. Scan it for resources that could be registered.

◆ RemoveFactory()

bool GrayLib::cXObjMgrPack::RemoveFactory ( cXObjPackFactory pFactory)
virtual

Remove all uses of this factory.

◆ RemoveXObjDef()

void GrayLib::cXObjMgrPack::RemoveXObjDef ( cXObjDef pObj)
overridevirtual

called by DisposeThis()

Reimplemented from GrayLib::cXObjMgr.

◆ UNITTEST_FRIEND()

GrayLib::cXObjMgrPack::UNITTEST_FRIEND ( cXObjMgrPack  )

Member Data Documentation

◆ m_aPackFactories

cArrayPtr<cXObjPackFactory> GrayLib::cXObjMgrPack::m_aPackFactories
protected

what file extensions can we handle for packages? How to load each type.

◆ m_aXObjModulesToLoad

cArrayRef<cXObjModule> GrayLib::cXObjMgrPack::m_aXObjModulesToLoad
protected

plug-in DLL/SO's are dangerous and must be treated special. Read order is important here (they may cascade)! sorted by insert order.

◆ m_aXObjPacks

cArraySortSymName<cXObjPack> GrayLib::cXObjMgrPack::m_aXObjPacks
protected

All package files we need to get script blocks from. SYMNAME sorted.

◆ m_aXObjPacksToLoad

cArrayRef<cXObjPack> GrayLib::cXObjMgrPack::m_aXObjPacksToLoad
protected

Files queued to be read later. (load order used at startup)

◆ m_iScriptCacheTime

TIMESYSD_t GrayLib::cXObjMgrPack::m_iScriptCacheTime

Params for control.

Time in Milli seconds to keep a cached script open.

◆ m_ScriptContextRoot

cScriptContext GrayLib::cXObjMgrPack::m_ScriptContextRoot
protected

global/default/Root context. PLEVEL_Owner

◆ m_ScriptExecBest

cScriptExec GrayLib::cXObjMgrPack::m_ScriptExecBest
protected

set sm_pExpExecBest with a default value. Preferred script execution/evaluation engine.

◆ m_sScriptDir

cStringF GrayLib::cXObjMgrPack::m_sScriptDir
protected

default base directory for script/DLL/SO/Module resource files/packs


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