CCfits  2.6
KeywordCreator.h
1 // Astrophysics Science Division,
2 // NASA/ Goddard Space Flight Center
3 // HEASARC
4 // http://heasarc.gsfc.nasa.gov
5 // e-mail: ccfits@legacy.gsfc.nasa.gov
6 //
7 // Original author: Ben Dorman
8 
9 #ifndef KEYWORDCREATOR_H
10 #define KEYWORDCREATOR_H 1
11 
12 // KeyData
13 #include "KeyData.h"
14 // FitsError
15 #include "FitsError.h"
16 
17 namespace CCfits {
18  class HDU;
19 
20 } // namespace CCfits
21 
22 
23 namespace CCfits {
24 
25 
26 
27  class KeywordCreator
28  {
29 
30  public:
31  KeywordCreator (HDU* p);
32  virtual ~KeywordCreator();
33 
34  virtual Keyword* MakeKeyword (const String& keyName, const String& comment = String(""), bool isLongStr = false) = 0;
35  static Keyword* getKeyword (const String& keyName, HDU* p);
36  // Additional Public Declarations
37  virtual void reset ();
38  virtual Keyword* createKeyword (const String& keyName, const String& comment = String(""), bool isLongStr = false);
39  // This version of getKeyword is for reading a keyword
40  // in with a specified type.
41  static Keyword* getKeyword (const String& keyName, ValueType keyType, HDU* p);
42  static Keyword* getKeyword (int keyNumber, HDU* p);
43  // If calling function already has the keyword name, it can send it in as the
44  // 3rd argument and the function will make use of it. Otherwise leave it
45  // empty and the function will just extract the keyword name from the card.
46  // This function does not take ownership of the memory allocated to card.
47  static Keyword* getKeywordFromCard(char* card, HDU* p, const String& keyName=string(""));
48 
49  // Additional Public Declarations
50 
51  protected:
52  HDU* forHDU ();
53 
54  // Additional Protected Declarations
55 
56  private:
57  KeywordCreator(const KeywordCreator &right);
58  KeywordCreator & operator=(const KeywordCreator &right);
59 
60  static Keyword* parseRecord (const String& name, const String& valueString, const String& comment, HDU* hdu, bool isLongStr = false);
61  static bool isContinued (const String& value);
62  static void getLongValueString (HDU* p, const String& keyName, String& value, String& comment);
63 
64  // Additional Private Declarations
65 
66  private: //## implementation
67  // Data Members for Class Attributes
68  Keyword *m_keyword;
69 
70  // Data Members for Associations
71  HDU* m_forHDU;
72 
73  // Additional Implementation Declarations
74 
75  };
76 
77  // Class CCfits::KeywordCreator
78 
79  inline void KeywordCreator::reset ()
80  {
81  m_keyword=0;
82 
83  }
84 
85  inline HDU* KeywordCreator::forHDU ()
86  {
87  return m_forHDU;
88  }
89 
90 } // namespace CCfits
91 
92 
93 #endif
ValueType
CCfits value types and their CFITSIO equivalents (in caps)
Definition: CCfits.h:81