IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 11292


Ignore:
Timestamp:
Jan 25, 2007, 2:05:18 PM (19 years ago)
Author:
jhoblitt
Message:

add first pass nebclient support/linking
change pmConfigConvertFilename() to accept a boolean create [file] parameter

Location:
trunk/psModules
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/configure.ac

    r11253 r11292  
    323323PSMODULES_CFLAGS="${PSMODULES_CFLAGS=} ${PSLIB_CFLAGS}"
    324324PSMODULES_LIBS="${PSMODULES_LIBS=} ${PSLIB_LIBS}"
     325
     326dnl nebclient -----------------------------------------------------------------
     327
     328PKG_CHECK_MODULES([NEBCLIENT], [nebclient >= 0.0.2],
     329    [AC_DEFINE([HAVE_NEBCLIENT], 1, [Define to 1 if libnebclient is avaiable])],    [AC_MSG_RESULT([no])]
     330)
     331
     332PSMODULES_CFLAGS="${PSMODULES_CFLAGS=} ${NEBCLIENT_CFLAGS}"
     333PSMODULES_LIBS="${PSMODULES_LIBS=} ${NEBCLIENT_LIBS}"
    325334
    326335echo "PSMODULES_CFLAGS: $PSMODULES_CFLAGS"
  • trunk/psModules/src/camera/pmFPA_JPEG.c

    r10883 r11292  
    55 *  @author EAM, IfA
    66 *
    7  *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2007-01-03 03:18:21 $
     7 *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2007-01-26 00:05:17 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    207207
    208208    psString name = pmFPAfileNameFromRule (file->filerule, file, view);
    209     psString newName = pmConfigConvertFilename (name, config);
     209    bool create = file->mode == PM_FPA_MODE_WRITE ? true : false;
     210    psString newName = pmConfigConvertFilename(name, config, create);
    210211
    211212    psImageJpegColormap *map = psImageJpegColormapSet (NULL, colormapName);
  • trunk/psModules/src/camera/pmFPA_MANAPLOT.c

    r10421 r11292  
    55 *  @author EAM, IfA
    66 *
    7  *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2006-12-03 18:48:10 $
     7 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2007-01-26 00:05:17 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    136136    // output : filerule
    137137
     138    bool create = file->mode == PM_FPA_MODE_WRITE ? true : false;
     139
    138140    psString tmpName;
    139141    tmpName = pmFPAfileNameFromRule (file->filextra, file, view);
    140     psString input = pmConfigConvertFilename (tmpName, config);
     142    psString input = pmConfigConvertFilename (tmpName, config, create);
    141143    psFree (tmpName);
    142144
    143145    tmpName = pmFPAfileNameFromRule (file->filerule, file, view);
    144     psString output = pmConfigConvertFilename (tmpName, config);
     146    psString output = pmConfigConvertFilename (tmpName, config, create);
    145147    psFree (tmpName);
    146148
    147149    tmpName = pmFPAfileNameFromRule (file->extname, file, view);
    148     psString script = pmConfigConvertFilename (tmpName, config);
     150    psString script = pmConfigConvertFilename (tmpName, config, create);
    149151    psFree (tmpName);
    150152
  • trunk/psModules/src/camera/pmFPAfileDefine.c

    r11255 r11292  
    286286    }
    287287
    288     psString realName = pmConfigConvertFilename (infiles->data[0], config);
     288    bool create = file->mode == PM_FPA_MODE_WRITE ? true : false;
     289    psString realName = pmConfigConvertFilename (infiles->data[0], config, create);
    289290    if (!realName) {
    290291        psError(PS_ERR_IO, false, "Failed to convert file name %s\n", (char *) infiles->data[0]);
     
    366367    for (int i = 0; i < infiles->n; i++) {
    367368        if (i > 0) {
    368             psString realName = pmConfigConvertFilename (infiles->data[i], config);
     369            bool create = file->mode == PM_FPA_MODE_WRITE ? true : false;
     370            psString realName = pmConfigConvertFilename (infiles->data[i], config, create);
    369371            if (!realName) {
    370372                psError(PS_ERR_IO, false, "Failed to convert file name %s", (char *) infiles->data[i]);
     
    490492    // save the association on file->names
    491493    for (int i = 0; i < infiles->n; i++) {
    492         psString realName = pmConfigConvertFilename (infiles->data[i], config);
     494        bool create = file->mode == PM_FPA_MODE_WRITE ? true : false;
     495        psString realName = pmConfigConvertFilename (infiles->data[i], config, create);
    493496        if (!realName) {
    494497            psError(PS_ERR_IO, false, "Failed to convert file name %s", (char *) infiles->data[i]);
     
    724727
    725728    // Prepend the global path to the file rule
    726     psString tmpName = pmConfigConvertFilename (file->filerule, config);
     729    bool create = file->mode == PM_FPA_MODE_WRITE ? true : false;
     730    psString tmpName = pmConfigConvertFilename (file->filerule, config, create);
    727731    psFree (file->filerule);
    728732    file->filerule = tmpName;
  • trunk/psModules/src/camera/pmFPAfileIO.c

    r11255 r11292  
    239239
    240240    // apply filename mangling rules (file://, path://, neb://)
    241     psString tmpName = pmConfigConvertFilename (file->filename, config);
     241    bool create = file->mode == PM_FPA_MODE_WRITE ? true : false;
     242    psString tmpName = pmConfigConvertFilename (file->filename, config, create);
    242243    psFree (file->filename);
    243244    file->filename = tmpName;
  • trunk/psModules/src/config/pmConfig.c

    r11245 r11292  
    44 *  @author EAM (IfA)
    55 *
    6  *  @version $Revision: 1.73 $ $Name: not supported by cvs2svn $
    7  *  @date $Date: 2007-01-23 03:19:35 $
     6 *  @version $Revision: 1.74 $ $Name: not supported by cvs2svn $
     7 *  @date $Date: 2007-01-26 00:05:18 $
    88 *
    99 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2424#include <glob.h>
    2525#include <pslib.h>
     26
    2627#include "pmConfig.h"
     28#include "pmErrorCodes.h"
    2729#include "pmConfigRecipes.h"
    2830#include "pmConfigCamera.h"
     31
     32#ifdef HAVE_NEBCLIENT
     33#include <nebclient.h>
     34#endif // ifdef HAVE_NEBCLIENT
    2935
    3036#define PS_SITE "PS_SITE"         // Name of the environment variable containing the site config file
     
    10471053
    10481054// convert the supplied name, create a new output psString
    1049 psString pmConfigConvertFilename(const char *filename, const pmConfig *config)
     1055psString pmConfigConvertFilename(const char *filename, const pmConfig *config, bool create)
    10501056{
    10511057    PS_ASSERT_STRING_NON_EMPTY(filename, NULL);
    10521058    PS_ASSERT_PTR_NON_NULL(config, NULL);
    10531059
    1054     psString newName = psStringCopy (filename);
    1055 
    10561060    // strip file:// from front of name
    1057     if (!strncasecmp (newName, "file:", strlen("file:"))) {
     1061    if (!strncasecmp(filename, "file:", strlen("file:"))) {
     1062        psString newName = psStringCopy(filename);
     1063
    10581064        char *point = newName + strlen("file:");
    10591065        while (*point == '/')
     
    10631069        psFree (newName);
    10641070        newName = tmpName;
     1071
     1072        return newName;
    10651073    }
    10661074
    10671075    // replace path://PATH with matched datapath
    1068     if (!strncasecmp (newName, "path://", strlen("path://"))) {
     1076    if (!strncasecmp(filename, "path://", strlen("path://"))) {
    10691077        PS_ASSERT_METADATA_NON_NULL(config->site, NULL);
     1078
     1079        psString newName = psStringCopy(filename);
    10701080
    10711081        // filename should be of the form: path://PATH/rest/of/file
     
    11021112        psFree(newName);
    11031113        newName = tmpName;
     1114
     1115        return newName;
    11041116    }
    11051117
    11061118    // substitute neb://name with matched nebulous name
    1107 
    1108     return newName;
    1109 }
     1119    if (!strncasecmp(filename, "neb://", strlen("neb://"))) {
     1120        #ifdef HAVE_NEBCLIENT
     1121
     1122        bool status = false;
     1123        psString nebulous_server = psMetadataLookupStr(&status, config->site, "NEBULOUS_SERVER");
     1124        if (!status) {
     1125            psError(PM_ERR_CONFIG, true, "failed to lookup config value for NEBULOUS_SERVER.");
     1126            return NULL;
     1127        }
     1128        if (!nebulous_server) {
     1129            psError(PM_ERR_CONFIG, true, "Could not determine nebulous server URI.");
     1130            return NULL;
     1131        }
     1132
     1133        nebServer *server = nebServerAlloc(nebulous_server);
     1134        if (!server) {
     1135            psError(PM_ERR_SYS, true, "failed to create a nebServer object.");
     1136            nebServerFree(server);
     1137            return NULL;
     1138        }
     1139
     1140        psString newName = psStringCopy(filename);
     1141
     1142        // for for the nebulous key
     1143        char *foo = nebFind(server, newName);
     1144        // if it doesn't exist, create it
     1145        if (!foo) {
     1146            foo = nebCreate(server, newName, 0, NULL, NULL, NULL);
     1147        }
     1148
     1149        psFree(newName);
     1150        psString newFoo = psStringCopy(foo);
     1151        psFree(foo);
     1152        nebServerFree(server);
     1153
     1154        return newFoo;
     1155
     1156        #else // ifdef HAVE_NEBCLIENT
     1157
     1158        psError(PM_ERR_PROG, true, "psModules was compiled without nebulous support.");
     1159        return NULL;
     1160        #endif // ifdef HAVE_NEBCLIENT
     1161
     1162    }
     1163
     1164    // if we go this far, do nothing
     1165    return psStringCopy(filename);
     1166}
  • trunk/psModules/src/config/pmConfig.h

    r11251 r11292  
    55 *  @author Eugene Magnier, IfA
    66 *
    7  *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2007-01-24 01:05:41 $
     7 *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2007-01-26 00:05:18 $
    99 *  Copyright 2005-2006 Institute for Astronomy, University of Hawaii
    1010 */
     
    155155
    156156/// Convert the supplied name, create a new output psString
    157 psString pmConfigConvertFilename(const char *filename, const pmConfig *config);
     157psString pmConfigConvertFilename(
     158    const char *filename,               ///< file path/URI
     159    const pmConfig *config,             ///< configuration
     160    bool create                         ///< create the file if it doesn't exist
     161);
    158162
    159163/// Set whether all config parameters are read on startup
  • trunk/psModules/src/objects/pmPSF_IO.c

    r10421 r11292  
    66 *  @author EAM, IfA
    77 *
    8  *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2006-12-03 18:48:10 $
     8 *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2007-01-26 00:05:18 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    204204    case PM_FPA_FILE_PSF:
    205205        filename = pmFPAfileNameFromRule (file->filerule, file, view);
    206         realname = pmConfigConvertFilename (filename, config);
     206        bool create = file->mode == PM_FPA_MODE_WRITE ? true : false;
     207        realname = pmConfigConvertFilename (filename, config, create);
    207208
    208209        psMetadata *psfData = pmPSFtoMetadata (NULL, psf);
     
    308309    case PM_FPA_FILE_PSF:
    309310        filename = pmFPAfileNameFromRule (file->filerule, file, view);
    310         realname = pmConfigConvertFilename (filename, config);
     311        bool create = file->mode == PM_FPA_MODE_WRITE ? true : false;
     312        realname = pmConfigConvertFilename (filename, config, create);
    311313
    312314        psMetadata *psfData = psMetadataConfigRead(NULL, &Nfail, realname, FALSE);
  • trunk/psModules/src/objects/pmSourceIO.c

    r11246 r11292  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2007-01-23 03:20:13 $
     5 *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2007-01-26 00:05:18 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    182182        return false;
    183183
     184    bool create = file->mode == PM_FPA_MODE_WRITE ? true : false;
     185
    184186    switch (file->type) {
    185187    case PM_FPA_FILE_RAW:
    186188        filename = pmFPAfileNameFromRule (file->filerule, file, view);
    187         realname = pmConfigConvertFilename (filename, config);
     189        realname = pmConfigConvertFilename (filename, config, create);
    188190        pmSourcesWriteRAW (sources, realname);
    189191        psFree (realname);
     
    193195    case PM_FPA_FILE_OBJ:
    194196        filename = pmFPAfileNameFromRule (file->filerule, file, view);
    195         realname = pmConfigConvertFilename (filename, config);
     197        realname = pmConfigConvertFilename (filename, config, create);
    196198        pmSourcesWriteOBJ (sources, realname);
    197199        psFree (realname);
     
    201203    case PM_FPA_FILE_SX:
    202204        filename = pmFPAfileNameFromRule (file->filerule, file, view);
    203         realname = pmConfigConvertFilename (filename, config);
     205        realname = pmConfigConvertFilename (filename, config, create);
    204206        pmSourcesWriteSX (sources, realname);
    205207        psFree (realname);
     
    211213        hdu = pmFPAviewThisHDU (view, file->fpa);
    212214        filename = pmFPAfileNameFromRule (file->filerule, file, view);
    213         realname = pmConfigConvertFilename (filename, config);
     215        realname = pmConfigConvertFilename (filename, config, create);
    214216
    215217        // copy the header to an output header, add the output header data
     
    452454        }
    453455
    454         psString realname = pmConfigConvertFilename (file->filename, config);
     456        bool create = file->mode == PM_FPA_MODE_WRITE ? true : false;
     457        psString realname = pmConfigConvertFilename (file->filename, config, create);
    455458
    456459        file->fits = psFitsOpen (realname, "r");
Note: See TracChangeset for help on using the changeset viewer.