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 | Static Public Member Functions | Private Member Functions | Friends | List of all members
lsst::afw::image::detail::MaskDict Class Reference

Inherits lsst::afw::image::MapWithHash.

Public Member Functions

boost::shared_ptr< MaskDictclone () const
 
 ~MaskDict ()
 
int getUnusedPlane () const
 
int getMaskPlane (const std::string &name) const
 
void print () const
 

Static Public Member Functions

static boost::shared_ptr
< MaskDict
makeMaskDict ()
 
static boost::shared_ptr
< MaskDict
makeMaskDict (detail::MaskPlaneDict const &dict)
 
static boost::shared_ptr
< MaskDict
setDefaultDict (boost::shared_ptr< MaskDict > dict)
 
static boost::shared_ptr
< MaskDict
incrDefaultVersion ()
 
static void listMaskDicts ()
 

Private Member Functions

 MaskDict ()
 
 MaskDict (MapWithHash const *dict)
 

Friends

class ::lsst::afw::image::DictState
 

Additional Inherited Members

- Public Types inherited from lsst::afw::image::MapWithHash
typedef
detail::MaskPlaneDict::value_type 
value_type
 
typedef
detail::MaskPlaneDict::const_iterator 
const_iterator
 

Detailed Description

Definition at line 174 of file Mask.cc.

Constructor & Destructor Documentation

lsst::afw::image::detail::MaskDict::MaskDict ( )
inlineprivate

Definition at line 177 of file Mask.cc.

177 : MapWithHash() {}
lsst::afw::image::detail::MaskDict::MaskDict ( MapWithHash const *  dict)
inlineprivate

Definition at line 178 of file Mask.cc.

178 : MapWithHash(*dict) {}
lsst::afw::image::detail::MaskDict::~MaskDict ( )

Definition at line 322 of file Mask.cc.

322  {
323  _state.eraseDict(this);
324 }

Member Function Documentation

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

Definition at line 314 of file Mask.cc.

314  {
315  PTR(MaskDict) dict(new MaskDict(*this));
316 
317  _state.addDict(dict.get());
318 
319  return dict;
320 }
#define PTR(...)
Definition: base.h:41
int lsst::afw::image::detail::MaskDict::getMaskPlane ( const std::string &  name) const

Definition at line 359 of file Mask.cc.

360 {
361  MapWithHash::const_iterator i = find(name);
362 
363  return (i == end()) ? -1 : i->second;
364 }
table::Key< std::string > name
Definition: ApCorrMap.cc:71
int lsst::afw::image::detail::MaskDict::getUnusedPlane ( ) const

Definition at line 331 of file Mask.cc.

332 {
333  if (empty()) {
334  return 0;
335  }
336 
337  MapWithHash::const_iterator const it =
338  std::max_element(begin(), end(), boost::bind(std::less<int>(),
339  boost::bind(&MapWithHash::value_type::second, _1),
340  boost::bind(&MapWithHash::value_type::second, _2)
341  )
342  );
343  assert(it != end());
344  int id = it->second + 1; // The maskPlane to use if there are no gaps
345 
346  for (int i = 0; i < id; ++i) {
347  MapWithHash::const_iterator const it = // is i already used in this Mask?
348  std::find_if(begin(), end(), boost::bind(std::equal_to<int>(),
349  boost::bind(&MapWithHash::value_type::second, _1), i));
350  if (it == end()) { // Not used; so we'll use it
351  return i;
352  }
353  }
354 
355  return id;
356 }
int id
Definition: CR.cc:151
boost::shared_ptr< MaskDict > lsst::afw::image::detail::MaskDict::incrDefaultVersion ( )
static

Definition at line 326 of file Mask.cc.

326  {
327  return _state.incrDefaultVersion();
328 }
static void lsst::afw::image::detail::MaskDict::listMaskDicts ( )
static
boost::shared_ptr< MaskDict > lsst::afw::image::detail::MaskDict::makeMaskDict ( )
static

Definition at line 289 of file Mask.cc.

290 {
291  return _state.getDefaultDict();
292 }
boost::shared_ptr< MaskDict > lsst::afw::image::detail::MaskDict::makeMaskDict ( detail::MaskPlaneDict const &  dict)
static

Definition at line 295 of file Mask.cc.

296 {
297  PTR(MaskDict) dict = _state.getDefaultDict();
298 
299  if (!mpd.empty()) {
300  MapWithHash mwh(mpd);
301  dict = PTR(MaskDict)(new MaskDict(&mwh));
302  _state.addDict(dict.get());
303  }
304 
305  return dict;
306 }
#define PTR(...)
Definition: base.h:41
if(width!=gim.getWidth()||height!=gim.getHeight()||x0!=gim.getX0()||y0!=gim.getY0())
Definition: saturated.cc:47
void lsst::afw::image::detail::MaskDict::print ( ) const
inline

Definition at line 191 of file Mask.cc.

191  {
192  for (MapWithHash::const_iterator ptr = begin(); ptr != end(); ++ptr) {
193  std::cout << "Plane " << ptr->second << " -> " << ptr->first << std::endl;
194  }
195  }
boost::shared_ptr< MaskDict > lsst::afw::image::detail::MaskDict::setDefaultDict ( boost::shared_ptr< MaskDict dict)
static

Definition at line 309 of file Mask.cc.

310 {
311  return _state.setDefaultDict(dict);
312 }

Friends And Related Function Documentation

friend class ::lsst::afw::image::DictState
friend

Definition at line 175 of file Mask.cc.


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