LSST Applications g04e9c324dd+8c5ae1fdc5,g134cb467dc+1b3060144d,g18429d2f64+f642bf4753,g199a45376c+0ba108daf9,g1fd858c14a+2dcf163641,g262e1987ae+7b8c96d2ca,g29ae962dfc+3bd6ecb08a,g2cef7863aa+aef1011c0b,g35bb328faa+8c5ae1fdc5,g3fd5ace14f+53e1a9e7c5,g4595892280+fef73a337f,g47891489e3+2efcf17695,g4d44eb3520+642b70b07e,g53246c7159+8c5ae1fdc5,g67b6fd64d1+2efcf17695,g67fd3c3899+b70e05ef52,g74acd417e5+317eb4c7d4,g786e29fd12+668abc6043,g87389fa792+8856018cbb,g89139ef638+2efcf17695,g8d7436a09f+3be3c13596,g8ea07a8fe4+9f5ccc88ac,g90f42f885a+a4e7b16d9b,g97be763408+ad77d7208f,g9dd6db0277+b70e05ef52,ga681d05dcb+a3f46e7fff,gabf8522325+735880ea63,gac2eed3f23+2efcf17695,gb89ab40317+2efcf17695,gbf99507273+8c5ae1fdc5,gd8ff7fe66e+b70e05ef52,gdab6d2f7ff+317eb4c7d4,gdc713202bf+b70e05ef52,gdfd2d52018+b10e285e0f,ge365c994fd+310e8507c4,ge410e46f29+2efcf17695,geaed405ab2+562b3308c0,gffca2db377+8c5ae1fdc5,w.2025.35
LSST Data Management Base Package
Loading...
Searching...
No Matches
lsst::afw::table::BoxKey< Box > Class Template Reference

A FunctorKey used to get or set a lsst::geom::Box2I or Box2D from a (min, max) pair of Point3Keys. More...

#include <aggregates.h>

Inheritance diagram for lsst::afw::table::BoxKey< Box >:
lsst::afw::table::FunctorKey< Box > lsst::afw::table::OutputFunctorKey< Box > lsst::afw::table::InputFunctorKey< Box >

Public Types

using Element = typename Box::Element
 Type of coordinate elements (i.e. int or double).
 
using Value
 The data type for get and set.
 

Public Member Functions

 BoxKey () noexcept=default
 Default constructor; instance will not be usable unless subsequently assigned to.
 
 BoxKey (PointKey< Element > const &min, PointKey< Element > const &max) noexcept
 Construct from a pair of PointKeys.
 
 BoxKey (SubSchema const &s)
 Construct from a subschema, assuming _min_x, _max_x, _min_y, _max_y subfields.
 
 BoxKey (BoxKey const &) noexcept=default
 
 BoxKey (BoxKey &&) noexcept=default
 
BoxKeyoperator= (BoxKey const &) noexcept=default
 
BoxKeyoperator= (BoxKey &&) noexcept=default
 
 ~BoxKey () noexcept override=default
 
std::size_t hash_value () const noexcept
 Return a hash of this object.
 
Box get (BaseRecord const &record) const override
 Get a Box from the given record.
 
void set (BaseRecord &record, Box const &value) const override
 Set a Box in the given record.
 
bool operator== (BoxKey const &other) const noexcept
 Compare the FunctorKey for equality with another, using the underlying x and y Keys.
 
bool operator!= (BoxKey const &other) const noexcept
 
bool isValid () const noexcept
 Return True if both the min and max PointKeys are valid.
 
PointKey< ElementgetMin () const noexcept
 Return the underlying min PointKey.
 
PointKey< ElementgetMax () const noexcept
 Return the underlying max PointKey.
 

Static Public Member Functions

static BoxKey addFields (Schema &schema, std::string const &name, std::string const &doc, std::string const &unit)
 Add _min_x, _min_y, _max_x, _max_y fields to a Schema, and return a BoxKey that points to them.
 

Detailed Description

template<typename Box>
class lsst::afw::table::BoxKey< Box >

A FunctorKey used to get or set a lsst::geom::Box2I or Box2D from a (min, max) pair of Point3Keys.

The Box2IKey and Box2DKey typedefs should be preferred to using the template name directly.

Definition at line 208 of file aggregates.h.

Member Typedef Documentation

◆ Element

template<typename Box>
using lsst::afw::table::BoxKey< Box >::Element = typename Box::Element

Type of coordinate elements (i.e. int or double).

Definition at line 211 of file aggregates.h.

◆ Value

using lsst::afw::table::FunctorKey< Box >::Value
inherited

The data type for get and set.

Definition at line 77 of file FunctorKey.h.

Constructor & Destructor Documentation

◆ BoxKey() [1/5]

template<typename Box>
lsst::afw::table::BoxKey< Box >::BoxKey ( )
defaultnoexcept

Default constructor; instance will not be usable unless subsequently assigned to.

◆ BoxKey() [2/5]

template<typename Box>
lsst::afw::table::BoxKey< Box >::BoxKey ( PointKey< Element > const & min,
PointKey< Element > const & max )
inlinenoexcept

Construct from a pair of PointKeys.

Definition at line 233 of file aggregates.h.

233: _min(min), _max(max) {}
A FunctorKey used to get or set a lsst::geom::Box2I or Box2D from a (min, max) pair of Point3Keys.
Definition aggregates.h:208

◆ BoxKey() [3/5]

template<typename Box>
lsst::afw::table::BoxKey< Box >::BoxKey ( SubSchema const & s)
inline

Construct from a subschema, assuming _min_x, _max_x, _min_y, _max_y subfields.

If a schema has "a_min_x" and "a_min_x" (etc) fields, this constructor allows you to construct a BoxKey via:

BoxKey<Box> k(schema["a"]);

Definition at line 243 of file aggregates.h.

243: _min(s["min"]), _max(s["max"]) {}

◆ BoxKey() [4/5]

template<typename Box>
lsst::afw::table::BoxKey< Box >::BoxKey ( BoxKey< Box > const & )
defaultnoexcept

◆ BoxKey() [5/5]

template<typename Box>
lsst::afw::table::BoxKey< Box >::BoxKey ( BoxKey< Box > && )
defaultnoexcept

◆ ~BoxKey()

template<typename Box>
lsst::afw::table::BoxKey< Box >::~BoxKey ( )
overridedefaultnoexcept

Member Function Documentation

◆ addFields()

template<typename Box>
BoxKey< Box > lsst::afw::table::BoxKey< Box >::addFields ( Schema & schema,
std::string const & name,
std::string const & doc,
std::string const & unit )
static

Add _min_x, _min_y, _max_x, _max_y fields to a Schema, and return a BoxKey that points to them.

Parameters
[in,out]schemaSchema to add fields to.
[in]nameName prefix for all fields; suffixes above will be appended to this to form the full field names. For example, if name == "b", the fields added will be "b_min_x", "b_min_y", "b_max_x", and "b_max_y".
[in]docString used as the documentation for the fields.
[in]unitString used as the unit for all fields.

Definition at line 86 of file aggregates.cc.

87 {
88 auto minKey = PointKey<Element>::addFields(schema, schema.join(name, "min"), doc + " (minimum)", unit);
89 auto maxKey = PointKey<Element>::addFields(schema, schema.join(name, "max"), doc + " (maximum)", unit);
90 return BoxKey<Box>(minKey, maxKey);
91}
BoxKey() noexcept=default
Default constructor; instance will not be usable unless subsequently assigned to.
static PointKey addFields(Schema &schema, std::string const &name, std::string const &doc, std::string const &unit)
Add a pair of _x, _y fields to a Schema, and return a PointKey that points to them.
Definition aggregates.cc:36

◆ get()

template<typename Box>
Box lsst::afw::table::BoxKey< Box >::get ( BaseRecord const & record) const
overridevirtual

Get a Box from the given record.

Implements lsst::afw::table::OutputFunctorKey< Box >.

Definition at line 94 of file aggregates.cc.

94 {
95 return Box(record.get(_min), record.get(_max), /*invert=*/false);
96}
Box get(BaseRecord const &record) const override
Get a Box from the given record.
Definition aggregates.cc:94

◆ getMax()

template<typename Box>
PointKey< Element > lsst::afw::table::BoxKey< Box >::getMax ( ) const
inlinenoexcept

Return the underlying max PointKey.

Definition at line 276 of file aggregates.h.

276{ return _max; }

◆ getMin()

template<typename Box>
PointKey< Element > lsst::afw::table::BoxKey< Box >::getMin ( ) const
inlinenoexcept

Return the underlying min PointKey.

Definition at line 273 of file aggregates.h.

273{ return _min; }

◆ hash_value()

template<typename Box>
std::size_t lsst::afw::table::BoxKey< Box >::hash_value ( ) const
inlinenoexcept

Return a hash of this object.

Definition at line 252 of file aggregates.h.

252 {
253 // Completely arbitrary seed
254 return cpputils::hashCombine(17, _min, _max);
255 }
std::size_t hashCombine(std::size_t seed) noexcept
Combine hashes.
Definition hashCombine.h:35

◆ isValid()

template<typename Box>
bool lsst::afw::table::BoxKey< Box >::isValid ( ) const
inlinenoexcept

Return True if both the min and max PointKeys are valid.

Definition at line 270 of file aggregates.h.

270{ return _min.isValid() && _max.isValid(); }

◆ operator!=()

template<typename Box>
bool lsst::afw::table::BoxKey< Box >::operator!= ( BoxKey< Box > const & other) const
inlinenoexcept

Definition at line 266 of file aggregates.h.

266{ return !(*this == other); }

◆ operator=() [1/2]

template<typename Box>
BoxKey & lsst::afw::table::BoxKey< Box >::operator= ( BoxKey< Box > && )
defaultnoexcept

◆ operator=() [2/2]

template<typename Box>
BoxKey & lsst::afw::table::BoxKey< Box >::operator= ( BoxKey< Box > const & )
defaultnoexcept

◆ operator==()

template<typename Box>
bool lsst::afw::table::BoxKey< Box >::operator== ( BoxKey< Box > const & other) const
inlinenoexcept

Compare the FunctorKey for equality with another, using the underlying x and y Keys.

Definition at line 265 of file aggregates.h.

265{ return _min == other._min && _max == other._max; }

◆ set()

template<typename Box>
void lsst::afw::table::BoxKey< Box >::set ( BaseRecord & record,
Box const & value ) const
overridevirtual

Set a Box in the given record.

Implements lsst::afw::table::InputFunctorKey< Box >.

Definition at line 99 of file aggregates.cc.

99 {
100 _min.set(record, value.getMin());
101 _max.set(record, value.getMax());
102}
PointKey< Element > getMin() const noexcept
Return the underlying min PointKey.
Definition aggregates.h:273
PointKey< Element > getMax() const noexcept
Return the underlying max PointKey.
Definition aggregates.h:276

The documentation for this class was generated from the following files: