CCfits  2.6
GroupTable.h
1 // Astrophysics Science Division,
2 // NASA/ Goddard Space Flight Center
3 // HEASARC
4 // http://heasarc.gsfc.nasa.gov
5 // e-mail: ccfits@heasarc.gsfc.nasa.gov
6 //
7 // Original author: Kristin Rutkowski
8 
9 #ifndef GROUPTABLE_H
10 #define GROUPTABLE_H 1
11 
12 #include "HDUCreator.h"
13 #include "BinTable.h"
14 
15 #include <map>
16 
17 namespace CCfits {
18 
81  // +++ just name it Group?
82 
83  class GroupTable : public BinTable
84  {
85 
86  // ********************************
87  // public methods
88  // ********************************
89 
90  public:
91 
92  ~GroupTable();
93 
94  // +++ ?
95  //bool operator==(const GroupTable & right) const;
96  //bool operator!=(const GroupTable & right) const;
97 
98  // +++ returning a ptr to the newly added member?
99  HDU * addMember (HDU & newMember);
100  HDU * addMember (int memberPosition);
101 
102  // +++ deleteHDU must be false for now
103  //HDU * removeMember (LONGLONG memberNumber, bool deleteHDU = false);
104  //HDU * removeMember (HDU & member, bool deleteHDU = false);
105  HDU * removeMember (LONGLONG memberNumber);
106  HDU * removeMember (HDU & member);
107 
108  // +++ should I be offering default values for these booleans?
109 // void mergeGroups (GroupTable & other, bool removeOther = false) ;
110 // void compactGroup (bool deleteSubGroupTables = false) ;
111 
112 // void copyMember (HDU & member) ;
113 // void copyGroup () ;
114 // void removeGroup () ;
115 // bool verifyGroup () const ; // +++ this function name doesn't really indicate bool
116 
117  void listMembers() const;
118 
119  LONGLONG getNumMembers () const ;
120  int getID () const ;
121  const String & getName () const ;
122  //virtual HDU * getHDUPtr () const;
123 
124  // method to determine if this object is a GroupTable
125  // +++ or have bool isComposite() ?
126  //virtual GroupTable * getComposite () ;
127 
128 
129  //Iterator<GroupComponent> createIterator () ;
130  //typedef std::vector<GroupComponent *>::iterator iterator;
131  //std::vector<GroupComponent *>::iterator begin() { return m_members.begin(); }
132  //std::vector<GroupComponent *>::iterator end() { return m_members.end(); }
133 
134 
135  // ********************************
136  // protected methods
137  // ********************************
138 
139  protected:
140 
141  //GroupTable (const GroupTable & right);
142 
143  // create a new grouping table
144  // +++ we'll go ahead and require a groupname
145  // +++ make version default = 1?
146  GroupTable (FITS* p, int groupID, const String & groupName);
147 
148  // create an existing grouping table
149  //GroupTable (FITS* p);
150 
151 
152  // ********************************
153  // private methods
154  // ********************************
155 
156  private:
157 
158  //GroupTable & operator=(const GroupTable &right);
159 
160 
161 
162  // ********************************
163  // data members
164  // ********************************
165 
166  private:
167 
168  string m_name; // GRPNAME keyword
169  int m_id; // EXTVER keyword // +++ int?
170  std::vector<HDU *> m_members;
171  // +++ is a vector the best data structure for this? prob not a map. each member doesn't have to have a name.
172  // +++ if we don't have a class GroupMember, then we can't find out how many groups a member is part of
173 
174  LONGLONG m_numMembers; // +++ https://heasarc.gsfc.nasa.gov/fitsio/c/c_user/node32.html lrgst size of NAXIS2
175  // +++ this could use a ULONGLONG datatype, since rows can't be neg
176 
177  // +++ I think we need to keep information about the location of the group table
178  // because some members identify that they are a member of a group, and have the location of the group
179 
180 
181  // ********************************
182  // Additional Implementation Declarations
183  // ********************************
184 
185  private: //## implementation
186 
187  // for the HDU* MakeTable() function
188  friend class HDUCreator;
189 
190  }; // end-class GroupTable
191 
192 
193  // ********************************
194  // INLINE METHODS
195  // ********************************
196 
197  inline LONGLONG GroupTable::getNumMembers () const
198  {
199  return m_numMembers;
200  }
201 
202  inline int GroupTable::getID () const
203  {
204  return m_id;
205  }
206 
207  // +++ name could be blank/null
208  inline const string & GroupTable::getName () const
209  {
210  return m_name;
211  }
212 
213 // inline GroupTable * GroupTable::getComposite ()
214 // {
215 // return this;
216 // }
217 
218 
219 } // end-namespace CCfits
220 
221 // end-ifndef GROUPTABLE_H
222 #endif
Class representing a hierarchical association of Header Data Units (HDUs).
Definition: GroupTable.h:83
Base class for all HDU [Header-Data Unit] objects.
Definition: HDU.h:673
Memory object representation of a disk FITS file.
Definition: FITS.h:628
Class Representing Binary Table Extensions. Contains columns with scalar or vector row entries...
Definition: BinTable.h:130
void listMembers() const
List group members.
Definition: GroupTable.cxx:91
GroupTable(FITS *p, int groupID, const String &groupName)
ctor for creating a new group table
Definition: GroupTable.cxx:31
HDU * addMember(HDU &newMember)
Add a new member to the group table. Adds GRPIDn/GRPLCn keywords to the member HDU.
Definition: GroupTable.cxx:45