LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Friends | List of all members
lsst::afw::table::Key< Flag > Class Reference

Key specialization for Flag. More...

#include <Flag.h>

Inheritance diagram for lsst::afw::table::Key< Flag >:
lsst::afw::table::KeyBase< Flag > lsst::afw::table::FieldBase< Flag >

Public Types

using Value = bool
 the type returned by BaseRecord::get More...
 
using Element = std::int64_t
 the actual storage type (shared by multiple flag fields) More...
 

Public Member Functions

template<typename OtherT >
bool operator== (Key< OtherT > const &other) const
 Equality comparison. More...
 
template<typename OtherT >
bool operator!= (Key< OtherT > const &other) const
 
bool operator== (Key const &other) const
 
bool operator!= (Key const &other) const
 
std::size_t hash_value () const noexcept
 Return a hash of this object. More...
 
std::size_t getOffset () const
 Return the offset in bytes of the integer element that holds this field's bit. More...
 
std::size_t getBit () const
 The index of this field's bit within the integer it shares with other Flag fields. More...
 
bool isValid () const
 Return true if the key was initialized to valid offset. More...
 
 Key ()
 Default construct a field. More...
 
 Key (Key const &)=default
 
 Key (Key &&)=default
 
Keyoperator= (Key const &)=default
 
Keyoperator= (Key &&)=default
 
 ~Key ()=default
 
Key< FieldBase< Flag >::ElementgetStorage () const
 Return a key corresponding to the integer element where this field's bit is packed. More...
 
std::size_t getElementCount () const
 Return the number of subfield elements (always one for scalars). More...
 

Static Public Member Functions

static std::string getTypeString ()
 Return a string description of the field type. More...
 

Static Public Attributes

static bool const HAS_NAMED_SUBFIELDS = false
 

Protected Member Functions

void stream (std::ostream &os) const
 Defines how fields are printed. More...
 

Friends

class detail::Access
 
class BaseRecord
 
std::ostreamoperator<< (std::ostream &os, Key< Flag > const &key)
 Stringification. More...
 

Detailed Description

Key specialization for Flag.

Flag fields are special; their keys need to contain not only the offset to the integer element they share with other Flag fields, but also their position in that shared field.

Flag fields operate mostly like a bool field, but they do not support reference access, and internally they are packed into an integer shared by multiple fields so the marginal cost of each Flag field is only one bit.

Definition at line 94 of file Flag.h.

Member Typedef Documentation

◆ Element

using lsst::afw::table::FieldBase< Flag >::Element = std::int64_t
inherited

the actual storage type (shared by multiple flag fields)

Definition at line 35 of file Flag.h.

◆ Value

using lsst::afw::table::FieldBase< Flag >::Value = bool
inherited

the type returned by BaseRecord::get

Definition at line 34 of file Flag.h.

Constructor & Destructor Documentation

◆ Key() [1/3]

lsst::afw::table::Key< Flag >::Key ( )
inline

Default construct a field.

The new field will be invalid until a valid Key is assigned to it.

Definition at line 146 of file Flag.h.

146 : FieldBase<Flag>(), _offset(0), _bit(0), _valid(false) {}

◆ Key() [2/3]

lsst::afw::table::Key< Flag >::Key ( Key< Flag > const &  )
default

◆ Key() [3/3]

lsst::afw::table::Key< Flag >::Key ( Key< Flag > &&  )
default

◆ ~Key()

lsst::afw::table::Key< Flag >::~Key ( )
default

Member Function Documentation

◆ getBit()

std::size_t lsst::afw::table::Key< Flag >::getBit ( ) const
inline

The index of this field's bit within the integer it shares with other Flag fields.

Definition at line 129 of file Flag.h.

129 { return _bit; }

◆ getElementCount()

std::size_t lsst::afw::table::FieldBase< Flag >::getElementCount ( ) const
inlineinherited

Return the number of subfield elements (always one for scalars).

Definition at line 38 of file Flag.h.

38 { return 1; }

◆ getOffset()

std::size_t lsst::afw::table::Key< Flag >::getOffset ( ) const
inline

Return the offset in bytes of the integer element that holds this field's bit.

Definition at line 126 of file Flag.h.

126 { return _offset; }

◆ getStorage()

Key< FieldBase< Flag >::Element > lsst::afw::table::KeyBase< Flag >::getStorage ( ) const
inherited

Return a key corresponding to the integer element where this field's bit is packed.

Definition at line 15 of file KeyBase.cc.

15  {
16  return detail::Access::extractElement(*this, 0);
17 }
static Key< typename Key< T >::Element > extractElement(KeyBase< T > const &kb, std::size_t n)
Definition: Access.h:35

◆ getTypeString()

static std::string lsst::afw::table::FieldBase< Flag >::getTypeString ( )
inlinestaticinherited

Return a string description of the field type.

Definition at line 41 of file Flag.h.

41 { return "Flag"; }

◆ hash_value()

std::size_t lsst::afw::table::Key< Flag >::hash_value ( ) const
inlinenoexcept

Return a hash of this object.

Definition at line 120 of file Flag.h.

120  {
121  // Completely arbitrary seed
122  return utils::hashCombine(17, _offset, _bit);
123  }
std::size_t hashCombine(std::size_t seed) noexcept
Combine hashes.
Definition: hashCombine.h:35

◆ isValid()

bool lsst::afw::table::Key< Flag >::isValid ( ) const
inline

Return true if the key was initialized to valid offset.

This does not guarantee that a key is valid with any particular schema, or even that any schemas still exist in which this key is valid.

A key that is default constructed will always be invalid.

Definition at line 139 of file Flag.h.

139 { return _valid; }

◆ operator!=() [1/2]

bool lsst::afw::table::Key< Flag >::operator!= ( Key< Flag > const &  other) const
inline

Definition at line 116 of file Flag.h.

116 { return !this->operator==(other); }
bool operator==(Key< OtherT > const &other) const
Equality comparison.
Definition: Flag.h:107

◆ operator!=() [2/2]

template<typename OtherT >
bool lsst::afw::table::Key< Flag >::operator!= ( Key< OtherT > const &  other) const
inline

Definition at line 111 of file Flag.h.

111  {
112  return true;
113  }

◆ operator=() [1/2]

Key& lsst::afw::table::Key< Flag >::operator= ( Key< Flag > &&  )
default

◆ operator=() [2/2]

Key& lsst::afw::table::Key< Flag >::operator= ( Key< Flag > const &  )
default

◆ operator==() [1/2]

bool lsst::afw::table::Key< Flag >::operator== ( Key< Flag > const &  other) const
inline

Definition at line 115 of file Flag.h.

115 { return _offset == other._offset && _bit == other._bit; }

◆ operator==() [2/2]

template<typename OtherT >
bool lsst::afw::table::Key< Flag >::operator== ( Key< OtherT > const &  other) const
inline

Equality comparison.

Two keys with different types are never equal. Keys with the same type are equal if they point to the same location in a table, regardless of what Schema they were constructed from (for instance, if a field has a different name in one Schema than another, but is otherwise the same, the two keys will be equal).

Definition at line 107 of file Flag.h.

107  {
108  return false;
109  }

◆ stream()

void lsst::afw::table::FieldBase< Flag >::stream ( std::ostream os) const
inlineprotectedinherited

Defines how fields are printed.

Definition at line 60 of file Flag.h.

60 {}

Friends And Related Function Documentation

◆ BaseRecord

friend class BaseRecord
friend

Definition at line 162 of file Flag.h.

◆ detail::Access

friend class detail::Access
friend

Definition at line 161 of file Flag.h.

◆ operator<<

std::ostream& operator<< ( std::ostream os,
Key< Flag > const &  key 
)
friend

Stringification.

Definition at line 155 of file Flag.h.

155  {
156  return os << "Key['" << Key<Flag>::getTypeString() << "'](offset=" << key.getOffset()
157  << ", bit=" << key.getBit() << ")";
158  }
std::ostream * os
Definition: Schema.cc:557
static std::string getTypeString()
Return a string description of the field type.
Definition: FieldBase.cc:56

Member Data Documentation

◆ HAS_NAMED_SUBFIELDS

bool const lsst::afw::table::KeyBase< Flag >::HAS_NAMED_SUBFIELDS = false
staticinherited

Definition at line 69 of file Flag.h.


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