32 #ifndef LSST_AFW_IMAGE_FILTER_H
33 #define LSST_AFW_IMAGE_FILTER_H
36 #include <unordered_map>
39 #include "lsst/base.h"
40 #include "lsst/pex/policy/Policy.h"
58 : _name(name), _lambdaEff(lambdaEff) {
76 explicit FilterProperty(std::string
const& name, lsst::pex::policy::Policy
const& pol,
81 std::string
const&
getName()
const {
return _name; }
97 return !(*
this == rhs);
102 static void reset() { _initRegistry(); }
112 typedef std::unordered_map<std::string, FilterProperty> PropertyMap;
117 static void _initRegistry();
123 void _insert(
bool force =
false);
128 static PropertyMap* _propertyMap;
143 bool const force =
false
145 : _id(_lookup(name, force)), _name(name) {}
151 : _id(id), _name(_lookup(id)) {}
158 explicit Filter(std::shared_ptr<lsst::daf::base::PropertySet const>,
bool const force =
false);
173 std::string
const&
getName()
const {
return _name; }
194 static void reset() { _initRegistry(); }
210 static int defineAlias(std::string
const& oldName, std::string
const& newName,
bool force =
false);
215 static std::vector<std::string>
getNames();
218 typedef std::unordered_map<std::string, std::string const> AliasMap;
219 typedef std::unordered_map<std::string, unsigned int const> NameMap;
220 typedef std::unordered_map<unsigned int, std::string const> IdMap;
225 static void _initRegistry();
232 static int _lookup(std::string
const&
name,
bool const force =
false);
236 static std::string
const& _lookup(
int id);
242 static AliasMap* _aliasMap;
243 static IdMap* _idMap;
244 static NameMap* _nameMap;
260 #endif // LSST_AFW_IMAGE_FILTER_H
static void reset()
Clear all definitions.
bool operator==(Filter const &rhs) const
Are two filters identical?
std::string const & getCanonicalName() const
Return a filter's canonical name.
int stripFilterKeywords(std::shared_ptr< lsst::daf::base::PropertySet > metadata)
Remove Filter-related keywords from the metadata.
std::string const & getName() const
Return a Filter's name.
bool operator!=(Filter const &rhs) const
FilterProperty const & getFilterProperty() const
Return a Filter's FilterProperty.
static int define(FilterProperty const &filterProperty, int id=AUTO, bool force=false)
Define a filter name to have the specified id.
static FilterProperty const & lookup(std::string const &name)
Lookup the properties of a filter "name".
int getId() const
Return a Filter's integral id.
table::Key< std::string > name
static int defineAlias(std::string const &oldName, std::string const &newName, bool force=false)
Define an alias for a filter.
bool operator!=(FilterProperty const &rhs) const
Return true iff rhs != this.
Holds an integer identifier for an LSST filter.
FilterProperty(std::string const &name, double lambdaEff, bool force=false)
lsst::daf::base::PropertySet PropertySet
std::vector< std::string > getAliases() const
Return all aliases by which this filter is known.
Filter(int id=UNKNOWN)
Creates a Filter with the given identifier.
Filter(std::string const &name, bool const force=false)
Creates a Filter with the given name.
bool operator==(FilterProperty const &rhs) const
Return true iff two FilterProperties are identical.
double getLambdaEff() const
Return the filter's effective wavelength (nm)
Describe the properties of a Filter (e.g.
std::string const & getName() const
Return a filter's name.
static void reset()
Clear all definitions.
static std::vector< std::string > getNames()
Return a list of known filters.