Changeset 1496
- Timestamp:
- Aug 11, 2004, 3:23:20 PM (22 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 8 edited
-
astro/psCoord.h (modified) (6 diffs)
-
astro/psTime.h (modified) (4 diffs)
-
astronomy/psAstrometry.h (modified) (6 diffs)
-
astronomy/psCoord.h (modified) (6 diffs)
-
astronomy/psMetadata.h (modified) (7 diffs)
-
astronomy/psTime.h (modified) (4 diffs)
-
collections/psMetadata.h (modified) (7 diffs)
-
types/psMetadata.h (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/psCoord.h
r1441 r1496 11 11 * @author George Gusciora, MHPCC 12 12 * 13 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-08- 09 23:40:54$13 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-08-12 01:23:20 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 117 117 /** Projection type for projection/deprojection 118 118 * 119 * @see alsopsProject, psDeproject119 * @see psProject, psDeproject 120 120 * 121 121 */ … … 133 133 /** Parameter set for projection/deprojection 134 134 * 135 * @see alsopsProject, psDeproject135 * @see psProject, psDeproject 136 136 * 137 137 */ … … 148 148 /** Mode for Offset calculation between two sky positions 149 149 * 150 * @see alsopsSphereGetOffset, psSphereSetOffset150 * @see psSphereGetOffset, psSphereSetOffset 151 151 * 152 152 */ … … 158 158 /** The units of the offset 159 159 * 160 * @see alsopsSphereGetOffset, psSphereSetOffset160 * @see psSphereGetOffset, psSphereSetOffset 161 161 * 162 162 */ … … 170 170 /** Applies the psPlaneTransform transform to a specified coordinate 171 171 * 172 */ 173 psPlane* psPlaneTransformApply(psPlane* out, ///< a psPlane to recycle. If NULL, a new one is generated. 174 const psPlaneTransform* transform, ///< the transform to apply 175 const psPlane* coords ///< the coordinate to apply the transform above. 176 ); 172 * @return psPlane* resulting coordinate based on transform 173 */ 174 psPlane* psPlaneTransformApply( 175 psPlane* out, ///< a psPlane to recycle. If NULL, a new one is generated. 176 const psPlaneTransform* transform, ///< the transform to apply 177 const psPlane* coords ///< the coordinate to apply the transform above. 178 ); 177 179 178 180 /** Applies the psPlaneDistort transform to a specified coordinate 179 181 * 180 */ 181 psPlane* psPlaneDistortApply(psPlane* out, ///< a psPlane to recycle. If NULL, a new one is generated. 182 const psPlaneDistort* transform, ///< the transform to apply 183 const psPlane* coords, ///< the coordinate to apply the transform above. 184 float term3, ///< third term -- maybe magnitude 185 float term4 ///< forth term -- maybe color 186 ); 182 * @return psPlane* resulting coordinate based on transform 183 */ 184 psPlane* psPlaneDistortApply( 185 psPlane* out, ///< a psPlane to recycle. If NULL, a new one is generated. 186 const psPlaneDistort* transform, ///< the transform to apply 187 const psPlane* coords, ///< the coordinate to apply the transform above. 188 float term3, ///< third term -- maybe magnitude 189 float term4 ///< forth term -- maybe color 190 ); 187 191 188 192 /** Allocator for psSphereTransform 189 193 * 190 */ 191 psSphereTransform* psSphereTransformAlloc(double NPlat, ///< north pole latitude 192 double Xo, ///< First PT of Ares lon 193 double xo ///< First PT of Ares equiv lon 194 ); 194 * @return psSphereTransform* newly allocated struct 195 */ 196 psSphereTransform* psSphereTransformAlloc( 197 double NPlat, ///< north pole latitude 198 double Xo, ///< First PT of Ares lon 199 double xo ///< First PT of Ares equiv lon 200 ); 195 201 196 202 /** Applies the psSphereTransform transform for a specified coordinate 197 203 * 198 */ 199 psSphere* psSphereTransformApply(psSphere* out, ///< a psSphere to recycle. If NULL, a new one is 200 // generated. 201 const psSphereTransform* transform, ///< the transform to apply 202 const psSphere* coord ///< the coordinate to apply the transform above.x 203 ); 204 205 psSphereTransform* psSphereTransformICRStoEcliptic(psTime time); 206 207 psSphereTransform* psSphereTransformEcliptictoICRS(psTime time); 208 204 * @return psSphere* resulting coordinate based on transform 205 */ 206 psSphere* psSphereTransformApply( 207 psSphere* out, ///< a psSphere to recycle. If NULL, a new one is generated. 208 const psSphereTransform* transform,///< the transform to apply 209 const psSphere* coord ///< the coordinate to apply the transform above.x 210 ); 211 212 /** Creates the appropriate transform for converting from ICRS to Ecliptic 213 * coordinate systems. 214 * 215 * @return psSphereTransform* transform for ICRS->Ecliptic coordinate systems 216 */ 217 psSphereTransform* psSphereTransformICRStoEcliptic( 218 psTime time ///< the time for which the resulting transform will be valid 219 ); 220 221 /** Creates the appropriate transform for converting from Ecliptic to ICRS 222 * coordinate systems. 223 * 224 * @return psSphereTransform* transform for Ecliptic->ICRS coordinate systems 225 */ 226 psSphereTransform* psSphereTransformEcliptictoICRS( 227 psTime time ///< the time for which the resulting transform will be valid 228 ); 229 230 /** Creates the appropriate transform for converting from ICRS to Galatic 231 * coordinate systems. 232 * 233 */ 209 234 psSphereTransform* psSphereTransformICRStoGalatic(void); 210 235 236 /** Creates the appropriate transform for converting from Galatic to ICRS 237 * coordinate systems. 238 * 239 */ 211 240 psSphereTransform* psSphereTransformGalatictoICRS(void); 212 241 213 psPlane* psProject(const psSphere* coord, const psProjection* projection); 214 215 psSphere* psDeproject(const psPlane* coord, const psProjection* projection); 216 217 psSphere* psSphereGetOffset(const psSphere* restrict position1, 218 const psSphere* restrict position2, 219 psSphereOffsetMode mode, psSphereOffsetUnit unit); 220 221 psSphere* psSphereSetOffset(const psSphere* restrict position, 222 const psSphere* restrict offset, 223 psSphereOffsetMode mode, psSphereOffsetUnit unit); 242 /** Projects a spherical coordinate to a linear coordinate system 243 * 244 * @return psPlane* projected coordinate 245 */ 246 psPlane* psProject( 247 const psSphere* coord, ///< coordinate to project 248 const psProjection* projection ///< parameters of the projection 249 ); 250 251 /** Reverse projection of a linear coordinate to a spherical coordinate system 252 * 253 * @return psPlane* projected coordinate 254 */ 255 psSphere* psDeproject( 256 const psPlane* coord, ///< coordinate to project 257 const psProjection* projection ///< parameters of the projection 258 ); 259 260 /** Determines the offset (RA,Dec) on the sky between two positions. 261 * 262 * Both an offset mode and an offset unit may be defined. The mode may be 263 * either PS_SPHERICAL, in which case the specified offset corresponds to an 264 * offset in angles, or it may be PS_LINEAR, in which case the offset 265 * corresponds to a linear offset in a local projection. The offset unit may 266 * be in one of PS_ARCSEC, PS_ARCMIN, PS_DEGREE, and PS_RADIAN, which 267 * specifies the units of the offset only. 268 * 269 * @return psSphere* the offset between position1 and position2 270 */ 271 psSphere* psSphereGetOffset( 272 const psSphere* restrict position1, 273 const psSphere* restrict position2, 274 psSphereOffsetMode mode, 275 psSphereOffsetUnit unit 276 ); 277 278 /** Applies the given offset to a coordinate. 279 * 280 * Both an offset mode and an offset unit may be defined. The mode may be 281 * either PS_SPHERICAL, in which case the specified offset corresponds to an 282 * offset in angles, or it may be PS_LINEAR, in which case the offset 283 * corresponds to a linear offset in a local projection. The offset unit may 284 * be in one of PS_ARCSEC, PS_ARCMIN, PS_DEGREE, and PS_RADIAN, which 285 * specifies the units of the offset only. 286 * 287 * @return psSphere* the given position with the given offset applied. 288 */ 289 psSphere* psSphereSetOffset( 290 const psSphere* restrict position, 291 const psSphere* restrict offset, 292 psSphereOffsetMode mode, 293 psSphereOffsetUnit unit 294 ); 224 295 225 296 /// @} -
trunk/psLib/src/astro/psTime.h
r1441 r1496 13 13 * @author Ross Harman, MHPCC 14 14 * 15 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $16 * @date $Date: 2004-08- 09 23:40:54$15 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2004-08-12 01:23:20 $ 17 17 * 18 18 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 39 39 /** Definition of psTime. 40 40 * 41 * The psTime struct is used by psLib to represent time values critical to astronomical calculations. This 42 * structure represents a time which is equivalent to TAI (International Atomic Time) and is measured in 43 * both seconds and microseconds. 41 * The psTime struct is used by psLib to represent time values critical to 42 * astronomical calculations. This structure represents a time which is 43 * equivalent to TAI (International Atomic Time) and is measured in both 44 * seconds and microseconds. 44 45 */ 45 46 typedef struct 46 47 { 47 48 time_t tv_sec; /**< Seconds since epoch, Jan 1, 1970. */ 49 50 suseconds_t tv_usec; /**< Microseconds since last second. */ 48 time_t tv_sec; ///< Seconds since epoch, Jan 1, 1970. 49 suseconds_t tv_usec; ///< Microseconds since last second. 51 50 } 52 51 psTime; … … 65 64 */ 66 65 67 psTime psTimeGetTime(void 68 /** No argument. */ 69 ); 66 psTime psTimeGetTime(void); 70 67 71 68 /** Convert psTime to ISO time in TAI units. 72 69 * 73 * Converts psTime to a null terminated string in the form of: YYYY/MM/DD,HH:MM:SS.SSS. This function assumes 74 * the input time already is in TAI time and does not add or subtract leapseconds. 70 * Converts psTime to a null terminated string in the form of: 71 * YYYY/MM/DD,HH:MM:SS.SSS. This function assumes the input time already is 72 * in TAI time and does not add or subtract leapseconds. 75 73 * 76 74 * @return char*: Pointer null terminated array of chars in ISO time. 77 75 */ 78 76 79 char *psTimeToISO( psTime time80 /** Input time to be converted. */81 );77 char *psTimeToISO( 78 psTime time ///< Input time to be converted. 79 ); 82 80 83 81 /** Convert psTime to UTC time. 84 82 * 85 * Converts psTime to UTC time in double precision floating point notation. The input to this must already be 86 * int TAI time. The result from this function is not in TAI units, but that of UTC, which does not contain 87 * leapseconds. 83 * Converts psTime to UTC time in double precision floating point notation. 84 * The input to this must already be int TAI time. The result from this 85 * function is not in TAI units, but that of UTC, which does not contain 86 * leapseconds. 88 87 * 89 88 * @return psTime: UTC time psTime format. 90 89 */ 91 90 92 psTime psTimeToUTC( psTime time93 /** Input time to be converted. */94 );91 psTime psTimeToUTC( 92 psTime time ///< Input time to be converted. 93 ); 95 94 96 95 /** Convert psTime to modified Julian date time. 97 96 * 98 * Converts psTime to modified Julian date (MJD) time. This function assumes the input time already is in TAI 99 * time and does not add or subtract leapseconds. 97 * Converts psTime to modified Julian date (MJD) time. This function assumes 98 * the input time already is in TAI time and does not add or subtract 99 * leapseconds. 100 100 * 101 101 * @return double: Modified Julian Days (MJD) time. 102 102 */ 103 104 double psTimeToMJD(psTime time 105 /** Input time to be converted. */ 106 ); 103 double psTimeToMJD( 104 psTime time ///< Input time to be converted. 105 ); 107 106 108 107 /** Convert psTime to Julian date time. 109 108 * 110 * Converts psTime to Julian date (JD) time. This function assumes the input time already is in TAI time and111 * does not add or subtract leapseconds.109 * Converts psTime to Julian date (JD) time. This function assumes the input 110 * time already is in TAI time and does not add or subtract leapseconds. 112 111 * 113 112 * @return double: Julian Date (JD) time. 114 113 */ 115 116 double psTimeToJD(psTime time 117 /** Input time to be converted. */ 118 ); 114 double psTimeToJD( 115 psTime time ///< Input time to be converted. 116 ); 119 117 120 118 /** Convert psTime to timeval time. 121 119 * 122 * Converts psTime to timeval time. This function assumes the input time already is in TAI time and does not123 * add or subtract leapseconds.120 * Converts psTime to timeval time. This function assumes the input time 121 * already is in TAI time and does not add or subtract leapseconds. 124 122 * 125 123 * @return timeval: timeval struct time. 126 124 */ 127 128 struct timeval psTimeToTimeval(psTime time 129 /** Input time to be converted. */ 130 ); 125 struct timeval psTimeToTimeval( 126 psTime time ///< Input time to be converted. 127 ); 131 128 132 129 /** Convert psTime to tm time. … … 137 134 * @return tm: tm struct time. 138 135 */ 139 140 struct tm *psTimeToTM(psTime time 141 /** Input time to be converted. */ 142 ); 136 struct tm *psTimeToTM( 137 psTime time ///< Input time to be converted. 138 ); 143 139 144 140 /** Convert ISO to psTime. 145 141 * 146 * Converts ISO time to psTime. This function assumes the input time already is in TAI time and does not add147 * or subtract leapseconds.142 * Converts ISO time to psTime. This function assumes the input time already 143 * is in TAI time and does not add or subtract leapseconds. 148 144 * 149 145 * @return psTime: time 150 146 */ 151 152 psTime psISOToTime(char *time 153 /** Input time to be converted. */ 154 ); 147 psTime psISOToTime( 148 char *time ///< Input time to be converted. 149 ); 155 150 156 151 /** Convert UTC to psTime. 157 152 * 158 * Converts UTC time to psTime. This function assumes the input time already is in TAI time and add or159 * subtracts the necessary leapseconds.153 * Converts UTC time to psTime. This function assumes the input time already 154 * is in TAI time and add or subtracts the necessary leapseconds. 160 155 * 161 156 * @return psTime: time in TAI units. 162 157 */ 163 164 psTime psUTCToTime(psTime time 165 /** Input time to be converted. */ 166 ); 158 psTime psUTCToTime( 159 psTime time ///< Input time to be converted. 160 ); 167 161 168 162 /** Convert MJD to psTime. 169 163 * 170 * Converts MJD time to psTime. This function assumes the input time already is in TAI time and does not add 171 * or subtract leapseconds. 172 * 173 * @return psTime: time. 174 */ 175 176 psTime psMJDToTime(double time 177 /** Input time to be converted. */ 178 ); 164 * Converts MJD time to psTime. This function assumes the input time already 165 * is in TAI time and does not add or subtract leapseconds. 166 * 167 * @return psTime: time. 168 */ 169 psTime psMJDToTime( 170 double time ///< Input time to be converted. 171 ); 179 172 180 173 /** Convert JD to psTime. 181 174 * 182 * Converts JD time to psTime. This function assumes the input time already is in TAI time and does not add 183 * or subtract leapseconds. 184 * 185 * @return psTime: time. 186 */ 187 188 psTime psJDToTime(double time 189 /** Input time to be converted. */ 190 ); 175 * Converts JD time to psTime. This function assumes the input time already 176 * is in TAI time and does not add or subtract leapseconds. 177 * 178 * @return psTime: time. 179 */ 180 psTime psJDToTime( 181 double time ///< Input time to be converted. 182 ); 191 183 192 184 /** Convert timeval to psTime. 193 185 * 194 * Converts timeval time to psTime. This function assumes the input time already is in TAI time and does not 195 * add or subtract leapseconds. 196 * 197 * @return psTime: time. 198 */ 199 200 psTime psTimevalToTime(struct timeval *time 201 /** Input time to be converted. */ 202 ); 186 * Converts timeval time to psTime. This function assumes the input time 187 * already is in TAI time and does not add or subtract leapseconds. 188 * 189 * @return psTime: time. 190 */ 191 psTime psTimevalToTime( 192 struct timeval *time ///< Input time to be converted. 193 ); 203 194 204 195 /** Convert tm time to psTime. 205 196 * 206 * Converts tm time to psTime. This function assumes the input time already is in TAI time and does not add 207 * or subtract leapseconds. 208 * 209 * @return psTime: time. 210 */ 211 212 psTime psTMToTime(struct tm *time 213 /** Input time to be converted. */ 214 ); 197 * Converts tm time to psTime. This function assumes the input time already 198 * is in TAI time and does not add or subtract leapseconds. 199 * 200 * @return psTime: time. 201 */ 202 psTime psTMToTime( 203 struct tm *time ///< Input time to be converted. 204 ); 215 205 216 206 /// @} -
trunk/psLib/src/astronomy/psAstrometry.h
r1489 r1496 8 8 * @author George Gusciora, MHPCC 9 9 * 10 * @version $Revision: 1.1 8$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-08-1 1 23:33:44$10 * @version $Revision: 1.19 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-08-12 01:23:20 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 44 44 typedef struct 45 45 { 46 const double latitude; ///< geodetic latitude (radians)47 const double sinLat; ///< sine of geodetic latitude48 const double cosLat; ///< cosine of geodetic latitude49 const double abberationMag; ///< magnitude of diurnal aberration vector50 const double height; ///< height (HM)51 const double temperature; ///< ambient temperature (TDK)52 const double pressure; ///< pressure (PMB)53 const double humidity; ///< relative humidity (RH)54 const double wavelength; ///< wavelength (WL)55 const double lapseRate; ///< lapse rate (TLR)56 const double refractA; ///< refraction constant A (radians)57 const double refractB; ///< refraction constant B (radians)58 const double longitudeOffset; ///< longitude + ... (radians)59 const double siderealTime; ///< local apparent sidereal time (radians)46 const double latitude; ///< geodetic latitude (radians) 47 const double sinLat; ///< sine of geodetic latitude 48 const double cosLat; ///< cosine of geodetic latitude 49 const double abberationMag; ///< magnitude of diurnal aberration vector 50 const double height; ///< height (HM) 51 const double temperature; ///< ambient temperature (TDK) 52 const double pressure; ///< pressure (PMB) 53 const double humidity; ///< relative humidity (RH) 54 const double wavelength; ///< wavelength (WL) 55 const double lapseRate; ///< lapse rate (TLR) 56 const double refractA; ///< refraction constant A (radians) 57 const double refractB; ///< refraction constant B (radians) 58 const double longitudeOffset; ///< longitude + ... (radians) 59 const double siderealTime; ///< local apparent sidereal time (radians) 60 60 } 61 61 psGrommit; … … 72 72 typedef struct 73 73 { 74 int nX; ///< Number of elements in x direction75 int nY; ///< Number of elements in y direction76 double x0; ///< X Position of 0,0 corner on focal plane77 double y0; ///< Y Position of 0,0 corner on focal plane78 double xScale; ///< Scale of the grid in x direction79 double yScale; ///< Scale of the grid in x direction80 double **x; ///< The grid of offsets in x81 double **y; ///< The grid of offsets in y74 int nX; ///< Number of elements in x direction 75 int nY; ///< Number of elements in y direction 76 double x0; ///< X Position of 0,0 corner on focal plane 77 double y0; ///< Y Position of 0,0 corner on focal plane 78 double xScale; ///< Scale of the grid in x direction 79 double yScale; ///< Scale of the grid in x direction 80 double **x; ///< The grid of offsets in x 81 double **y; ///< The grid of offsets in y 82 82 } 83 83 psFixedPattern; … … 94 94 typedef struct 95 95 { 96 const unsigned int colBins; ///< Amount of binning in x-dimension97 const unsigned int rowBins; ///< Amount of binning in y-dimension98 const int col0; ///< Offset from the left of chip.99 const int row0; ///< Offset from the bottom of chip.100 101 psImage* image; ///< imaging area of Readout102 psList* objects; ///< objects derived from Readout103 psMetadata* metadata; ///< readout-level metadata96 const unsigned int colBins; ///< Amount of binning in x-dimension 97 const unsigned int rowBins; ///< Amount of binning in y-dimension 98 const int col0; ///< Offset from the left of chip. 99 const int row0; ///< Offset from the bottom of chip. 100 101 psImage* image; ///< imaging area of Readout 102 psList* objects; ///< objects derived from Readout 103 psMetadata* metadata; ///< readout-level metadata 104 104 } 105 105 psReadout; … … 116 116 typedef struct psCell 117 117 { 118 psArray* readouts; ///< readouts from the cell119 psMetadata* metadata; ///< cell-level metadata120 121 psPlaneTransform* toChip; ///< transformations from cell to chip coordinates122 psPlaneTransform* fromChip; ///< transformations from chip to cell coordinates123 psPlaneTransform* toFPA; ///< transformations from cell to FPA coordinates124 psPlaneTransform* toTP; ///< transformations from cell to tangent plane coordinates125 126 struct psChip* parent; ///< chip in which contains this cell118 psArray* readouts; ///< readouts from the cell 119 psMetadata* metadata; ///< cell-level metadata 120 121 psPlaneTransform* toChip; ///< transformations from cell to chip coordinates 122 psPlaneTransform* fromChip; ///< transformations from chip to cell coordinates 123 psPlaneTransform* toFPA; ///< transformations from cell to FPA coordinates 124 psPlaneTransform* toTP; ///< transformations from cell to tangent plane coordinates 125 126 struct psChip* parent; ///< chip in which contains this cell 127 127 } 128 128 psCell; … … 138 138 typedef struct psChip 139 139 { 140 psArray* cells; ///< cells in the chip141 psMetadata* metadata; ///< chip-level metadata142 143 psPlaneTransform* toFPA; ///< transformation from chip to FPA coordinates144 psPlaneTransform* fromFPA; ///< transformation from FPA to chip coordinates145 146 struct psFPA* parent; ///< FPA which contains this chip140 psArray* cells; ///< cells in the chip 141 psMetadata* metadata; ///< chip-level metadata 142 143 psPlaneTransform* toFPA; ///< transformation from chip to FPA coordinates 144 psPlaneTransform* fromFPA; ///< transformation from FPA to chip coordinates 145 146 struct psFPA* parent; ///< FPA which contains this chip 147 147 } 148 148 psChip; -
trunk/psLib/src/astronomy/psCoord.h
r1441 r1496 11 11 * @author George Gusciora, MHPCC 12 12 * 13 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-08- 09 23:40:54$13 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-08-12 01:23:20 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 117 117 /** Projection type for projection/deprojection 118 118 * 119 * @see alsopsProject, psDeproject119 * @see psProject, psDeproject 120 120 * 121 121 */ … … 133 133 /** Parameter set for projection/deprojection 134 134 * 135 * @see alsopsProject, psDeproject135 * @see psProject, psDeproject 136 136 * 137 137 */ … … 148 148 /** Mode for Offset calculation between two sky positions 149 149 * 150 * @see alsopsSphereGetOffset, psSphereSetOffset150 * @see psSphereGetOffset, psSphereSetOffset 151 151 * 152 152 */ … … 158 158 /** The units of the offset 159 159 * 160 * @see alsopsSphereGetOffset, psSphereSetOffset160 * @see psSphereGetOffset, psSphereSetOffset 161 161 * 162 162 */ … … 170 170 /** Applies the psPlaneTransform transform to a specified coordinate 171 171 * 172 */ 173 psPlane* psPlaneTransformApply(psPlane* out, ///< a psPlane to recycle. If NULL, a new one is generated. 174 const psPlaneTransform* transform, ///< the transform to apply 175 const psPlane* coords ///< the coordinate to apply the transform above. 176 ); 172 * @return psPlane* resulting coordinate based on transform 173 */ 174 psPlane* psPlaneTransformApply( 175 psPlane* out, ///< a psPlane to recycle. If NULL, a new one is generated. 176 const psPlaneTransform* transform, ///< the transform to apply 177 const psPlane* coords ///< the coordinate to apply the transform above. 178 ); 177 179 178 180 /** Applies the psPlaneDistort transform to a specified coordinate 179 181 * 180 */ 181 psPlane* psPlaneDistortApply(psPlane* out, ///< a psPlane to recycle. If NULL, a new one is generated. 182 const psPlaneDistort* transform, ///< the transform to apply 183 const psPlane* coords, ///< the coordinate to apply the transform above. 184 float term3, ///< third term -- maybe magnitude 185 float term4 ///< forth term -- maybe color 186 ); 182 * @return psPlane* resulting coordinate based on transform 183 */ 184 psPlane* psPlaneDistortApply( 185 psPlane* out, ///< a psPlane to recycle. If NULL, a new one is generated. 186 const psPlaneDistort* transform, ///< the transform to apply 187 const psPlane* coords, ///< the coordinate to apply the transform above. 188 float term3, ///< third term -- maybe magnitude 189 float term4 ///< forth term -- maybe color 190 ); 187 191 188 192 /** Allocator for psSphereTransform 189 193 * 190 */ 191 psSphereTransform* psSphereTransformAlloc(double NPlat, ///< north pole latitude 192 double Xo, ///< First PT of Ares lon 193 double xo ///< First PT of Ares equiv lon 194 ); 194 * @return psSphereTransform* newly allocated struct 195 */ 196 psSphereTransform* psSphereTransformAlloc( 197 double NPlat, ///< north pole latitude 198 double Xo, ///< First PT of Ares lon 199 double xo ///< First PT of Ares equiv lon 200 ); 195 201 196 202 /** Applies the psSphereTransform transform for a specified coordinate 197 203 * 198 */ 199 psSphere* psSphereTransformApply(psSphere* out, ///< a psSphere to recycle. If NULL, a new one is 200 // generated. 201 const psSphereTransform* transform, ///< the transform to apply 202 const psSphere* coord ///< the coordinate to apply the transform above.x 203 ); 204 205 psSphereTransform* psSphereTransformICRStoEcliptic(psTime time); 206 207 psSphereTransform* psSphereTransformEcliptictoICRS(psTime time); 208 204 * @return psSphere* resulting coordinate based on transform 205 */ 206 psSphere* psSphereTransformApply( 207 psSphere* out, ///< a psSphere to recycle. If NULL, a new one is generated. 208 const psSphereTransform* transform,///< the transform to apply 209 const psSphere* coord ///< the coordinate to apply the transform above.x 210 ); 211 212 /** Creates the appropriate transform for converting from ICRS to Ecliptic 213 * coordinate systems. 214 * 215 * @return psSphereTransform* transform for ICRS->Ecliptic coordinate systems 216 */ 217 psSphereTransform* psSphereTransformICRStoEcliptic( 218 psTime time ///< the time for which the resulting transform will be valid 219 ); 220 221 /** Creates the appropriate transform for converting from Ecliptic to ICRS 222 * coordinate systems. 223 * 224 * @return psSphereTransform* transform for Ecliptic->ICRS coordinate systems 225 */ 226 psSphereTransform* psSphereTransformEcliptictoICRS( 227 psTime time ///< the time for which the resulting transform will be valid 228 ); 229 230 /** Creates the appropriate transform for converting from ICRS to Galatic 231 * coordinate systems. 232 * 233 */ 209 234 psSphereTransform* psSphereTransformICRStoGalatic(void); 210 235 236 /** Creates the appropriate transform for converting from Galatic to ICRS 237 * coordinate systems. 238 * 239 */ 211 240 psSphereTransform* psSphereTransformGalatictoICRS(void); 212 241 213 psPlane* psProject(const psSphere* coord, const psProjection* projection); 214 215 psSphere* psDeproject(const psPlane* coord, const psProjection* projection); 216 217 psSphere* psSphereGetOffset(const psSphere* restrict position1, 218 const psSphere* restrict position2, 219 psSphereOffsetMode mode, psSphereOffsetUnit unit); 220 221 psSphere* psSphereSetOffset(const psSphere* restrict position, 222 const psSphere* restrict offset, 223 psSphereOffsetMode mode, psSphereOffsetUnit unit); 242 /** Projects a spherical coordinate to a linear coordinate system 243 * 244 * @return psPlane* projected coordinate 245 */ 246 psPlane* psProject( 247 const psSphere* coord, ///< coordinate to project 248 const psProjection* projection ///< parameters of the projection 249 ); 250 251 /** Reverse projection of a linear coordinate to a spherical coordinate system 252 * 253 * @return psPlane* projected coordinate 254 */ 255 psSphere* psDeproject( 256 const psPlane* coord, ///< coordinate to project 257 const psProjection* projection ///< parameters of the projection 258 ); 259 260 /** Determines the offset (RA,Dec) on the sky between two positions. 261 * 262 * Both an offset mode and an offset unit may be defined. The mode may be 263 * either PS_SPHERICAL, in which case the specified offset corresponds to an 264 * offset in angles, or it may be PS_LINEAR, in which case the offset 265 * corresponds to a linear offset in a local projection. The offset unit may 266 * be in one of PS_ARCSEC, PS_ARCMIN, PS_DEGREE, and PS_RADIAN, which 267 * specifies the units of the offset only. 268 * 269 * @return psSphere* the offset between position1 and position2 270 */ 271 psSphere* psSphereGetOffset( 272 const psSphere* restrict position1, 273 const psSphere* restrict position2, 274 psSphereOffsetMode mode, 275 psSphereOffsetUnit unit 276 ); 277 278 /** Applies the given offset to a coordinate. 279 * 280 * Both an offset mode and an offset unit may be defined. The mode may be 281 * either PS_SPHERICAL, in which case the specified offset corresponds to an 282 * offset in angles, or it may be PS_LINEAR, in which case the offset 283 * corresponds to a linear offset in a local projection. The offset unit may 284 * be in one of PS_ARCSEC, PS_ARCMIN, PS_DEGREE, and PS_RADIAN, which 285 * specifies the units of the offset only. 286 * 287 * @return psSphere* the given position with the given offset applied. 288 */ 289 psSphere* psSphereSetOffset( 290 const psSphere* restrict position, 291 const psSphere* restrict offset, 292 psSphereOffsetMode mode, 293 psSphereOffsetUnit unit 294 ); 224 295 225 296 /// @} -
trunk/psLib/src/astronomy/psMetadata.h
r1441 r1496 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1. 19$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-08- 09 23:40:54$13 * @version $Revision: 1.20 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-08-12 01:23:20 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 34 34 */ 35 35 typedef enum { 36 PS_META_ITEM_SET = 0, ///< Null. Metadata is in psMetadataItem.items37 PS_META_BOOL, ///< Boolean data.38 PS_META_S32, ///< Signed 32-bit integer data.39 PS_META_F32, ///< Single-precision float data.40 PS_META_F64, ///< Double-precision float data.41 PS_META_STR, ///< String data (Stored in as void *).42 PS_META_IMG, ///< Image data (Stored in as void *).43 PS_META_JPEG, ///< JPEG data (Stored in as void.44 PS_META_PNG, ///< PNG data (Stored in as void *).45 PS_META_ASTROM, ///< Astrometric coefficients (Stored in as void *).46 PS_META_UNKNOWN, ///< Other data (Stored in as void *).47 PS_META_NTYPE ///< Number of types. Must be last.36 PS_META_ITEM_SET = 0, ///< Null. Metadata is in psMetadataItem.items 37 PS_META_BOOL, ///< Boolean data. 38 PS_META_S32, ///< Signed 32-bit integer data. 39 PS_META_F32, ///< Single-precision float data. 40 PS_META_F64, ///< Double-precision float data. 41 PS_META_STR, ///< String data (Stored in as void *). 42 PS_META_IMG, ///< Image data (Stored in as void *). 43 PS_META_JPEG, ///< JPEG data (Stored in as void *). 44 PS_META_PNG, ///< PNG data (Stored in as void *). 45 PS_META_ASTROM, ///< Astrometric coefficients (Stored in as void *). 46 PS_META_UNKNOWN, ///< Other data (Stored in as void *). 47 PS_META_NTYPE ///< Number of types. Must be last. 48 48 } psMetadataType; 49 49 … … 55 55 typedef struct psMetadataItem 56 56 { 57 const int id; ///< Unique ID for metadata item.58 char *restrict name; ///< Name of metadata item.59 psMetadataType type; ///< Type of metadata item.57 const int id; ///< Unique ID for metadata item. 58 char *restrict name; ///< Name of metadata item. 59 psMetadataType type; ///< Type of metadata item. 60 60 union { 61 bool B; 62 psS32 S32; ///< Signed 32-bit integer data.63 psF32 F32; ///< Single-precision float data.64 psF64 F64; ///< Double-precision float data.65 psPTR V; ///< Pointer to other type of data.66 } data; ///< Union for data types.67 char *comment; ///< Optional comment ("", not NULL).68 psList* restrict items; ///< List of psMetadataItems with same name.61 bool B; ///< boolean data 62 psS32 S32; ///< Signed 32-bit integer data. 63 psF32 F32; ///< Single-precision float data. 64 psF64 F64; ///< Double-precision float data. 65 psPTR V; ///< Pointer to other type of data. 66 } data; ///< Union for data types. 67 char *comment; ///< Optional comment ("", not NULL). 68 psList* restrict items; ///< List of psMetadataItems with same name. 69 69 } 70 70 psMetadataItem; … … 72 72 /** Metadata data structure. 73 73 * 74 * Struct for holding metadata items. Metadata items are held in two containers. The first employs a 75 * doubly-linked list to preserve the order of the metadata. The second container employs a hash table which 76 * allows fast lookup when given a metadata keyword. 74 * Struct for holding metadata items. Metadata items are held in two 75 * containers. The first employs a doubly-linked list to preserve the order 76 * of the metadata. The second container employs a hash table which 77 * allows fast lookup when given a metadata keyword. 77 78 */ 78 79 typedef struct psMetadata 79 80 { 80 psList* restrict list; 81 psHash* restrict table; 81 psList* restrict list; ///< the metadata in linked-list 82 psHash* restrict table; ///< the metadata in a hash table 82 83 } 83 84 psMetadata; … … 91 92 /** Create a metadata item. 92 93 * 93 * Returns a fill psMetadataItem ready for insertion into the psMetadata struct. The name argument specifies 94 * the name to use for this item, and may include sprintf formatting codes. The format entry specifies both 95 * the metadata type and optional flags and is created by bit-wise or of the appropriate type and flag. The 96 * comment argument is a fixed string used to comment the metadata item. The arguments to the name formatting 97 * codes and the metadata itself are passed as arguments following the comment string. The data must be 98 * a pointer for any of the elements stored in data.void. The argument list must be interpreted appropriately 99 * by the va_list operators in the function. 100 * specified size and type. 101 * 102 * @return psMetadataItem* : Pointer metadata item. 103 */ 104 psMetadataItem* psMetadataItemAlloc(const char *name, ///< Name of metadata item. 105 psMetadataType type, ///< Type of metadata item. 106 const char *comment, ///< Comment for metadata item. 107 ... ///< Arguments for name formatting and metadata item data. 108 ); 94 * Returns a fill psMetadataItem ready for insertion into the psMetadata 95 * struct. The name argument specifies the name to use for this item, and 96 * may include sprintf formatting codes. The format entry specifies both 97 * the metadata type and optional flags and is created by bit-wise or of the 98 * appropriate type and flag. The comment argument is a fixed string used to 99 * comment the metadata item. The arguments to the name formatting codes and 100 * the metadata itself are passed as arguments following the comment string. 101 * The data must be a pointer for any of the elements stored in data.void. 102 * The argument list must be interpreted appropriately by the va_list 103 * operators in the function specified size and type. 104 * 105 * @return psMetadataItem* : Pointer metadata item. 106 */ 107 psMetadataItem* psMetadataItemAlloc( 108 const char *name, ///< Name of metadata item. 109 psMetadataType type, ///< Type of metadata item. 110 const char *comment, ///< Comment for metadata item. 111 ... ///< Arguments for name formatting and metadata item data. 112 ); 109 113 110 114 /** Create a metadata item with va_list. 111 115 * 112 * Returns a fill psMetadataItem ready for insertion into the psMetadata struct. The name argument specifies 113 * the name to use for this item, and may include sprintf formatting codes. The format entry specifies both 114 * the metadata type and optional flags and is created by bit-wise or of the appropriate type and flag. The 115 * comment argument is a fixed string used to comment the metadata item. The arguments to the name formatting 116 * codes and the metadata itself are passed as arguments following the comment string. The data must be 117 * a pointer for any of the elements stored in data.void. The argument list must be interpreted appropriately 118 * by the va_list operators in the function. 119 * specified size and type. 120 * 121 * @return psMetadataItem* : Pointer metadata item. 122 */ 123 psMetadataItem* psMetadataItemAllocV(const char *name, ///< Name of metadata item. 124 psMetadataType type, ///< Type of metadata item. 125 const char *comment, ///< Comment for metadata item. 126 va_list list ///< Arguments for name formatting and metadata item 127 // data. 128 ); 116 * Returns a fill psMetadataItem ready for insertion into the psMetadata 117 * struct. The name argument specifies the name to use for this item, and 118 * may include sprintf formatting codes. The format entry specifies both 119 * the metadata type and optional flags and is created by bit-wise or of the 120 * appropriate type and flag. The comment argument is a fixed string used to 121 * comment the metadata item. The arguments to the name formatting codes and 122 * the metadata itself are passed as arguments following the comment string. 123 * The data must be a pointer for any of the elements stored in data.void. 124 * The argument list must be interpreted appropriately by the va_list 125 * operators in the function specified size and type. 126 * 127 * @return psMetadataItem* : Pointer metadata item. 128 */ 129 psMetadataItem* psMetadataItemAllocV( 130 const char *name, ///< Name of metadata item. 131 psMetadataType type, ///< Type of metadata item. 132 const char *comment, ///< Comment for metadata item. 133 va_list list ///< Arguments for name formatting and metadata item data. 134 ); 129 135 130 136 /** Create a metadata collection. 131 137 * 132 * Returns an empty metadata container with fully allocated internal metadata containers.133 * 134 * @return psMetadata* : Pointer metadata.135 * /136 psMetadata* psMetadataAlloc(void ///< Void. 137 );138 * Returns an empty metadata container with fully allocated internal metadata 139 * containers. 140 * 141 * @return psMetadata* : Pointer metadata. 142 */ 143 psMetadata* psMetadataAlloc(void); 138 144 139 145 /** Add existing metadata item to metadata collection. 140 146 * 141 * Add a metadata item that has already been created to the metadata collection. 147 * Add a metadata item that has already been created to the metadata 148 * collection. 149 * 150 * @return bool: True for success, false for failure. 151 */ 152 bool psMetadataAddItem( 153 psMetadata* restrict md, ///< Metadata collection to insert metadat item. 154 int where, ///< Location to be added. 155 psMetadataItem* restrict item ///< Metadata item to be added. 156 ); 157 158 /** Create and add a metadata item to metadata collection. 159 * 160 * Creates a new metadata item add to the metadata collection. 142 161 * 143 162 * @return bool: True for success, false for failure. 144 163 */ 145 bool psMetadataAddItem(psMetadata* restrict md, ///< Metadata collection to insert metadat item. 146 int where, ///< Location to be added. 147 psMetadataItem* restrict item ///< Metadata item to be added. 148 ); 149 150 /** Create and add a metadata item to metadata collection. 151 * 152 * Creates a new metadata item add to the metadata collection. 164 bool psMetadataAdd( 165 psMetadata* restrict md, ///< Metadata collection to insert metadat item. 166 int where, ///< Location to be added. 167 const char *name, ///< Name of metadata item. 168 psMetadataType type, ///< Type of metadata item. 169 const char *comment, ///< Comment for metadata item. 170 ... ///< Arguments for name formatting and metadata item data. 171 ); 172 173 /** Remove an item from metadata collection. 174 * 175 * Items may be removed from metadata by specifing a key or location. If the 176 * name is null, the where argument is used instead. If name is not null, 177 * where is set to PS_LIST_UNKNOWN. If the item is found, it is removed from 178 * the metadata and true is returned. If the key is not unique, then all 179 * items corresponding to it are removed. 153 180 * 154 181 * @return bool: True for success, false for failure. 155 182 */ 156 bool psMetadataAdd(psMetadata* restrict md, ///< Metadata collection to insert metadat item. 157 int where, ///< Location to be added. 158 const char *name, ///< Name of metadata item. 159 psMetadataType type, ///< Type of metadata item. 160 const char *comment, ///< Comment for metadata item. 161 ... ///< Arguments for name formatting and metadata item data. 162 ); 163 164 /** Remove an item from metadata collection. 165 * 166 * Items may be removed from metadata by specifing a key or location. If the name is null, the where argument 167 * is used instead. If name is not null, where is set to PS_LIST_UNKNOWN. If the item is found, it is removed 168 * from the metadata and true is returned. If the key is not unique, then all items corresponding to it are 169 * removed. 170 * 171 * @return bool: True for success, false for failure. 172 */ 173 bool psMetadataRemove(psMetadata* restrict md, ///< Metadata collection to insert metadat item. 174 int where, ///< Location to be removed. 175 const char *restrict key ///< Name of metadata key. 176 ); 183 bool psMetadataRemove( 184 psMetadata* restrict md, ///< Metadata collection to insert metadat item. 185 int where, ///< Location to be removed. 186 const char *restrict key ///< Name of metadata key. 187 ); 177 188 178 189 /** Find an item in the metadata collection based on key name. 179 190 * 180 * Items may be found in the metadata by providing a key. If the key is non-unique, the first item is 181 * returned. If the item is not found, null is returned. 182 * 183 * @return psMetadataItem* : Pointer metadata item. 184 */ 185 psMetadataItem* psMetadataLookup(psMetadata* restrict md, ///< Metadata collection to insert metadat 186 // item. 187 const char *restrict key ///< Name of metadata key. 188 ); 191 * Items may be found in the metadata by providing a key. If the key is 192 * non-unique, the first item is returned. If the item is not found, null is 193 * returned. 194 * 195 * @return psMetadataItem* : Pointer metadata item. 196 */ 197 psMetadataItem* psMetadataLookup( 198 psMetadata* restrict md, ///< Metadata collection to insert metadata item. 199 const char *restrict key ///< Name of metadata key. 200 ); 189 201 190 202 /** Find an item in the metadata collection based on list index. 191 203 * 192 * Items may be found in the metadata by their entry position in the list container. 193 * 194 * @return psMetadataItem* : Pointer metadata item. 195 */ 196 psMetadataItem* psMetadataGet(psMetadata* restrict md, ///< Metadata collection to insert metadat item. 197 int where ///< Location to be retrieved. 198 ); 204 * Items may be found in the metadata by their entry position in the list 205 * container. 206 * 207 * @return psMetadataItem* : Pointer metadata item. 208 */ 209 psMetadataItem* psMetadataGet( 210 psMetadata* restrict md, ///< Metadata collection to insert metadat item. 211 int where ///< Location to be retrieved. 212 ); 199 213 200 214 /** Set or reset metadata iterator. 201 215 * 202 * Metadata may be iterated by setting or resetting an iterator to a location in the metadata list. 216 * Metadata may be iterated by setting or resetting an iterator to a location 217 * in the metadata list. 203 218 * 204 219 * @return void: void. 205 220 */ 206 bool psMetadataSetIterator(psMetadata* restrict md, ///< Metadata collection to iterate. 207 int where ///< Location of iterator. 208 ); 221 bool psMetadataSetIterator( 222 psMetadata* restrict md, ///< Metadata collection to iterate. 223 int where ///< Location of iterator. 224 ); 209 225 210 226 /** Get next metadata item. … … 214 230 * @return psMetadataItem* : Pointer metadata item. 215 231 */ 216 psMetadataItem* psMetadataGetNext(psMetadata* restrict md, ///< Metadata collection to iterate. 217 const char *restrict match, ///< Beginning of key name. 218 int which ///< Iterator to be used. 219 ); 232 psMetadataItem* psMetadataGetNext( 233 psMetadata* restrict md, ///< Metadata collection to iterate. 234 const char *restrict match, ///< Beginning of key name. 235 int which ///< Iterator to be used. 236 ); 220 237 221 238 /** Get previous metadata item. … … 225 242 * @return psMetadataItem* : Pointer metadata item. 226 243 */ 227 psMetadataItem* psMetadataGetPrevious(psMetadata* restrict md, ///< Metadata collection to iterate. 228 const char *restrict match, ///< Beginning of key name. 229 int which ///< Iterator to be used. 230 ); 244 psMetadataItem* psMetadataGetPrevious( 245 psMetadata* restrict md, ///< Metadata collection to iterate. 246 const char *restrict match, ///< Beginning of key name. 247 int which ///< Iterator to be used. 248 ); 231 249 232 250 /** Print metadata item to file. 233 251 * 234 * Metadata items may be printed to an open file descriptor based on a provided format. The format is a 235 * sprintf format statement with exactly one % formatting command. If the metadata item type is a numeric 236 * type, this formatting command must also be numeric, and the type conversion performed to the value to match 237 * the format type. If the metadata type is a string, the fromatting command must also be for a string. If the 238 * metadata type is any other data type, printing is not allowed. 239 * 240 * @return psMetadataItem* : Pointer metadata item. 241 */ 242 void psMetadataItemPrint(FILE * fd, ///< Pointer to file to write metadata item. 243 const char *format, ///< Format to print metadata item. 244 const psMetadataItem* restrict metadataItem ///< Metadata item to print. 245 ); 252 * Metadata items may be printed to an open file descriptor based on a 253 * provided format. The format is a sprintf format statement with exactly 254 * one % formatting command. If the metadata item type is a numeric type, 255 * this formatting command must also be numeric, and the type conversion 256 * performed to the value to match the format type. If the metadata type is 257 * a string, the fromatting command must also be for a string. If the 258 * metadata type is any other data type, printing is not allowed. 259 * 260 * @return psMetadataItem* : Pointer metadata item. 261 */ 262 void psMetadataItemPrint( 263 FILE * fd, ///< Pointer to file to write metadata item. 264 const char *format, ///< Format to print metadata item. 265 const psMetadataItem* restrict metadataItem ///< Metadata item to print. 266 ); 246 267 247 268 /** Read metadata header. 248 269 * 249 * Read a metadata header from file. If the file is not found, an error is reported. This file is currently 250 * unimplemented. 251 * 252 * @return psMetadata* : Pointer metadata. 253 */ 254 psMetadata* psMetadataReadHeader(psMetadata* output, ///< Resulting metadata from read. 255 char *extname, ///< File name extension string. 256 int extnum, ///< File name extension number. Starts at 1. 257 char *filename ///< Name of file to read. 258 ); 270 * Read a metadata header from file. If the file is not found, an error is 271 * reported. This file is currently unimplemented. 272 * 273 * @return psMetadata* : Pointer metadata. 274 */ 275 psMetadata* psMetadataReadHeader( 276 psMetadata* output, ///< Resulting metadata from read. 277 char *extname, ///< File name extension string. 278 int extnum, ///< File name extension number. Starts at 1. 279 char *filename ///< Name of file to read. 280 ); 259 281 260 282 /** Read metadata header. 261 283 * 262 * Read a metadata header from file. If the file is not found, an error is reported. 263 * 264 * @return psMetadata* : Pointer metadata. 265 */ 266 psMetadata* psMetadataFReadHeader(psMetadata* output, ///< Resulting metadata from read. 267 char *extName, ///< File name extension string. 268 int extNum, ///< File name extension number. 269 fitsfile * fd ///< Pointer to file to read. 270 ); 284 * Read a metadata header from file. If the file is not found, an error is 285 * reported. 286 * 287 * @return psMetadata* : Pointer metadata. 288 */ 289 psMetadata* psMetadataFReadHeader( 290 psMetadata* output, ///< Resulting metadata from read. 291 char *extName, ///< File name extension string. 292 int extNum, ///< File name extension number. 293 fitsfile * fd ///< Pointer to file to read. 294 ); 271 295 272 296 /// @} -
trunk/psLib/src/astronomy/psTime.h
r1441 r1496 13 13 * @author Ross Harman, MHPCC 14 14 * 15 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $16 * @date $Date: 2004-08- 09 23:40:54$15 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2004-08-12 01:23:20 $ 17 17 * 18 18 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 39 39 /** Definition of psTime. 40 40 * 41 * The psTime struct is used by psLib to represent time values critical to astronomical calculations. This 42 * structure represents a time which is equivalent to TAI (International Atomic Time) and is measured in 43 * both seconds and microseconds. 41 * The psTime struct is used by psLib to represent time values critical to 42 * astronomical calculations. This structure represents a time which is 43 * equivalent to TAI (International Atomic Time) and is measured in both 44 * seconds and microseconds. 44 45 */ 45 46 typedef struct 46 47 { 47 48 time_t tv_sec; /**< Seconds since epoch, Jan 1, 1970. */ 49 50 suseconds_t tv_usec; /**< Microseconds since last second. */ 48 time_t tv_sec; ///< Seconds since epoch, Jan 1, 1970. 49 suseconds_t tv_usec; ///< Microseconds since last second. 51 50 } 52 51 psTime; … … 65 64 */ 66 65 67 psTime psTimeGetTime(void 68 /** No argument. */ 69 ); 66 psTime psTimeGetTime(void); 70 67 71 68 /** Convert psTime to ISO time in TAI units. 72 69 * 73 * Converts psTime to a null terminated string in the form of: YYYY/MM/DD,HH:MM:SS.SSS. This function assumes 74 * the input time already is in TAI time and does not add or subtract leapseconds. 70 * Converts psTime to a null terminated string in the form of: 71 * YYYY/MM/DD,HH:MM:SS.SSS. This function assumes the input time already is 72 * in TAI time and does not add or subtract leapseconds. 75 73 * 76 74 * @return char*: Pointer null terminated array of chars in ISO time. 77 75 */ 78 76 79 char *psTimeToISO( psTime time80 /** Input time to be converted. */81 );77 char *psTimeToISO( 78 psTime time ///< Input time to be converted. 79 ); 82 80 83 81 /** Convert psTime to UTC time. 84 82 * 85 * Converts psTime to UTC time in double precision floating point notation. The input to this must already be 86 * int TAI time. The result from this function is not in TAI units, but that of UTC, which does not contain 87 * leapseconds. 83 * Converts psTime to UTC time in double precision floating point notation. 84 * The input to this must already be int TAI time. The result from this 85 * function is not in TAI units, but that of UTC, which does not contain 86 * leapseconds. 88 87 * 89 88 * @return psTime: UTC time psTime format. 90 89 */ 91 90 92 psTime psTimeToUTC( psTime time93 /** Input time to be converted. */94 );91 psTime psTimeToUTC( 92 psTime time ///< Input time to be converted. 93 ); 95 94 96 95 /** Convert psTime to modified Julian date time. 97 96 * 98 * Converts psTime to modified Julian date (MJD) time. This function assumes the input time already is in TAI 99 * time and does not add or subtract leapseconds. 97 * Converts psTime to modified Julian date (MJD) time. This function assumes 98 * the input time already is in TAI time and does not add or subtract 99 * leapseconds. 100 100 * 101 101 * @return double: Modified Julian Days (MJD) time. 102 102 */ 103 104 double psTimeToMJD(psTime time 105 /** Input time to be converted. */ 106 ); 103 double psTimeToMJD( 104 psTime time ///< Input time to be converted. 105 ); 107 106 108 107 /** Convert psTime to Julian date time. 109 108 * 110 * Converts psTime to Julian date (JD) time. This function assumes the input time already is in TAI time and111 * does not add or subtract leapseconds.109 * Converts psTime to Julian date (JD) time. This function assumes the input 110 * time already is in TAI time and does not add or subtract leapseconds. 112 111 * 113 112 * @return double: Julian Date (JD) time. 114 113 */ 115 116 double psTimeToJD(psTime time 117 /** Input time to be converted. */ 118 ); 114 double psTimeToJD( 115 psTime time ///< Input time to be converted. 116 ); 119 117 120 118 /** Convert psTime to timeval time. 121 119 * 122 * Converts psTime to timeval time. This function assumes the input time already is in TAI time and does not123 * add or subtract leapseconds.120 * Converts psTime to timeval time. This function assumes the input time 121 * already is in TAI time and does not add or subtract leapseconds. 124 122 * 125 123 * @return timeval: timeval struct time. 126 124 */ 127 128 struct timeval psTimeToTimeval(psTime time 129 /** Input time to be converted. */ 130 ); 125 struct timeval psTimeToTimeval( 126 psTime time ///< Input time to be converted. 127 ); 131 128 132 129 /** Convert psTime to tm time. … … 137 134 * @return tm: tm struct time. 138 135 */ 139 140 struct tm *psTimeToTM(psTime time 141 /** Input time to be converted. */ 142 ); 136 struct tm *psTimeToTM( 137 psTime time ///< Input time to be converted. 138 ); 143 139 144 140 /** Convert ISO to psTime. 145 141 * 146 * Converts ISO time to psTime. This function assumes the input time already is in TAI time and does not add147 * or subtract leapseconds.142 * Converts ISO time to psTime. This function assumes the input time already 143 * is in TAI time and does not add or subtract leapseconds. 148 144 * 149 145 * @return psTime: time 150 146 */ 151 152 psTime psISOToTime(char *time 153 /** Input time to be converted. */ 154 ); 147 psTime psISOToTime( 148 char *time ///< Input time to be converted. 149 ); 155 150 156 151 /** Convert UTC to psTime. 157 152 * 158 * Converts UTC time to psTime. This function assumes the input time already is in TAI time and add or159 * subtracts the necessary leapseconds.153 * Converts UTC time to psTime. This function assumes the input time already 154 * is in TAI time and add or subtracts the necessary leapseconds. 160 155 * 161 156 * @return psTime: time in TAI units. 162 157 */ 163 164 psTime psUTCToTime(psTime time 165 /** Input time to be converted. */ 166 ); 158 psTime psUTCToTime( 159 psTime time ///< Input time to be converted. 160 ); 167 161 168 162 /** Convert MJD to psTime. 169 163 * 170 * Converts MJD time to psTime. This function assumes the input time already is in TAI time and does not add 171 * or subtract leapseconds. 172 * 173 * @return psTime: time. 174 */ 175 176 psTime psMJDToTime(double time 177 /** Input time to be converted. */ 178 ); 164 * Converts MJD time to psTime. This function assumes the input time already 165 * is in TAI time and does not add or subtract leapseconds. 166 * 167 * @return psTime: time. 168 */ 169 psTime psMJDToTime( 170 double time ///< Input time to be converted. 171 ); 179 172 180 173 /** Convert JD to psTime. 181 174 * 182 * Converts JD time to psTime. This function assumes the input time already is in TAI time and does not add 183 * or subtract leapseconds. 184 * 185 * @return psTime: time. 186 */ 187 188 psTime psJDToTime(double time 189 /** Input time to be converted. */ 190 ); 175 * Converts JD time to psTime. This function assumes the input time already 176 * is in TAI time and does not add or subtract leapseconds. 177 * 178 * @return psTime: time. 179 */ 180 psTime psJDToTime( 181 double time ///< Input time to be converted. 182 ); 191 183 192 184 /** Convert timeval to psTime. 193 185 * 194 * Converts timeval time to psTime. This function assumes the input time already is in TAI time and does not 195 * add or subtract leapseconds. 196 * 197 * @return psTime: time. 198 */ 199 200 psTime psTimevalToTime(struct timeval *time 201 /** Input time to be converted. */ 202 ); 186 * Converts timeval time to psTime. This function assumes the input time 187 * already is in TAI time and does not add or subtract leapseconds. 188 * 189 * @return psTime: time. 190 */ 191 psTime psTimevalToTime( 192 struct timeval *time ///< Input time to be converted. 193 ); 203 194 204 195 /** Convert tm time to psTime. 205 196 * 206 * Converts tm time to psTime. This function assumes the input time already is in TAI time and does not add 207 * or subtract leapseconds. 208 * 209 * @return psTime: time. 210 */ 211 212 psTime psTMToTime(struct tm *time 213 /** Input time to be converted. */ 214 ); 197 * Converts tm time to psTime. This function assumes the input time already 198 * is in TAI time and does not add or subtract leapseconds. 199 * 200 * @return psTime: time. 201 */ 202 psTime psTMToTime( 203 struct tm *time ///< Input time to be converted. 204 ); 215 205 216 206 /// @} -
trunk/psLib/src/collections/psMetadata.h
r1441 r1496 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1. 19$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-08- 09 23:40:54$13 * @version $Revision: 1.20 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-08-12 01:23:20 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 34 34 */ 35 35 typedef enum { 36 PS_META_ITEM_SET = 0, ///< Null. Metadata is in psMetadataItem.items37 PS_META_BOOL, ///< Boolean data.38 PS_META_S32, ///< Signed 32-bit integer data.39 PS_META_F32, ///< Single-precision float data.40 PS_META_F64, ///< Double-precision float data.41 PS_META_STR, ///< String data (Stored in as void *).42 PS_META_IMG, ///< Image data (Stored in as void *).43 PS_META_JPEG, ///< JPEG data (Stored in as void.44 PS_META_PNG, ///< PNG data (Stored in as void *).45 PS_META_ASTROM, ///< Astrometric coefficients (Stored in as void *).46 PS_META_UNKNOWN, ///< Other data (Stored in as void *).47 PS_META_NTYPE ///< Number of types. Must be last.36 PS_META_ITEM_SET = 0, ///< Null. Metadata is in psMetadataItem.items 37 PS_META_BOOL, ///< Boolean data. 38 PS_META_S32, ///< Signed 32-bit integer data. 39 PS_META_F32, ///< Single-precision float data. 40 PS_META_F64, ///< Double-precision float data. 41 PS_META_STR, ///< String data (Stored in as void *). 42 PS_META_IMG, ///< Image data (Stored in as void *). 43 PS_META_JPEG, ///< JPEG data (Stored in as void *). 44 PS_META_PNG, ///< PNG data (Stored in as void *). 45 PS_META_ASTROM, ///< Astrometric coefficients (Stored in as void *). 46 PS_META_UNKNOWN, ///< Other data (Stored in as void *). 47 PS_META_NTYPE ///< Number of types. Must be last. 48 48 } psMetadataType; 49 49 … … 55 55 typedef struct psMetadataItem 56 56 { 57 const int id; ///< Unique ID for metadata item.58 char *restrict name; ///< Name of metadata item.59 psMetadataType type; ///< Type of metadata item.57 const int id; ///< Unique ID for metadata item. 58 char *restrict name; ///< Name of metadata item. 59 psMetadataType type; ///< Type of metadata item. 60 60 union { 61 bool B; 62 psS32 S32; ///< Signed 32-bit integer data.63 psF32 F32; ///< Single-precision float data.64 psF64 F64; ///< Double-precision float data.65 psPTR V; ///< Pointer to other type of data.66 } data; ///< Union for data types.67 char *comment; ///< Optional comment ("", not NULL).68 psList* restrict items; ///< List of psMetadataItems with same name.61 bool B; ///< boolean data 62 psS32 S32; ///< Signed 32-bit integer data. 63 psF32 F32; ///< Single-precision float data. 64 psF64 F64; ///< Double-precision float data. 65 psPTR V; ///< Pointer to other type of data. 66 } data; ///< Union for data types. 67 char *comment; ///< Optional comment ("", not NULL). 68 psList* restrict items; ///< List of psMetadataItems with same name. 69 69 } 70 70 psMetadataItem; … … 72 72 /** Metadata data structure. 73 73 * 74 * Struct for holding metadata items. Metadata items are held in two containers. The first employs a 75 * doubly-linked list to preserve the order of the metadata. The second container employs a hash table which 76 * allows fast lookup when given a metadata keyword. 74 * Struct for holding metadata items. Metadata items are held in two 75 * containers. The first employs a doubly-linked list to preserve the order 76 * of the metadata. The second container employs a hash table which 77 * allows fast lookup when given a metadata keyword. 77 78 */ 78 79 typedef struct psMetadata 79 80 { 80 psList* restrict list; 81 psHash* restrict table; 81 psList* restrict list; ///< the metadata in linked-list 82 psHash* restrict table; ///< the metadata in a hash table 82 83 } 83 84 psMetadata; … … 91 92 /** Create a metadata item. 92 93 * 93 * Returns a fill psMetadataItem ready for insertion into the psMetadata struct. The name argument specifies 94 * the name to use for this item, and may include sprintf formatting codes. The format entry specifies both 95 * the metadata type and optional flags and is created by bit-wise or of the appropriate type and flag. The 96 * comment argument is a fixed string used to comment the metadata item. The arguments to the name formatting 97 * codes and the metadata itself are passed as arguments following the comment string. The data must be 98 * a pointer for any of the elements stored in data.void. The argument list must be interpreted appropriately 99 * by the va_list operators in the function. 100 * specified size and type. 101 * 102 * @return psMetadataItem* : Pointer metadata item. 103 */ 104 psMetadataItem* psMetadataItemAlloc(const char *name, ///< Name of metadata item. 105 psMetadataType type, ///< Type of metadata item. 106 const char *comment, ///< Comment for metadata item. 107 ... ///< Arguments for name formatting and metadata item data. 108 ); 94 * Returns a fill psMetadataItem ready for insertion into the psMetadata 95 * struct. The name argument specifies the name to use for this item, and 96 * may include sprintf formatting codes. The format entry specifies both 97 * the metadata type and optional flags and is created by bit-wise or of the 98 * appropriate type and flag. The comment argument is a fixed string used to 99 * comment the metadata item. The arguments to the name formatting codes and 100 * the metadata itself are passed as arguments following the comment string. 101 * The data must be a pointer for any of the elements stored in data.void. 102 * The argument list must be interpreted appropriately by the va_list 103 * operators in the function specified size and type. 104 * 105 * @return psMetadataItem* : Pointer metadata item. 106 */ 107 psMetadataItem* psMetadataItemAlloc( 108 const char *name, ///< Name of metadata item. 109 psMetadataType type, ///< Type of metadata item. 110 const char *comment, ///< Comment for metadata item. 111 ... ///< Arguments for name formatting and metadata item data. 112 ); 109 113 110 114 /** Create a metadata item with va_list. 111 115 * 112 * Returns a fill psMetadataItem ready for insertion into the psMetadata struct. The name argument specifies 113 * the name to use for this item, and may include sprintf formatting codes. The format entry specifies both 114 * the metadata type and optional flags and is created by bit-wise or of the appropriate type and flag. The 115 * comment argument is a fixed string used to comment the metadata item. The arguments to the name formatting 116 * codes and the metadata itself are passed as arguments following the comment string. The data must be 117 * a pointer for any of the elements stored in data.void. The argument list must be interpreted appropriately 118 * by the va_list operators in the function. 119 * specified size and type. 120 * 121 * @return psMetadataItem* : Pointer metadata item. 122 */ 123 psMetadataItem* psMetadataItemAllocV(const char *name, ///< Name of metadata item. 124 psMetadataType type, ///< Type of metadata item. 125 const char *comment, ///< Comment for metadata item. 126 va_list list ///< Arguments for name formatting and metadata item 127 // data. 128 ); 116 * Returns a fill psMetadataItem ready for insertion into the psMetadata 117 * struct. The name argument specifies the name to use for this item, and 118 * may include sprintf formatting codes. The format entry specifies both 119 * the metadata type and optional flags and is created by bit-wise or of the 120 * appropriate type and flag. The comment argument is a fixed string used to 121 * comment the metadata item. The arguments to the name formatting codes and 122 * the metadata itself are passed as arguments following the comment string. 123 * The data must be a pointer for any of the elements stored in data.void. 124 * The argument list must be interpreted appropriately by the va_list 125 * operators in the function specified size and type. 126 * 127 * @return psMetadataItem* : Pointer metadata item. 128 */ 129 psMetadataItem* psMetadataItemAllocV( 130 const char *name, ///< Name of metadata item. 131 psMetadataType type, ///< Type of metadata item. 132 const char *comment, ///< Comment for metadata item. 133 va_list list ///< Arguments for name formatting and metadata item data. 134 ); 129 135 130 136 /** Create a metadata collection. 131 137 * 132 * Returns an empty metadata container with fully allocated internal metadata containers.133 * 134 * @return psMetadata* : Pointer metadata.135 * /136 psMetadata* psMetadataAlloc(void ///< Void. 137 );138 * Returns an empty metadata container with fully allocated internal metadata 139 * containers. 140 * 141 * @return psMetadata* : Pointer metadata. 142 */ 143 psMetadata* psMetadataAlloc(void); 138 144 139 145 /** Add existing metadata item to metadata collection. 140 146 * 141 * Add a metadata item that has already been created to the metadata collection. 147 * Add a metadata item that has already been created to the metadata 148 * collection. 149 * 150 * @return bool: True for success, false for failure. 151 */ 152 bool psMetadataAddItem( 153 psMetadata* restrict md, ///< Metadata collection to insert metadat item. 154 int where, ///< Location to be added. 155 psMetadataItem* restrict item ///< Metadata item to be added. 156 ); 157 158 /** Create and add a metadata item to metadata collection. 159 * 160 * Creates a new metadata item add to the metadata collection. 142 161 * 143 162 * @return bool: True for success, false for failure. 144 163 */ 145 bool psMetadataAddItem(psMetadata* restrict md, ///< Metadata collection to insert metadat item. 146 int where, ///< Location to be added. 147 psMetadataItem* restrict item ///< Metadata item to be added. 148 ); 149 150 /** Create and add a metadata item to metadata collection. 151 * 152 * Creates a new metadata item add to the metadata collection. 164 bool psMetadataAdd( 165 psMetadata* restrict md, ///< Metadata collection to insert metadat item. 166 int where, ///< Location to be added. 167 const char *name, ///< Name of metadata item. 168 psMetadataType type, ///< Type of metadata item. 169 const char *comment, ///< Comment for metadata item. 170 ... ///< Arguments for name formatting and metadata item data. 171 ); 172 173 /** Remove an item from metadata collection. 174 * 175 * Items may be removed from metadata by specifing a key or location. If the 176 * name is null, the where argument is used instead. If name is not null, 177 * where is set to PS_LIST_UNKNOWN. If the item is found, it is removed from 178 * the metadata and true is returned. If the key is not unique, then all 179 * items corresponding to it are removed. 153 180 * 154 181 * @return bool: True for success, false for failure. 155 182 */ 156 bool psMetadataAdd(psMetadata* restrict md, ///< Metadata collection to insert metadat item. 157 int where, ///< Location to be added. 158 const char *name, ///< Name of metadata item. 159 psMetadataType type, ///< Type of metadata item. 160 const char *comment, ///< Comment for metadata item. 161 ... ///< Arguments for name formatting and metadata item data. 162 ); 163 164 /** Remove an item from metadata collection. 165 * 166 * Items may be removed from metadata by specifing a key or location. If the name is null, the where argument 167 * is used instead. If name is not null, where is set to PS_LIST_UNKNOWN. If the item is found, it is removed 168 * from the metadata and true is returned. If the key is not unique, then all items corresponding to it are 169 * removed. 170 * 171 * @return bool: True for success, false for failure. 172 */ 173 bool psMetadataRemove(psMetadata* restrict md, ///< Metadata collection to insert metadat item. 174 int where, ///< Location to be removed. 175 const char *restrict key ///< Name of metadata key. 176 ); 183 bool psMetadataRemove( 184 psMetadata* restrict md, ///< Metadata collection to insert metadat item. 185 int where, ///< Location to be removed. 186 const char *restrict key ///< Name of metadata key. 187 ); 177 188 178 189 /** Find an item in the metadata collection based on key name. 179 190 * 180 * Items may be found in the metadata by providing a key. If the key is non-unique, the first item is 181 * returned. If the item is not found, null is returned. 182 * 183 * @return psMetadataItem* : Pointer metadata item. 184 */ 185 psMetadataItem* psMetadataLookup(psMetadata* restrict md, ///< Metadata collection to insert metadat 186 // item. 187 const char *restrict key ///< Name of metadata key. 188 ); 191 * Items may be found in the metadata by providing a key. If the key is 192 * non-unique, the first item is returned. If the item is not found, null is 193 * returned. 194 * 195 * @return psMetadataItem* : Pointer metadata item. 196 */ 197 psMetadataItem* psMetadataLookup( 198 psMetadata* restrict md, ///< Metadata collection to insert metadata item. 199 const char *restrict key ///< Name of metadata key. 200 ); 189 201 190 202 /** Find an item in the metadata collection based on list index. 191 203 * 192 * Items may be found in the metadata by their entry position in the list container. 193 * 194 * @return psMetadataItem* : Pointer metadata item. 195 */ 196 psMetadataItem* psMetadataGet(psMetadata* restrict md, ///< Metadata collection to insert metadat item. 197 int where ///< Location to be retrieved. 198 ); 204 * Items may be found in the metadata by their entry position in the list 205 * container. 206 * 207 * @return psMetadataItem* : Pointer metadata item. 208 */ 209 psMetadataItem* psMetadataGet( 210 psMetadata* restrict md, ///< Metadata collection to insert metadat item. 211 int where ///< Location to be retrieved. 212 ); 199 213 200 214 /** Set or reset metadata iterator. 201 215 * 202 * Metadata may be iterated by setting or resetting an iterator to a location in the metadata list. 216 * Metadata may be iterated by setting or resetting an iterator to a location 217 * in the metadata list. 203 218 * 204 219 * @return void: void. 205 220 */ 206 bool psMetadataSetIterator(psMetadata* restrict md, ///< Metadata collection to iterate. 207 int where ///< Location of iterator. 208 ); 221 bool psMetadataSetIterator( 222 psMetadata* restrict md, ///< Metadata collection to iterate. 223 int where ///< Location of iterator. 224 ); 209 225 210 226 /** Get next metadata item. … … 214 230 * @return psMetadataItem* : Pointer metadata item. 215 231 */ 216 psMetadataItem* psMetadataGetNext(psMetadata* restrict md, ///< Metadata collection to iterate. 217 const char *restrict match, ///< Beginning of key name. 218 int which ///< Iterator to be used. 219 ); 232 psMetadataItem* psMetadataGetNext( 233 psMetadata* restrict md, ///< Metadata collection to iterate. 234 const char *restrict match, ///< Beginning of key name. 235 int which ///< Iterator to be used. 236 ); 220 237 221 238 /** Get previous metadata item. … … 225 242 * @return psMetadataItem* : Pointer metadata item. 226 243 */ 227 psMetadataItem* psMetadataGetPrevious(psMetadata* restrict md, ///< Metadata collection to iterate. 228 const char *restrict match, ///< Beginning of key name. 229 int which ///< Iterator to be used. 230 ); 244 psMetadataItem* psMetadataGetPrevious( 245 psMetadata* restrict md, ///< Metadata collection to iterate. 246 const char *restrict match, ///< Beginning of key name. 247 int which ///< Iterator to be used. 248 ); 231 249 232 250 /** Print metadata item to file. 233 251 * 234 * Metadata items may be printed to an open file descriptor based on a provided format. The format is a 235 * sprintf format statement with exactly one % formatting command. If the metadata item type is a numeric 236 * type, this formatting command must also be numeric, and the type conversion performed to the value to match 237 * the format type. If the metadata type is a string, the fromatting command must also be for a string. If the 238 * metadata type is any other data type, printing is not allowed. 239 * 240 * @return psMetadataItem* : Pointer metadata item. 241 */ 242 void psMetadataItemPrint(FILE * fd, ///< Pointer to file to write metadata item. 243 const char *format, ///< Format to print metadata item. 244 const psMetadataItem* restrict metadataItem ///< Metadata item to print. 245 ); 252 * Metadata items may be printed to an open file descriptor based on a 253 * provided format. The format is a sprintf format statement with exactly 254 * one % formatting command. If the metadata item type is a numeric type, 255 * this formatting command must also be numeric, and the type conversion 256 * performed to the value to match the format type. If the metadata type is 257 * a string, the fromatting command must also be for a string. If the 258 * metadata type is any other data type, printing is not allowed. 259 * 260 * @return psMetadataItem* : Pointer metadata item. 261 */ 262 void psMetadataItemPrint( 263 FILE * fd, ///< Pointer to file to write metadata item. 264 const char *format, ///< Format to print metadata item. 265 const psMetadataItem* restrict metadataItem ///< Metadata item to print. 266 ); 246 267 247 268 /** Read metadata header. 248 269 * 249 * Read a metadata header from file. If the file is not found, an error is reported. This file is currently 250 * unimplemented. 251 * 252 * @return psMetadata* : Pointer metadata. 253 */ 254 psMetadata* psMetadataReadHeader(psMetadata* output, ///< Resulting metadata from read. 255 char *extname, ///< File name extension string. 256 int extnum, ///< File name extension number. Starts at 1. 257 char *filename ///< Name of file to read. 258 ); 270 * Read a metadata header from file. If the file is not found, an error is 271 * reported. This file is currently unimplemented. 272 * 273 * @return psMetadata* : Pointer metadata. 274 */ 275 psMetadata* psMetadataReadHeader( 276 psMetadata* output, ///< Resulting metadata from read. 277 char *extname, ///< File name extension string. 278 int extnum, ///< File name extension number. Starts at 1. 279 char *filename ///< Name of file to read. 280 ); 259 281 260 282 /** Read metadata header. 261 283 * 262 * Read a metadata header from file. If the file is not found, an error is reported. 263 * 264 * @return psMetadata* : Pointer metadata. 265 */ 266 psMetadata* psMetadataFReadHeader(psMetadata* output, ///< Resulting metadata from read. 267 char *extName, ///< File name extension string. 268 int extNum, ///< File name extension number. 269 fitsfile * fd ///< Pointer to file to read. 270 ); 284 * Read a metadata header from file. If the file is not found, an error is 285 * reported. 286 * 287 * @return psMetadata* : Pointer metadata. 288 */ 289 psMetadata* psMetadataFReadHeader( 290 psMetadata* output, ///< Resulting metadata from read. 291 char *extName, ///< File name extension string. 292 int extNum, ///< File name extension number. 293 fitsfile * fd ///< Pointer to file to read. 294 ); 271 295 272 296 /// @} -
trunk/psLib/src/types/psMetadata.h
r1441 r1496 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1. 19$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-08- 09 23:40:54$13 * @version $Revision: 1.20 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-08-12 01:23:20 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 34 34 */ 35 35 typedef enum { 36 PS_META_ITEM_SET = 0, ///< Null. Metadata is in psMetadataItem.items37 PS_META_BOOL, ///< Boolean data.38 PS_META_S32, ///< Signed 32-bit integer data.39 PS_META_F32, ///< Single-precision float data.40 PS_META_F64, ///< Double-precision float data.41 PS_META_STR, ///< String data (Stored in as void *).42 PS_META_IMG, ///< Image data (Stored in as void *).43 PS_META_JPEG, ///< JPEG data (Stored in as void.44 PS_META_PNG, ///< PNG data (Stored in as void *).45 PS_META_ASTROM, ///< Astrometric coefficients (Stored in as void *).46 PS_META_UNKNOWN, ///< Other data (Stored in as void *).47 PS_META_NTYPE ///< Number of types. Must be last.36 PS_META_ITEM_SET = 0, ///< Null. Metadata is in psMetadataItem.items 37 PS_META_BOOL, ///< Boolean data. 38 PS_META_S32, ///< Signed 32-bit integer data. 39 PS_META_F32, ///< Single-precision float data. 40 PS_META_F64, ///< Double-precision float data. 41 PS_META_STR, ///< String data (Stored in as void *). 42 PS_META_IMG, ///< Image data (Stored in as void *). 43 PS_META_JPEG, ///< JPEG data (Stored in as void *). 44 PS_META_PNG, ///< PNG data (Stored in as void *). 45 PS_META_ASTROM, ///< Astrometric coefficients (Stored in as void *). 46 PS_META_UNKNOWN, ///< Other data (Stored in as void *). 47 PS_META_NTYPE ///< Number of types. Must be last. 48 48 } psMetadataType; 49 49 … … 55 55 typedef struct psMetadataItem 56 56 { 57 const int id; ///< Unique ID for metadata item.58 char *restrict name; ///< Name of metadata item.59 psMetadataType type; ///< Type of metadata item.57 const int id; ///< Unique ID for metadata item. 58 char *restrict name; ///< Name of metadata item. 59 psMetadataType type; ///< Type of metadata item. 60 60 union { 61 bool B; 62 psS32 S32; ///< Signed 32-bit integer data.63 psF32 F32; ///< Single-precision float data.64 psF64 F64; ///< Double-precision float data.65 psPTR V; ///< Pointer to other type of data.66 } data; ///< Union for data types.67 char *comment; ///< Optional comment ("", not NULL).68 psList* restrict items; ///< List of psMetadataItems with same name.61 bool B; ///< boolean data 62 psS32 S32; ///< Signed 32-bit integer data. 63 psF32 F32; ///< Single-precision float data. 64 psF64 F64; ///< Double-precision float data. 65 psPTR V; ///< Pointer to other type of data. 66 } data; ///< Union for data types. 67 char *comment; ///< Optional comment ("", not NULL). 68 psList* restrict items; ///< List of psMetadataItems with same name. 69 69 } 70 70 psMetadataItem; … … 72 72 /** Metadata data structure. 73 73 * 74 * Struct for holding metadata items. Metadata items are held in two containers. The first employs a 75 * doubly-linked list to preserve the order of the metadata. The second container employs a hash table which 76 * allows fast lookup when given a metadata keyword. 74 * Struct for holding metadata items. Metadata items are held in two 75 * containers. The first employs a doubly-linked list to preserve the order 76 * of the metadata. The second container employs a hash table which 77 * allows fast lookup when given a metadata keyword. 77 78 */ 78 79 typedef struct psMetadata 79 80 { 80 psList* restrict list; 81 psHash* restrict table; 81 psList* restrict list; ///< the metadata in linked-list 82 psHash* restrict table; ///< the metadata in a hash table 82 83 } 83 84 psMetadata; … … 91 92 /** Create a metadata item. 92 93 * 93 * Returns a fill psMetadataItem ready for insertion into the psMetadata struct. The name argument specifies 94 * the name to use for this item, and may include sprintf formatting codes. The format entry specifies both 95 * the metadata type and optional flags and is created by bit-wise or of the appropriate type and flag. The 96 * comment argument is a fixed string used to comment the metadata item. The arguments to the name formatting 97 * codes and the metadata itself are passed as arguments following the comment string. The data must be 98 * a pointer for any of the elements stored in data.void. The argument list must be interpreted appropriately 99 * by the va_list operators in the function. 100 * specified size and type. 101 * 102 * @return psMetadataItem* : Pointer metadata item. 103 */ 104 psMetadataItem* psMetadataItemAlloc(const char *name, ///< Name of metadata item. 105 psMetadataType type, ///< Type of metadata item. 106 const char *comment, ///< Comment for metadata item. 107 ... ///< Arguments for name formatting and metadata item data. 108 ); 94 * Returns a fill psMetadataItem ready for insertion into the psMetadata 95 * struct. The name argument specifies the name to use for this item, and 96 * may include sprintf formatting codes. The format entry specifies both 97 * the metadata type and optional flags and is created by bit-wise or of the 98 * appropriate type and flag. The comment argument is a fixed string used to 99 * comment the metadata item. The arguments to the name formatting codes and 100 * the metadata itself are passed as arguments following the comment string. 101 * The data must be a pointer for any of the elements stored in data.void. 102 * The argument list must be interpreted appropriately by the va_list 103 * operators in the function specified size and type. 104 * 105 * @return psMetadataItem* : Pointer metadata item. 106 */ 107 psMetadataItem* psMetadataItemAlloc( 108 const char *name, ///< Name of metadata item. 109 psMetadataType type, ///< Type of metadata item. 110 const char *comment, ///< Comment for metadata item. 111 ... ///< Arguments for name formatting and metadata item data. 112 ); 109 113 110 114 /** Create a metadata item with va_list. 111 115 * 112 * Returns a fill psMetadataItem ready for insertion into the psMetadata struct. The name argument specifies 113 * the name to use for this item, and may include sprintf formatting codes. The format entry specifies both 114 * the metadata type and optional flags and is created by bit-wise or of the appropriate type and flag. The 115 * comment argument is a fixed string used to comment the metadata item. The arguments to the name formatting 116 * codes and the metadata itself are passed as arguments following the comment string. The data must be 117 * a pointer for any of the elements stored in data.void. The argument list must be interpreted appropriately 118 * by the va_list operators in the function. 119 * specified size and type. 120 * 121 * @return psMetadataItem* : Pointer metadata item. 122 */ 123 psMetadataItem* psMetadataItemAllocV(const char *name, ///< Name of metadata item. 124 psMetadataType type, ///< Type of metadata item. 125 const char *comment, ///< Comment for metadata item. 126 va_list list ///< Arguments for name formatting and metadata item 127 // data. 128 ); 116 * Returns a fill psMetadataItem ready for insertion into the psMetadata 117 * struct. The name argument specifies the name to use for this item, and 118 * may include sprintf formatting codes. The format entry specifies both 119 * the metadata type and optional flags and is created by bit-wise or of the 120 * appropriate type and flag. The comment argument is a fixed string used to 121 * comment the metadata item. The arguments to the name formatting codes and 122 * the metadata itself are passed as arguments following the comment string. 123 * The data must be a pointer for any of the elements stored in data.void. 124 * The argument list must be interpreted appropriately by the va_list 125 * operators in the function specified size and type. 126 * 127 * @return psMetadataItem* : Pointer metadata item. 128 */ 129 psMetadataItem* psMetadataItemAllocV( 130 const char *name, ///< Name of metadata item. 131 psMetadataType type, ///< Type of metadata item. 132 const char *comment, ///< Comment for metadata item. 133 va_list list ///< Arguments for name formatting and metadata item data. 134 ); 129 135 130 136 /** Create a metadata collection. 131 137 * 132 * Returns an empty metadata container with fully allocated internal metadata containers.133 * 134 * @return psMetadata* : Pointer metadata.135 * /136 psMetadata* psMetadataAlloc(void ///< Void. 137 );138 * Returns an empty metadata container with fully allocated internal metadata 139 * containers. 140 * 141 * @return psMetadata* : Pointer metadata. 142 */ 143 psMetadata* psMetadataAlloc(void); 138 144 139 145 /** Add existing metadata item to metadata collection. 140 146 * 141 * Add a metadata item that has already been created to the metadata collection. 147 * Add a metadata item that has already been created to the metadata 148 * collection. 149 * 150 * @return bool: True for success, false for failure. 151 */ 152 bool psMetadataAddItem( 153 psMetadata* restrict md, ///< Metadata collection to insert metadat item. 154 int where, ///< Location to be added. 155 psMetadataItem* restrict item ///< Metadata item to be added. 156 ); 157 158 /** Create and add a metadata item to metadata collection. 159 * 160 * Creates a new metadata item add to the metadata collection. 142 161 * 143 162 * @return bool: True for success, false for failure. 144 163 */ 145 bool psMetadataAddItem(psMetadata* restrict md, ///< Metadata collection to insert metadat item. 146 int where, ///< Location to be added. 147 psMetadataItem* restrict item ///< Metadata item to be added. 148 ); 149 150 /** Create and add a metadata item to metadata collection. 151 * 152 * Creates a new metadata item add to the metadata collection. 164 bool psMetadataAdd( 165 psMetadata* restrict md, ///< Metadata collection to insert metadat item. 166 int where, ///< Location to be added. 167 const char *name, ///< Name of metadata item. 168 psMetadataType type, ///< Type of metadata item. 169 const char *comment, ///< Comment for metadata item. 170 ... ///< Arguments for name formatting and metadata item data. 171 ); 172 173 /** Remove an item from metadata collection. 174 * 175 * Items may be removed from metadata by specifing a key or location. If the 176 * name is null, the where argument is used instead. If name is not null, 177 * where is set to PS_LIST_UNKNOWN. If the item is found, it is removed from 178 * the metadata and true is returned. If the key is not unique, then all 179 * items corresponding to it are removed. 153 180 * 154 181 * @return bool: True for success, false for failure. 155 182 */ 156 bool psMetadataAdd(psMetadata* restrict md, ///< Metadata collection to insert metadat item. 157 int where, ///< Location to be added. 158 const char *name, ///< Name of metadata item. 159 psMetadataType type, ///< Type of metadata item. 160 const char *comment, ///< Comment for metadata item. 161 ... ///< Arguments for name formatting and metadata item data. 162 ); 163 164 /** Remove an item from metadata collection. 165 * 166 * Items may be removed from metadata by specifing a key or location. If the name is null, the where argument 167 * is used instead. If name is not null, where is set to PS_LIST_UNKNOWN. If the item is found, it is removed 168 * from the metadata and true is returned. If the key is not unique, then all items corresponding to it are 169 * removed. 170 * 171 * @return bool: True for success, false for failure. 172 */ 173 bool psMetadataRemove(psMetadata* restrict md, ///< Metadata collection to insert metadat item. 174 int where, ///< Location to be removed. 175 const char *restrict key ///< Name of metadata key. 176 ); 183 bool psMetadataRemove( 184 psMetadata* restrict md, ///< Metadata collection to insert metadat item. 185 int where, ///< Location to be removed. 186 const char *restrict key ///< Name of metadata key. 187 ); 177 188 178 189 /** Find an item in the metadata collection based on key name. 179 190 * 180 * Items may be found in the metadata by providing a key. If the key is non-unique, the first item is 181 * returned. If the item is not found, null is returned. 182 * 183 * @return psMetadataItem* : Pointer metadata item. 184 */ 185 psMetadataItem* psMetadataLookup(psMetadata* restrict md, ///< Metadata collection to insert metadat 186 // item. 187 const char *restrict key ///< Name of metadata key. 188 ); 191 * Items may be found in the metadata by providing a key. If the key is 192 * non-unique, the first item is returned. If the item is not found, null is 193 * returned. 194 * 195 * @return psMetadataItem* : Pointer metadata item. 196 */ 197 psMetadataItem* psMetadataLookup( 198 psMetadata* restrict md, ///< Metadata collection to insert metadata item. 199 const char *restrict key ///< Name of metadata key. 200 ); 189 201 190 202 /** Find an item in the metadata collection based on list index. 191 203 * 192 * Items may be found in the metadata by their entry position in the list container. 193 * 194 * @return psMetadataItem* : Pointer metadata item. 195 */ 196 psMetadataItem* psMetadataGet(psMetadata* restrict md, ///< Metadata collection to insert metadat item. 197 int where ///< Location to be retrieved. 198 ); 204 * Items may be found in the metadata by their entry position in the list 205 * container. 206 * 207 * @return psMetadataItem* : Pointer metadata item. 208 */ 209 psMetadataItem* psMetadataGet( 210 psMetadata* restrict md, ///< Metadata collection to insert metadat item. 211 int where ///< Location to be retrieved. 212 ); 199 213 200 214 /** Set or reset metadata iterator. 201 215 * 202 * Metadata may be iterated by setting or resetting an iterator to a location in the metadata list. 216 * Metadata may be iterated by setting or resetting an iterator to a location 217 * in the metadata list. 203 218 * 204 219 * @return void: void. 205 220 */ 206 bool psMetadataSetIterator(psMetadata* restrict md, ///< Metadata collection to iterate. 207 int where ///< Location of iterator. 208 ); 221 bool psMetadataSetIterator( 222 psMetadata* restrict md, ///< Metadata collection to iterate. 223 int where ///< Location of iterator. 224 ); 209 225 210 226 /** Get next metadata item. … … 214 230 * @return psMetadataItem* : Pointer metadata item. 215 231 */ 216 psMetadataItem* psMetadataGetNext(psMetadata* restrict md, ///< Metadata collection to iterate. 217 const char *restrict match, ///< Beginning of key name. 218 int which ///< Iterator to be used. 219 ); 232 psMetadataItem* psMetadataGetNext( 233 psMetadata* restrict md, ///< Metadata collection to iterate. 234 const char *restrict match, ///< Beginning of key name. 235 int which ///< Iterator to be used. 236 ); 220 237 221 238 /** Get previous metadata item. … … 225 242 * @return psMetadataItem* : Pointer metadata item. 226 243 */ 227 psMetadataItem* psMetadataGetPrevious(psMetadata* restrict md, ///< Metadata collection to iterate. 228 const char *restrict match, ///< Beginning of key name. 229 int which ///< Iterator to be used. 230 ); 244 psMetadataItem* psMetadataGetPrevious( 245 psMetadata* restrict md, ///< Metadata collection to iterate. 246 const char *restrict match, ///< Beginning of key name. 247 int which ///< Iterator to be used. 248 ); 231 249 232 250 /** Print metadata item to file. 233 251 * 234 * Metadata items may be printed to an open file descriptor based on a provided format. The format is a 235 * sprintf format statement with exactly one % formatting command. If the metadata item type is a numeric 236 * type, this formatting command must also be numeric, and the type conversion performed to the value to match 237 * the format type. If the metadata type is a string, the fromatting command must also be for a string. If the 238 * metadata type is any other data type, printing is not allowed. 239 * 240 * @return psMetadataItem* : Pointer metadata item. 241 */ 242 void psMetadataItemPrint(FILE * fd, ///< Pointer to file to write metadata item. 243 const char *format, ///< Format to print metadata item. 244 const psMetadataItem* restrict metadataItem ///< Metadata item to print. 245 ); 252 * Metadata items may be printed to an open file descriptor based on a 253 * provided format. The format is a sprintf format statement with exactly 254 * one % formatting command. If the metadata item type is a numeric type, 255 * this formatting command must also be numeric, and the type conversion 256 * performed to the value to match the format type. If the metadata type is 257 * a string, the fromatting command must also be for a string. If the 258 * metadata type is any other data type, printing is not allowed. 259 * 260 * @return psMetadataItem* : Pointer metadata item. 261 */ 262 void psMetadataItemPrint( 263 FILE * fd, ///< Pointer to file to write metadata item. 264 const char *format, ///< Format to print metadata item. 265 const psMetadataItem* restrict metadataItem ///< Metadata item to print. 266 ); 246 267 247 268 /** Read metadata header. 248 269 * 249 * Read a metadata header from file. If the file is not found, an error is reported. This file is currently 250 * unimplemented. 251 * 252 * @return psMetadata* : Pointer metadata. 253 */ 254 psMetadata* psMetadataReadHeader(psMetadata* output, ///< Resulting metadata from read. 255 char *extname, ///< File name extension string. 256 int extnum, ///< File name extension number. Starts at 1. 257 char *filename ///< Name of file to read. 258 ); 270 * Read a metadata header from file. If the file is not found, an error is 271 * reported. This file is currently unimplemented. 272 * 273 * @return psMetadata* : Pointer metadata. 274 */ 275 psMetadata* psMetadataReadHeader( 276 psMetadata* output, ///< Resulting metadata from read. 277 char *extname, ///< File name extension string. 278 int extnum, ///< File name extension number. Starts at 1. 279 char *filename ///< Name of file to read. 280 ); 259 281 260 282 /** Read metadata header. 261 283 * 262 * Read a metadata header from file. If the file is not found, an error is reported. 263 * 264 * @return psMetadata* : Pointer metadata. 265 */ 266 psMetadata* psMetadataFReadHeader(psMetadata* output, ///< Resulting metadata from read. 267 char *extName, ///< File name extension string. 268 int extNum, ///< File name extension number. 269 fitsfile * fd ///< Pointer to file to read. 270 ); 284 * Read a metadata header from file. If the file is not found, an error is 285 * reported. 286 * 287 * @return psMetadata* : Pointer metadata. 288 */ 289 psMetadata* psMetadataFReadHeader( 290 psMetadata* output, ///< Resulting metadata from read. 291 char *extName, ///< File name extension string. 292 int extNum, ///< File name extension number. 293 fitsfile * fd ///< Pointer to file to read. 294 ); 271 295 272 296 /// @}
Note:
See TracChangeset
for help on using the changeset viewer.
