IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 16143


Ignore:
Timestamp:
Jan 18, 2008, 3:11:53 PM (18 years ago)
Author:
jhoblitt
Message:

update PXOPT_* macros

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/end_stage/ippTools/src/pxtools.h

    r16125 r16143  
    114114    } \
    115115 \
    116     if (required && (var != max)) { \
     116    if (required && (var == max)) { \
    117117        psError(PS_ERR_UNKNOWN, true, "%s is required", key); \
    118118        return ret; \
     
    170170
    171171#define PXOPT_COPY_PRIMITIVE(from, to, type, suffix, oldname, newname, comment) \
     172{ \
     173    bool status = false; \
     174    type var = psMetadataLookup##suffix(&status, from, oldname); \
     175    if (!status) { \
     176        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for " oldname); \
     177        return false; \
     178    } \
     179    if (!psMetadataAdd##suffix(to, PS_LIST_TAIL, newname, PS_META_DUPLICATE_OK, comment, var)) { \
     180        psError(PS_ERR_UNKNOWN, false, "failed to add item " newname); \
     181        psFree(to); \
     182        return false; \
     183    } \
     184}
     185
     186#define PXOPT_COPY_V(from, to, type, suffix, oldname, newname, comment) \
    172187{ \
    173188    bool status = false; \
     
    183198            return false; \
    184199        } \
    185     } \
    186 }
    187 
    188 #define PXOPT_COPY_V(from, to, type, suffix, oldname, newname, comment) \
    189     PXOPT_COPY_PRIMITIVE(from, to, type*, suffix, oldname, newname, comment) \
     200    }\
     201}
    190202
    191203#define PXOPT_COPY_F(from, to, type, oldname, newname, comment) \
     
    213225
    214226#define PXOPT_COPY_TIME(from, to, oldname, newname, comment) \
    215   PXOPT_COPY_V(from, to, psTime, Time, oldname, newname, comment)
     227  PXOPT_COPY_V(from, to, psTime *, Time, oldname, newname, comment)
    216228
    217229#define PXOPT_COPY_STR(from, to, oldname, newname, comment) \
    218   PXOPT_COPY_PRIMITIVE(from, to, psString, Str, oldname, newname, comment)
     230  PXOPT_COPY_V(from, to, psString, Str, oldname, newname, comment)
     231
     232#define PXOPT_COPY_S16(from, to, oldname, newname, comment) \
     233  PXOPT_COPY_PRIMITIVE(from, to, psS16, S16, oldname, newname, comment)
     234
     235#define PXOPT_COPY_S32(from, to, oldname, newname, comment) \
     236  PXOPT_COPY_PRIMITIVE(from, to, psS32, S32, oldname, newname, comment)
     237
     238#define PXOPT_COPY_S64(from, to, oldname, newname, comment) \
     239  PXOPT_COPY_PRIMITIVE(from, to, psS64, S64, oldname, newname, comment)
     240
     241#define PXOPT_COPY_U16(from, to, oldname, newname, comment) \
     242  PXOPT_COPY_PRIMITIVE(from, to, psU16, U16, oldname, newname, comment)
     243
     244#define PXOPT_COPY_U32(from, to, oldname, newname, comment) \
     245  PXOPT_COPY_PRIMITIVE(from, to, psU32, U32, oldname, newname, comment)
     246
     247#define PXOPT_COPY_U64(from, to, oldname, newname, comment) \
     248  PXOPT_COPY_PRIMITIVE(from, to, psU64, U64, oldname, newname, comment)
    219249
    220250#endif // PXTOOLS_H
Note: See TracChangeset for help on using the changeset viewer.