CCfits
2.7
|
00001 // Astrophysics Science Division, 00002 // NASA/ Goddard Space Flight Center 00003 // HEASARC 00004 // http://heasarc.gsfc.nasa.gov 00005 // e-mail: ccfits@heasarc.gsfc.nasa.gov 00006 // 00007 // Original author: Kristin Rutkowski 00008 00009 #ifndef GROUPTABLE_H 00010 #define GROUPTABLE_H 1 00011 00012 #include "HDUCreator.h" 00013 #include "BinTable.h" 00014 00015 #include <map> 00016 00017 namespace CCfits { 00018 00081 // +++ just name it Group? 00082 00083 class GroupTable : public BinTable 00084 { 00085 00086 // ******************************** 00087 // public methods 00088 // ******************************** 00089 00090 public: 00091 00092 ~GroupTable(); 00093 00094 // +++ ? 00095 //bool operator==(const GroupTable & right) const; 00096 //bool operator!=(const GroupTable & right) const; 00097 00098 // +++ returning a ptr to the newly added member? 00099 HDU * addMember (HDU & newMember); 00100 HDU * addMember (int memberPosition); 00101 00102 // +++ deleteHDU must be false for now 00103 //HDU * removeMember (LONGLONG memberNumber, bool deleteHDU = false); 00104 //HDU * removeMember (HDU & member, bool deleteHDU = false); 00105 HDU * removeMember (LONGLONG memberNumber); 00106 HDU * removeMember (HDU & member); 00107 00108 // +++ should I be offering default values for these booleans? 00109 // void mergeGroups (GroupTable & other, bool removeOther = false) ; 00110 // void compactGroup (bool deleteSubGroupTables = false) ; 00111 00112 // void copyMember (HDU & member) ; 00113 // void copyGroup () ; 00114 // void removeGroup () ; 00115 // bool verifyGroup () const ; // +++ this function name doesn't really indicate bool 00116 00117 void listMembers() const; 00118 00119 LONGLONG getNumMembers () const ; 00120 int getID () const ; 00121 const String & getName () const ; 00122 //virtual HDU * getHDUPtr () const; 00123 00124 // method to determine if this object is a GroupTable 00125 // +++ or have bool isComposite() ? 00126 //virtual GroupTable * getComposite () ; 00127 00128 00129 //Iterator<GroupComponent> createIterator () ; 00130 //typedef std::vector<GroupComponent *>::iterator iterator; 00131 //std::vector<GroupComponent *>::iterator begin() { return m_members.begin(); } 00132 //std::vector<GroupComponent *>::iterator end() { return m_members.end(); } 00133 00134 00135 // ******************************** 00136 // protected methods 00137 // ******************************** 00138 00139 protected: 00140 00141 //GroupTable (const GroupTable & right); 00142 00143 // create a new grouping table 00144 // +++ we'll go ahead and require a groupname 00145 // +++ make version default = 1? 00146 GroupTable (FITS* p, int groupID, const String & groupName); 00147 00148 // create an existing grouping table 00149 //GroupTable (FITS* p); 00150 00151 00152 // ******************************** 00153 // private methods 00154 // ******************************** 00155 00156 private: 00157 00158 //GroupTable & operator=(const GroupTable &right); 00159 00160 00161 00162 // ******************************** 00163 // data members 00164 // ******************************** 00165 00166 private: 00167 00168 string m_name; // GRPNAME keyword 00169 int m_id; // EXTVER keyword // +++ int? 00170 std::vector<HDU *> m_members; 00171 // +++ is a vector the best data structure for this? prob not a map. each member doesn't have to have a name. 00172 // +++ if we don't have a class GroupMember, then we can't find out how many groups a member is part of 00173 00174 LONGLONG m_numMembers; // +++ https://heasarc.gsfc.nasa.gov/fitsio/c/c_user/node32.html lrgst size of NAXIS2 00175 // +++ this could use a ULONGLONG datatype, since rows can't be neg 00176 00177 // +++ I think we need to keep information about the location of the group table 00178 // because some members identify that they are a member of a group, and have the location of the group 00179 00180 00181 // ******************************** 00182 // Additional Implementation Declarations 00183 // ******************************** 00184 00185 private: //## implementation 00186 00187 // for the HDU* MakeTable() function 00188 friend class HDUCreator; 00189 00190 }; // end-class GroupTable 00191 00192 00193 // ******************************** 00194 // INLINE METHODS 00195 // ******************************** 00196 00197 inline LONGLONG GroupTable::getNumMembers () const 00198 { 00199 return m_numMembers; 00200 } 00201 00202 inline int GroupTable::getID () const 00203 { 00204 return m_id; 00205 } 00206 00207 // +++ name could be blank/null 00208 inline const string & GroupTable::getName () const 00209 { 00210 return m_name; 00211 } 00212 00213 // inline GroupTable * GroupTable::getComposite () 00214 // { 00215 // return this; 00216 // } 00217 00218 00219 } // end-namespace CCfits 00220 00221 // end-ifndef GROUPTABLE_H 00222 #endif