IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.