IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 9572


Ignore:
Timestamp:
Oct 13, 2006, 4:35:39 PM (20 years ago)
Author:
Paul Price
Message:

Adding const where appropriate. Adding doxygen documentation to header files. Removing comments on functions defined in the header file, so that there's only a single source.

Location:
trunk/psModules/src/concepts
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/concepts/pmConcepts.c

    r9570 r9572  
    2525}
    2626
    27 pmConceptSpec *pmConceptSpecAlloc(psMetadataItem *blank, // Blank value; contains the name
    28                                   pmConceptParseFunc parse, // Function to call to parse the concept
    29                                   pmConceptFormatFunc format // Function to call to format the concept
    30                                  )
     27pmConceptSpec *pmConceptSpecAlloc(psMetadataItem *blank, pmConceptParseFunc parse,
     28                                  pmConceptFormatFunc format)
    3129{
    3230    pmConceptSpec *spec = psAlloc(sizeof(pmConceptSpec));
     
    4139
    4240
    43 bool pmConceptRegister(psMetadataItem *blank, // Blank value; contains the name
    44                        pmConceptParseFunc parse, // Function to call to parse the concept
    45                        pmConceptFormatFunc format, // Function to call to format the concept
    46                        pmFPALevel level // Level at which to store concept in the FPA hierarchy
    47                       )
     41bool pmConceptRegister(psMetadataItem *blank, pmConceptParseFunc parse,
     42                       pmConceptFormatFunc format, pmFPALevel level)
    4843{
    4944    PS_ASSERT_PTR_NON_NULL(blank, false);
     
    185180// Write all registered concepts for the specified level
    186181static bool conceptsWrite(psMetadata **specs, // One of the concepts specifications
    187                           pmFPA *fpa,   // The FPA
    188                           pmChip *chip, // The chip
    189                           pmCell *cell, // The cell
     182                          const pmFPA *fpa,   // The FPA
     183                          const pmChip *chip, // The chip
     184                          const pmCell *cell, // The cell
    190185                          pmConceptSource source, // The source of the concepts to write
    191186                          psDB *db,      // Database handle
    192                           psMetadata *concepts // The concepts to write out
     187                          const psMetadata *concepts // The concepts to write out
    193188                         )
    194189{
     
    218213}
    219214
    220 // Set the concepts for a given FPA to blanks
    221 bool pmConceptsBlankFPA(pmFPA *fpa    // FPA for which to set blank concepts
    222                        )
    223 {
    224     PS_ASSERT_PTR_NON_NULL(fpa, false);
    225     psTrace("psModules.concepts", 5, "Blanking FPA concepts: %p %p\n", conceptsFPA, fpa->concepts);
    226     return conceptsBlank(&conceptsFPA, fpa->concepts);
    227 }
    228 
    229 // Read the concepts for the given set of fpa, chip, cell
    230 bool pmConceptsRead(pmFPA *fpa,         // FPA for which to read concepts
    231                     pmChip *chip,       // Chip for which to read concepts, or NULL
    232                     pmCell *cell,       // Cell for which to read concepts, or NULL
    233                     pmConceptSource source, // The source of the concepts to read
    234                     psDB *db            // Database handle
    235                    )
     215
     216bool pmConceptsRead(pmFPA *fpa, pmChip *chip, pmCell *cell, pmConceptSource source, psDB *db)
    236217{
    237218    PS_ASSERT_PTR_NON_NULL(fpa, false);
     
    248229
    249230
    250 // Read the concepts for a given FPA
    251 bool pmConceptsReadFPA(pmFPA *fpa,      // FPA for which to read concepts
    252                        pmConceptSource source, // The source of the concepts to read
    253                        bool propagateDown, // Propagate to lower levels?
    254                        psDB *db        // Database handle
    255                       )
     231bool pmConceptsBlankFPA(pmFPA *fpa)
     232{
     233    PS_ASSERT_PTR_NON_NULL(fpa, false);
     234    psTrace("psModules.concepts", 5, "Blanking FPA concepts: %p %p\n", conceptsFPA, fpa->concepts);
     235    return conceptsBlank(&conceptsFPA, fpa->concepts);
     236}
     237
     238
     239bool pmConceptsReadFPA(pmFPA *fpa, pmConceptSource source, bool propagateDown, psDB *db)
    256240{
    257241    PS_ASSERT_PTR_NON_NULL(fpa, false);
     
    271255}
    272256
    273 // Read the concepts for a given FPA
    274 bool pmConceptsWriteFPA(pmFPA *fpa,     // FPA for which to write concepts
    275                         pmConceptSource source, // The source of the concepts to read
    276                         bool propagateDown, // Propagate to lower levels?
    277                         psDB *db        // Database handle
    278                        )
     257bool pmConceptsWriteFPA(const pmFPA *fpa, pmConceptSource source, bool propagateDown, psDB *db)
    279258{
    280259    PS_ASSERT_PTR_NON_NULL(fpa, false);
     
    293272}
    294273
    295 // Set the concepts for a given chip to blanks
    296 bool pmConceptsBlankChip(pmChip *chip // FPA for which to set blank concepts
    297                         )
     274bool pmConceptsBlankChip(pmChip *chip)
    298275{
    299276    PS_ASSERT_PTR_NON_NULL(chip, false);
     
    302279}
    303280
    304 // Read the concepts for a given FPA
    305 bool pmConceptsReadChip(pmChip *chip,   // Chip for which to read concepts
    306                         pmConceptSource source, // The source of the concepts to read
    307                         bool propagateUp, // Propagate to higher levels?
    308                         bool propagateDown, // Propagate to lower levels?
    309                         psDB *db        // Database handle
    310                        )
     281bool pmConceptsReadChip(pmChip *chip, pmConceptSource source, bool propagateUp,
     282                        bool propagateDown, psDB *db)
    311283{
    312284    PS_ASSERT_PTR_NON_NULL(chip, false);
     
    330302}
    331303
    332 // Read the concepts for a given FPA
    333 bool pmConceptsWriteChip(pmChip *chip,  // Chip for which to write concepts
    334                          pmConceptSource source, // The source of the concepts to read
    335                          bool propagateUp, // Propagate to higher levels?
    336                          bool propagateDown, // Propagate to lower levels?
    337                          psDB *db        // Database handle
    338                         )
     304bool pmConceptsWriteChip(const pmChip *chip, pmConceptSource source, bool propagateUp,
     305                         bool propagateDown, psDB *db)
    339306{
    340307    PS_ASSERT_PTR_NON_NULL(chip, false);
     
    357324}
    358325
    359 // Set the concepts for a given chip to blanks
    360 bool pmConceptsBlankCell(pmCell *cell // Cell for which to set blank concepts
    361                         )
     326bool pmConceptsBlankCell(pmCell *cell)
    362327{
    363328    PS_ASSERT_PTR_NON_NULL(cell, false);
     
    366331}
    367332
    368 // Read the concepts for a given FPA
    369 bool pmConceptsReadCell(pmCell *cell,   // Cell for which to read concepts
    370                         pmConceptSource source, // The source of the concepts to read
    371                         bool propagateUp, // Propagate to higher levels?
    372                         psDB *db        // Database handle
    373                        )
     333bool pmConceptsReadCell(pmCell *cell, pmConceptSource source, bool propagateUp, psDB *db)
    374334{
    375335    PS_ASSERT_PTR_NON_NULL(cell, false);
     
    394354}
    395355
    396 // Read the concepts for a given FPA
    397 bool pmConceptsWriteCell(pmCell *cell,  // FPA for which to write concepts
    398                          pmConceptSource source, // The source of the concepts to read
    399                          bool propagateUp, // Propagate to higher levels?
    400                          psDB *db       // Database handle
    401                         )
     356bool pmConceptsWriteCell(const pmCell *cell, pmConceptSource source, bool propagateUp, psDB *db)
    402357{
    403358    PS_ASSERT_PTR_NON_NULL(cell, false);
     
    423378{
    424379    conceptsInitialised = true;
     380
     381    p_psMemAllocatePersistent(true);
    425382
    426383    bool init = false;                  // Did we initialise anything?
     
    761718    }
    762719
     720    p_psMemAllocatePersistent(false);
     721
    763722    return init;
    764723}
     
    777736
    778737
    779 // Copy concepts from one FPA to another
    780 bool pmFPACopyConcepts(pmFPA *target,   // The target FPA
    781                        pmFPA *source    // The target FPA
    782                       )
     738bool pmFPACopyConcepts(pmFPA *target, const pmFPA *source)
    783739{
    784740    PS_ASSERT_PTR_NON_NULL(target, false);
  • trunk/psModules/src/concepts/pmConcepts.h

    r9570 r9572  
    22#define PM_CONCEPTS_H
    33
    4 #include "pslib.h"
     4#include <pslib.h>
    55#include "pmFPA.h"
    66
    7 // Function to call to parse a concept once it has been read
    8 typedef psMetadataItem* (*pmConceptParseFunc)(const psMetadataItem *concept, const psMetadataItem *pattern, const psMetadata *cameraFormat, const pmFPA *fpa, const pmChip *chip, const pmCell *cell);
    9 // Function to call to format a concept for writing
    10 typedef psMetadataItem* (*pmConceptFormatFunc)(const psMetadataItem *concept, const psMetadata *cameraFormat, const pmFPA *fpa, const pmChip *chip, const pmCell *cell);
     7/// Function to call to parse a concept once it has been read
     8typedef psMetadataItem* (*pmConceptParseFunc)(const psMetadataItem *concept, ///< Concept to parse
     9        const psMetadataItem *pattern, ///< Pattern for parsing
     10        const psMetadata *cameraFormat, ///< Camera format definition
     11        const pmFPA *fpa, ///< FPA for concept, or NULL
     12        const pmChip *chip, ///< Chip for concept, or NULL
     13        const pmCell *cell ///< Cell for concept, or NULL
     14                                             );
    1115
    12 // A "concept" specification
     16/// Function to call to format a concept for writing
     17typedef psMetadataItem* (*pmConceptFormatFunc)(const psMetadataItem *concept, ///< Concept to format
     18        const psMetadata *cameraFormat, ///< Camera format definition
     19        const pmFPA *fpa, ///< FPA for concept, or NULL
     20        const pmChip *chip, ///< Chip for concept, or NULL
     21        const pmCell *cell ///< Cell for concept, or NULL
     22                                              );
     23
     24
     25/// A "concept" specification
     26///
     27/// Defines the name, default comment, blank value, and functions to parse (after reading) and format (before
     28/// writing) the concept.
    1329typedef struct
    1430{
    15     psMetadataItem *blank;              // Blank value of concept; also contains the name
    16     pmConceptParseFunc parse;           // Function to call to read the concept
    17     pmConceptFormatFunc format;         // Function to call to write the concept
     31    psMetadataItem *blank;              ///< Blank value of concept; also contains the name and comment
     32    pmConceptParseFunc parse;           ///< Function to call to read the concept
     33    pmConceptFormatFunc format;         ///< Function to call to write the concept
    1834}
    1935pmConceptSpec;
    2036
    21 // Allocator
    22 pmConceptSpec *pmConceptSpecAlloc(psMetadataItem *blank, // Blank value; contains the name
    23                                   pmConceptParseFunc parse, // Function to call to parse the concept
    24                                   pmConceptFormatFunc format // Function to call to format the concept
     37/// Allocator for pmConceptSpec
     38pmConceptSpec *pmConceptSpecAlloc(psMetadataItem *blank, ///< Blank value; contains the name
     39                                  pmConceptParseFunc parse, ///< Function to call to parse the concept
     40                                  pmConceptFormatFunc format ///< Function to call to format the concept
    2541                                 );
    2642
    27 // Register a new concept
    28 bool pmConceptRegister(psMetadataItem *blank, // Blank value; contains the name
    29                        pmConceptParseFunc parse, // Function to call to parse the concept
    30                        pmConceptFormatFunc format, // Function to call to format the concept
    31                        pmFPALevel level // Level at which to store concept in the FPA hierarchy
     43/// Register a new concept for parsing and formatting
     44///
     45/// Defines a new concept, based on the blank value (with name and default comment), and functions to parse
     46/// and format the concept.  The new concept is registered at the specified level (FPA, chip or cell).
     47bool pmConceptRegister(psMetadataItem *blank, ///< Blank value; contains the name and default comment
     48                       pmConceptParseFunc parse, ///< Function to call to parse the concept
     49                       pmConceptFormatFunc format, ///< Function to call to format the concept
     50                       pmFPALevel level ///< Level at which to store concept in the FPA hierarchy
    3251                      );
    3352
    34 // Some specificity to reading and writing concepts
     53/// Source for concepts when reading and writing.
     54///
     55/// Since some sources become available at different times from others, we need to provide some specificity to
     56/// reading and writing concepts (or we're forced to wait until everything's available, which we don't want to
     57/// do).  Concepts may be read from or written to multiple sources at once by OR-ing them.
    3558typedef enum {
    36     PM_CONCEPT_SOURCE_NONE     = 0x00,  // No concepts
    37     PM_CONCEPT_SOURCE_CELLS    = 0x01,  // Concept comes from the camera information
    38     PM_CONCEPT_SOURCE_DEFAULTS = 0x02,  // Concept comes from defaults
    39     PM_CONCEPT_SOURCE_PHU      = 0x04,  // Concept comes from PHU
    40     PM_CONCEPT_SOURCE_HEADER   = 0x08,  // Concept comes from FITS header
    41     PM_CONCEPT_SOURCE_DATABASE = 0x10,  // Concept comes from database
    42     PM_CONCEPT_SOURCE_ALL      = 0xff   // All concepts
     59    PM_CONCEPT_SOURCE_NONE     = 0x00,  ///< No concepts
     60    PM_CONCEPT_SOURCE_CELLS    = 0x01,  ///< Concept comes from the camera information
     61    PM_CONCEPT_SOURCE_DEFAULTS = 0x02,  ///< Concept comes from defaults
     62    PM_CONCEPT_SOURCE_PHU      = 0x04,  ///< Concept comes from PHU
     63    PM_CONCEPT_SOURCE_HEADER   = 0x08,  ///< Concept comes from FITS header
     64    PM_CONCEPT_SOURCE_DATABASE = 0x10,  ///< Concept comes from database
     65    PM_CONCEPT_SOURCE_ALL      = 0xff   ///< All concepts
    4366} pmConceptSource;
    4467
    45 // Read the concepts for the given set of fpa, chip, cell
    46 bool pmConceptsRead(pmFPA *fpa,         // FPA for which to read concepts
    47                     pmChip *chip,       // Chip for which to read concepts, or NULL
    48                     pmCell *cell,       // Cell for which to read concepts, or NULL
    49                     pmConceptSource source, // The source of the concepts to read
    50                     psDB *db            // Database handle
     68/// Read the concepts for the given set of fpa, chip, cell
     69///
     70/// Attempts to read as many concepts as possible from the specified source for the specified FPA, chip and
     71/// cell.  That is, it will read chip- and cell-level concepts in addition to fpa-level concepts, if the chip
     72/// and cell are provided.
     73bool pmConceptsRead(pmFPA *fpa,         ///< FPA for which to read concepts
     74                    pmChip *chip,       ///< Chip for which to read concepts, or NULL
     75                    pmCell *cell,       ///< Cell for which to read concepts, or NULL
     76                    pmConceptSource source, ///< The source of the concepts to read
     77                    psDB *db            ///< Database handle
    5178                   );
    5279
    53 // Set blanks, read or write concepts at the appropriate level
    54 bool pmConceptsBlankFPA(pmFPA *fpa      // FPA for which to set blank concepts
     80/// Set the concepts within the FPA to the blank value
     81bool pmConceptsBlankFPA(pmFPA *fpa      ///< FPA for which to set blank concepts
    5582                       );
    56 bool pmConceptsReadFPA(pmFPA *fpa,      // FPA for which to read concepts
    57                        pmConceptSource source, // Source for concepts
    58                        bool propagateDown, // Propagate to lower levels?
    59                        psDB *db         // Database handle
     83
     84/// Read concepts for an FPA; optionally, read concepts at all lower levels.
     85///
     86/// Once concepts should be available for reading at the FPA-level, this function attempts to read the
     87/// concepts from the specified source.  It also allows concepts to be read at lower levels by iterating over
     88/// the components.
     89bool pmConceptsReadFPA(pmFPA *fpa,      ///< FPA for which to read concepts
     90                       pmConceptSource source, ///< Source for concepts
     91                       bool propagateDown, ///< Propagate to lower levels?
     92                       psDB *db         ///< Database handle
    6093                      );
    61 bool pmConceptsWriteFPA(pmFPA *fpa,     // FPA for which to write concepts
    62                         pmConceptSource source, // Source for concepts
    63                         bool propagateDown, // Propagate to lower levels?
    64                         psDB *db        // Database handle
     94
     95/// Write concepts for an FPA; optionally, write concepts at all lower levels.
     96///
     97/// This function writes all concepts for the FPA to the specified "source".  It also allows concepts to be
     98/// written for all lower levels by iterating over the components.
     99bool pmConceptsWriteFPA(const pmFPA *fpa,     ///< FPA for which to write concepts
     100                        pmConceptSource source, ///< Source for concepts
     101                        bool propagateDown, ///< Propagate to lower levels?
     102                        psDB *db        ///< Database handle
    65103                       );
    66 bool pmConceptsBlankChip(pmChip *chip   // FPA for which to set blank concepts
    67                         );
    68 bool pmConceptsReadChip(pmChip *chip,   // Chip for which to read concepts
    69                         pmConceptSource source, // Source for concepts
    70                         bool propagateUp, // Propagate to higher levels?
    71                         bool propagateDown, // Propagate to lower levels?
    72                         psDB *db        // Database handle
    73                        );
    74 bool pmConceptsWriteChip(pmChip *chip,  // Chip for which to write concepts
    75                          pmConceptSource source, // Source for concepts
    76                          bool propagateUp,// Propagate to higher levels?
    77                          bool propagateDown, // Propagate to lower levels?
    78                          psDB *db       // Database handle
    79                         );
    80 bool pmConceptsBlankCell(pmCell *cell   // Cell for which to set blank concepts
    81                         );
    82 bool pmConceptsReadCell(pmCell *cell,   // Cell for which to read concepts
    83                         pmConceptSource source, // Source for concepts
    84                         bool propagateUp, // Propagate to higher levels?
    85                         psDB *db        // Database handle
    86                        );
    87 bool pmConceptsWriteCell(pmCell *cell,  // FPA for which to write concepts
    88                          pmConceptSource source, // Source for concepts
    89                          bool propagateUp, // Propagate to higher levels?
    90                          psDB *db       // Database handle
     104
     105/// Set the concepts within the chip to the blank value
     106bool pmConceptsBlankChip(pmChip *chip   ///< FPA for which to set blank concepts
    91107                        );
    92108
    93 // Set up the blank concepts
     109/// Read concepts for a chip; optionally, read concepts at the FPA and cell levels.
     110///
     111/// Once concepts should be available for reading at the FPA-level, this function attempts to read the
     112/// concepts from the specified source.  It also allows concepts to be read at the fpa level (through the
     113/// parent), and the cell level by iterating over the components.
     114bool pmConceptsReadChip(pmChip *chip,   ///< Chip for which to read concepts
     115                        pmConceptSource source, ///< Source for concepts
     116                        bool propagateUp, ///< Propagate to higher levels?
     117                        bool propagateDown, ///< Propagate to lower levels?
     118                        psDB *db        ///< Database handle
     119                       );
     120
     121/// Write concepts for a chip; optionally, write concepts at the FPA and cell levels.
     122///
     123/// This function writes all concepts for the chip to the specified "source".  It also allows concepts to be
     124/// written for the FPA, and the cell level by iterating over the components.
     125bool pmConceptsWriteChip(const pmChip *chip,  ///< Chip for which to write concepts
     126                         pmConceptSource source, ///< Source for concepts
     127                         bool propagateUp,///< Propagate to higher levels?
     128                         bool propagateDown, ///< Propagate to lower levels?
     129                         psDB *db       ///< Database handle
     130                        );
     131
     132/// Set the concepts within the cell to the blank value
     133bool pmConceptsBlankCell(pmCell *cell   ///< Cell for which to set blank concepts
     134                        );
     135
     136/// Read concepts for a cell; optionally, read concepts for the parents.
     137///
     138/// Once concepts should be available for reading at the FPA-level, this function attempts to read the
     139/// concepts from the specified source.  It also allows concepts to be read at upper levels through the
     140/// parents (note, it would not read concepts for all chips, but only the parent of this cell).
     141bool pmConceptsReadCell(pmCell *cell,   ///< Cell for which to read concepts
     142                        pmConceptSource source, ///< Source for concepts
     143                        bool propagateUp, ///< Propagate to higher levels?
     144                        psDB *db        ///< Database handle
     145                       );
     146
     147/// Write concepts for a cell; optionally, write concepts for the parents.
     148///
     149/// This function writes all concepts for the chip to the specified "source".  It also allows concepts to be
     150/// written for the upper levels through the parents (note, it would not write concepts for all chips, but
     151/// only the parent of this cell).
     152bool pmConceptsWriteCell(const pmCell *cell,  ///< FPA for which to write concepts
     153                         pmConceptSource source, ///< Source for concepts
     154                         bool propagateUp, ///< Propagate to higher levels?
     155                         psDB *db       ///< Database handle
     156                        );
     157
     158/// Initialise the concepts system.
     159///
     160/// Register the standard concepts, so that concepts may be read and written.  This function is called
     161/// automatically the first time the concepts functions are used.
    94162bool pmConceptsInit(void);
    95 // Free the concept specs so there's no memory leak
     163
     164/// Signifies that the user is done with the concepts system.
     165///
     166/// Frees the registered concepts so there is no memory leak when the user checks "persistent" memory.
    96167void pmConceptsDone(void);
    97168
    98 // Copy all the concepts within an FPA to another FPA
    99 bool pmFPACopyConcepts(pmFPA *target,   // The target FPA
    100                        pmFPA *source    // The target FPA
     169/// Copy all the concepts within an FPA to another FPA
     170///
     171/// Iterates over all components of the FPA, and copies the concepts metadata from the source to the target.
     172bool pmFPACopyConcepts(pmFPA *target,   ///< The target FPA
     173                       const pmFPA *source    ///< The source FPA
    101174                      );
    102175
  • trunk/psModules/src/concepts/pmConceptsAverage.c

    r8815 r9572  
    2121
    2222// Set a variety of concepts in a cell by averaging over several
    23 bool pmConceptsAverageCells(pmCell *target,// Target cell
    24                             psList *sources, // List of source cells
    25                             psRegion *trimsec, // The trim section
    26                             psRegion *biassec // The bias section
    27                            )
     23bool pmConceptsAverageCells(pmCell *target, psList *sources, psRegion *trimsec, psRegion *biassec)
    2824{
    2925    PS_ASSERT_PTR_NON_NULL(target, false);
  • trunk/psModules/src/concepts/pmConceptsAverage.h

    r7851 r9572  
    55#include "pmFPA.h"
    66
    7 // Set a variety of concepts in a cell by averaging over several
    8 bool pmConceptsAverageCells(pmCell *target,// Target cell
    9                             psList *sources, // List of source cells
    10                             psRegion *trimsec, // The trim section
    11                             psRegion *biassec // The bias section
     7/// Set a variety of concepts in a cell by averaging over several
     8///
     9/// In some instances, we want to combine the values of a concept for several cells into a single concept for
     10/// a single cell (e.g., when mosaicking multiple cells into a chip with one "cell").  This function averages
     11/// the values of various concepts:
     12/// - CELL.GAIN
     13/// - CELL.READNOISE
     14/// - CELL.EXPOSURE
     15/// - CELL.DARKTIME
     16/// - CELL.TIME
     17/// For other concepts, it ensures the values are consistent:
     18/// - CELL.READDIR
     19/// - CELL.TIMESYS
     20/// And for others, it takes the "worst" possible value:
     21/// - CELL.SATURATION
     22/// - CELL.BAD
     23bool pmConceptsAverageCells(pmCell *target,///< Target cell
     24                            psList *sources, ///< List of source cells
     25                            psRegion *trimsec, ///< The new trim section
     26                            psRegion *biassec ///< The new bias section
    1227                           );
    1328
  • trunk/psModules/src/concepts/pmConceptsPhotcode.c

    r8815 r9572  
    44
    55#include <stdio.h>
     6#include <string.h>
    67#include <pslib.h>
    78
    89#include "pmConceptsPhotcode.h"
    910
    10 char *pmConceptsPhotcodeForView (pmConfig *config, pmFPAfile *file, pmFPAview *view)
     11psString pmConceptsPhotcodeForView(pmConfig *config, pmFPAfile *file, pmFPAview *view)
    1112{
     13    PS_ASSERT_PTR_NON_NULL(config, NULL);
     14    PS_ASSERT_PTR_NON_NULL(file, NULL);
     15    PS_ASSERT_PTR_NON_NULL(view, NULL);
    1216
    1317    if (view->chip < -1) {
    14         psError(PS_ERR_IO, true, "photcodes undefined for FPA: defined by chip\n");
     18        psError(PS_ERR_IO, true, "Photcodes undefined for FPA: defined by chip\n");
    1519        return NULL;
    1620    }
    1721
    1822    // select recipe options supplied on command line
    19     psMetadata *recipe  = psMetadataLookupPtr (NULL, config->recipes, "PHASE2");
    20     if (recipe == NULL) {
    21         psError(PS_ERR_IO, true, "recipe PHASE2 not found\n");
     23    bool mdok;                          // Status of MD lookup
     24    psMetadata *recipe  = psMetadataLookupPtr(&mdok, config->recipes, "PHASE2");
     25    if (!mdok || !recipe) {
     26        psError(PS_ERR_IO, true, "Recipe PHASE2 not found\n");
    2227        return NULL;
    2328    }
    2429
    2530    // select photcode rule from recipe
    26     char *rule = psMetadataLookupStr (NULL, recipe, "PHOTCODE.RULE");
    27     if (rule == NULL) {
     31    char *rule = psMetadataLookupStr(&mdok, recipe, "PHOTCODE.RULE");
     32    if (!mdok || !rule || strlen(rule) == 0) {
    2833        psError(PS_ERR_IO, true, "PHOTCODE.RULE not found in PHASE2 recipe\n");
    2934        return NULL;
     
    3136
    3237    // convert rule to real photcode
    33     char *photcode = pmFPAfileNameFromRule (rule, file, view);
     38    psString photcode = pmFPAfileNameFromRule(rule, file, view);
    3439
    3540    return photcode;
  • trunk/psModules/src/concepts/pmConceptsPhotcode.h

    r7679 r9572  
    22#define PM_CONCEPTS_PHOTCODE_H
    33
    4 #include "pslib.h"
     4#include <pslib.h>
    55#include "pmConfig.h"
    66#include "pmFPAview.h"
    77#include "pmFPAfile.h"
    88
    9 char *pmConceptsPhotcodeForView (pmConfig *config, pmFPAfile *file, pmFPAview *view);
     9/// Return the photcode based on the PHOTCODE.RULE in the PHASE2 recipe
     10///
     11/// A photometry code ("photcode") is a string that represents the combination of filter and detector (chip).
     12/// This functions generates a photcode for a particular chip within the FPA, based on the PHOTCODE.RULE in
     13/// the PHASE2 recipe.  Interpolation using the usual syntax (e.g., "{CHIP.NAME}") is permitted.
     14psString pmConceptsPhotcodeForView(pmConfig *config, pmFPAfile *file, pmFPAview *view);
    1015
    1116# endif
  • trunk/psModules/src/concepts/pmConceptsStandard.c

    r9539 r9572  
    3030
    3131
    32 static double defaultCoordScaling(psMetadataItem *pattern)
     32static double defaultCoordScaling(const psMetadataItem *pattern)
    3333{
    3434    if (strcmp(pattern->name, "FPA.RA") == 0) {
     
    4646
    4747// FPA.RA and FPA.DEC
    48 psMetadataItem *p_pmConceptParse_FPA_Coords(psMetadataItem *concept,
    49         psMetadataItem *pattern,
    50         psMetadata *cameraFormat,
    51         pmFPA *fpa,
    52         pmChip *chip,
    53         pmCell *cell)
     48psMetadataItem *p_pmConceptParse_FPA_Coords(const psMetadataItem *concept,
     49        const psMetadataItem *pattern,
     50        const psMetadata *cameraFormat,
     51        const pmFPA *fpa,
     52        const pmChip *chip,
     53        const pmCell *cell)
    5454{
    5555    assert(concept);
     
    115115
    116116// FPA.RA and FPA.DEC
    117 psMetadataItem *p_pmConceptFormat_FPA_Coords(psMetadataItem *concept,
    118         psMetadata *cameraFormat,
    119         pmFPA *fpa,
    120         pmChip *chip,
    121         pmCell *cell)
     117psMetadataItem *p_pmConceptFormat_FPA_Coords(const psMetadataItem *concept,
     118        const psMetadata *cameraFormat,
     119        const pmFPA *fpa,
     120        const pmChip *chip,
     121        const pmCell *cell)
    122122{
    123123    assert(concept);
     
    165165
    166166
    167 psMetadataItem *p_pmConceptParse_CELL_TRIMSEC(psMetadataItem *concept,
    168         psMetadataItem *pattern,
    169         psMetadata *cameraFormat,
    170         pmFPA *fpa,
    171         pmChip *chip,
    172         pmCell *cell)
     167psMetadataItem *p_pmConceptParse_CELL_TRIMSEC(const psMetadataItem *concept,
     168        const psMetadataItem *pattern,
     169        const psMetadata *cameraFormat,
     170        const pmFPA *fpa,
     171        const pmChip *chip,
     172        const pmCell *cell)
    173173{
    174174    assert(concept);
     
    189189}
    190190
    191 psMetadataItem *p_pmConceptParse_CELL_BIASSEC(psMetadataItem *concept,
    192         psMetadataItem *pattern,
    193         psMetadata *cameraFormat,
    194         pmFPA *fpa,
    195         pmChip *chip,
    196         pmCell *cell)
     191psMetadataItem *p_pmConceptParse_CELL_BIASSEC(const psMetadataItem *concept,
     192        const psMetadataItem *pattern,
     193        const psMetadata *cameraFormat,
     194        const pmFPA *fpa,
     195        const pmChip *chip,
     196        const pmCell *cell)
    197197{
    198198    assert(concept);
     
    245245
    246246// CELL.XBIN and CELL.YBIN
    247 psMetadataItem *p_pmConceptParse_CELL_Binning(psMetadataItem *concept,
    248         psMetadataItem *pattern,
    249         psMetadata *cameraFormat,
    250         pmFPA *fpa,
    251         pmChip *chip,
    252         pmCell *cell)
     247psMetadataItem *p_pmConceptParse_CELL_Binning(const psMetadataItem *concept,
     248        const psMetadataItem *pattern,
     249        const psMetadata *cameraFormat,
     250        const pmFPA *fpa,
     251        const pmChip *chip,
     252        const pmCell *cell)
    253253{
    254254    assert(concept);
     
    282282
    283283
    284 psMetadataItem *p_pmConceptParse_TIMESYS(psMetadataItem *concept,
    285         psMetadataItem *pattern,
    286         psMetadata *cameraFormat,
    287         pmFPA *fpa,
    288         pmChip *chip,
    289         pmCell *cell)
     284psMetadataItem *p_pmConceptParse_TIMESYS(const psMetadataItem *concept,
     285        const psMetadataItem *pattern,
     286        const psMetadata *cameraFormat,
     287        const pmFPA *fpa,
     288        const pmChip *chip,
     289        const pmCell *cell)
    290290{
    291291    assert(concept);
     
    311311}
    312312
    313 psMetadataItem *p_pmConceptParse_TIME(psMetadataItem *concept,
    314                                       psMetadataItem *pattern,
    315                                       psMetadata *cameraFormat,
    316                                       pmFPA *fpa,
    317                                       pmChip *chip,
    318                                       pmCell *cell)
     313psMetadataItem *p_pmConceptParse_TIME(const psMetadataItem *concept,
     314                                      const psMetadataItem *pattern,
     315                                      const psMetadata *cameraFormat,
     316                                      const pmFPA *fpa,
     317                                      const pmChip *chip,
     318                                      const pmCell *cell)
    319319{
    320320    assert(concept);
     
    523523
    524524// Correct a position --- in case the user wants FORTRAN indexing (like the FITS standard...)
    525 static int fortranCorr(psMetadata *cameraFormat, // The camera format description
     525static int fortranCorr(const psMetadata *cameraFormat, // The camera format description
    526526                       const char *name // Name of concept to check for FORTRAN indexing
    527527                      )
     
    538538}
    539539
    540 psMetadataItem *p_pmConceptParse_Positions(psMetadataItem *concept,
    541         psMetadataItem *pattern,
    542         psMetadata *cameraFormat,
    543         pmFPA *fpa,
    544         pmChip *chip,
    545         pmCell *cell)
     540psMetadataItem *p_pmConceptParse_Positions(const psMetadataItem *concept,
     541        const psMetadataItem *pattern,
     542        const psMetadata *cameraFormat,
     543        const pmFPA *fpa,
     544        const pmChip *chip,
     545        const pmCell *cell)
    546546{
    547547    assert(concept);
     
    572572
    573573
    574 psMetadataItem *p_pmConceptFormat_CELL_TRIMSEC(psMetadataItem *concept,
    575         psMetadata *cameraFormat,
    576         pmFPA *fpa,
    577         pmChip *chip,
    578         pmCell *cell)
     574psMetadataItem *p_pmConceptFormat_CELL_TRIMSEC(const psMetadataItem *concept,
     575        const psMetadata *cameraFormat,
     576        const pmFPA *fpa,
     577        const pmChip *chip,
     578        const pmCell *cell)
    579579{
    580580    assert(concept);
     
    588588}
    589589
    590 psMetadataItem *p_pmConceptFormat_CELL_BIASSEC(psMetadataItem *concept,
    591         psMetadata *cameraFormat,
    592         pmFPA *fpa,
    593         pmChip *chip,
    594         pmCell *cell)
     590psMetadataItem *p_pmConceptFormat_CELL_BIASSEC(const psMetadataItem *concept,
     591        const psMetadata *cameraFormat,
     592        const pmFPA *fpa,
     593        const pmChip *chip,
     594        const pmCell *cell)
    595595{
    596596    // Return a metadata item containing a list of metadata items of region strings
     
    614614// This function actually does both CELL.XBIN and CELL.YBIN if CELL.XBIN and CELL.YBIN are specified by the
    615615// same header.
    616 psMetadataItem *p_pmConceptFormat_CELL_XBIN(psMetadataItem *concept,
    617         psMetadata *cameraFormat,
    618         pmFPA *fpa,
    619         pmChip *chip,
    620         pmCell *cell)
     616psMetadataItem *p_pmConceptFormat_CELL_XBIN(const psMetadataItem *concept,
     617        const psMetadata *cameraFormat,
     618        const pmFPA *fpa,
     619        const pmChip *chip,
     620        const pmCell *cell)
    621621{
    622622    assert(concept);
     
    637637
    638638    // Otherwise, there's no formatting required
    639     return psMemIncrRefCounter(concept);
     639    return psMetadataItemCopy(concept);
    640640}
    641641
    642642// Only need to format if both if CELL.XBIN and CELL.YBIN are not specified by the same header.
    643 psMetadataItem *p_pmConceptFormat_CELL_YBIN(psMetadataItem *concept,
    644         psMetadata *cameraFormat,
    645         pmFPA *fpa,
    646         pmChip *chip,
    647         pmCell *cell)
     643psMetadataItem *p_pmConceptFormat_CELL_YBIN(const psMetadataItem *concept,
     644        const psMetadata *cameraFormat,
     645        const pmFPA *fpa,
     646        const pmChip *chip,
     647        const pmCell *cell)
    648648{
    649649    assert(concept);
     
    660660
    661661    // No formatting required
    662     return psMemIncrRefCounter(concept);
    663 }
    664 
    665 
    666 psMetadataItem *p_pmConceptFormat_TIMESYS(psMetadataItem *concept,
    667         psMetadata *cameraFormat,
    668         pmFPA *fpa,
    669         pmChip *chip,
    670         pmCell *cell)
     662    return psMetadataItemCopy(concept);
     663}
     664
     665
     666psMetadataItem *p_pmConceptFormat_TIMESYS(const psMetadataItem *concept,
     667        const psMetadata *cameraFormat,
     668        const pmFPA *fpa,
     669        const pmChip *chip,
     670        const pmCell *cell)
    671671{
    672672    psString sys = NULL;            // String to store
     
    693693}
    694694
    695 psMetadataItem *p_pmConceptFormat_TIME(psMetadataItem *concept,
    696                                        psMetadata *cameraFormat,
    697                                        pmFPA *fpa,
    698                                        pmChip *chip,
    699                                        pmCell *cell)
     695psMetadataItem *p_pmConceptFormat_TIME(const psMetadataItem *concept,
     696                                       const psMetadata *cameraFormat,
     697                                       const pmFPA *fpa,
     698                                       const pmChip *chip,
     699                                       const pmCell *cell)
    700700{
    701701    psTime *time = concept->data.V;     // The time
     
    808808}
    809809
    810 psMetadataItem *p_pmConceptFormat_Positions(psMetadataItem *concept,
    811         psMetadata *cameraFormat,
    812         pmFPA *fpa,
    813         pmChip *chip,
    814         pmCell *cell)
     810psMetadataItem *p_pmConceptFormat_Positions(const psMetadataItem *concept,
     811        const psMetadata *cameraFormat,
     812        const pmFPA *fpa,
     813        const pmChip *chip,
     814        const pmCell *cell)
    815815{
    816816    assert(concept);
  • trunk/psModules/src/concepts/pmConceptsStandard.h

    r9510 r9572  
    22#define PM_CONCEPTS_STANDARD_H
    33
    4 #include "pslib.h"
     4#include <pslib.h>
    55#include "pmFPA.h"
    66
    77// Functions to parse and format the standard concepts
    88
    9 psMetadataItem *p_pmConceptParse_FPA_Coords(psMetadataItem *concept,
    10         psMetadataItem *pattern,
    11         psMetadata *cameraFormat,
    12         pmFPA *fpa,
    13         pmChip *chip,
    14         pmCell *cell);
    15 psMetadataItem *p_pmConceptFormat_FPA_Coords(psMetadataItem *concept,
    16         psMetadata *cameraFormat,
    17         pmFPA *fpa,
    18         pmChip *chip,
    19         pmCell *cell);
    20 psMetadataItem *p_pmConceptParse_CELL_TRIMSEC(psMetadataItem *concept,
    21         psMetadataItem *pattern,
    22         psMetadata *cameraFormat,
    23         pmFPA *fpa,
    24         pmChip *chip,
    25         pmCell *cell);
    26 psMetadataItem *p_pmConceptParse_CELL_BIASSEC(psMetadataItem *concept,
    27         psMetadataItem *pattern,
    28         psMetadata *cameraFormat,
    29         pmFPA *fpa,
    30         pmChip *chip,
    31         pmCell *cell);
    32 psMetadataItem *p_pmConceptParse_CELL_Binning(psMetadataItem *concept,
    33         psMetadataItem *pattern,
    34         psMetadata *cameraFormat,
    35         pmFPA *fpa,
    36         pmChip *chip,
    37         pmCell *cell);
    38 psMetadataItem *p_pmConceptParse_TIMESYS(psMetadataItem *concept,
    39         psMetadataItem *pattern,
    40         psMetadata *cameraFormat,
    41         pmFPA *fpa,
    42         pmChip *chip,
    43         pmCell *cell);
    44 psMetadataItem *p_pmConceptParse_TIME(psMetadataItem *concept,
    45                                       psMetadataItem *pattern,
    46                                       psMetadata *cameraFormat,
    47                                       pmFPA *fpa,
    48                                       pmChip *chip,
    49                                       pmCell *cell);
    50 psMetadataItem *p_pmConceptParse_Positions(psMetadataItem *concept,
    51         psMetadataItem *pattern,
    52         psMetadata *cameraFormat,
    53         pmFPA *fpa,
    54         pmChip *chip,
    55         pmCell *cell);
    56 psMetadataItem *p_pmConceptFormat_CELL_TRIMSEC(psMetadataItem *concept,
    57         psMetadata *cameraFormat,
    58         pmFPA *fpa,
    59         pmChip *chip,
    60         pmCell *cell);
    61 psMetadataItem *p_pmConceptFormat_CELL_BIASSEC(psMetadataItem *concept,
    62         psMetadata *cameraFormat,
    63         pmFPA *fpa,
    64         pmChip *chip,
    65         pmCell *cell);
    66 psMetadataItem *p_pmConceptFormat_CELL_XBIN(psMetadataItem *concept,
    67         psMetadata *cameraFormat,
    68         pmFPA *fpa,
    69         pmChip *chip,
    70         pmCell *cell);
    71 psMetadataItem *p_pmConceptFormat_CELL_YBIN(psMetadataItem *concept,
    72         psMetadata *cameraFormat,
    73         pmFPA *fpa,
    74         pmChip *chip,
    75         pmCell *cell);
    76 psMetadataItem *p_pmConceptFormat_TIMESYS(psMetadataItem *concept,
    77         psMetadata *cameraFormat,
    78         pmFPA *fpa,
    79         pmChip *chip,
    80         pmCell *cell);
    81 psMetadataItem *p_pmConceptFormat_TIME(psMetadataItem *concept,
    82                                        psMetadata *cameraFormat,
    83                                        pmFPA *fpa,
    84                                        pmChip *chip,
    85                                        pmCell *cell);
    86 psMetadataItem *p_pmConceptFormat_Positions(psMetadataItem *concept,
    87         psMetadata *cameraFormat,
    88         pmFPA *fpa,
    89         pmChip *chip,
    90         pmCell *cell);
     9
     10/// Parse the coordinates concepts: FPA.RA and FPA.DEC
     11psMetadataItem *p_pmConceptParse_FPA_Coords(const psMetadataItem *concept, ///< Concept to parse
     12        const psMetadataItem *pattern, ///< Pattern to use in parsing
     13        const psMetadata *cameraFormat, ///< Camera format definition
     14        const pmFPA *fpa, ///< FPA for concept, or NULL
     15        const pmChip *chip, ///< Chip for concept, or NULL
     16        const pmCell *cell ///< Cell for concept, or NULL
     17                                           );
     18
     19/// Format the coordinates concepts: FPA.RA and FPA.DEC
     20psMetadataItem *p_pmConceptFormat_FPA_Coords(const psMetadataItem *concept, ///< Concept to format
     21        const psMetadata *cameraFormat, ///< Camera format definition
     22        const pmFPA *fpa, ///< FPA for concept, or NULL
     23        const pmChip *chip, ///< Chip for concept, or NULL
     24        const pmCell *cell ///< Cell for concept, or NULL
     25                                            );
     26
     27/// Parse the CELL.TRIMSEC concept
     28psMetadataItem *p_pmConceptParse_CELL_TRIMSEC(const psMetadataItem *concept, ///< Concept to parse
     29        const psMetadataItem *pattern, ///< Pattern to use in parsing
     30        const psMetadata *cameraFormat, ///< Camera format definition
     31        const pmFPA *fpa, ///< FPA for concept, or NULL
     32        const pmChip *chip, ///< Chip for concept, or NULL
     33        const pmCell *cell ///< Cell for concept, or NULL
     34                                             );
     35
     36/// Parse the CELL.BIASSEC concept
     37psMetadataItem *p_pmConceptParse_CELL_BIASSEC(const psMetadataItem *concept, ///< Concept to parse
     38        const psMetadataItem *pattern, ///< Pattern to use in parsing
     39        const psMetadata *cameraFormat, ///< Camera format definition
     40        const pmFPA *fpa, ///< FPA for concept, or NULL
     41        const pmChip *chip, ///< Chip for concept, or NULL
     42        const pmCell *cell ///< Cell for concept, or NULL
     43                                             );
     44
     45/// Parse the cell binning concepts: CELL.XBIN, CELL.YBIN
     46psMetadataItem *p_pmConceptParse_CELL_Binning(const psMetadataItem *concept, ///< Concept to parse
     47        const psMetadataItem *pattern, ///< Pattern to use in parsing
     48        const psMetadata *cameraFormat, ///< Camera format definition
     49        const pmFPA *fpa, ///< FPA for concept, or NULL
     50        const pmChip *chip, ///< Chip for concept, or NULL
     51        const pmCell *cell ///< Cell for concept, or NULL
     52                                             );
     53
     54/// Parse the time system concepts: FPA.TIMESYS and CELL.TIMESYS
     55psMetadataItem *p_pmConceptParse_TIMESYS(const psMetadataItem *concept, ///< Concept to parse
     56        const psMetadataItem *pattern, ///< Pattern to use in parsing
     57        const psMetadata *cameraFormat, ///< Camera format definition
     58        const pmFPA *fpa, ///< FPA for concept, or NULL
     59        const pmChip *chip, ///< Chip for concept, or NULL
     60        const pmCell *cell ///< Cell for concept, or NULL
     61                                        );
     62
     63/// Parse the time concepts: FPA.TIME and CELL.TIME
     64psMetadataItem *p_pmConceptParse_TIME(const psMetadataItem *concept, ///< Concept to parse
     65                                      const psMetadataItem *pattern, ///< Pattern to use in parsing
     66                                      const psMetadata *cameraFormat, ///< Camera format definition
     67                                      const pmFPA *fpa, ///< FPA for concept, or NULL
     68                                      const pmChip *chip, ///< Chip for concept, or NULL
     69                                      const pmCell *cell ///< Cell for concept, or NULL
     70                                     );
     71
     72/// Parse a cell position concept, e.g., CELL.X0
     73psMetadataItem *p_pmConceptParse_Positions(const psMetadataItem *concept, ///< Concept to parse
     74        const psMetadataItem *pattern, ///< Pattern to use in parsing
     75        const psMetadata *cameraFormat, ///< Camera format definition
     76        const pmFPA *fpa, ///< FPA for concept, or NULL
     77        const pmChip *chip, ///< Chip for concept, or NULL
     78        const pmCell *cell ///< Cell for concept, or NULL
     79                                          );
     80
     81/// Format the CELL.TRIMSEC concept
     82psMetadataItem *p_pmConceptFormat_CELL_TRIMSEC(const psMetadataItem *concept, ///< Concept to format
     83        const psMetadata *cameraFormat, ///< Camera format definition
     84        const pmFPA *fpa, ///< FPA for concept, or NULL
     85        const pmChip *chip, ///< Chip for concept, or NULL
     86        const pmCell *cell ///< Cell for concept, or NULL
     87                                              );
     88
     89/// Format the CELL.BIASSEC concept
     90psMetadataItem *p_pmConceptFormat_CELL_BIASSEC(const psMetadataItem *concept, ///< Concept to format
     91        const psMetadata *cameraFormat, ///< Camera format definition
     92        const pmFPA *fpa, ///< FPA for concept, or NULL
     93        const pmChip *chip, ///< Chip for concept, or NULL
     94        const pmCell *cell ///< Cell for concept, or NULL
     95                                              );
     96
     97/// Format the CELL.XBIN concept
     98psMetadataItem *p_pmConceptFormat_CELL_XBIN(const psMetadataItem *concept, ///< Concept to format
     99        const psMetadata *cameraFormat, ///< Camera format definition
     100        const pmFPA *fpa, ///< FPA for concept, or NULL
     101        const pmChip *chip, ///< Chip for concept, or NULL
     102        const pmCell *cell ///< Cell for concept, or NULL
     103                                           );
     104
     105/// Format the CELL.YBIN concept
     106psMetadataItem *p_pmConceptFormat_CELL_YBIN(const psMetadataItem *concept, ///< Concept to format
     107        const psMetadata *cameraFormat, ///< Camera format definition
     108        const pmFPA *fpa, ///< FPA for concept, or NULL
     109        const pmChip *chip, ///< Chip for concept, or NULL
     110        const pmCell *cell ///< Cell for concept, or NULL
     111                                           );
     112
     113/// Format the time system concepts: FPA.TIMESYS and CELL.TIMESYS
     114psMetadataItem *p_pmConceptFormat_TIMESYS(const psMetadataItem *concept, ///< Concept to format
     115        const psMetadata *cameraFormat, ///< Camera format definition
     116        const pmFPA *fpa, ///< FPA for concept, or NULL
     117        const pmChip *chip, ///< Chip for concept, or NULL
     118        const pmCell *cell ///< Cell for concept, or NULL
     119                                         );
     120
     121/// Format the time concepts: FPA.TIME and CELL.TIME
     122psMetadataItem *p_pmConceptFormat_TIME(const psMetadataItem *concept, ///< Concept to format
     123                                       const psMetadata *cameraFormat, ///< Camera format definition
     124                                       const pmFPA *fpa, ///< FPA for concept, or NULL
     125                                       const pmChip *chip, ///< Chip for concept, or NULL
     126                                       const pmCell *cell ///< Cell for concept, or NULL
     127                                      );
     128
     129/// Format a cell position concept, e.g., CELL.X0
     130psMetadataItem *p_pmConceptFormat_Positions(const psMetadataItem *concept, ///< Concept to format
     131        const psMetadata *cameraFormat, ///< Camera format definition
     132        const pmFPA *fpa, ///< FPA for concept, or NULL
     133        const pmChip *chip, ///< Chip for concept, or NULL
     134        const pmCell *cell ///< Cell for concept, or NULL
     135                                           );
    91136
    92137#endif
  • trunk/psModules/src/concepts/pmConceptsWrite.c

    r9570 r9572  
    1818//////////////////////////////////////////////////////////////////////////////////////////////////////////////
    1919
    20 static bool compareConcepts(psMetadataItem *compare, // Item to compare
    21                             psMetadataItem *standard // Standard for comparison
     20static bool compareConcepts(const psMetadataItem *compare, // Item to compare
     21                            const psMetadataItem *standard // Standard for comparison
    2222                           )
    2323{
     
    105105
    106106// Format a single concept
    107 static psMetadataItem *conceptFormat(pmConceptSpec *spec, // The concept specification
    108                                      psMetadataItem *concept, // The concept to parse
    109                                      psMetadata *cameraFormat, // The camera format
    110                                      pmFPA *fpa, // The FPA
    111                                      pmChip *chip, // The chip
    112                                      pmCell *cell // The cell
     107static psMetadataItem *conceptFormat(const pmConceptSpec *spec, // The concept specification
     108                                     const psMetadataItem *concept, // The concept to parse
     109                                     const psMetadata *cameraFormat, // The camera format
     110                                     const pmFPA *fpa, // The FPA
     111                                     const pmChip *chip, // The chip
     112                                     const pmCell *cell // The cell
    113113                                    )
    114114{
     
    121121            formatted = spec->format(concept, cameraFormat, fpa, chip, cell);
    122122        } else {
    123             formatted = psMemIncrRefCounter(concept);
     123            formatted = psMemIncrRefCounter((const psPtr)concept);
    124124        }
    125125
     
    132132static bool writeSingleHeader(pmHDU *hdu, // HDU for which to add to the header
    133133                              const char *keyword, // Keyword to add
    134                               psMetadataItem *item // Item to add to the header; may be NULL
     134                              const psMetadataItem *item // Item to add to the header; may be NULL
    135135                             )
    136136{
     
    182182static bool writeHeader(pmHDU *hdu,     // HDU for which to add to the header
    183183                        const char *keywords, // Keywords to add
    184                         psMetadataItem *item // Item to add to the header
     184                        const psMetadataItem *item // Item to add to the header
    185185                       )
    186186{
     
    220220//////////////////////////////////////////////////////////////////////////////////////////////////////////////
    221221
    222 bool p_pmConceptsWriteToCells(psMetadata *specs, // The concept specifications
    223                               pmCell *cell,   // The cell
    224                               psMetadata *concepts // The concepts
    225                              )
     222bool p_pmConceptsWriteToCells(const psMetadata *specs, const pmCell *cell, const psMetadata *concepts)
    226223{
    227224    PS_ASSERT_PTR_NON_NULL(specs, false);
     
    230227        return false;
    231228    }
    232     if (!cell->config)
    233         return false;
     229    if (!cell->config) {
     230        return false;
     231    }
    234232
    235233    pmHDU *hdu = pmHDUGetLowest(NULL, NULL, cell); // The HDU at the lowest level
     
    291289}
    292290
    293 bool p_pmConceptsWriteToDefaults(psMetadata *specs, // The concept specifications
    294                                  pmFPA *fpa, // The FPA
    295                                  pmChip *chip, // The chip
    296                                  pmCell *cell, // The cell
    297                                  psMetadata *concepts // The concepts
    298                                 )
     291bool p_pmConceptsWriteToDefaults(const psMetadata *specs, const pmFPA *fpa, const pmChip *chip,
     292                                 const pmCell *cell, psMetadata *concepts)
    299293{
    300294    PS_ASSERT_PTR_NON_NULL(specs, false);
     
    357351
    358352
    359 bool p_pmConceptsWriteToHeader(psMetadata *specs, // The concept specifications
    360                                pmFPA *fpa, // The FPA
    361                                pmChip *chip, // The chip
    362                                pmCell *cell, // The cell
    363                                psMetadata *concepts // The concepts
    364                               )
     353bool p_pmConceptsWriteToHeader(const psMetadata *specs, const pmFPA *fpa, const pmChip *chip,
     354                               const pmCell *cell, const psMetadata *concepts)
    365355{
    366356    PS_ASSERT_PTR_NON_NULL(specs, false);
     
    405395
    406396// XXX Warning: This code has not been tested at all
    407 bool p_pmConceptsWriteToDatabase(psMetadata *specs, // The concept specifications
    408                                  pmFPA *fpa, // The FPA
    409                                  pmChip *chip, // The chip
    410                                  pmCell *cell, // The cell
    411                                  psDB *db,// The database handle
    412                                  psMetadata *concepts // The concepts
    413                                 )
     397bool p_pmConceptsWriteToDatabase(const psMetadata *specs, const pmFPA *fpa, const pmChip *chip,
     398                                 const pmCell *cell, psDB *db, const psMetadata *concepts)
    414399{
    415400    PS_ASSERT_PTR_NON_NULL(specs, false);
  • trunk/psModules/src/concepts/pmConceptsWrite.h

    r9570 r9572  
    55#include "pmFPA.h"
    66
    7 bool p_pmConceptsWriteToCells(psMetadata *specs, // The concept specifications
    8                               pmCell *cell,   // The cell
    9                               psMetadata *concepts // The concepts
     7/// "Write" concepts to (actually, check against) the camera format file's CELLS.
     8///
     9/// Examines the CELLS metadata in the camera format file for the current type of cell, and checks that the
     10/// concepts as defined there match the ones defined in the cell.  A warning is produced if the concepts do
     11/// not match.
     12bool p_pmConceptsWriteToCells(const psMetadata *specs, ///< The concept specifications
     13                              const pmCell *cell, ///< The cell
     14                              const psMetadata *concepts ///< The concepts
    1015                             );
    11 bool p_pmConceptsWriteToDefaults(psMetadata *specs, // The concept specifications
    12                                  pmFPA *fpa, // The FPA
    13                                  pmChip *chip, // The chip
    14                                  pmCell *cell, // The cell
    15                                  psMetadata *concepts // The concepts
     16
     17/// "Write" concepts to (actually, check against) the camera format file's DEFAULTS.
     18///
     19/// Examines the DEFAULTS metadata in the camera format file, and checks that the concepts as defined there
     20/// match the ones defined in the cell.  A warning is produced if the concepts do not match.
     21bool p_pmConceptsWriteToDefaults(const psMetadata *specs, ///< The concept specifications
     22                                 const pmFPA *fpa, ///< The FPA
     23                                 const pmChip *chip, ///< The chip
     24                                 const pmCell *cell, ///< The cell
     25                                 const psMetadata *concepts ///< The concepts
    1626                                );
    17 bool p_pmConceptsWriteToHeader(psMetadata *specs, // The concept specifications
    18                                pmFPA *fpa, // The FPA
    19                                pmChip *chip, // The chip
    20                                pmCell *cell, // The cell
    21                                psMetadata *concepts // The concepts
     27
     28/// "Write" concepts to (actually, add to, pending a later write) the FITS header.
     29///
     30/// Examines the FITS header TRANSLATION metadata in the camera format file, and writes concepts to the
     31/// appropriate FITS headers in the HDU, in preparation for a future write of the HDU.
     32bool p_pmConceptsWriteToHeader(const psMetadata *specs, ///< The concept specifications
     33                               const pmFPA *fpa, ///< The FPA
     34                               const pmChip *chip, ///< The chip
     35                               const pmCell *cell, ///< The cell
     36                               const psMetadata *concepts ///< The concepts
    2237                              );
    23 bool p_pmConceptsWriteToDatabase(psMetadata *specs, // The concept specifications
    24                                  pmFPA *fpa, // The FPA
    25                                  pmChip *chip, // The chip
    26                                  pmCell *cell, // The cell
    27                                  psDB *db,// The database handle
    28                                  psMetadata *concepts // The concepts
     38
     39/// Write concepts to the database.
     40///
     41/// Examines the DATABASE metadata in the camera format file, and writes concepts to the database.
     42/// Warning: This function has not been tested; use at your own risk.
     43bool p_pmConceptsWriteToDatabase(const psMetadata *specs, ///< The concept specifications
     44                                 const pmFPA *fpa, ///< The FPA
     45                                 const pmChip *chip, ///< The chip
     46                                 const pmCell *cell, ///< The cell
     47                                 psDB *db,///< The database handle
     48                                 const psMetadata *concepts ///< The concepts
    2949                                );
    3050
Note: See TracChangeset for help on using the changeset viewer.