/***********************************************************************//** * @brief Copy class members * * @param image FITS image to copy * * Copy class members. If the pixel array is linked the pointer to the array * is copied. Otherwise a copy of the image pixels will be created. ***************************************************************************/ void GFitsImageDouble::copy_members(const GFitsImageDouble& image) { // Fetch column data if not yet fetched. The casting circumvents the // const correctness bool not_loaded = (image.m_pixels == NULL); if (not_loaded) { const_cast<GFitsImageDouble*>(&image)->fetch_data(); } // Copy pixels if (m_num_pixels > 0 && image.m_pixels != NULL) { m_pixels = new double[m_num_pixels]; for (int i = 0; i < m_num_pixels; ++i) { m_pixels[i] = image.m_pixels[i]; } } // Copy NULL value alloc_nulval(image.m_nulval); // Small memory option: release column if it was fetch above #if defined(G_SMALL_MEMORY) if (not_loaded) { const_cast<GFitsImageDouble*>(&image)->release_data(); } #endif // Return return; }
/***********************************************************************//** * @brief Copy class members * * @param[in] column Column. * * Sets the content of the vector column by copying from another column. * If the code is compiled with the small memory option, and if the source * column has not yet been loaded, then we only load the column temporarily * for copying purposes and release it again once copying is finished. ***************************************************************************/ void GFitsTableLongLongCol::copy_members(const GFitsTableLongLongCol& column) { // Fetch data if necessary bool not_loaded = (!column.is_loaded()); if (not_loaded) { column.fetch_data(); } // Copy attributes m_type = column.m_type; m_size = column.m_size; m_varlen = column.m_varlen; m_rowstart = column.m_rowstart; // Copy column data if (column.m_data != NULL && m_size > 0) { alloc_data(); for (int i = 0; i < m_size; ++i) { m_data[i] = column.m_data[i]; } } // Copy NULL value alloc_nulval(column.m_nulval); // Small memory option: release column if it was fetch above #if defined(G_SMALL_MEMORY) if (not_loaded) { const_cast<GFitsTableLongLongCol*>(&column)->release_data(); } #endif // Return return; }
/***********************************************************************//** * @brief Copy class members * * @param[in] column Table column. * * Sets the content of the vector column by copying from another column. * If the code is compiled with the small memory option, and if the source * column has not yet been loaded, then we only load the column temporarily * for copying purposes and release it again once copying is finished. ***************************************************************************/ void GFitsTableFloatCol::copy_members(const GFitsTableFloatCol& column) { // Fetch column data if not yet fetched. The casting circumvents the // const correctness bool not_loaded = (column.m_data == NULL); if (not_loaded) { const_cast<GFitsTableFloatCol*>(&column)->fetch_data(); } // Copy attributes m_type = column.m_type; m_size = column.m_size; // Copy column data if (column.m_data != NULL && m_size > 0) { alloc_data(); for (int i = 0; i < m_size; ++i) { m_data[i] = column.m_data[i]; } } // Copy NULL value alloc_nulval(column.m_nulval); // Small memory option: release column if it was fetch above #if defined(G_SMALL_MEMORY) if (not_loaded) { const_cast<GFitsTableFloatCol*>(&column)->release_data(); } #endif // Return return; }
/***********************************************************************//** * @brief Set nul value * * @param[in] value Nul value. * * @todo To correctly reflect the nul value in the data, the image should * be reloaded. However, the image may have been changed, so in principle * saving is needed. However, we may not want to store the image, hence saving * is also not desired. We thus have to develop a method to update the * image information for a new nul value in place ... ***************************************************************************/ void GFitsImage::nulval(const void* value) { // Allocate nul value alloc_nulval(value); // Update image //TODO // Return return; }
/***********************************************************************//** * @brief Set nul value * * @param[in] value Nul value. * * @todo To correctly reflect the nul value in the data, the column should * be reloaded. However, the column may have been changed, so in principle * saving is needed. However, we may not want to store the data, hence saving * is also not desired. We thus have to develop a method to update the * column information for a new nul value in place ... ***************************************************************************/ void GFitsTableLongLongCol::nulval(const long long* value) { // Allocate nul value alloc_nulval(value); // Update column // if (m_data != NULL) { // save(); // load(); // } // Return return; }
/***********************************************************************//** * @brief Set nul value * * @param[in] value Nul value. * * @todo To correctly reflect the nul value in the data, the column should * be reloaded. However, the column may have been changed, so in principle * saving is needed. However, we may not want to store the data, hence saving * is also not desired. We thus have to develop a method to update the * column information for a new nul value in place ... ***************************************************************************/ void GFitsTableCFloatCol::nulval(const GFits::cfloat* value) { // Allocate nul value alloc_nulval(value); // Update column // if (m_data != NULL) { // save(); // load(); // } // Return return; }
/***********************************************************************//** * @brief Set nul value * * @param[in] value Nul value. * * @todo To correctly reflect the nul value in the data, the column should * be reloaded. However, the column may have been changed, so in principle * saving is needed. However, we may not want to store the data, hence saving * is also not desired. We thus have to develop a method to update the * column information for a new nul value in place ... ***************************************************************************/ void GFitsTableByteCol::nulval(const unsigned char* value) { // Allocate nul value alloc_nulval(value); // Update column // if (m_data != NULL) { // save(); // load(); // } // Return return; }