2 #ifndef AFW_TABLE_IO_FitsWriter_h_INCLUDED
3 #define AFW_TABLE_IO_FitsWriter_h_INCLUDED
12 namespace lsst {
namespace afw {
namespace table {
namespace io {
34 template <
typename OutputT,
typename ContainerT>
35 static void apply(OutputT & output, std::string
const & mode, ContainerT
const & container,
int flags) {
37 apply(fits, container, flags);
41 template <
typename ContainerT>
42 static void apply(
Fits & fits, ContainerT
const & container,
int flags) {
44 = boost::static_pointer_cast<
BaseTable const>(container.getTable())->makeFitsWriter(&fits, flags);
45 writer->write(container);
55 template <
typename ContainerT>
56 void write(ContainerT
const & container) {
57 std::set<PTR(BaseTable const)> tables;
58 for (
typename ContainerT::const_iterator i = container.begin(); i != container.end(); ++i) {
59 if (i->getTable() != container.getTable()) tables.insert(i->getTable());
61 for (std::set<
PTR(
BaseTable const)>::iterator j = tables.begin(); j != tables.end(); ++j) {
67 pex::exceptions::LogicError,
68 "Cannot save Catalog with heterogenous schemas"
72 _writeTable(container.getTable(), container.size());
73 for (
typename ContainerT::const_iterator i = container.begin(); i != container.end(); ++i) {
99 struct ProcessRecords;
108 #endif // !AFW_TABLE_IO_FitsWriter_h_INCLUDED
Writer object for FITS binary tables.
static void apply(OutputT &output, std::string const &mode, ContainerT const &container, int flags)
Driver for writing FITS files.
virtual void _writeRecord(BaseRecord const &source)
Write an individual record.
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
virtual void _finish()
Finish writing a catalog.
boost::shared_ptr< ProcessRecords > _processor
void write(ContainerT const &container)
Write records in a container to disk.
#define LSST_EXCEPT(type,...)
FitsWriter(Fits *fits, int flags)
Construct from a wrapped cfitsio pointer.
virtual void _writeTable(boost::shared_ptr< BaseTable const > const &table, std::size_t nRows)
Write a table and its schema.
Base class for all records.
static void apply(Fits &fits, ContainerT const &container, int flags)
Low-level driver for writing FITS files, operating on an open FITS file.
Base class for all tables.
Include files required for standard LSST Exception handling.