GammaLib  1.7.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GFitsTableStringCol.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GFitsTableStringCol.cpp - FITS table string column class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2010-2017 by Juergen Knoedlseder *
5  * ----------------------------------------------------------------------- *
6  * *
7  * This program is free software: you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation, either version 3 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This program is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15  * GNU General Public License for more details. *
16  * *
17  * You should have received a copy of the GNU General Public License *
18  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
19  * *
20  ***************************************************************************/
21 /**
22  * @file GFitsTableStringCol.cpp
23  * @brief FITS table string column class implementation
24  * @author Juergen Knoedlseder
25  */
26 
27 /* __ Includes ___________________________________________________________ */
28 #ifdef HAVE_CONFIG_H
29 #include <config.h>
30 #endif
31 #include <cstring> // std::strncpy, etc...
32 #include <string>
33 #include "GException.hpp"
34 #include "GTools.hpp"
35 #include "GFitsCfitsio.hpp"
36 #include "GFitsTableStringCol.hpp"
37 
38 /* __ Method name definitions ____________________________________________ */
39 #define G_INSERT "GFitsTableStringCol::insert(int&, int&)"
40 #define G_REMOVE "GFitsTableStringCol::remove(int&, int&)"
41 
42 /* __ Macros _____________________________________________________________ */
43 
44 /* __ Coding definitions _________________________________________________ */
45 
46 /* __ Debug definitions __________________________________________________ */
47 
48 
49 /*==========================================================================
50  = =
51  = Constructors/destructors =
52  = =
53  ==========================================================================*/
54 
55 /***********************************************************************//**
56  * @brief Constructor
57  ***************************************************************************/
59 {
60  // Initialise class members for clean destruction
61  init_members();
62 
63  // Return
64  return;
65 }
66 
67 
68 /***********************************************************************//**
69  * @brief Constructor
70  *
71  * @param[in] name Name of column.
72  * @param[in] nrows Number of rows in column.
73  * @param[in] width Length of individual string.
74  * @param[in] size Number of strings in each column.
75  ***************************************************************************/
77  const int& nrows,
78  const int& width,
79  const int& size) :
80  GFitsTableCol(name, nrows, size, width)
81 {
82  // Initialise class members for clean destruction
83  init_members();
84 
85  // Return
86  return;
87 }
88 
89 
90 /***********************************************************************//**
91  * @brief Copy constructor
92  *
93  * @param[in] column Table column.
94  ***************************************************************************/
96  GFitsTableCol(column)
97 {
98  // Initialise class members for clean destruction
99  init_members();
100 
101  // Copy members
102  copy_members(column);
103 
104  // Return
105  return;
106 }
107 
108 
109 /***********************************************************************//**
110  * @brief Destructor
111  ***************************************************************************/
113 {
114  // Free members
115  free_members();
116 
117  // Return
118  return;
119 }
120 
121 
122 /*==========================================================================
123  = =
124  = Operators =
125  = =
126  ==========================================================================*/
127 
128 /***********************************************************************//**
129  * @brief Assignment operator
130  *
131  * @param[in] column Table column.
132  * @return Table column.
133  ***************************************************************************/
135 {
136  // Execute only if object is not identical
137  if (this != &column) {
138 
139  // Copy base class members
140  this->GFitsTableCol::operator=(column);
141 
142  // Free members
143  free_members();
144 
145  // Initialise private members for clean destruction
146  init_members();
147 
148  // Copy members
149  copy_members(column);
150 
151  } // endif: object was not identical
152 
153  // Return this object
154  return *this;
155 }
156 
157 
158 /***********************************************************************//**
159  * @brief Column data access operator
160  *
161  * @param[in] row Row of column to access.
162  * @param[in] inx Vector index in column row to access.
163  *
164  * Provides access to data in a column.
165  ***************************************************************************/
166 std::string& GFitsTableStringCol::operator()(const int& row, const int& inx)
167 {
168  // If data are not available then load them now
169  if (m_data == NULL) fetch_data();
170 
171  // Return data bin
172  return m_data[offset(row, inx)];
173 }
174 
175 
176 /***********************************************************************//**
177  * @brief Column data access operator (const variant)
178  *
179  * @param[in] row Row of column to access.
180  * @param[in] inx Vector index in column row to access.
181  *
182  * Provides access to data in a column.
183  ***************************************************************************/
184 const std::string& GFitsTableStringCol::operator()(const int& row, const int& inx) const
185 {
186  // If data are not available then load them now
187  if (m_data == NULL) fetch_data();
188 
189  // Return data bin
190  return m_data[offset(row, inx)];
191 }
192 
193 
194 /*==========================================================================
195  = =
196  = Public methods =
197  = =
198  ==========================================================================*/
199 
200 /***********************************************************************//**
201  * @brief Clear instance
202  *
203  * This method properly resets the object to an initial state.
204  ***************************************************************************/
206 {
207  // Free class members (base and derived classes, derived class first)
208  free_members();
210 
211  // Initialise members
213  init_members();
214 
215  // Return
216  return;
217 }
218 
219 
220 /***********************************************************************//**
221  * @brief Clone column
222  ***************************************************************************/
224 {
225  return new GFitsTableStringCol(*this);
226 }
227 
228 
229 /***********************************************************************//**
230  * @brief Get string value
231  *
232  * @param[in] row Table row.
233  * @param[in] inx Table column vector index.
234  *
235  * Returns value of specified row and vector index as string.
236  ***************************************************************************/
237 std::string GFitsTableStringCol::string(const int& row, const int& inx) const
238 {
239  // If data are not available then load them now
240  if (m_data == NULL) fetch_data();
241 
242  // Return value
243  return m_data[offset(row,inx)];
244 }
245 
246 
247 /***********************************************************************//**
248  * @brief Get double precision value
249  *
250  * @param[in] row Table row.
251  * @param[in] inx Table column vector index.
252  *
253  * Returns value of specified row and vector index as double precision.
254  ***************************************************************************/
255 double GFitsTableStringCol::real(const int& row, const int& inx) const
256 {
257  // If data are not available then load them now
258  if (m_data == NULL) fetch_data();
259 
260  // Assign string to double
261  double value = gammalib::todouble(m_data[offset(row,inx)]);
262 
263  // Return value
264  return value;
265 }
266 
267 
268 /***********************************************************************//**
269  * @brief Get integer value
270  *
271  * @param[in] row Table row.
272  * @param[in] inx Table column vector index.
273  *
274  * Returns value of specified row and vector index as integer.
275  ***************************************************************************/
276 int GFitsTableStringCol::integer(const int& row, const int& inx) const
277 {
278  // If data are not available then load them now
279  if (m_data == NULL) fetch_data();
280 
281  // Assign string to int
282  int value = gammalib::toint(m_data[offset(row,inx)]);
283 
284  // Return value
285  return value;
286 }
287 
288 
289 /***********************************************************************//**
290  * @brief Insert rows in column
291  *
292  * @param[in] row Row after which rows should be inserted (0=first row).
293  * @param[in] nrows Number of rows to be inserted.
294  *
295  * @exception GException::fits_invalid_row
296  * Specified row is invalid.
297  *
298  * Inserts rows into a FITS table. This implies that all columns will be
299  * loaded into memory.
300  ***************************************************************************/
301 void GFitsTableStringCol::insert(const int& row, const int& nrows)
302 {
303  // Make sure that row is valid
304  if (row < 0 || row > m_length) {
305  throw GException::fits_invalid_row(G_INSERT, row, m_length);
306  }
307 
308  // Continue only if there are rows to be inserted
309  if (nrows > 0) {
310 
311  // If we have no rows yet then simply set the length to the
312  // number of rows to be inserted
313  if (m_length == 0) {
314  m_length = nrows;
316  alloc_data();
317  init_data();
318  }
319 
320  // ... otherwise fetch data, allocate new data and copy over
321  // the existing items
322  else {
323 
324  // If data are not available then load them now
325  if (m_data == NULL) fetch_data();
326 
327  // Compute new column length
328  int length = m_length + nrows;
329 
330  // Calculate size of new memory
331  m_size = m_number * length;
332 
333  // Allocate new data to hold the column
334  std::string* new_data = new std::string[m_size];
335 
336  // Compute the number of elements before the insertion point,
337  // the number of elements that get inserted, and the total
338  // number of elements after the insertion point
339  int n_before = m_number * row;
340  int n_insert = m_number * nrows;
341  int n_after = m_number * (m_length - row);
342 
343  // Copy and initialise data
344  std::string* src = m_data;
345  std::string* dst = new_data;
346  for (int i = 0; i < n_before; ++i) {
347  *dst++ = *src++;
348  }
349  for (int i = 0; i < n_insert; ++i) {
350  dst->clear();
351  dst++;
352  }
353  for (int i = 0; i < n_after; ++i) {
354  *dst++ = *src++;
355  }
356 
357  // Free old data
358  if (m_data != NULL) delete [] m_data;
359 
360  // Set pointer to new data and store length
361  m_data = new_data;
362  m_length = length;
363 
364  } // endelse: there were already data
365 
366  } // endfor: there were rows to be inserted
367 
368  // Return
369  return;
370 }
371 
372 
373 /***********************************************************************//**
374  * @brief Remove rows from column
375  *
376  * @param[in] row Row after which rows should be removed (0=first row).
377  * @param[in] nrows Number of rows to be removed.
378  *
379  * @exception GException::fits_invalid_row
380  * Specified row is invalid.
381  * @exception GException::fits_invalid_nrows
382  * Invalid number of rows specified.
383  *
384  * This method removes rows from a FITS table. This implies that the column
385  * will be loaded into memory.
386  ***************************************************************************/
387 void GFitsTableStringCol::remove(const int& row, const int& nrows)
388 {
389  // Make sure that row is valid
390  if (row < 0 || row >= m_length) {
392  }
393 
394  // Make sure that we don't remove beyond the limit
395  if (nrows < 0 || nrows > m_length-row) {
397  }
398 
399  // Continue only if there are rows to be removed
400  if (nrows > 0) {
401 
402  // If data are not available then load them now
403  if (m_data == NULL) fetch_data();
404 
405  // Compute new column length
406  int length = m_length - nrows;
407 
408  // Calculate size of new memory
409  m_size = m_number * length;
410 
411  // If we have rows remaining then allocate new data to hold
412  // the column
413  if (m_size > 0) {
414 
415  // Allocate new data to hold the column
416  std::string* new_data = new std::string[m_size];
417 
418  // Compute the number of elements before the removal point,
419  // the number of elements that get removed, and the total
420  // number of elements after the removal point
421  int n_before = m_number * row;
422  int n_remove = m_number * nrows;
423  int n_after = m_number * (length - row);
424 
425  // Copy data
426  std::string* src = m_data;
427  std::string* dst = new_data;
428  for (int i = 0; i < n_before; ++i) {
429  *dst++ = *src++;
430  }
431  src += n_remove;
432  for (int i = 0; i < n_after; ++i) {
433  *dst++ = *src++;
434  }
435 
436  // Free old data
437  if (m_data != NULL) delete [] m_data;
438 
439  // Set pointer to new data and store length
440  m_data = new_data;
441  m_length = length;
442 
443  } // endif: there are still elements after removal
444 
445  // ... otherwise just remove all data
446  else {
447 
448  // Free old data
449  if (m_data != NULL) delete [] m_data;
450 
451  // Set pointer to new data and store length
452  m_data = NULL;
453  m_length = length;
454  }
455 
456  } // endfor: there were rows to be removed
457 
458  // Return
459  return;
460 }
461 
462 
463 /***********************************************************************//**
464  * @brief Set nul value
465  *
466  * @param[in] value Nul value string.
467  *
468  * Allows the specification of the FITS table nul string. The default nul
469  * strings is an empty string which results in NULL entries in case that
470  * no data has been written.
471  *
472  * @todo To correctly reflect the nul value in the data, the column should
473  * be reloaded. However, the column may have been changed, so in principle
474  * saving is needed. However, we may not want to store the data, hence saving
475  * is also not desired. We thus have to develop a method to update the
476  * column information for a new nul value in place ...
477  ***************************************************************************/
478 void GFitsTableStringCol::nulval(const std::string& value)
479 {
480  // Allocate nul value
481  alloc_nulval(value);
482 
483  // Update column
484 // if (m_data != NULL) {
485 // save();
486 // load();
487 // }
488 
489  // Return
490  return;
491 }
492 
493 
494 /*==========================================================================
495  = =
496  = Private methods =
497  = =
498  ==========================================================================*/
499 
500 /***********************************************************************//**
501  * @brief Initialise class members
502  ***************************************************************************/
504 {
505  // Initialise members
506  m_type = __TSTRING;
507  m_data = NULL;
508  m_buffer = NULL;
509  m_nulval = NULL;
510 
511  // Initialise nul value
512  alloc_nulval("");
513 
514  // Return
515  return;
516 }
517 
518 
519 /***********************************************************************//**
520  * @brief Copy class members
521  *
522  * @param[in] column Column.
523  *
524  * Sets the content of the vector column by copying from another column.
525  * If the code is compiled with the small memory option, and if the source
526  * column has not yet been loaded, then we only load the column temporarily
527  * for copying purposes and release it again once copying is finished.
528  ***************************************************************************/
530 {
531  // Fetch data if necessary
532  bool not_loaded = (!column.is_loaded());
533  if (not_loaded) {
534  column.fetch_data();
535  }
536 
537  // Copy attributes
538  m_type = column.m_type;
539  m_size = column.m_size;
540  m_varlen = column.m_varlen;
541  m_rowstart = column.m_rowstart;
542 
543  // Copy column data
544  if (column.m_data != NULL && m_size > 0) {
545  if (m_data != NULL) delete [] m_data;
546  m_data = new std::string[m_size];
547  for (int i = 0; i < m_size; ++i) {
548  m_data[i] = column.m_data[i];
549  }
550  }
551 
552  // Copy NULL value
553  if (column.m_nulval != NULL) {
554  if (m_nulval != NULL) delete [] m_nulval;
555  m_nulval = new char[m_width+1];
556  std::strncpy(m_nulval, column.m_nulval, m_width);
557  }
558 
559  // Small memory option: release column if it was fetch above
560  #if defined(G_SMALL_MEMORY)
561  if (not_loaded) {
562  const_cast<GFitsTableStringCol*>(&column)->release_data();
563  }
564  #endif
565 
566  // Return
567  return;
568 }
569 
570 
571 /***********************************************************************//**
572  * @brief Delete class members
573  ***************************************************************************/
575 {
576  // Free memory
577  if (m_data != NULL) delete [] m_data;
578  if (m_nulval != NULL) delete [] m_nulval;
579 
580  // Mark memory as freed
581  m_data = NULL;
582  m_nulval = NULL;
583 
584  // Reset load flag
585  m_size = 0;
586 
587  // Free buffer
588  free_buffer();
589 
590  // Return
591  return;
592 }
593 
594 
595 /***********************************************************************//**
596  * @brief Save table column into FITS file
597  *
598  * The data is transferred from the internal string vector into a character
599  * transfer buffer that can be handled by the cfitsio routines.
600  *
601  * The table column is only saved if it is linked to a FITS file and if the
602  * data are indeed present in the class instance. This avoids saving of data
603  * that have not been modified.
604  *
605  * Refer to GFitsTableCol::save_column() for more information.
606  ***************************************************************************/
608 {
609  // Free buffer
610  free_buffer();
611 
612  // Allocate buffer. This also fills the entire buffer with '\0'
613  // characters.
614  alloc_buffer();
615 
616  // Transfer string into buffer
617  for (int i = 0; i < m_size; ++i) {
618  if (m_data[i].length() > 0) {
619  std::strncpy(m_buffer[i], m_data[i].c_str(), m_width);
620  }
621  }
622 
623  // Save column
624  save_column();
625 
626  // Free buffer
627  free_buffer();
628 
629  // Return
630  return;
631 }
632 
633 
634 /***********************************************************************//**
635  * @brief Returns format string of ASCII table
636  ***************************************************************************/
637 std::string GFitsTableStringCol::ascii_format(void) const
638 {
639  // Initialize format string
640  std::string format;
641 
642  // Set type code
643  format.append("A");
644 
645  // Set width
646  format.append(gammalib::str(m_width));
647 
648  // Return format
649  return format;
650 }
651 
652 
653 /***********************************************************************//**
654  * @brief Allocates column data
655  ***************************************************************************/
657 {
658  // Free memory
659  if (m_data != NULL) delete [] m_data;
660 
661  // Mark pointer as free
662  m_data = NULL;
663 
664  // Allocate new data
665  if (m_size > 0) {
666  m_data = new std::string[m_size];
667  }
668 
669  // Allocate also buffer
670  free_buffer();
671  alloc_buffer();
672 
673  // Return
674  return;
675 }
676 
677 
678 /***********************************************************************//**
679  * @brief Fetch column data
680  *
681  * If a FITS file is attached to the column the data are loaded into memory
682  * from the FITS file. If no FITS file is attached, memory is allocated
683  * to hold the column data and all cells are set to 0.
684  *
685  * Refer to GFitsTableCol::load_column for more information.
686  ***************************************************************************/
688 {
689  // Calculate size of memory
690  //m_size = m_number * m_length;
691 
692  // Free old buffer memory
693  //free_buffer();
694 
695  // Allocate buffer memory
696  //alloc_buffer();
697 
698  // Load column
699  const_cast<GFitsTableStringCol*>(this)->load_column();
700 
701  // Extract string from buffer
702  for (int i = 0; i < m_size; ++i) {
703  if (m_buffer[i] != NULL) {
704  m_data[i].assign(m_buffer[i]);
705  }
706  }
707 
708  // Free buffer memory
709  free_buffer();
710 
711  // Return
712  return;
713 }
714 
715 
716 /***********************************************************************//**
717  * @brief Resize column data
718  *
719  * @param[in] index Start index.
720  * @param[in] number Number of elements to add/remove.
721  *
722  * Adds or removes elements from specified index on. Adding is done if
723  * @p number is a positive number, removing if @p number is negative.
724  * Note that the method does not change the validity of the arguments.
725  * This needs to be done by the client.
726  ***************************************************************************/
727 void GFitsTableStringCol::resize_data(const int& index, const int& number)
728 {
729  // Continue only if number of elements is not zero
730  if (number != 0) {
731 
732  // If data are not available then load them now
733  if (m_data == NULL) fetch_data();
734 
735  // If elements should be removed then do not allocate new memory
736  // but just move elements forward and change the logical size of
737  // memory. Only if all elements should be removed the memory is
738  // released.
739  if (number < 0) {
740  int left = index - number;
741  std::string* dst = m_data + index;
742  std::string* src = m_data + left;
743  int num = m_size - left;
744  for (int i = 0; i < num; ++i) {
745  *dst++ = *src++;
746  }
747  m_size += number;
748  if (m_size < 1) {
749  release_data();
750  }
751  }
752 
753  // If elements should be added then allocate new memory, copy over
754  // the old data and initialise the new elements
755  else {
756  int left = m_size - index;
757  m_size += number;
758  std::string* new_data = new std::string[m_size];
759  std::string* dst = new_data;
760  std::string* src = m_data;
761  for (int i = 0; i < index; ++i) {
762  *dst++ = *src++;
763  }
764  for (int i = 0; i < number; ++i) {
765  *dst++ = "";
766  }
767  for (int i = 0; i < left; ++i) {
768  *dst++ = *src++;
769  }
770  if (m_data != NULL) delete [] m_data;
771  m_data = new_data;
772  }
773 
774  } // endif: number was non-zero
775 
776  // Return
777  return;
778 }
779 
780 
781 /***********************************************************************//**
782  * @brief Release column data
783  ***************************************************************************/
785 {
786  // Free any existing memory
787  if (m_data != NULL) delete [] m_data;
788 
789  // Mark pointer as free and reset loaded vector size
790  m_data = NULL;
791  m_size = 0;
792 
793  // Return
794  return;
795 }
796 
797 
798 /***********************************************************************//**
799  * @brief Allocate nul value
800  *
801  * @param[in] value Nul value string.
802  ***************************************************************************/
803 void GFitsTableStringCol::alloc_nulval(const std::string& value)
804 {
805  // Free any existing memory
806  if (m_nulval != NULL) delete [] m_nulval;
807 
808  // Mark pointer as free
809  m_nulval = NULL;
810 
811  // Allocate and initialise nul value
812  m_nulval = new char[m_width+1];
813  for (int j = 0; j <= m_width; ++j) {
814  m_nulval[j] = '\0';
815  }
816 
817  // Set nul value
818  std::strncpy(m_nulval, value.c_str(), m_width);
819 
820  // Return
821  return;
822 }
823 
824 
825 /***********************************************************************//**
826  * @brief Initialise column data
827  ***************************************************************************/
829 {
830  // Initialise data if they exist
831  if (m_data != NULL) {
832  for (int i = 0; i < m_size; ++i) {
833  m_data[i].clear();
834  }
835  }
836 
837  // Return
838  return;
839 }
840 
841 
842 /***********************************************************************//**
843  * @brief Allocate CFITSIO transfer buffer
844  *
845  * The CFITSIO transfer buffer allows transparent conversion from the CFITSIO
846  * storage format to a vector of strings.
847  ***************************************************************************/
849 {
850  // Allocate buffer memory
851  if (m_size > 0) {
852  m_buffer = new char*[m_size];
853  for (int i = 0; i < m_size; ++i) {
854  m_buffer[i] = new char[m_width+1];
855  }
856  }
857 
858  // Initialise buffer
859  if (m_buffer != NULL) {
860  for (int i = 0; i < m_size; ++i) {
861  for (int j = 0; j <= m_width; ++j) {
862  (m_buffer[i])[j] = '\0';
863  }
864  }
865  }
866 
867  // Return
868  return;
869 }
870 
871 
872 /***********************************************************************//**
873  * @brief Free CFITSIO transfer buffer
874  *
875  * Release memory that has been allocated for the CFITSIO transfer buffer.
876  ***************************************************************************/
878 {
879  // If there was a buffer allocated then free it
880  if (m_buffer != NULL) {
881  for (int i = 0; i < m_size; ++i) {
882  if (m_buffer[i] != NULL) delete [] m_buffer[i];
883  }
884  delete [] m_buffer;
885  m_buffer = NULL;
886  }
887 
888  // Return
889  return;
890 }
char ** m_buffer
Data area for CFITSIO transfer.
GFitsTableStringCol(void)
Constructor.
int m_type
Column type.
std::string number(const std::string &noun, const int &number)
Convert singular noun into number noun.
Definition: GTools.cpp:1046
void free_buffer(void) const
Free CFITSIO transfer buffer.
int m_number
Number of elements in column.
char * nulval(void)
Returns pointer to nul value.
void free_members(void)
Delete class members.
GFitsTableCol & operator=(const GFitsTableCol &column)
Assignment operator.
std::string * m_data
Data area.
#define G_REMOVE
int m_varlen
Maximum number of elements in variable-length.
virtual void clear(void)
Clear instance.
Gammalib tools definition.
char * m_nulval
NULL string.
virtual void fetch_data(void) const
Fetch column data.
virtual ~GFitsTableStringCol(void)
Destructor.
virtual void load_column(void)
Load table column from FITS file.
FITS table string column.
const int & number(void) const
Returns number of elements in column.
virtual void init_data(void)
Initialise column data.
void init_members(void)
Initialise class members.
virtual void save(void)
Save table column into FITS file.
virtual void resize_data(const int &index, const int &number)
Resize column data.
CFITSIO interface header.
Abstract interface for FITS table column.
virtual void remove(const int &row, const int &nrows)
Remove rows from column.
std::vector< int > m_rowstart
Start index of each row.
std::string left(const std::string &s, const int &n, const char &c= ' ')
Left justify string to achieve a length of n characters.
Definition: GTools.cpp:949
FITS table string column class interface definition.
virtual void alloc_data(void)
Allocates column data.
virtual std::string string(const int &row, const int &col=0) const
Get string value.
virtual int integer(const int &row, const int &col=0) const
Get integer value.
void alloc_nulval(const std::string &value)
Allocate nul value.
#define G_INSERT
virtual std::string ascii_format(void) const
Returns format string of ASCII table.
int m_length
Length of column (number of rows)
GFitsTableStringCol & operator=(const GFitsTableStringCol &column)
Assignment operator.
int m_size
Size of allocated data area (0 if not loaded)
virtual void release_data(void)
Release column data.
virtual int offset(const int &row, const int &inx) const
Compute offset of column element in memory.
Exception handler interface definition.
virtual bool is_loaded(void) const
Checks if column has been loaded.
void free_members(void)
Delete class members.
void alloc_buffer(void) const
Allocate CFITSIO transfer buffer.
virtual double real(const int &row, const int &col=0) const
Get double precision value.
int toint(const std::string &arg)
Convert string into integer value.
Definition: GTools.cpp:700
virtual void save_column(void)
Save table column into FITS file.
const int & nrows(void) const
Returns number of rows in column.
virtual void insert(const int &row, const int &nrows)
Insert rows in column.
virtual GFitsTableStringCol * clone(void) const
Clone column.
#define __TSTRING
double todouble(const std::string &arg)
Convert string into double precision value.
Definition: GTools.cpp:805
std::string & operator()(const int &row, const int &inx=0)
Column data access operator.
int m_width
Width in Bytes of single column element.
void copy_members(const GFitsTableStringCol &column)
Copy class members.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.
Definition: GTools.cpp:413
void init_members(void)
Initialise class members.