source: trunk/src/Outputs/CatalogueWriter.hh @ 1064

Last change on this file since 1064 was 1064, checked in by MatthewWhiting, 12 years ago

Continuing Ticket #162 -- moving to the use of CatalogueSpecification?. Also fixing a bug where the VOTable column ID string was not being set (identified via the verification script!).

File size: 3.2 KB
RevLine 
[1046]1#ifndef DUCHAMP_CATALOGUE_WRITER_H_
2#define DUCHAMP_CATALOGUE_WRITER_H_
3
[1049]4#include <ios>
[1046]5#include <string>
[1048]6#include <vector>
[1046]7#include <duchamp/param.hh>
[1048]8#include <duchamp/fitsHeader.hh>
[1046]9#include <duchamp/Detection/detection.hh>
[1061]10#include <duchamp/Outputs/columns.hh>
[1048]11#include <duchamp/Utils/Statistics.hh>
12#include <duchamp/Cubes/cubes.hh>
[1046]13
14namespace duchamp {
15
[1050]16  /// @brief Base class for writing out catalogues. 
17  /// @details This class forms the basis for derived classes that
18  /// handle writing of the catalogue to different types of files. The
19  /// class makes no assumption about the type of output (eg. file or
20  /// stream etc), but it does hold pointers to all the metadata from
21  /// the cube, as well as to the object list. Implementations of the
22  /// individual writing methods is left up to the base class.
[1046]23  class CatalogueWriter
24  {
25  public:
26    CatalogueWriter();
27    CatalogueWriter(std::string name);
28    CatalogueWriter(const CatalogueWriter& other);
29    CatalogueWriter& operator= (const CatalogueWriter& other);
30    virtual ~CatalogueWriter(){};
31   
32    /// @brief open the catalogue for writing
[1049]33    virtual bool openCatalogue(std::ios_base::openmode mode = std::ios_base::out )=0;
[1046]34
35    /// @brief Write header information - not including parameters
36    virtual void writeHeader() = 0;
37
[1050]38    /// @brief Write the input parameters
[1048]39    virtual void writeParameters() = 0;
[1046]40
[1050]41    /// @brief Write out the entire catalogue
42    virtual void writeEntries() = 0;
43
44    /// @brief Write a single catalogue entry based on a detected object
[1048]45    virtual void writeEntry(Detection *object) = 0;
[1050]46   
47    /// @brief Write footer information -- stuff to come after the catalogue table
[1046]48    virtual void writeFooter() = 0;
49
[1050]50    /// @brief Close the catalogue (file/stream/whatever)
[1046]51    virtual bool closeCatalogue() = 0;
52
53    void setName(std::string s){itsName=s;};
54    std::string name(){return itsName;};
55    bool isOpen(){return itsOpenFlag;};
[1064]56    Catalogues::CatalogueSpecification columnSpec(){return *itsColumnSpecification;};
57    void setColumnSpec(Catalogues::CatalogueSpecification *cols){itsColumnSpecification = cols;};
[1048]58    void setParam(Param *par){itsParam=par;};
59    void setStats(Statistics::StatsContainer<float> *stats){itsStats=stats;};
60    void setHead(FitsHeader *head){itsHead=head;};
61    void setObjectList(std::vector<Detection> *objlist){itsObjectList=objlist;};
[1050]62
63    /// @brief Set up the pointers to point to the cube's metadata
[1048]64    void setup(Cube *cube);
[1046]65
66  protected:
[1050]67    /// @brief The name of the output file, if necessary
[1046]68    std::string itsName;
[1050]69    /// @brief Is the output open and suitable for writing
[1046]70    bool        itsOpenFlag;
[1050]71    /// @brief A pointer to the list of column specifications
[1064]72    Catalogues::CatalogueSpecification *itsColumnSpecification;
[1050]73    /// @brief A pointer to the set of input parameters
[1048]74    Param *itsParam;
[1050]75    /// @brief A pointer to the statistics used by the cube
[1048]76    Statistics::StatsContainer<float> *itsStats;
[1050]77    /// @brief A pointer to the fits header description
[1048]78    FitsHeader *itsHead;
[1050]79    /// @brief A pointer to the list of detected objects
[1048]80    std::vector<Detection> *itsObjectList;
[1050]81    /// @brief The cube dimensions
[1049]82    size_t *itsCubeDim;
[1046]83
84  };
85
86}
87
88
89#endif
Note: See TracBrowser for help on using the repository browser.