IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 14, 2006, 6:27:39 PM (20 years ago)
Author:
eugene
Message:

updates to the dvo image/catalog APIs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/libdvo/src/dvo_catalog_create.c

    r8328 r8342  
    1 # include <ohana.h>
    21# include <dvo.h>
    32# define DEBUG 1
    43
    54// create a new dvo catalog file (if split, lock extra files as well?)
    6 void dvo_catalog_create (SkyRegion *region, Catalog *catalog, int Nsecfilt, char *catformat, char *catmode) {
     5// catalog internals which must be set:
     6// catalog[0].filename
     7// catalog[0].catmode
     8// catalog[0].catformat (used by dvo_catalog_save)
     9// catalog[0].lockmode
     10void dvo_catalog_create (SkyRegion *region, Catalog *catalog, int Nsecfilt) {
    711
    8   int length, status;
     12  int length;
    913  char *path, *root, *file, *line;
    1014  time_t now;
     
    1216  if (DEBUG) fprintf (stderr, "new catalog file: %s\n", catalog[0].filename);
    1317
    14   dvo_catalog_init (catalog);
    15 
    16   /* set the recommended CATFORMAT */
    17   catalog[0].catformat = DVO_FORMAT_UNDEF;
    18   if (!strcasecmp (catformat, "INTERNAL"))  catalog[0].catformat = DVO_FORMAT_INTERNAL;
    19   if (!strcasecmp (catformat, "LONEOS"))    catalog[0].catformat = DVO_FORMAT_LONEOS;
    20   if (!strcasecmp (catformat, "ELIXIR"))    catalog[0].catformat = DVO_FORMAT_ELIXIR;
    21   if (!strcasecmp (catformat, "PANSTARRS")) catalog[0].catformat = DVO_FORMAT_PANSTARRS;
    22   if (!strcasecmp (catformat, "PMTEST"))    catalog[0].catformat = DVO_FORMAT_PMTEST;
    23   if (catalog[0].catformat == DVO_FORMAT_UNDEF) {
    24     fprintf (stderr, "invalid output catalog format\n");
    25     exit (1);
    26   }
    27 
    28   /* set the recommended CATMODE */
    29   catalog[0].catmode = DVO_MODE_UNDEF;
    30   if (!strcasecmp (catmode, "RAW"))   catalog[0].catmode = DVO_MODE_RAW;
    31   if (!strcasecmp (catmode, "MEF"))   catalog[0].catmode = DVO_MODE_MEF;
    32   if (!strcasecmp (catmode, "SPLIT")) catalog[0].catmode = DVO_MODE_SPLIT;
    33   if (catalog[0].catmode == DVO_MODE_UNDEF) {
    34     fprintf (stderr, "invalid output catalog mode\n");
    35     exit (1);
    36   }
     18  // init the data values, not the internals listed above
     19  dvo_catalog_init (catalog, FALSE);
    3720
    3821  /* for RAW mode, make header a fake image */
     
    5235    /* define measure catalog file */
    5336    ALLOCATE (catalog[0].measure_catalog, Catalog, 1);
    54     dvo_catalog_init (catalog[0].measure_catalog);
     37    dvo_catalog_init (catalog[0].measure_catalog, TRUE);
    5538
    5639    /* create basic data for measure catalog file */
     
    6447    /* define missing catalog file */
    6548    ALLOCATE (catalog[0].missing_catalog, Catalog, 1);
    66     dvo_catalog_init (catalog[0].missing_catalog);
     49    dvo_catalog_init (catalog[0].missing_catalog, TRUE);
    6750
    6851    /* create basic data for missing catalog file */
     
    7659    /* define secfilt catalog file */
    7760    ALLOCATE (catalog[0].secfilt_catalog, Catalog, 1);
    78     dvo_catalog_init (catalog[0].secfilt_catalog);
     61    dvo_catalog_init (catalog[0].secfilt_catalog, TRUE);
    7962
    8063    /* create basic data for secfilt catalog file */
     
    9073    // lock the additional split files
    9174    // XXX clear residual locks if we fail
    92     if (lock_catalog (catalog[0].measure_catalog, catalog[0].lockmode) != 2) {
     75    if (dvo_catalog_lock (catalog[0].measure_catalog, catalog[0].lockmode) != 2) {
    9376      fprintf (stderr, "error with file lock\n");
    9477      exit (2);
    9578    }
    96     if (lock_catalog (catalog[0].missing_catalog, catalog[0].lockmode) != 2) {
     79    if (dvo_catalog_lock (catalog[0].missing_catalog, catalog[0].lockmode) != 2) {
    9780      fprintf (stderr, "error with file lock\n");
    9881      exit (2);
    9982    }
    100     if (lock_catalog (catalog[0].secfilt_catalog, catalog[0].lockmode) != 2) {
     83    if (dvo_catalog_lock (catalog[0].secfilt_catalog, catalog[0].lockmode) != 2) {
    10184      fprintf (stderr, "error with file lock\n");
    10285      exit (2);
Note: See TracChangeset for help on using the changeset viewer.