Loading...
Searching...
No Matches
casacore::BucketCache_global_functions_BucketCache_CallBack Struct Reference
casa package (libcasa_casa) » IO_module

More...

`#include <BucketCache.h>`

## Public Types

typedef char *(* | BucketCacheToLocal) (void *ownerObject, const char *canonical)
typedef void(* | BucketCacheFromLocal) (void *ownerObject, char *canonical, const char *local)
typedef char *(* | BucketCacheAddBuffer) (void *ownerObject)
typedef void(* | BucketCacheDeleteBuffer) (void *ownerObject, char *buffer)

## Detailed Description

Define the type of the static read and write function.

### Intended use:

Public interface

### Review Status

Reviewed By:
  UNKNOWN
Date Reviewed:
  before2004/08/25

### Synopsis

The BucketCache class needs a way to convert its data from local to canonical format and vice-versa. This is done by callback functions defined at construction time.

The ToLocal callback function has to allocate a buffer of the correct size and to copy/convert the canonical data in the input buffer to this buffer. The pointer this newly allocated buffer has to be returned. The BucketCache class keeps this pointer in the cache block.

The FromLocal callback function has to copy/convert the data from the buffer in local format to the buffer in canonical format. It should NOT delete the buffer; that has to be done by the DeleteBuffer function.

The AddBuffer callback function has to create (and initialize) a buffer to be added to the file and cache. When the file gets extended, BucketCache only registers the new size, but does not werite anything. When a bucket is read between the actual file size and the new file size, the AddBuffer callback function is called to create a buffer and possibly initialize it.

The DeleteBuffer callback function has to delete the buffer allocated by the ToLocal function.

The functions get a pointer to the owner object, which was provided at construction time. The callback function has to cast this to the correct type and can use it thereafter.
C++ supports pointers to members, but it is a bit hard. Therefore pointers to static members are used (which are simple pointers to functions). A pointer to the owner object is also passed to let the static function call the correct member function (when needed).

### Example

See class BucketCache.

Definition at line 87 of file BucketCache.h.

## Member Typedef Documentation

## BucketCacheAddBuffer

typedef char *(* casacore::BucketCache_global_functions_BucketCache_CallBack::BucketCacheAddBuffer) (void *ownerObject)

Definition at line 91 of file BucketCache.h.

## BucketCacheDeleteBuffer

typedef void(* casacore::BucketCache_global_functions_BucketCache_CallBack::BucketCacheDeleteBuffer) (void *ownerObject, char *buffer)

Definition at line 92 of file BucketCache.h.

## BucketCacheFromLocal

typedef void(* casacore::BucketCache_global_functions_BucketCache_CallBack::BucketCacheFromLocal) (void *ownerObject, char *canonical, const char *local)

Definition at line 89 of file BucketCache.h.

## BucketCacheToLocal

typedef char *(* casacore::BucketCache_global_functions_BucketCache_CallBack::BucketCacheToLocal) (void *ownerObject, const char *canonical)

Definition at line 88 of file BucketCache.h.

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

- casa/IO/BucketCache.h