Support Forum       G3D Web Page     
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
G3D::BufferUnmapper Class Reference

"Frees" mapped memory by unmapping it. More...

Inherits G3D::MemoryManager.

Public Member Functions

virtual void * alloc (size_t s) override
 Return a pointer to s bytes of memory that are unused by the rest of the program. More...
 
virtual void free (void *ptr) override
 Invoke to declare that this memory will no longer be used by the program. More...
 
virtual bool isThreadsafe () const override
 Returns true if this memory manager is threadsafe (i.e., alloc and free can be called asychronously) More...
 

Static Public Member Functions

static shared_ptr< MemoryManagercreate ()
 Return the instance. More...
 
static shared_ptr< BufferUnmappercreate (const shared_ptr< PixelTransferBuffer > &b)
 

Protected Member Functions

 BufferUnmapper (const shared_ptr< PixelTransferBuffer > &b)
 

Static Protected Member Functions

template<class T , class ... ArgTypes>
static shared_ptr< T > createShared (ArgTypes &&... args)
 Like std::make_shared, but works for protected constructors. More...
 

Protected Attributes

shared_ptr< PixelTransferBufferm_buffer
 

Detailed Description

"Frees" mapped memory by unmapping it.

Useful when passing a mapped PixelTransferBuffer to a NetConnection or other API that can use a memory manager for deallocation.

Constructor & Destructor Documentation

◆ BufferUnmapper()

G3D::BufferUnmapper::BufferUnmapper ( const shared_ptr< PixelTransferBuffer > &  b)
inlineprotected

Member Function Documentation

◆ alloc()

virtual void* G3D::BufferUnmapper::alloc ( size_t  s)
inlineoverridevirtual

Return a pointer to s bytes of memory that are unused by the rest of the program.

The contents of the memory are undefined

Reimplemented from G3D::MemoryManager.

◆ create() [1/2]

static shared_ptr<MemoryManager> G3D::MemoryManager::create ( )
staticinherited

Return the instance.

There's only one instance of the default MemoryManager; it is cached after the first creation.

Referenced by G3D::Array< G3D::AABox >::Array(), G3D::categorizeByDerivedType(), and G3D::Table< String, double >::Table().

◆ create() [2/2]

static shared_ptr<BufferUnmapper> G3D::BufferUnmapper::create ( const shared_ptr< PixelTransferBuffer > &  b)
inlinestatic

◆ createShared()

template<class T , class ... ArgTypes>
static shared_ptr<T> G3D::ReferenceCountedObject::createShared ( ArgTypes &&...  args)
inlinestaticprotectedinherited

Like std::make_shared, but works for protected constructors.

Call as createShared<myclass>.

◆ free()

virtual void G3D::BufferUnmapper::free ( void *  ptr)
inlineoverridevirtual

Invoke to declare that this memory will no longer be used by the program.

The memory manager is not required to actually reuse or release this memory.

Reimplemented from G3D::MemoryManager.

◆ isThreadsafe()

virtual bool G3D::BufferUnmapper::isThreadsafe ( ) const
inlineoverridevirtual

Returns true if this memory manager is threadsafe (i.e., alloc and free can be called asychronously)

Reimplemented from G3D::MemoryManager.

Member Data Documentation

◆ m_buffer

shared_ptr<PixelTransferBuffer> G3D::BufferUnmapper::m_buffer
protected

Referenced by free().


documentation generated on Wed Nov 24 2021 08:01:53 using doxygen 1.8.15