IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 11216


Ignore:
Timestamp:
Jan 19, 2007, 6:24:42 PM (19 years ago)
Author:
Paul Price
Message:

Adding pmFPAIdentifySourceFromHeader to only identify the source in the FPA --- same action as pmFPAAddSourceFromHeader, except it doesn't add.

Location:
trunk/psModules/src/camera
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/camera/pmFPAConstruct.c

    r10992 r11216  
    471471                            const pmFPAview *phuView, // The view corresponding to the PHU, or NULL
    472472                            const psMetadata *header, // The PHU header, or NULL
    473                             const psMetadata *format // Format of file
     473                            const psMetadata *format, // Format of file
     474                            bool install // Install the provided header in the location that we find?
    474475                           )
    475476{
     
    540541            return NULL;
    541542        }
    542         if (processContents(fpa, NULL, NULL, phdu, PM_FPA_LEVEL_FPA, contents, format) < 0) {
     543        if (install && processContents(fpa, NULL, NULL, phdu, PM_FPA_LEVEL_FPA, contents, format) < 0) {
    543544            psError(PS_ERR_IO, false, "Error setting CONTENTS");
    544545            psFree(phdu);
     
    548549        psFree(phdu);
    549550
    550         if (header && !pmConceptsRead(fpa, NULL, NULL, PM_CONCEPT_SOURCE_PHU, NULL)) {
     551        if (install && header && !pmConceptsRead(fpa, NULL, NULL, PM_CONCEPT_SOURCE_PHU, NULL)) {
    551552            psWarning("Unable to read concepts from PHU.\n");
    552553        }
     
    645646        }
    646647
    647         const char *content = getContent(fileInfo, contents, chip, cell); // The chip:cell:cellType triples
    648         if (!content || strlen(content) == 0) {
    649             psError(PS_ERR_IO, false, "Unable to get CONTENTS.\n");
    650             psFree(phdu);
    651             psFree(view);
    652             return NULL;
    653         }
    654         if (processContents(fpa, chip, cell, phdu, level, content, format) < 0) {
    655             psError(PS_ERR_IO, false, "Error setting CONTENTS");
    656             psFree(phdu);
    657             psFree(view);
    658             return NULL;
     648        if (install) {
     649            const char *content = getContent(fileInfo, contents, chip, cell); // chip:cell:cellType triples
     650            if (!content || strlen(content) == 0) {
     651                psError(PS_ERR_IO, false, "Unable to get CONTENTS.\n");
     652                psFree(phdu);
     653                psFree(view);
     654                return NULL;
     655            }
     656            if (processContents(fpa, chip, cell, phdu, level, content, format) < 0) {
     657                psError(PS_ERR_IO, false, "Error setting CONTENTS");
     658                psFree(phdu);
     659                psFree(view);
     660                return NULL;
     661            }
    659662        }
    660663        psFree(phdu);
    661664
    662         if (header && !pmConceptsRead(fpa, chip, cell, PM_CONCEPT_SOURCE_PHU, NULL)) {
     665        if (install && header && !pmConceptsRead(fpa, chip, cell, PM_CONCEPT_SOURCE_PHU, NULL)) {
    663666            psWarning("Unable to read concepts from PHU.\n");
    664667        }
     
    724727        }
    725728
    726         pmHDU *hdu = pmHDUAlloc(extName); // The extension
    727         // Casting to avoid "warning: passing arg 1 of `p_psMemIncrRefCounter' discards qualifiers from
    728         // pointer target type"
    729         hdu->format = psMemIncrRefCounter((const psPtr)format);
    730 
    731         if (processContents(fpa, chip, cell, hdu, level, contentsItem->data.V, format) < 0) {
    732             psError(PS_ERR_IO, false, "Error setting CONTENTS");
    733             psFree(view);
     729        if (install) {
     730            pmHDU *hdu = pmHDUAlloc(extName); // The extension
     731            // Casting to avoid "warning: passing arg 1 of `p_psMemIncrRefCounter' discards qualifiers from
     732            // pointer target type"
     733            hdu->format = psMemIncrRefCounter((const psPtr)format);
     734
     735            if (processContents(fpa, chip, cell, hdu, level, contentsItem->data.V, format) < 0) {
     736                psError(PS_ERR_IO, false, "Error setting CONTENTS");
     737                psFree(view);
     738                psFree(hdu);
     739                psFree(contentsIter);
     740                return NULL;
     741            }
    734742            psFree(hdu);
    735             psFree(contentsIter);
    736             return NULL;
    737         }
    738         psFree(hdu);
     743        }
    739744    }
    740745    psFree(contentsIter);
    741746
    742     if (!pmConceptsReadFPA(fpa, PM_CONCEPT_SOURCE_DEFAULTS, true, NULL)) {
    743         psWarning("Unable to read concepts from defaults for FPA.  Attempting to "
    744                   "proceed anyway.\n");
    745     }
    746 
    747     if (header && !pmConceptsRead(fpa, chip, cell, PM_CONCEPT_SOURCE_PHU, NULL)) {
    748         psWarning("Unable to read concepts from PHU.\n");
     747    if (install) {
     748        if (!pmConceptsReadFPA(fpa, PM_CONCEPT_SOURCE_DEFAULTS, true, NULL)) {
     749            psWarning("Unable to read concepts from defaults for FPA.  Attempting to "
     750                      "proceed anyway.\n");
     751        }
     752
     753        if (header && !pmConceptsRead(fpa, chip, cell, PM_CONCEPT_SOURCE_PHU, NULL)) {
     754            psWarning("Unable to read concepts from PHU.\n");
     755        }
    749756    }
    750757
     
    759766    PS_ASSERT_PTR_NON_NULL(format, false);
    760767
    761     pmFPAview *view = addSource(fpa, phuView, NULL, format);
     768    pmFPAview *view = addSource(fpa, phuView, NULL, format, true);
    762769    bool status = (view == NULL);
    763770    psFree(view);
     
    795802    psFree(newFPAname);                 // Drop reference
    796803
    797     return addSource(fpa, NULL, phu, format);
     804    return addSource(fpa, NULL, phu, format, true);
     805}
     806
     807
     808pmFPAview *pmFPAIdentifySourceFromHeader(pmFPA *fpa, psMetadata *phu, const psMetadata *format)
     809{
     810    PS_ASSERT_PTR_NON_NULL(fpa, NULL);
     811    PS_ASSERT_PTR_NON_NULL(phu, NULL);
     812    PS_ASSERT_PTR_NON_NULL(format, NULL);
     813
     814    return addSource(fpa, NULL, phu, format, false);
    798815}
    799816
  • trunk/psModules/src/camera/pmFPAConstruct.h

    r9588 r11216  
    77/// @author Paul Price, IfA
    88///
    9 /// @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
    10 /// @date $Date: 2006-10-17 00:55:01 $
     9/// @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
     10/// @date $Date: 2007-01-20 04:24:42 $
    1111///
    1212/// Copyright 2005-2006 Institute for Astronomy, University of Hawaii
     
    4848                                   );
    4949
     50/// Identify a source in the focal plane hierarchy, specified by a (primary) header
     51///
     52/// This is the same as pmFPAAddSourceFromHeader, except the input is not added into the FPA hierarchy.
     53/// This function serves only to identify where in the hierarchy it should go, not prepare for reading, etc.
     54pmFPAview *pmFPAIdentifySourceFromHeader(pmFPA *fpa, psMetadata *phu, const psMetadata *format);
     55
    5056/// Print a representation of the FPA, including its headers and concepts.
    5157///
Note: See TracChangeset for help on using the changeset viewer.