casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Types | Static Public Member Functions | Static Private Member Functions
casa::Conversion Class Reference

A class with general conversion definitions. More...

#include <Conversion.h>

List of all members.

Public Types

typedef unsigned int ValueFunction (void *to, const void *from, unsigned int 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, unsigned int nbytes)
 Define the signature of a function converting from one format to another providing the number of bytes.

Static Public Member Functions

static unsigned int boolToBit (void *to, const void *from, unsigned int nvalues)
 Convert a stream of Bools to output format (as bits).
static void boolToBit (void *to, const void *from, unsigned int startBit, unsigned int nvalues)
static unsigned int bitToBool (void *to, const void *from, unsigned int nvalues)
 Convert a stream of Bools to output format (as bits).
static void bitToBool (void *to, const void *from, unsigned int startBit, unsigned int nvalues)
static unsigned int valueCopy (void *to, const void *from, unsigned int nbytes)
 Copy a value using memcpy.
static ByteFunctiongetmemcpy ()
 Get a pointer to the memcpy function.
static void * mymemcpy (void *to, const void *from, unsigned int nbytes)
 A placeholder for the ObjectCenter or DEC-alpha memcpy or 64bit SGI Also added this for HPUX11 (2b provided in the makedefs) (because they do not use an unsigned int for nbytes).

Static Private Member Functions

static unsigned int bitToBool_ (void *to, const void *from, unsigned int 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.

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 84 of file Conversion.h.


Member Typedef Documentation

typedef void* casa::Conversion::ByteFunction(void *to, const void *from, unsigned int 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 107 of file Conversion.h.

typedef unsigned int casa::Conversion::ValueFunction(void *to, const void *from, unsigned int 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 99 of file Conversion.h.


Member Function Documentation

static unsigned int casa::Conversion::bitToBool ( void *  to,
const void *  from,
unsigned int  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.

static void casa::Conversion::bitToBool ( void *  to,
const void *  from,
unsigned int  startBit,
unsigned int  nvalues 
) [static]
static unsigned int casa::Conversion::bitToBool_ ( void *  to,
const void *  from,
unsigned int  nvalues 
) [static, private]

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

static unsigned int casa::Conversion::boolToBit ( void *  to,
const void *  from,
unsigned int  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.

static void casa::Conversion::boolToBit ( void *  to,
const void *  from,
unsigned int  startBit,
unsigned int  nvalues 
) [static]

Get a pointer to the memcpy function.

Definition at line 156 of file Conversion.h.

References mymemcpy().

static void* casa::Conversion::mymemcpy ( void *  to,
const void *  from,
unsigned int  nbytes 
) [static]

A placeholder for the ObjectCenter or DEC-alpha memcpy or 64bit SGI Also added this for HPUX11 (2b provided in the makedefs) (because they do not use an unsigned int for nbytes).

Referenced by getmemcpy().

static unsigned int casa::Conversion::valueCopy ( void *  to,
const void *  from,
unsigned int  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: