833 if( m_type == fitsType<char *>() || m_type == fitsType<std::string>() )
835 m_valueStrGood =
true;
839 m_valueStr.str(
"" );
840 m_valueStr.precision( 10 );
844 case fitsType<char>():
845 m_valueStr << static_cast<int>( m_value.Char );
847 case fitsType<unsigned char>():
848 m_valueStr << static_cast<int>( m_value.UChar );
850 case fitsType<short>():
851 m_valueStr << m_value.Short;
853 case fitsType<unsigned short>():
854 m_valueStr << m_value.UShort;
856 case fitsType<int>():
857 m_valueStr << m_value.Int;
859 case fitsType<unsigned int>():
860 m_valueStr << m_value.UInt;
862 case fitsType<long>():
863 m_valueStr << m_value.Long;
865 case fitsType<unsigned long>():
866 m_valueStr << m_value.ULong;
868 case fitsType<long long>():
869 m_valueStr << m_value.LongLong;
871 case fitsType<unsigned long long>():
872 m_valueStr << m_value.ULongLong;
874 case fitsType<float>():
875 m_valueStr << m_value.Float;
877 case fitsType<std::complex<float>>():
878 m_valueStr << m_value.complexFloat;
880 case fitsType<double>():
881 m_valueStr << m_value.Double;
883 case fitsType<std::complex<double>>():
884 m_valueStr << m_value.complexDouble;
886 case fitsType<fitsCommentType>():
888 case fitsType<fitsHistoryType>():
890 case fitsType<fitsContinueType>():
894 "Unknown FITS type for " + m_keyword );
897 m_valueStrGood =
true;
928 case fitsType<unsigned char>():
930 cval = m_value.UChar;
933 case fitsType<char>():
938 case fitsType<short>():
940 cval = m_value.Short;
943 case fitsType<unsigned short>():
945 cval = m_value.UShort;
948 case fitsType<int>():
953 case fitsType<unsigned int>():
958 case fitsType<long>():
963 case fitsType<unsigned long>():
965 cval = m_value.ULong;
968 case fitsType<long long>():
970 cval = m_value.LongLong;
973 case fitsType<unsigned long long>():
975 cval = m_value.ULongLong;
978 case fitsType<float>():
980 cval = m_value.Float;
983 case fitsType<std::complex<float>>():
986 "can't convert complex type for " + m_keyword );
988 case fitsType<double>():
990 cval = m_value.Double;
993 case fitsType<std::complex<double>>():
996 "can't convert complex type for " + m_keyword );
998 case fitsType<fitsCommentType>():
1001 "cannot convert comment to numeric type for " + m_keyword );
1003 case fitsType<fitsHistoryType>():
1006 "cannot convert history to numeric type for " + m_keyword );
1008 case fitsType<fitsContinueType>():
1011 "cannot convert continue to numeric type for " + m_keyword );
1016 "cannot convert string to numeric type for " + m_keyword );
1021 "invalid FITS type conversion for " + m_keyword );
1038 case fitsType<unsigned char>():
1040 errc = convertedValue<unsigned char>( m_value.UChar );
1043 case fitsType<char>():
1045 errc = convertedValue<char>( m_value.Char );
1048 case fitsType<short>():
1050 errc = convertedValue<short>( m_value.Short );
1053 case fitsType<unsigned short>():
1055 errc = convertedValue<unsigned short>( m_value.UShort );
1058 case fitsType<int>():
1060 errc = convertedValue<int>( m_value.Int );
1063 case fitsType<unsigned int>():
1065 errc = convertedValue<unsigned int>( m_value.UInt );
1068 case fitsType<long>():
1070 errc = convertedValue<long>( m_value.Long );
1073 case fitsType<unsigned long>():
1075 errc = convertedValue<unsigned long>( m_value.ULong );
1078 case fitsType<long long>():
1080 errc = convertedValue<long long>( m_value.LongLong );
1083 case fitsType<unsigned long long>():
1085 errc = convertedValue<unsigned long long>( m_value.ULongLong );
1088 case fitsType<float>():
1090 errc = convertedValue<float>( m_value.Float );
1093 case fitsType<std::complex<float>>():
1096 "can't convert complex type for " + m_keyword );
1098 case fitsType<double>():
1100 errc = convertedValue<double>( m_value.Double );
1103 case fitsType<std::complex<double>>():
1106 "can't convert complex type for " + m_keyword );
1108 case fitsType<fitsCommentType>():
1111 "cannot convert comment to numeric type for " + m_keyword );
1113 case fitsType<fitsHistoryType>():
1116 "cannot convert history to numeric type for " + m_keyword );
1118 case fitsType<fitsContinueType>():
1121 "cannot convert continue to numeric type for " + m_keyword );
1127 m_valueGood =
false;
1133 "invalid FITS type conversion for " + m_keyword );
1552 if( m_type == fitsType<char *>() || m_type == fitsType<std::string>() )
1554 return fits_write_key<char *>( fptr,
1555 (
char *)m_keyword.c_str(),
1556 (
void *)m_valueStr.str().c_str(),
1557 (
char *)m_comment.c_str() );
1561 if( m_valueStrGood ==
true )
1564 return fits_write_key<fitsUnknownType>( fptr,
1565 (
char *)m_keyword.c_str(),
1566 (
void *)m_valueStr.str().c_str(),
1567 (
char *)m_comment.c_str() );
1573 case fitsType<bool>():
1575 return fits_write_key<bool>( fptr, (
char *)m_keyword.c_str(), &m_value.Bool, (
char *)m_comment.c_str() );
1577 case fitsType<char>():
1579 return fits_write_key<char>( fptr, (
char *)m_keyword.c_str(), &m_value.Char, (
char *)m_comment.c_str() );
1581 case fitsType<unsigned char>():
1583 return fits_write_key<unsigned char>( fptr,
1584 (
char *)m_keyword.c_str(),
1586 (
char *)m_comment.c_str() );
1588 case fitsType<short>():
1590 return fits_write_key<short>( fptr, (
char *)m_keyword.c_str(), &m_value.Short, (
char *)m_comment.c_str() );
1592 case fitsType<unsigned short>():
1594 return fits_write_key<unsigned short>( fptr,
1595 (
char *)m_keyword.c_str(),
1597 (
char *)m_comment.c_str() );
1599 case fitsType<int>():
1601 return fits_write_key<int>( fptr, (
char *)m_keyword.c_str(), &m_value.Int, (
char *)m_comment.c_str() );
1603 case fitsType<unsigned int>():
1605 return fits_write_key<unsigned int>( fptr,
1606 (
char *)m_keyword.c_str(),
1608 (
char *)m_comment.c_str() );
1610 case fitsType<long>():
1612 return fits_write_key<long>( fptr, (
char *)m_keyword.c_str(), &m_value.Long, (
char *)m_comment.c_str() );
1614 case fitsType<unsigned long>():
1616 return fits_write_key<unsigned long>( fptr,
1617 (
char *)m_keyword.c_str(),
1619 (
char *)m_comment.c_str() );
1621 case fitsType<long long>():
1623 return fits_write_key<long long>( fptr,
1624 (
char *)m_keyword.c_str(),
1626 (
char *)m_comment.c_str() );
1628 case fitsType<unsigned long long>():
1630 return fits_write_key<unsigned long long>( fptr,
1631 (
char *)m_keyword.c_str(),
1633 (
char *)m_comment.c_str() );
1635 case fitsType<float>():
1637 return fits_write_key<float>( fptr, (
char *)m_keyword.c_str(), &m_value.Float, (
char *)m_comment.c_str() );
1639 case fitsType<double>():
1641 return fits_write_key<double>( fptr,
1642 (
char *)m_keyword.c_str(),
1644 (
char *)m_comment.c_str() );
1646 case fitsType<fitsCommentType>():
1648 return fits_write_comment( fptr, (
char *)m_comment.c_str() );
1650 case fitsType<fitsHistoryType>():
1652 return fits_write_history( fptr, (
char *)m_comment.c_str() );
1656 return internal::mxlib_error_report<verboseT>(
error_t::invalidarg,
"invalid FITS type for " + m_keyword );