CXXR (C++ R) API
Classes | Static Public Member Functions | Friends
CXXR::RAllocStack Class Reference

Class for implementing R_alloc() and kindred functions. More...

#include <RAllocStack.h>

List of all members.

Classes

class  Scope
 Object constraining lifetime of R_alloc() blocks. More...

Static Public Member Functions

static void * allocate (size_t sz)
 Allocate a new block of memory.
static void restoreSize (size_t new_size)
 Restore stack to a previous size.
static size_t size ()
 Current size of stack.

Friends

class SchwarzCounter< RAllocStack >

Detailed Description

Class for implementing R_alloc() and kindred functions.

This class has only static members. It implements a stack of pointers to blocks of memory.


Member Function Documentation

static void* CXXR::RAllocStack::allocate ( size_t  sz)
static

Allocate a new block of memory.

The block will be aligned on a multiple of sizeof(double) .

Parameters:
szThe required size in bytes (strictly, as a multiple of sizeof(char)), of the memory block.
Returns:
Pointer to the start of the memory block.
static void CXXR::RAllocStack::restoreSize ( size_t  new_size)
static

Restore stack to a previous size.

Restore the stack to a previous size by popping elements off the top.

Parameters:
new_sizeThe size to which the stack is to be restored. Must not be greater than the current size.
Note:
In future this method may cease to be available, since the use of the RAllocStack::Scope class is preferable.
static size_t CXXR::RAllocStack::size ( )
inlinestatic

Current size of stack.

Returns:
the current size of the stack.
Note:
This method is intended for use in conjunction with restoreSize(), and may cease to be public in future.

The documentation for this class was generated from the following file: