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 | Public Attributes | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
lsst::afw::image::FilterProperty Class Reference

#include <Filter.h>

Public Member Functions

 FilterProperty (std::string const &name, double lambdaEff, bool force=false)
 
 FilterProperty (std::string const &name, lsst::daf::base::PropertySet const &prop=lsst::daf::base::PropertySet(), bool force=false)
 
 FilterProperty (std::string const &name, lsst::pex::policy::Policy const &pol, bool force=false)
 
std::string const & getName () const
 
double getLambdaEff () const
 
bool operator== (FilterProperty const &rhs) const
 
bool operator!= (FilterProperty const &rhs) const
 

Static Public Member Functions

static void reset ()
 
static FilterProperty const & lookup (std::string const &name)
 

Public Attributes

boost::shared_ptr< FilterPropertyPtr
 
boost::shared_ptr
< FilterProperty const > 
ConstPtr
 

Private Types

typedef
std::tr1::unordered_map
< std::string const,
FilterProperty
PropertyMap
 

Private Member Functions

void _insert (bool force=false)
 

Static Private Member Functions

static void _initRegistry ()
 

Private Attributes

std::string _name
 
double _lambdaEff
 

Static Private Attributes

static PropertyMap_propertyMap = NULL
 

Detailed Description

Describe the properties of a Filter (e.g. effective wavelength)

Definition at line 55 of file Filter.h.

Member Typedef Documentation

typedef std::tr1::unordered_map<std::string const, FilterProperty> lsst::afw::image::FilterProperty::PropertyMap
private

Definition at line 92 of file Filter.h.

Constructor & Destructor Documentation

lsst::afw::image::FilterProperty::FilterProperty ( std::string const &  name,
double  lambdaEff,
bool  force = false 
)
inlineexplicit

Definition at line 60 of file Filter.h.

60  :
61  _name(name), _lambdaEff(lambdaEff) { _insert(force); }
table::Key< std::string > name
Definition: ApCorrMap.cc:71
void _insert(bool force=false)
Definition: Filter.cc:75
lsst::afw::image::FilterProperty::FilterProperty ( std::string const &  name,
lsst::daf::base::PropertySet const &  prop = lsst::daf::base::PropertySet(),
bool  force = false 
)
explicit
Parameters
namename of filter
propvalues describing the Filter
forceAllow this name to replace a previous one

Definition at line 45 of file Filter.cc.

49  : _name(name), _lambdaEff(-1)
50 {
51  if (prop.exists("lambdaEff")) {
52  _lambdaEff = prop.getAsDouble("lambdaEff");
53  }
54  _insert(force);
55 }
table::Key< std::string > name
Definition: ApCorrMap.cc:71
void _insert(bool force=false)
Definition: Filter.cc:75
lsst::afw::image::FilterProperty::FilterProperty ( std::string const &  name,
lsst::pex::policy::Policy const &  pol,
bool  force = false 
)
explicit

Create a new FilterProperty, setting values from a Policy

Parameters
namename of filter
polvalues describing the Filter
forceAllow this name to replace a previous one

Definition at line 61 of file Filter.cc.

64  : _name(name), _lambdaEff(-1)
65 {
66  if (pol.exists("lambdaEff")) {
67  _lambdaEff = pol.getDouble("lambdaEff");
68  }
69  _insert(force);
70 }
table::Key< std::string > name
Definition: ApCorrMap.cc:71
void _insert(bool force=false)
Definition: Filter.cc:75

Member Function Documentation

void lsst::afw::image::FilterProperty::_initRegistry ( )
staticprivate

Initialise the Filter registry

Definition at line 112 of file Filter.cc.

113 {
114  if (_propertyMap) {
115  delete _propertyMap;
116  }
117 
119 }
std::tr1::unordered_map< std::string const, FilterProperty > PropertyMap
Definition: Filter.h:92
static PropertyMap * _propertyMap
Definition: Filter.h:100
void lsst::afw::image::FilterProperty::_insert ( bool  force = false)
private

Insert FilterProperty into registry

Parameters
forceAllow this name to replace a previous one?

Definition at line 75 of file Filter.cc.

78 {
79  if (!_propertyMap) {
80  _initRegistry();
81  }
82 
83  PropertyMap::iterator keyVal = _propertyMap->find(getName());
84 
85  if (keyVal != _propertyMap->end()) {
86  if (keyVal->second == *this) {
87  return; // OK, a redefinition with identical values
88  }
89 
90  if (!force) {
91  throw LSST_EXCEPT(pexEx::RuntimeError, "Filter " + getName() + " is already defined");
92  }
93  _propertyMap->erase(keyVal);
94  }
95 
96  _propertyMap->insert(std::make_pair(getName(), *this));
97 }
static PropertyMap * _propertyMap
Definition: Filter.h:100
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
std::string const & getName() const
Definition: Filter.h:71
double lsst::afw::image::FilterProperty::getLambdaEff ( ) const
inline

Return the filter's effective wavelength (nm)

Definition at line 75 of file Filter.h.

75 { return _lambdaEff; }
std::string const& lsst::afw::image::FilterProperty::getName ( ) const
inline

Return a filter's name

Definition at line 71 of file Filter.h.

71 { return _name; }
FilterProperty const & lsst::afw::image::FilterProperty::lookup ( std::string const &  name)
static

Lookup the properties of a filter "name"

Parameters
namename of desired filter

Definition at line 124 of file Filter.cc.

126 {
127  if (!_propertyMap) {
128  _initRegistry();
129  }
130 
131  PropertyMap::iterator keyVal = _propertyMap->find(name);
132 
133  if (keyVal == _propertyMap->end()) {
134  throw LSST_EXCEPT(pexEx::NotFoundError, "Unable to find filter " + name);
135  }
136 
137  return keyVal->second;
138 }
table::Key< std::string > name
Definition: ApCorrMap.cc:71
static PropertyMap * _propertyMap
Definition: Filter.h:100
#define LSST_EXCEPT(type,...)
Definition: Exception.h:46
bool lsst::afw::image::FilterProperty::operator!= ( FilterProperty const &  rhs) const
inline

Return true iff rhs != this

Parameters
rhsObject to compare with this

Definition at line 83 of file Filter.h.

84  { return !(*this == rhs); }
bool lsst::afw::image::FilterProperty::operator== ( FilterProperty const &  rhs) const

Return true iff two FilterProperties are identical

Parameters
rhsObject to compare with this

Definition at line 102 of file Filter.cc.

104 {
105  return (_lambdaEff == rhs._lambdaEff);
106 }
static void lsst::afw::image::FilterProperty::reset ( )
inlinestatic

Clear all definitions

Definition at line 88 of file Filter.h.

88 { _initRegistry(); }

Member Data Documentation

double lsst::afw::image::FilterProperty::_lambdaEff
private

Definition at line 98 of file Filter.h.

std::string lsst::afw::image::FilterProperty::_name
private

Definition at line 97 of file Filter.h.

FilterProperty::PropertyMap * lsst::afw::image::FilterProperty::_propertyMap = NULL
staticprivate

Definition at line 100 of file Filter.h.

boost::shared_ptr<FilterProperty const> lsst::afw::image::FilterProperty::ConstPtr

Definition at line 58 of file Filter.h.

boost::shared_ptr<FilterProperty> lsst::afw::image::FilterProperty::Ptr

Definition at line 57 of file Filter.h.


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