IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 10, 2004, 12:07:04 PM (22 years ago)
Author:
eugene
Message:

cleaned up types / implementation for math operations

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/archive/pslib/include/psMath.h

    r204 r206  
    8383
    8484/** for a set of N data types, you need a collection of N^2 - 1 functions **/
     85
     86/*** example 3: embedded data type */
     87
     88psImage A, B, Y;
     89
     90B = psBinaryOp (NULL, A, "^", psScalar(2));
     91Y = psUnaryOp (NULL, B, "log");
     92
     93/** in this method, the data types (psImage, psVector) include embedded information about their data type in
     94 * the structure.  The constant value is then handled by calling the psScalar function which returns a private
     95 * scalar data type which is always freed by the code.  This forces the layout of the data structures to be
     96 * consistent, with the type information as the first entry.  We can then define a data type which is
     97 * completely flat and can be used to check on the data type of the data.
     98 */
     99
     100typedef struct {
     101    psTypeInfo type;
     102    union {
     103        int i;
     104        float f;
     105        double d;
     106    }
     107} p_psScalar;
     108
     109typedef struct {
     110    psType type;
     111    psDimension dim;
     112} psTypeInfo;
Note: See TracChangeset for help on using the changeset viewer.