casacore
Public Types | Static Public Member Functions | Static Private Member Functions | List of all members
casacore::Conversion Class Reference

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. More...
 
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. More...
 

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). More...
 
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). More...
 
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. More...
 
static ByteFunctiongetmemcpy ()
 Get a pointer to the memcpy function. More...
 

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. More...
 

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.

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 85 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 108 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 100 of file Conversion.h.

Member Function Documentation

◆ bitToBool() [1/2]

static 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]

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

◆ bitToBool_()

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

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

◆ boolToBit() [1/2]

static 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]

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

◆ getmemcpy()

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

Get a pointer to the memcpy function.

Definition at line 152 of file Conversion.h.

◆ valueCopy()

static 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: