00001 00002 /** @file psScalar.h 00003 * 00004 * @brief Contains basic scalar definitions and operations 00005 * 00006 * This file defines the basic type for a scalar struct and functions useful 00007 * in manupulating scalars. 00008 * 00009 * @ingroup Scalar 00010 * 00011 * @author Ross Harman, MHPCC 00012 * 00013 * @version $Revision: 1.1.1.1 $ $Name: $ 00014 * @date $Date: 2005/06/15 21:08:12 $ 00015 * 00016 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 00017 */ 00018 00019 #ifndef PS_SCALAR_H 00020 #define PS_SCALAR_H 00021 00022 #include "psType.h" 00023 00024 /// @addtogroup Scalar 00025 /// @{ 00026 00027 /** Basic scalar data structure. 00028 * 00029 * Struct for maintaining a scalar of frequently used primitive types. 00030 * 00031 */ 00032 typedef struct 00033 { 00034 psType type; ///< Type of data. 00035 00036 union { 00037 psU8 U8; ///< Unsigned 8-bit integer data. 00038 psU16 U16; ///< Unsigned 16-bit integer data. 00039 psU32 U32; ///< Unsigned 32-bit integer data. 00040 psU64 U64; ///< Unsigned 64-bit integer data. 00041 psS8 S8; ///< Signed 8-bit integer data. 00042 psS16 S16; ///< Signed 16-bit integer data. 00043 psS32 S32; ///< Signed 32-bit integer data. 00044 psS64 S64; ///< Signed 64-bit integer data. 00045 psF32 F32; ///< Single-precision float data. 00046 psF64 F64; ///< Double-precision float data. 00047 psC32 C32; ///< Single-precision complex data. 00048 psC64 C64; ///< Double-precision complex data. 00049 } data; ///< Union for data types. 00050 } 00051 psScalar; 00052 00053 /*****************************************************************************/ 00054 00055 /* FUNCTION PROTOTYPES */ 00056 00057 /*****************************************************************************/ 00058 00059 /** Allocate a scalar. 00060 * 00061 * Uses psLib memory allocation functions to create scalar data as defined by the psType type. 00062 * Accepts a complex 64 bit float for input value, as max size, but resizes according to 00063 * correct type. 00064 * 00065 * @return psScalar* Pointer to a new psScalar. 00066 */ 00067 psScalar* psScalarAlloc( 00068 psC64 value, ///< Data to be put into psScalar. 00069 psElemType dataType ///< Type of data to be held by psScalar. 00070 ); 00071 00072 /** Copy a scalar. 00073 * 00074 * Uses psLib memory allocation functions to copy a scalar. 00075 * 00076 * @return psScalar* A copy of the input scalar 00077 */ 00078 psScalar* psScalarCopy( 00079 psScalar *scalar ///< Scalar to copy. 00080 ); 00081 00082 /// @} 00083 00084 #endif // #ifndef PS_SCALAR_H
1.4.1