This is a buffer that contains a shared or private pool to either externally or internally managed host memory.  
 More...
#include <HostBuffer.h>
 | 
|   | HostBuffer (uint64_t bufferSize=0) | 
|   | Return a full buffer or an empty buffer.  More...
  | 
|   | 
|   | HostBuffer (HostBuffer &&other) | 
|   | Move copy-constructor.  More...
  | 
|   | 
|   | ~HostBuffer () | 
|   | Custom descructor.  More...
  | 
|   | 
| HostBuffer &  | operator= (HostBuffer &&other) | 
|   | Move copy assignment operation.  More...
  | 
|   | 
|   | HostBuffer (const HostBuffer &)=delete | 
|   | Disallow copy-construction.  More...
  | 
|   | 
| HostBuffer &  | operator= (const HostBuffer &)=delete | 
|   | Disallow copy assignment operation.  More...
  | 
|   | 
| void  | init (uint64_t bufferSize, void *data=nullptr) | 
|   | Initialize as a full buffer with the specified size. If data is NULL the memory is internally allocated.  More...
  | 
|   | 
| uint64_t  | poolSize () const  | 
|   | Returns the size in bytes of the memory pool shared with this instance.  More...
  | 
|   | 
| bool  | isManaged () const  | 
|   | Return true if memory is managed (using std::malloc and std:free) by the shared pool in this buffer. Else memory is assumed to be managed externally.  More...
  | 
|   | 
| bool  | isPool () const  | 
|   | Return true if this is a pool, i.e. an empty buffer with a nonempty internal pool, i.e. this->size() == 0 and this->poolSize() != 0.  More...
  | 
|   | 
| bool  | isFull () const  | 
|   | Return true if the pool exists, is nonempty but has no more available memory.  More...
  | 
|   | 
| void  | clear () | 
|   | Clear this buffer so it is empty.  More...
  | 
|   | 
| void  | reset () | 
|   | Clears all existing buffers that are registered against the memory pool and resets the pool so it can be reused to create new buffers.  More...
  | 
|   | 
| uint64_t  | poolUsage () const  | 
|   | Total number of bytes from the pool currently in use by buffers.  More...
  | 
|   | 
| void  | resizePool (uint64_t poolSize, void *data=nullptr) | 
|   | resize the pool size. It will attempt to resize the existing memory block, but if that fails a deep copy is performed. If data is not NULL it will be used as new externally managed memory for the pool. All registered buffers are updated so GridHandle::grid might return a new address (if deep copy was performed).  More...
  | 
|   | 
 | 
| const uint8_t *  | data () const  | 
|   | Retuns a pointer to the raw memory buffer managed by this allocator.  More...
  | 
|   | 
| uint8_t *  | data () | 
|   | Retuns a pointer to the raw memory buffer managed by this allocator.  More...
  | 
|   | 
 | 
| uint64_t  | bufferSize () const  | 
|   | Returns the size in bytes associated with this buffer.  More...
  | 
|   | 
| uint64_t  | size () const  | 
|   | Returns the size in bytes associated with this buffer.  More...
  | 
|   | 
 | 
| bool  | isEmpty () const  | 
|   | Returns true if this buffer has no memory associated with it.  More...
  | 
|   | 
| bool  | empty () const  | 
|   | Returns true if this buffer has no memory associated with it.  More...
  | 
|   | 
 | 
| static HostBuffer  | createPool (uint64_t poolSize, void *data=nullptr) | 
|   | Return a pool buffer which satisfies: buffer.size == 0, buffer.poolSize() == poolSize, and buffer.data() == nullptr. If data==nullptr, memory for the pool will be allocated.  More...
  | 
|   | 
| static HostBuffer  | createFull (uint64_t bufferSize, void *data=nullptr) | 
|   | Return a full buffer which satisfies: buffer.size == bufferSize, buffer.poolSize() == bufferSize, and buffer.data() == data. If data==nullptr, memory for the pool will be allocated.  More...
  | 
|   | 
| static HostBuffer  | create (uint64_t bufferSize, const HostBuffer *pool=nullptr) | 
|   | Return a buffer with bufferSize bytes managed by the specified memory pool. If none is provided, i.e. pool == nullptr or pool->poolSize() == 0, one is created with size bufferSize, i.e. a full buffer is returned.  More...
  | 
|   | 
This is a buffer that contains a shared or private pool to either externally or internally managed host memory. 
- Note
 - Terminology: Pool: 0 = buffer.size() < buffer.poolSize() Buffer: 0 < buffer.size() < buffer.poolSize() Full: 0 < buffer.size() = buffer.poolSize() Empty: 0 = buffer.size() = buffer.poolSize() 
 
Definition at line 114 of file HostBuffer.h.
 
  
  
      
        
          | nanovdb::HostBuffer::HostBuffer  | 
          ( | 
          uint64_t  | 
          bufferSize = 0 | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Return a full buffer or an empty buffer. 
Definition at line 457 of file HostBuffer.h.
 
 
  
  
      
        
          | nanovdb::HostBuffer::HostBuffer  | 
          ( | 
          HostBuffer &&  | 
          other | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
 
  
  
      
        
          | nanovdb::HostBuffer::~HostBuffer  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
 
  
  
      
        
          | nanovdb::HostBuffer::HostBuffer  | 
          ( | 
          const HostBuffer &  | 
           | ) | 
           | 
         
       
   | 
  
delete   | 
  
 
Disallow copy-construction. 
 
 
  
  
      
        
          | uint64_t nanovdb::HostBuffer::bufferSize  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Returns the size in bytes associated with this buffer. 
Definition at line 197 of file HostBuffer.h.
 
 
  
  
      
        
          | void nanovdb::HostBuffer::clear  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Clear this buffer so it is empty. 
Definition at line 564 of file HostBuffer.h.
 
 
Return a buffer with bufferSize bytes managed by the specified memory pool. If none is provided, i.e. pool == nullptr or pool->poolSize() == 0, one is created with size bufferSize, i.e. a full buffer is returned. 
- Exceptions
 - 
  
    | If | the specified pool has insufficient memory for the requested buffer size.  | 
  
   
Definition at line 552 of file HostBuffer.h.
 
 
  
  
      
        
          | HostBuffer nanovdb::HostBuffer::createFull  | 
          ( | 
          uint64_t  | 
          bufferSize,  | 
         
        
           | 
           | 
          void *  | 
          data = nullptr  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inlinestatic   | 
  
 
Return a full buffer which satisfies: buffer.size == bufferSize, buffer.poolSize() == bufferSize, and buffer.data() == data. If data==nullptr, memory for the pool will be allocated. 
- Exceptions
 - 
  
  
 
Definition at line 541 of file HostBuffer.h.
 
 
  
  
      
        
          | HostBuffer nanovdb::HostBuffer::createPool  | 
          ( | 
          uint64_t  | 
          poolSize,  | 
         
        
           | 
           | 
          void *  | 
          data = nullptr  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inlinestatic   | 
  
 
Return a pool buffer which satisfies: buffer.size == 0, buffer.poolSize() == poolSize, and buffer.data() == nullptr. If data==nullptr, memory for the pool will be allocated. 
- Exceptions
 - 
  
  
 
Definition at line 528 of file HostBuffer.h.
 
 
  
  
      
        
          | const uint8_t* nanovdb::HostBuffer::data  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Retuns a pointer to the raw memory buffer managed by this allocator. 
- Warning
 - Note that the pointer can be NULL if the allocator was not initialized! 
 
Definition at line 191 of file HostBuffer.h.
 
 
  
  
      
        
          | uint8_t* nanovdb::HostBuffer::data  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Retuns a pointer to the raw memory buffer managed by this allocator. 
- Warning
 - Note that the pointer can be NULL if the allocator was not initialized! 
 
Definition at line 192 of file HostBuffer.h.
 
 
  
  
      
        
          | bool nanovdb::HostBuffer::empty  | 
          ( | 
          void  | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Returns true if this buffer has no memory associated with it. 
Definition at line 211 of file HostBuffer.h.
 
 
  
  
      
        
          | void nanovdb::HostBuffer::init  | 
          ( | 
          uint64_t  | 
          bufferSize,  | 
         
        
           | 
           | 
          void *  | 
          data = nullptr  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inline   | 
  
 
Initialize as a full buffer with the specified size. If data is NULL the memory is internally allocated. 
Definition at line 477 of file HostBuffer.h.
 
 
  
  
      
        
          | bool nanovdb::HostBuffer::isEmpty  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Returns true if this buffer has no memory associated with it. 
Definition at line 210 of file HostBuffer.h.
 
 
  
  
      
        
          | bool nanovdb::HostBuffer::isFull  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Return true if the pool exists, is nonempty but has no more available memory. 
Definition at line 523 of file HostBuffer.h.
 
 
  
  
      
        
          | bool nanovdb::HostBuffer::isManaged  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Return true if memory is managed (using std::malloc and std:free) by the shared pool in this buffer. Else memory is assumed to be managed externally. 
Definition at line 518 of file HostBuffer.h.
 
 
  
  
      
        
          | bool nanovdb::HostBuffer::isPool  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Return true if this is a pool, i.e. an empty buffer with a nonempty internal pool, i.e. this->size() == 0 and this->poolSize() != 0. 
Definition at line 216 of file HostBuffer.h.
 
 
Move copy assignment operation. 
Definition at line 491 of file HostBuffer.h.
 
 
Disallow copy assignment operation. 
 
 
  
  
      
        
          | uint64_t nanovdb::HostBuffer::poolSize  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Returns the size in bytes of the memory pool shared with this instance. 
Definition at line 508 of file HostBuffer.h.
 
 
  
  
      
        
          | uint64_t nanovdb::HostBuffer::poolUsage  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Total number of bytes from the pool currently in use by buffers. 
Definition at line 513 of file HostBuffer.h.
 
 
  
  
      
        
          | void nanovdb::HostBuffer::reset  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Clears all existing buffers that are registered against the memory pool and resets the pool so it can be reused to create new buffers. 
- Exceptions
 - 
  
    | If | this instance is not empty or contains no pool. | 
  
   
- Warning
 - This method is not thread-safe! 
 
Definition at line 574 of file HostBuffer.h.
 
 
  
  
      
        
          | void nanovdb::HostBuffer::resizePool  | 
          ( | 
          uint64_t  | 
          poolSize,  | 
         
        
           | 
           | 
          void *  | 
          data = nullptr  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inline   | 
  
 
resize the pool size. It will attempt to resize the existing memory block, but if that fails a deep copy is performed. If data is not NULL it will be used as new externally managed memory for the pool. All registered buffers are updated so GridHandle::grid might return a new address (if deep copy was performed). 
- Note
 - This method can be use to resize the memory pool and even change it from internally to externally managed memory or vice versa.
 
- Exceptions
 - 
  
    | if | poolSize is less than this->poolUsage() the used memory or allocations fail.  | 
  
   
Definition at line 585 of file HostBuffer.h.
 
 
  
  
      
        
          | uint64_t nanovdb::HostBuffer::size  | 
          ( | 
          void  | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Returns the size in bytes associated with this buffer. 
Definition at line 198 of file HostBuffer.h.
 
 
The documentation for this class was generated from the following file: