Changeset 6257 for trunk/ippTools/src/pxframes.c
- Timestamp:
- Jan 30, 2006, 5:19:13 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/pxframes.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/pxframes.c
r6224 r6257 2 2 3 3 #include "pxtools.h" 4 5 #define PX_FRAME_ALLOC(frametype, exptype) \ 6 \ 7 static void frametype##Free(frametype *ptr);\ 8 \ 9 frametype *frametype##Alloc( \ 10 exptype##Row *exposure, \ 11 psArray *images \ 12 ) \ 13 { \ 14 frametype *frame; \ 15 \ 16 PS_ASSERT_PTR_NON_NULL(exposure, NULL); \ 17 PS_ASSERT_PTR_NON_NULL(images, NULL); \ 18 \ 19 frame = psAlloc(sizeof(frametype)); \ 20 psMemSetDeallocator(frame, (psFreeFunc)frametype##Free); \ 21 \ 22 frame->exposure = exposure; \ 23 frame->images = images; \ 24 \ 25 return frame; \ 26 } \ 27 \ 28 static void frametype##Free(frametype *ptr) \ 29 { \ 30 psFree(ptr->exposure); \ 31 psFree(ptr->images); \ 32 } 33 34 PX_FRAME_ALLOC(newFrame, newExp); 35 PX_FRAME_ALLOC(rawScienceFrame, rawScienceExp); 36 PX_FRAME_ALLOC(p2PendingFrame, p2PendingExp); 37 PX_FRAME_ALLOC(p2DoneFrame, p2DoneExp); 4 38 5 39 #define PX_FRAME_PRINT(frametype, imfiletype) \ … … 35 69 PX_FRAME_PRINT(rawScienceFrame, rawImfile); 36 70 PX_FRAME_PRINT(p2PendingFrame, p2PendingImfile); 71 72 73 #define PX_FRAME_SEARCH(frametype, exptype, imfiletype) \ 74 psArray *frametype##Search(pxConfig *config) \ 75 { \ 76 PS_ASSERT_PTR_NON_NULL(config, NULL); \ 77 \ 78 psArray *exposures = exptype##SelectRowObjects(config->database, \ 79 config->where, MAX_ROWS); \ 80 if (!exposures) { \ 81 psError(PS_ERR_UNKNOWN, false, "no exptype rows found"); \ 82 \ 83 return NULL; \ 84 } \ 85 \ 86 psArray *allFrames = psArrayAlloc(exposures->n); \ 87 allFrames->n = 0; \ 88 \ 89 psMetadata *where = psMetadataAlloc (); \ 90 for (int i = 0; i < exposures->n; i++) { \ 91 exptype##Row *exposure = exposures->data[i]; \ 92 \ 93 psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", PS_META_REPLACE, "==", \ 94 exposure->exp_id); \ 95 \ 96 psArray *images = imfiletype##SelectRowObjects(config->database, where, \ 97 MAX_ROWS); \ 98 if (!images) { \ 99 psError(PS_ERR_UNKNOWN, false, "database access failed"); \ 100 \ 101 return NULL; \ 102 } \ 103 \ 104 frametype *frame = frametype##Alloc(exposure, images); \ 105 psArrayAdd(allFrames, 100, frame); \ 106 } \ 107 \ 108 return allFrames; \ 109 } 110 111 PX_FRAME_SEARCH(newFrame, newExp, newImfile);
Note:
See TracChangeset
for help on using the changeset viewer.
