LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
lsst::afw::table::Key< Flag > Class Template 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 Member Functions

int getOffset () const
 Return the offset in bytes of the integer element that holds this field's bit. More...
 
int 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...
 
template<typename OtherT >
bool operator== (Key< OtherT > const &other) const
 Equality comparison. More...
 
template<typename OtherT >
bool operator!= (Key< OtherT > const &other) const
 Equality comparison. More...
 
bool operator== (Key const &other) const
 Equality comparison. More...
 
bool operator!= (Key const &other) const
 Equality comparison. More...
 
- Public Member Functions inherited from lsst::afw::table::KeyBase< Flag >
Key< FieldBase< Flag >::Element > getStorage () const
 Return a key corresponding to the integer element where this field's bit is packed. More...
 
- Public Member Functions inherited from lsst::afw::table::FieldBase< Flag >
int getElementCount () const
 Return the number of subfield elements (always one for scalars). More...
 
 FieldBase ()
 
 FieldBase (int)
 

Private Member Functions

Value getValue (Element const *p, ndarray::Manager::Ptr const &) const
 Used to implement RecordBase::get. More...
 
void setValue (Element *p, ndarray::Manager::Ptr const &, Value v) const
 Used to implement RecordBase::set. More...
 
 Key (int offset, int bit)
 

Private Attributes

int _offset
 
int _bit
 

Friends

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

Additional Inherited Members

- Public Types inherited from lsst::afw::table::FieldBase< Flag >
typedef bool Value
 the type returned by BaseRecord::get More...
 
typedef boost::int64_t Element
 the actual storage type (shared by multiple flag fields) More...
 
- Static Public Member Functions inherited from lsst::afw::table::FieldBase< Flag >
static std::string getTypeString ()
 Return a string description of the field type. More...
 
- Static Public Attributes inherited from lsst::afw::table::KeyBase< Flag >
static bool const HAS_NAMED_SUBFIELDS = false
 
- Protected Member Functions inherited from lsst::afw::table::FieldBase< Flag >
void stream (std::ostream &os) const
 Defines how fields are printed. More...
 

Detailed Description

template<>
class lsst::afw::table::Key< Flag >

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 82 of file Flag.h.

Constructor & Destructor Documentation

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 123 of file Flag.h.

123 : FieldBase<Flag>(), _offset(-1), _bit(0) {}
lsst::afw::table::Key< Flag >::Key ( int  offset,
int  bit 
)
inlineexplicitprivate

Definition at line 150 of file Flag.h.

150 : _offset(offset), _bit(bit) {}

Member Function Documentation

int 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 106 of file Flag.h.

106 { return _bit; }
int 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 103 of file Flag.h.

103 { return _offset; }
Value lsst::afw::table::Key< Flag >::getValue ( Element const *  p,
ndarray::Manager::Ptr const &   
) const
inlineprivate

Used to implement RecordBase::get.

Definition at line 137 of file Flag.h.

137  {
138  return (*p) & (Element(1) << _bit);
139  }
boost::int64_t Element
the actual storage type (shared by multiple flag fields)
Definition: Flag.h:30
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 116 of file Flag.h.

116 { return _offset >= 0; }
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 96 of file Flag.h.

96 { return true; }
bool lsst::afw::table::Key< Flag >::operator!= ( Key< Flag > 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 99 of file Flag.h.

99 { return !this->operator==(other); }
bool operator==(Key< OtherT > const &other) const
Equality comparison.
Definition: Flag.h:95
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 95 of file Flag.h.

95 { return false; }
bool lsst::afw::table::Key< Flag >::operator== ( Key< Flag > 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 98 of file Flag.h.

98 { return _offset == other._offset && _bit == other._bit; }
void lsst::afw::table::Key< Flag >::setValue ( Element p,
ndarray::Manager::Ptr const &  ,
Value  v 
) const
inlineprivate

Used to implement RecordBase::set.

Definition at line 142 of file Flag.h.

142  {
143  if (v) {
144  *p |= (Element(1) << _bit);
145  } else {
146  *p &= ~(Element(1) << _bit);
147  }
148  }
boost::int64_t Element
the actual storage type (shared by multiple flag fields)
Definition: Flag.h:30

Friends And Related Function Documentation

friend class BaseRecord
friend

Definition at line 134 of file Flag.h.

friend class detail::Access
friend

Definition at line 133 of file Flag.h.

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

Stringification.

Definition at line 126 of file Flag.h.

126  {
127  return os << "Key['" << Key<Flag>::getTypeString() << "'](offset=" << key.getOffset()
128  << ", bit=" << key.getBit() << ")";
129  }
static std::string getTypeString()
Return a string description of the field type.

Member Data Documentation

int lsst::afw::table::Key< Flag >::_bit
private

Definition at line 153 of file Flag.h.

int lsst::afw::table::Key< Flag >::_offset
private

Definition at line 152 of file Flag.h.


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