LSSTApplications  11.0-13-gbb96280,12.1+18,12.1+7,12.1-1-g14f38d3+72,12.1-1-g16c0db7+5,12.1-1-g5961e7a+84,12.1-1-ge22e12b+23,12.1-11-g06625e2+4,12.1-11-g0d7f63b+4,12.1-19-gd507bfc,12.1-2-g7dda0ab+38,12.1-2-gc0bc6ab+81,12.1-21-g6ffe579+2,12.1-21-gbdb6c2a+4,12.1-24-g941c398+5,12.1-3-g57f6835+7,12.1-3-gf0736f3,12.1-37-g3ddd237,12.1-4-gf46015e+5,12.1-5-g06c326c+20,12.1-5-g648ee80+3,12.1-5-gc2189d7+4,12.1-6-ga608fc0+1,12.1-7-g3349e2a+5,12.1-7-gfd75620+9,12.1-9-g577b946+5,12.1-9-gc4df26a+10
LSSTDataManagementBasePackage
InputArchive.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 #ifndef AFW_TABLE_IO_InputArchive_h_INCLUDED
3 #define AFW_TABLE_IO_InputArchive_h_INCLUDED
4 
5 #include <map>
6 
7 #include "lsst/base.h"
9 
10 namespace lsst { namespace afw { namespace table {
11 
12 class BaseRecord;
13 template <typename RecordT> class CatalogT;
14 typedef CatalogT<BaseRecord> BaseCatalog;
15 
16 namespace io {
17 
18 class CatalogVector;
19 
28 class InputArchive {
29 public:
30 
31  typedef std::map<int,PTR(Persistable)> Map;
32 
34  InputArchive();
35 
37  InputArchive(BaseCatalog const & index, CatalogVector const & dataCatalogs);
38 
40  InputArchive(InputArchive const & other);
41 
43  InputArchive & operator=(InputArchive const & other);
44 
45  ~InputArchive();
46 
52  PTR(Persistable) get(int id) const;
53 
55  template <typename T>
56  PTR(T) get(int id) const {
57  PTR(T) p = std::dynamic_pointer_cast<T>(get(id));
58  LSST_ARCHIVE_ASSERT(p || id == 0);
59  return p;
60  }
61 
63  Map const & getAll() const;
64 
70  static InputArchive readFits(fits::Fits & fitsfile);
71 
72 private:
73 
74  class Impl;
75 
76  InputArchive(PTR(Impl) impl);
77 
78  PTR(Impl) _impl;
79 };
80 
81 }}}} // namespace lsst::afw::table::io
82 
83 #endif // !AFW_TABLE_IO_InputArchive_h_INCLUDED
InputArchive()
Construct an empty InputArchive that contains no objects.
boost::shared_ptr< Persistable > get(int id) const
Load the Persistable with the given ID and return it.
InputArchive & operator=(InputArchive const &other)
Assignment. Does not deep-copy loaded Persistables.
static InputArchive readFits(fits::Fits &fitsfile)
Read an object from an already open FITS object.
CatalogT< BaseRecord > BaseCatalog
Definition: fwd.h:61
#define LSST_ARCHIVE_ASSERT(EXPR)
An assertion macro used to validate the structure of an InputArchive.
Definition: Persistable.h:45
A custom container class for records, based on std::vector.
Definition: Catalog.h:95
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
Definition: fits.h:202
A base class for objects that can be persisted via afw::table::io Archive classes.
Definition: Persistable.h:72
Map const & getAll() const
Load and return all objects in the archive.
A vector of catalogs used by Persistable.
Definition: CatalogVector.h:26
std::map< int, boost::shared_ptr< Persistable > > Map
Definition: InputArchive.h:31
#define PTR(...)
Definition: base.h:41
int id
Definition: CR.cc:156
boost::shared_ptr< Impl > _impl
Definition: InputArchive.h:78
A multi-catalog archive object used to load table::io::Persistable objects.
Definition: InputArchive.h:28
Basic LSST definitions.