LSSTApplications  19.0.0-11-g2ce9f25+4,20.0.0+1,20.0.0+10,20.0.0+11,20.0.0+13,20.0.0+2,20.0.0+3,20.0.0+4,20.0.0+6,20.0.0-1-g10df615+10,20.0.0-1-g253301a+5,20.0.0-1-g596936a+11,20.0.0-1-g8a53f90+1,20.0.0-1-gc96f8cb+12,20.0.0-1-gd1c87d7+1,20.0.0-17-g41c5faf,20.0.0-2-g04cfba9+4,20.0.0-2-gd11eeda,20.0.0-2-gec03fae+3,20.0.0-3-g082faa5+1,20.0.0-3-gbdbfa727+3,20.0.0-3-gc53c7b6,20.0.0-4-gde602ef96+4,20.0.0-4-ge48a6ca+6,20.0.0-4-ge987224+1,20.0.0-8-g7eef53f7+7,20.0.0-9-g8e1b333,w.2020.28
LSSTDataManagementBasePackage
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
lsst::afw::image::detail::MaskDict Class Referencefinal

#include <MaskDict.h>

Classes

class  GlobalState
 

Public Types

typedef MaskPlaneDict::value_type value_type
 
typedef MaskPlaneDict::const_iterator const_iterator
 

Public Member Functions

MaskDictoperator= (MaskDict const &)=delete
 
MaskDictoperator= (MaskDict &&)=delete
 
 ~MaskDict () noexcept
 
std::shared_ptr< MaskDictclone () const
 
int getUnusedPlane () const
 
int getMaskPlane (std::string const &name) const
 
void print () const
 
bool operator== (MaskDict const &rhs) const
 
bool operator!= (MaskDict const &rhs) const
 
const_iterator begin () const noexcept
 
const_iterator end () const noexcept
 
const_iterator find (std::string const &name) const
 
std::size_t size () const noexcept
 
bool empty () const noexcept
 
MaskPlaneDict const & getMaskPlaneDict () const noexcept
 
void add (std::string const &name, int bitId)
 
void erase (std::string const &name)
 
void clear ()
 

Static Public Member Functions

static std::shared_ptr< MaskDictcopyOrGetDefault (MaskPlaneDict const &dict)
 
static std::shared_ptr< MaskDictgetDefault ()
 
static void setDefault (std::shared_ptr< MaskDict > dict)
 
static std::shared_ptr< MaskDictdetachDefault ()
 
static void addAllMasksPlane (std::string const &name, int bitId)
 

Detailed Description

Definition at line 61 of file MaskDict.h.

Member Typedef Documentation

◆ const_iterator

typedef MaskPlaneDict::const_iterator lsst::afw::image::detail::MaskDict::const_iterator

Definition at line 65 of file MaskDict.h.

◆ value_type

typedef MaskPlaneDict::value_type lsst::afw::image::detail::MaskDict::value_type

Definition at line 64 of file MaskDict.h.

Constructor & Destructor Documentation

◆ ~MaskDict()

lsst::afw::image::detail::MaskDict::~MaskDict ( )
defaultnoexcept

Member Function Documentation

◆ add()

void lsst::afw::image::detail::MaskDict::add ( std::string const &  name,
int  bitId 
)

Definition at line 191 of file MaskDict.cc.

191  {
192  _dict[name] = bitId;
193  _hash = boost::hash<MaskPlaneDict>()(_dict);
194 }

◆ addAllMasksPlane()

void lsst::afw::image::detail::MaskDict::addAllMasksPlane ( std::string const &  name,
int  bitId 
)
static

Definition at line 127 of file MaskDict.cc.

127  {
129  [&name, bitId](MaskDict & dict) {
130  auto const found = std::find_if(
131  dict.begin(), dict.end(),
132  [bitId](auto const & item) { return item.second == bitId; }
133  );
134  if (found == dict.end()) {
135  // is name already in use?
136  if (dict.find(name) == dict.end()) {
137  dict.add(name, bitId);
138  }
139  }
140  }
141  );
142 }

◆ begin()

const_iterator lsst::afw::image::detail::MaskDict::begin ( ) const
inlinenoexcept

Definition at line 131 of file MaskDict.h.

131 { return _dict.begin(); }

◆ clear()

void lsst::afw::image::detail::MaskDict::clear ( )

Definition at line 201 of file MaskDict.cc.

201  {
202  _dict.clear();
203  _hash = 0x0;
204 }

◆ clone()

std::shared_ptr< MaskDict > lsst::afw::image::detail::MaskDict::clone ( ) const

Definition at line 146 of file MaskDict.cc.

146  {
147  return GlobalState::get().copy(*this);
148 }

◆ copyOrGetDefault()

std::shared_ptr< MaskDict > lsst::afw::image::detail::MaskDict::copyOrGetDefault ( MaskPlaneDict const &  dict)
static

Definition at line 111 of file MaskDict.cc.

111  {
112  return GlobalState::get().copyOrGetDefault(mpd);
113 }

◆ detachDefault()

std::shared_ptr< MaskDict > lsst::afw::image::detail::MaskDict::detachDefault ( )
static

Definition at line 123 of file MaskDict.cc.

123  {
124  return GlobalState::get().detachDefault();
125 }

◆ empty()

bool lsst::afw::image::detail::MaskDict::empty ( ) const
inlinenoexcept

Definition at line 141 of file MaskDict.h.

141 { return _dict.empty(); }

◆ end()

const_iterator lsst::afw::image::detail::MaskDict::end ( ) const
inlinenoexcept

Definition at line 132 of file MaskDict.h.

132 { return _dict.end(); }

◆ erase()

void lsst::afw::image::detail::MaskDict::erase ( std::string const &  name)

Definition at line 196 of file MaskDict.cc.

196  {
197  _dict.erase(name);
198  _hash = boost::hash<MaskPlaneDict>()(_dict);
199 }

◆ find()

const_iterator lsst::afw::image::detail::MaskDict::find ( std::string const &  name) const
inline

Definition at line 135 of file MaskDict.h.

135 { return _dict.find(name); }

◆ getDefault()

std::shared_ptr< MaskDict > lsst::afw::image::detail::MaskDict::getDefault ( )
static

Definition at line 115 of file MaskDict.cc.

115  {
116  return GlobalState::get().getDefault();
117 }

◆ getMaskPlane()

int lsst::afw::image::detail::MaskDict::getMaskPlane ( std::string const &  name) const

Definition at line 176 of file MaskDict.cc.

176  {
177  auto iter = find(name);
178  return (iter == end()) ? -1 : iter->second;
179 }

◆ getMaskPlaneDict()

MaskPlaneDict const& lsst::afw::image::detail::MaskDict::getMaskPlaneDict ( ) const
inlinenoexcept

Definition at line 144 of file MaskDict.h.

144 { return _dict; }

◆ getUnusedPlane()

int lsst::afw::image::detail::MaskDict::getUnusedPlane ( ) const

Definition at line 150 of file MaskDict.cc.

150  {
151  if (empty()) {
152  return 0;
153  }
154 
155  auto const maxIter = std::max_element(
156  begin(), end(),
157  [](auto const & a, auto const & b) { return a.second < b.second; }
158  );
159  assert(maxIter != end());
160  int id = maxIter->second + 1; // The maskPlane to use if there are no gaps
161 
162  for (int i = 0; i < id; ++i) {
163  // is i already used in this Mask?
164  auto const sameIter = std::find_if(
165  begin(), end(),
166  [i](auto const & item) { return item.second == i; }
167  );
168  if (sameIter == end()) { // Not used; so we'll use it
169  return i;
170  }
171  }
172 
173  return id;
174 }

◆ operator!=()

bool lsst::afw::image::detail::MaskDict::operator!= ( MaskDict const &  rhs) const
inline

Definition at line 128 of file MaskDict.h.

128 { return !(*this == rhs); }

◆ operator=() [1/2]

MaskDict& lsst::afw::image::detail::MaskDict::operator= ( MaskDict &&  )
delete

◆ operator=() [2/2]

MaskDict& lsst::afw::image::detail::MaskDict::operator= ( MaskDict const &  )
delete

◆ operator==()

bool lsst::afw::image::detail::MaskDict::operator== ( MaskDict const &  rhs) const

Definition at line 187 of file MaskDict.cc.

187  {
188  return this == &rhs || (_hash == rhs._hash && _dict == rhs._dict);
189 }

◆ print()

void lsst::afw::image::detail::MaskDict::print ( ) const

Definition at line 181 of file MaskDict.cc.

181  {
182  for (auto const & item : *this) {
183  std::cout << "Plane " << item.second << " -> " << item.first << std::endl;
184  }
185 }

◆ setDefault()

void lsst::afw::image::detail::MaskDict::setDefault ( std::shared_ptr< MaskDict dict)
static

Definition at line 119 of file MaskDict.cc.

119  {
121 }

◆ size()

std::size_t lsst::afw::image::detail::MaskDict::size ( ) const
inlinenoexcept

Definition at line 138 of file MaskDict.h.

138 { return _dict.size(); }

The documentation for this class was generated from the following files:
std::max_element
T max_element(T... args)
lsst::afw::image::detail::MaskDict::GlobalState::copy
std::shared_ptr< MaskDict > copy(MaskDict const &dict)
Definition: MaskDict.cc:49
lsst::afw::image::detail::MaskDict::empty
bool empty() const noexcept
Definition: MaskDict.h:141
std::move
T move(T... args)
lsst::afw::image::detail::MaskDict::GlobalState::getDefault
std::shared_ptr< MaskDict > getDefault() const noexcept
Definition: MaskDict.cc:56
lsst::afw::image::detail::MaskDict::GlobalState::forEachMaskDict
void forEachMaskDict(Functor functor)
Definition: MaskDict.cc:71
lsst::afw::image::detail::MaskDict::end
const_iterator end() const noexcept
Definition: MaskDict.h:132
std::find_if
T find_if(T... args)
std::map::size
T size(T... args)
lsst::afw::image::detail::MaskDict::GlobalState::get
static GlobalState & get()
Definition: MaskDict.cc:34
lsst::afw::geom.transform.transformContinued.name
string name
Definition: transformContinued.py:32
std::map::clear
T clear(T... args)
std::cout
lsst::afw::image::detail::MaskDict::find
const_iterator find(std::string const &name) const
Definition: MaskDict.h:135
id
table::Key< int > id
Definition: Detector.cc:162
std::map::erase
T erase(T... args)
b
table::Key< int > b
Definition: TransmissionCurve.cc:467
std::endl
T endl(T... args)
a
table::Key< int > a
Definition: TransmissionCurve.cc:466
std::map::begin
T begin(T... args)
lsst::afw::image::detail::MaskDict::GlobalState::setDefault
void setDefault(std::shared_ptr< MaskDict > dict)
Definition: MaskDict.cc:60
std::map::empty
T empty(T... args)
std::map::end
T end(T... args)
lsst::afw::image::detail::MaskDict::begin
const_iterator begin() const noexcept
Definition: MaskDict.h:131
astshim.fitsChanContinued.iter
def iter(self)
Definition: fitsChanContinued.py:88
lsst::afw::image::detail::MaskDict::GlobalState::detachDefault
std::shared_ptr< MaskDict > detachDefault()
Definition: MaskDict.cc:64
lsst::afw::image::detail::MaskDict::GlobalState::copyOrGetDefault
std::shared_ptr< MaskDict > copyOrGetDefault(MaskPlaneDict const &mpd)
Definition: MaskDict.cc:39