Changeset 2482 in Sophya


Ignore:
Timestamp:
Dec 9, 2003, 7:36:31 PM (22 years ago)
Author:
ansari
Message:

remis declaration strptime pour gcc 2.95 et ajout statistiques en fin de fichier / modifs Write/ReadNameTagTable - Reza 9 Dec 2003

Location:
trunk/SophyaLib/BaseTools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/BaseTools/ppersist.cc

    r2477 r2482  
    1818// -----------------------------------------------------------------
    1919
    20 
    21 //  strptime n'est pas defini sous Linux  - Reza Mars 2000
    22 #if defined(OS_LINUX) || defined(OS_MACOSX)
    23 extern "C" {
    24 char *strptime(const char *buf, const char *format, struct tm *tm);
    25 }
    26 #endif
    2720
    2821#define MAXTAGLEN 255
     
    382375//--
    383376
    384 //++
     377PInPersist::PInPersist(RawInOutStream * is, bool ad, bool scan)
     378  : PPFBinaryInputStream(is, ad, scan)
     379{
     380}
     381
    385382PInPersist::PInPersist(string const& flnm, bool scan)
    386383  : PPFBinaryInputStream(flnm, scan)
    387 //
    388 //      Constructeur. Ouvre le fichier.
    389 //--
    390384{
    391385}
     
    613607  //  Comptage d'objets ecrits
    614608  _nbobjs++;
     609  if (wobj_level > _maxnestlevel)  _maxnestlevel = wobj_level;
    615610  if (wobj_level == 1) _nbtlobjs++;
    616611  wobj_level--; 
     
    633628    PutRawU8(id);      // Writing the corresponding object Id
    634629    PutRawI8(pos);     // The original object position
     630    _nbrefs++;         // Compteur de nombre de reference ecrits
    635631    return true;
    636632  }
  • trunk/SophyaLib/BaseTools/ppfbinstream.cc

    r2481 r2482  
    88
    99
    10 /*
    11 //  strptime n'est pas defini sous Linux  - Reza Mars 2000
    12 #if defined(OS_LINUX) || defined(OS_MACOSX)
     10//  strptime n'est pas defini sous Linux avec g++ avant gcc 3.x - Reza Mars 2000
     11#if defined(OS_LINUX) && defined(__GNUG__) && (__GNUC__ < 3)
    1312extern "C" {
    1413char *strptime(const char *buf, const char *format, struct tm *tm);
    1514}
    1615#endif
    17 */
    1816
    1917#define MAXTAGLEN_V2 255
     
    6159  _nbobjs = 0;       // Nb total d'objets
    6260  _nbtlobjs = 0;     // Nb d'objets de niveau 1
     61  _nbrefs = 0;       // Nb de reference d'objets
     62  _maxnestlevel = 0; // Niveau maximum d'objets emboites
    6363}
    6464
     
    8383  rs += buff;
    8484  rs += CreationDateStr();
    85   sprintf(buff,"\n NbObjs= %ld NbTopLevObjs= %ld ", (long)NbObjects(),
    86           (long)NbTopLevelObjects());
     85  sprintf(buff,"\n NbObjs= %ld NbTopLevObjs= %ld NbRefs= %ld MaxNest= %d ",
     86          (long)NbObjects(), (long)NbTopLevelObjects(),
     87          (long)NbReferences(), MaxNestedObjsLevel());
    8788  rs += buff;
    8889  sprintf(buff,"\n NbPosTag= %ld NbNameTag= %ld ", (long)NbPosTags(),
     
    172173  rbuf[32] = '\0';
    173174  struct tm tm;
    174   /*  #if !(defined(__MWERKS__) || defined(OS_MACOSX))  RZ-DEL */
    175175  strptime(rbuf,"%d/%m/%Y %H:%M:%S GMT",&tm);
    176176  /*  #else
    177177  sscanf(rbuf,"%2d/%2d/%4d %2d:%2d:%2d GMT",&tm.tm_mday,&tm.tm_mon,&tm.tm_year,
    178178                                            &tm.tm_hour,&tm.tm_min,&tm.tm_sec);
    179 
    180   tm.tm_mon  --;
    181   tm.tm_year -= 1900;
    182   #endif    RZ-DEL */
     179  tm.tm_mon  --;   tm.tm_year -= 1900;
     180  #endif  */
    183181
    184182  creationdate = mktime(&tm);
     
    212210    throw FileFormatExc("PPFBinaryInputStream::ReadNameTagTable()  Corrupted file PPS_NAMETAG_TABLE not found");
    213211  // Lecture nb de PosTag et nb d'objets dans le flot
    214   GetI8(_nbpostag);
    215   GetI8(_nbobjs);
    216   GetI8(_nbtlobjs);
     212  int_8 stats[8] = {0,0,0,0,0,0,0,0};
     213  GetI8s(stats, 8);
     214  _nbpostag = stats[0];
     215  _nbobjs = stats[1];
     216  _nbtlobjs = stats[2];
     217  _nbrefs = stats[3];
     218  _maxnestlevel = stats[4];
     219
    217220  uint_8 ttsz,it;
    218221  // Lecture nombre de NameTag
    219   GetU8(ttsz);
     222  GetRawU8(ttsz);
    220223  if (ttsz > 0) {
    221224    for(it=0; it<ttsz; it++) {
    222225      int_8 tpos;
    223226      string tname;
    224       GetI8(tpos);
     227      GetRawI8(tpos);
    225228      GetStr(tname);
    226229      tags[tname] = tpos;
     
    10221025  cout << " NbPosTag=" << NbPosTags() << " NbNameTag=" << tags.size()
    10231026       << " NbObjs=" << NbObjects() << " NbTopLevObjs=" << NbTopLevelObjects()
     1027       << " NbRefs=" << NbReferences() << " MaxNest=" << MaxNestedObjsLevel()
    10241028       << endl << endl;
    10251029
     
    10991103        else {
    11001104          cout << "<PPS_NAMETAG_TABLE> tag at position " << hex << cpos << dec << endl;
    1101           GetI8(i8);  // nb pos tag
    1102           GetI8(i8);  // nb d'objets
    1103           GetI8(i8);  // nb objets toplevel
    1104           GetU8(ui8); // nb de nametag
     1105          int_8 stats[8];
     1106          GetI8s(stats,8);
     1107          GetRawU8(ui8); // nb de nametag
    11051108          for(int kt=0; kt<ui8; kt++) {
    11061109            string tname;
    1107             GetI8(i8);
     1110            GetRawI8(i8);
    11081111            GetStr(tname);
    11091112            if (lev > 0) 
     
    12541257  PutRawUByte(PPS_NAMETAG_TABLE);  //   NameTagTable tag
    12551258  // Ecriture nb de PosTag et nb d'objets dans le flot
    1256   PutI8(_nbpostag);
    1257   PutI8(_nbobjs);
    1258   PutI8(_nbtlobjs); 
     1259  int_8 stats[8] = {0,0,0,0,0,0,0,0};
     1260  stats[0] = _nbpostag;
     1261  stats[1] = _nbobjs;
     1262  stats[2] = _nbtlobjs;
     1263  stats[3] = _nbrefs;
     1264  stats[4] = _maxnestlevel;
     1265  PutI8s(stats, 8);
    12591266  // Ecriture nb de tag et les tags
    1260   PutU8((uint_8)tags.size());    // Number of tags
     1267  PutRawU8((uint_8)tags.size());    // Number of tags
    12611268  if (tags.size() > 0) {
    12621269    for (map<string,int_8>::iterator i = tags.begin(); i != tags.end(); i++) {
    12631270      int_8 pos = (*i).second;
    1264       PutI8(pos);
     1271      PutRawI8(pos);
    12651272      PutStr((*i).first);
    12661273    }
  • trunk/SophyaLib/BaseTools/ppfbinstream.h

    r2477 r2482  
    6767  inline int_8  NbObjects() {return _nbobjs; }
    6868  inline int_8  NbTopLevelObjects() {return _nbtlobjs; }
     69  inline int_8  NbReferences() {return _nbrefs; }
     70  inline int_4  MaxNestedObjsLevel() {return _maxnestlevel; }
    6971
    7072  string GetTagName(int itag);  // 0..NbTags-1
     
    8385  int_8 _nbobjs;       // Nb total d'objets
    8486  int_8 _nbtlobjs;     // Nb d'objets de niveau 1
     87  int_8 _nbrefs;       // Nb de references PPS_REFERENCE
     88  int_4 _maxnestlevel; // Niveau maximum d'objets emboites
    8589};
    8690 
Note: See TracChangeset for help on using the changeset viewer.