Changeset 192


Ignore:
Timestamp:
01/14/05 11:06:15 (20 years ago)
Author:
kil064
Message:

adjust to allow FITSImage writing (use SDFITSImageWriter)
delete pointer in destructor

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDWriter.cc

    r125 r192  
    1 //#---------------------------------------------------------------------------
     1 //#---------------------------------------------------------------------------
    22//# SDWriter.cc: ASAP class to write out single dish spectra.
    33//#---------------------------------------------------------------------------
     
    4343#include "SDMemTable.h"
    4444#include "SDWriter.h"
     45#include "SDFITSImageWriter.h"
    4546
    4647using namespace casa;
     
    5455{
    5556  cFormat = format;
    56 
     57//
    5758  if (cFormat == "MS2") {
    5859    cWriter = new PKSMS2writer();
    59   } else {
     60  } else if (cFormat == "SDFITS") {
    6061    cWriter = new PKSSDwriter();
     62  } else if (cFormat == "FITS") {
     63    cWriter = 0;
    6164  }
    6265}
     
    6871SDWriter::~SDWriter()
    6972{
    70   // Nothing.
     73   if (cWriter) {
     74     delete cWriter;
     75   }
    7176}
    7277
     
    7580// Reset the output format.
    7681
    77 Int SDWriter::setFormat(
    78         const std::string &format)
     82Int SDWriter::setFormat(const std::string &format)
    7983{
    8084  if (format != cFormat) {
    81     delete cWriter;
    82 
     85    if (cWriter) delete cWriter;
     86//
    8387    cFormat = format;
    8488    if (cFormat == "MS2") {
    8589      cWriter = new PKSMS2writer();
    86     } else {
     90    } else if (cFormat == "SDFITS") {
    8791      cWriter = new PKSSDwriter();
     92    } else if (cFormat == "FITS") {
     93      cWriter = 0;
    8894    }
    8995  }
    90 
    9196  return 0;
    9297}
     
    97102// finished.
    98103
    99 Int SDWriter::write(
    100         const CountedPtr<SDMemTable> table,
    101         const std::string &filename)
    102 {
     104Int SDWriter::write(const CountedPtr<SDMemTable> table,
     105                    const std::string &filename)
     106{
     107
     108// Image FITS
     109
     110  if (cFormat=="FITS") {
     111     Bool verbose = True;
     112     SDFITSImageWriter iw;
     113     if (iw.write(*table, filename, verbose)) {
     114        return 0;
     115     } else {
     116        return 1;
     117     }
     118  }
     119
     120// MS or SDFITS
     121
    103122  // Extract the header from the table.
    104123  SDHeader hdr = table->getSDHeader();
  • trunk/src/SDWriter.h

    r125 r192  
    4949  ~SDWriter();
    5050
     51// Format can be "SDIFTS", "FITS", or "MS2"
    5152  casa::Int setFormat(const string &format = "SDFITS");
    5253  casa::Int write(const casa::CountedPtr<SDMemTable> table,
Note: See TracChangeset for help on using the changeset viewer.