38 #define G_ELEMENTS1 "GFitsTableCol::elements(int&, int&)"
39 #define G_ELEMENTS2 "GFitsTableCol::elements(int&)"
40 #define G_LOAD_COLUMN_FIXED "GFitsTableCol::load_column_fixed()"
41 #define G_LOAD_COLUMN_VARIABLE "GFitsTableCol::load_column_variable()"
42 #define G_SAVE_COLUMN_FIXED "GFitsTableCol::save_column_fixed()"
43 #define G_SAVE_COLUMN_VARIABLE "GFitsTableCol::save_column_variable()"
44 #define G_OFFSET "GFitsTableCol::offset(int&, int&)"
167 if (
this != &column) {
207 if (row < 0 || row >=
nrows()) {
214 std::string msg =
"Number of elements " +
gammalib::str(elements) +
215 " can not be negative. Please specify a"
216 " non-negative number of elements.";
229 if (difference > 0) {
237 else if (difference < 0) {
242 for (
int i = row + 1; i <=
nrows(); ++i) {
248 for (
int i = 0; i <
nrows(); ++i) {
279 if (row < 0 || row >=
nrows()) {
302 std::string typecode =
"";
368 tform.append(typecode);
398 if (
unit().length() > 0) {
416 result.append(
"[loaded] ");
419 result.append(
"[not loaded] ");
426 if (!
dim().empty()) {
430 for (
int k = 1; k <
dim().size(); ++k) {
436 result.append(
" "+value);
446 result.append(
" varlen=");
451 result.append(
"undetermined");
470 #if defined(G_PRINT_CONTENT)
477 for (
int row = 0; row <
nrows(); ++row) {
480 result.append(
"start=");
484 for (
int inx = 0; inx <
elements(row); ++inx) {
485 result.append(
" "+
string(row, inx));
489 result.append(
"\nend=");
604 if (status != 252 && status != 107) {
608 std::string msg =
"FITS HDU number "+
610 " not found in FITS file.";
620 "for column \""+
m_name+
"\".");
672 if (status != 252 && status != 107) {
676 std::string msg =
"FITS HDU number "+
678 " not found in FITS file.";
690 for (
int row = 0; row <
m_length; ++row) {
704 std::string msg =
"Unable to get descriptor of row "+
706 name()+
"' from FITS file.";
725 for (
int row = 0; row <
m_length; ++row) {
742 std::string msg =
"Unable to load row "+
gammalib::str(row+1)+
""
743 " of column '"+
name()+
"' from FITS file.";
811 std::string msg =
"FITS HDU number "+
813 " not found in FITS file.";
821 std::string msg =
"Unable to save column '"+
name()+
"' to"
862 std::string msg =
"FITS HDU number "+
864 " not found in FITS file.";
869 for (
int row = 0; row <
m_length; ++row) {
882 std::string msg =
"Unable to save row "+
gammalib::str(row+1)+
""
883 " of column '"+
name()+
"' to FITS file.";
913 #if defined(G_RANGE_CHECK)
920 #if defined(G_RANGE_CHECK)
921 if (inx < 0 || inx >=
elements(row)) {
947 #if defined(G_CALL_GRAPH)
948 printf(
"GFitsTableCol::init_members\n");
974 #if defined(G_CALL_GRAPH)
975 printf(
"exit GFitsTableCol::init_members\n");
1019 #if defined(G_CALL_GRAPH)
1020 printf(
"GFitsTableCol::free_members\n");
1030 #if defined(G_CALL_GRAPH)
1031 printf(
"exit GFitsTableCol::free_members\n");
#define __fftscl(A, B, C, D, E)
virtual void * ptr_nulval(void)=0
virtual void init_data(void)=0
const int & anynul(void) const
Return number of NULLs encountered.
std::string number(const std::string &noun, const int &number)
Convert singular noun into number noun.
void connect(void *vptr)
Connect table column to FITS file.
int m_colnum
Column number (starting from 1). This parameter is used to signal if a table column corresponds to a ...
bool m_variable
Signals if column is variable length.
int m_anynul
Number of NULLs encountered.
GVector abs(const GVector &vector)
Computes absolute of vector elements.
int m_number
Number of elements in column.
virtual ~GFitsTableCol(void)
Destructor.
void free_members(void)
Delete class members.
#define G_LOAD_COLUMN_VARIABLE
double m_tscale
Optional scaling factor (1 = no scaling)
GFitsTableCol & operator=(const GFitsTableCol &column)
Assignment operator.
const std::string & name(void) const
Returns column name.
void elements(const int &row, const int &elements)
Set number of column elements for specific row.
std::vector< int > m_dim
Column dimension.
int m_varlen
Maximum number of elements in variable-length.
const bool & is_variable(void) const
Signals if column is of variable length.
#define __ffgcv(A, B, C, D, E, F, G, H, I, J)
virtual void save_column_fixed(void)
Save table column into FITS file.
const std::string & unit(void) const
Returns column unit.
FITS table column abstract base class definition.
#define G_LOAD_COLUMN_FIXED
virtual void load_column(void)
Load table column from FITS file.
virtual void alloc_data(void)=0
virtual void load_column_variable(void)
Load variable-length column from FITS file.
std::string right(const std::string &s, const int &n, const char &c= ' ')
Right justify string to achieve a length of n characters.
const int & number(void) const
Returns number of elements in column.
std::string print(const GChatter &chatter=NORMAL) const
Print column information.
#define __ffmahd(A, B, C, D)
void init_members(void)
Initialise class members.
CFITSIO interface header.
std::string m_unit
Column unit.
Abstract interface for FITS table column.
const double & tscale(void) const
Return TSCALE value.
std::vector< int > m_rowstart
Start index of each row.
int m_repeat
Repeat value of column.
const std::vector< int > & dim(void) const
Returns column dimension.
std::string m_name
Column name.
virtual void save(void)
Save table column into FITS file.
virtual void resize_data(const int &index, const int &number)=0
int m_length
Length of column (number of rows)
const int & repeat(void) const
Returns column repeat value (only used for binary tables)
virtual void * ptr_data(const int &index=0)=0
int m_size
Size of allocated data area (0 if not loaded)
#define __ffpcn(A, B, C, D, E, F, G, H, I)
virtual int offset(const int &row, const int &inx) const
Compute offset of column element in memory.
virtual bool is_loaded(void) const =0
void copy_members(const GFitsTableCol &column)
Copy class members.
Exception handler interface definition.
GFitsTableCol(void)
Void constructor.
#define G_SAVE_COLUMN_FIXED
virtual void save_column(void)
Save table column into FITS file.
const int & type(void) const
Returns CFITSIO column type.
virtual void fetch_data(void) const =0
virtual void save_column_variable(void)
Save table column into FITS file.
void * m_fitsfile
FITS file pointer associated with column.
const int & nrows(void) const
Returns number of rows in column.
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
virtual std::string ascii_format(void) const =0
virtual void load_column_fixed(void)
Load fixed-length column from FITS file.
#define G_SAVE_COLUMN_VARIABLE
const int & width(void) const
Return width in Bytes of one column element.
int m_width
Width in Bytes of single column element.
#define __ffgdes(A, B, C, D, E, F)
std::string tform_binary(void) const
Returns TFORM code for binary table column.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.