GroupTable.h
// Astrophysics Science Division,
// NASA/ Goddard Space Flight Center
// HEASARC
// http://heasarc.gsfc.nasa.gov
// e-mail: ccfits@heasarc.gsfc.nasa.gov
//
// Original author: Kristin Rutkowski
#ifndef GROUPTABLE_H
#define GROUPTABLE_H 1
#include "HDUCreator.h"
#include "BinTable.h"
#include <map>
namespace CCfits {
// +++ 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
CCfits::GroupTable
Class representing a hierarchical association of Header Data Units (HDUs).
Definition: GroupTable.h:83
CCfits::HDU
Base class for all HDU [Header-Data Unit] objects.
Definition: HDU.h:673
CCfits::FITS
Memory object representation of a disk FITS file.
Definition: FITS.h:628
CCfits::BinTable
Class Representing Binary Table Extensions. Contains columns with scalar or vector row entries...
Definition: BinTable.h:130
CCfits::GroupTable::listMembers
void listMembers() const
List group members.
Definition: GroupTable.cxx:91
CCfits::GroupTable::GroupTable
GroupTable(FITS *p, int groupID, const String &groupName)
ctor for creating a new group table
Definition: GroupTable.cxx:31
CCfits::GroupTable::addMember
HDU * addMember(HDU &newMember)
Add a new member to the group table. Adds GRPIDn/GRPLCn keywords to the member HDU.
Definition: GroupTable.cxx:45