Changeset 773 in Sophya for trunk/SophyaLib
- Timestamp:
- Mar 10, 2000, 4:23:01 PM (26 years ago)
- Location:
- trunk/SophyaLib/BaseTools
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/BaseTools/ndatablock.cc
r754 r773 30 30 #endif 31 31 32 Alloc(n );32 Alloc(n, NULL, NULL, true); // allocation et mise a zero 33 33 } 34 34 … … 96 96 97 97 template <class T> 98 void NDataBlock<T>::Alloc(size_t n,T* data,Bridge* br )98 void NDataBlock<T>::Alloc(size_t n,T* data,Bridge* br,bool zero) 99 99 // Allocation d'un NOUVEL espace de stoquage de "n" donnees 100 // Si data==NULL : allocation de l'espace memoire (remplit de zeros) 100 // Si data==NULL : allocation de l'espace memoire 101 // si zero == true , l'espace est remplis de zeros 101 102 // data!=NULL : partage des donnees avec l'adresse data 102 103 // Si br==NULL : les donnees nous appartiennent … … 173 174 mSRef->nref = 1; 174 175 if(data) mSRef->data = data; 175 else {mSRef->data = new T[n]; memset(mSRef->data,0,n*sizeof(T));}176 else {mSRef->data = new T[n]; if (zero) memset(mSRef->data,0,n*sizeof(T));} 176 177 mSRef->bridge = br; 177 178 … … 201 202 if(&a==NULL) throw(NullPtrError("NDataBlock::Clone &a==NULL\n")); 202 203 if(!a.mSRef || a.mSz==0) throw(SzMismatchError("NDataBlock::Clone a.mSz==0\n")); 203 Alloc(a.mSz );204 Alloc(a.mSz, NULL, NULL, false); // pas de mise a zero 204 205 memcpy(Data(),a.Data(),mSz*sizeof(T)); 205 206 } … … 288 289 if(data==NULL) throw(NullPtrError("NDataBlock::FillFrom data==NULL\n")); 289 290 if(n==0) throw(ParmError("NDataBlock::FillFrom n<=0\n")); 290 if(mSRef==NULL) Alloc(n );291 if(mSRef==NULL) Alloc(n, NULL, NULL, false); // Pas de mise a zero 291 292 if(mSz<n) n = mSz; 292 293 memcpy(Data(),data,n*sizeof(T)); -
trunk/SophyaLib/BaseTools/ndatablock.h
r754 r773 109 109 typedef struct {size_t nref; T* data; Bridge* bridge; } NDREF; 110 110 111 void Alloc(size_t n,T* data=NULL,Bridge* br=NULL );111 void Alloc(size_t n,T* data=NULL,Bridge* br=NULL, bool zero=true); 112 112 void Delete(void); 113 113 -
trunk/SophyaLib/BaseTools/pexceptions.cc
r512 r773 22 22 } 23 23 24 string BuildLongExceptionMessage(const char * s, const char *file, int line) 25 { 26 char buff[32]; 27 sprintf(buff," Line=%d", line); 28 string rs=s; 29 rs += " File="; rs += file; rs += buff; 30 return(rs); 31 } 32 24 33 #endif -
trunk/SophyaLib/BaseTools/pexceptions.h
r749 r773 8 8 using namespace std; 9 9 10 // Petit utilitaire pour accoler numero de ligne et nom de fichier aux messages 11 // d'exception 12 #define PExcLongMessage(a) BuildLongExceptionMessage(a,__FILE__,__LINE__) 13 10 14 namespace SOPHYA { 15 16 // Utiliatire pour accoler un nom de fichier et numero de ligne au message 17 string BuildLongExceptionMessage(const char * s, const char *file, int line); 11 18 12 19 // Ancestor for PError and PException -
trunk/SophyaLib/BaseTools/smathconst.h
r754 r773 4 4 5 5 #include "machdefs.h" 6 #include <values.h> 6 7 7 8 /* EA conflit entre les diverses copies de nbmath.h, nbconst.h... A nettoyer... */
Note:
See TracChangeset
for help on using the changeset viewer.