High-Level Data Reduction Library: hdrl_buffer.c File Reference

High-Level Data Reduction Library 1.6.0 High-Level data reduction routines for ESO pipelines

Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Functions
hdrl_buffer.c File Reference
`#include "hdrl_buffer.h"`
`#include "hdrl_types.h"`
`#include "hdrl_utils.h"`
`#include <cpl.h>`
`#include <cxlist.h>`
`#include <unistd.h>`
`#include <stdint.h>`
`#include <stdlib.h>`
`#include <sys/mman.h>`
`#include <sys/types.h>`
`#include <fcntl.h>`
`#include <string.h>`
Include dependency graph for hdrl_buffer.c:

## Data Structures
struct | _hdrl_buffer_
struct | hdrl_pool_base
struct | hdrl_pool_mmap
struct | hdrl_pool_malloc

## Macros
#define | _POSIX_C_SOURCE 200112L /* posix_fallocate, ftruncate */
#define | _XOPEN_SOURCE 600

## Typedefs
typedef hdrl_pool_base | hdrl_pool

## Functions
hdrl_buffer * | hdrl_buffer_new (void)
| Create buffer object.
size_t | hdrl_buffer_set_malloc_threshold (hdrl_buffer *buf, size_t t)
| set total amount of memory the buffer can malloc
void | hdrl_buffer_readonly (hdrl_buffer *buf, cpl_boolean ro)
char * | hdrl_buffer_allocate (hdrl_buffer *buf, size_t size)
| Allocate memory block from buffer.
void | hdrl_buffer_free (hdrl_buffer *HDRL_UNUSED(buf), char *p)
void | hdrl_buffer_delete (hdrl_buffer *buf)
| delete buffer

## Macro Definition Documentation

## ◆ _POSIX_C_SOURCE

#define _POSIX_C_SOURCE 200112L /* posix_fallocate, ftruncate */

## ◆ _XOPEN_SOURCE

#define _XOPEN_SOURCE 600

## Typedef Documentation

## ◆ hdrl_pool

typedef hdrl_pool_base hdrl_pool

## Function Documentation

## ◆ hdrl_buffer_allocate()

char * hdrl_buffer_allocate | ( | hdrl_buffer * | buf,
|  | size_t | size
| ) |  |

Allocate memory block from buffer.

Parameters

  buf | buffer object
  size | size of memory to allocate

Returns
  writable memory block, or NULL on failure

## ◆ hdrl_buffer_delete()

void hdrl_buffer_delete | ( | hdrl_buffer * | buf | ) |

delete buffer

Parameters

  buf | buffer

Invalidates memory of all objects contained in the buffer

## ◆ hdrl_buffer_free()

void hdrl_buffer_free | ( | hdrl_buffer * | HDRL_UNUSEDbuf,
|  | char * | p
| ) |  |

## ◆ hdrl_buffer_new()

hdrl_buffer * hdrl_buffer_new | ( | void |  | ) |

Create buffer object.

Returns
  buffer object useable to obtain memory mapped memory

## ◆ hdrl_buffer_readonly()

void hdrl_buffer_readonly | ( | hdrl_buffer * | buf,
|  | cpl_boolean | ro
| ) |  |

## ◆ hdrl_buffer_set_malloc_threshold()

size_t hdrl_buffer_set_malloc_threshold | ( | hdrl_buffer * | buf,
|  | size_t | t
| ) |  |

set total amount of memory the buffer can malloc

Parameters

  buf | buffer object
  t | amount of memory in MiB

Returns
  old amount in wMiB

Note
  changing threshold will only affect future allocation