Changeset 701 in Sophya for trunk/SophyaLib/Samba/spherepos.cc


Ignore:
Timestamp:
Jan 4, 2000, 3:27:29 PM (26 years ago)
Author:
ansari
Message:

mise a jour de persistances par objets delegues

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/Samba/spherepos.cc

    r682 r701  
     1// 04/01/00 : implantation de la persistance par classe deleguee - Guy Le Meur
     2
    13#include "spherepos.h"
    24
    3 static char *head_spherepos_cc_ = "$Header: /Users/garnier/temp/CVSSophya/SophyaLib/Samba/spherepos.cc,v 1.3 1999-12-10 16:55:59 ansari Exp $";
     5static char *head_spherepos_cc_ = "$Header: /Users/garnier/temp/CVSSophya/SophyaLib/Samba/spherepos.cc,v 1.4 2000-01-04 14:27:15 ansari Exp $";
    46
    57
     
    911  id_ = SphereCoordSys_NEUTRAL;
    1012  description_ = "NEUTRAL SphereCoordSystem";
     13}
     14SphereCoordSys::SphereCoordSys(const SphereCoordSys& a )
     15{
     16  id_ = a.id_;
     17  description_ = a.description_;
    1118}
    1219
     
    1926{
    2027}
    21 
    22 // Temporary implementation of PPersist::
    23 // To be changed later ($CHECK$  Reza 26/10/99)
    24 void SphereCoordSys::ReadSelf(PInPersist& is)
     28SphereCoordSys& SphereCoordSys::operator = (const SphereCoordSys& a)
    2529{
    26 uint_8 itab[3];
    27 is.Get(itab, 3);
    28 id_ = itab[1];
    29 is.GetStr(description_);
     30  id_ = a.id_;
     31  description_ = a.description_;
     32  return *this;
    3033}
    3134
    32 void SphereCoordSys::WriteSelf(POutPersist& os) const
     35
     36////////////////////////////////////////////////////////////////
     37// -------------------------------------------------------------------------
     38//   Les objets delegues pour la gestion de persistance
     39// -------------------------------------------------------------------------
     40
     41FIO_SphereCoordSys::FIO_SphereCoordSys()
     42  {
     43    dobj=new SphereCoordSys;
     44    ownobj=true;
     45  }
     46FIO_SphereCoordSys::FIO_SphereCoordSys(string const & filename)
     47  {
     48    dobj=new SphereCoordSys;
     49    ownobj=true;
     50    Read(filename);
     51  }
     52FIO_SphereCoordSys::FIO_SphereCoordSys(const SphereCoordSys & obj)
     53  {
     54    dobj = new SphereCoordSys(obj);
     55    ownobj=true;
     56  }
     57FIO_SphereCoordSys::FIO_SphereCoordSys(SphereCoordSys * obj)
     58  {
     59    dobj = obj;
     60    ownobj=false;
     61  }
     62FIO_SphereCoordSys::~FIO_SphereCoordSys()
     63  {
     64    if (ownobj && dobj) delete dobj;
     65  }
     66AnyDataObj* FIO_SphereCoordSys::DataObj()
     67  {
     68    return(dobj);
     69  }
     70
     71
     72void  FIO_SphereCoordSys::ReadSelf(PInPersist& is)
     73  {
     74uint_8 itab[3];
     75 string description;
     76is.Get(itab, 3);
     77is.GetStr(description);
     78if (dobj == NULL) dobj = new SphereCoordSys(itab[1], description);
     79 else *dobj= SphereCoordSys(itab[1], description);
     80  }           
     81void       FIO_SphereCoordSys::WriteSelf(POutPersist& os) const
    3382{
     83if (dobj == NULL)   return;  // Attention - $CHECK$ Guy 04/01/00
    3484//  On ecrit 3 uint_8
    3585//  0 : Numero de version,  1 : Id,  2  reserve a l
    3686uint_8 itab[3];
    3787itab[0] = 1;
    38 itab[1] = id_;
     88itab[1] = dobj->Id();
    3989itab[2] = 0;
    4090os.Put(itab, 3);
    41 os.PutStr(description_);
    42 }
     91os.PutStr(dobj->description());
     92}
     93
     94
    4395
    4496//................. SpherePosition class .................
Note: See TracChangeset for help on using the changeset viewer.