Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

psScalar.h

Go to the documentation of this file.
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/09/14 20:42:48 $
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     psMathType 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     complex value,                     ///< Data to be put into psScalar.
00069     psElemType type                    ///< Type of data to be held by psScalar.
00070 );
00071 
00072 
00073 /** Checks the type of a particular pointer.
00074  *
00075  *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
00076  *
00077  *  @return bool:       True if the pointer matches a psScalar structure, false otherwise.
00078  */
00079 bool psMemCheckScalar(
00080     psPtr ptr                          ///< the pointer whose type to check
00081 );
00082 
00083 
00084 /** Copy a scalar.
00085  *
00086  * Uses psLib memory allocation functions to copy a scalar.
00087  *
00088  * @return psScalar*    A copy of the input scalar
00089  */
00090 psScalar* psScalarCopy(
00091     const psScalar *value              ///< Scalar to copy.
00092 );
00093 
00094 /// @}
00095 
00096 #endif // #ifndef PS_SCALAR_H

Generated on Wed Sep 14 10:42:48 2005 for Pan-STARRS Foundation Library by  doxygen 1.4.2