MemoryMetadataProxy Struct Reference

#include <weakrefservices.h>

详细描述

Proxy object to access memory metadata. While the proxy object exists the metadata for the target is locked and cannot be accessed or modified by other threads (in fact all metadata for the target including weak references is locked). Therefore best practice is to destroy the proxy object as soon as possible.

公共成员函数

  MAXON_DISALLOW_COPY_AND_ASSIGN ( MemoryMetadataProxy )
  MemoryMetadataProxy ()=default
  MemoryMetadataProxy ( MemoryMetadataProxy &&)=default
  MemoryMetadataProxy ( WeakRefTargetBase *weakRefTarget, void *metadata)
  MAXON_OPERATOR_MOVE_ASSIGNMENT ( MemoryMetadataProxy )
  ~MemoryMetadataProxy ()
  operator Bool () const
Result < void * >  Get () const

Private Attributes

WeakRefTargetBase _weakRefTarget
void *  _metadata

构造函数 & 析构函数文档编制

◆  MemoryMetadataProxy() [1/3]

MemoryMetadataProxy ( )
default

◆  MemoryMetadataProxy() [2/3]

MemoryMetadataProxy ( MemoryMetadataProxy &&  )
default

◆  MemoryMetadataProxy() [3/3]

MemoryMetadataProxy ( WeakRefTargetBase weakRefTarget ,
void *  metadata  
)
explicit

◆  ~MemoryMetadataProxy()

~ MemoryMetadataProxy ( )

Destructs the proxy object and unlocks access to the metadata.

成员函数文档编制

◆  MAXON_DISALLOW_COPY_AND_ASSIGN()

MAXON_DISALLOW_COPY_AND_ASSIGN ( MemoryMetadataProxy   )

◆  MAXON_OPERATOR_MOVE_ASSIGNMENT()

MAXON_OPERATOR_MOVE_ASSIGNMENT ( MemoryMetadataProxy   )

◆  operator Bool()

operator Bool ( ) const
explicit

◆  Get()

Result <void*> Get ( ) const

Returns the memory metadata (or an error if there wasn't any).

返回
Memory metadata on success.

Member Data Documentation

◆  _weakRefTarget

WeakRefTargetBase * _weakRefTarget
private

◆  _metadata

void* _metadata private