LSSTApplications
19.0.0-14-gb0260a2+72efe9b372,20.0.0+7927753e06,20.0.0+8829bf0056,20.0.0+995114c5d2,20.0.0+b6f4b2abd1,20.0.0+bddc4f4cbe,20.0.0-1-g253301a+8829bf0056,20.0.0-1-g2b7511a+0d71a2d77f,20.0.0-1-g5b95a8c+7461dd0434,20.0.0-12-g321c96ea+23efe4bbff,20.0.0-16-gfab17e72e+fdf35455f6,20.0.0-2-g0070d88+ba3ffc8f0b,20.0.0-2-g4dae9ad+ee58a624b3,20.0.0-2-g61b8584+5d3db074ba,20.0.0-2-gb780d76+d529cf1a41,20.0.0-2-ged6426c+226a441f5f,20.0.0-2-gf072044+8829bf0056,20.0.0-2-gf1f7952+ee58a624b3,20.0.0-20-geae50cf+e37fec0aee,20.0.0-25-g3dcad98+544a109665,20.0.0-25-g5eafb0f+ee58a624b3,20.0.0-27-g64178ef+f1f297b00a,20.0.0-3-g4cc78c6+e0676b0dc8,20.0.0-3-g8f21e14+4fd2c12c9a,20.0.0-3-gbd60e8c+187b78b4b8,20.0.0-3-gbecbe05+48431fa087,20.0.0-38-ge4adf513+a12e1f8e37,20.0.0-4-g97dc21a+544a109665,20.0.0-4-gb4befbc+087873070b,20.0.0-4-gf910f65+5d3db074ba,20.0.0-5-gdfe0fee+199202a608,20.0.0-5-gfbfe500+d529cf1a41,20.0.0-6-g64f541c+d529cf1a41,20.0.0-6-g9a5b7a1+a1cd37312e,20.0.0-68-ga3f3dda+5fca18c6a4,20.0.0-9-g4aef684+e18322736b,w.2020.45
LSSTDataManagementBasePackage
|
Go to the documentation of this file.
8 #include "boost/format.hpp"
31 typedef Map::value_type MapItem;
44 if (
iter->getSchema().compare(
schema, flags) == flags) {
51 if (!
iter->getTable()->getMetadata()) {
53 iter->getTable()->setMetadata(metadata);
54 metadata->set(
"EXTTYPE",
"ARCHIVE_DATA");
55 metadata->set(
"AR_CATN", catArchive,
"# of this catalog relative to the start of this archive");
62 indexRecord->set(indexKeys.id,
id);
63 indexRecord->set(indexKeys.name,
name);
64 indexRecord->set(indexKeys.module,
module);
70 indexRecord->set(indexKeys.nRows, 0);
79 indexRecord->set(indexKeys.catPersistable, catPersistable);
80 indexRecord->set(indexKeys.nRows, catalog.
size());
90 "All catalogs passed to saveCatalog must be created by makeCatalog");
95 auto names =
iter->getTable()->getMetadata()->getArray<
std::string>(
"AR_NAME");
96 if (
std::find(names.begin(), names.end(),
name) == names.end()) {
97 iter->getTable()->getMetadata()->add(
"AR_NAME",
name,
"Class name for objects stored here");
100 iter->getTable()->getMetadata()->add(
"AR_NAME",
name,
"Class name for objects stored here");
102 indexRecord->set(indexKeys.row0,
iter->size());
103 indexRecord->set(indexKeys.catArchive, catArchive);
119 if (permissive && !obj->isPersistable())
return 0;
124 return put(obj.
get(),
self, permissive);
128 return r.first->second;
134 "# of catalogs in this archive, including the index");
138 iter->writeFits(fitsfile);
144 metadata->set(
"EXTTYPE",
"ARCHIVE_INDEX");
145 metadata->set(
"AR_CATN", 0,
"# of this catalog relative to the start of this archive");
173 if (!_impl.unique()) {
177 return _impl->put(obj, _impl, permissive);
181 if (!_impl.unique()) {
185 return _impl->put(
std::move(obj), _impl, permissive);
191 if (n == 0)
return _impl->_index;
192 if (
std::size_t(n) > _impl->_catalogs.size() || n < 0) {
195 (
boost::format(
"Catalog number %d is out of range [0,%d]") % n % _impl->_catalogs.size())
198 return _impl->_catalogs[n - 1];
212 _impl->saveCatalog(catalog, _id, _name, _module, _catPersistable);
219 return _impl->put(obj, _impl, permissive);
225 return _impl->put(
std::move(obj), _impl, permissive);
230 : _id(
id), _catPersistable(0), _name(
name), _module(
module), _impl(impl) {}
BaseCatalog makeCatalog(Schema const &schema)
int put(std::shared_ptr< Persistable const > obj, std::shared_ptr< Impl > const &self, bool permissive)
virtual std::string getPythonModule() const
Return the fully-qualified Python module that should be imported to guarantee that its factory is reg...
OutputArchive & operator=(OutputArchive const &other)
Assign from another OutputArchive. Saved objects are not deep-copied.
static constexpr int const NO_CATALOGS_SAVED
Special value used for catArchive, catPersistable, and row0 when an object with no state is saved.
BaseCatalog const & getCatalog(int n) const
Return the nth catalog. Catalog 0 is always the index catalog.
int put(std::shared_ptr< Persistable const > obj, bool permissive=false)
Save an object to the archive and return a unique ID that can be used to retrieve it from an InputArc...
An object passed to Persistable::write to allow it to persist itself.
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
Reports attempts to access elements using an invalid key.
void saveCatalog(BaseCatalog const &catalog)
Save a catalog in the archive.
Class for storing ordered metadata with comments.
static ArchiveIndexSchema const & get()
Return the singleton instance.
Defines the fields and offsets for a table.
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
virtual bool isPersistable() const noexcept
Return true if this particular object can be persisted using afw::table::io.
@ EQUAL_KEYS
Keys have the same types offsets, and sizes.
void saveEmpty(int id, std::string const &name, std::string const &module)
BaseCatalog makeCatalog(Schema const &schema)
Return a new, empty catalog with the given schema.
virtual std::string getPersistenceName() const
Return the unique name used to persist this object and look up its factory.
size_type size() const
Return the number of elements in the catalog.
void writeFits(fits::Fits &fitsfile) const
Write the archive to an already-open FITS object.
Reports attempts to exceed implementation-defined length limits for some classes.
Schema for the index catalog that specifies where objects are stored in the data catalogs.
ItemVariant const * other
std::shared_ptr< Table > getTable() const
Return the table associated with the catalog.
Reports errors in the logical structure of the program.
A vector of catalogs used by Persistable.
void saveEmpty()
Indicate that the object being persisted has no state, and hence will never call makeCatalog() or sav...
virtual void write(OutputArchiveHandle &handle) const
Write the object to one or more catalogs.
A multi-catalog archive object used to save table::io::Persistable objects.
A base class for image defects.
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
void writeFits(std::string const &filename, std::string const &mode="w", int flags=0) const
Write a FITS binary table to a regular file.
A base class for objects that can be persisted via afw::table::io Archive classes.
CatalogT< BaseRecord > BaseCatalog
std::shared_ptr< BaseRecord > addIndexRecord(int id, std::string const &name, std::string const &module)
int put(Persistable const *obj, std::shared_ptr< Impl > const &self, bool permissive)
int put(Persistable const *obj, bool permissive=false)
Save an object to the archive and return a unique ID that can be used to retrieve it from an InputArc...
std::shared_ptr< RecordT > addNew()
Create a new record, add it to the end of the catalog, and return a pointer to it.
@ EQUAL_NAMES
Fields have the same names (ordered).
OutputArchiveHandle(const OutputArchiveHandle &)=delete
iterator begin()
Iterator access.
OutputArchive()
Construct an empty OutputArchive containing no objects.
void saveCatalog(BaseCatalog const &catalog, int id, std::string const &name, std::string const &module, int catPersistable)
void writeFits(fits::Fits &fitsfile)
int countCatalogs() const
Return the total number of catalogs, including the index.
BaseCatalog const & getIndexCatalog() const
Return the index catalog that specifies where objects are stored in the data catalogs.