prime/include/Kyoto/CObjectReference.hpp

39 lines
959 B
C++
Raw Normal View History

#ifndef _COBJECTREFERENCE
#define _COBJECTREFERENCE
#include <Kyoto/CVParamTransfer.hpp>
2022-10-06 09:23:45 +00:00
#include <Kyoto/SObjectTag.hpp>
#include <rstl/auto_ptr.hpp>
class IObj;
class IObjectStore;
class CObjectReference {
public:
CObjectReference(const rstl::auto_ptr< IObj >& obj);
2022-10-20 14:28:06 +00:00
~CObjectReference();
2023-01-14 06:27:43 +00:00
CObjectReference(IObjectStore& store, const rstl::auto_ptr< IObj >& obj, const SObjectTag& tag,
CVParamTransfer xfer);
bool IsLoaded() const { return x10_object != nullptr; }
2022-10-20 14:28:06 +00:00
void AddReference() { x0_refCount++; }
int RemoveReference();
void Lock();
void Unlock();
IObj* GetObject();
2023-01-14 06:27:43 +00:00
void Unload();
void CancelLoad();
bool IsLoading() const;
2022-11-25 12:41:28 +00:00
const SObjectTag& GetTag() const { return x4_objTag; }
2022-10-20 14:28:06 +00:00
private:
2023-01-14 06:27:43 +00:00
short x0_refCount : 16;
short x2_lockCount : 15;
short x3_loading : 1;
SObjectTag x4_objTag;
IObjectStore* xc_objectStore;
IObj* x10_object;
CVParamTransfer x14_params;
};
#endif // _COBJECTREFERENCE