Bsoft  1.9
Bernard's software package
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
datatypes.cpp File Reference

Functions to check and convert datatypes. More...

#include "rwimg.h"
#include "datatypes.h"
#include "utilities.h"

Go to the source code of this file.

Functions

unsigned long gettypesize (DataType type)
 Get the size of a datatype. More...
 
DataType getdatatype (char letter)
 Get the data type indicated by a single letter code. More...
 
int set_value_with_datatype (char *ptr, double value, DataType datatype)
 Set a pointer to a value with a given data type. More...
 

Variables

int verbose
 

Detailed Description

Functions to check and convert datatypes.

Author
Bernard Heymann
Date
Created: 19990321
Modified: 20110816

Definition in file datatypes.cpp.

Function Documentation

DataType getdatatype ( char  letter)

Get the data type indicated by a single letter code.

This function is used in optional command-line arguments to indicate a new data type for an image.

Parameters
letterletter indicating data type.
Returns
DataType type data type (defined in rwimg.h).

Definition at line 52 of file datatypes.cpp.

unsigned long gettypesize ( DataType  type)

Get the size of a datatype.

This function is used for calculating image data sizes for allocating memory and reading the data.

Parameters
typedata type (defined in rwimg.h).
Returns
unsigned long size of data type, if < 0 the data type is not supported.

Definition at line 25 of file datatypes.cpp.

int set_value_with_datatype ( char *  ptr,
double  value,
DataType  datatype 
)

Set a pointer to a value with a given data type.

A value is inserted into a given location with the given data type. The size of the allocated memory is channels*typesize.

Parameters
*ptrpointer to location.
valuethe value.
datatypedata type (defined in rwimg.h).
Returns
int 0, <0 on error.

Definition at line 89 of file datatypes.cpp.

Variable Documentation

int verbose