Changeset 2657 in Sophya


Ignore:
Timestamp:
Apr 5, 2005, 5:37:54 PM (20 years ago)
Author:
ansari
Message:

1/ Correction petite erreur ds NDataBlock et recuperation de
MemoryObjectId a travers une fonction globale (static) ds AnyDataObj
2/ Ajout fonctions pour lister les classes PPersist handler ds ppersist.h .cc

Reza, 5 Avril 2005

Location:
trunk/SophyaLib/BaseTools
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/BaseTools/anydataobj.h

    r895 r2657  
    1616  AnyDataObj() { }
    1717  virtual ~AnyDataObj() { }
     18
     19//! Return a process wide unique identifier
     20  static uint_8 getUniqueId();
    1821};
    1922
  • trunk/SophyaLib/BaseTools/ndatablock.cc

    r2615 r2657  
    1010#include "pexceptions.h"
    1111#include "ndatablock.h"
     12
     13/* ---- Pour renvoyer un identificateur unique ---- */
     14static uint_8 _ndrefid_ = 0; // Identificateur de NDREF cree
     15uint_8 AnyDataObj::getUniqueId()
     16{
     17  _ndrefid_++;
     18  return ( _ndrefid_ );
     19}
    1220
    1321/*!
     
    310318 */
    311319
    312 static uint_8 _ndrefid_ = 0; // Identificateur de NDREF cree
    313320
    314321template <class T>
     
    327334mSRef = new NDREF;
    328335mSRef->nref = 1;
    329 mSRef->dsid = ++_ndrefid_;
     336mSRef->dsid = AnyDataObj::getUniqueId();
    330337if(data) mSRef->data = data;
    331338else {mSRef->data = new T[n]; if (zero) memset(mSRef->data,0,n*sizeof(T));}
  • trunk/SophyaLib/BaseTools/ndatablock.h

    r2565 r2657  
    110110  inline T const*  End() const    {return mSRef->data+mSz;}
    111111  //! Return the number of references to the data structure
    112   inline size_t NRef() const {if(mSRef) return 0; else return mSRef->nref;}
     112  inline size_t NRef() const {if(mSRef) return mSRef->nref;  else return 0; }
    113113
    114114  // Impression
  • trunk/SophyaLib/BaseTools/ppersist.cc

    r2615 r2657  
    88#include "anydataobj.h"
    99#include <iostream>
     10#include <iomanip>
    1011#include <typeinfo>
    1112
     
    105106//      class_typename should be typeid(DataObject).name(), to be
    106107//      used by POutPersist::PutDataObject() methods.
     108
     109//! Lists the registered PPersist handler classes and the corresponding class id.
     110void
     111PIOPersist::ListPPHandlers()
     112{
     113  cout << " PIOPersist::ListPPHandlers() - List of registered PPersist handler classes " << endl;
     114  map<string, uint_8>::iterator it;
     115  int k = 0;
     116  for (it = (*ppclassNameList).begin(); it != (*ppclassNameList).end(); it++) {
     117    cout << ++k << ":   " << (*it).first << "\n" << "          ClassId: Hex=  "
     118         << hex << (*it).second << "  (Dec= " << dec << (*it).second << ")" << endl;   
     119  }
     120}
     121
     122//! Lists the registered DataObj classes with the corresponding PPHandler name
     123void
     124PIOPersist::ListDataObjClasses()
     125{
     126  cout << " PIOPersist::ListDataObjClasses() : Registered DataObj class list " << endl;
     127  map<string, uint_8>::iterator it;
     128  int k = 0;
     129  for (it = (*dobjclassNameList).begin(); it != (*dobjclassNameList).end(); it++) {
     130    cout << ++k << "- "  << (*it).first << "  ->  " << getPPClassName((*it).second) << endl;
     131  }
     132}
    107133
    108134PIOPersist::ClassCreatorFunc
  • trunk/SophyaLib/BaseTools/ppersist.h

    r2477 r2657  
    7777    static void                  RegisterPPHandlerClass(uint_8 classId, string ppclass_name, ClassCreatorFunc f);
    7878    static void                  RegisterDataObjClass(uint_8 classId, string class_name);
     79
     80    static void                  ListPPHandlers();
     81    static void                  ListDataObjClasses();
    7982
    8083    static ClassCreatorFunc      FindCreatorFunc(uint_8 classId);
Note: See TracChangeset for help on using the changeset viewer.