Changeset 9572 for trunk/psModules/src/concepts/pmConcepts.h
- Timestamp:
- Oct 13, 2006, 4:35:39 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/concepts/pmConcepts.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/concepts/pmConcepts.h
r9570 r9572 2 2 #define PM_CONCEPTS_H 3 3 4 #include "pslib.h"4 #include <pslib.h> 5 5 #include "pmFPA.h" 6 6 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 8 typedef 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 ); 11 15 12 // A "concept" specification 16 /// Function to call to format a concept for writing 17 typedef 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. 13 29 typedef struct 14 30 { 15 psMetadataItem *blank; // Blank value of concept; also contains the name16 pmConceptParseFunc parse; // Function to call to read the concept17 pmConceptFormatFunc format; // Function to call to write the concept31 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 18 34 } 19 35 pmConceptSpec; 20 36 21 // Allocator22 pmConceptSpec *pmConceptSpecAlloc(psMetadataItem *blank, // Blank value; contains the name23 pmConceptParseFunc parse, // Function to call to parse the concept24 pmConceptFormatFunc format // Function to call to format the concept37 /// Allocator for pmConceptSpec 38 pmConceptSpec *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 25 41 ); 26 42 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). 47 bool 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 32 51 ); 33 52 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. 35 58 typedef enum { 36 PM_CONCEPT_SOURCE_NONE = 0x00, // No concepts37 PM_CONCEPT_SOURCE_CELLS = 0x01, // Concept comes from the camera information38 PM_CONCEPT_SOURCE_DEFAULTS = 0x02, // Concept comes from defaults39 PM_CONCEPT_SOURCE_PHU = 0x04, // Concept comes from PHU40 PM_CONCEPT_SOURCE_HEADER = 0x08, // Concept comes from FITS header41 PM_CONCEPT_SOURCE_DATABASE = 0x10, // Concept comes from database42 PM_CONCEPT_SOURCE_ALL = 0xff // All concepts59 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 43 66 } pmConceptSource; 44 67 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. 73 bool 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 51 78 ); 52 79 53 // Set blanks, read or write concepts at the appropriate level54 bool pmConceptsBlankFPA(pmFPA *fpa // FPA for which to set blank concepts80 /// Set the concepts within the FPA to the blank value 81 bool pmConceptsBlankFPA(pmFPA *fpa ///< FPA for which to set blank concepts 55 82 ); 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. 89 bool 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 60 93 ); 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. 99 bool 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 65 103 ); 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 106 bool pmConceptsBlankChip(pmChip *chip ///< FPA for which to set blank concepts 91 107 ); 92 108 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. 114 bool 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. 125 bool 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 133 bool 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). 141 bool 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). 152 bool 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. 94 162 bool 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. 96 167 void pmConceptsDone(void); 97 168 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. 172 bool pmFPACopyConcepts(pmFPA *target, ///< The target FPA 173 const pmFPA *source ///< The source FPA 101 174 ); 102 175
Note:
See TracChangeset
for help on using the changeset viewer.
