Changeset 8204
- Timestamp:
- Aug 6, 2006, 5:23:41 PM (20 years ago)
- Location:
- trunk/ippdb
- Files:
-
- 3 edited
-
configure.ac (modified) (1 diff)
-
src/ippdb.c (modified) (3 diffs)
-
src/ippdb.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippdb/configure.ac
r8171 r8204 1 1 AC_PREREQ(2.59) 2 2 3 AC_INIT([ippdb], [0.0.1 8], [pan-starrs.ifa.hawaii.edu])3 AC_INIT([ippdb], [0.0.19], [pan-starrs.ifa.hawaii.edu]) 4 4 AC_CONFIG_SRCDIR([ippdb.pc.in]) 5 5 -
trunk/ippdb/src/ippdb.c
r8171 r8204 3 3 #include "ippdb.h" 4 4 5 #define IPPDB_DEFAULT_INDEX_NAME "position" 5 6 #define WEATHER_TABLE_NAME "weather" 6 #define WEATHER_INDEX_NAME "position"7 #define WEATHER_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME 7 8 #define SKYP_TRANSPARENCY_TABLE_NAME "skyp_transparency" 8 #define SKYP_TRANSPARENCY_INDEX_NAME "position"9 #define SKYP_TRANSPARENCY_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME 9 10 #define SKYP_ABSORPTION_TABLE_NAME "skyp_absorption" 10 #define SKYP_ABSORPTION_INDEX_NAME "position"11 #define SKYP_ABSORPTION_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME 11 12 #define SKYP_EMISSION_TABLE_NAME "skyp_emission" 12 #define SKYP_EMISSION_INDEX_NAME "position"13 #define SKYP_EMISSION_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME 13 14 #define DIMM_TABLE_NAME "dimm" 14 #define DIMM_INDEX_NAME "position"15 #define DIMM_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME 15 16 #define SKYP_IR_TABLE_NAME "skyp_ir" 16 #define SKYP_IR_INDEX_NAME "position"17 #define SKYP_IR_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME 17 18 #define DOME_TABLE_NAME "dome" 18 #define DOME_INDEX_NAME "position"19 #define DOME_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME 19 20 #define TELESCOPE_TABLE_NAME "telescope" 20 #define TELESCOPE_INDEX_NAME "position"21 #define TELESCOPE_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME 21 22 #define SUMMITEXP_TABLE_NAME "summitExp" 22 #define SUMMITEXP_INDEX_NAME "position"23 #define SUMMITEXP_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME 23 24 #define PZPENDINGEXP_TABLE_NAME "pzPendingExp" 24 #define PZPENDINGEXP_INDEX_NAME "position"25 #define PZPENDINGEXP_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME 25 26 #define PZPENDINGIMFILE_TABLE_NAME "pzPendingImfile" 26 #define PZPENDINGIMFILE_INDEX_NAME "position"27 #define PZPENDINGIMFILE_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME 27 28 #define NEWEXP_TABLE_NAME "newExp" 28 #define NEWEXP_INDEX_NAME "position"29 #define NEWEXP_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME 29 30 #define NEWIMFILE_TABLE_NAME "newImfile" 30 #define NEWIMFILE_INDEX_NAME "position"31 #define NEWIMFILE_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME 31 32 #define RAWDETRENDEXP_TABLE_NAME "rawDetrendExp" 32 #define RAWDETRENDEXP_INDEX_NAME "position"33 #define RAWDETRENDEXP_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME 33 34 #define RAWSCIENCEEXP_TABLE_NAME "rawScienceExp" 34 #define RAWSCIENCEEXP_INDEX_NAME "position"35 #define RAWSCIENCEEXP_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME 35 36 #define RAWIMFILE_TABLE_NAME "rawImfile" 36 #define RAWIMFILE_INDEX_NAME "position"37 #define RAWIMFILE_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME 37 38 #define P1PENDINGEXP_TABLE_NAME "p1PendingExp" 38 #define P1PENDINGEXP_INDEX_NAME "position"39 #define P1PENDINGEXP_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME 39 40 #define P2PENDINGEXP_TABLE_NAME "p2PendingExp" 40 #define P2PENDINGEXP_INDEX_NAME "position"41 #define P2PENDINGEXP_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME 41 42 #define P2PENDINGIMFILE_TABLE_NAME "p2PendingImfile" 42 #define P2PENDINGIMFILE_INDEX_NAME "position"43 #define P2PENDINGIMFILE_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME 43 44 #define P2DONEEXP_TABLE_NAME "p2DoneExp" 44 #define P2DONEEXP_INDEX_NAME "position"45 #define P2DONEEXP_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME 45 46 #define P2DONEIMFILE_TABLE_NAME "p2DoneImfile" 46 #define P2DONEIMFILE_INDEX_NAME "position"47 #define P2DONEIMFILE_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME 47 48 #define P3PENDINGEXP_TABLE_NAME "p3PendingExp" 48 #define P3PENDINGEXP_INDEX_NAME "position"49 #define P3PENDINGEXP_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME 49 50 #define DETRUN_TABLE_NAME "detRun" 50 #define DETRUN_INDEX_NAME "position"51 #define DETRUN_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME 51 52 #define DETINPUTEXP_TABLE_NAME "detInputExp" 52 #define DETINPUTEXP_INDEX_NAME "position"53 #define DETINPUTEXP_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME 53 54 #define DETPROCESSEDIMFILE_TABLE_NAME "detProcessedImfile" 54 #define DETPROCESSEDIMFILE_INDEX_NAME "position"55 #define DETPROCESSEDIMFILE_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME 55 56 #define DETSTACKEDIMFILE_TABLE_NAME "detStackedImfile" 56 #define DETSTACKEDIMFILE_INDEX_NAME "position"57 #define DETSTACKEDIMFILE_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME 57 58 #define DETNORMALIZEDIMFILE_TABLE_NAME "detNormalizedImfile" 58 #define DETNORMALIZEDIMFILE_INDEX_NAME "position"59 #define DETNORMALIZEDIMFILE_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME 59 60 #define DETMASTERFRAME_TABLE_NAME "detMasterFrame" 60 #define DETMASTERFRAME_INDEX_NAME "position"61 #define DETMASTERFRAME_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME 61 62 #define DETMASTERIMFILE_TABLE_NAME "detMasterImfile" 62 #define DETMASTERIMFILE_INDEX_NAME "position"63 #define DETMASTERIMFILE_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME 63 64 #define DETRESIDIMFILEANALYSIS_TABLE_NAME "detResidImfileAnalysis" 64 #define DETRESIDIMFILEANALYSIS_INDEX_NAME "position"65 #define DETRESIDIMFILEANALYSIS_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME 65 66 #define DETRESIDEXPANALYSIS_TABLE_NAME "detResidExpAnalysis" 66 #define DETRESIDEXPANALYSIS_INDEX_NAME "position"67 #define DETRESIDEXPANALYSIS_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME 67 68 #define MAX_STRING_LENGTH 1024 68 69 … … 75 76 { 76 77 psDBCleanup(dbh); 78 } 79 80 bool ippdbPrintMetadata(FILE *stream, psMetadata *md, bool mdconfigformat) 81 { 82 PS_ASSERT_PTR_NON_NULL(md, false); 83 84 psMetadata *clean = psMetadataCopy(NULL, md); 85 86 // don't bother to check the return status as the key we are trying to 87 // remove may or may not be there 88 // XXX someday psErr should be checked -- the only acceptable error is key 89 // not found 90 psMetadataRemoveKey(clean, IPPDB_DEFAULT_INDEX_NAME); 91 92 if (!ippdbPrintMetadataRaw(stream, clean, mdconfigformat)) { 93 psError(PS_ERR_UNKNOWN, false, "failed to print metadata"); 94 psFree(clean); 95 return false; 96 } 97 psFree(clean); 98 99 return true; 100 } 101 102 bool ippdbPrintMetadataRaw(FILE *stream, psMetadata *md, bool mdconfigformat) 103 { 104 PS_ASSERT_PTR_NON_NULL(md, false); 105 106 psString str = psMetadataConfigFormat(md); 107 if (!str) { 108 psError(PS_ERR_UNKNOWN, false, "failed to format data into a string"); 109 } 110 fprintf(stream, "%s\n", str); 111 psFree(str); 112 113 return true; 77 114 } 78 115 … … 82 119 PS_ASSERT_PTR_NON_NULL(mdname, false); 83 120 84 psMetadata *output = psMetadataAlloc();85 121 for (long i = 0; i < psArrayLength(mds); i++) { 86 122 psMetadata *md = mds->data[i]; 87 if (!psMetadataAddMetadata( 88 output, 89 PS_LIST_TAIL, 90 mdname, 91 PS_META_DUPLICATE_OK, 92 NULL, 93 md 94 )) { 95 psError(PS_ERR_UNKNOWN, false, "failed to add metadata"); 96 psFree(output); 123 if (!ippdbPrintMetadata(stream, md, mdconfigformat)) { 124 psError(PS_ERR_UNKNOWN, false, "failed to print metadata"); 97 125 return false; 98 126 } 99 127 } 100 128 101 psString str = psMetadataConfigFormat(output); 102 if (!str) { 103 psError(PS_ERR_UNKNOWN, false, "failed to format data into a string"); 104 psFree(output); 105 } 106 psFree(output); 107 fprintf(stream, "%s\n", str); 108 psFree(str); 129 return true; 130 } 131 132 bool ippdbPrintMetadatasRaw(FILE *stream, psArray *mds, const char *mdname, bool mdconfigformat) 133 { 134 PS_ASSERT_PTR_NON_NULL(mds, false); 135 PS_ASSERT_PTR_NON_NULL(mdname, false); 136 137 for (long i = 0; i < psArrayLength(mds); i++) { 138 psMetadata *md = mds->data[i]; 139 if (!ippdbPrintMetadataRaw(stream, md, mdconfigformat)) { 140 psError(PS_ERR_UNKNOWN, false, "failed to print metadata"); 141 return false; 142 } 143 } 109 144 110 145 return true; -
trunk/ippdb/src/ippdb.h
r8161 r8204 31 31 ); 32 32 33 /** Formats and prints an array of metadata 33 /** Formats and prints a metadata 34 * 35 * Any internal use fields are stripped. 34 36 * 35 37 * When mdconfigformat is set the formated output is in psMetadataConfig … … 39 41 */ 40 42 43 bool ippdbPrintMetadata( 44 FILE *stream, ///< a stream 45 psMetadata *md, ///< An array of metadata 46 bool mdconfigformat ///< format as mdconfig or simple 47 ); 48 49 /** Formats and prints a metadata 50 * 51 * The metadata is printed verbatium without removing any fields. 52 * 53 * When mdconfigformat is set the formated output is in psMetadataConfig 54 * format, otherwise it is in a simple tabular format. 55 * 56 * @return true on success 57 */ 58 59 bool ippdbPrintMetadataRaw( 60 FILE *stream, ///< a stream 61 psMetadata *md, ///< An array of metadata 62 bool mdconfigformat ///< format as mdconfig or simple 63 ); 64 65 /** Formats and prints an array of metadata 66 * 67 * Any internal use fields are stripped. 68 * 69 * When mdconfigformat is set the formated output is in psMetadataConfig 70 * format, otherwise it is in a simple tabular format. 71 * 72 * @return true on success 73 */ 74 41 75 bool ippdbPrintMetadatas( 76 FILE *stream, ///< a stream 77 psArray *mds, ///< An array of metadata 78 const char *mdname, ///< name of the metadata(s) 79 bool mdconfigformat ///< format as mdconfig or simple 80 ); 81 82 /** Formats and prints an array of metadata 83 * 84 * The metadatas are printed verbatium without removing any fields. 85 * 86 * When mdconfigformat is set the formated output is in psMetadataConfig 87 * format, otherwise it is in a simple tabular format. 88 * 89 * @return true on success 90 */ 91 92 bool ippdbPrintMetadatasRaw( 42 93 FILE *stream, ///< a stream 43 94 psArray *mds, ///< An array of metadata
Note:
See TracChangeset
for help on using the changeset viewer.
