lsst.afw  20.0.0-9-g61a2a9a3d+63f5489896
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Static Protected Member Functions | Related Functions | List of all members
lsst::afw::image::Filter Class Referencefinal

Holds an integer identifier for an LSST filter. More...

#include <Filter.h>

Inheritance diagram for lsst::afw::image::Filter:
lsst::afw::typehandling::Storable lsst::afw::table::io::Persistable

Public Member Functions

 Filter (std::string const &name, bool const force=false)
 Creates a Filter with the given name. More...
 
 Filter (int id=UNKNOWN)
 Creates a Filter with the given identifier. More...
 
 Filter (std::shared_ptr< lsst::daf::base::PropertySet const > metadata, bool const force=false)
 Create a Filter from a PropertySet (e.g. More...
 
 Filter (Filter const &)=default
 
 Filter (Filter &&) noexcept=default
 
Filteroperator= (Filter const &)=default
 
Filteroperator= (Filter &&) noexcept=default
 
 ~Filter () noexcept=default
 
bool operator== (Filter const &rhs) const noexcept
 Are two filters identical? More...
 
bool operator!= (Filter const &rhs) const noexcept
 
std::size_t hash_value () const noexcept override
 Return a hash of this object. More...
 
int getId () const noexcept
 Return a Filter's integral id. More...
 
std::string const & getName () const noexcept
 Return a Filter's name. More...
 
std::string const & getCanonicalName () const
 Return a filter's canonical name. More...
 
std::vector< std::stringgetAliases () const
 Return all aliases by which this filter is known. More...
 
FilterProperty const & getFilterProperty () const
 Return a Filter's FilterProperty. More...
 
std::shared_ptr< typehandling::StorablecloneStorable () const override
 Create a new Filter that is a copy of this one. More...
 
bool equals (typehandling::Storable const &other) const noexcept override
 Compare this object to another Storable. More...
 
bool isPersistable () const noexcept override
 Return true if this particular object can be persisted using afw::table::io. More...
 
virtual std::string toString () const
 Create a string representation of this object (optional operation). More...
 
void writeFits (std::string const &fileName, std::string const &mode="w") const
 Write the object to a regular FITS file. More...
 
void writeFits (fits::MemFileManager &manager, std::string const &mode="w") const
 Write the object to a FITS image in memory. More...
 
void writeFits (fits::Fits &fitsfile) const
 Write the object to an already-open FITS object. More...
 

Static Public Member Functions

static void reset ()
 Clear all definitions. More...
 
static int define (FilterProperty const &filterProperty, int id=AUTO, bool force=false)
 Define a filter name to have the specified id. More...
 
static int defineAlias (std::string const &oldName, std::string const &newName, bool force=false)
 Define an alias for a filter. More...
 
static std::vector< std::stringgetNames ()
 Return a list of known filters. More...
 

Static Public Attributes

static int const AUTO = -1
 
static int const UNKNOWN = -1
 

Protected Types

typedef io::OutputArchiveHandle OutputArchiveHandle
 

Protected Member Functions

std::string getPersistenceName () const override
 Return the unique name used to persist this object and look up its factory. More...
 
std::string getPythonModule () const override
 Return the fully-qualified Python module that should be imported to guarantee that its factory is registered. More...
 
void write (OutputArchiveHandle &handle) const override
 Write the object to one or more catalogs. More...
 

Static Protected Member Functions

template<class T >
static bool singleClassEquals (T const &lhs, Storable const &rhs)
 Test if a Storable is of a particular class and equal to another object. More...
 

Related Functions

(Note that these are not member functions.)

std::ostreamoperator<< (std::ostream &os, Storable const &storable)
 Output operator for Storable. More...
 

Detailed Description

Holds an integer identifier for an LSST filter.

Definition at line 141 of file Filter.h.

Member Typedef Documentation

◆ OutputArchiveHandle

typedef io::OutputArchiveHandle lsst::afw::table::io::Persistable::OutputArchiveHandle
protectedinherited

Definition at line 108 of file Persistable.h.

Constructor & Destructor Documentation

◆ Filter() [1/5]

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

Creates a Filter with the given name.

Parameters
nameName of filter
forceAllow us to construct an unknown Filter

Definition at line 149 of file Filter.h.

◆ Filter() [2/5]

lsst::afw::image::Filter::Filter ( int  id = UNKNOWN)
inlineexplicit

Creates a Filter with the given identifier.

Parameters
idId number of desired filter

Definition at line 156 of file Filter.h.

◆ Filter() [3/5]

lsst::afw::image::Filter::Filter ( std::shared_ptr< lsst::daf::base::PropertySet const >  metadata,
bool const  force = false 
)
explicit

Create a Filter from a PropertySet (e.g.

a FITS header)

Parameters
metadataMetadata to process (e.g. a IFITS header)
forceAllow us to construct an unknown Filter

Definition at line 122 of file Filter.cc.

◆ Filter() [4/5]

lsst::afw::image::Filter::Filter ( Filter const &  )
default

◆ Filter() [5/5]

lsst::afw::image::Filter::Filter ( Filter &&  )
defaultnoexcept

◆ ~Filter()

lsst::afw::image::Filter::~Filter ( )
defaultnoexcept

Member Function Documentation

◆ cloneStorable()

std::shared_ptr< typehandling::Storable > lsst::afw::image::Filter::cloneStorable ( ) const
overridevirtual

Create a new Filter that is a copy of this one.

Reimplemented from lsst::afw::typehandling::Storable.

Definition at line 176 of file Filter.cc.

◆ define()

int lsst::afw::image::Filter::define ( FilterProperty const &  filterProperty,
int  id = AUTO,
bool  force = false 
)
static

Define a filter name to have the specified id.

If id == Filter::AUTO a value will be chosen for you.

It is an error to attempt to change a name's id (unless you specify force)

Definition at line 256 of file Filter.cc.

◆ defineAlias()

int lsst::afw::image::Filter::defineAlias ( std::string const &  oldName,
std::string const &  newName,
bool  force = false 
)
static

Define an alias for a filter.

Parameters
oldNameold name for Filter
newNamenew name for Filter
forceforce an alias even if newName is already in use

Definition at line 289 of file Filter.cc.

◆ equals()

bool lsst::afw::image::Filter::equals ( typehandling::Storable const &  other) const
overridevirtualnoexcept

Compare this object to another Storable.

Returns
*this == other if other is a Filter; otherwise false.

Reimplemented from lsst::afw::typehandling::Storable.

Definition at line 180 of file Filter.cc.

◆ getAliases()

std::vector< std::string > lsst::afw::image::Filter::getAliases ( ) const

Return all aliases by which this filter is known.

The list excludes the canonical name

Definition at line 146 of file Filter.cc.

◆ getCanonicalName()

std::string const& lsst::afw::image::Filter::getCanonicalName ( ) const
inline

Return a filter's canonical name.

I.e. if this filter's an alias, return the name of the aliased Filter

Definition at line 195 of file Filter.h.

◆ getFilterProperty()

FilterProperty const & lsst::afw::image::Filter::getFilterProperty ( ) const

Return a Filter's FilterProperty.

Definition at line 355 of file Filter.cc.

◆ getId()

int lsst::afw::image::Filter::getId ( ) const
inlinenoexcept

Return a Filter's integral id.

Definition at line 185 of file Filter.h.

◆ getName()

std::string const& lsst::afw::image::Filter::getName ( ) const
inlinenoexcept

Return a Filter's name.

Definition at line 189 of file Filter.h.

◆ getNames()

std::vector< std::string > lsst::afw::image::Filter::getNames ( )
static

Return a list of known filters.

Definition at line 159 of file Filter.cc.

◆ getPersistenceName()

std::string lsst::afw::image::Filter::getPersistenceName ( ) const
overrideprotectedvirtual

Return the unique name used to persist this object and look up its factory.

Must be less than ArchiveIndexSchema::MAX_NAME_LENGTH characters.

Reimplemented from lsst::afw::table::io::Persistable.

Definition at line 220 of file Filter.cc.

◆ getPythonModule()

std::string lsst::afw::image::Filter::getPythonModule ( ) const
overrideprotectedvirtual

Return the fully-qualified Python module that should be imported to guarantee that its factory is registered.

Must be less than ArchiveIndexSchema::MAX_MODULE_LENGTH characters.

Will be ignored if empty.

Reimplemented from lsst::afw::table::io::Persistable.

Definition at line 222 of file Filter.cc.

◆ hash_value()

std::size_t lsst::afw::image::Filter::hash_value ( ) const
overridevirtualnoexcept

Return a hash of this object.

Reimplemented from lsst::afw::typehandling::Storable.

Definition at line 234 of file Filter.cc.

◆ isPersistable()

bool lsst::afw::image::Filter::isPersistable ( ) const
overridevirtualnoexcept

Return true if this particular object can be persisted using afw::table::io.

Reimplemented from lsst::afw::table::io::Persistable.

Definition at line 218 of file Filter.cc.

◆ operator!=()

bool lsst::afw::image::Filter::operator!= ( Filter const &  rhs) const
inlinenoexcept

Definition at line 177 of file Filter.h.

◆ operator=() [1/2]

Filter& lsst::afw::image::Filter::operator= ( Filter &&  )
defaultnoexcept

◆ operator=() [2/2]

Filter& lsst::afw::image::Filter::operator= ( Filter const &  )
default

◆ operator==()

bool lsst::afw::image::Filter::operator== ( Filter const &  rhs) const
noexcept

Are two filters identical?

Definition at line 232 of file Filter.cc.

◆ reset()

static void lsst::afw::image::Filter::reset ( )
inlinestatic

Clear all definitions.

Definition at line 210 of file Filter.h.

◆ singleClassEquals()

template<class T >
static bool lsst::afw::typehandling::Storable::singleClassEquals ( T const &  lhs,
Storable const &  rhs 
)
inlinestaticprotectedinherited

Test if a Storable is of a particular class and equal to another object.

This method template simplifies implementations of equals that delegate to operator== without supporting cross-class comparisons.

Template Parameters
TThe class expected of the two objects to be compared.
Parameters
lhs,rhsThe objects to compare. Note that rhs need not be a T, while lhs must be.
Returns
true if rhs is a T and lhs == rhs; false otherwise.
Exception Safety\n Provides the same level of exception safety as operator==.
Most implementations of operator== do not throw.
Note
This method template calls operator== with both arguments of compile-time type T const&. Its use is not recommended if there would be any ambiguity as to which operator== gets picked by overload resolution.

This method template is typically called from equals as:

bool MyType::equals(Storable const& other) const noexcept {
    return singleClassEquals(*this, other);
}

Definition at line 151 of file Storable.h.

◆ toString()

std::string lsst::afw::typehandling::Storable::toString ( ) const
virtualinherited

Create a string representation of this object (optional operation).

Exceptions
UnsupportedOperationExceptionThrown if this object does not have a string representation.
Note
When called on Python classes, this method delegates to __repr__.

Reimplemented in lsst::afw::image::PhotoCalib, lsst::afw::geom::SkyWcs, lsst::afw::geom::polygon::Polygon, lsst::afw::image::VisitInfo, and lsst::afw::typehandling::StorableHelper< Base >.

Definition at line 40 of file Storable.cc.

◆ write()

void lsst::afw::image::Filter::write ( OutputArchiveHandle handle) const
overrideprotectedvirtual

Write the object to one or more catalogs.

The handle object passed to this function provides an interface for adding new catalogs and adding nested objects to the same archive (while checking for duplicates). See OutputArchiveHandle for more information.

Reimplemented from lsst::afw::table::io::Persistable.

Definition at line 224 of file Filter.cc.

◆ writeFits() [1/3]

void lsst::afw::table::io::Persistable::writeFits ( fits::Fits fitsfile) const
inherited

Write the object to an already-open FITS object.

Parameters
[in]fitsfileOpen FITS object to write to.

Definition at line 18 of file Persistable.cc.

◆ writeFits() [2/3]

void lsst::afw::table::io::Persistable::writeFits ( fits::MemFileManager manager,
std::string const &  mode = "w" 
) const
inherited

Write the object to a FITS image in memory.

Parameters
[in]managerName of the file to write to.
[in]modeIf "w", any existing file with the given name will be overwritten. If "a", new HDUs will be appended to an existing file.

Definition at line 29 of file Persistable.cc.

◆ writeFits() [3/3]

void lsst::afw::table::io::Persistable::writeFits ( std::string const &  fileName,
std::string const &  mode = "w" 
) const
inherited

Write the object to a regular FITS file.

Parameters
[in]fileNameName of the file to write to.
[in]modeIf "w", any existing file with the given name will be overwritten. If "a", new HDUs will be appended to an existing file.

Definition at line 24 of file Persistable.cc.

Friends And Related Function Documentation

◆ operator<<()

std::ostream & operator<< ( std::ostream os,
Storable const &  storable 
)
related

Output operator for Storable.

Parameters
osthe desired output stream
storablethe object to print
Returns
a reference to os
Exceptions
UnsupportedOperationExceptionThrown if storable does not have an implementation of Storable::toString.

Definition at line 174 of file Storable.h.

Member Data Documentation

◆ AUTO

int const lsst::afw::image::Filter::AUTO = -1
static

Definition at line 143 of file Filter.h.

◆ UNKNOWN

int const lsst::afw::image::Filter::UNKNOWN = -1
static

Definition at line 144 of file Filter.h.


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