SlotFactory_Create()

Create a new slot factory instance.

Synopsis:

#include <asr/slot-factory.h>
 
SlotFactory* SlotFactory_Create(unsigned int num_slots, unsigned int *page_size)

Arguments:

num_slots

The initial number of slot entries that the factory's buffer can hold.

page_size

A pointer to a buffer containing the page size used when allocating ASR slot entry buffers. The value obtained from this optional argument is adjusted to the next largest 32-bit aligned value.

Library:

libasr

Description:

The SlotFactory_Create() function creates a new slot factory instance by allocating an entry buffer that can hold a minimum number of slot entries (specified by num_slots). If the num_slots argument is zero, the no memory is allocated for the entry buffer and no entry elements are created. These members are updated when the first allocation occurs via the SlotFactory_createUniqueEntry() function.

Returns:

A new slot factory instance created on the heap. The ownership of the memory returned by this function is transferred to the calling context, which must delete the instance by calling the SlotFactory_Delete() function. If an allocation error occurs, this constructor will return a NULL pointer and set errno accordingly.