Changeset 802 in Sophya


Ignore:
Timestamp:
Apr 3, 2000, 7:32:27 PM (25 years ago)
Author:
ansari
Message:

Mise au point du nouveau schema (Version=2) de PPersist - Mise en place

de tag complet pour toutes les donnees/objets ecrits - Gestion a peu
pres correct des objets references plusieurs fois, ecrit une seule fois.
Mecanisme d'enregistrement pour les DataObject associe et Methodes
(PutObject/GetObjet) facilitant l'ecriture/lecture de DataObject.
Separation du fichier de la classe FIO_NDataBlock<T>.

Reza03/04/2000

Location:
trunk/SophyaLib/BaseTools
Files:
2 added
7 edited

Legend:

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

    r754 r802  
    270270//  ostream&    operator << (ostream& s, DVList& dvl)
    271271//      sortie sur flot "s" (Appel a "Print(s)").
    272 //  void  Write(string const& fn)
    273 //      Ecriture d'un fichier PPersist de nom "fn"
    274 //  void  Read(string const& fn)
    275 //      Lecture d'un fichier PPersist de nom "fn"
    276272//--
    277273
     
    350346{
    351347char buf[512];
     348string sfw;
    352349
    353350int lc = dobj->Comment().length();
    354 if (lc > 511) lc = 511;
    355351if (lc > 0) {
    356352  sprintf(buf,"Comment: ( %6d ) ", lc);
    357   s.PutLine(buf);
    358   s.PutBytes(dobj->Comment().c_str(), lc);
    359   }
    360 s.PutLine("----Variable-List---------------");
     353  sfw = buf;  s.PutStr(sfw);
     354  s.PutStr(dobj->Comment());
     355  }
     356sfw = "----Variable-List---------------";  s.PutStr(sfw);
    361357DVList::ValList::const_iterator it;
    362358for(it = dobj->Begin(); it != dobj->End(); it++)  {
     
    364360    case 'I' :
    365361      sprintf(buf,"I %s %d", (*it).first.substr(0,64).c_str(), (*it).second.elval.mtv.iv );
    366       s.PutLine(buf);
     362      sfw = buf;  s.PutStr(sfw);
    367363      break;
    368364    case 'D' :
    369365      sprintf(buf,"D %s %.20g", (*it).first.substr(0,64).c_str(), (*it).second.elval.mtv.dv );
    370       s.PutLine(buf);
     366      sfw = buf;  s.PutStr(sfw);
    371367      break;
    372368    case 'S' :
    373369      sprintf(buf,"S %s %s", (*it).first.substr(0,64).c_str(), (*it).second.elval.mtv.strv );
    374       s.PutLine(buf);
     370      sfw = buf;  s.PutStr(sfw);
    375371      break;
    376372    default :
     
    380376  if ((*it).second.elcomm.length() > 0) {
    381377    sprintf(buf,"# %s", (*it).second.elcomm.substr(0,256).c_str());
    382     s.PutLine(buf);
    383   }
    384 }
    385 
    386 s.PutLine("ZZZZZ--End-of-Varible-List------");
     378    sfw = buf;  s.PutStr(sfw);
     379  }
     380}
     381
     382sfw = "ZZZZZ--End-of-Varible-List------"; s.PutStr(sfw);
    387383}
    388384
     
    391387{
    392388char buf[512];
     389string sfr;
    393390int_8 j,iv;
    394391r_8 dv;
     
    397394dobj->Clear();
    398395
    399 s.GetLine(buf, 511);  // Pour lire les "------- "
    400 if (buf[0] != '-') {  // Il y a un champ commentaire a lire
    401   buf[18] ='\0';
    402   int lc = atoi(buf+11);
    403   if (lc > 511)  {
    404     cerr << "DVList::ReadSelf() Pb/Bug ??  CommentLength= " << lc << endl;
    405     lc = 511;
    406     }
    407   s.GetBytes(buf, lc);
    408   buf[lc] ='\0';
    409   dobj->Comment() = buf;
     396s.GetStr(sfr);  // Pour lire les "------- "
     397if (sfr[0] != '-') {  // Il y a un champ commentaire a lire
     398  s.GetStr(sfr);
     399  dobj->Comment() = sfr;
    410400  }
    411401
    412402string key="";
    413403while(ok) {
    414   s.GetLine(buf, 511);
     404  s.GetStr(sfr);
     405  strncpy(buf, sfr.c_str(), 512);
    415406  buf[511] = '\0';
    416407  if (strncmp(buf,"ZZZZZ",5) == 0)  { ok=false; break; }
  • trunk/SophyaLib/BaseTools/machdefs.h

    r682 r802  
    264264#if defined(__KCC__)
    265265/* KCC V 3.2 ne compile pas  i/ostream s ; long p = s.tellg();  OK en  V 3.3 */
    266 #define STREAMPOS_IS_CLASS
    267266#define HAS_STR_NPOS
    268267#ifndef ANSI_TEMPLATES
  • trunk/SophyaLib/BaseTools/ndatablock.cc

    r773 r802  
    99#include "pexceptions.h"
    1010#include "ndatablock.h"
    11 #include "objfio.h"
    1211
    1312// define DEBUG_NDATABLOCK
     
    613612}
    614613
    615 ////////////////////////////////////////////////////////////////
    616 // -------------------------------------------------------------------------
    617 //   Les objets delegues pour la gestion de persistance
    618 // -------------------------------------------------------------------------
    619 
    620 /*
    621 template <class T>
    622 void ObjFileIO< NDataBlock<T> >::ReadSelf(PInPersist& is)
    623 template <class T>
    624 void ObjFileIO< NDataBlock<T> >::WriteSelf(POutPersist& os)
    625 */
    626 
    627 // Pour pouvoir ecrire des tableaux de complex, en attendant
    628 // PIn/POutPersist::Get/Put(complex<>)
    629 #include "piocmplx.h"
    630 
    631 template <class T>
    632 FIO_NDataBlock<T>::FIO_NDataBlock()
    633 {
    634 dobj=new NDataBlock<T>;
    635 ownobj=true;
    636 }
    637 
    638 template <class T>
    639 FIO_NDataBlock<T>::FIO_NDataBlock(string const & filename)
    640 {
    641 dobj=new NDataBlock<T>;
    642 ownobj=true;
    643 Read(filename);
    644 }
    645 
    646 template <class T>
    647 FIO_NDataBlock<T>::FIO_NDataBlock(const NDataBlock<T> & obj)
    648 {
    649 dobj = new NDataBlock<T>(obj);
    650 ownobj=true;
    651 }
    652 
    653 template <class T>
    654 FIO_NDataBlock<T>::FIO_NDataBlock(NDataBlock<T> * obj)
    655 {
    656 dobj = obj;
    657 ownobj=false;
    658 }
    659 
    660 template <class T>
    661 FIO_NDataBlock<T>::~FIO_NDataBlock()
    662 {
    663 if (ownobj && dobj) delete dobj;
    664 }
    665 
    666 template <class T>
    667 AnyDataObj* FIO_NDataBlock<T>::DataObj()
    668 {
    669 return(dobj);
    670 }
    671 
    672 template <class T>
    673 void FIO_NDataBlock<T>::SetDataObj(AnyDataObj & o)
    674 {
    675 NDataBlock<T> * po = dynamic_cast< NDataBlock<T> * >(&o);
    676 if (po == NULL) return;
    677 if (ownobj && dobj) delete dobj;
    678 dobj = po; ownobj = false;
    679 }
    680 
    681 template <class T>
    682 void FIO_NDataBlock<T>::ReadSelf(PInPersist& is)
    683 {
    684 // On lit les 3 premiers uint_8
    685 uint_8 itab[3];
    686 is.Get(itab, 3);
    687 if (dobj == NULL) dobj = new NDataBlock<T>(itab[1]);
    688 else if (itab[1] != dobj->Size()) dobj->ReSize(itab[1]);
    689 // On lit le tableau de nombres
    690 PIOSReadArray(is, dobj->Data(), dobj->Size());
    691 }
    692 
    693 
    694 template <class T>
    695 void FIO_NDataBlock<T>::WriteSelf(POutPersist& os) const
    696 {
    697 if (dobj == NULL)   return;  // Attention - $CHECK$ Reza 26/04/99
    698 //  On ecrit 3 uint_8
    699 //  0 : Numero de version,  1 : Taille,  2  reserve a l
    700 uint_8 itab[3];
    701 itab[0] = 1;
    702 itab[1] = dobj->Size();
    703 itab[2] = 0;
    704 os.Put(itab, 3);
    705 //  On ecrit le tableau de nombres
    706 PIOSWriteArray(os, dobj->Data(), dobj->Size());
    707 }
    708614
    709615///////////////////////////////////////////////////////////////
     
    718624#pragma define_template NDataBlock<r_4>
    719625#pragma define_template NDataBlock<r_8>
    720 #pragma define_template NDataBlock< complex<float> >
    721 #pragma define_template NDataBlock< complex<double> >
    722 // Instances des delegues FileIO (PPersist)
    723 #pragma define_template FIO_NDataBlock<uint_1>
    724 #pragma define_template FIO_NDataBlock<uint_2>
    725 #pragma define_template FIO_NDataBlock<int_2>
    726 #pragma define_template FIO_NDataBlock<int_4>
    727 #pragma define_template FIO_NDataBlock<int_8>
    728 #pragma define_template FIO_NDataBlock<uint_4>
    729 #pragma define_template FIO_NDataBlock<uint_8>
    730 #pragma define_template FIO_NDataBlock<r_8>
    731 #pragma define_template FIO_NDataBlock<r_4>
    732 #pragma define_template FIO_NDataBlock< complex<float> >
    733 #pragma define_template FIO_NDataBlock< complex<double> >
     626#pragma define_template NDataBlock< complex<r_4> >
     627#pragma define_template NDataBlock< complex<r_8> >
    734628#endif
    735629
     
    744638template class NDataBlock<r_4>;
    745639template class NDataBlock<r_8>;
    746 template class NDataBlock< complex<float> >;
    747 template class NDataBlock< complex<double> >;
    748 // Instances des delegues FileIO (PPersist)
    749 template class FIO_NDataBlock<uint_1>;
    750 template class FIO_NDataBlock<uint_2>;
    751 template class FIO_NDataBlock<int_2>;
    752 template class FIO_NDataBlock<int_4>;
    753 template class FIO_NDataBlock<int_8>;
    754 template class FIO_NDataBlock<uint_4>;
    755 template class FIO_NDataBlock<uint_8>;
    756 template class FIO_NDataBlock<r_8>;
    757 template class FIO_NDataBlock<r_4>;
    758 template class FIO_NDataBlock< complex<float> >;
    759 template class FIO_NDataBlock< complex<double> >;
    760 #endif
     640template class NDataBlock< complex<r_4> >;
     641template class NDataBlock< complex<r_8> >;
     642#endif
  • trunk/SophyaLib/BaseTools/ndatablock.h

    r773 r802  
    88#include "machdefs.h"
    99#include "anydataobj.h"
    10 #include "ppersist.h"
    1110#include <iostream.h>
    1211
     
    160159
    161160
    162 // Classe pour la gestion de persistance
    163 template <class T>
    164 class FIO_NDataBlock : public  PPersist  {
    165 public:
    166   FIO_NDataBlock();
    167   FIO_NDataBlock(string const & filename);
    168   FIO_NDataBlock(const NDataBlock<T> & obj);
    169   FIO_NDataBlock(NDataBlock<T> * obj);
    170   virtual ~FIO_NDataBlock();
    171   virtual AnyDataObj* DataObj();
    172   virtual void        SetDataObj(AnyDataObj & o);
    173   inline operator NDataBlock<T>() { return(*dobj); }
    174 protected :
    175   virtual void       ReadSelf(PInPersist&);           
    176   virtual void       WriteSelf(POutPersist&) const; 
    177   NDataBlock<T> * dobj;
    178   bool ownobj;
    179 };
    180 
    181 template <class T>
    182 inline POutPersist& operator << (POutPersist& os, NDataBlock<T> & obj)
    183 { FIO_NDataBlock<T> fio(&obj);  fio.Write(os);  return(os); }
    184 template <class T>
    185 inline PInPersist& operator >> (PInPersist& is, NDataBlock<T> & obj)
    186 { FIO_NDataBlock<T> fio(&obj);  fio.Read(is);  return(is); }
    187161
    188162} // Fin du namespace
  • trunk/SophyaLib/BaseTools/ppersist.cc

    r754 r802  
    55#include "pexceptions.h"
    66#include "ppersist.h"
     7#include "anydataobj.h"
    78#include <fstream.h>
    89#include <iostream.h>
     
    1314#include "unixmac.h"
    1415#include <SIOUX.h>
     16#endif
     17
     18//  strptime n'est pas defini sous Linux  - Reza Mars 2000
     19#if defined(OS_LINUX)
     20extern "C" {
     21char *strptime(char *buf, const char *format, const struct tm *tm);
     22}
    1523#endif
    1624
     
    3543
    3644MD5_CONTEXT PIOPersist::ctx;
    37 PIOPersist::ClassList * PIOPersist::classList = NULL;   // $CHECK$ Reza 26/04/99
    38 map<string, uint_8> * PIOPersist::typeids = NULL;
     45PIOPersist::ClassList * PIOPersist::ppclassList = NULL;   // $CHECK$ Reza 26/04/99
     46map<string, uint_8> * PIOPersist::ppclassNameList = NULL;
     47map<string, uint_8> * PIOPersist::dobjclassNameList = NULL;
    3948
    4049//++
     
    4453//--
    4554{
    46 classList = new PIOPersist::ClassList;
    47 typeids = new map<string, uint_8>;
    48 }
    49 
    50 //++
    51 void
    52 PIOPersist::RegisterClass(uint_8 classId, string typname, ClassCreatorFunc f)
     55ppclassList = new PIOPersist::ClassList;
     56ppclassNameList = new map<string, uint_8>;
     57dobjclassNameList = new map<string, uint_8>;
     58}
     59
     60//++
     61void
     62PIOPersist::RegisterPPHandlerClass(uint_8 classId, string ppclass_name, ClassCreatorFunc f)
    5363//
    54 //      Register a new persistant class.
    55 //      The classId is usually a hash of the class name, and this
    56 //      method is called only through the PPersistRegistrar template
    57 //      class, with the PPRegister(className) macro.
     64//      Register a new persistence handler (PPersist) class.
     65//      The classId is usually a hash of the class name, and
     66//      ppclass_name is typeid(PPersistClass).name() .
     67//      This method is called only through the PPersistRegistrar template
    5868//
    5969//--
    6070{
    61   if (classList->size() && (classList->find(classId) != classList->end())) {
    62       cerr << "RegisterClass : Error, " << hex << classId << dec
    63            << " already registered." << endl;
    64       throw(DuplicateIdExc("PIOPersist::RegisterClass"));
     71  if (ppclassList->size() && (ppclassList->find(classId) != ppclassList->end()) ) {
     72    cerr << "RegisterClass : Error, " << hex << classId << dec
     73         << " already registered." << endl;
     74    throw(DuplicateIdExc("PIOPersist::RegisterPPHandlerClass"));
     75  }
     76  if (ppclassNameList->size() && (ppclassNameList->find(ppclass_name) != ppclassNameList->end())) {
     77    cerr << "RegisterClass : Error (2) " <<  ppclass_name
     78         << " already registered." << endl;
     79      throw(DuplicateIdExc("PIOPersist::RegisterPPHandlerClass (3)"));
    6580    }
    6681 
    67   (*classList)[classId] = f;
    68   (*typeids)[typname]  = classId;
    69 }
    70 
     82  (*ppclassList)[classId] = f;
     83  (*ppclassNameList)[ppclass_name]  = classId;
     84}
     85
     86//++
     87void
     88PIOPersist::RegisterDataObjClass(uint_8 classId, string class_name)
     89//      Register a new DataObj class corresponding to a PPersist classId
     90//      class_typename should be typeid(DataObject).name()
     91//--
     92{
     93  if (ppclassList->find(classId) == ppclassList->end() )
     94    throw( NotFoundExc("PIOPersist::RegisterDataObjClass() Not found classId") );
     95  if (dobjclassNameList->size() && (dobjclassNameList->find(class_name) != dobjclassNameList->end()))
     96      throw(DuplicateIdExc("PIOPersist::RegisterDataObjClass"));
     97
     98  (*dobjclassNameList)[class_name]  = classId;
     99}
     100
     101//      class_typename should be typeid(DataObject).name(), to be
     102//      used by POutPersist::PutDataObject() methods.
    71103
    72104PIOPersist::ClassCreatorFunc
    73105PIOPersist::FindCreatorFunc(uint_8 classId)
    74 {
    75   ClassList::iterator i = classList->find(classId);
    76   if (i == classList->end()) throw(NotFoundExc("PIOPersist::FindCreatorFunc"));
     106// Returns the PPersist class creator function for the specified classId
     107{
     108  ClassList::iterator i = ppclassList->find(classId);
     109  if (i == ppclassList->end()) throw(NotFoundExc("PIOPersist::FindCreatorFunc() Not found classId"));
    77110  return (*i).second;
     111}
     112
     113string
     114PIOPersist::getPPClassName(uint_8 classId)
     115// Returns the PPersist class name for the specified classId
     116{
     117  map<string, uint_8>::iterator i;
     118  for (i= ppclassNameList->begin(); i != ppclassNameList->end(); i++)
     119    if ( (*i).second == classId ) return (*i).first;
     120
     121  throw(NotFoundExc("PIOPersist::getPPClassName() Not found classId"));
     122}
     123
     124uint_8
     125PIOPersist::getPPClassId(string const & typ_name)
     126// Returns the classId for the specified PPersist class type name
     127{
     128  map<string, uint_8>::iterator i = ppclassNameList->find(typ_name);
     129  if (i == ppclassNameList->end())
     130    throw(NotFoundExc("PIOPersist::getPPClassId() Not found className"));
     131  return (*i).second;
     132}
     133
     134uint_8
     135PIOPersist::getPPClassId(PPersist const & ppo)
     136// Returns the classId for the specified PPersist class
     137{
     138  string typ_name = typeid(ppo).name() ;
     139  return (getPPClassId(typ_name) );
     140}
     141
     142
     143string
     144PIOPersist::getDataObjClassName(uint_8 classId)
     145// Returns the PPersist class name for the specified classId
     146{
     147  map<string, uint_8>::iterator i;
     148  for (i= dobjclassNameList->begin(); i != dobjclassNameList->end(); i++)
     149    if ( (*i).second == classId ) return (*i).first;
     150
     151  throw(NotFoundExc("PIOPersist::getDataObjClassName() Not found classId"));
     152}
     153
     154uint_8
     155PIOPersist::getDataObjClassId(string const & typ_name)
     156// Returns the classId for the specified PPersist class type name
     157{
     158  map<string, uint_8>::iterator i = dobjclassNameList->find(typ_name);
     159  if (i == dobjclassNameList->end())
     160    throw(NotFoundExc("PIOPersist::getDataObjClassId() Not found className"));
     161  return (*i).second;
     162}
     163
     164uint_8
     165PIOPersist::getDataObjClassId(AnyDataObj const & o)
     166// Returns the classId for the specified PPersist class
     167{
     168  string typ_name = typeid(o).name() ;
     169  return (getDataObjClassId(typ_name) );
    78170}
    79171
     
    140232//--
    141233{
    142    s.PutObject(this);
     234   s.PutPPObject(this);
    143235}
    144236
     
    156248  // We should be the exact type 
    157249  // Check tag value
    158   char ppstype;
     250  unsigned char ppstype,ppstag;
    159251  s.GetTypeTag(ppstype);
    160   if (ppstype != PInPersist::PPS_OBJECT) {
    161     throw FileFormatExc("PPersist::Read : not an object in flow");
    162   }
    163  
    164   // Check class id
    165   uint_8 classId;
    166   s.GetRawU8(classId);
    167   uint_8 myClassId = PIOPersist::getTypeId(typeid(*this).name());
    168   if (classId != myClassId) {
    169     throw FileFormatExc("PPersist::Read : not the same object type");
    170   }
    171 
    172   ReadSelf(s);
     252  if ( (ppstype != PInPersist::PPS_OBJECT) && ( ppstype != PInPersist::PPS_REFERENCE ) ) {
     253  }
     254  if (ppstype == PInPersist::PPS_OBJECT) {
     255    // Check class id
     256    uint_8 classId;
     257    s.GetRawU8(classId);
     258    uint_8 oid,oid2;
     259    s.GetRawU8(oid);
     260    if (classId != PIOPersist::getPPClassId(*this) )
     261      throw FileFormatExc("PPersist::Read (): not the same object type"); 
     262    ReadSelf(s);
     263    // Read the ENDOBJECT
     264    s.GetRawUByte(ppstag);
     265    if (ppstag != PInPersist::PPS_ENDOBJECT)
     266      throw FileFormatExc("PPersist::Read() No PPS_ENDOBJECT tag");
     267    s.GetRawU8(oid2);
     268    if (oid2 != oid)
     269      throw FileFormatExc("PPersist::Read() Inconsistent PPS-OId at PPS_ENDOBJECT ");
     270    s.KeepOId(oid, *this);   // Object should be kept with its PPS_OId  (if oid > 0)
     271  }
     272  else if ( ppstype == PInPersist::PPS_REFERENCE )
     273    s.ReadReference(*this);
     274
     275  else  throw FileFormatExc("PPersist::Read() : not an object in flow");
     276
    173277}
    174278
     
    181285{
    182286  s.WriteTag(tag);
    183   s.PutObject(this);
     287  s.PutPPObject(this);
    184288}
    185289
     
    196300}
    197301
     302// Renvoie l'identificateur de l'objet  - par defaut=0
     303
     304uint_8
     305PPersist::getMemOId() const
     306{
     307  return(0);
     308}
     309
     310// Ces deux methodes doivent etre redefinies si   getMemOId() renvoie non nul (>0)
     311// ShareDataReference() et CloneSharedReference()
     312void
     313PPersist::ShareDataReference(PPersist & pcs)
     314{
     315  throw NotAvailableOperation("PPersist::ShareDataReference() - Unsupported operation !");
     316}
     317
     318PPersist *
     319PPersist::CloneSharedReference()
     320{
     321  throw NotAvailableOperation("PPersist::CloneSharedReference() - Unsupported operation !");
     322}
    198323
    199324//++
     
    233358    throw FileFormatExc("PInPersist::PInPersist  bad header");
    234359  }
    235   version = atoi(rbuf+24);
    236 
     360  rbuf[32] = '\0';
     361  version = atoi(rbuf+25);
     362  if (version < 2) {
     363    cerr << "PInPersist::PInPersist(" << flnm << ") Version(=" << version
     364         << ") < 2 not supported !" << endl;
     365    throw FileFormatExc("PInPersist::PInPersist() - Unsupported (Old) Version");
     366  }
    237367  // read endianness
    238368  GetRawBytes(rbuf, 32);
     
    249379  rbuf[32] = '\0';
    250380  struct tm tm;
    251   #ifndef __MWERKS__
     381  #ifndef __MWERKS__ 
    252382  strptime(rbuf,"%d/%m/%Y %H:%M:%S GMT",&tm);
    253383  #else
     
    258388  #endif
    259389  creationdate = mktime(&tm);
    260 
     390  filename = flnm;  // keep the filename
     391  seqread = true;   // To flag non sequential reads
    261392  if (scan) Scan();
    262393}
     
    266397PInPersist::~PInPersist()
    267398{
     399  ObjList::iterator i;
     400  for(i=objList.begin(); i!= objList.end(); i++) 
     401    if ((*i).second)  delete (*i).second;
    268402  delete s;
    269403}
    270404
    271405
     406string
     407PInPersist::CreationDateStr()
     408{
     409  time_t cdt = CreationDate();
     410  string cdate = ctime(&cdt);
     411  return(cdate);
     412}
     413
    272414void
    273415PInPersist::Scan()
     
    275417  // On cherche la liste des tags, a la fin du fichier
    276418
    277   char ppstype;
     419  unsigned char ppstype;
    278420  size_t debut;
    279421#ifdef STREAMPOS_IS_CLASS
     
    333475      //    throw NotFoundExc("PInPersist::GotoTag   tag not found");
    334476  s->seekg((*i).second);
    335   objList.clear(); // $CHECK$ EA 171199
     477  seqread = false;
     478  //  objList.clear(); $CHECK$ EA 171199 Ne pas faire ? Reza 03/2000 ?
    336479  return(true);
    337480}
     
    344487  for (int j=0; j<itag; j++) i++;
    345488  s->seekg((*i).second);
    346   objList.clear(); // $CHECK$ EA 171199
     489  // objList.clear();  $CHECK$ EA 171199  Ne pas faire ? Reza 03/2000 ?
    347490  return(true);
    348491}
     
    355498  for (int j=0; j<itag; j++) i++;
    356499  return((*i).first);
     500}
     501
     502string
     503PInPersist::GetTagClassName(int itag)
     504{
     505  // A faire
     506//   if (itag<0 || itag >= (int)tags.size()) return "";
     507//   map<string, int_8>::iterator i = tags.begin();
     508//   for (int j=0; j<itag; j++) i++;
     509//   uint_8 cid = (*i).second;
     510//   return(GetClassName(cid));
     511  return("");
    357512}
    358513
     
    424579
    425580void
    426 PInPersist::GetTypeTag(char& c)
    427 {
    428   GetRawByte(c);
    429   while (c == PPS_TAG_MARK) {
    430     objList.clear();
    431     GetRawByte(c);
    432   }
     581PInPersist::GetTypeTag(unsigned char& c)
     582{
     583  c = PPS_TAG_MARK;
     584  while (c == PPS_TAG_MARK) GetRawUByte(c);
     585  //  while (c == PPS_TAG_MARK) {    Il ne faut plus faire ca !
     586  //    objList.clear();             $CHECK$ Reza 03/2000
     587  //    GetRawByte(c);
     588  //  }
    433589}
    434590
     
    441597
    442598void
     599PInPersist::GetRawUByte(unsigned char& c)
     600{
     601  GetRawBytes(&c, 1);
     602}
     603
     604void
    443605PInPersist::GetRawBytes(void* ptr, size_t bytes)
    444606{
     
    479641
    480642void
    481 PInPersist::CheckTag(short datasz)
    482 {
    483   char ppstype;
     643PInPersist::CheckTag(short datasz, short datatype)
     644// datatype = PPS_DATATYPE_CHAR or PPS_DATATYPE_FLOAT or PPS_DATATYPE_INTEGER or PPS_DATATYPE_UNSIGNED
     645{
     646  unsigned char ppstype;
    484647  GetTypeTag(ppstype);
    485   if (ppstype != PPS_SIMPLE + datasz)
     648  if (ppstype != PPS_SIMPLE + datasz + datatype)
    486649    throw FileFormatExc("PInPersist::CheckTag   bad type in ppersist file");
    487650}
    488651
    489652void
    490 PInPersist::CheckArrayTag(short datasz, size_t sz)
    491 {
    492   char ppstype;
     653PInPersist::CheckArrayTag(short datasz, size_t sz, short datatype)
     654// datatype = PPS_DATATYPE_CHAR or PPS_DATATYPE_FLOAT or PPS_DATATYPE_INTEGER or PPS_DATATYPE_UNSIGNED
     655{
     656  unsigned char ppstype;
    493657  GetTypeTag(ppstype);
    494658  size_t filesz;
    495   if (sz <= 0x7fff) {
    496     if (ppstype != PPS_SIMPLE_ARRAY + datasz)
    497       throw FileFormatExc("PInPersist::CheckTag   bad type in ppersist file");
    498     int_2 ff;
    499     GetRawI2(ff); filesz=ff;
    500   } else if (sz <= 0x7fffffff) {
    501     if (ppstype != PPS_SIMPLE_ARRAY4 + datasz)
    502       throw FileFormatExc("PInPersist::CheckTag   bad type in ppersist file");
     659  if (sz <= 0x7fffffff) {
     660    if (ppstype != PPS_SIMPLE_ARRAY4 + datasz + datatype)
     661      throw FileFormatExc("PInPersist::CheckArrayTag   bad type in ppersist file");
    503662    int_4 ff;
    504663    GetRawI4(ff); filesz=ff;
    505664  } else {
    506     if (ppstype != PPS_SIMPLE_ARRAY8 + datasz)
    507       throw FileFormatExc("PInPersist::CheckTag   bad type in ppersist file");
     665    if (ppstype != PPS_SIMPLE_ARRAY8 + datasz + datatype)
     666      throw FileFormatExc("PInPersist::CheckArrayTag   bad type in ppersist file");
    508667    uint_8 ff;
    509668    GetRawU8(ff); filesz=ff;
    510669  }
    511670  if (filesz != sz)
    512     throw FileFormatExc("PInPersist::CheckTag   bad array size in ppersist file");
     671    throw FileFormatExc("PInPersist::CheckArrayTag   bad array size in ppersist file");
    513672}
    514673
     
    516675PInPersist::GetByte(char& c)
    517676{
    518   CheckTag(1);
     677  CheckTag(1,PPS_DATATYPE_CHAR);
    519678  GetRawBytes(&c, 1);
    520679}
    521680
     681
    522682void
    523683PInPersist::GetBytes(void* ptr, size_t bytes)
    524684{
    525   CheckArrayTag(1, bytes);
     685  CheckArrayTag(1, bytes, PPS_DATATYPE_CHAR);
    526686  GetRawBytes(ptr, bytes);
    527687}
     
    529689PInPersist::GetR4   (r_4& result)
    530690{
    531   CheckTag(4);
     691  CheckTag(4,PPS_DATATYPE_FLOAT);
    532692  GetRawBytes(&result, sizeof(r_4));
    533693  if (bigEndian != IS_BIG_ENDIAN)
     
    539699PInPersist::GetR4s  (r_4* tab, size_t n)
    540700{
    541   CheckArrayTag(4,n);
     701  CheckArrayTag(4,n,PPS_DATATYPE_FLOAT);
    542702  GetRawBytes(tab, n*sizeof(r_4));
    543703  if (bigEndian == IS_BIG_ENDIAN) return;
     
    552712PInPersist::GetR8   (r_8& result)
    553713{
    554   CheckTag(8);
     714  CheckTag(8,PPS_DATATYPE_FLOAT);
    555715  GetRawBytes(&result, sizeof(r_8));
    556716  if (bigEndian != IS_BIG_ENDIAN)
     
    561721PInPersist::GetR8s  (r_8* tab, size_t n)
    562722{
    563   CheckArrayTag(8,n);
     723  CheckArrayTag(8,n,PPS_DATATYPE_FLOAT);
    564724  GetRawBytes(tab, n*sizeof(r_8));
    565725  if (bigEndian == IS_BIG_ENDIAN) return;
     
    574734PInPersist::GetI2   (int_2& result)
    575735{
    576   CheckTag(2);
     736  CheckTag(2,PPS_DATATYPE_INTEGER);
    577737  GetRawBytes(&result, sizeof(int_2));
    578738  if (bigEndian != IS_BIG_ENDIAN)
     
    583743PInPersist::GetI2s  (int_2* tab, size_t n)
    584744{
    585   CheckArrayTag(2,n);
     745  CheckArrayTag(2,n,PPS_DATATYPE_INTEGER);
    586746  GetRawBytes(tab, n*sizeof(int_2));
    587747  if (bigEndian == IS_BIG_ENDIAN) return;
     
    596756PInPersist::GetU2   (uint_2& result)
    597757{
    598   CheckTag(2);
     758  CheckTag(2,PPS_DATATYPE_UNSIGNED);
    599759  GetRawBytes(&result, sizeof(uint_2));
    600760  if (bigEndian != IS_BIG_ENDIAN)
     
    605765PInPersist::GetU2s  (uint_2* tab, size_t n)
    606766{
    607   CheckArrayTag(2,n);
     767  CheckArrayTag(2,n,PPS_DATATYPE_UNSIGNED);
    608768  GetRawBytes(tab, n*sizeof(uint_2));
    609769  if (bigEndian == IS_BIG_ENDIAN) return;
     
    618778PInPersist::GetI4   (int_4& result)
    619779{
    620   CheckTag(4);
     780  CheckTag(4,PPS_DATATYPE_INTEGER);
    621781  GetRawBytes(&result, sizeof(int_4));
    622782  if (bigEndian != IS_BIG_ENDIAN)
     
    627787PInPersist::GetI4s  (int_4* tab, size_t n)
    628788{
    629   CheckArrayTag(4,n);
     789  CheckArrayTag(4,n,PPS_DATATYPE_INTEGER);
    630790  GetRawBytes(tab, n*sizeof(int_4));
    631791  if (bigEndian == IS_BIG_ENDIAN) return;
     
    640800PInPersist::GetU4   (uint_4& result)
    641801{
    642   CheckTag(4);
     802  CheckTag(4,PPS_DATATYPE_UNSIGNED);
    643803  GetRawBytes(&result, sizeof(uint_4));
    644804  if (bigEndian != IS_BIG_ENDIAN)
     
    649809PInPersist::GetU4s  (uint_4* tab, size_t n)
    650810{
    651   CheckArrayTag(4,n);
     811  CheckArrayTag(4,n,PPS_DATATYPE_UNSIGNED);
    652812  GetRawBytes(tab, n*sizeof(uint_4));
    653813  if (bigEndian == IS_BIG_ENDIAN) return;
     
    663823PInPersist::GetI8   (int_8& result)
    664824{
    665   CheckTag(8);
     825  CheckTag(8,PPS_DATATYPE_INTEGER);
    666826  GetRawBytes(&result, sizeof(int_8));
    667827  if (bigEndian != IS_BIG_ENDIAN)
     
    672832PInPersist::GetI8s  (int_8* tab, size_t n)
    673833{
    674   CheckArrayTag(8,n);
     834  CheckArrayTag(8,n,PPS_DATATYPE_INTEGER);
    675835  GetRawBytes(tab, n*sizeof(int_8));
    676836  if (bigEndian == IS_BIG_ENDIAN) return;
     
    685845PInPersist::GetU8   (uint_8& result)
    686846{
    687   CheckTag(8);
     847  CheckTag(8,PPS_DATATYPE_UNSIGNED);
    688848  GetRawBytes(&result, sizeof(uint_8));
    689849  if (bigEndian != IS_BIG_ENDIAN)
     
    694854PInPersist::GetU8s  (uint_8* tab, size_t n)
    695855{
    696   CheckArrayTag(8,n);
     856  CheckArrayTag(8,n,PPS_DATATYPE_UNSIGNED);
    697857  GetRawBytes(tab, n*sizeof(uint_8));
    698858  if (bigEndian == IS_BIG_ENDIAN) return;
     
    708868PInPersist::GetLine(char* ptr, size_t len)
    709869{
    710   char ppstype;
    711   GetTypeTag(ppstype);
    712   if (ppstype != PPS_LINE)
    713     throw FileFormatExc("PInPersist::GetLine   bad type in ppersist file");
    714   s->getline(ptr, len, '\n');
     870  string str;
     871  GetStr(str);
     872  strncpy(ptr, str.c_str(), len);
     873  ptr[len] = '\0';
    715874}
    716875
     
    718877PInPersist::GetStr(string& str)
    719878{
    720   char ppstype;
     879  unsigned char ppstype;
    721880  GetTypeTag(ppstype);
    722881  if (ppstype != PPS_STRING)
    723     throw FileFormatExc("PInPersist::GetLine   bad type in ppersist file");
    724   int_2 len;
    725   GetRawI2(len);
     882    throw FileFormatExc("PInPersist::GetStr   bad type in ppersist file");
     883  int_4 len;
     884  GetRawI4(len);
    726885  char * buff = new char[len+1];
    727886  GetRawBytes(buff, len);
     
    731890}
    732891
     892
    733893PPersist*
    734894PInPersist::ReadObject()
    735895{
     896  return(GetPPObject());
     897}
     898
     899void
     900PInPersist::GetObject(AnyDataObj & o)
     901{
     902  GetPPObject(&o);
     903  return;
     904}
     905
     906void
     907PInPersist::GetObject(AnyDataObj & o, string tagname)
     908{
     909  GotoTag(tagname);
     910  GetPPObject(&o);
     911  return;
     912}
     913
     914PPersist*
     915PInPersist::GetPPObject(AnyDataObj * po)
     916{
    736917  // Get tag
    737   char ppstype;
     918  unsigned char ppstype;
    738919  GetTypeTag(ppstype);
    739920  if (ppstype != PPS_OBJECT && ppstype != PPS_REFERENCE && ppstype != PPS_NULL) {
     
    747928    uint_8 classId;
    748929    GetRawU8(classId);
     930    uint_8 oid,oid2;
     931    GetRawU8(oid);
    749932   
    750933    // Get factory method
     
    756939    // Create object
    757940    PPersist* object = f();
     941    //  If a DataObject was specified , we assign it to the PPersistObject
     942    if (po != NULL) object->SetDataObj(*po);
     943
    758944    object->ReadSelf(*this);
    759     assignObjectId(object);
     945    unsigned char ppstag;
     946    // Read the ENDOBJECT
     947    GetRawUByte(ppstag);
     948    if (ppstag != PPS_ENDOBJECT)
     949      throw FileFormatExc("PInPersist::ReadObject No PPS_ENDOBJECT tag");
     950    GetRawU8(oid2);
     951    if (oid2 != oid)
     952      throw FileFormatExc("PInPersist::ReadObject Inconsistent PPS-OId at PPS_ENDOBJECT ");
     953
     954    KeepOId(oid, *object);
    760955    return object;
    761   } else {
    762     // Get object id
    763     int_4 id;
    764     GetRawI4(id);
    765     if (id <0 || id>=objList.size()) {
    766       char msg[200];
    767       sprintf(msg, "PInPersist::ReadObject    invalid object id for reference: %d/%d",id,objList.size());
    768       throw FileFormatExc(msg);
     956  }
     957  else if (ppstype == PPS_REFERENCE)
     958    return ReadReference();
     959
     960  else throw FileFormatExc("PInPersist::ReadObject invalide Tag Type !"); 
     961}
     962
     963
     964void
     965PInPersist::AnalyseTags(int lev)
     966{
     967  unsigned char ppstag=0;
     968  unsigned char ppst1,ppst2,ppst3;
     969  uint_8 cpos,fsize;
     970  uint_8 ui8,cid,oid;
     971  int_4 i4;
     972  int_8 i8;
     973  char * buff;
     974  string str;
     975 
     976  cout << "\n ---------------------------------------------------------- " << endl;
     977  cout << " PInPersist::AnalyseTags(Level= " << lev << ")" << endl;
     978
     979
     980#ifdef STREAMPOS_IS_CLASS
     981  cpos = s->tellg().offset();
     982#else
     983  cpos = s->tellg();
     984#endif
     985  s->seekg(0,ios::end);
     986#ifdef STREAMPOS_IS_CLASS
     987  fsize = s->tellg().offset();
     988#else
     989  fsize = s->tellg();
     990#endif
     991  s->seekg(cpos,ios::beg);
     992
     993  cout << "   Version= " << Version() << " FileSize= " << fsize
     994       << " Creation Date= " << CreationDateStr() <<  endl;
     995 
     996  uint_8 totntags = 0;
     997  bool eofok = false;
     998
     999  while ( (ppstag != PPS_EOF) &&  (cpos < fsize) ) {
     1000#ifdef STREAMPOS_IS_CLASS
     1001  cpos = s->tellg().offset();
     1002#else
     1003  cpos = s->tellg();
     1004#endif
     1005    GetRawUByte(ppstag);
     1006    totntags++;
     1007
     1008    ppst1 = ppstag&0x0f;  // bits 0123
     1009    ppst2 = ppstag&0x30;  // bits     45
     1010    ppst3 = ppstag&0xc0;  // bits       67
     1011    if ((ppst2 == 0) && (ppst3 == 0) ) {
     1012      switch (ppst1) {
     1013
     1014      case PPS_NULL :
     1015        if (lev > 1)  cout << "<PPS_NULL> tag at position " << hex << cpos << dec << endl;
     1016        break;
     1017
     1018      case PPS_STRING :
     1019        GetRawI4(i4);
     1020        if (lev > 1)  cout << "<PPS_STRING> tag at position " << hex << cpos << dec
     1021                           << " Length=" << i4 << endl;
     1022        s->seekg(i4,ios::cur);
     1023        break;
     1024
     1025      case PPS_OBJECT :
     1026        GetRawU8(cid);
     1027        GetRawU8(oid);
     1028        cout << "<PPS_OBJECT> tag at position " << hex << cpos << " ClassId= " << cid
     1029             << "  ObjectId= " << oid << dec << endl;
     1030        break;
     1031
     1032      case PPS_REFERENCE :
     1033        GetRawU8(oid);
     1034        GetRawI8(i8);
     1035        cout << "<PPS_REFERENCE> tag at position " << hex << cpos << "  ObjectId= "
     1036             << oid << "  OrigPos=" << i8 << dec << endl;
     1037        break;
     1038
     1039      case PPS_TAG_MARK :
     1040        cout << "<PPS_TAG_MARK> tag at position " << hex << cpos << dec << endl;
     1041        break;
     1042     
     1043      case PPS_ENDOBJECT :
     1044        GetRawU8(oid);
     1045        cout << "<PPS_ENDOBJECT> tag at position " << hex << cpos << "  ObjectId= "
     1046             << oid << dec << endl;
     1047        break;
     1048
     1049      case PPS_TAG :
     1050        GetRawI8(i8);
     1051        GetRawI4(i4);
     1052        buff = new char[i4+1];
     1053        GetRawBytes(buff, i4);
     1054        buff[i4] = '\0';  str = buff;
     1055        delete[] buff;
     1056        cout << "<PPS_TAG> tag at position " << hex << cpos << dec
     1057             << " Name= " << str << endl;
     1058        break;
     1059
     1060      case PPS_EOF :
     1061        GetRawI8(i8);   
     1062        cout << "<PPS_EOF> tag at position " << hex << cpos 
     1063             << " TagPos=" << i8 << dec << endl;
     1064        eofok = true;
     1065        break;
     1066
     1067      default :
     1068        cerr << " ERROR : Unexpected tag value " << hex << ppstag
     1069             << " At position" << cpos << dec << endl;
     1070        throw FileFormatExc("PInPersist::AnalyseTags() - Unexpected tag value !");
     1071      }
    7691072    }
    770     return objList[id];
    771   }
    772 }
    773 
    774 int_4
    775 PInPersist::assignObjectId(PPersist* x)
    776 {
    777   objList.push_back(x);
    778   return objList.size()-1;
     1073    else {
     1074      string dtype = "???? x";
     1075      if (ppst3 == PPS_DATATYPE_CHAR) dtype = "CHAR x";
     1076      else if (ppst3 == PPS_DATATYPE_FLOAT) dtype = "FLOAT x";
     1077      else if (ppst3 == PPS_DATATYPE_INTEGER) dtype = "INTEGER x";
     1078      else if (ppst3 == PPS_DATATYPE_UNSIGNED) dtype = "UNSIGNED x";
     1079      int_4 dsize = ppst1;
     1080      char sb[16];
     1081      sprintf(sb, "%d", dsize);
     1082      dtype += sb;
     1083
     1084      switch (ppst2) {
     1085
     1086      case PPS_SIMPLE :
     1087        if (lev > 2)  cout << "<PPS_SIMPLE> tag at position " << hex << cpos << dec
     1088                           << " DataType=" << dtype << endl;
     1089        s->seekg(dsize, ios::cur);
     1090        break;
     1091
     1092      case PPS_SIMPLE_ARRAY4 :
     1093        GetRawI4(i4);
     1094        if (lev > 0)  cout << "<PPS_SIMPLE_ARRAY4> tag at position " << hex << cpos << dec
     1095                           << " DataType=" << dtype << " NElts= " << i4 << endl;
     1096        s->seekg((uint_8)dsize*(uint_8)i4, ios::cur);
     1097        break;
     1098
     1099      case PPS_SIMPLE_ARRAY8 :
     1100        GetRawU8(ui8);
     1101        if (lev > 0)  cout << "<PPS_SIMPLE_ARRAY8> tag at position " << hex << cpos << dec
     1102                           << " DataType=" << dtype << " NElts= " << ui8 << endl;
     1103        s->seekg((uint_8)dsize*ui8, ios::cur);
     1104        break;
     1105      }
     1106    }
     1107  }
     1108  if (!eofok)
     1109    throw FileFormatExc("PInPersist::AnalyseTags() - Not found <PPS_EOF> tag ");
     1110
     1111  cout << " PInPersist::AnalyseTags() - End - Total Number of Tags= " << totntags << endl;
     1112  cout << " ---------------------------------------------------------- \n" << endl;
     1113  return;
     1114}
     1115
     1116void
     1117PInPersist::ReadReference(PPersist & ppo)
     1118{
     1119  PPersist * pr = ReadReference();
     1120  ppo.ShareDataReference(*pr);
     1121}
     1122
     1123
     1124PPersist *
     1125PInPersist::ReadReference()
     1126{
     1127  uint_8 oid;
     1128  int_8 pos;
     1129  GetRawU8(oid);
     1130  GetRawI8(pos);
     1131  //  cerr << " DBG - PInPersist::ReadReference-A "  << oid << " Pos= " << pos << endl;
     1132  map<uint_8, PPersist *>::iterator i = objList.find(oid);
     1133  if (i != objList.end()) return (*i).second;
     1134  else  {  // We may have skeeped it !
     1135    // Let's try to read it
     1136    int_8 cpos;
     1137#ifdef STREAMPOS_IS_CLASS
     1138    cpos = s->tellg().offset();
     1139#else
     1140    cpos = s->tellg();
     1141#endif
     1142    s->seekg(pos);
     1143    PPersist* ppo = ReadObject();
     1144    s->seekg(cpos);
     1145    delete ppo;
     1146    //    cerr << " DBG - PInPersist::ReadReference-B ... " << endl; 
     1147
     1148    map<uint_8, PPersist *>::iterator i2 = objList.find(oid);
     1149    if (i2 == objList.end())
     1150      throw FileFormatExc("PInPersist::ReadReference()   Not found PPS_OId ");
     1151    return (*i2).second;
     1152  }
     1153}
     1154
     1155
     1156void
     1157PInPersist::KeepOId(uint_8 oid, PPersist & ppo)
     1158{
     1159  if ((oid&0x1) == 0)  return; // This is not an object which can be referenced
     1160  //  cerr << " DBG - PInPersist::KeepOId() " << oid << endl;
     1161  if ((objList.size() > 0) && (objList.find(oid) != objList.end()) ) {
     1162    //  Ceci ne devrait arriver que si on lit dans le desordre (avec GotoTag)
     1163    //  et pas avec une lecture sequentielle ...   Reza 03/2000
     1164    //  cerr << "PInPersist::KeepOId()/Warning - already present PPS_ObjectId ! " << oid << endl;
     1165    if (seqread) throw FileFormatExc("PInPersist::KeepOId() already present PPS_ObjectId ");
     1166    PPersist *pp = (*objList.find(oid)).second;
     1167    ppo.ShareDataReference(*pp);
     1168  }
     1169  else {
     1170    PPersist * npp = ppo.CloneSharedReference();
     1171    if (npp == NULL) throw PError("PInPersist::KeepOId() NULL returned by PPersist.Clone() ! ");
     1172    objList[oid] = npp;
     1173  }
     1174  return;
    7791175}
    7801176
     
    8031199    bigEndian = endianness;
    8041200
     1201  // PPS (POutPersist stream) Object Id initialisation
     1202  pps_OId = 0;
    8051203  // Output stream creation
    8061204  s = new ofstream(flnm.c_str(),ios::out | IOS_BIN); 
    8071205
    8081206  // Header
    809   PutRawBytes("SOS-SOPHYA-PPersistFile V1               ",32);
     1207  PutRawBytes("SOS-SOPHYA-PPersistFile V2               ",32);
    8101208  PutRawBytes(bigEndian
    8111209           ? "BIG-ENDIAN                             "
     
    8191217  datestring[32] = '\0';
    8201218  PutRawBytes(datestring, 32);
     1219  filename = flnm;
    8211220}
    8221221
     
    8241223{
    8251224  if (tags.size() == 0) {
    826     PutRawByte(PPS_EOF);
     1225    PutRawUByte(PPS_EOF);
    8271226    PutRawI8(-1);
    8281227  } else {
     
    8361235      string name = (*i).first;
    8371236      int_8 pos = (*i).second;
    838       PutRawByte(PPS_TAG);                       // This is a tag
     1237      PutRawUByte(PPS_TAG);                       // This is a tag
    8391238      PutRawI8(pos);                             // position of previous tag
    8401239      PutRawI4(name.length());                   // length of the name
    8411240      PutRawBytes(name.c_str(), name.length());  // name, without final "0".
    8421241    }
    843     PutRawByte(PPS_EOF);
     1242    PutRawUByte(PPS_EOF);
    8441243    PutRawI8(tagPos);
    8451244  }
     
    8681267
    8691268  tags[name] = tagPos;
    870   PutRawByte(PPS_TAG_MARK);                       // This is a tag
    871   objList.clear(); // $CHECK$ EA 171199
     1269  PutRawUByte(PPS_TAG_MARK);                       // This is a tag
     1270  //  objList.clear(); // $CHECK$ EA 171199  - Ne pas faire ? Reza 03/2000
    8721271}
    8731272
     
    9141313
    9151314void
     1315POutPersist::PutRawUByte(unsigned char c)
     1316{
     1317  PutRawBytes(&c, 1);
     1318}
     1319
     1320void
    9161321POutPersist::PutRawI2   (int_2 val)
    9171322{
     
    9501355
    9511356void
    952 POutPersist::PutArrayTag(short datasz, size_t sz)
    953 {
    954   if (sz <= 0x7fff) {
    955     PutRawByte(PPS_SIMPLE_ARRAY + datasz);
    956     PutRawI2(sz);
    957   } else if (sz <= 0x7fffffff) {
    958     PutRawByte(PPS_SIMPLE_ARRAY4 + datasz);
     1357POutPersist::PutArrayTag(short datasz, size_t sz, short datatype)
     1358// datatype = PPS_DATATYPE_CHAR or PPS_DATATYPE_FLOAT or PPS_DATATYPE_INTEGER or PPS_DATATYPE_UNSIGNED
     1359{
     1360  if (sz <= 0x7fffffff) {
     1361    PutRawUByte(PPS_SIMPLE_ARRAY4 + datasz + datatype);
    9591362    PutRawI4(sz);
    9601363  } else {
    961     PutRawByte(PPS_SIMPLE_ARRAY8 + datasz);
     1364    PutRawUByte(PPS_SIMPLE_ARRAY8 + datasz + datatype);
    9621365    PutRawU8(sz);
    9631366  }
     
    9671370POutPersist::PutByte(char c)
    9681371{
    969   PutRawByte(PPS_SIMPLE + 1);
     1372  PutRawByte(PPS_SIMPLE + 1 + PPS_DATATYPE_CHAR);
    9701373  PutRawBytes(&c, 1);
    9711374}
     
    9761379POutPersist::PutBytes(void const* ptr, size_t bytes)
    9771380{
    978   PutArrayTag(1, bytes);
     1381  PutArrayTag(1, bytes, PPS_DATATYPE_CHAR);
    9791382  PutRawBytes(ptr, bytes);
    9801383}
     
    9831386POutPersist::PutR4   (r_4 val)
    9841387{
    985   PutRawByte(PPS_SIMPLE + 4);
     1388  PutRawUByte(PPS_SIMPLE + 4 + PPS_DATATYPE_FLOAT);
    9861389 
    9871390  if (bigEndian != IS_BIG_ENDIAN)
     
    9941397POutPersist::PutR4s  (r_4 const* tab, size_t n)
    9951398{
    996   PutArrayTag(4, n);
     1399  PutArrayTag(4, n, PPS_DATATYPE_FLOAT);
    9971400
    9981401  if (bigEndian == IS_BIG_ENDIAN) {
     
    10101413POutPersist::PutR8   (r_8 val)
    10111414{
    1012   PutRawByte(PPS_SIMPLE + 8);
     1415  PutRawUByte(PPS_SIMPLE + 8 + PPS_DATATYPE_FLOAT);
    10131416
    10141417  if (bigEndian != IS_BIG_ENDIAN)
     
    10211424POutPersist::PutR8s  (r_8 const* tab, size_t n)
    10221425{
    1023   PutArrayTag(8, n);
     1426  PutArrayTag(8, n, PPS_DATATYPE_FLOAT);
    10241427
    10251428  if (bigEndian == IS_BIG_ENDIAN) {
     
    10371440POutPersist::PutI2   (int_2 val)
    10381441{
    1039   PutRawByte(PPS_SIMPLE + 2);
     1442  PutRawUByte(PPS_SIMPLE + 2 + PPS_DATATYPE_INTEGER);
    10401443
    10411444  if (bigEndian != IS_BIG_ENDIAN)
     
    10481451POutPersist::PutI2s  (int_2 const* tab, size_t n)
    10491452{
    1050   PutArrayTag(2, n);
     1453  PutArrayTag(2, n, PPS_DATATYPE_INTEGER);
    10511454 
    10521455  if (bigEndian == IS_BIG_ENDIAN) {
     
    10641467POutPersist::PutU2   (uint_2 val)
    10651468{
    1066   PutRawByte(PPS_SIMPLE + 2);
     1469  PutRawUByte(PPS_SIMPLE + 2 + PPS_DATATYPE_UNSIGNED);
    10671470
    10681471  if (bigEndian != IS_BIG_ENDIAN)
     
    10751478POutPersist::PutU2s  (uint_2 const* tab, size_t n)
    10761479{
    1077   PutArrayTag(2, n);
     1480  PutArrayTag(2, n, PPS_DATATYPE_UNSIGNED);
    10781481
    10791482  if (bigEndian == IS_BIG_ENDIAN) {
     
    10911494POutPersist::PutI4   (int_4 val)
    10921495{
    1093   PutRawByte(PPS_SIMPLE + 4);
     1496  PutRawUByte(PPS_SIMPLE + 4 + PPS_DATATYPE_INTEGER);
    10941497
    10951498  if (bigEndian != IS_BIG_ENDIAN)
     
    11021505POutPersist::PutI4s  (int_4 const* tab, size_t n)
    11031506{
    1104   PutArrayTag(4, n);
     1507  PutArrayTag(4, n, PPS_DATATYPE_INTEGER);
    11051508
    11061509  if (bigEndian == IS_BIG_ENDIAN) {
     
    11181521POutPersist::PutU4   (uint_4 val)
    11191522{
    1120   PutRawByte(PPS_SIMPLE + 4);
     1523  PutRawUByte(PPS_SIMPLE + 4 + PPS_DATATYPE_UNSIGNED);
    11211524
    11221525  if (bigEndian != IS_BIG_ENDIAN)
     
    11291532POutPersist::PutU4s  (uint_4 const* tab, size_t n)
    11301533{
    1131   PutArrayTag(4, n);
     1534  PutArrayTag(4, n, PPS_DATATYPE_UNSIGNED);
    11321535
    11331536  if (bigEndian == IS_BIG_ENDIAN) {
     
    11451548POutPersist::PutI8   (int_8 val)
    11461549{
    1147   PutRawByte(PPS_SIMPLE + 8);
     1550  PutRawUByte(PPS_SIMPLE + 8 + PPS_DATATYPE_INTEGER);
    11481551
    11491552  if (bigEndian != IS_BIG_ENDIAN)
     
    11561559POutPersist::PutI8s  (int_8 const* tab, size_t n)
    11571560{
    1158   PutArrayTag(8, n);
     1561  PutArrayTag(8, n, PPS_DATATYPE_INTEGER);
    11591562
    11601563  if (bigEndian == IS_BIG_ENDIAN) {
     
    11721575POutPersist::PutU8   (uint_8 val)
    11731576{
    1174   PutRawByte(PPS_SIMPLE + 8);
     1577  PutRawUByte(PPS_SIMPLE + 8 + PPS_DATATYPE_UNSIGNED);
    11751578
    11761579  if (bigEndian != IS_BIG_ENDIAN)
     
    11831586POutPersist::PutU8s  (uint_8 const* tab, size_t n)
    11841587{
    1185   PutArrayTag(8, n);
     1588  PutArrayTag(8, n, PPS_DATATYPE_UNSIGNED);
    11861589
    11871590  if (bigEndian == IS_BIG_ENDIAN) {
     
    11991602POutPersist::PutStr(string const& str)
    12001603{
    1201   PutRawByte(PPS_STRING);
    1202   PutRawI2(str.length());
     1604  PutRawUByte(PPS_STRING);
     1605  PutRawI4(str.length());
    12031606  PutRawBytes(str.c_str(), str.length());
    12041607}
     
    12071610POutPersist::PutLine(char const* ptr, size_t len)
    12081611{
    1209   PutRawByte(PPS_LINE);
    1210 
    1211   if (len == 0)  len = strlen(ptr);
    1212   PutRawBytes(ptr, len);
    1213   PutRawByte('\n');
    1214 }
    1215 
    1216 void
    1217 POutPersist::PutObject(PPersist const* obj)
    1218 {
    1219   if (serializeNullAndRepeat(obj)) return;
    1220 
    1221   PutRawByte(PPS_OBJECT);
    1222   PutRawU8(getTypeId(typeid(*obj).name()));
    1223   //PutRawU8(PIOPersist::Hash(typeid(*obj).name()));
    1224   assignObjectId(obj);
     1612  string str = ptr;
     1613  PutStr(str);
     1614}
     1615
     1616
     1617void
     1618POutPersist::PutObject(AnyDataObj & o)
     1619{
     1620  ClassCreatorFunc f = FindCreatorFunc(getDataObjClassId(o));
     1621  if (!f)
     1622      throw NotFoundExc("PInPersist::PutObject()   class not registered");
     1623  PPersist* ppo = f();
     1624  ppo->SetDataObj(o);
     1625  PutPPObject(ppo);
     1626}
     1627
     1628void
     1629POutPersist::PutObject(AnyDataObj & o, string tagname)
     1630{
     1631  WriteTag(tagname);
     1632  PutObject(o);
     1633}
     1634
     1635
     1636void
     1637POutPersist::PutPPObject(PPersist const* obj)
     1638{
     1639  if (serializeNullAndRepeat(obj)) return;  // NULL object or already written in stream
     1640
     1641  //   We have to write the object
     1642  uint_8 oid = assignObjectId(obj);       // We assing a PPS Object Id
     1643  PutRawUByte(PPS_OBJECT);         // We write the Object Tag
     1644  PutRawU8(getPPClassId(*obj));    // Writing the PPersist ClassId
     1645  PutRawU8(oid);                   // Write the PPS Object Id
    12251646  obj->WriteSelf(*this);
     1647  PutRawUByte(PPS_ENDOBJECT);      // We write the End-Of-Object Tag
     1648  PutRawU8(oid);                   // and again its PPS Object Id
    12261649}
    12271650
     
    12301653{
    12311654  if (x == NULL) {
    1232     PutRawByte(PPS_NULL);
     1655    PutRawUByte(PPS_NULL);
    12331656    return true;
    12341657  }
    12351658
    1236   int_4 id = findObjectId(x);
    1237   if (id >= 0) {
    1238     PutRawByte(PPS_REFERENCE);
    1239     PutRawI4(id);
     1659  int_8 pos;
     1660  uint_8 id = findObjectId(x, pos);
     1661  if (id > 0) {
     1662    PutRawUByte(PPS_REFERENCE);
     1663    PutRawU8(id);      // Writing the corresponding object Id
     1664    PutRawI8(pos);     // The original object position
    12401665    return true;
    12411666  }
    12421667 
    1243   return false;
    1244 }
    1245 
    1246 int_4
     1668  return false;  // Object have to be written in stream ...
     1669}
     1670
     1671uint_8
    12471672POutPersist::assignObjectId(PPersist const* x)
    12481673{
    1249   int_4 id = objList.size();
    1250   objList[x] = id;
     1674  pps_OId += 16;  // We keep the three first bytes for future usage
     1675                  // Bit 1 non zero -> Object can be referenced
     1676  uint_8 id = pps_OId;
     1677  uint_8 mid = x->getMemOId();
     1678  if (mid > 0) {
     1679    int_8 pos;
     1680    if (findObjectId(x,pos) > 0) 
     1681      throw PError("POutPersist::assignObjectId() Error - Already serialized object ! ");
     1682    id += 1;  // Object Id starting at zero
     1683    objreftag rt;
     1684    rt.ppsoid = id;
     1685#ifdef STREAMPOS_IS_CLASS
     1686    rt.ppspos = s->tellp().offset();
     1687#else
     1688    rt.ppspos = s->tellp();
     1689#endif
     1690    objList[mid] = rt;
     1691  }
    12511692  return id;
    12521693}
    12531694
    1254 int_4
    1255 POutPersist::findObjectId(PPersist const* x)
    1256 {
    1257   ObjList::iterator i = objList.find(x);
    1258   if (i == objList.end()) return -1;
    1259   return (*i).second;
    1260 }
    1261 
    1262 
     1695uint_8
     1696POutPersist::findObjectId(PPersist const* x, int_8 & pos)
     1697{
     1698  pos = -1;
     1699  uint_8 mid = x->getMemOId();
     1700  if (mid == 0)   return(0);
     1701  ObjList::iterator i = objList.find(mid);
     1702  if (i == objList.end()) return 0;
     1703  pos = (*i).second.ppspos;
     1704  return (*i).second.ppsoid;
     1705}
     1706
     1707
  • trunk/SophyaLib/BaseTools/ppersist.h

    r754 r802  
    77//
    88// E. Aubourg     CEA DAPNIA/SPP  1999
     9// R. Ansari      LAL IN2P3/CNRS  03/2000
    910
    1011
     
    5152
    5253    virtual AnyDataObj* DataObj()=0;       // Retourne l'objet reel
    53     virtual void       SetDataObj(AnyDataObj &)=0;       
    54 
     54    virtual void       SetDataObj(AnyDataObj &)=0;     
     55
     56    virtual uint_8     getMemOId() const ;      // Renvoie l'identificateur de l'objet  - par defaut=0
     57    // Ces deux methodes doivent etre redefinies si   getMemOId() renvoie non nul (>0)
     58    virtual void       ShareDataReference(PPersist &);       
     59    virtual PPersist*  CloneSharedReference();
     60                                                // doit etre surcharge pour renvoyer un mem-oid correct
    5561  protected: 
    5662    virtual void       ReadSelf(PInPersist&)=0;           
    57     virtual void       WriteSelf(POutPersist&) const=0; 
     63    virtual void       WriteSelf(POutPersist&) const=0;
    5864
    5965    friend class       PInPersist;
     
    7177    typedef PPersist*            (*ClassCreatorFunc)();
    7278 
    73     static void                  RegisterClass(uint_8 classId, string typname, ClassCreatorFunc f);
     79    static void                  RegisterPPHandlerClass(uint_8 classId, string ppclass_name, ClassCreatorFunc f);
     80    static void                  RegisterDataObjClass(uint_8 classId, string class_name);
     81
    7482    static ClassCreatorFunc      FindCreatorFunc(uint_8 classId);
     83
     84    static string                getPPClassName(uint_8 classId);
     85    static uint_8                getPPClassId(string const & typ_name);
     86    static uint_8                getPPClassId(PPersist const & ppo);
     87    static string                getDataObjClassName(uint_8 classId);
     88    static uint_8                getDataObjClassId(string const & typ_name);
     89    static uint_8                getDataObjClassId(AnyDataObj const & o);
     90
    7591    static uint_8 Hash(string const& typname) {
    7692        md5_init(&ctx);
     
    8298 
    8399    static void Initialize();   // Pour initialiser classList
    84     static uint_8 getTypeId(string s) {return (*typeids)[s];}
     100
     101    string FileName() { return filename; }   // Retourne le nom de fichier
     102
    85103  private:
    86104
    87105    typedef map<uint_8, ClassCreatorFunc, less<uint_8> > ClassList; 
    88106    // Pas de createur appele pour objets statiques sur Linux - $CHECK$ Reza 26/04/99
    89     static ClassList *           classList; 
    90     static map<string, uint_8> * typeids;
     107    static ClassList *           ppclassList;      // PPersist class list 
     108    static map<string, uint_8> * ppclassNameList;  // PPersist classId = f(PPersistClassName)
     109    static map<string, uint_8> * dobjclassNameList;  // PPersist classId = f(DataObjClassName)
    91110
    92111  protected:
     
    98117          PPS_TAG = 4,              // tag entries
    99118          PPS_EOF = 5,              // Just before tag infomation, offset to PPS_TAG
    100           PPS_LINE = 6,             // '\n'-terminated, deprecated ?
    101           PPS_TAG_MARK = 7,         // to reset object count when skipped
     119          PPS_ENDOBJECT = 6,        // marks the end of a given object information
     120          PPS_TAG_MARK = 7,         // To have a name tag, position marker in a file
    102121          PPS_SIMPLE = 16,          // 16 + number of bytes, up to 8 bytes
    103           PPS_SIMPLE_ARRAY = 32,    // 32 + number of bytes, up to 8 bytes, then 2 bytes of length
    104           PPS_SIMPLE_ARRAY4 = 64,   // 64 + number of bytes, up to 8 bytes, then 4 bytes of length
    105           PPS_SIMPLE_ARRAY8 = 128   // 64 + number of bytes, up to 8 bytes, then 8 bytes of length
     122          PPS_SIMPLE_ARRAY4 = 32,   // 32 + number of bytes, up to 8 bytes, then 4 bytes of length
     123          PPS_SIMPLE_ARRAY8 = 48    // 48 + number of bytes, up to 8 bytes, then 8 bytes of length
     124    };
     125          // The following values are used PPS_SIMPLE and PPS_SIMPLE_ARRAY (Using OR)
     126   enum  {PPS_DATATYPE_CHAR = 0,        // 0  : DataType=character
     127          PPS_DATATYPE_FLOAT = 64,      // 64 : DataType=float
     128          PPS_DATATYPE_INTEGER = 128,   // 128 :DataType=integer
     129          PPS_DATATYPE_UNSIGNED = 192   // 192 :DataType=Unsigned integer
    106130   };
    107131
    108132    map<string, int_8> tags;
     133    string filename;
    109134  };
    110135
     
    121146    bool   GotoTagNum(int itag);  // 0..NbTags-1
    122147    string GetTagName(int itag);  // 0..NbTags-1
     148    string GetTagClassName(int itag);  // 0..NbTags-1
    123149    vector<string> const &  GetTagNames(); 
    124150
     
    163189    void   Get(string& x) {GetStr(x);}
    164190 
     191    //   Object Reading
    165192    PPersist*  ReadObject();
    166 
     193    void       GetObject(AnyDataObj & o);
     194    void       GetObject(AnyDataObj & o, string  tagname);
     195    PPersist*  GetPPObject(AnyDataObj * po=NULL);
    167196
    168197    int    Version() {return version;}
    169198    time_t CreationDate() { return creationdate; }
     199    string CreationDateStr();
     200
     201    void   AnalyseTags(int lev=0);   // List (all or some) tags ...
     202
     203    //  Reza 03/2000
     204    //  Methodes qui pourraient etre protected, mais doivent etre utilisables par PPersist
     205    void   ReadReference(PPersist & ppo);  // Fill the ppo object from the reference tag
     206    PPersist * ReadReference();            // Creates object from the reference tag
     207    void   KeepOId(uint_8 oid, PPersist & ppo);        // Keeps the ppo in the objList
    170208
    171209  protected:
    172     void   CheckTag   (short datasz);
    173     void   CheckArrayTag(short datasz, size_t sz);
    174     void   GetTypeTag (char& c);
     210    void   CheckTag   (short datasz, short datatype);
     211    void   CheckArrayTag(short datasz, size_t sz, short datatype);
     212    void   GetTypeTag (unsigned char& c);
    175213    void   GetRawByte (char& c);
     214    void   GetRawUByte (unsigned char& c);
    176215    void   GetRawBytes(void* ptr, size_t bytes);
    177216    void   GetRawI2   (int_2&);
     
    179218    void   GetRawI8   (int_8&);
    180219    void   GetRawU8   (uint_8&);
    181     void   GetObject(PPersist*);               // Object has been allocated with correct type
    182     int_4  assignObjectId(PPersist* x);
     220
    183221    void   Scan();
    184     char*  GetCStr(uint_2 l);
    185222
    186223    istream* s;
     
    191228    time_t creationdate;
    192229
    193     // already read objects, id = order in array
    194     typedef vector<PPersist*> ObjList;
     230    // already read objects
     231    typedef map<uint_8, PPersist * > ObjList;
    195232    ObjList objList;
    196 
     233    // Si on a fait une lecture non sequentielle  -> seqread = false
     234    bool seqread;
    197235    friend class PPersist;
    198236  };
     
    225263    void PutLine (char const* ptr, size_t len=0); // deprecated ?
    226264    void PutStr  (string const&);
    227     void PutObject (PPersist const*); // Like doing Write(stream) on object
     265    void PutPPObject (PPersist const*); // Like doing Write(stream) on PPersist object
     266
     267    void PutObject(AnyDataObj & o);   // Creates the corresponding PPersist Object and call Write()
     268    void PutObject(AnyDataObj & o, string tagname);
    228269
    229270    void   Put(char   c) {PutByte(c);}
     
    245286    void   Put(int_8 const*  x, size_t n) {PutI8s(x,n);}
    246287    void   Put(string const& s) {PutStr(s);}
    247     void   Put(PPersist const* x) {PutObject(x);}
     288    void   Put(PPersist const* x) {PutPPObject(x);}
    248289
    249290
     
    252293    bool bigEndian;
    253294
    254     void     PutArrayTag(short datasz, size_t sz);
     295    void     PutArrayTag(short datasz, size_t sz, short datatype);
    255296    void     PutRawByte (char);
     297    void     PutRawUByte (unsigned char);
    256298    void     PutRawI2   (int_2);
    257299    void     PutRawI4   (int_4);
     
    260302    void     PutRawBytes(void const* ptr, size_t bytes);
    261303    bool     serializeNullAndRepeat(PPersist const* x);
    262     int_4    findObjectId(PPersist const* x);
    263     int_4    assignObjectId(PPersist const* x);
    264 
    265     // already serialized objects
    266     typedef map<PPersist const*, int_4, less<PPersist const*> >  ObjList;
     304    uint_8   findObjectId(PPersist const* x, int_8 & pos);
     305    uint_8   assignObjectId(PPersist const* x);
     306
     307    // objreftag contains the assigned POutStream Object Id and the stream position
     308    // of the original written object
     309    typedef struct { uint_8 ppsoid; int_8 ppspos; } objreftag;
     310    // already serialized objects are kept in a map as a function of the Objects memory Id
     311    typedef map<uint_8, objreftag, less<uint_8> >  ObjList;
    267312    ObjList objList;
     313    uint_8 pps_OId;    // PPS Object Id
    268314  };
    269315 
     
    306352#endif
    307353 
    308   inline POutPersist& operator << (POutPersist& c, PPersist const& obj)
    309     {
    310       obj.Write(c);
    311       return c;
    312     }
    313  
    314   inline PInPersist& operator >> (PInPersist& c, PPersist& obj)
    315     {
    316       obj.Read(c);
    317       return c;
    318     }
    319  
     354
     355// --- Cela risque d'etre dangereux --- On le laisse au niveau des DataObj
     356//                           Reza 24/3/2000
     357//   inline POutPersist& operator << (POutPersist& c, PPersist const& obj)
     358//     {
     359//       obj.Write(c);
     360//       return c;
     361//     }
     362 
     363//   inline PInPersist& operator >> (PInPersist& c, PPersist& obj)
     364//     {
     365//       obj.Read(c);
     366//       return c;
     367//     }
     368
    320369  // Utility class to
    321370  //   - compute the class ID from a MD5 hash of the class name
     
    326375    public:
    327376      static PPersist* Create() {return new T();}
    328       static void Register(string id) {PIOPersist::RegisterClass(Hash(id),typeid(T).name(),Create);}
     377      static void Register(string id) { PIOPersist::RegisterPPHandlerClass(Hash(id), typeid(T).name(), Create); }
    329378      static uint_8 Hash(string id) {
    330379        return PIOPersist::Hash(id);
     
    333382 
    334383#define PPRegister(className) PPersistRegistrar<className>::Register(#className);
     384#define DObjRegister(ppclassName, className) PIOPersist::RegisterDataObjClass(PIOPersist::Hash(#ppclassName), typeid(className).name());
    335385
    336386} // namespace
  • trunk/SophyaLib/BaseTools/sophyainit.cc

    r754 r802  
    1111
    1212#include "ppersist.h"
    13 #include "ndatablock.h"
     13#include "fiondblock.h"
    1414#include "dvlist.h"
    1515
     
    3636  PIOPersist::Initialize();
    3737  PPRegister(FIO_NDataBlock<uint_1>);
     38  DObjRegister(FIO_NDataBlock<uint_1>, NDataBlock<uint_1>);
    3839  PPRegister(FIO_NDataBlock<uint_2>);
     40  DObjRegister(FIO_NDataBlock<uint_2>, NDataBlock<uint_2>);
    3941  PPRegister(FIO_NDataBlock<int_2>);
     42  DObjRegister(FIO_NDataBlock<int_2>, NDataBlock<int_2>);
    4043  PPRegister(FIO_NDataBlock<int_4>);
     44  DObjRegister(FIO_NDataBlock<int_4>, NDataBlock<int_4>);
    4145  PPRegister(FIO_NDataBlock<int_8>);
     46  DObjRegister(FIO_NDataBlock<int_8>, NDataBlock<int_8>);
    4247  PPRegister(FIO_NDataBlock<uint_4>);
     48  DObjRegister(FIO_NDataBlock<uint_4>, NDataBlock<uint_4>);
    4349  PPRegister(FIO_NDataBlock<uint_8>);
     50  DObjRegister(FIO_NDataBlock<uint_8>, NDataBlock<uint_8>);
    4451  PPRegister(FIO_NDataBlock<r_4>);
     52  DObjRegister(FIO_NDataBlock<r_4>, NDataBlock<r_4>);
    4553  PPRegister(FIO_NDataBlock<r_8>);
    46   PPRegister(FIO_NDataBlock< complex<float> >);
    47   PPRegister(FIO_NDataBlock< complex<double> >);
     54  DObjRegister(FIO_NDataBlock<r_8>, NDataBlock<r_8>);
     55  PPRegister(FIO_NDataBlock< complex<r_4> >);
     56  DObjRegister(FIO_NDataBlock< complex<r_4> >, NDataBlock< complex<r_4> >);
     57  PPRegister(FIO_NDataBlock< complex<r_8> >);
     58  DObjRegister(FIO_NDataBlock< complex<r_8> >, NDataBlock< complex<r_8> >);
    4859
    4960  PPRegister(ObjFileIO<DVList>);
     61  DObjRegister(ObjFileIO<DVList>, DVList);
    5062
    5163
Note: See TracChangeset for help on using the changeset viewer.