Changeset 1443 for trunk/src


Ignore:
Timestamp:
09/01/08 11:54:04 (16 years ago)
Author:
Malte Marquarding
Message:

Fix ticket #127; still have to add class header hack

Location:
trunk/src
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STWriter.cpp

    r1410 r1443  
    4747#include <tables/Tables/ArrayColumn.h>
    4848
    49 //#include "SDFITSImageWriter.h"
     49#include "STFITSImageWriter.h"
    5050#include "STAsciiWriter.h"
    5151#include "STHeader.h"
     
    5858STWriter::STWriter(const std::string &format)
    5959{
     60  format_ = format;
     61  String t(format_);
     62  t.upcase();
     63  if (t == "MS2") {
     64    writer_ = new PKSMS2writer();
     65  } else if (t == "SDFITS") {
     66    writer_ = new PKSSDwriter();
     67  } else if (t == "ASCII" || t == "FITS" || t == "CLASS") {
     68    writer_ = 0;
     69  } else {
     70    throw (AipsError("Unrecognized export format"));
     71  }
     72}
     73
     74STWriter::~STWriter()
     75{
     76   if (writer_) {
     77     delete writer_;
     78   }
     79}
     80
     81Int STWriter::setFormat(const std::string &format)
     82{
     83  if (format != format_) {
     84    if (writer_) delete writer_;
     85  }
     86
    6087  format_ = format;
    6188  String t(format_);
     
    6592  } else if (t== "SDFITS") {
    6693    writer_ = new PKSSDwriter();
    67   } else if (t== "ASCII") {
    68     writer_ = 0;
    69   } else {
    70     throw (AipsError("Unrecognized export format"));
    71   }
    72 }
    73 
    74 STWriter::~STWriter()
    75 {
    76    if (writer_) {
    77      delete writer_;
    78    }
    79 }
    80 
    81 Int STWriter::setFormat(const std::string &format)
    82 {
    83   if (format != format_) {
    84     if (writer_) delete writer_;
    85   }
    86 
    87   format_ = format;
    88   String t(format_);
    89   t.upcase();
    90   if (t== "MS2") {
    91     writer_ = new PKSMS2writer();
    92   } else if (t== "SDFITS") {
    93     writer_ = new PKSSDwriter();
    94   } else if (t== "ASCII") {
     94  } else if (t == "ASCII" || t == "FITS" || t == "CLASS") {
    9595    writer_ = 0;
    9696  } else {
     
    110110    } else {
    111111      return 1;
     112    }
     113  } else if ( format_ == "FITS" || format_ == "CLASS") {
     114    STFITSImageWriter iw;
     115    if (format_ == "CLASS") {
     116      iw.setClass(True);
     117    }
     118    if (iw.write(*in, filename)) {
     119      return 0;
    112120    }
    113121  }
Note: See TracChangeset for help on using the changeset viewer.