-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGroupTable.h
222 lines (143 loc) · 6.09 KB
/
GroupTable.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
// Astrophysics Science Division,
// NASA/ Goddard Space Flight Center
// HEASARC
// http://heasarc.gsfc.nasa.gov
// e-mail: [email protected]
//
// Original author: Kristin Rutkowski
#ifndef GROUPTABLE_H
#define GROUPTABLE_H 1
#include "HDUCreator.h"
#include "BinTable.h"
#include <map>
namespace CCfits {
/*! \class GroupTable
\brief Class representing a hierarchical association of Header
Data Units (HDUs).
Groups of HDUs allow for the hierarchical association of HDUs.
Offices may want to group together HDUs in order to organize
data files. The associated HDUs need not be in the same FITS file.
Group Composites are the holding structure for the group members.
Composites may also be members of a group.
The specification for grouping is defined in "A Hierarchical
Grouping Convention for FITS" by Jennings, Pence, Folk and
Schlesinger at
https://fits.gsfc.nasa.gov/registry/grouping/grouping.pdf
*/
/*! \fn GroupTable::GroupTable (FITS* p, int groupID, const String & groupName);
\brief ctor for creating a new group table
\param p The FITS file in which to place the new HDU
\param groupID ID of new group table
\param groupName Name of new group table
*/
/*! \fn HDU * GroupTable::addMember (HDU & newMember)
\brief Add a new member to the group table. Adds GRPIDn/GRPLCn
keywords to the member HDU.
\param newMember Member HDU to be added
*/
/*! \fn HDU * GroupTable::addMember(int memberPosition)
\brief Add a new member to the group table. Adds GRPIDn/GRPLCn
keywords to the member HDU. The member must be in the same
file as the group table.
\param memberPosition Position of HDU to add (Primary array == 1)
*/
/*! \fn void GroupTable::listMembers() const
\brief List group members
*/
// +++ just name it Group?
class GroupTable : public BinTable
{
// ********************************
// public methods
// ********************************
public:
~GroupTable();
// +++ ?
//bool operator==(const GroupTable & right) const;
//bool operator!=(const GroupTable & right) const;
// +++ returning a ptr to the newly added member?
HDU * addMember (HDU & newMember);
HDU * addMember (int memberPosition);
// +++ deleteHDU must be false for now
//HDU * removeMember (LONGLONG memberNumber, bool deleteHDU = false);
//HDU * removeMember (HDU & member, bool deleteHDU = false);
HDU * removeMember (LONGLONG memberNumber);
HDU * removeMember (HDU & member);
// +++ should I be offering default values for these booleans?
// void mergeGroups (GroupTable & other, bool removeOther = false) ;
// void compactGroup (bool deleteSubGroupTables = false) ;
// void copyMember (HDU & member) ;
// void copyGroup () ;
// void removeGroup () ;
// bool verifyGroup () const ; // +++ this function name doesn't really indicate bool
void listMembers() const;
LONGLONG getNumMembers () const ;
int getID () const ;
const String & getName () const ;
//virtual HDU * getHDUPtr () const;
// method to determine if this object is a GroupTable
// +++ or have bool isComposite() ?
//virtual GroupTable * getComposite () ;
//Iterator<GroupComponent> createIterator () ;
//typedef std::vector<GroupComponent *>::iterator iterator;
//std::vector<GroupComponent *>::iterator begin() { return m_members.begin(); }
//std::vector<GroupComponent *>::iterator end() { return m_members.end(); }
// ********************************
// protected methods
// ********************************
protected:
//GroupTable (const GroupTable & right);
// create a new grouping table
// +++ we'll go ahead and require a groupname
// +++ make version default = 1?
GroupTable (FITS* p, int groupID, const String & groupName);
// create an existing grouping table
//GroupTable (FITS* p);
// ********************************
// private methods
// ********************************
private:
//GroupTable & operator=(const GroupTable &right);
// ********************************
// data members
// ********************************
private:
string m_name; // GRPNAME keyword
int m_id; // EXTVER keyword // +++ int?
std::vector<HDU *> m_members;
// +++ is a vector the best data structure for this? prob not a map. each member doesn't have to have a name.
// +++ if we don't have a class GroupMember, then we can't find out how many groups a member is part of
LONGLONG m_numMembers; // +++ https://heasarc.gsfc.nasa.gov/fitsio/c/c_user/node32.html lrgst size of NAXIS2
// +++ this could use a ULONGLONG datatype, since rows can't be neg
// +++ I think we need to keep information about the location of the group table
// because some members identify that they are a member of a group, and have the location of the group
// ********************************
// Additional Implementation Declarations
// ********************************
private: //## implementation
// for the HDU* MakeTable() function
friend class HDUCreator;
}; // end-class GroupTable
// ********************************
// INLINE METHODS
// ********************************
inline LONGLONG GroupTable::getNumMembers () const
{
return m_numMembers;
}
inline int GroupTable::getID () const
{
return m_id;
}
// +++ name could be blank/null
inline const string & GroupTable::getName () const
{
return m_name;
}
// inline GroupTable * GroupTable::getComposite ()
// {
// return this;
// }
} // end-namespace CCfits
// end-ifndef GROUPTABLE_H
#endif