Index: trunk/ippTools/src/pxframes.c
===================================================================
--- trunk/ippTools/src/pxframes.c	(revision 11075)
+++ 	(revision )
@@ -1,232 +1,0 @@
-/*
- * pxframes.c
- *
- * Copyright (C) 2006  Joshua Hoblitt
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * program; see the file COPYING. If not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-
-#include "pxtools.h"
-
-#define PX_FRAME_ALLOC(frametype, exptype) \
- \
-static void frametype##Free(frametype *ptr);\
- \
-frametype *frametype##Alloc( \
-    exptype##Row *exposure, \
-    psArray *images \
-) \
-{ \
-    frametype *frame; \
- \
-    PS_ASSERT_PTR_NON_NULL(exposure, NULL); \
-    PS_ASSERT_PTR_NON_NULL(images, NULL); \
- \
-    frame = psAlloc(sizeof(frametype)); \
-    psMemSetDeallocator(frame, (psFreeFunc)frametype##Free); \
- \
-    frame->exposure = psMemIncrRefCounter(exposure); \
-    frame->images   = psMemIncrRefCounter(images); \
- \
-    return frame; \
-} \
- \
-static void frametype##Free(frametype *ptr) \
-{ \
-    psFree(ptr->exposure); \
-    psFree(ptr->images); \
-}
-
-//PX_FRAME_ALLOC(newFrame, newExp);
-//PX_FRAME_ALLOC(rawDetrendFrame, rawDetrendExp);
-//PX_FRAME_ALLOC(rawScienceFrame, rawScienceExp);
-//PX_FRAME_ALLOC(p2PendingFrame, p2PendingExp);
-
-#define PX_FRAME_PRINT(frametype, imfiletype) \
-bool frametype##Print(FILE *stream, pxConfig *config, psArray *frames) \
-{\
-    PS_ASSERT_PTR_NON_NULL(config, false); \
-    PS_ASSERT_PTR_NON_NULL(frames, false); \
-\
-    bool simple = false; \
-    { \
-        bool status = false; \
-        simple = psMetadataLookupBool(&status, config->args, "-simple"); \
-        if (!status) { \
-            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple"); \
-            return false; \
-        } \
-    } \
-\
-    for (long i = 0; i < psArrayLength(frames); i++) { \
-        frametype *frame = frames->data[i]; \
-        PS_ASSERT_PTR_NON_NULL(frame, false); \
-        PS_ASSERT_PTR_NON_NULL(frame->images, false); \
-\
-        if (!imfiletype##PrintObjects(stdout, frame->images, !simple)) { \
-            psError(PS_ERR_UNKNOWN, false, "failed to print array"); \
-            return false; \
-        } \
-    } \
-    \
-\
-    return true; \
-}
-
-//PX_FRAME_PRINT(newFrame, newImfile);
-//PX_FRAME_PRINT(rawScienceFrame, rawImfile);
-//PX_FRAME_PRINT(rawDetrendFrame, rawImfile);
-//PX_FRAME_PRINT(p2PendingFrame, p2PendingImfile);
-
-// XXX fix the exposure search so that it doesn't dump the entire table
-#define PX_FRAME_SEARCH(frametype, exptype, imfiletype, key) \
-psArray *frametype##Search(pxConfig *config) \
-{ \
-    PS_ASSERT_PTR_NON_NULL(config, NULL); \
- \
-    psArray *exposures = exptype##SelectRowObjects(config->dbh, NULL, MAX_ROWS); \
-    if (!exposures) { \
-        psError(PS_ERR_UNKNOWN, false, "no " #exptype " rows found"); \
- \
-        return NULL; \
-    } \
- \
-    psArray *allFrames = psArrayAllocEmpty(psArrayLength(exposures)); \
- \
-    for (long i = 0; i < psArrayLength(exposures); i++) { \
-        exptype##Row *exposure = exposures->data[i]; \
-\
-        psMetadata *where = psMetadataAlloc(); \
-        psMetadataAddStr(where, PS_LIST_TAIL, #key, PS_META_REPLACE, "==", \
-            exposure->key); \
- \
-        psArray *images = imfiletype##SelectRowObjects(config->dbh, where, \
-            MAX_ROWS); \
-        psFree(where); \
-        if (!images) { \
-            psError(PS_ERR_UNKNOWN, false, "no " #imfiletype " rows found for key %s", exposure->key); \
- \
-            continue; \
-        } \
- \
-        frametype *frame = frametype##Alloc(exposure, images); \
-        psFree(images); \
-        psArrayAdd(allFrames, 100, frame); \
-        psFree(frame); \
-    } \
- \
-    psFree(exposures); \
- \
-    if (!psArrayLength(allFrames)) { \
-        psFree(allFrames); \
-        allFrames = NULL; \
-    } \
- \
-    return allFrames; \
-}
-
-//PX_FRAME_SEARCH(newFrame, newExp, newImfile);
-//PX_FRAME_SEARCH(rawDetrendFrame, rawDetrendExp, rawImfile, exp_tag);
-//PX_FRAME_SEARCH(rawScienceFrame, rawScienceExp, rawImfile, exp_tag);
-//PX_FRAME_SEARCH(p2PendingFrame, p2PendingExp, p2PendingImfile, exp_tag);
-
-
-bool rawScienceFrameInsert(pxConfig *config, rawScienceFrame *frame)
-{
-    PS_ASSERT_PTR_NON_NULL(config, false);
-    PS_ASSERT_PTR_NON_NULL(config->dbh, false);
-    PS_ASSERT_PTR_NON_NULL(frame, false);
-
-    psDB *dbh = config->dbh;
-
-    if (!rawScienceExpInsertObject(dbh, frame->exposure)) {
-        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
-        return false;
-    }
-
-    psArray *images = frame->images;
-    for (long i = 0; i < psArrayLength(images); i++) {
-        if (!rawImfileInsertObject(dbh, images->data[i])) {
-            psError(PS_ERR_UNKNOWN, false, "dbh access failed");
-            return false;
-        }
-    }
-
-    return true;
-}
-
-/*
-rawDetrendFrame *newToRawDetrendFrame(pxConfig *config, newFrame *newFrame)
-{
-    newExpRow       *newExp = NULL;
-
-    PS_ASSERT_PTR_NON_NULL(newFrame, NULL);
-
-    newExp = newFrame->exposure;
-    rawDetrendExpRow *rawDetrendExp = newToRawDetrendExp(config, newExp);
-
-    psArray *newImages = newFrame->images;
-    psArray *rawImages = psArrayAllocEmpty(psArrayLength(newImages));
-    for (long i = 0; i < psArrayLength(newImages); i++) {
-        newImfileRow *newImfile = newImages->data[i];
-        rawImfileRow *rawImfile = rawImfileRowAlloc(
-            newImfile->exp_tag,
-            newImfile->class,
-            newImfile->class_id,
-            newImfile->uri
-        );
-        psArrayAdd(rawImages, 0, rawImfile);
-        psFree(rawImfile);
-    }
-
-    rawDetrendFrame *rawDetrendFrame = rawDetrendFrameAlloc(rawDetrendExp, rawImages);
-    psFree(rawDetrendExp);
-    psFree(rawImages);
-
-    return rawDetrendFrame;
-}
-*/
-
-#if 0
-bool rawDetrendFrameInsert(pxConfig *config, rawDetrendFrame *frame)
-{
-    PS_ASSERT_PTR_NON_NULL(config, false);
-    PS_ASSERT_PTR_NON_NULL(config->dbh, false);
-    PS_ASSERT_PTR_NON_NULL(frame, false);
-
-    psDB *dbh = config->dbh;
-
-    if (!rawDetrendExpInsertObject(dbh, frame->exposure)) {
-        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
-        return false;
-    }
-
-    psArray *images = frame->images;
-    for (long i = 0; i < psArrayLength(images); i++) {
-        if (!rawImfileInsertObject(dbh, images->data[i])) {
-            psError(PS_ERR_UNKNOWN, false, "dbh access failed");
-            return false;
-        }
-    }
-
-    return true;
-}
-
-#endif
