Discontiguous, one-dimensional buffer (which consists of multiple contiguous, one-dimensional panels) that can grow indefinitely by calling append.  
 More...
#include <GrowableBuffer.h>
 | 
|   | GrowableBuffer (const BuilderOptions &options, std::unique_ptr< PRIMITIVE[]> ptr, int64_t length, int64_t reserved) | 
|   | Creates a GrowableBuffer from a full set of parameters.  
  | 
|   | 
|   | GrowableBuffer (const BuilderOptions &options) | 
|   | Creates a GrowableBuffer by allocating a new buffer, taking an options #reserved from options.  
  | 
|   | 
|   | GrowableBuffer (GrowableBuffer &&other) noexcept | 
|   | Move constructor.  
  | 
|   | 
| size_t  | length () const | 
|   | Currently used number of elements.  
  | 
|   | 
| const BuilderOptions &  | options () const | 
|   | Return options of this GrowableBuffer.  
  | 
|   | 
| void  | clear () | 
|   | Discards accumulated data, the #reserved returns to options.initial(), and a new #ptr is allocated.  
  | 
|   | 
| PRIMITIVE  | last () const | 
|   | Last element in last panel.  
  | 
|   | 
| size_t  | nbytes () const | 
|   | Currently used number of bytes.  
  | 
|   | 
| void  | append (PRIMITIVE datum) | 
|   | Inserts one datum into the panel, possibly triggering allocation of a new panel.  
  | 
|   | 
| void  | extend (const PRIMITIVE *ptr, size_t size) | 
|   | Inserts an entire array into the panel(s), possibly triggering allocation of a new panel.  
  | 
|   | 
| PRIMITIVE &  | append_and_get_ref (PRIMITIVE datum) | 
|   | Like append, but the type signature returns the reference to PRIMITIVE.  
  | 
|   | 
| void  | concatenate (PRIMITIVE *external_pointer) const noexcept | 
|   | Copies and concatenates all accumulated data from multiple panels to one contiguously allocated external_pointer.  
  | 
|   | 
| void  | move_to (PRIMITIVE *to_ptr) noexcept | 
|   | Moves all accumulated data from multiple panels to one contiguously allocated external_pointer. The panels are deleted, and a new #ptr is allocated.  
  | 
|   | 
| void  | concatenate_from (PRIMITIVE *external_pointer, size_t to, size_t from) const noexcept | 
|   | Copies and concatenates all accumulated data from multiple panels to one contiguously allocated external_pointer.  
  | 
|   | 
| void  | append (PRIMITIVE *external_pointer, size_t offset, size_t from, int64_t length) const noexcept | 
|   | Copies data from a panel to one contiguously allocated external_pointer.  
  | 
|   | 
template<typename PRIMITIVE>
class awkward::GrowableBuffer< PRIMITIVE >
Discontiguous, one-dimensional buffer (which consists of multiple contiguous, one-dimensional panels) that can grow indefinitely by calling append. 
Configured by BuilderOptions, the buffer starts by reserving initial slots. When the number of slots used reaches the number reserved, a new panel is allocated that is resize times larger.
When ArrayBuilder::to_buffers is called, these buffers are copied to the new Content array. 
 
◆ GrowableBuffer() [1/3]
template<typename PRIMITIVE> 
 
Creates a GrowableBuffer from a full set of parameters. 
- Parameters
 - 
  
    | options | Initial size configuration for building a panel.  | 
    | ptr | Reference-counted pointer to the array buffer.  | 
    | length | Currently used number of elements.  | 
    | reserved | Currently allocated number of elements. | 
  
   
Although the length increments every time append is called, it is always less than or equal to #reserved because of allocations of new panels. 
 
 
◆ GrowableBuffer() [2/3]
template<typename PRIMITIVE> 
 
Creates a GrowableBuffer by allocating a new buffer, taking an options #reserved from options. 
- Parameters
 - 
  
    | options | Initial size configuration for building a panel.  | 
  
   
 
 
◆ GrowableBuffer() [3/3]
template<typename PRIMITIVE> 
 
Move constructor. 
panel_ is move-only. 
 
 
◆ append() [1/2]
template<typename PRIMITIVE> 
  
  
      
        
          | void append  | 
          ( | 
          PRIMITIVE * |           external_pointer,  | 
         
        
           | 
           | 
          size_t |           offset,  | 
         
        
           | 
           | 
          size_t |           from,  | 
         
        
           | 
           | 
          int64_t |           length ) const | 
         
       
   | 
  
inlinenoexcept   | 
  
 
Copies data from a panel to one contiguously allocated external_pointer. 
 
 
◆ append() [2/2]
template<typename PRIMITIVE> 
  
  
      
        
          | void append  | 
          ( | 
          PRIMITIVE |           datum | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Inserts one datum into the panel, possibly triggering allocation of a new panel. 
This increases the length by 1; if the new length is larger than #reserved, a new panel will be allocated. 
 
 
◆ append_and_get_ref()
template<typename PRIMITIVE> 
  
  
      
        
          | PRIMITIVE & append_and_get_ref  | 
          ( | 
          PRIMITIVE |           datum | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Like append, but the type signature returns the reference to PRIMITIVE. 
 
 
◆ arange()
template<typename PRIMITIVE> 
 
Creates a GrowableBuffer in which the elements are initialized to numbers counting from 0 to length. 
- Parameters
 - 
  
    | options | Initial size configuration for building a panel.  | 
    | length | The number of elements to initialize (and the GrowableBuffer's initial length). | 
  
   
This is similar to NumPy's arange. 
 
 
◆ clear()
template<typename PRIMITIVE> 
 
Discards accumulated data, the #reserved returns to options.initial(), and a new #ptr is allocated. 
 
 
◆ concatenate()
template<typename PRIMITIVE> 
  
  
      
        
          | void concatenate  | 
          ( | 
          PRIMITIVE * |           external_pointer | ) | 
           const | 
         
       
   | 
  
inlinenoexcept   | 
  
 
Copies and concatenates all accumulated data from multiple panels to one contiguously allocated external_pointer. 
 
 
◆ concatenate_from()
template<typename PRIMITIVE> 
  
  
      
        
          | void concatenate_from  | 
          ( | 
          PRIMITIVE * |           external_pointer,  | 
         
        
           | 
           | 
          size_t |           to,  | 
         
        
           | 
           | 
          size_t |           from ) const | 
         
       
   | 
  
inlinenoexcept   | 
  
 
Copies and concatenates all accumulated data from multiple panels to one contiguously allocated external_pointer. 
 
 
◆ copy_as()
template<typename PRIMITIVE> 
template<typename TO_PRIMITIVE> 
 
Takes a (possibly multi-panels) GrowableBuffer<PRIMITIVE> and makes another (one panel) GrowableBuffer<TO_PRIMITIVE>. 
Used to change the data type of buffer content from PRIMITIVE to TO_PRIMITIVE for building arrays. 
 
 
◆ empty() [1/2]
template<typename PRIMITIVE> 
 
Creates an empty GrowableBuffer. 
- Parameters
 - 
  
    | options | Initial size configuration for building a panel.  | 
  
   
 
 
◆ empty() [2/2]
template<typename PRIMITIVE> 
 
Creates an empty GrowableBuffer with a minimum reservation. 
- Parameters
 - 
  
    | options | Initial size configuration for building a panel.  | 
    | minreserve | The initial reservation will be the maximum of minreserve and initial.  | 
  
   
 
 
◆ extend()
template<typename PRIMITIVE> 
  
  
      
        
          | void extend  | 
          ( | 
          const PRIMITIVE * |           ptr,  | 
         
        
           | 
           | 
          size_t |           size ) | 
         
       
   | 
  
inline   | 
  
 
Inserts an entire array into the panel(s), possibly triggering allocation of a new panel. 
If the size is larger than the empty slots in the current panel, then, first, the empty slots are filled and then a new panel will be allocated for the rest of the array elements. 
 
 
◆ full()
template<typename PRIMITIVE> 
 
Creates a GrowableBuffer in which all elements are initialized to a given value. 
- Parameters
 - 
  
    | options | Initial size configuration for building a panel.  | 
    | value | The initialization value.  | 
    | length | The number of elements to initialize (and the GrowableBuffer's initial length). | 
  
   
This is similar to NumPy's full. 
 
 
◆ last()
template<typename PRIMITIVE> 
 
Last element in last panel. 
 
 
◆ length()
template<typename PRIMITIVE> 
 
Currently used number of elements. 
Although the length increments every time append is called, it is always less than or equal to #reserved because of allocations of new panels. 
 
 
◆ move_to()
template<typename PRIMITIVE> 
  
  
      
        
          | void move_to  | 
          ( | 
          PRIMITIVE * |           to_ptr | ) | 
           | 
         
       
   | 
  
inlinenoexcept   | 
  
 
Moves all accumulated data from multiple panels to one contiguously allocated external_pointer. The panels are deleted, and a new #ptr is allocated. 
 
 
◆ nbytes()
template<typename PRIMITIVE> 
 
Currently used number of bytes. 
 
 
◆ options()
template<typename PRIMITIVE> 
 
 
◆ zeros()
template<typename PRIMITIVE> 
 
Creates a GrowableBuffer in which all elements are initialized to 0. 
- Parameters
 - 
  
    | options | Initial size configuration for building a panel.  | 
    | length | The number of elements to initialize (and the GrowableBuffer's initial length). | 
  
   
This is similar to NumPy's zeros. 
 
 
The documentation for this class was generated from the following file:
- /home/runner/work/awkward/awkward/awkward-cpp/header-only/growable-buffer/awkward/GrowableBuffer.h