- Timestamp:
- Mar 3, 2010, 9:44:38 PM (16 years ago)
- Location:
- trunk/SophyaLib/BaseTools
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/BaseTools/datatype.cc
r3619 r3750 31 31 else if (typeid(T) == typeid(complex<r_4>)) return(" complex<r_4> "); 32 32 else if (typeid(T) == typeid(complex<r_8>)) return(" complex<r_8> "); 33 #ifdef SO_LDBLE128 34 else if (typeid(T) == typeid(r_16)) return("r_16"); 35 else if (typeid(T) == typeid(complex<r_16>)) return(" complex<r_16> "); 36 #endif 33 37 else return("???unknowntype???"); 34 38 } … … 48 52 else if (typeid(T) == typeid(complex<r_4>)) return(11); 49 53 else if (typeid(T) == typeid(complex<r_8>)) return(12); 54 #ifdef SO_LDBLE128 55 else if (typeid(T) == typeid(r_16)) return(13); 56 else if (typeid(T) == typeid(complex<r_16>)) return(14); 57 #endif 50 58 else return(0); 51 59 } … … 78 86 DECL_TEMP_SPEC 79 87 string DataTypeInfo< complex<r_8> >::getTypeName() { return(" complex<r_8> "); } 80 88 #ifdef SO_LDBLE128 89 DECL_TEMP_SPEC 90 string DataTypeInfo<r_16>::getTypeName() { return("r_16"); } 91 DECL_TEMP_SPEC 92 string DataTypeInfo< complex<r_16> >::getTypeName() { return(" complex<r_16> "); } 93 #endif 81 94 /*! 82 95 \ brief Return an identifier associated to T … … 114 127 DECL_TEMP_SPEC 115 128 int DataTypeInfo< complex<r_8> >::getTypeId() { return(12); } 129 #ifdef SO_LDBLE128 130 DECL_TEMP_SPEC 131 int DataTypeInfo<r_16>::getTypeId() { return(13); } 132 DECL_TEMP_SPEC 133 int DataTypeInfo< complex<r_16> >::getTypeId() { return(14); } 134 #endif 135 116 136 #endif 117 137 … … 185 205 #pragma define_template DataTypeInfo< complex<r_4> > 186 206 #pragma define_template DataTypeInfo< complex<r_8> > 207 #ifdef SO_LDBLE128 208 #pragma define_template DataTypeInfo<r_16> 209 #pragma define_template DataTypeInfo< complex<r_16> > 210 #endif 211 187 212 #endif 188 213 … … 200 225 template class DataTypeInfo< complex<r_4> >; 201 226 template class DataTypeInfo< complex<r_8> >; 227 #ifdef SO_LDBLE128 228 template class DataTypeInfo<r_16>; 229 template class DataTypeInfo< complex<r_16> >; 230 #endif 231 202 232 #endif 203 233 -
trunk/SophyaLib/BaseTools/fiondblock.cc
r3661 r3750 139 139 inline void PIOSReadArray(PInPersist & is, complex<double> * arr, size_t n) 140 140 { r_8 * pr = (r_8 *)arr; is.Get(pr, n*2); } 141 #ifdef SO_LDBLE128 142 // ces fonctions ne devraient jamais etre appelees ( pas de r_16 en V_PPF <= 3 ) 143 inline void PIOSReadArray(PInPersist & is, r_16 * arr, size_t n) 144 { is.Get(arr, n); } 145 inline void PIOSReadArray(PInPersist & is, complex<long double> * arr, size_t n) 146 { r_16 * pr = (r_16 *)arr; is.Get(pr, n*2); } 147 #endif 141 148 //--------------------------------------------------------------------------- 142 149 … … 196 203 #pragma define_template FIO_NDataBlock< complex<r_4> > 197 204 #pragma define_template FIO_NDataBlock< complex<r_8> > 205 #ifdef SO_LDBLE128 206 #pragma define_template FIO_NDataBlock<r_16> 207 #pragma define_template FIO_NDataBlock< complex<r_16> > 208 #endif 209 198 210 #endif 199 211 … … 213 225 template class FIO_NDataBlock< complex<r_4> >; 214 226 template class FIO_NDataBlock< complex<r_8> >; 215 } 216 #endif 227 #ifdef SO_LDBLE128 228 template class FIO_NDataBlock<r_16>; 229 template class FIO_NDataBlock< complex<r_16> >; 230 #endif 231 } 232 #endif -
trunk/SophyaLib/BaseTools/machdefs_mkmf.h
r3535 r3750 6 6 - SO_NOFPIC : disable fPIC flag (Position Independent Code) default fPIC enabled 7 7 - SO_SASIZET64 : select 64 bits size for array indices (default 32 bits) 8 - SO_LDBLE128 : enable support for 128 bits floating point numbers (default NO 128 bits floats) 8 9 - SO_BOUNDCHECKING : activate bound checking (in accessing array elements) 9 10 - SOPHYA_DEBUG : debug flag ( --> if set, SO_BOUNDCHECKING is also set) … … 83 84 typedef float r_4; 84 85 typedef double r_8; 86 #ifdef SO_LDBLE128 87 /* 128 bits floating point numbers */ 88 typedef long double r_16; 89 #endif 85 90 86 91 /* --------------------------------------------------------------- */ -
trunk/SophyaLib/BaseTools/mutyv.h
r3661 r3750 64 64 inline MuTyV & operator= (r_4 v) { typ = MTVFloat; dv = (r_8)v; iv = (int_8)v; dv_im = 0.; return(*this); } 65 65 inline MuTyV & operator= (r_8 v) { typ = MTVFloat; dv = v; iv = (int_8)v; dv_im = 0.; return(*this); } 66 inline MuTyV & operator= (complex<r_4> const& v) { typ = MTVComplex; dv = (r_8)v.real(); dv_im = v.imag();66 inline MuTyV & operator= (complex<r_4> const& v) { typ = MTVComplex; dv = (r_8)v.real(); dv_im = (r_8)v.imag(); 67 67 iv = (int_8)dv; return(*this); } 68 68 inline MuTyV & operator= (complex<r_8> const& v) { typ = MTVComplex; dv = (r_8)v.real(); dv_im = v.imag(); 69 69 iv = (int_8)dv; return(*this); } 70 const char* operator= (const char* s); 71 string const& operator= (string const & s); 72 TimeStamp const& operator= (TimeStamp const & s); 70 #ifdef SO_LDBLE128 71 inline MuTyV & operator= (r_16 v) { typ = MTVFloat; dv = (r_8)v; iv = (int_8)v; dv_im = 0.; return(*this); } 72 inline MuTyV & operator= (complex<r_16> const& v) { typ = MTVComplex; dv = (r_8)v.real(); dv_im = (r_8)v.imag(); 73 iv = (int_8)dv; return(*this); } 74 #endif 75 const char* operator= (const char* s); 76 string const& operator= (string const & s); 77 TimeStamp const& operator= (TimeStamp const & s); 73 78 74 79 inline operator uint_1() const { return((uint_1)iv); } … … 84 89 inline operator complex<r_4>() const { return(complex<r_4>((r_4)dv, (r_4)dv_im)); } 85 90 inline operator complex<r_8>() const { return(complex<r_8>(dv, dv_im)); } 91 #ifdef SO_LDBLE128 92 inline operator r_16() const { return((r_16)dv); } 93 inline operator complex<r_16>() const { return(complex<r_16>((r_16)dv, (r_16)dv_im)); } 94 #endif 86 95 87 88 96 operator string() const ; 97 operator TimeStamp() const ; 89 98 90 99 inline uint_1 Convert(uint_1& x) const { x = (uint_1)iv; return x; } … … 102 111 inline complex<r_8> Convert(complex<r_8> & x) const 103 112 { x = complex< r_8 > (dv, dv_im); return x; } 104 113 #ifdef SO_LDBLE128 114 inline r_16 Convert(r_16& x) const { x = (r_16)dv; return x; } 115 inline complex<r_16> Convert(complex<r_16> & x) const 116 { x = complex< r_16 > ((r_16)dv, (r_16)dv_im); return x; } 117 #endif 105 118 string& Convert(string& x) const ; 106 119 TimeStamp& Convert(TimeStamp& x) const ; -
trunk/SophyaLib/BaseTools/ndatablock.cc
r3661 r3750 822 822 #pragma define_template NDataBlock< complex<r_4> > 823 823 #pragma define_template NDataBlock< complex<r_8> > 824 #ifdef SO_LDBLE128 825 #pragma define_template NDataBlock<r_16> 826 #pragma define_template NDataBlock< complex<r_16> > 827 #endif 828 824 829 #endif 825 830 … … 838 843 template class NDataBlock< complex<r_4> >; 839 844 template class NDataBlock< complex<r_8> >; 840 } 845 #ifdef SO_LDBLE128 846 template class NDataBlock<r_16>; 847 template class NDataBlock< complex<r_16> >; 841 848 #endif 849 } 850 #endif -
trunk/SophyaLib/BaseTools/ppfbinstream.cc
r3619 r3750 21 21 22 22 23 static inline void bswap16(void* p) 24 { 25 uint_8* p8 = (uint_8*)p; 26 uint_8 tmp1 = *(p8); 27 uint_8 tmp = *(p8+1); 28 *(p8) = ((tmp >> (7*8)) & 0x000000FF) | 29 ((tmp >> (5*8)) & 0x0000FF00) | 30 ((tmp >> (3*8)) & 0x00FF0000) | 31 ((tmp >> (1*8)) & 0xFF000000) | 32 ((tmp & 0xFF000000) << (1*8)) | 33 ((tmp & 0x00FF0000) << (3*8)) | 34 ((tmp & 0x0000FF00) << (5*8)) | 35 ((tmp & 0x000000FF) << (7*8)); 36 *(p8+1) = ((tmp1 >> (7*8)) & 0x000000FF) | 37 ((tmp1 >> (5*8)) & 0x0000FF00) | 38 ((tmp1 >> (3*8)) & 0x00FF0000) | 39 ((tmp1 >> (1*8)) & 0xFF000000) | 40 ((tmp1 & 0xFF000000) << (1*8)) | 41 ((tmp1 & 0x00FF0000) << (3*8)) | 42 ((tmp1 & 0x0000FF00) << (5*8)) | 43 ((tmp1 & 0x000000FF) << (7*8)); 44 } 45 23 46 static inline void bswap8(void* p) 24 47 { … … 48 71 *(uint_2*)p = ((tmp >> 8) & 0x00FF) | 49 72 ((tmp & 0x00FF) << 8); 73 } 74 75 // Convertit la taille de donnees (2 (int_2), 4 (int_4, r_4), 8 (r_8) ...) en taille codee dans le tag 76 static inline unsigned char datasize2tagsize( unsigned char sz) 77 { 78 // Taille permises 1,2,4,8,16 79 // Pour les tailles <= 8, c'est directement la taille 80 if (sz<=8) return sz; 81 else { 82 if (sz==16) return 10; 83 else return 0; // signale une erreur 84 } 85 } 86 // Convertit la taille codee dans le tag en taille de donnees (2 (int_2), 4 (int_4, r_4), 8 (r_8) ...) en 87 static inline unsigned char tagsize2datasize( unsigned char sz) 88 { 89 // Taille permises 1,2,4,8,16 90 // Pour les tailles <= 8, c'est directement la taille 91 if (sz<=8) return sz; 92 else { 93 if (sz==10) return 10; 94 else return 0; // signale une erreur 95 } 50 96 } 51 97 … … 653 699 654 700 void 655 PPFBinaryInputStream::CheckTag( short datasz, shortdatatype)701 PPFBinaryInputStream::CheckTag(unsigned char datasz, unsigned char datatype) 656 702 // datatype = PPS_DATATYPE_CHAR or PPS_DATATYPE_FLOAT or PPS_DATATYPE_INTEGER or PPS_DATATYPE_UNSIGNED 657 703 { 658 704 unsigned char ppstype; 659 705 GetTypeTag(ppstype); 660 if (ppstype != PPS_SIMPLE + datas z+ datatype)706 if (ppstype != PPS_SIMPLE + datasize2tagsize(datasz) + datatype) 661 707 throw FileFormatExc("PPFBinaryInputStream::CheckTag bad type in ppersist file"); 662 708 } 663 709 664 710 void 665 PPFBinaryInputStream::CheckArrayTag( short datasz, size_t sz, shortdatatype)711 PPFBinaryInputStream::CheckArrayTag(unsigned char datasz, size_t sz, unsigned char datatype) 666 712 // datatype = PPS_DATATYPE_CHAR or PPS_DATATYPE_FLOAT or PPS_DATATYPE_INTEGER or PPS_DATATYPE_UNSIGNED 667 713 { … … 670 716 size_t filesz; 671 717 if (sz <= 0x7fffffff) { 672 if (ppstype != PPS_SIMPLE_ARRAY4 + datas z+ datatype)718 if (ppstype != PPS_SIMPLE_ARRAY4 + datasize2tagsize(datasz) + datatype) 673 719 throw FileFormatExc("PPFBinaryInputStream::CheckArrayTag bad type in ppersist file"); 674 720 int_4 ff; 675 721 GetRawI4(ff); filesz=ff; 676 722 } else { 677 if (ppstype != PPS_SIMPLE_ARRAY8 + datas z+ datatype)723 if (ppstype != PPS_SIMPLE_ARRAY8 + datasize2tagsize(datasz) + datatype) 678 724 throw FileFormatExc("PPFBinaryInputStream::CheckArrayTag bad type in ppersist file"); 679 725 uint_8 ff; … … 691 737 } 692 738 693 694 739 void 695 740 PPFBinaryInputStream::GetBytes(void* ptr, size_t bytes) … … 698 743 GetRawBytes(ptr, bytes); 699 744 } 745 700 746 void 701 747 PPFBinaryInputStream::GetR4 (r_4& result) … … 715 761 if (bigEndian == IS_BIG_ENDIAN) return; 716 762 717 for (unsigned int i=0; i<n; i++) 718 bswap4(tab+i); 763 for (size_t i=0; i<n; i++) bswap4(tab+i); 719 764 720 765 return; … … 737 782 if (bigEndian == IS_BIG_ENDIAN) return; 738 783 739 for (unsigned int i=0; i<n; i++) 740 bswap8(tab+i); 784 for (size_t i=0; i<n; i++) bswap8(tab+i); 741 785 742 786 return; … … 787 831 if (bigEndian == IS_BIG_ENDIAN) return; 788 832 789 for (unsigned int i=0; i<n; i++) 790 bswap2(tab+i); 833 for (size_t i=0; i<n; i++) bswap2(tab+i); 791 834 792 835 return; … … 809 852 if (bigEndian == IS_BIG_ENDIAN) return; 810 853 811 for (unsigned int i=0; i<n; i++) 812 bswap2(tab+i); 854 for (size_t i=0; i<n; i++) bswap2(tab+i); 813 855 814 856 return; … … 831 873 if (bigEndian == IS_BIG_ENDIAN) return; 832 874 833 for (unsigned int i=0; i<n; i++) 834 bswap4(tab+i); 875 for (size_t i=0; i<n; i++) bswap4(tab+i); 835 876 836 877 return; … … 853 894 if (bigEndian == IS_BIG_ENDIAN) return; 854 895 855 for (unsigned int i=0; i<n; i++) 856 bswap4(tab+i); 896 for (size_t i=0; i<n; i++) bswap4(tab+i); 857 897 858 898 return; … … 876 916 if (bigEndian == IS_BIG_ENDIAN) return; 877 917 878 for (unsigned int i=0; i<n; i++) 879 bswap8(tab+i); 918 for (size_t i=0; i<n; i++) bswap8(tab+i); 880 919 881 920 return; … … 898 937 if (bigEndian == IS_BIG_ENDIAN) return; 899 938 900 for (unsigned int i=0; i<n; i++) 901 bswap8(tab+i); 939 for (size_t i=0; i<n; i++) bswap8(tab+i); 902 940 903 941 return; … … 951 989 952 990 r_4 * p = (r_4 *)tab; 953 for ( unsigned int i=0; i<n; i++) {991 for (size_t i=0; i<n; i++) { 954 992 bswap4(p); p++; 955 993 bswap4(p); p++; … … 979 1017 980 1018 r_8 * p = (r_8 *)tab; 981 for ( unsigned int i=0; i<n; i++) {1019 for (size_t i=0; i<n; i++) { 982 1020 bswap8(p); p++; 983 1021 bswap8(p); p++; … … 986 1024 } 987 1025 1026 // Support pour les long double (128 bits floating point numbers) 1027 #ifdef SO_LDBLE128 1028 void 1029 PPFBinaryInputStream::GetR16 (r_16& result) 1030 { 1031 CheckTag(16,PPS_DATATYPE_FLOAT); 1032 GetRawBytes(&result, sizeof(r_16)); 1033 if (bigEndian != IS_BIG_ENDIAN) 1034 bswap16(&result); 1035 } 1036 1037 void 1038 PPFBinaryInputStream::GetR16s (r_16* tab, size_t n) 1039 { 1040 CheckArrayTag(16,n,PPS_DATATYPE_FLOAT); 1041 GetRawBytes(tab, n*sizeof(r_16)); 1042 if (bigEndian == IS_BIG_ENDIAN) return; 1043 1044 for (size_t i=0; i<n; i++) bswap16(tab+i); 1045 1046 return; 1047 } 1048 1049 void 1050 PPFBinaryInputStream::GetZ16 (complex<r_16>& result) 1051 { 1052 CheckTag(16,PPS_DATATYPE_COMPLEX); 1053 r_16 reim[2]; 1054 GetRawBytes(reim, 2*sizeof(r_16)); 1055 if (bigEndian != IS_BIG_ENDIAN) { 1056 bswap16(reim); 1057 bswap16(reim+1); 1058 } 1059 result = complex<r_16>(reim[0], reim[1]); 1060 } 1061 1062 void 1063 PPFBinaryInputStream::GetZ16s (complex<r_16>* tab, size_t n) 1064 { 1065 CheckArrayTag(16,n,PPS_DATATYPE_COMPLEX); 1066 GetRawBytes(tab, n*2*sizeof(r_16)); 1067 if (bigEndian == IS_BIG_ENDIAN) return; 1068 1069 r_16 * p = (r_16 *)tab; 1070 for (size_t i=0; i<n; i++) { 1071 bswap16(p); p++; 1072 bswap16(p); p++; 1073 } 1074 return; 1075 } 1076 #endif 988 1077 989 1078 void … … 1185 1274 else if (ppst3 == PPS_DATATYPE_INTEGER) dtype = "INTEGER x"; 1186 1275 else if (ppst3 == PPS_DATATYPE_UNSIGNED) dtype = "UNSIGNED x"; 1187 int_4 dsize = ppst1;1276 int_4 dsize = (int_4)tagsize2datasize(ppst1); 1188 1277 int_8 dsizeskip = dsize; 1189 1278 if (ppst30 == PPS_DATATYPE_COMPLEX) { … … 1236 1325 1237 1326 1238 //++1239 // Class POutPersist1240 // Lib Outils++1241 // include ppersist.h1242 //1243 // Fichier d'objets persistants, en écriture.1244 //--1245 1246 1247 //++1248 // POutPersist(string const& flnm, int endianness = PPersist::PPS_NATIVE)1249 //1250 // Crée un nouveau fichier ppersist. Par défaut, il est petit=boutien1251 // sur machines petit-boutiennes, et gros-boutien sur machines1252 // gros-boutiennes. On peut explicitement spécifier PPersist::PPS_LITTLE_ENDIAN1253 // ou PPersist::PPS_BIG_ENDIAN.1254 //--1255 1256 1327 /*! 1257 1328 \class SOPHYA::PPFBinaryInputStream … … 1302 1373 version = 3; 1303 1374 // Header 1304 PutRawBytes("SOS-SOPHYA-PPersistFile V 3",32);1375 PutRawBytes("SOS-SOPHYA-PPersistFile V4 ",32); 1305 1376 PutRawBytes(bigEndian 1306 1377 ? "BIG-ENDIAN " … … 1482 1553 1483 1554 void 1484 PPFBinaryOutputStream::PutArrayTag( short datasz, size_t sz, shortdatatype)1555 PPFBinaryOutputStream::PutArrayTag(unsigned char datasz, size_t sz, unsigned char datatype) 1485 1556 // datatype = PPS_DATATYPE_CHAR or PPS_DATATYPE_FLOAT or PPS_DATATYPE_INTEGER or PPS_DATATYPE_UNSIGNED 1486 1557 { 1487 1558 if (sz <= 0x7fffffff) { 1488 PutRawUByte(PPS_SIMPLE_ARRAY4 + datas z+ datatype);1559 PutRawUByte(PPS_SIMPLE_ARRAY4 + datasize2tagsize(datasz) + datatype); 1489 1560 PutRawI4(sz); 1490 1561 } else { 1491 PutRawUByte(PPS_SIMPLE_ARRAY8 + datas z+ datatype);1562 PutRawUByte(PPS_SIMPLE_ARRAY8 + datasize2tagsize(datasz) + datatype); 1492 1563 PutRawU8(sz); 1493 1564 } … … 1497 1568 PPFBinaryOutputStream::PutByte(char c) 1498 1569 { 1499 PutRawByte(PPS_SIMPLE + 1+ PPS_DATATYPE_CHAR);1570 PutRawByte(PPS_SIMPLE + datasize2tagsize(1) + PPS_DATATYPE_CHAR); 1500 1571 PutRawBytes(&c, 1); 1501 1572 } … … 1513 1584 PPFBinaryOutputStream::PutR4 (r_4 val) 1514 1585 { 1515 PutRawUByte(PPS_SIMPLE + 4+ PPS_DATATYPE_FLOAT);1586 PutRawUByte(PPS_SIMPLE + datasize2tagsize(4) + PPS_DATATYPE_FLOAT); 1516 1587 1517 1588 if (bigEndian != IS_BIG_ENDIAN) … … 1529 1600 PutRawBytes(tab, n*sizeof(r_4)); 1530 1601 } else { 1531 for ( unsigned int i=0; i<n; i++) {1602 for (size_t i=0; i<n; i++) { 1532 1603 r_4 val = tab[i]; 1533 1604 bswap4(&val); … … 1540 1611 PPFBinaryOutputStream::PutR8 (r_8 val) 1541 1612 { 1542 PutRawUByte(PPS_SIMPLE + 8+ PPS_DATATYPE_FLOAT);1613 PutRawUByte(PPS_SIMPLE + datasize2tagsize(8) + PPS_DATATYPE_FLOAT); 1543 1614 1544 1615 if (bigEndian != IS_BIG_ENDIAN) … … 1556 1627 PutRawBytes(tab, n*sizeof(r_8)); 1557 1628 } else { 1558 for ( unsigned int i=0; i<n; i++) {1629 for (size_t i=0; i<n; i++) { 1559 1630 r_8 val = tab[i]; 1560 1631 bswap8(&val); … … 1567 1638 PPFBinaryOutputStream::PutI1 (int_1 val) 1568 1639 { 1569 PutRawUByte(PPS_SIMPLE + 1+ PPS_DATATYPE_INTEGER);1640 PutRawUByte(PPS_SIMPLE + datasize2tagsize(1) + PPS_DATATYPE_INTEGER); 1570 1641 PutRawBytes(&val, sizeof(int_1)); 1571 1642 } … … 1581 1652 PPFBinaryOutputStream::PutU1 (uint_1 val) 1582 1653 { 1583 PutRawUByte(PPS_SIMPLE + 1+ PPS_DATATYPE_UNSIGNED);1654 PutRawUByte(PPS_SIMPLE + datasize2tagsize(1) + PPS_DATATYPE_UNSIGNED); 1584 1655 PutRawBytes(&val, sizeof(uint_1)); 1585 1656 } … … 1595 1666 PPFBinaryOutputStream::PutI2 (int_2 val) 1596 1667 { 1597 PutRawUByte(PPS_SIMPLE + 2+ PPS_DATATYPE_INTEGER);1668 PutRawUByte(PPS_SIMPLE + datasize2tagsize(2) + PPS_DATATYPE_INTEGER); 1598 1669 1599 1670 if (bigEndian != IS_BIG_ENDIAN) … … 1611 1682 PutRawBytes(tab, n*sizeof(int_2)); 1612 1683 } else { 1613 for ( unsigned int i=0; i<n; i++) {1684 for (size_t i=0; i<n; i++) { 1614 1685 int_2 val = tab[i]; 1615 1686 bswap2(&val); … … 1622 1693 PPFBinaryOutputStream::PutU2 (uint_2 val) 1623 1694 { 1624 PutRawUByte(PPS_SIMPLE + 2+ PPS_DATATYPE_UNSIGNED);1695 PutRawUByte(PPS_SIMPLE + datasize2tagsize(2) + PPS_DATATYPE_UNSIGNED); 1625 1696 1626 1697 if (bigEndian != IS_BIG_ENDIAN) … … 1638 1709 PutRawBytes(tab, n*sizeof(uint_2)); 1639 1710 } else { 1640 for ( unsigned int i=0; i<n; i++) {1711 for (size_t i=0; i<n; i++) { 1641 1712 uint_2 val = tab[i]; 1642 1713 bswap2(&val); … … 1649 1720 PPFBinaryOutputStream::PutI4 (int_4 val) 1650 1721 { 1651 PutRawUByte(PPS_SIMPLE + 4+ PPS_DATATYPE_INTEGER);1722 PutRawUByte(PPS_SIMPLE + datasize2tagsize(4) + PPS_DATATYPE_INTEGER); 1652 1723 1653 1724 if (bigEndian != IS_BIG_ENDIAN) … … 1665 1736 PutRawBytes(tab, n*sizeof(int_4)); 1666 1737 } else { 1667 for ( unsigned int i=0; i<n; i++) {1738 for (size_t i=0; i<n; i++) { 1668 1739 int_4 val = tab[i]; 1669 1740 bswap4(&val); … … 1676 1747 PPFBinaryOutputStream::PutU4 (uint_4 val) 1677 1748 { 1678 PutRawUByte(PPS_SIMPLE + 4+ PPS_DATATYPE_UNSIGNED);1749 PutRawUByte(PPS_SIMPLE + datasize2tagsize(4) + PPS_DATATYPE_UNSIGNED); 1679 1750 1680 1751 if (bigEndian != IS_BIG_ENDIAN) … … 1692 1763 PutRawBytes(tab, n*sizeof(uint_4)); 1693 1764 } else { 1694 for ( unsigned int i=0; i<n; i++) {1765 for (size_t i=0; i<n; i++) { 1695 1766 uint_4 val = tab[i]; 1696 1767 bswap4(&val); … … 1703 1774 PPFBinaryOutputStream::PutI8 (int_8 val) 1704 1775 { 1705 PutRawUByte(PPS_SIMPLE + 8+ PPS_DATATYPE_INTEGER);1776 PutRawUByte(PPS_SIMPLE + datasize2tagsize(8) + PPS_DATATYPE_INTEGER); 1706 1777 1707 1778 if (bigEndian != IS_BIG_ENDIAN) … … 1719 1790 PutRawBytes(tab, n*sizeof(int_8)); 1720 1791 } else { 1721 for ( unsigned int i=0; i<n; i++) {1792 for (size_t i=0; i<n; i++) { 1722 1793 int_8 val = tab[i]; 1723 1794 bswap8(&val); … … 1730 1801 PPFBinaryOutputStream::PutU8 (uint_8 val) 1731 1802 { 1732 PutRawUByte(PPS_SIMPLE + 8+ PPS_DATATYPE_UNSIGNED);1803 PutRawUByte(PPS_SIMPLE + datasize2tagsize(8) + PPS_DATATYPE_UNSIGNED); 1733 1804 1734 1805 if (bigEndian != IS_BIG_ENDIAN) … … 1746 1817 PutRawBytes(tab, n*sizeof(uint_8)); 1747 1818 } else { 1748 for ( unsigned int i=0; i<n; i++) {1819 for (size_t i=0; i<n; i++) { 1749 1820 uint_8 val = tab[i]; 1750 1821 bswap8(&val); … … 1773 1844 PPFBinaryOutputStream::PutZ4 (complex<r_4> val) 1774 1845 { 1775 PutRawUByte(PPS_SIMPLE + 4+ PPS_DATATYPE_COMPLEX);1846 PutRawUByte(PPS_SIMPLE + datasize2tagsize(4) + PPS_DATATYPE_COMPLEX); 1776 1847 r_4 reim[2]; 1777 1848 reim[0] = val.real(); … … 1792 1863 PutRawBytes(tab, n*2*sizeof(r_4)); 1793 1864 } else { 1794 for ( unsigned int i=0; i<n; i++) {1865 for (size_t i=0; i<n; i++) { 1795 1866 r_4 reim[2]; 1796 1867 reim[0] = tab[i].real(); … … 1806 1877 PPFBinaryOutputStream::PutZ8 (complex<r_8> val) 1807 1878 { 1808 PutRawUByte(PPS_SIMPLE + 8+ PPS_DATATYPE_COMPLEX);1879 PutRawUByte(PPS_SIMPLE + datasize2tagsize(8) + PPS_DATATYPE_COMPLEX); 1809 1880 r_8 reim[2]; 1810 1881 reim[0] = val.real(); … … 1825 1896 PutRawBytes(tab, n*2*sizeof(r_8)); 1826 1897 } else { 1827 for ( unsigned int i=0; i<n; i++) {1898 for (size_t i=0; i<n; i++) { 1828 1899 r_8 reim[2]; 1829 1900 reim[0] = tab[i].real(); … … 1836 1907 } 1837 1908 1909 // Support pour les long double (128 bits floating point numbers) 1910 #ifdef SO_LDBLE128 1911 void 1912 PPFBinaryOutputStream::PutR16 (r_16 val) 1913 { 1914 PutRawUByte(PPS_SIMPLE + datasize2tagsize(16) + PPS_DATATYPE_FLOAT); 1915 1916 if (bigEndian != IS_BIG_ENDIAN) 1917 bswap16(&val); 1918 1919 PutRawBytes(&val, sizeof(r_16)); 1920 } 1921 1922 void 1923 PPFBinaryOutputStream::PutR16s (r_16 const* tab, size_t n) 1924 { 1925 PutArrayTag(16, n, PPS_DATATYPE_FLOAT); 1926 1927 if (bigEndian == IS_BIG_ENDIAN) { 1928 PutRawBytes(tab, n*sizeof(r_16)); 1929 } else { 1930 for (size_t i=0; i<n; i++) { 1931 r_16 val = tab[i]; 1932 bswap16(&val); 1933 PutRawBytes(&val, sizeof(r_16)); 1934 } 1935 } 1936 } 1937 1938 void 1939 PPFBinaryOutputStream::PutZ16 (complex<r_16> val) 1940 { 1941 PutRawUByte(PPS_SIMPLE + datasize2tagsize(16) + PPS_DATATYPE_COMPLEX); 1942 r_16 reim[2]; 1943 reim[0] = val.real(); 1944 reim[1] = val.imag(); 1945 if (bigEndian != IS_BIG_ENDIAN) { 1946 bswap16(reim); 1947 bswap16(reim+1); 1948 } 1949 PutRawBytes(reim, 2*sizeof(r_16)); 1950 } 1951 1952 void 1953 PPFBinaryOutputStream::PutZ16s (complex<r_16> const* tab, size_t n) 1954 { 1955 PutArrayTag(16, n, PPS_DATATYPE_COMPLEX); 1956 1957 if (bigEndian == IS_BIG_ENDIAN) { 1958 PutRawBytes(tab, n*2*sizeof(r_16)); 1959 } else { 1960 for (size_t i=0; i<n; i++) { 1961 r_16 reim[2]; 1962 reim[0] = tab[i].real(); 1963 reim[1] = tab[i].imag(); 1964 bswap16(reim); 1965 bswap16(reim+1); 1966 PutRawBytes(reim, 2*sizeof(r_16)); 1967 } 1968 } 1969 } 1970 #endif 1971 1838 1972 void 1839 1973 PPFBinaryOutputStream::PutPosTagTable(int_8 const * ptab, size_t sz) -
trunk/SophyaLib/BaseTools/ppfbinstream.h
r2485 r3750 142 142 void GetZ8 (complex<r_8> &); 143 143 void GetZ8s (complex<r_8> *, size_t); 144 #ifdef SO_LDBLE128 145 void GetR16 (r_16&); 146 void GetR16s (r_16*, size_t); 147 void GetZ16 (complex<r_16> &); 148 void GetZ16s (complex<r_16> *, size_t); 149 #endif 144 150 145 151 inline void Get(char& c) {GetByte(c);} … … 170 176 inline void Get(complex<r_4> * x, size_t n) { GetZ4s(x, n); } 171 177 inline void Get(complex<r_8> * x, size_t n) { GetZ8s(x, n); } 172 178 #ifdef SO_LDBLE128 179 inline void Get(r_16& x) {GetR16(x);} 180 inline void Get(r_16* x, size_t n) {GetR16s(x,n);} 181 inline void Get(complex<r_16> & x) {GetZ16(x);} 182 inline void Get(complex<r_16> * x, size_t n) { GetZ16s(x, n); } 183 #endif 173 184 // Reading a list (table) of position tags 174 185 void GetPosTagTable(int_8*, size_t); … … 184 195 void SkipItem(bool fgrdi=true, unsigned char itag=0); 185 196 186 void CheckTag ( short datasz, shortdatatype);187 void CheckArrayTag( short datasz, size_t sz, shortdatatype);197 void CheckTag (unsigned char datasz, unsigned char datatype); 198 void CheckArrayTag(unsigned char datasz, size_t sz, unsigned char datatype); 188 199 void GetTypeTag (unsigned char& c); 189 200 void GetRawByte (char& c); … … 245 256 void PutZ8 (complex<r_8>); 246 257 void PutZ8s (complex<r_8> const*, size_t); 247 258 #ifdef SO_LDBLE128 259 void PutR16 (r_16); 260 void PutR16s (r_16 const*, size_t); 261 void PutZ16 (complex<r_16>); 262 void PutZ16s (complex<r_16> const*, size_t); 263 #endif 248 264 249 265 void Put(char c) {PutByte(c);} … … 264 280 void Put(complex<r_4> const* x, size_t n) {PutZ4s(x,n);} 265 281 void Put(complex<r_8> const* x, size_t n) {PutZ8s(x,n);} 282 #ifdef SO_LDBLE128 283 void Put(r_16 x) {PutR16(x);} 284 void Put(r_16 const* x, size_t n) {PutR16s(x,n);} 285 void Put(complex<r_16> x) {PutZ16(x);} 286 void Put(complex<r_16> const* x, size_t n) {PutZ16s(x,n);} 287 #endif 266 288 void Put(uint_1 const* x, size_t n) {PutU1s(x,n);} 267 289 void Put(int_1 const* x, size_t n) {PutI1s(x,n);} … … 284 306 void WriteNameTagTableV2(); 285 307 286 void PutArrayTag( short datasz, size_t sz, shortdatatype);308 void PutArrayTag(unsigned char datasz, size_t sz, unsigned char datatype); 287 309 void PutRawByte (char); 288 310 void PutRawUByte (unsigned char); -
trunk/SophyaLib/BaseTools/sophyainit.cc
r3663 r3750 36 36 // - Exceptions sophya heritent de std::exception (mars 09) 37 37 // - Extension / ajout de classes generateur aleatoires (Mersenne-Twister ...avril 09) 38 // Module version number - 2.20 , Avr09 39 #define MOD_VERS 2.20 38 // Module version number - 2.20 , Avr09 39 // - Ajout type long double (r_16) et prise en chage des r_16 et complex<r_16> 40 // par les PPersist (fev 2010) 41 // Module version number - 2.30 , Fev10 42 43 #define MOD_VERS 2.30 40 44 41 45 // Pour garder la liste des modules et leurs numeros de version … … 98 102 PPRegister(FIO_NDataBlock< complex<r_8> >); 99 103 DObjRegister(FIO_NDataBlock< complex<r_8> >, NDataBlock< complex<r_8> >); 100 104 #ifdef SO_LDBLE128 105 PPRegister(FIO_NDataBlock<r_16>); 106 DObjRegister(FIO_NDataBlock<r_16>, NDataBlock<r_16>); 107 PPRegister(FIO_NDataBlock< complex<r_16> >); 108 DObjRegister(FIO_NDataBlock< complex<r_16> >, NDataBlock< complex<r_16> >); 109 #endif 101 110 // Enregistrement des handlers PPF pour les TimeStamp 102 111 PPRegister(ObjFileIO<TimeStamp>); -
trunk/SophyaLib/BaseTools/sversion.h
r3737 r3750 3 3 4 4 #define SOPHYA_VERSION 2.1 5 #define SOPHYA_REVISION 456 #define SOPHYA_TAG "V_ Jan2010"5 #define SOPHYA_REVISION 50 6 #define SOPHYA_TAG "V_Mar2010" 7 7 8 8 #endif
Note:
See TracChangeset
for help on using the changeset viewer.