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

#include <cXObjDef.h>

Inheritance diagram for GrayLib::cXObjDef:
GrayLib::cXObject GrayLib::cScriptableObj IXObject Gray::cThreadLockableRef Gray::CObject Gray::cHeapObject IScriptableObj Gray::cRefBase Gray::cThreadLockStub Gray::IHeapObject IUnknown Gray::cLockableBase GrayLib::cXObjPack GrayLib::cXObjPackChild GrayMapData::cMapPatch GrayX::GrayXRoot GrayDotNetX::CResourceDotNet GrayJS::cJSXFile GrayLib::cXObjModule GrayLib::cXObjScript GrayLib::cXObjEventSink

Public Types

enum  P_TYPE_ { P_QTY }
 
enum  M_TYPE_ { M_QTY }
 
typedef cXObject CSCRIPTABLE_SUPER_t
 
- Public Types inherited from GrayLib::cXObject
enum  P_TYPE_ { P_QTY }
 
enum  M_TYPE_ { M_QTY }
 base methods that all objects have. More...
 

Public Member Functions

virtual cScriptableInterfaceDefPtr _stdcall get_ScriptInterfaceDef () const
 
 cXObjDef (UID_t rid, cAtomRef aSymName)
 
virtual ~cXObjDef ()
 
virtual HRESULT DisposeThis () override
 utility More...
 
STDMETHOD() SetObjStateLoaded ()
 extra cleanup at the end of the load. More...
 
bool hasSymName () const noexcept
 Get the SYMNAME of the resource item. (Used for saving,scripting) may be number or name. More...
 
cAtomRef get_SymNameA () const
 
 STDMETHOD_ (cStringA, get_SymName)() const override
 
STDMETHOD() put_SymName (cAtomRef aSymName, bool bOverwrite=false) override
 
HRESULT put_SymName2 (cAtomRef aSymName)
 
 STDMETHOD_ (cString, get_Name)() const override
 
virtual cString get_Description () const
 
virtual void put_Description (cString sDescription)
 
virtual cString get_DescriptionFull () const
 
virtual bool isResourceLoaded () const
 
virtual void UnloadXObject ()
 
virtual HRESULT LoadXObject ()
 
virtual HRESULT ReloadXObject ()
 
virtual HRESULT SaveXObject ()
 
virtual void CopyXObject (const cXObjDef *pDef)
 
virtual int get_BaseRefCount () const override
 
STDMETHOD() s_PropPut (const cScriptableProp *pProp, const cVariant &vVal) override
 
STDMETHOD() s_PropGet (const cScriptableProp *pProp, OUT cVariant &vValRet) override
 
STDMETHOD() s_Invoke (const cScriptableMethod *pMethod, const cVariant &vArgs, OUT cVariant &vValRet) override
 
STDMETHOD() s_WriteProps (IScriptableSetter &reg) override
 
virtual size_t GetHeapStats (OUT ITERATE_t &iAllocCount) const override
 allocs for all children. does NOT include sizeof(*this) More...
 
- Public Member Functions inherited from GrayLib::cXObject
 cXObject (UID_t nUID=cUID::k_CLEAR, cXObjDef *pBaseDef=nullptr)
 
virtual ~cXObject ()
 
virtual bool isValidCheck () const noexcept override
 
 STDMETHOD_ (XOBJTID_t, get_XObjTypeId)() const
 
const ATOMCHAR_tget_XObjTypeName () const
 
bool isValidUID () const noexcept
 
UID_t get_UIDValue () const noexcept
 
UID_t get_HashCode () const noexcept
 
 STDMETHOD_ (HASHCODE_t, get_HashCodeX)() const noexcept override
 
void put_UIDValuePrivate (UID_t dwIndex)
 
 STDMETHOD_ (void, put_UIDValue)(UID_t dwIndex)
 
 STDMETHOD_ (cString, get_Name)() const override
 
STDMETHOD() put_Name (cString sName)
 
 STDMETHOD_ (cString, get_NameDeco)() const
 
 STDMETHOD_ (cStringA, get_SymName)() const override
 
STDMETHOD() put_SymName (cAtomRef aSymName, bool bOverwrite=false)
 
HRESULT put_SymName2 (cAtomRef aSymName)
 
cXObjDefget_BaseDef () const
 
virtual bool put_BaseDef (cXObjDef *pDef)
 
 STDMETHOD_ (cAtomRef, get_BaseSymNameA)() const
 shortcut for symbolic name for get_BaseDef() More...
 
virtual cRefPtr< cXObjectget_ContainerObject () const
 
virtual cVariant get_ContainerVar () const
 
STDMETHOD() put_ContainerVar (const cVariant &vVal)
 
bool isMyContainer (const cXObject *pObjParent) const
 
void InitObjState ()
 
XObjState_TYPE get_ObjState () const noexcept
 
bool put_ObjState (XObjState_TYPE eObjState)
 
bool isObjStateLoading () const noexcept
 
bool isObjStateLoading1 () const noexcept
 
bool isObjStateLoaded () const noexcept
 
bool isObjStateModified () const noexcept
 
bool isObjStateDisposed () const noexcept
 
bool isObjStateBad () const noexcept
 
STDMETHOD() SetObjStateLoaded ()
 extra cleanup at the end of the load. More...
 
void SetObjStateBad ()
 
void SetObjStateModified ()
 
void ClearObjStateModified ()
 
const cTimeIntget_TimeSaved () const noexcept
 
void put_TimeSaved (cTimeInt timeSaved)
 
void UpdateTimeSaved ()
 
virtual cVarTuplePtr FindTagA (cAtomRef aTagName) const
 extra Properties/Tags More...
 
cVarTuplePtr FindTag (const ATOMCHAR_t *pszTagName) const
 
void s_WritePropsTags (IScriptableSetter &Update)
 
STDMETHOD() s_PropPut (const cScriptableProp *pProp, const cVariant &vVal) override
 
STDMETHOD() s_PropGet (const cScriptableProp *pProp, OUT cVariant &vValRet) override
 
STDMETHOD() s_Invoke (const cScriptableMethod *pMethod, const cVariant &vArgs, OUT cVariant &vValRet) override
 
STDMETHOD() s_GetByName (const ATOMCHAR_t *pszPropName, OUT cVariant &rvValRet) override
 
STDMETHOD() s_TagPut (const ATOMCHAR_t *pszTagName, const cVariant &vValSet)
 
STDMETHOD() s_TagGet (const ATOMCHAR_t *pszTagName, OUT cVariant &vValRet)
 
STDMETHOD() s_LoadProps (IScriptableEnumerator &rProps)
 
STDMETHOD() s_EventSinkAdd (cXObjDef *pXObjDef, bool bRemove=false)
 
cStringA s_PropGetDumpStr (const cScriptableProp *pProp, XOBJ_DUMP_MASK_t uFlags=0)
 Enumerate methods and props. reflection/introspection. More...
 
HRESULT s_DumpKeys (cStreamOutput &rout, XOBJ_DUMP_MASK_t uFlags, const cScriptableProp *const *ppProps, ITERATE_t iQty)
 
HRESULT s_DumpHelp (cStreamOutput &rout, const cVariant &vArgs)
 
virtual XOBJ_WEIRD_t IsWeird () const
 
virtual XOBJ_WEIRD_t FixWeird ()
 
 IUNKNOWN_DISAMBIG_R (cThreadLockableRef)
 
STDMETHOD() QueryInterface (const IID &riid, void **ppvObject) override
 
- Public Member Functions inherited from GrayLib::cScriptableObj
virtual ~cScriptableObj ()
 
 STDMETHOD_ (cScriptableInterfaceDefPtr, get_ScriptInterfaceDef)() const
 
STDMETHOD() s_PropGet (const cScriptableProp *pProp, OUT cVariant &vValRet) override
 
STDMETHOD() s_PropPut (const cScriptableProp *pProp, const cVariant &vVal) override
 
STDMETHOD() s_Invoke (const cScriptableMethod *pMethod, const cVariant &vArgs, OUT cVariant &vValRet) override
 
const cScriptablePropFindPropStr (const ATOMCHAR_t *pszPropName) const
 
const cScriptableMethodFindMethodStr (const ATOMCHAR_t *pszPropName) const
 
HRESULT s_InvokeKey (const ATOMCHAR_t *pszMethodKey, const cVariant &vArgs, OUT cVariant &vValRet)
 
 STDMETHOD_ (cVariant, s_Exec)(const ATOMCHAR_t *pszMethodKey
 
STDMETHOD() s_GetEnum (ITERATE_t i, OUT cStringA &rsPropName, OUT cVariant &rvValRet) override
 
STDMETHOD() s_GetByName (const ATOMCHAR_t *pszPropName, OUT cVariant &rvValRet) override
 
STDMETHOD() s_Put (const ATOMCHAR_t *pszPropName, const cVariant &vValSet) override
 
void s_LoadPropsCommandLine (cAppArgs &args)
 
HRESULT s_LoadPropsBase (IScriptableEnumerator &rProps)
 
HRESULT s_LoadPropVar (const ATOMCHAR_t *pszPropName, const cVariant &vVal)
 
HRESULT s_WritePropNULL (IScriptableSetter &s, const cScriptableProp *pProp)
 
HRESULT s_WriteProp (IScriptableSetter &s, const cScriptableProp *pProp)
 
HRESULT s_WritePropsClass (IScriptableSetter &s, const cScriptableInterfaceDef *pClass)
 
HRESULT s_WritePropsArray (IScriptableSetter &s, const cScriptableProp *pProps, IScriptableObj *pDefaultSkip=nullptr)
 
STDMETHOD() s_WriteProps (IScriptableSetter &s)
 
 STDMETHOD_ (cVariant, s_Get)(const ATOMCHAR_t *pszPropName)
 
cVariant s_Get (const cScriptableProp &rProp)
 
 STDMETHOD_ (cString, s_GetStr)(const ATOMCHAR_t *pszPropName)
 
 STDMETHOD_ (float, s_GetFloat)(const ATOMCHAR_t *pszPropName)
 
STDMETHOD() GetTypeInfoCount (UINT *pctinfo)
 
- Public Member Functions inherited from Gray::cThreadLockableRef
 cThreadLockableRef (int iStaticRefCount=0) noexcept
 
virtual ~cThreadLockableRef ()
 
virtual void onThreadLockFail (TIMESYSD_t dwWaitMS)
 
- 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 ()
 
- Public Member Functions inherited from Gray::cThreadLockStub
THREADID_t get_ThreadLockOwner () const
 
- Public Member Functions inherited from Gray::CObject
virtual ~CObject ()
 
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
 

Static Public Member Functions

static cAtomRef GRAYCALL MakeSymName (const ATOMCHAR_t *pszTypeName, ITERATE_t iEnum)
 
- Static Public Member Functions inherited from GrayLib::cScriptableObj
static HRESULT GRAYCALL CopyAllProps (IScriptableSetter *pObjDest, IScriptableEnumerator &rProps, int iStart=0)
 

Public Attributes

 CHEAPOBJECT_IMPL
 
TIMESYS_t m_timeLastUsed
 system time when last used. for caching More...
 
- Public Attributes inherited from GrayLib::cXObject
cVarMap m_TagMap
 attach extra tags here. (e.g. properties that don't apply to all instances. ASSUME NO OVERLAP with defined props.) More...
 
- Public Attributes inherited from GrayLib::cScriptableObj
const cVariantvArgs = cVariant::k_VarNULL)
 

Static Public Attributes

static cScriptableInterfaceDef sm_ScriptInterfaceDef
 
static cScriptableProp sm_Props [P_QTY+1]
 
static cScriptableMethod sm_Methods [M_QTY+1]
 
- Static Public Attributes inherited from GrayLib::cXObject
static cScriptableInterfaceDef sm_ScriptInterfaceDef
 
static cScriptableProp sm_Props [P_QTY+1]
 
static cScriptableMethod sm_Methods [M_QTY+1]
 
static ITERATE_t sm_iLoadingCount = 0
 are we loading ? LoadXObject() reentrant ? More...
 

Friends

class cXObjMgr
 

Additional Inherited Members

- Protected Member Functions inherited from Gray::cLockableBase
 cLockableBase () noexcept
 
 ~cLockableBase ()
 
LONG get_LockCount () const
 
bool isLocked () const
 
void IncLockCount ()
 
LONG DecLockCount ()
 
void Lock ()
 
LONG Unlock ()
 
- Protected Member Functions inherited from Gray::cHeapObject
const void * get_HeapPtr () const noexcept override
 Get the top level (outermost, freeable) class pointer. I can delete get_HeapPtr(). More...
 
- Protected Attributes inherited from GrayLib::cXObject
 CHEAPOBJECT_IMPL
 
cRefPtr< cXObjDefm_pBaseDef
 This XObject is based on a template of other XObject/XObjDef. overloads it's props via m_TagMap. More...
 

Detailed Description

This tends to be a static definition in nature. Created in the scripts/files rather than database. cXObject also that may have a symbolic resource name (SymName="i_name" etc) where cXObject does not. usually used to define a template for instances of some cXObject's. To extend its properties.

Member Typedef Documentation

◆ CSCRIPTABLE_SUPER_t

Member Enumeration Documentation

◆ M_TYPE_

Enumerator
M_QTY 

◆ P_TYPE_

Enumerator
P_QTY 

Constructor & Destructor Documentation

◆ cXObjDef()

GrayLib::cXObjDef::cXObjDef ( UID_t  rid,
cAtomRef  aSymName 
)

◆ ~cXObjDef()

GrayLib::cXObjDef::~cXObjDef ( )
virtual

Member Function Documentation

◆ CopyXObject()

void GrayLib::cXObjDef::CopyXObject ( const cXObjDef pDef)
virtual

Dupe this Def DEBUG_CHECK( get_UIDValue() == pLink->get_UIDValue());

Reimplemented in GrayLib::cXObjEventSink.

◆ DisposeThis()

HRESULT GrayLib::cXObjDef::DisposeThis ( void  )
overridevirtual

utility

detach my children etc.

Pre-destructor cleanup things can be done since virtuals don't work in destructors.

Note
since this is reference counted it should be deleted in onFinalRelease()

Destroy this object even though there may be references to it. indicate to anyone who looks that this is a deleted object ? Pre-destructor cleanup things can be done since virtuals don't work in destructors.

Note
since this is reference counted it is actually deleted in onFinalRelease()
This is similar to the .NET Dispose() function DEBUG_CHECK( get_ObjState() == XObjState_Disposing );

Reimplemented from GrayLib::cXObject.

Reimplemented in GrayLib::cXObjPack, GrayLib::cXObjModule, GrayJS::cJSXFile, GrayMapData::cMapPatch, and GrayLib::cXObjPackChild.

◆ get_BaseRefCount()

virtual int GrayLib::cXObjDef::get_BaseRefCount ( ) const
inlineoverridevirtual

The number of refs to this object that "don't count" towards actual usage. i.e. ref made from the UID table, ref from the SYMNAME hash. Used to UnloadXObject() if not actually in use.

Reimplemented from GrayLib::cXObject.

◆ get_Description()

virtual cString GrayLib::cXObjDef::get_Description ( ) const
inlinevirtual

Override for descriptive user text for this resource.

Reimplemented in GrayLib::cXObjPack.

◆ get_DescriptionFull()

virtual cString GrayLib::cXObjDef::get_DescriptionFull ( ) const
inlinevirtual

extra info in the description.

◆ get_ScriptInterfaceDef()

virtual cScriptableInterfaceDefPtr _stdcall GrayLib::cXObjDef::get_ScriptInterfaceDef ( ) const
inlinevirtual

Reimplemented from GrayLib::cXObject.

Reimplemented in GrayLib::cXObjEventSink.

◆ get_SymNameA()

cAtomRef GrayLib::cXObjDef::get_SymNameA ( ) const
inline

◆ GetHeapStats()

virtual size_t GrayLib::cXObjDef::GetHeapStats ( OUT ITERATE_t iAllocCount) const
inlineoverridevirtual

allocs for all children. does NOT include sizeof(*this)

allocs for all children. does NOT include sizeof(*this)

get allocs for all children. does not include sizeof(*this) NOT include size of m_pBaseDef.

Reimplemented from GrayLib::cXObject.

◆ hasSymName()

bool GrayLib::cXObjDef::hasSymName ( ) const
inlinenoexcept

Get the SYMNAME of the resource item. (Used for saving,scripting) may be number or name.

This has a Symbolic SymName defined?

◆ isResourceLoaded()

virtual bool GrayLib::cXObjDef::isResourceLoaded ( ) const
inlinevirtual

Loaded on demand attached resources. unlink/unload all this data. so we can re-use this.

Resource has been loaded. (not just defined) no need to load again.

◆ LoadXObject()

HRESULT GrayLib::cXObjDef::LoadXObject ( )
virtual

Load the resource on demand. Don't load if already loaded.

Reimplemented in GrayMapData::cMapPatch.

◆ MakeSymName()

cAtomRef GrayLib::cXObjDef::MakeSymName ( const ATOMCHAR_t pszTypeName,
ITERATE_t  iEnum 
)
static

Create a simple enumerated resource SYMNAME in the form "Name#"

◆ put_Description()

virtual void GrayLib::cXObjDef::put_Description ( cString  sDescription)
inlinevirtual

Descriptive user text for this resource. Override this if you care about a description. Otherwise this is lost.

◆ put_SymName()

HRESULT GrayLib::cXObjDef::put_SymName ( cAtomRef  aSymName,
bool  bOverwrite = false 
)
override

Set the global symbolic SymName for this object.

Note
UID and SymName not valid in cXObjMgr until SetObjStateLoaded is called.

◆ put_SymName2()

HRESULT GrayLib::cXObjDef::put_SymName2 ( cAtomRef  aSymName)

Alternate SYMNAME for this. Not its primary name. Give it another SYMNAME= even if it already has one. it's OK to have multiple names.

◆ ReloadXObject()

HRESULT GrayLib::cXObjDef::ReloadXObject ( )
virtual

dispose of changes.

Reimplemented in GrayMapData::cMapPatch.

◆ s_Invoke()

HRESULT GrayLib::cXObjDef::s_Invoke ( const cScriptableMethod pMethod,
const cVariant vArgs,
OUT cVariant vValRet 
)
override

◆ s_PropGet()

HRESULT GrayLib::cXObjDef::s_PropGet ( const cScriptableProp pProp,
OUT cVariant vValRet 
)
override

◆ s_PropPut()

HRESULT GrayLib::cXObjDef::s_PropPut ( const cScriptableProp pProp,
const cVariant vVal 
)
override

◆ s_WriteProps()

HRESULT GrayLib::cXObjDef::s_WriteProps ( IScriptableSetter reg)
override

◆ SaveXObject()

HRESULT GrayLib::cXObjDef::SaveXObject ( )
virtual

dispose of changes.

Reimplemented in GrayMapData::cMapPatch.

◆ SetObjStateLoaded()

HRESULT GrayLib::cXObjDef::SetObjStateLoaded ( )

extra cleanup at the end of the load.

The object has been fully loaded. Make sure its OK. Make sure the object is properly registered in cXObjMgr.

◆ STDMETHOD_() [1/2]

GrayLib::cXObjDef::STDMETHOD_ ( cString  ,
get_Name   
) const
inlineoverride

This could be overridden to give a more human readable name.

◆ STDMETHOD_() [2/2]

GrayLib::cXObjDef::STDMETHOD_ ( cStringA  ,
get_SymName   
) const
override

◆ UnloadXObject()

virtual void GrayLib::cXObjDef::UnloadXObject ( )
inlinevirtual

Assume the resource will be re-loaded later on demand ? m_aSymName.Empty(); // don't bother with this.

Reimplemented in GrayLib::cXObjPack, GrayLib::cXObjModule, GrayJS::cJSXFile, and GrayMapData::cMapPatch.

Friends And Related Function Documentation

◆ cXObjMgr

friend class cXObjMgr
friend

Member Data Documentation

◆ CHEAPOBJECT_IMPL

GrayLib::cXObjDef::CHEAPOBJECT_IMPL

◆ m_timeLastUsed

TIMESYS_t GrayLib::cXObjDef::m_timeLastUsed

system time when last used. for caching

◆ sm_Methods

cScriptableMethod GrayLib::cXObjDef::sm_Methods
static
Initial value:
=
{
#define cXObjDefMethod(a,b,c)
}
#define CSCRIPT_PROP_END
Definition: cScriptableInterface.h:264

◆ sm_Props

cScriptableProp GrayLib::cXObjDef::sm_Props
static
Initial value:
=
{
#define cXObjDefProp(a,b,c)
}

◆ sm_ScriptInterfaceDef

cScriptableInterfaceDef GrayLib::cXObjDef::sm_ScriptInterfaceDef
static

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