Navigation

Operators and Keywords

Function List:

C++ API

data-conv.cc File Reference

#include <cctype>
#include <cstdlib>
#include <iostream>
#include <vector>
#include "byte-swap.h"
#include "data-conv.h"
#include "lo-error.h"
#include "lo-ieee.h"
#include "oct-locbuf.h"

Include dependency graph for data-conv.cc:


Defines

#define FIND_SIZED_INT_TYPE(VAL, BITS, TQ, Q)
#define FIND_SIZED_FLOAT_TYPE(VAL, BITS)
#define GET_SIZED_INT_TYPE(T, U)
#define LS_DO_READ(TYPE, swap, data, size, len, stream)
#define LS_DO_WRITE(TYPE, data, size, len, stream)

Functions

template void swap_bytes< 2 > (volatile void *, int)
template void swap_bytes< 4 > (volatile void *, int)
template void swap_bytes< 8 > (volatile void *, int)
void do_double_format_conversion (void *data, int len, oct_mach_info::float_format from_fmt, oct_mach_info::float_format to_fmt)
void do_float_format_conversion (void *data, int len, oct_mach_info::float_format from_fmt, oct_mach_info::float_format to_fmt)
void do_float_format_conversion (void *data, size_t sz, int len, oct_mach_info::float_format from_fmt, oct_mach_info::float_format to_fmt)
void read_doubles (std::istream &is, double *data, save_type type, int len, bool swap, oct_mach_info::float_format fmt)
void read_floats (std::istream &is, float *data, save_type type, int len, bool swap, oct_mach_info::float_format fmt)
void write_doubles (std::ostream &os, const double *data, save_type type, int len)
void write_floats (std::ostream &os, const float *data, save_type type, int len)

Define Documentation

#define FIND_SIZED_FLOAT_TYPE ( VAL,
BITS   ) 

Value:

do \
    { \
      int sz = BITS / CHAR_BIT; \
      if (sizeof (float) == sz) \
        VAL = oct_data_conv::dt_float; \
      else if (sizeof (double) == sz) \
        VAL = oct_data_conv::dt_double; \
      else \
        VAL = oct_data_conv::dt_unknown; \
    } \
  while (0)

#define FIND_SIZED_INT_TYPE ( VAL,
BITS,
TQ,
 ) 

Value:

do \
    { \
      int sz = BITS / CHAR_BIT; \
      if (sizeof (TQ char) == sz) \
        VAL = oct_data_conv::dt_ ## Q ## char; \
      else if (sizeof (TQ short) == sz) \
        VAL = oct_data_conv::dt_ ## Q ## short; \
      else if (sizeof (TQ int) == sz) \
        VAL = oct_data_conv::dt_ ## Q ## int; \
      else if (sizeof (TQ long) == sz) \
        VAL = oct_data_conv::dt_ ## Q ## long; \
      else \
        VAL = oct_data_conv::dt_unknown; \
    } \
  while (0)

#define GET_SIZED_INT_TYPE ( T,
 ) 

Value:

do \
    { \
      switch (sizeof (T)) \
        { \
        case 1: \
          retval = dt_ ## U ## int8; \
          break; \
 \
        case 2: \
          retval = dt_ ## U ## int16; \
          break; \
 \
        case 4: \
          retval = dt_ ## U ## int32; \
          break; \
 \
        case 8: \
          retval = dt_ ## U ## int64; \
          break; \
 \
        default: \
          retval = dt_unknown; \
          break; \
        } \
    } \
  while (0)

#define LS_DO_READ ( TYPE,
swap,
data,
size,
len,
stream   ) 

Value:

do \
    { \
      if (len > 0) \
        { \
          OCTAVE_LOCAL_BUFFER (TYPE, ptr, len); \
          stream.read (reinterpret_cast<char *>  (ptr), size * len); \
          if (swap) \
            swap_bytes< size > (ptr, len); \
          for (int i = 0; i < len; i++) \
            data[i] = ptr[i]; \
        } \
    } \
  while (0)

#define LS_DO_WRITE ( TYPE,
data,
size,
len,
stream   ) 

Value:

do \
    { \
      if (len > 0) \
        { \
          char tmp_type = type; \
          stream.write (&tmp_type, 1); \
          OCTAVE_LOCAL_BUFFER (TYPE, ptr, len); \
          for (int i = 0; i < len; i++) \
            ptr[i] = static_cast <TYPE> (data[i]);         \
          stream.write (reinterpret_cast<char *> (ptr), size * len); \
        } \
    } \
  while (0)


Function Documentation

void do_double_format_conversion ( void *  data,
int  len,
oct_mach_info::float_format  from_fmt,
oct_mach_info::float_format  to_fmt 
)

void do_float_format_conversion ( void *  data,
size_t  sz,
int  len,
oct_mach_info::float_format  from_fmt,
oct_mach_info::float_format  to_fmt 
)

void do_float_format_conversion ( void *  data,
int  len,
oct_mach_info::float_format  from_fmt,
oct_mach_info::float_format  to_fmt 
)

void read_doubles ( std::istream &  is,
double data,
save_type  type,
int  len,
bool  swap,
oct_mach_info::float_format  fmt 
)

void read_floats ( std::istream &  is,
float data,
save_type  type,
int  len,
bool  swap,
oct_mach_info::float_format  fmt 
)

template void swap_bytes< 2 > ( volatile void *  ,
int   
)

template void swap_bytes< 4 > ( volatile void *  ,
int   
)

template void swap_bytes< 8 > ( volatile void *  ,
int   
)

void write_doubles ( std::ostream os,
const double data,
save_type  type,
int  len 
)

void write_floats ( std::ostream os,
const float data,
save_type  type,
int  len 
)