casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | List of all members
casacore::BucketCache_global_functions_BucketCache_CallBack Struct Reference

Define the type of the static read and write function. 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 89 of file BucketCache.h.

Member Typedef Documentation

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

Definition at line 93 of file BucketCache.h.

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

Definition at line 94 of file BucketCache.h.

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

Definition at line 91 of file BucketCache.h.

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

Definition at line 90 of file BucketCache.h.


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