Changeset 3173 in Sophya for trunk


Ignore:
Timestamp:
Feb 5, 2007, 10:04:46 AM (19 years ago)
Author:
ansari
Message:

Ajout methodes TArray::ZeroSize() RenewObjId() - Reza 05/02/2007

Location:
trunk/SophyaLib/TArray
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/TArray/basarr.cc

    r3107 r3173  
    741741}
    742742
    743 
     743//! Set the array sizes to zero, corresponding to an unallocated array
     744void BaseArray::SetZeroSize()
     745{
     746  ndim_ = 0;
     747  for(int_4 k=0; k<BASEARRAY_MAXNDIMS; k++) step_[k] = size_[k] = 0;
     748  totsize_ = 0;
     749  minstep_ = 0;
     750  moystep_ = 0;
     751  offset_ = 0;
     752  // On ne change pas l'organisation memoire, le type de vecteur
     753  // et le array type
     754}
     755
  • trunk/SophyaLib/TArray/basarr.h

    r2917 r3173  
    183183  virtual void UpdateSubArraySizes(BaseArray & ra, int_4 ndim, sa_size_t * siz, sa_size_t * pos, sa_size_t * step) const;
    184184
     185  // Pour mettre les tailles a zero
     186  virtual void SetZeroSize();
     187
    185188  int_4  ndim_; //!< number of dimensions of array
    186189  sa_size_t size_[BASEARRAY_MAXNDIMS]; //!< array of the size in each dimension
  • trunk/SophyaLib/TArray/tarray.cc

    r3101 r3173  
    382382}
    383383
     384  //! To clear the array sizes - corresponding to an unallocated array.
     385template <class T>
     386TArray<T>&  TArray<T>::ZeroSize()
     387{
     388  if (NbDimensions() == 0)  return (*this); 
     389  SetZeroSize();
     390  mNDBlock.Dealloc();
     391  return (*this);
     392}
    384393
    385394/*!
  • trunk/SophyaLib/TArray/tarray.h

    r2938 r3173  
    6767  void Realloc(int_4 ndim, sa_size_t * siz, sa_size_t step=1, bool force=false);
    6868
     69  //! To clear the array sizes - corresponding to an unallocated array.
     70  virtual TArray<T>& ZeroSize();
     71
    6972  // Compacts size=1 array dimensions
    7073  virtual TArray<T>& CompactAllDimensions();
     
    212215  virtual void   WriteASCII(ostream& os) const;
    213216
     217//! assign a new object Id (or DataRef Id) - useful for PPF write operations
     218  inline void RenewObjId() { mNDBlock.RenewObjId(); }
    214219//  Pour la gestion de persistance
    215220  friend class  FIO_TArray<T>;
  • trunk/SophyaLib/TArray/tarrinit.cc

    r3017 r3173  
    2020
    2121// Module version number - 2.0 , Jul 2006
    22 #define MOD_VERS   2.0
     22// Module version number - 2.02 , Fev 2006: Ajout TArray::ZeroSize() , RenewObjId()
     23#define MOD_VERS   2.02
    2324
    2425TArrayInitiator::TArrayInitiator()
Note: See TracChangeset for help on using the changeset viewer.