Changeset 2441 in Sophya for trunk/SophyaLib/BaseTools
- Timestamp:
- Oct 3, 2003, 3:39:33 PM (22 years ago)
- Location:
- trunk/SophyaLib/BaseTools
- Files:
-
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/BaseTools/fiondblock.cc
r2322 r2441 8 8 #include <complex> 9 9 #include "pexceptions.h" 10 #include "datatype.h" 10 11 #include "fiondblock.h" 11 #include "datatype.h"12 12 #include <typeinfo> 13 13 … … 24 24 */ 25 25 26 // Pour pouvoir ecrire des tableaux de complex, en attendant27 // PIn/POutPersist::Get/Put(complex<>)28 #include "piocmplx.h"29 26 30 27 template <class T> … … 110 107 } 111 108 109 //--------------------------------------------------------------------------- 110 // Pour compatibilite de lecture avec PPF V2 111 inline void PIOSReadArray(PInPersist & is, uint_1 * arr, size_t n) 112 { is.GetBytes(arr, n); } 113 inline void PIOSReadArray(PInPersist & is, uint_2 * arr, size_t n) 114 { is.Get(arr, n); } 115 inline void PIOSReadArray(PInPersist & is, int_2 * arr, size_t n) 116 { is.Get(arr, n); } 117 inline void PIOSReadArray(PInPersist & is, uint_4 * arr, size_t n) 118 { is.Get(arr, n); } 119 inline void PIOSReadArray(PInPersist & is, int_4 * arr, size_t n) 120 { is.Get(arr, n); } 121 inline void PIOSReadArray(PInPersist & is, uint_8 * arr, size_t n) 122 { is.Get(arr, n); } 123 inline void PIOSReadArray(PInPersist & is, int_8 * arr, size_t n) 124 { is.Get(arr, n); } 125 inline void PIOSReadArray(PInPersist & is, r_4 * arr, size_t n) 126 { is.Get(arr, n); } 127 inline void PIOSReadArray(PInPersist & is, r_8 * arr, size_t n) 128 { is.Get(arr, n); } 129 inline void PIOSReadArray(PInPersist & is, complex<float> * arr, size_t n) 130 { r_4 * pr = (r_4 *)arr; is.Get(pr, n*2); } 131 inline void PIOSReadArray(PInPersist & is, complex<double> * arr, size_t n) 132 { r_8 * pr = (r_8 *)arr; is.Get(pr, n*2); } 133 //--------------------------------------------------------------------------- 134 112 135 template <class T> 113 136 void FIO_NDataBlock<T>::ReadSelf(PInPersist& is) … … 119 142 else if (itab[1] != dobj->Size()) dobj->ReSize(itab[1]); 120 143 // On lit le tableau de nombres 121 PIOSReadArray(is, dobj->Data(), dobj->Size()); 144 if (is.Version() <= 2) // lecture ancienne version PPF 145 PIOSReadArray(is, dobj->Data(), dobj->Size()); 146 else is.Get(dobj->Data(), dobj->Size()); 122 147 } 123 148 … … 135 160 os.Put(itab, 3); 136 161 // On ecrit le tableau de nombres 137 PIOSWriteArray(os, dobj->Data(), dobj->Size()); 162 os.Put(dobj->Data(), dobj->Size()); 138 163 } 139 164 -
trunk/SophyaLib/BaseTools/ppersist.cc
r2430 r2441 336 336 //-- 337 337 { 338 s.Write Tag(tag);338 s.WriteNameTag(tag); 339 339 s.PutPPObject(this); 340 340 } … … 431 431 rbuf[32] = '\0'; 432 432 struct tm tm; 433 #if !(defined(__MWERKS__) || defined(OS_MACOSX))433 /* #if !(defined(__MWERKS__) || defined(OS_MACOSX)) RZ-DEL */ 434 434 strptime(rbuf,"%d/%m/%Y %H:%M:%S GMT",&tm); 435 #else435 /* #else 436 436 sscanf(rbuf,"%2d/%2d/%4d %2d:%2d:%2d GMT",&tm.tm_mday,&tm.tm_mon,&tm.tm_year, 437 437 &tm.tm_hour,&tm.tm_min,&tm.tm_sec); 438 438 439 tm.tm_mon --; 439 440 tm.tm_year -= 1900; 440 #endif 441 #endif RZ-DEL */ 442 441 443 creationdate = mktime(&tm); 442 444 filename = flnm; // keep the filename … … 516 518 if (ppstype == PPS_EOF) break; 517 519 518 if (ppstype != PPS_ TAG)520 if (ppstype != PPS_NAMETAG_TABLE) 519 521 throw FileFormatExc("PInPersist::Scan corrupted file, bad tag entry"); 520 522 … … 540 542 541 543 bool 542 PInPersist::GotoTag(string const& name) 544 PInPersist::GotoPositionTag(int_8 pos) 545 { 546 s->seekg(pos); 547 int_8 tpos; 548 GetRawI8(tpos); 549 if (tpos != pos) 550 throw FileFormatExc("PInPersist::GotoPositionTag() - Wrong tag position!"); 551 return true; 552 } 553 554 bool 555 PInPersist::GotoNameTag(string const& name) 543 556 { 544 557 map<string, int_8>::iterator i = tags.find(name); 545 558 if (i == tags.end()) 546 559 return false; 547 // throw NotFoundExc("PInPersist::Goto Tag tag not found");560 // throw NotFoundExc("PInPersist::GotoNameTag tag not found"); 548 561 s->seekg((*i).second); 549 562 seqread = false; … … 551 564 return(true); 552 565 } 566 553 567 554 568 bool … … 625 639 PInPersist::GetTypeTag(unsigned char& c) 626 640 { 627 c = PPS_TAG_MARK; 628 while (c == PPS_TAG_MARK) GetRawUByte(c); 629 // while (c == PPS_TAG_MARK) { Il ne faut plus faire ca ! 641 int_8 tpos; 642 c = PPS_NAMETAG_MARK; 643 while ( (c == PPS_NAMETAG_MARK) || (c == PPS_POSTAG_MARK) ) { 644 GetRawUByte(c); 645 if (c == PPS_POSTAG_MARK) GetRawI8(tpos); 646 } 647 // while (c == PPS_NAMETAG_MARK) { Il ne faut plus faire ca ! 630 648 // objList.clear(); $CHECK$ Reza 03/2000 631 649 // GetRawByte(c); … … 776 794 777 795 void 796 PInPersist::GetI1 (int_1& result) 797 { 798 CheckTag(1,PPS_DATATYPE_INTEGER); 799 GetRawBytes(&result, sizeof(int_1)); 800 } 801 802 void 803 PInPersist::GetI1s (int_1* tab, size_t n) 804 { 805 CheckArrayTag(1,n,PPS_DATATYPE_INTEGER); 806 GetRawBytes(tab, n*sizeof(int_1)); 807 } 808 809 void 810 PInPersist::GetU1 (uint_1& result) 811 { 812 CheckTag(1,PPS_DATATYPE_UNSIGNED); 813 GetRawBytes(&result, sizeof(uint_1)); 814 } 815 816 void 817 PInPersist::GetU1s (uint_1* tab, size_t n) 818 { 819 CheckArrayTag(1,n,PPS_DATATYPE_UNSIGNED); 820 GetRawBytes(tab, n*sizeof(uint_1)); 821 } 822 823 void 778 824 PInPersist::GetI2 (int_2& result) 779 825 { … … 934 980 } 935 981 982 void 983 PInPersist::GetZ4 (complex<r_4>& result) 984 { 985 CheckTag(4,PPS_DATATYPE_COMPLEX); 986 r_4 reim[2]; 987 GetRawBytes(reim, 2*sizeof(r_4)); 988 if (bigEndian != IS_BIG_ENDIAN) { 989 bswap4(reim); 990 bswap4(reim+1); 991 } 992 result = complex<r_4>(reim[0], reim[1]); 993 } 994 995 void 996 PInPersist::GetZ4s (complex<r_4>* tab, size_t n) 997 { 998 CheckArrayTag(4,n,PPS_DATATYPE_COMPLEX); 999 GetRawBytes(tab, n*2*sizeof(r_4)); 1000 if (bigEndian == IS_BIG_ENDIAN) return; 1001 1002 r_4 * p = (r_4 *)tab; 1003 for (unsigned int i=0; i<n; i++) { 1004 bswap4(p); p++; 1005 bswap4(p); p++; 1006 } 1007 return; 1008 } 1009 1010 void 1011 PInPersist::GetZ8 (complex<r_8>& result) 1012 { 1013 CheckTag(8,PPS_DATATYPE_COMPLEX); 1014 r_8 reim[2]; 1015 GetRawBytes(reim, 2*sizeof(r_8)); 1016 if (bigEndian != IS_BIG_ENDIAN) { 1017 bswap8(reim); 1018 bswap8(reim+1); 1019 } 1020 result = complex<r_8>(reim[0], reim[1]); 1021 } 1022 1023 void 1024 PInPersist::GetZ8s (complex<r_8>* tab, size_t n) 1025 { 1026 CheckArrayTag(8,n,PPS_DATATYPE_COMPLEX); 1027 GetRawBytes(tab, n*2*sizeof(r_8)); 1028 if (bigEndian == IS_BIG_ENDIAN) return; 1029 1030 r_8 * p = (r_8 *)tab; 1031 for (unsigned int i=0; i<n; i++) { 1032 bswap8(p); p++; 1033 bswap8(p); p++; 1034 } 1035 return; 1036 } 1037 1038 1039 void 1040 PInPersist::GetPosTagTable(int_8* ptab, size_t sz) 1041 { 1042 unsigned char ppstype; 1043 GetTypeTag(ppstype); 1044 if (ppstype != PPS_POSTAG_TABLE) 1045 throw FileFormatExc("PInPersist::GetPosTagTable bad type in ppersist stream"); 1046 int_4 tsz; 1047 GetRawI4(tsz); 1048 if (tsz != sz) 1049 throw FileFormatExc("PInPersist::GetPosTagTable Size mismatch "); 1050 for(int kk=0; kk<tsz; kk++) 1051 GetRawI8(ptab[kk]); 1052 return; 1053 } 1054 1055 void 1056 PInPersist::GetPosTagTable(vector<int_8>& ptab) 1057 { 1058 unsigned char ppstype; 1059 GetTypeTag(ppstype); 1060 if (ppstype != PPS_POSTAG_TABLE) 1061 throw FileFormatExc("PInPersist::GetPosTagTable bad type in ppersist stream"); 1062 ptab.clear(); 1063 int_4 tsz; 1064 GetRawI4(tsz); 1065 int_8 tpos; 1066 for(int kk=0; kk<tsz; kk++) { 1067 GetRawI8(tpos); 1068 ptab.push_back(tpos); 1069 } 1070 return; 1071 } 936 1072 937 1073 PPersist* … … 1010 1146 { 1011 1147 unsigned char ppstag=0; 1012 unsigned char ppst1,ppst2,ppst3 ;1148 unsigned char ppst1,ppst2,ppst3,ppst30; 1013 1149 uint_8 cpos,fsize; 1014 1150 uint_8 ui8,cid,oid; … … 1053 1189 ppst2 = ppstag&0x30; // bits 45 1054 1190 ppst3 = ppstag&0xc0; // bits 67 1191 ppst30 = ppstag&0xc1; // bits 0 67 1055 1192 if ((ppst2 == 0) && (ppst3 == 0) ) { 1056 1193 switch (ppst1) { … … 1081 1218 break; 1082 1219 1083 case PPS_TAG_MARK : 1084 cout << "<PPS_TAG_MARK> tag at position " << hex << cpos << dec << endl; 1220 case PPS_NAMETAG_MARK : 1221 cout << "<PPS_NAMETAG_MARK> tag at position " << hex << cpos << dec << endl; 1222 break; 1223 1224 case PPS_POSTAG_MARK : 1225 GetRawI8(i8); 1226 cout << "<PPS_POSTAG_MARK> tag at position " << hex << cpos 1227 << " TPos=" << i8 << dec << endl; 1085 1228 break; 1086 1229 … … 1091 1234 break; 1092 1235 1093 case PPS_TAG : 1236 case PPS_POSTAG_TABLE : 1237 GetRawI4(i4); 1238 for(int kkt=0; kkt<i4; kkt++) GetRawI8(i8); 1239 cout << "<PPS_POSTAG_TABLE> tag at position " << hex << cpos << dec << endl; 1240 break; 1241 1242 case PPS_NAMETAG_TABLE : 1094 1243 GetRawI8(i8); 1095 1244 GetRawI4(i4); … … 1117 1266 else { 1118 1267 string dtype = "???? x"; 1119 if (ppst3 == PPS_DATATYPE_CHAR) dtype = "CHAR x"; 1268 if (ppst30 == PPS_DATATYPE_COMPLEX) dtype = "COMPLEX x"; 1269 else if (ppst3 == PPS_DATATYPE_CHAR) dtype = "CHAR x"; 1120 1270 else if (ppst3 == PPS_DATATYPE_FLOAT) dtype = "FLOAT x"; 1121 1271 else if (ppst3 == PPS_DATATYPE_INTEGER) dtype = "INTEGER x"; 1122 1272 else if (ppst3 == PPS_DATATYPE_UNSIGNED) dtype = "UNSIGNED x"; 1123 1273 int_4 dsize = ppst1; 1274 int_4 dsizeskip = dsize; 1275 if (ppst30 == PPS_DATATYPE_COMPLEX) { 1276 dsize--; 1277 dsizeskip = 2*dsize; 1278 } 1124 1279 char sb[16]; 1125 1280 sprintf(sb, "%d", dsize); … … 1131 1286 if (lev > 2) cout << "<PPS_SIMPLE> tag at position " << hex << cpos << dec 1132 1287 << " DataType=" << dtype << endl; 1133 s->seekg(dsize , ios::cur);1288 s->seekg(dsizeskip, ios::cur); 1134 1289 break; 1135 1290 … … 1138 1293 if (lev > 0) cout << "<PPS_SIMPLE_ARRAY4> tag at position " << hex << cpos << dec 1139 1294 << " DataType=" << dtype << " NElts= " << i4 << endl; 1140 s->seekg((uint_8)dsize *(uint_8)i4, ios::cur);1295 s->seekg((uint_8)dsizeskip*(uint_8)i4, ios::cur); 1141 1296 break; 1142 1297 … … 1145 1300 if (lev > 0) cout << "<PPS_SIMPLE_ARRAY8> tag at position " << hex << cpos << dec 1146 1301 << " DataType=" << dtype << " NElts= " << ui8 << endl; 1147 s->seekg((uint_8)dsize *ui8, ios::cur);1302 s->seekg((uint_8)dsizeskip*ui8, ios::cur); 1148 1303 break; 1149 1304 } … … 1247 1402 // Output stream creation 1248 1403 s = new ofstream(flnm.c_str(),ios::out | IOS_BIN); 1249 1404 version = 3; 1250 1405 // Header 1251 PutRawBytes("SOS-SOPHYA-PPersistFile V 2",32);1406 PutRawBytes("SOS-SOPHYA-PPersistFile V3 ",32); 1252 1407 PutRawBytes(bigEndian 1253 1408 ? "BIG-ENDIAN " … … 1279 1434 string name = (*i).first; 1280 1435 int_8 pos = (*i).second; 1281 PutRawUByte(PPS_ TAG); // This is a tag1436 PutRawUByte(PPS_NAMETAG_TABLE); // This is a tag 1282 1437 PutRawI8(pos); // position of previous tag 1283 1438 PutRawI4(name.length()); // length of the name … … 1291 1446 } 1292 1447 1293 1294 void 1295 POutPersist::WriteTag(string const& name) 1448 int_8 1449 POutPersist::WritePositionTag() 1450 { 1451 int_8 tagpos; 1452 #ifdef STREAMPOS_IS_CLASS 1453 tagpos = s->tellp().offset(); 1454 #else 1455 tagpos = s->tellp(); 1456 #endif 1457 PutRawByte(PPS_POSTAG_MARK); 1458 PutI8(tagpos); 1459 return(tagpos); 1460 } 1461 1462 void 1463 POutPersist::WriteNameTag(string const& name) 1296 1464 { 1297 1465 if (name.length() > MAXTAGLEN) 1298 throw ParmError("POutPersist::Write Tag tag name too long");1466 throw ParmError("POutPersist::WriteNameTag tag name too long"); 1299 1467 1300 1468 if (tags.find(name) != tags.end()) 1301 throw DuplicateIdExc("POutPersist::Write Tag duplicate tag name");1469 throw DuplicateIdExc("POutPersist::WriteNameTag duplicate tag name"); 1302 1470 1303 1471 // Get current file position … … 1311 1479 1312 1480 tags[name] = tagPos; 1313 PutRawUByte(PPS_ TAG_MARK); // This is a tag1481 PutRawUByte(PPS_NAMETAG_MARK); // This is a tag 1314 1482 // objList.clear(); // $CHECK$ EA 171199 - Ne pas faire ? Reza 03/2000 1315 1483 } … … 1482 1650 1483 1651 void 1652 POutPersist::PutI1 (int_1 val) 1653 { 1654 PutRawUByte(PPS_SIMPLE + 1 + PPS_DATATYPE_INTEGER); 1655 PutRawBytes(&val, sizeof(int_1)); 1656 } 1657 1658 void 1659 POutPersist::PutI1s (int_1 const* tab, size_t n) 1660 { 1661 PutArrayTag(1, n, PPS_DATATYPE_INTEGER); 1662 PutRawBytes(tab, n*sizeof(int_1)); 1663 } 1664 1665 void 1666 POutPersist::PutU1 (uint_1 val) 1667 { 1668 PutRawUByte(PPS_SIMPLE + 1 + PPS_DATATYPE_UNSIGNED); 1669 PutRawBytes(&val, sizeof(uint_1)); 1670 } 1671 1672 void 1673 POutPersist::PutU1s (uint_1 const* tab, size_t n) 1674 { 1675 PutArrayTag(1, n, PPS_DATATYPE_UNSIGNED); 1676 PutRawBytes(tab, n*sizeof(uint_1)); 1677 } 1678 1679 void 1484 1680 POutPersist::PutI2 (int_2 val) 1485 1681 { … … 1660 1856 1661 1857 void 1858 POutPersist::PutZ4 (complex<r_4> val) 1859 { 1860 PutRawUByte(PPS_SIMPLE + 4 + PPS_DATATYPE_COMPLEX); 1861 r_4 reim[2]; 1862 reim[0] = val.real(); 1863 reim[1] = val.imag(); 1864 if (bigEndian != IS_BIG_ENDIAN) { 1865 bswap4(reim); 1866 bswap4(reim+1); 1867 } 1868 PutRawBytes(reim, 2*sizeof(r_4)); 1869 } 1870 1871 void 1872 POutPersist::PutZ4s (complex<r_4> const* tab, size_t n) 1873 { 1874 PutArrayTag(4, n, PPS_DATATYPE_COMPLEX); 1875 1876 if (bigEndian == IS_BIG_ENDIAN) { 1877 PutRawBytes(tab, n*2*sizeof(r_4)); 1878 } else { 1879 for (unsigned int i=0; i<n; i++) { 1880 r_4 reim[2]; 1881 reim[0] = tab[i].real(); 1882 reim[1] = tab[i].imag(); 1883 bswap4(reim); 1884 bswap4(reim+1); 1885 PutRawBytes(reim, 2*sizeof(r_4)); 1886 } 1887 } 1888 } 1889 1890 void 1891 POutPersist::PutZ8 (complex<r_8> val) 1892 { 1893 PutRawUByte(PPS_SIMPLE + 8 + PPS_DATATYPE_COMPLEX); 1894 r_8 reim[2]; 1895 reim[0] = val.real(); 1896 reim[1] = val.imag(); 1897 if (bigEndian != IS_BIG_ENDIAN) { 1898 bswap8(reim); 1899 bswap8(reim+1); 1900 } 1901 PutRawBytes(reim, 2*sizeof(r_8)); 1902 } 1903 1904 void 1905 POutPersist::PutZ8s (complex<r_8> const* tab, size_t n) 1906 { 1907 PutArrayTag(8, n, PPS_DATATYPE_COMPLEX); 1908 1909 if (bigEndian == IS_BIG_ENDIAN) { 1910 PutRawBytes(tab, n*2*sizeof(r_8)); 1911 } else { 1912 for (unsigned int i=0; i<n; i++) { 1913 r_8 reim[2]; 1914 reim[0] = tab[i].real(); 1915 reim[1] = tab[i].imag(); 1916 bswap8(reim); 1917 bswap8(reim+1); 1918 PutRawBytes(reim, 2*sizeof(r_8)); 1919 } 1920 } 1921 } 1922 1923 void 1924 POutPersist::PutPosTagTable(int_8 const * ptab, size_t sz) 1925 { 1926 PutRawUByte(PPS_POSTAG_TABLE); 1927 int_4 tsz = sz; 1928 PutRawI4(tsz); 1929 for(int kk=0; kk<tsz; kk++) 1930 PutRawI8(ptab[kk]); 1931 return; 1932 } 1933 1934 void 1935 POutPersist::PutPosTagTable(vector<int_8> const& ptab) 1936 { 1937 PutRawUByte(PPS_POSTAG_TABLE); 1938 int_4 tsz = ptab.size(); 1939 PutRawI4(tsz); 1940 for(int kk=0; kk<tsz; kk++) 1941 PutRawI8(ptab[kk]); 1942 return; 1943 } 1944 1945 void 1662 1946 POutPersist::PutObject(AnyDataObj & o) 1663 1947 { … … 1673 1957 POutPersist::PutObject(AnyDataObj & o, string tagname) 1674 1958 { 1675 Write Tag(tagname);1959 WriteNameTag(tagname); 1676 1960 PutObject(o); 1677 1961 } -
trunk/SophyaLib/BaseTools/ppersist.h
r1202 r2441 17 17 #include <time.h> 18 18 19 #include <complex> 19 20 #include <string> 20 21 #include <map> … … 93 94 static void Initialize(); // Pour initialiser classList 94 95 96 int Version() {return version;} // PIn/OutPersist version number 95 97 string FileName() { return filename; } // Retourne le nom de fichier 96 98 … … 109 111 PPS_OBJECT = 2, // classId, data... 110 112 PPS_REFERENCE = 3, // objectId 111 PPS_ TAG = 4, // tag entries113 PPS_NAMETAG_TABLE = 4, // Name tag table (Written at the end of file/stream) 112 114 PPS_EOF = 5, // Just before tag infomation, offset to PPS_TAG 113 115 PPS_ENDOBJECT = 6, // marks the end of a given object information 114 PPS_TAG_MARK = 7, // To have a name tag, position marker in a file 116 PPS_NAMETAG_MARK = 7, // To have a name tag, position marker in a file 117 PPS_POSTAG_MARK = 8, // Position tag mark + 8 bytes (=stream position) 118 PPS_POSTAG_TABLE = 40, // Position tag table + 8 bytes (=stream position) 115 119 PPS_SIMPLE = 16, // 16 + number of bytes, up to 8 bytes 116 120 PPS_SIMPLE_ARRAY4 = 32, // 32 + number of bytes, up to 8 bytes, then 4 bytes of length … … 120 124 enum {PPS_DATATYPE_CHAR = 0, // 0 : DataType=character 121 125 PPS_DATATYPE_FLOAT = 64, // 64 : DataType=float 126 PPS_DATATYPE_COMPLEX = 65, // 65 : DataType=complex 122 127 PPS_DATATYPE_INTEGER = 128, // 128 :DataType=integer 123 128 PPS_DATATYPE_UNSIGNED = 192 // 192 :DataType=Unsigned integer … … 126 131 map<string, int_8> tags; 127 132 string filename; 133 int version; // PPersist(In/Out) version 128 134 }; 129 135 130 136 131 137 // TBD : use hash tables instead of maps. Check hashtbl status in STL. 132 138 133 139 //! Input stream for PPersit objects. … … 137 143 ~PInPersist(); 138 144 139 bool GotoTag(string const& name); 145 // Gestion des tags 146 bool GotoPositionTag(int_8 pos); 147 bool GotoNameTag(string const& name); 148 inline bool GotoTag(string const& name) { return GotoNameTag(name); } 140 149 int NbTags(); 141 150 bool GotoTagNum(int itag); // 0..NbTags-1 … … 144 153 vector<string> const & GetTagNames(); 145 154 155 // Lecture donnees de base et tableaux de donnees de base 156 // Basic data type (and corresponding arrays) reading 146 157 void GetByte (char& c); 147 158 void GetBytes(void* ptr, size_t bytes); … … 150 161 void GetR8 (r_8&); 151 162 void GetR8s (r_8*, size_t); 163 void GetI1 (int_1&); 164 void GetI1s (int_1*, size_t); 165 void GetU1 (uint_1&); 166 void GetU1s (uint_1*, size_t); 152 167 void GetI2 (int_2&); 153 168 void GetI2s (int_2*, size_t); … … 164 179 void GetLine (char* ptr, size_t len); 165 180 void GetStr (string&); 166 167 void Get(char& c) {GetByte(c);} 168 void Get(r_4& x) {GetR4(x);} 169 void Get(r_8& x) {GetR8(x);} 170 void Get(uint_2& x) {GetU2(x);} 171 void Get(int_2& x) {GetI2(x);} 172 void Get(uint_4& x) {GetU4(x);} 173 void Get(int_4& x) {GetI4(x);} 174 void Get(uint_8& x) {GetU8(x);} 175 void Get(int_8& x) {GetI8(x);} 176 void Get(r_4* x, size_t n) {GetR4s(x,n);} 177 void Get(r_8* x, size_t n) {GetR8s(x,n);} 178 void Get(uint_2* x, size_t n) {GetU2s(x,n);} 179 void Get(int_2* x, size_t n) {GetI2s(x,n);} 180 void Get(uint_4* x, size_t n) {GetU4s(x,n);} 181 void Get(int_4* x, size_t n) {GetI4s(x,n);} 182 void Get(uint_8* x, size_t n) {GetU8s(x,n);} 183 void Get(int_8* x, size_t n) {GetI8s(x,n);} 184 void Get(string& x) {GetStr(x);} 185 181 void GetZ4 (complex<r_4> &); 182 void GetZ4s (complex<r_4> *, size_t); 183 void GetZ8 (complex<r_8> &); 184 void GetZ8s (complex<r_8> *, size_t); 185 186 inline void Get(char& c) {GetByte(c);} 187 inline void Get(r_4& x) {GetR4(x);} 188 inline void Get(r_8& x) {GetR8(x);} 189 inline void Get(uint_1& x) {GetU1(x);} 190 inline void Get(int_1& x) {GetI1(x);} 191 inline void Get(uint_2& x) {GetU2(x);} 192 inline void Get(int_2& x) {GetI2(x);} 193 inline void Get(uint_4& x) {GetU4(x);} 194 inline void Get(int_4& x) {GetI4(x);} 195 inline void Get(uint_8& x) {GetU8(x);} 196 inline void Get(int_8& x) {GetI8(x);} 197 inline void Get(complex<r_4> & x) {GetZ4(x);} 198 inline void Get(complex<r_8> & x) {GetZ8(x);} 199 200 inline void Get(r_4* x, size_t n) {GetR4s(x,n);} 201 inline void Get(r_8* x, size_t n) {GetR8s(x,n);} 202 inline void Get(uint_1* x, size_t n) {GetU1s(x,n);} 203 inline void Get(int_1* x, size_t n) {GetI1s(x,n);} 204 inline void Get(uint_2* x, size_t n) {GetU2s(x,n);} 205 inline void Get(int_2* x, size_t n) {GetI2s(x,n);} 206 inline void Get(uint_4* x, size_t n) {GetU4s(x,n);} 207 inline void Get(int_4* x, size_t n) {GetI4s(x,n);} 208 inline void Get(uint_8* x, size_t n) {GetU8s(x,n);} 209 inline void Get(int_8* x, size_t n) {GetI8s(x,n);} 210 inline void Get(string& x) {GetStr(x);} 211 inline void Get(complex<r_4> * x, size_t n) { GetZ4s(x, n); } 212 inline void Get(complex<r_8> * x, size_t n) { GetZ8s(x, n); } 213 214 // Reading a list (table) of position tags 215 void GetPosTagTable(int_8*, size_t); 216 void GetPosTagTable(vector<int_8>&); 217 186 218 // Object Reading 187 219 PPersist* ReadObject(); … … 190 222 PPersist* GetPPObject(AnyDataObj * po=NULL); 191 223 192 int Version() {return version;}193 224 time_t CreationDate() { return creationdate; } 194 225 string CreationDateStr(); … … 219 250 220 251 bool bigEndian; 221 int version;222 252 223 253 time_t creationdate; … … 237 267 ~POutPersist(); 238 268 239 void WriteTag(string const& name); 269 // Ecriture de tags 270 int_8 WritePositionTag(); 271 void WriteNameTag(string const& name); 272 inline void WriteTag(string const& name) { WriteNameTag(name); } 240 273 241 274 void PutByte (char c); … … 245 278 void PutR8 (r_8); 246 279 void PutR8s (r_8 const*, size_t); 280 void PutI1 (int_1); 281 void PutI1s (int_1 const*, size_t); 282 void PutU1 (uint_1); 283 void PutU1s (uint_1 const*, size_t); 247 284 void PutI2 (int_2); 248 285 void PutI2s (int_2 const*, size_t); … … 259 296 void PutLine (char const* ptr, size_t len=0); // deprecated ? 260 297 void PutStr (string const&); 261 void PutPPObject (PPersist const*); // Like doing Write(stream) on PPersist object 262 263 void PutObject(AnyDataObj & o); // Creates the corresponding PPersist Object and call Write() 264 void PutObject(AnyDataObj & o, string tagname); 298 void PutZ4 (complex<r_4>); 299 void PutZ4s (complex<r_4> const*, size_t); 300 void PutZ8 (complex<r_8>); 301 void PutZ8s (complex<r_8> const*, size_t); 302 265 303 266 304 void Put(char c) {PutByte(c);} 267 305 void Put(r_4 x) {PutR4(x);} 268 306 void Put(r_8 x) {PutR8(x);} 307 void Put(complex<r_4> x) {PutZ4(x);} 308 void Put(complex<r_8> x) {PutZ8(x);} 309 void Put(uint_1 x) {PutU1(x);} 310 void Put(int_1 x) {PutI1(x);} 269 311 void Put(uint_2 x) {PutU2(x);} 270 312 void Put(int_2 x) {PutI2(x);} … … 275 317 void Put(r_4 const* x, size_t n) {PutR4s(x,n);} 276 318 void Put(r_8 const* x, size_t n) {PutR8s(x,n);} 319 void Put(complex<r_4> const* x, size_t n) {PutZ4s(x,n);} 320 void Put(complex<r_8> const* x, size_t n) {PutZ8s(x,n);} 321 void Put(uint_1 const* x, size_t n) {PutU1s(x,n);} 322 void Put(int_1 const* x, size_t n) {PutI1s(x,n);} 277 323 void Put(uint_2 const* x, size_t n) {PutU2s(x,n);} 278 324 void Put(int_2 const* x, size_t n) {PutI2s(x,n);} … … 283 329 void Put(string const& s) {PutStr(s);} 284 330 void Put(PPersist const* x) {PutPPObject(x);} 331 332 // Writing a list of position tag table 333 void PutPosTagTable(int_8 const *, size_t); 334 void PutPosTagTable(vector<int_8> const&); 335 336 // Objet Write - Ecriture des objets 337 void PutPPObject (PPersist const*); // Like doing Write(stream) on PPersist object 338 339 void PutObject(AnyDataObj & o); // Creates the corresponding PPersist Object and call Write() 340 void PutObject(AnyDataObj & o, string tagname); 285 341 286 342 … … 310 366 }; 311 367 312 368 369 // Le macro suivant permettent de simplifier la declaration 370 // des operateurs >> << sur les POutPersist et PInPersist 313 371 #define RAWPERSISTIO(_Type_,_xtyp_) \ 314 372 inline POutPersist& operator << (POutPersist& c, _Type_ const& data) \ … … 324 382 } 325 383 384 // On utilise le macro RAWPERSISTIO pour declarer POutPersist << et PInPersist >> 385 // pour les types de base r_4 r_8 int_4 int_8 ... 326 386 RAWPERSISTIO(int_4,I4); 327 387 RAWPERSISTIO(uint_4,U4); … … 331 391 RAWPERSISTIO(r_4,R4); 332 392 RAWPERSISTIO(r_8,R8); 393 RAWPERSISTIO(complex<r_4>,Z4); 394 RAWPERSISTIO(complex<r_8>,Z8); 395 RAWPERSISTIO(string,Str); 333 396 334 397 #if 0 -
trunk/SophyaLib/BaseTools/sversion.h
r2434 r2441 2 2 #define SVERSION_H 3 3 4 #define SOPHYA_VERSION 1. 74 #define SOPHYA_VERSION 1.8 5 5 #define SOPHYA_REVISION 0 6 #define SOPHYA_TAG "V_ Sep2003"6 #define SOPHYA_TAG "V_Oct2003" 7 7 8 8 #endif
Note:
See TracChangeset
for help on using the changeset viewer.