Keyword.h
// Astrophysics Science Division,
// NASA/ Goddard Space Flight Center
// HEASARC
// http://heasarc.gsfc.nasa.gov
// e-mail: ccfits@legacy.gsfc.nasa.gov
//
// Original author: Ben Dorman
#ifndef KEYWORD_H
#define KEYWORD_H 1
#include "CCfits.h"
// using namespace CCfits;
#ifdef _MSC_VER
#include "MSconfig.h"
#endif
// FitsError
#include "FitsError.h"
namespace CCfits {
class HDU;
} // namespace CCfits
namespace CCfits {
/* \fn friend ostream& operator << (ostream &s, const Keyword &right);
\brief output operator for Keywords.
*/
class Keyword
{
public:
class WrongKeywordValueType : public FitsException //## Inherits: <unnamed>%39B0221700E2
{
public:
WrongKeywordValueType (const String& diag, bool silent = true);
protected:
private:
private: //## implementation
};
virtual ~Keyword();
Keyword & operator=(const Keyword &right);
bool operator==(const Keyword &right) const;
bool operator!=(const Keyword &right) const;
virtual std::ostream & put (std::ostream &s) const = 0;
virtual Keyword * clone () const = 0;
virtual void write ();
fitsfile* fitsPointer () const;
// CAUTION: This is declared public only to allow HDU addKey functions the ability to set their
// class as the Keyword's parent, and to avoid making entire HDU a friend class. (Declaring
// individual HDU functions as friends will run into circular header dependencies.) Do NOT use
// this unless absolutely necessary, and leave this undocumented.
void setParent (HDU* parent);
ValueType keytype () const;
const String& comment () const;
const String& name () const;
bool isLongStr () const;
public:
// Additional Public Declarations
template <typename T>
T& value(T& val) const;
template <typename T>
void setValue(const T& newValue);
protected:
Keyword(const Keyword &right);
Keyword (const String &keyname,
ValueType keytype,
HDU* p,
const String &comment = "",
bool isLongStr = false);
virtual void copy (const Keyword& right);
virtual bool compare (const Keyword &right) const;
void keytype (ValueType value);
const HDU* parent () const;
// Additional Protected Declarations
private:
// Additional Private Declarations
private: //## implementation
// Data Members for Class Attributes
ValueType m_keytype;
// Data Members for Associations
HDU* m_parent;
String m_comment;
String m_name;
bool m_isLongStr;
// Additional Implementation Declarations
friend std::ostream &operator << (std::ostream &s, const Keyword &right);
};
#ifndef SPEC_TEMPLATE_IMP_DEFECT
#ifndef SPEC_TEMPLATE_DECL_DEFECT
template <> float& Keyword::value(float& val) const;
template <> double& Keyword::value(double& val) const;
template <> int& Keyword::value(int& val) const;
template <> String& Keyword::value(String& val) const;
template <> void Keyword::setValue(const float& newValue);
template <> void Keyword::setValue(const double& newValue);
template <> void Keyword::setValue(const int& newValue);
#endif
#endif
inline std::ostream& operator << (std::ostream &s, const Keyword &right)
{
return right.put(s);
}
// Class CCfits::Keyword::WrongKeywordValueType
// Class CCfits::Keyword
inline void Keyword::setParent (HDU* parent)
{
m_parent = parent;
}
inline ValueType Keyword::keytype () const
{
return m_keytype;
}
inline void Keyword::keytype (ValueType value)
{
m_keytype = value;
}
inline const HDU* Keyword::parent () const
{
return m_parent;
}
inline const String& Keyword::comment () const
{
return m_comment;
}
inline const String& Keyword::name () const
{
return m_name;
}
inline bool Keyword::isLongStr () const
{
return m_isLongStr;
}
} // namespace CCfits
#endif
CCfits::Keyword::keytype
ValueType keytype() const
return the type of a keyword
Definition: Keyword.h:300
CCfits::Keyword::~Keyword
virtual ~Keyword()
virtual destructor
Definition: Keyword.cxx:55
CCfits::Keyword::comment
const String & comment() const
return the comment field of the keyword
Definition: Keyword.h:315
CCfits::Keyword::clone
virtual Keyword * clone() const =0
virtual copy constructor
CCfits::Keyword::name
const String & name() const
return the name of a keyword
Definition: Keyword.h:320
CCfits::Keyword
Abstract base class defining the interface for Keyword objects.
Definition: Keyword.h:198
CCfits::HDU
Base class for all HDU [Header-Data Unit] objects.
Definition: HDU.h:673
CCfits::Keyword::write
virtual void write()
left in for historical reasons, this seldom needs to be called by users
Definition: Keyword.cxx:97
CCfits::FitsException
FitsException is the base class for all exceptions thrown by this library.
Definition: FitsError.h:93
CCfits::Keyword::Keyword
Keyword(const Keyword &right)
copy constructor
Definition: Keyword.cxx:36
CCfits::ValueType
ValueType
CCfits value types and their CFITSIO equivalents (in caps)
Definition: CCfits.h:81
CCfits::operator<<
std::ostream & operator<<(std::ostream &s, const Column &right)
output operator for Column objects.
Definition: Column.h:1337
CCfits::Keyword::value
T & value(T &val) const
get the keyword value
Definition: KeywordT.h:29
CCfits::Keyword::parent
const HDU * parent() const
return a pointer to parent HDU.
Definition: Keyword.h:310
CCfits::Keyword::operator==
bool operator==(const Keyword &right) const
equality operator
Definition: Keyword.cxx:67
CCfits::Keyword::operator!=
bool operator!=(const Keyword &right) const
inequality operator
Definition: Keyword.cxx:72
CCfits::Keyword::setValue
void setValue(const T &newValue)
modify the value of an existing Keyword and write it to the file
Definition: KeywordT.h:44
CCfits::Keyword::fitsPointer
fitsfile * fitsPointer() const
return a pointer to the FITS file containing the parent HDU.
Definition: Keyword.cxx:109
CCfits::Keyword::operator=
Keyword & operator=(const Keyword &right)
assignment operator
Definition: Keyword.cxx:60