Loading...
Searching...
No Matches
casacore::Conversion Class Reference
casa package (libcasa_casa) » OS_module

More...

`#include <Conversion.h>`

## Public Types

typedef size_t | ValueFunction(void *to, const void *from, size_t nvalues)
| Define the signature of a function converting nvalues values from internal to external format or vice-versa.
typedef void * | ByteFunction(void *to, const void *from, size_t nbytes)
| Define the signature of a function converting from one format to another providing the number of bytes.

## Static Public Member Functions

static size_t | boolToBit (void *to, const void *from, size_t nvalues)
| Convert a stream of Bools to output format (as bits).
static void | boolToBit (void *to, const void *from, size_t startBit, size_t nvalues)
static size_t | bitToBool (void *to, const void *from, size_t nvalues)
| Convert a stream of Bools to output format (as bits).
static void | bitToBool (void *to, const void *from, size_t startBit, size_t nvalues)
static size_t | valueCopy (void *to, const void *from, size_t nbytes)
| Copy a value using memcpy.
static ByteFunction * | getmemcpy ()
| Get a pointer to the memcpy function.

## Static Private Member Functions

static size_t | bitToBool_ (void *to, const void *from, size_t nvalues)
| Copy bits to Bool in an unoptimized way needed when 'to' is not aligned properly.

## Detailed Description

A class with general conversion definitions

### Intended use:

Public interface

### Review Status

Reviewed By:
  Friso Olnon
Date Reviewed:
  1996/11/06
Test programs:
  tConversion

### Synopsis

This class contains the general definitions for the Conversion classes.

- It defines the signature for the functions converting from input to output format (e.g. from local to canonical format). There is a version where the number of values is given and a version where the number of bytes is given. The latter is there to be able to use memcpy as a conversion function (which will often be the case). Note that the signatures only differ in return value.
- It defines functions to convert Bools to bits and vice-versa. These are used elsewhere to store Bools as space efficient as possible. Note that these functions are machine independent (they work on little and big endian machines).
- It defines a private version of memcpy for compilers having a different signature for memcpy (e.g. ObjectCenter and DEC-Alpha).

Static functions in the classes CanonicalConversion, VAXConversion, and IBMConversion convert data from/to canonical, VAX, and IBM/360 format, resp..
Classes derived from DataConversion provide the same functionality in a polymorphic way.

### Motivation

This provides a common place for definitions used elsewhere. It also provides a uniform interface to memcpy.

Definition at line 83 of file Conversion.h.

## Member Typedef Documentation

## ByteFunction

typedef void * casacore::Conversion::ByteFunction(void *to, const void *from, size_t nbytes)

Define the signature of a function converting from one format to another providing the number of bytes.

It returns the to pointer (similar to memcpy). (For example the byteTo/FromLocalXXX functions in class CanonicalConversion.

Definition at line 106 of file Conversion.h.

## ValueFunction

typedef size_t casacore::Conversion::ValueFunction(void *to, const void *from, size_t nvalues)

Define the signature of a function converting nvalues values from internal to external format or vice-versa.

These functions are used in the IO framework , but are also used in the table system. Examples of such conversions are:
- local <-> canonical (when storing in canonical format)
- local <-> local (when storing in local format)
- binary <-> ASCII
It returns the number of bytes in external format. (For example the ToLocal/FromLocal functions in class CanonicalConversion return the number of bytes in canonical format).

Definition at line 98 of file Conversion.h.

## Member Function Documentation

## bitToBool() [1/2]

size_t casacore::Conversion::bitToBool | ( | void * | to,
|  | const void * | from,
|  | size_t | nvalues )

static

Convert a stream of Bools to output format (as bits).

The variable startBit (0-relative) indicates where to start in the from buffer.

## bitToBool() [2/2]

void casacore::Conversion::bitToBool | ( | void * | to,
|  | const void * | from,
|  | size_t | startBit,
|  | size_t | nvalues )

static

## bitToBool_()

size_t casacore::Conversion::bitToBool_ | ( | void * | to,
|  | const void * | from,
|  | size_t | nvalues )

static private

Copy bits to Bool in an unoptimized way needed when 'to' is not aligned properly.

## boolToBit() [1/2]

size_t casacore::Conversion::boolToBit | ( | void * | to,
|  | const void * | from,
|  | size_t | nvalues )

static

Convert a stream of Bools to output format (as bits).

The variable startBit (0-relative) indicates where to start in the to buffer.

## boolToBit() [2/2]

void casacore::Conversion::boolToBit | ( | void * | to,
|  | const void * | from,
|  | size_t | startBit,
|  | size_t | nvalues )

static

## getmemcpy()

Conversion::ByteFunction * casacore::Conversion::getmemcpy | ( |  | ) |

inline static

Get a pointer to the memcpy function.

Definition at line 150 of file Conversion.h.

## valueCopy()

size_t casacore::Conversion::valueCopy | ( | void * | to,
|  | const void * | from,
|  | size_t | nbytes )

static

Copy a value using memcpy.

It differs from memcpy in the return value.
Note: This version has the ValueFunction signature, but it expects as input the number of bytes;

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

- casa/OS/Conversion.h