Class FitsKeys

Nested Relationships

Nested Types

Class Documentation

class FitsKeys

Public Types

typedef std::map<std::string, struct_key_t> fits_key_t

STL map for the actual keyword database.

Public Functions

inline FitsKeys()

default constructor

inline FitsKeys(const FitsKeys &other)

copy constructor, copies the keydb map

inline FitsKeys &operator=(const FitsKeys &other)

assignment operator, assigns the keydb map

inline void merge(const fits_key_t &source)

merges another fits_key_t database (keydb) with this one

inline void erase_db()

erases this fits_key_t database (keydb)

std::string get_keytype(std::string keyvalue)

return type of keyword based on value

long listkeys()

list FITS keys in the internal database

long delkey(const std::string &key)

delete FITS key from the internal database

long addkey(const std::string &arg)

add FITS key to the internal database

long addkey(const std::vector<std::string> &vec)

add FITS key to the internal database

inline long addkey(const std::string &key, bool bval, const std::string &comment)

template function adds FITS keyword to internal database

no parsing is done here

This function is overloaded.

This version adds the keyword=value//comment directly into the database with no parsing. The database stores only strings so the type variable preserves the type and informs the FITS writer.

The template input “tval” here allows passing in any type of value, and the type will be set by the actual input type. However, if the input type is a string then an attempt will be made to infer the type from the string (this allows passing in a string “12.345” and have it be converted to a double.

The prec argument sets the displayed precision of double or float types if passed in as a double or float. Default is 8 if not supplied.

The overloading for type bool is because for the template class, since T can be evaluated as string, it can’t be treated as bool, so this is the easiest way to extract the bool value.

Parameters:
  • keyword[in] keyword name <string>

  • value[in] value for keyword, any type <T>

  • comment[in] comment <string>

  • prec[in] decimal places of precision

Returns:

ERROR or NO_ERROR

template<class T>
inline long addkey(const std::string &key, T tval, const std::string &comment)
template<class T>
inline long addkey(const std::string &key, T tval, const std::string &comment, const char *type)
template<class T>
inline long addkey(const std::string &key, T tval, const std::string &comment, std::string type)
template<class T>
inline long addkey(const std::string &key, T tval, const std::string &comment, int prec)
template<class T>
inline long do_addkey(const std::string &keyin, T tval, const std::string &comment, int prec, std::string type_in)
inline std::vector<fits_key_t::const_iterator> FindKeys(std::string search_for)
inline void EraseKeys(std::string search_for)
template<typename T>
inline T get_key(const std::string &keyname) const

Public Members

fits_key_t keydb

keyword database

struct struct_key_t

structure of FITS keyword internal database

Public Members

std::string keyword
std::string keytype
std::string keyvalue
std::string keycomment