Loading [MathJax]/extensions/tex2jax.js
LSST Applications g04a91732dc+9666464c73,g0fba68d861+d6c6f70ffa,g1fd858c14a+94f68680cf,g208c678f98+1ca806343c,g271391ec13+ac98094cfc,g2c84ff76c0+120a924478,g2c9e612ef2+a92a2e6025,g35bb328faa+fcb1d3bbc8,g4d2262a081+7c332456db,g4e0f332c67+c58e4b632d,g53246c7159+fcb1d3bbc8,g60b5630c4e+a92a2e6025,g67b6fd64d1+9d1b2ab50a,g78460c75b0+2f9a1b4bcd,g786e29fd12+cf7ec2a62a,g7b71ed6315+fcb1d3bbc8,g8852436030+506db7da85,g89139ef638+9d1b2ab50a,g8d6b6b353c+a92a2e6025,g9125e01d80+fcb1d3bbc8,g989de1cb63+9d1b2ab50a,g9f33ca652e+d1749da127,ga2b97cdc51+a92a2e6025,gabe3b4be73+1e0a283bba,gb1101e3267+6ecbd0580e,gb58c049af0+f03b321e39,gb89ab40317+9d1b2ab50a,gb90eeb9370+384e1fc23b,gcf25f946ba+506db7da85,gd315a588df+382ef11c06,gd6cbbdb0b4+75aa4b1db4,gd9a9a58781+fcb1d3bbc8,gde0f65d7ad+9984fb7d9e,ge278dab8ac+c61fbefdff,ge410e46f29+9d1b2ab50a,ge82c20c137+e12a08b75a,gf67bdafdda+9d1b2ab50a,gfd5510ef7b+864ead200a,v29.0.0.rc2
LSST Data Management Base Package
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Simple.h
Go to the documentation of this file.
1// -*- lsst-c++ -*-
2/*
3 * LSST Data Management System
4 * Copyright 2008, 2009, 2010, 2011 LSST Corporation.
5 *
6 * This product includes software developed by the
7 * LSST Project (http://www.lsst.org/).
8 *
9 * This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the LSST License Statement and
20 * the GNU General Public License along with this program. If not,
21 * see <http://www.lsstcorp.org/LegalNotices/>.
22 */
23#ifndef AFW_TABLE_Simple_h_INCLUDED
24#define AFW_TABLE_Simple_h_INCLUDED
25
33
34namespace lsst {
35namespace afw {
36namespace table {
37
38class SimpleRecord;
39class SimpleTable;
40
96
102class SimpleTable : public BaseTable {
103public:
108
119 static std::shared_ptr<SimpleTable> make(Schema const& schema,
120 std::shared_ptr<IdFactory> const& idFactory);
121
130 return make(schema, IdFactory::makeSimple());
131 }
132
141 Schema r = getMinimalSchema().schema;
142 r.disconnectAliases();
143 return r;
144 }
145
152 static bool checkSchema(Schema const& other) { return other.contains(getMinimalSchema().schema); }
153
156
158 std::shared_ptr<IdFactory const> getIdFactory() const { return _idFactory; }
159
161 void setIdFactory(std::shared_ptr<IdFactory> f) { _idFactory = f; }
162
164
170 static Key<RecordId> getIdKey() { return getMinimalSchema().id; }
172 static CoordKey getCoordKey() { return getMinimalSchema().coord; }
174
177
182
187
192
195 ~SimpleTable() override;
196
197protected:
198 SimpleTable(Schema const& schema, std::shared_ptr<IdFactory> const& idFactory);
199
200 explicit SimpleTable(SimpleTable const& other);
201
202 std::shared_ptr<BaseTable> _clone() const override;
203
205
206private:
207 // Struct that holds the minimal schema and the special keys we've added to it.
208 struct MinimalSchema {
209 Schema schema;
210 Key<RecordId> id;
212
213 MinimalSchema();
214 };
215
216 // Return the singleton minimal schema.
217 static MinimalSchema& getMinimalSchema();
218
219 friend class io::FitsWriter;
220
221 // Return a writer object that knows how to save in FITS format. See also FitsWriter.
222 std::shared_ptr<io::FitsWriter> makeFitsWriter(fits::Fits* fitsfile, int flags) const override;
223
224 std::shared_ptr<IdFactory> _idFactory; // generates IDs for new records
225};
226
229
234
237
240} // namespace table
241} // namespace afw
242} // namespace lsst
243
244#endif // !AFW_TABLE_Simple_h_INCLUDED
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
Definition fits.h:308
Field< T >::Value get(Key< T > const &key) const
Return the value of a field for the given key.
Definition BaseRecord.h:151
std::shared_ptr< BaseTable const > getTable() const
Return the table this record is associated with.
Definition BaseRecord.h:83
BaseRecord(ConstructionToken const &, detail::RecordData &&data)
Construct a record with uninitialized data.
void set(Key< T > const &key, U const &value)
Set value of a field for the given key.
Definition BaseRecord.h:164
std::shared_ptr< BaseRecord > copyRecord(BaseRecord const &input)
Deep-copy a record, requiring that it have the same schema as this table.
Definition BaseTable.cc:128
BaseTable(Schema const &schema, std::shared_ptr< daf::base::PropertyList > metadata=nullptr)
Construct from a schema.
Definition BaseTable.cc:152
A FunctorKey used to get or set celestial coordinates from a pair of lsst::geom::Angle keys.
Definition aggregates.h:292
static std::shared_ptr< IdFactory > makeSimple()
Return a simple IdFactory that simply counts from 1.
Definition IdFactory.cc:70
A class used as a handle to a particular field in a table.
Definition Key.h:53
Defines the fields and offsets for a table.
Definition Schema.h:51
int contains(Schema const &other, int flags=EQUAL_KEYS) const
Test whether the given schema is a subset of this.
Definition Schema.cc:490
A mapping between the keys of two Schemas, used to copy data between them.
Record class that must contain a unique ID field and a celestial coordinate field.
Definition Simple.h:48
lsst::geom::Angle getRa() const
Definition Simple.h:235
void setCoord(lsst::geom::SpherePoint const &coord)
Definition Simple.h:231
SimpleRecord(SimpleRecord &&)=delete
ColumnViewT< SimpleRecord > ColumnView
Definition Simple.h:51
RecordId getId() const
Convenience accessors for the keys in the minimal reference schema.
Definition Simple.h:227
SortedCatalogT< SimpleRecord > Catalog
Definition Simple.h:52
std::shared_ptr< SimpleTable const > getTable() const
Definition Simple.h:68
lsst::geom::SpherePoint getCoord() const
Definition Simple.h:230
SimpleRecord(const SimpleRecord &)=delete
void setId(RecordId id)
Definition Simple.h:228
void setRa(lsst::geom::Angle ra)
Definition Simple.h:236
SimpleRecord & operator=(const SimpleRecord &)=delete
void setDec(lsst::geom::Angle dec)
Definition Simple.h:239
SimpleRecord(ConstructionToken const &token, detail::RecordData &&data)
Constructor used by SimpleTable.
Definition Simple.h:64
SortedCatalogT< const SimpleRecord > ConstCatalog
Definition Simple.h:53
SimpleRecord & operator=(SimpleRecord &&)=delete
lsst::geom::Angle getDec() const
Definition Simple.h:238
Table class that must contain a unique ID field and a celestial coordinate field.
Definition Simple.h:102
static std::shared_ptr< SimpleTable > make(Schema const &schema)
Construct a new table.
Definition Simple.h:129
SimpleTable & operator=(SimpleTable const &)=delete
std::shared_ptr< SimpleTable > clone() const
Return a polymorphic deep copy of the table.
Definition Simple.h:176
static Key< RecordId > getIdKey()
Get keys for standard fields shared by all references.
Definition Simple.h:170
static bool checkSchema(Schema const &other)
Return true if the given schema is a valid SimpleTable schema.
Definition Simple.h:152
std::shared_ptr< BaseTable > _clone() const override
Clone implementation with noncovariant return types.
Definition Simple.cc:108
static Schema makeMinimalSchema()
Return a minimal schema for Simple tables and records.
Definition Simple.h:140
std::shared_ptr< io::FitsWriter > makeFitsWriter(fits::Fits *fitsfile, int flags) const override
Definition Simple.cc:104
std::shared_ptr< BaseRecord > _makeRecord() override
Default-construct an associated record (protected implementation).
Definition Simple.cc:114
static CoordKey getCoordKey()
Key for the celestial coordinates.
Definition Simple.h:172
std::shared_ptr< IdFactory > getIdFactory()
Return the object that generates IDs for the table (may be null).
Definition Simple.h:155
void setIdFactory(std::shared_ptr< IdFactory > f)
Switch to a new IdFactory – object that generates IDs for the table (may be null).
Definition Simple.h:161
static std::shared_ptr< SimpleTable > make(Schema const &schema, std::shared_ptr< IdFactory > const &idFactory)
Construct a new table.
Definition Simple.cc:75
std::shared_ptr< IdFactory const > getIdFactory() const
Return the object that generates IDs for the table (may be null).
Definition Simple.h:158
ColumnViewT< SimpleRecord > ColumnView
Definition Simple.h:105
std::shared_ptr< SimpleRecord > copyRecord(BaseRecord const &other)
Deep-copy a record, requiring that it have the same schema as this table.
Definition Simple.h:184
std::shared_ptr< SimpleRecord > makeRecord()
Default-construct an associated record.
Definition Simple.h:179
SortedCatalogT< Record > Catalog
Definition Simple.h:106
std::shared_ptr< SimpleRecord > copyRecord(BaseRecord const &other, SchemaMapper const &mapper)
Deep-copy a record, requiring that it have the same schema as this table.
Definition Simple.h:189
SortedCatalogT< const Record > ConstCatalog
Definition Simple.h:107
SimpleTable(Schema const &schema, std::shared_ptr< IdFactory > const &idFactory)
Definition Simple.cc:86
SimpleTable & operator=(SimpleTable &&)=delete
Custom catalog class for record/table subclasses that are guaranteed to have an ID,...
Writer object for FITS binary tables.
Definition FitsWriter.h:25
A class representing an angle.
Definition Angle.h:128
Point in an unspecified spherical coordinate system.
Definition SpherePoint.h:57
std::int64_t RecordId
Type used for unique IDs for records.
Definition misc.h:21
STL namespace.
T static_pointer_cast(T... args)
Helper struct that contains the information passed from BaseTable to BaseRecord at construction.
Definition BaseTable.h:32