[268] | 1 | // Gestion de block de donnees avec partage de references
|
---|
[502] | 2 | // malheureusement tres mal concu... C.Magneville 04/99
|
---|
[268] | 3 | // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA
|
---|
[245] | 4 | #include "machdefs.h"
|
---|
| 5 | #include <stdio.h>
|
---|
| 6 | #include <stdlib.h>
|
---|
| 7 | #include <iostream.h>
|
---|
| 8 | #include <complex>
|
---|
| 9 | #include "pexceptions.h"
|
---|
| 10 | #include "ndatablock.h"
|
---|
| 11 |
|
---|
[944] | 12 | /*!
|
---|
| 13 | \class SOPHYA::NDataBlock
|
---|
| 14 | \ingroup SysTools
|
---|
| 15 | Management of data blocks
|
---|
| 16 | */
|
---|
[268] | 17 |
|
---|
[944] | 18 | //////////////////////////////////
|
---|
| 19 | // Fonctionnement en mode debug //
|
---|
| 20 | //////////////////////////////////
|
---|
[245] | 21 |
|
---|
[944] | 22 | template <class T> int NDataBlock<T>::Debug_NDataBlock = 0;
|
---|
| 23 | template <class T> size_t NDataBlock<T>::NallocData = 0;
|
---|
| 24 | template <class T> size_t NDataBlock<T>::NallocSRef = 0;
|
---|
[245] | 25 |
|
---|
[944] | 26 | //! Set debug (and level print) for allocation and references debug.
|
---|
| 27 | /*!
|
---|
| 28 | \param prtlevel : activate/des-activate debug mode
|
---|
| 29 | and select print level
|
---|
| 30 |
|
---|
| 31 | \arg prtlevel <= 0 : no debug
|
---|
| 32 | \arg prtlevel == 1 : debug activated, no print
|
---|
| 33 | \arg prtlevel >=2 : debug activated,
|
---|
| 34 | print infos in all routines that have something to do with
|
---|
| 35 | allocations or des-allocation of datas or references.
|
---|
| 36 | */
|
---|
[245] | 37 | template <class T>
|
---|
[944] | 38 | void NDataBlock<T>::SetPrintDebug(int prtdbglevel)
|
---|
| 39 | {
|
---|
| 40 | Debug_NDataBlock = prtdbglevel;
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 | //! Reset debug counter values.
|
---|
| 44 | /*!
|
---|
| 45 | \param nallocdata : reset number of allocated data structures to \b nallocdata
|
---|
| 46 | \param nallocsref : reset number of allocated references to \b nallocsref
|
---|
| 47 | \warning In principle this routine should not be use (only experts)
|
---|
| 48 | */
|
---|
| 49 | template <class T>
|
---|
| 50 | void NDataBlock<T>::ResetDebug(size_t nallocdata, size_t nallocsref)
|
---|
| 51 | {
|
---|
| 52 | NallocData = nallocdata;
|
---|
| 53 | NallocSRef = nallocsref;
|
---|
| 54 | }
|
---|
| 55 |
|
---|
| 56 | //! Print debug current status.
|
---|
| 57 | /*!
|
---|
| 58 | Print debug current status for number of allocated
|
---|
| 59 | data structures and number of allocated references.
|
---|
| 60 | */
|
---|
| 61 | template <class T>
|
---|
| 62 | void NDataBlock<T>::PrintDebug()
|
---|
| 63 | {
|
---|
| 64 | cout<<"... ... ... NallocData = "<<NallocData
|
---|
| 65 | <<" , NallocSRef = "<<NallocSRef
|
---|
| 66 | <<" ... ... ..."<<endl;
|
---|
| 67 | }
|
---|
| 68 |
|
---|
| 69 | ///////////////////////////
|
---|
| 70 | // Createur, Destructeur //
|
---|
| 71 | ///////////////////////////
|
---|
| 72 |
|
---|
| 73 | //! Constructor for \b n datas
|
---|
| 74 | template <class T>
|
---|
[245] | 75 | NDataBlock<T>::NDataBlock(size_t n)
|
---|
| 76 | // Createur d'une structure de "n" donnees
|
---|
| 77 | : mSz(0), mSRef(NULL), mIsTemp(false)
|
---|
| 78 | {
|
---|
[944] | 79 | if(Debug_NDataBlock>1)
|
---|
| 80 | cout<<"?_NDataBlock::NDataBlock("<<this<<",n="<<n<<")"<<endl;
|
---|
[268] | 81 |
|
---|
[773] | 82 | Alloc(n, NULL, NULL, true); // allocation et mise a zero
|
---|
[245] | 83 | }
|
---|
| 84 |
|
---|
[944] | 85 | //! Constructor for \b n datas shared with external
|
---|
| 86 | /*!
|
---|
| 87 | Datas are previously allocated by an other external source.
|
---|
| 88 | \warning This require particular care (see Alloc)
|
---|
| 89 | \sa Alloc
|
---|
| 90 | */
|
---|
[245] | 91 | template <class T>
|
---|
| 92 | NDataBlock<T>::NDataBlock(size_t n, T* data, Bridge* br)
|
---|
[502] | 93 | // Createur d'une structure de "n" donnees, avec donnees preallouees.
|
---|
| 94 | // Attention createur TRES DANGEREUX (Voir explications dans Alloc()).
|
---|
[245] | 95 | : mSz(0), mSRef(NULL), mIsTemp(false)
|
---|
| 96 | {
|
---|
[944] | 97 | if(Debug_NDataBlock>1)
|
---|
| 98 | cout<<"?_NDataBlock::NDataBlock("<<this
|
---|
| 99 | <<",data="<<data<<",br="<<br<<")"<<endl;
|
---|
[268] | 100 |
|
---|
[245] | 101 | Alloc(n,data,br);
|
---|
| 102 | }
|
---|
| 103 |
|
---|
[944] | 104 | //! Default constructor
|
---|
[245] | 105 | template <class T>
|
---|
| 106 | NDataBlock<T>::NDataBlock()
|
---|
| 107 | // Createur par default
|
---|
| 108 | : mSz(0), mSRef(NULL), mIsTemp(false)
|
---|
| 109 | {
|
---|
[944] | 110 | if(Debug_NDataBlock>1)
|
---|
| 111 | cout<<"?_NDataBlock::NDataBlock("<<this<<") default"<<endl;
|
---|
[245] | 112 | }
|
---|
| 113 |
|
---|
[944] | 114 | //! Copy constructor
|
---|
| 115 | /*!
|
---|
| 116 | \warning datas are shared if \b a is temporary, cloned if not.
|
---|
| 117 | */
|
---|
[245] | 118 | template <class T>
|
---|
[268] | 119 | NDataBlock<T>::NDataBlock(const NDataBlock<T>& a)
|
---|
[289] | 120 | // Createur par copie: partage les donnees si "a" temporaire, clone sinon.
|
---|
[245] | 121 | : mSz(0), mSRef(NULL), mIsTemp(false)
|
---|
| 122 | {
|
---|
[944] | 123 | if(Debug_NDataBlock>1)
|
---|
| 124 | cout<<"?_NDataBlock::NDataBlock("<<this<<",&a="<<&a<<")"<<endl;
|
---|
[268] | 125 |
|
---|
[289] | 126 | CloneOrShare(a);
|
---|
[245] | 127 | }
|
---|
| 128 |
|
---|
[944] | 129 | //! Copy constructor with \b share option
|
---|
| 130 | /*!
|
---|
| 131 | \warning datas are shared if \b share is \b true, cloned if not.
|
---|
| 132 | */
|
---|
[245] | 133 | template <class T>
|
---|
[268] | 134 | NDataBlock<T>::NDataBlock(const NDataBlock<T>& a,bool share)
|
---|
[289] | 135 | // Createur avec choix de partager ou non selon "share"
|
---|
[245] | 136 | : mSz(0), mSRef(NULL), mIsTemp(false)
|
---|
| 137 | {
|
---|
[944] | 138 | if(Debug_NDataBlock>1)
|
---|
| 139 | cout<<"?_NDataBlock::NDataBlock("<<this<<",&a="<<&a<<",sh=<<"<<share<<")"<<endl;
|
---|
[268] | 140 |
|
---|
[245] | 141 | if(share) Share(a); else Clone(a);
|
---|
| 142 | }
|
---|
| 143 |
|
---|
[944] | 144 | //! Destructor
|
---|
[245] | 145 | template <class T>
|
---|
| 146 | NDataBlock<T>::~NDataBlock()
|
---|
| 147 | // Destructeur
|
---|
| 148 | {
|
---|
[944] | 149 | if(Debug_NDataBlock>1)
|
---|
| 150 | cout<<"?_NDataBlock::~NDataBlock("<<this<<")"<<endl;
|
---|
[268] | 151 |
|
---|
[245] | 152 | Delete();
|
---|
| 153 | }
|
---|
| 154 |
|
---|
[944] | 155 | ////////////////////////
|
---|
| 156 | // Gestion de donnees //
|
---|
| 157 | ////////////////////////
|
---|
[275] | 158 |
|
---|
[944] | 159 | //! Clone datas from \b a
|
---|
[245] | 160 | template <class T>
|
---|
[268] | 161 | void NDataBlock<T>::Clone(const NDataBlock<T>& a)
|
---|
[289] | 162 | // Clone: copie de donnees a partir de "a"
|
---|
[245] | 163 | {
|
---|
[944] | 164 | if(Debug_NDataBlock>1)
|
---|
| 165 | cout<<"?_NDataBlock::Clone("<<this<<","<<&a<<") a.(mSz="
|
---|
| 166 | <<a.mSz<<" mSRef="<<a.mSRef<<" IsTemp="<<a.IsTemp()
|
---|
| 167 | <<"), mSz="<<mSz<<" mSRef="<<mSRef<<" IsTemp="<<mIsTemp<<endl;
|
---|
[275] | 168 |
|
---|
[289] | 169 | if(&a==NULL) throw(NullPtrError("NDataBlock::Clone &a==NULL\n"));
|
---|
| 170 | if(!a.mSRef || a.mSz==0) throw(SzMismatchError("NDataBlock::Clone a.mSz==0\n"));
|
---|
[773] | 171 | Alloc(a.mSz, NULL, NULL, false); // pas de mise a zero
|
---|
[289] | 172 | memcpy(Data(),a.Data(),mSz*sizeof(T));
|
---|
[245] | 173 | }
|
---|
| 174 |
|
---|
[944] | 175 | //! Share datas with \b a
|
---|
[245] | 176 | template <class T>
|
---|
[944] | 177 | void NDataBlock<T>::Share(const NDataBlock<T>& a)
|
---|
| 178 | // Share: Partage les donnees avec "a"
|
---|
| 179 | {
|
---|
| 180 | if(Debug_NDataBlock>1) {
|
---|
| 181 | cout<<"?_NDataBlock::Share("<<this<<","<<&a<<")";
|
---|
| 182 | if(&a!=NULL) cout<<" a.(mSz="<<a.mSz<<" mSRef="<<a.mSRef
|
---|
| 183 | <<" IsTemp="<<a.IsTemp()<<")";
|
---|
| 184 | cout<<", mSz="<<mSz<<" mSRef="<<mSRef<<" IsTemp="<<mIsTemp<<endl;
|
---|
| 185 | }
|
---|
| 186 |
|
---|
| 187 | if(&a==NULL) throw(NullPtrError("NDataBlock::Share &a==NULL\n"));
|
---|
| 188 | if(!a.mSRef || a.mSz==0) throw(NullPtrError("NDataBlock::Share a.mSz=0\n"));
|
---|
| 189 | if(mSRef) Delete();
|
---|
| 190 | mSz = a.mSz; mSRef = a.mSRef; mSRef->nref++;
|
---|
| 191 |
|
---|
| 192 | if(Debug_NDataBlock>1)
|
---|
| 193 | cout<<"...?_NDataBlock::Share mSz="<<mSz<<" mSRef="<<mSRef
|
---|
| 194 | <<" mSRef->nref="<<mSRef->nref<<" mSRef->data="<< mSRef->data
|
---|
| 195 | <<" mSRef->bridge="<<mSRef->bridge<<" IsTemp="<<mIsTemp<<endl;
|
---|
| 196 | }
|
---|
| 197 |
|
---|
| 198 | //! \b Share with \b a if \b temporary, \b clone from \b a if not.
|
---|
| 199 | template <class T>
|
---|
[289] | 200 | void NDataBlock<T>::CloneOrShare(const NDataBlock<T>& a)
|
---|
| 201 | // CloneOrShare: Share si "a" temporaire, Clone sinon.
|
---|
| 202 | {
|
---|
[944] | 203 | if(Debug_NDataBlock>1)
|
---|
| 204 | cout<<"?_NDataBlock::CloneOrShare("<<this<<","<<&a<<")"<<endl;
|
---|
[289] | 205 |
|
---|
| 206 | if(&a==NULL) throw(NullPtrError("NDataBlock::CloneOrShare &a==NULL\n"));
|
---|
| 207 | if(a.IsTemp()) Share(a); else Clone(a);
|
---|
| 208 | }
|
---|
| 209 |
|
---|
[944] | 210 | ////////////////////////////////////////////////////////////
|
---|
| 211 | // Allocation , destruction , remplissage et reallocation //
|
---|
| 212 | ////////////////////////////////////////////////////////////
|
---|
| 213 |
|
---|
| 214 | //! Allocation management
|
---|
| 215 | /*!
|
---|
| 216 | Allocation d'un NOUVEL espace de stoquage de "n" donnees
|
---|
| 217 | \verbatim
|
---|
| 218 | Si data==NULL : allocation de l'espace memoire
|
---|
| 219 | si zero == true , l'espace est remplis de zeros
|
---|
| 220 | data!=NULL : partage des donnees avec l'adresse data
|
---|
| 221 | Si br==NULL : les donnees nous appartiennent
|
---|
| 222 | br!=NULL : les donnees ne nous appartiennent pas (ex: Blitz)
|
---|
| 223 |
|
---|
| 224 | Exemple: on veut connecter a un tableau de T*
|
---|
| 225 | > float *x = new float[5]; ... remplissage de x[] ...;
|
---|
| 226 | 1- On veut que NDataBlock NE DESALLOUE PAS le tableau "x[]"
|
---|
| 227 | a- Premiere solution
|
---|
| 228 | > NDataBlock A(5,x,new Bridge);
|
---|
| 229 | ......
|
---|
| 230 | > delete [] x;
|
---|
| 231 | - Il faut deleter x[] explicitement.
|
---|
| 232 | - Le destructeur de "A" ne detruit pas x[].
|
---|
| 233 | ATTENTION: Une fois x[] detruit, "A" ne peut
|
---|
| 234 | plus acceder les donnees!
|
---|
| 235 | - Bridge est detruit par le destructeur de "A"
|
---|
| 236 | b- Autre solution:
|
---|
| 237 | > NDataBlock A(5); A.FillFrom(5,x);
|
---|
| 238 | > delete [] x;
|
---|
| 239 | ......
|
---|
| 240 | - Il faut deleter x[] explicitement.
|
---|
| 241 | - "A" possede une copie en local de x[].
|
---|
| 242 | - Le destructeur de "A" ne detruit pas x[] mais la copie locale.
|
---|
| 243 | 2- On veut que NDataBlock desalloue le tableau
|
---|
| 244 | > NDataBlock A(5,x);
|
---|
| 245 | - Ne Pas Faire "delete [] x;"
|
---|
| 246 | - "A" partage les donnees avec x[].
|
---|
| 247 | - Le destructeur de "A" detruit x[].
|
---|
| 248 |
|
---|
| 249 | --- REMARQUE SUR LE DANGER DE CERTAINES SITUATIONS (CMV):
|
---|
| 250 | 1-/ x = new float[n1]; NDataBlock A(n2,x);
|
---|
| 251 | 1er danger: si n2>n1 depassement de tableaux (core dump)
|
---|
| 252 | 2sd danger: celui qui alloue x[] ne doit pas faire le "delete"
|
---|
| 253 | en desaccord avec toutes les regles de bonne conduite.
|
---|
| 254 | 2-/ float x[5]={1,2,3,4,5}; {NDataBlock A(n2,&x[0]);} cout<<x[2];
|
---|
| 255 | Ici, a la sortie du bloc {}, le destructeur de "A" va detruire
|
---|
| 256 | l'adresse de &x[0]: je n'ose imaginer que ca se fasse sans probleme
|
---|
| 257 | et de toute facon, cout<<x[2]; va surement faire des etincelles.
|
---|
| 258 | 3-/ x = new float[n1]; NDataBlock A(n2,x,new Bridge);
|
---|
| 259 | 1er danger: si n2>n1 depassement de tableaux (core dump)
|
---|
| 260 | 2sd danger: si la methode bridgee (blitz?) detruit x[]
|
---|
| 261 | "A" n'a plus de donnees connectees!
|
---|
| 262 | --- CONCLUSION
|
---|
| 263 | Cette classe est franchement merdique.
|
---|
| 264 | - On peut accepter la prise de risque liee a NDataBlock(n2,x,new Bridge);
|
---|
| 265 | car je ne vois pas comment on pourrait faire autrement pour connecter
|
---|
| 266 | un tableau de type blitz par exemple.
|
---|
| 267 | - Par contre le createur NDataBlock(n2,x); doit etre interdit
|
---|
| 268 | dans sa forme actelle car trop dangereux et il me semble inutile.
|
---|
| 269 | - Dans cette nouvelle optique:
|
---|
| 270 | NDataBlock(n2,x,new Bridge) et NDataBlock(n2,x) disparaissent
|
---|
| 271 | On remplace par NDataBlock(n2,x) {Alloc(n2,x,new Bridge);}
|
---|
| 272 | qui force le Bridge dans tout les cas puisque NDataBlock
|
---|
| 273 | ne possede pas les donnees.
|
---|
| 274 | Mais puis-je encore le faire vu que NDataBlock est a la base
|
---|
| 275 | de TVector,TMatrix et qu'il faut donc reprendre tout le code DPC
|
---|
| 276 | - Quoiqu'il arrive Alloc est une methode privee et peut donc rester
|
---|
| 277 | sous sa forme actuelle.
|
---|
| 278 |
|
---|
| 279 | \endverbatim
|
---|
| 280 | */
|
---|
[289] | 281 | template <class T>
|
---|
[944] | 282 | void NDataBlock<T>::Alloc(size_t n,T* data,Bridge* br,bool zero)
|
---|
[245] | 283 | {
|
---|
[944] | 284 | if(Debug_NDataBlock>1)
|
---|
| 285 | cout<<"?_NDataBlock::Alloc("<<this<<","
|
---|
| 286 | <<n<<","<<data<<","<<br<<") mSz="<<mSz
|
---|
| 287 | <<" mSRef="<<mSRef<<" IsTemp="<<mIsTemp<<endl;
|
---|
[268] | 288 |
|
---|
[944] | 289 | if(br && !data)
|
---|
| 290 | throw(NullPtrError("NDataBlock::Alloc br!=NULL && data==NULL\n"));
|
---|
| 291 | if(n==0) throw(SzMismatchError("NDataBlock::Alloc n==0\n"));
|
---|
[245] | 292 | if(mSRef) Delete();
|
---|
[944] | 293 | mSz = n;
|
---|
| 294 | mSRef = new NDREF;
|
---|
| 295 | mSRef->nref = 1;
|
---|
| 296 | if(data) mSRef->data = data;
|
---|
| 297 | else {mSRef->data = new T[n]; if (zero) memset(mSRef->data,0,n*sizeof(T));}
|
---|
| 298 | mSRef->bridge = br;
|
---|
[268] | 299 |
|
---|
[944] | 300 | if(Debug_NDataBlock>0) {
|
---|
| 301 | // Meme dans le cas data!=0 et br==0 (connexion d'un tableau
|
---|
| 302 | // avec destruction geree par ~NDataBlock (cas 2-) on compte
|
---|
| 303 | // comme si on avait fait une allocation du tableau (ce qui a ete
|
---|
| 304 | // fait au niveau du dessus!).
|
---|
| 305 | if(!br) NallocData++; NallocSRef++;
|
---|
| 306 | if(Debug_NDataBlock>1)
|
---|
| 307 | cout<<"...?_NDataBlock::Alloc mSz="<<mSz<<" mSRef="<<mSRef
|
---|
| 308 | <<" mSRef->nref="<<mSRef->nref<<" mSRef->data="<< mSRef->data
|
---|
| 309 | <<" mSRef->bridge="<<mSRef->bridge<<" IsTemp="<<mIsTemp
|
---|
| 310 | <<" Total("<<NallocData<<","<<NallocSRef<<")"<<endl;
|
---|
[245] | 311 | }
|
---|
[944] | 312 | }
|
---|
[245] | 313 |
|
---|
[944] | 314 | //! Management of de-allocation
|
---|
[245] | 315 | template <class T>
|
---|
| 316 | void NDataBlock<T>::Delete(void)
|
---|
| 317 | // Pour detruire les pointeurs en tenant compte des references
|
---|
| 318 | {
|
---|
[944] | 319 | if(Debug_NDataBlock>1) {
|
---|
| 320 | cout<<"?_NDataBlock::Delete("<<this<<") mSz="<<mSz
|
---|
| 321 | <<" mSRef="<<mSRef<<" IsTemp="<<mIsTemp;
|
---|
| 322 | if(mSRef)
|
---|
| 323 | cout<<" mSRef->nref="<<mSRef->nref<<" mSRef->data="
|
---|
| 324 | <<mSRef->data<<" mSRef->bridge="<<mSRef->bridge;
|
---|
| 325 | cout<<endl;
|
---|
| 326 | }
|
---|
[268] | 327 |
|
---|
[289] | 328 | if(mSRef==NULL) return;
|
---|
[245] | 329 | mSRef->nref--;
|
---|
| 330 | if(mSRef->nref != 0) {
|
---|
[268] | 331 |
|
---|
[944] | 332 | if(Debug_NDataBlock>1)
|
---|
[502] | 333 | cout<<"...?_NDataBlock::Delete() pas de desallocation il reste nref="
|
---|
| 334 | <<mSRef->nref<<" Total("<<NallocData<<","<<NallocSRef<<")"<<endl;
|
---|
[268] | 335 |
|
---|
[285] | 336 | mSz = 0; mSRef=NULL;
|
---|
[245] | 337 | return;
|
---|
| 338 | }
|
---|
[268] | 339 |
|
---|
[944] | 340 | if(Debug_NDataBlock>0) {
|
---|
| 341 | if(!mSRef->bridge) NallocData--; NallocSRef--;
|
---|
| 342 | if(Debug_NDataBlock>1)
|
---|
| 343 | cout<<"...?_NDataBlock::Delete() desallocation complete il reste nref="
|
---|
| 344 | <<mSRef->nref<<" Total("<<NallocData<<","<<NallocSRef<<")"<<endl;
|
---|
| 345 | }
|
---|
[268] | 346 |
|
---|
[245] | 347 | // Si il y a un Bridge les donnees ne n'appartiennent pas, on detruit le Bridge
|
---|
[285] | 348 | // sinon, les donnees ont ete allouees par nos soins, on libere l'espace
|
---|
| 349 | if(mSRef->bridge) delete mSRef->bridge; else delete [] mSRef->data;
|
---|
[245] | 350 | mSRef->bridge=NULL; mSRef->data=NULL;
|
---|
[285] | 351 | delete mSRef; mSRef=NULL; mSz = 0;
|
---|
[245] | 352 | }
|
---|
| 353 |
|
---|
[944] | 354 | //! Fill dats of this NDataBlock with the \b n datas pointed by \b data
|
---|
| 355 | /*!
|
---|
| 356 | \warning If class empty : allocate space in memory
|
---|
| 357 | \warning If class already connected : overwrite with minimum size
|
---|
| 358 | (\b n or \b mSz)
|
---|
| 359 | */
|
---|
[245] | 360 | template <class T>
|
---|
[257] | 361 | void NDataBlock<T>::FillFrom(size_t n,T* data)
|
---|
| 362 | // Remplissage par un tableau de donnees
|
---|
| 363 | // - Si classe vide : creation de l'espace memoire
|
---|
[289] | 364 | // - Si classe connectee : on ecrit selon la longueur minimale
|
---|
| 365 | // (cad this->mSz ou "n")
|
---|
[257] | 366 | {
|
---|
| 367 | if(data==NULL) throw(NullPtrError("NDataBlock::FillFrom data==NULL\n"));
|
---|
| 368 | if(n==0) throw(ParmError("NDataBlock::FillFrom n<=0\n"));
|
---|
[773] | 369 | if(mSRef==NULL) Alloc(n, NULL, NULL, false); // Pas de mise a zero
|
---|
[285] | 370 | if(mSz<n) n = mSz;
|
---|
[257] | 371 | memcpy(Data(),data,n*sizeof(T));
|
---|
| 372 | }
|
---|
| 373 |
|
---|
[944] | 374 | //! Re-allocate space for \b nnew datas
|
---|
| 375 | /*!
|
---|
| 376 | \param nnnew : new size
|
---|
| 377 | \param force : to manage the way re-allocation will be done (see after).
|
---|
| 378 | \verbatim
|
---|
| 379 | Re-allocation de "nnew" place memoire pour les donnees
|
---|
| 380 | avec conservation des "nold" donnees precedentes si possible.
|
---|
| 381 | "force" gere la re-allocation de la place memoire pour les donnees.
|
---|
| 382 | Divers cas se presentent:
|
---|
| 383 | a-/ *** nnew>nold force=quelconque ***
|
---|
| 384 | place re-allouee, donnees [0,nold[ copiees, surplus [nold,new[ mis a zero
|
---|
| 385 | b-/ *** nnew<=nold force=true ***
|
---|
| 386 | place re-allouee, donnees [0,nnew[ copiees, pas de surplus
|
---|
| 387 | c-/ *** nnew<=nold force=false ***
|
---|
| 388 | place non re-allouee, seule la valeur de la taille est diminuee
|
---|
| 389 | - On tient compte du partage des donnees dans tous les cas.
|
---|
| 390 | - Si il n'y a pas de donnees connectees a la classe, on re-alloue
|
---|
| 391 | dans tous les cas
|
---|
| 392 | \endverbatim
|
---|
| 393 | */
|
---|
[502] | 394 | template <class T>
|
---|
| 395 | void NDataBlock<T>::Realloc(size_t nnew,bool force)
|
---|
| 396 | {
|
---|
| 397 | if(nnew==0) throw(ParmError("NDataBlock::Realloc n<=0\n"));
|
---|
| 398 |
|
---|
| 399 | // Cas sans re-allocation memoire
|
---|
| 400 | if(mSRef && nnew<=mSz && ! force) { mSz=nnew; return;}
|
---|
| 401 |
|
---|
| 402 | // Cas avec re-allocation memoire
|
---|
| 403 | size_t ncop;
|
---|
| 404 | if(!mSRef || mSz==0) ncop=0; else if(mSz<nnew) ncop=mSz; else ncop=nnew;
|
---|
| 405 | T* dataloc = new T[nnew];
|
---|
| 406 | if(ncop>0) memcpy(dataloc,mSRef->data,ncop*sizeof(T));
|
---|
| 407 | if(nnew>ncop) memset(dataloc+ncop,0,(nnew-ncop)*sizeof(T));
|
---|
| 408 | Alloc(nnew,dataloc,NULL); //Alloc gere partage de reference et bridge
|
---|
| 409 | }
|
---|
| 410 |
|
---|
[944] | 411 | ////////////////
|
---|
| 412 | // Impression //
|
---|
| 413 | ////////////////
|
---|
[245] | 414 |
|
---|
[944] | 415 | //! Give infos and print \b n datas beginning at \b i1 on stream \b os.
|
---|
[245] | 416 | template <class T>
|
---|
[268] | 417 | void NDataBlock<T>::Print(ostream& os,size_t i1,size_t n) const
|
---|
[245] | 418 | // Impression de n elements a partir de i1
|
---|
| 419 | {
|
---|
| 420 | size_t nr = 0;
|
---|
[267] | 421 | T* p = NULL; Bridge* br = NULL;
|
---|
| 422 | if(mSRef) {nr = mSRef->nref; p = mSRef->data; br = mSRef->bridge;}
|
---|
[268] | 423 | os<<"NDataBlock::Print("<<this<<",Sz="<<mSz<<",IsTemp="<<mIsTemp<<")\n"
|
---|
| 424 | <<" mSRef="<<mSRef<<"(nref="<<nr<<",data="<<p
|
---|
| 425 | <<",bridge="<<br<<")"<<endl;
|
---|
[249] | 426 | if(i1>=mSz || n<=0 || !p) return;
|
---|
[245] | 427 | size_t i2 = i1+n; if(i2>mSz) i2=mSz;
|
---|
[269] | 428 | size_t im = 1; bool enl=false;
|
---|
[245] | 429 | while(i1<i2) {
|
---|
[257] | 430 | enl = false;
|
---|
[268] | 431 | os<<" "<<(*this)(i1); i1++;
|
---|
| 432 | if(im==8) {os<<"\n"; im=1; enl=true;} else im++;
|
---|
[245] | 433 | }
|
---|
[268] | 434 | if(!enl) os<<endl;
|
---|
[245] | 435 | }
|
---|
| 436 |
|
---|
[944] | 437 | //////////////////////////////////////////////
|
---|
| 438 | // Calcul de la somme / produit des donnees //
|
---|
| 439 | //////////////////////////////////////////////
|
---|
[289] | 440 |
|
---|
[944] | 441 | //! Return sum of \b n datas beginning at data \b i1.
|
---|
[289] | 442 | template <class T>
|
---|
| 443 | T NDataBlock<T>::Sum(size_t i1,size_t n) const
|
---|
| 444 | // Somme des elements de i1 a i1+n-1
|
---|
| 445 | {
|
---|
| 446 | if(i1>=mSz) return 0;
|
---|
| 447 | if(n>mSz) n = mSz; if(n==0) n = mSz-i1;
|
---|
| 448 | T const *p=Begin()+i1, *pe=p+n;
|
---|
| 449 | T val = 0;
|
---|
| 450 | while (p<pe) val += *p++;
|
---|
| 451 | return val;
|
---|
| 452 | }
|
---|
| 453 |
|
---|
[944] | 454 | //! Return product of \b n datas beginning at data \b i1.
|
---|
[289] | 455 | template <class T>
|
---|
| 456 | T NDataBlock<T>::Product(size_t i1,size_t n) const
|
---|
| 457 | // Produit des elements de i1 a i1+n-1
|
---|
| 458 | {
|
---|
| 459 | if(i1>=mSz) return 0;
|
---|
| 460 | if(n>mSz) n = mSz; if(n==0) n = mSz-i1;
|
---|
| 461 | T const *p=Begin()+i1, *pe=p+n;
|
---|
| 462 | T val = 0;
|
---|
| 463 | while (p<pe) val *= *p++;
|
---|
| 464 | return val;
|
---|
| 465 | }
|
---|
| 466 |
|
---|
[944] | 467 | ///////////////////////////////////////////////////////////////
|
---|
| 468 | // Surcharge de = : NDataBlock=NDataBlock; NDataBlock=<T> b; //
|
---|
| 469 | ///////////////////////////////////////////////////////////////
|
---|
[245] | 470 |
|
---|
[944] | 471 | //! Operator = : ND = ND1
|
---|
| 472 | /*! \warning share if \b a is temporary, clone if not */
|
---|
[245] | 473 | template <class T>
|
---|
[268] | 474 | NDataBlock<T>& NDataBlock<T>::operator = (const NDataBlock<T>& a)
|
---|
[289] | 475 | // Affectation: partage des donnees si "a" temporaire, clone sinon.
|
---|
[245] | 476 | {
|
---|
[944] | 477 | if(Debug_NDataBlock>1)
|
---|
| 478 | cout<<"?_NDataBlock::operator=("<<this<<","<<&a<<") a.(mSz="
|
---|
| 479 | <<a.mSz<<" mSRef="<<a.mSRef<<" IsTemp="<<a.IsTemp()
|
---|
| 480 | <<"), mSz="<<mSz<<" mSRef="<<mSRef<<" IsTemp="<<mIsTemp<<endl;
|
---|
[268] | 481 |
|
---|
[245] | 482 | if(this == &a) return *this;
|
---|
[289] | 483 | if(a.mSz==0)
|
---|
| 484 | throw(SzMismatchError("NDataBlock::operator=A null size\n"));
|
---|
| 485 | CloneOrShare(a);
|
---|
[245] | 486 | return *this;
|
---|
| 487 | }
|
---|
| 488 |
|
---|
[944] | 489 | //! Operator = : ND = \b v (at dats set to \b v).
|
---|
[245] | 490 | template <class T>
|
---|
[249] | 491 | NDataBlock<T>& NDataBlock<T>::operator = (T v)
|
---|
[289] | 492 | // Affectation de tous les elements a une constante "v"
|
---|
[245] | 493 | {
|
---|
[944] | 494 | if(Debug_NDataBlock>1)
|
---|
| 495 | cout<<"?_NDataBlock::operator=("<<this<<","<<v<<")"
|
---|
| 496 | <<" mSz="<<mSz<<" mSRef="<<mSRef<<" IsTemp="<<mIsTemp<<endl;
|
---|
[268] | 497 |
|
---|
[944] | 498 |
|
---|
[245] | 499 | if(mSz==0) throw(SzMismatchError("NDataBlock::operator=v null size\n"));
|
---|
[249] | 500 | T *p=Begin(), *pe=End();
|
---|
[245] | 501 | while (p<pe) *p++ = v;
|
---|
| 502 | return *this;
|
---|
| 503 | }
|
---|
| 504 |
|
---|
[944] | 505 | //////////////////////////////////////////////////////////////
|
---|
| 506 | // Surcharge de +=,-=,*=,/= (INPLACE): NDataBlock += <T> b; //
|
---|
| 507 | //////////////////////////////////////////////////////////////
|
---|
[245] | 508 |
|
---|
[944] | 509 | //! Add a constant : ND += b
|
---|
[245] | 510 | template <class T>
|
---|
| 511 | NDataBlock<T>& NDataBlock<T>::operator += (T b)
|
---|
| 512 | {
|
---|
| 513 | if(mSz==0) throw(SzMismatchError("NDataBlock::operator+=v null size\n"));
|
---|
[249] | 514 | T *p=Begin(), *pe=End();
|
---|
[245] | 515 | while (p<pe) *p++ += b;
|
---|
| 516 | return *this;
|
---|
| 517 | }
|
---|
| 518 |
|
---|
[944] | 519 | //! Substract a constant : ND -= b
|
---|
[245] | 520 | template <class T>
|
---|
| 521 | NDataBlock<T>& NDataBlock<T>::operator -= (T b)
|
---|
| 522 | {
|
---|
| 523 | if(mSz==0) throw(SzMismatchError("NDataBlock::operator-=v null size\n"));
|
---|
[249] | 524 | T *p=Begin(), *pe=End();
|
---|
[245] | 525 | while (p<pe) *p++ -= b;
|
---|
| 526 | return *this;
|
---|
| 527 | }
|
---|
| 528 |
|
---|
[944] | 529 | //! Multiply by a constant : ND *= b
|
---|
[245] | 530 | template <class T>
|
---|
| 531 | NDataBlock<T>& NDataBlock<T>::operator *= (T b)
|
---|
| 532 | {
|
---|
| 533 | if(mSz==0) throw(SzMismatchError("NDataBlock::operator*=v null size\n"));
|
---|
[249] | 534 | T *p=Begin(), *pe=End();
|
---|
[245] | 535 | while (p<pe) *p++ *= b;
|
---|
| 536 | return *this;
|
---|
| 537 | }
|
---|
| 538 |
|
---|
[944] | 539 | //! Divide by a constant : ND *= b
|
---|
[245] | 540 | template <class T>
|
---|
| 541 | NDataBlock<T>& NDataBlock<T>::operator /= (T b)
|
---|
| 542 | {
|
---|
[249] | 543 | if(b==(T) 0) throw(ParmError("NDataBlock::operator/=v divide by zero\n"));
|
---|
[245] | 544 | if(mSz==0) throw(SzMismatchError("NDataBlock::operator/=v null size\n"));
|
---|
[249] | 545 | T *p=Begin(), *pe=End();
|
---|
[245] | 546 | while (p<pe) *p++ /= b;
|
---|
| 547 | return *this;
|
---|
| 548 | }
|
---|
| 549 |
|
---|
[944] | 550 | ////////////////////////////////////////////////////////////////////
|
---|
| 551 | // Surcharge de +=,-=,*=,/= (INPLACE): NDataBlock += NDataBlock1; //
|
---|
| 552 | ////////////////////////////////////////////////////////////////////
|
---|
[245] | 553 |
|
---|
[944] | 554 | //! Add a NDataBlock : ND += ND1
|
---|
[245] | 555 | template <class T>
|
---|
[268] | 556 | NDataBlock<T>& NDataBlock<T>::operator += (const NDataBlock<T>& a)
|
---|
[245] | 557 | {
|
---|
[265] | 558 | if(mSz==0 || mSz!=a.mSz)
|
---|
| 559 | throw(SzMismatchError("NDataBlock::operator+=A size mismatch/null"));
|
---|
[268] | 560 | T *p=Begin(), *pe=End();
|
---|
| 561 | T const * pa=a.Begin();
|
---|
[289] | 562 | while (p<pe) *p++ += *pa++;
|
---|
[245] | 563 | return *this;
|
---|
| 564 | }
|
---|
| 565 |
|
---|
[944] | 566 | //! Substract a NDataBlock : ND -= ND1
|
---|
[245] | 567 | template <class T>
|
---|
[268] | 568 | NDataBlock<T>& NDataBlock<T>::operator -= (const NDataBlock<T>& a)
|
---|
[245] | 569 | {
|
---|
[265] | 570 | if(mSz==0 || mSz!=a.mSz)
|
---|
| 571 | throw(SzMismatchError("NDataBlock::operator-=A size mismatch/null"));
|
---|
[268] | 572 | T *p=Begin(), *pe=End();
|
---|
| 573 | T const *pa=a.Begin();
|
---|
[289] | 574 | while (p<pe) *p++ -= *pa++;
|
---|
[245] | 575 | return *this;
|
---|
| 576 | }
|
---|
| 577 |
|
---|
[944] | 578 | //! Multiply by a NDataBlock : ND *= ND1
|
---|
[245] | 579 | template <class T>
|
---|
[268] | 580 | NDataBlock<T>& NDataBlock<T>::operator *= (const NDataBlock<T>& a)
|
---|
[245] | 581 | {
|
---|
[265] | 582 | if(mSz==0 || mSz!=a.mSz)
|
---|
| 583 | throw(SzMismatchError("NDataBlock::operator*=A size mismatch/null"));
|
---|
[268] | 584 | T *p=Begin(), *pe=End();
|
---|
| 585 | T const *pa=a.Begin();
|
---|
[289] | 586 | while (p<pe) *p++ *= *pa++;
|
---|
[245] | 587 | return *this;
|
---|
| 588 | }
|
---|
| 589 |
|
---|
[944] | 590 | //! Divide by a NDataBlock : ND *= ND1
|
---|
[245] | 591 | template <class T>
|
---|
[268] | 592 | NDataBlock<T>& NDataBlock<T>::operator /= (const NDataBlock<T>& a)
|
---|
[289] | 593 | // Attention, aucune protection si un element de "a" est nul.
|
---|
[245] | 594 | {
|
---|
[265] | 595 | if(mSz==0 || mSz!=a.mSz)
|
---|
| 596 | throw(SzMismatchError("NDataBlock::operator/=A size mismatch/null"));
|
---|
[268] | 597 | T *p=Begin(), *pe=End();
|
---|
| 598 | T const *pa=a.Begin();
|
---|
[245] | 599 | while (p<pe) *p++ /= *pa++;
|
---|
| 600 | return *this;
|
---|
| 601 | }
|
---|
| 602 |
|
---|
[275] | 603 | ////////////////////////////////////////////////////////////////
|
---|
[944] | 604 | // Pour surcharge de +,-,*,/ : NDataBlock = NDataBlock1+<T>b; //
|
---|
| 605 | // NDataBlock = <T>b+NDataBlock1; //
|
---|
| 606 | ////////////////////////////////////////////////////////////////
|
---|
[245] | 607 |
|
---|
[944] | 608 | //! Add a constant and return NDataBlock : NDret = ND + b
|
---|
[245] | 609 | template <class T>
|
---|
[268] | 610 | NDataBlock<T> NDataBlock<T>::Add(T b) const
|
---|
[257] | 611 | // Pour A+b
|
---|
[245] | 612 | {
|
---|
[289] | 613 | NDataBlock<T> result(*this); result.SetTemp(true);
|
---|
[268] | 614 | result += b;
|
---|
| 615 | return result;
|
---|
[245] | 616 | }
|
---|
| 617 |
|
---|
[944] | 618 | //! Substract a constant and return NDataBlock : NDret = ND - b
|
---|
[245] | 619 | template <class T>
|
---|
[268] | 620 | NDataBlock<T> NDataBlock<T>::Sub(T b) const
|
---|
[257] | 621 | // Pour A-b
|
---|
[245] | 622 | {
|
---|
[289] | 623 | NDataBlock<T> result(*this); result.SetTemp(true);
|
---|
[259] | 624 | return result -= b;
|
---|
[245] | 625 | }
|
---|
| 626 |
|
---|
[944] | 627 | //! Substract from a constant and return NDataBlock : NDret = b - ND
|
---|
[245] | 628 | template <class T>
|
---|
[268] | 629 | NDataBlock<T> NDataBlock<T>::SubInv(T b) const
|
---|
[257] | 630 | // Pour b-A
|
---|
[245] | 631 | {
|
---|
[289] | 632 | NDataBlock<T> result(*this); result.SetTemp(true);
|
---|
[268] | 633 | T *p=result.Begin(), *pe=result.End();
|
---|
| 634 | T const *pa=this->Begin();
|
---|
[245] | 635 | while(p<pe) {*p++ = b - *pa++;}
|
---|
| 636 | return result;
|
---|
| 637 | }
|
---|
| 638 |
|
---|
[944] | 639 | //! Multiply by a constant and return NDataBlock : NDret = ND * b
|
---|
[245] | 640 | template <class T>
|
---|
[268] | 641 | NDataBlock<T> NDataBlock<T>::Mul(T b) const
|
---|
[257] | 642 | // Pour A*b
|
---|
[245] | 643 | {
|
---|
[289] | 644 | NDataBlock<T> result(*this); result.SetTemp(true);
|
---|
[259] | 645 | return result *= b;
|
---|
[245] | 646 | }
|
---|
| 647 |
|
---|
[944] | 648 | //! Divide by a constant and return NDataBlock : NDret = ND / b
|
---|
[245] | 649 | template <class T>
|
---|
[268] | 650 | NDataBlock<T> NDataBlock<T>::Div(T b) const
|
---|
[257] | 651 | // Pour A/b
|
---|
[245] | 652 | {
|
---|
[289] | 653 | NDataBlock<T> result(*this); result.SetTemp(true);
|
---|
[259] | 654 | return result /= b;
|
---|
[245] | 655 | }
|
---|
| 656 |
|
---|
[944] | 657 | //! Divide from a constant and return NDataBlock : NDret = b / ND
|
---|
[245] | 658 | template <class T>
|
---|
[268] | 659 | NDataBlock<T> NDataBlock<T>::DivInv(T b) const
|
---|
[257] | 660 | // Pour b/A
|
---|
[245] | 661 | {
|
---|
[289] | 662 | NDataBlock<T> result(*this); result.SetTemp(true);
|
---|
[268] | 663 | T *p=result.Begin(), *pe=result.End();
|
---|
| 664 | T const *pa = this->Begin();
|
---|
[245] | 665 | while(p<pe) {*p++ = b / *pa++;}
|
---|
| 666 | return result;
|
---|
| 667 | }
|
---|
| 668 |
|
---|
[944] | 669 | ///////////////////////////////////////////////////////////////////////
|
---|
| 670 | // Pour surcharge de +,-,*,/ : NDataBlock = NDataBlock1+NDataBlock2; //
|
---|
| 671 | ///////////////////////////////////////////////////////////////////////
|
---|
[245] | 672 |
|
---|
[944] | 673 | //! Add a NDataBlock and return a NDataBlock: ND = NDthis + NDb
|
---|
[245] | 674 | template <class T>
|
---|
[268] | 675 | NDataBlock<T> NDataBlock<T>::Add(const NDataBlock<T>& b) const
|
---|
[257] | 676 | // Pour A+B
|
---|
[245] | 677 | {
|
---|
[285] | 678 | if(mSz!=b.mSz)
|
---|
[265] | 679 | throw(SzMismatchError("NDataBlock operator C=A+B size mismatch/null\n"));
|
---|
[268] | 680 | NDataBlock<T> result; result.SetTemp(true);
|
---|
[289] | 681 | if(b.IsTemp()) {result.Share(b); result += *this;}
|
---|
| 682 | else {result.CloneOrShare(*this); result += b;}
|
---|
[268] | 683 | return result;
|
---|
[245] | 684 | }
|
---|
| 685 |
|
---|
[944] | 686 | //! Multiply by a NDataBlock and return a NDataBlock: ND = NDthis * NDb
|
---|
[245] | 687 | template <class T>
|
---|
[268] | 688 | NDataBlock<T> NDataBlock<T>::Mul(const NDataBlock<T>& b) const
|
---|
[257] | 689 | // Pour A*B
|
---|
[245] | 690 | {
|
---|
[285] | 691 | if(mSz!=b.mSz)
|
---|
[265] | 692 | throw(SzMismatchError("NDataBlock operator C=A*B size mismatch/null\n"));
|
---|
[268] | 693 | NDataBlock<T> result; result.SetTemp(true);
|
---|
[289] | 694 | if(b.IsTemp()) {result.Share(b); result *= *this;}
|
---|
| 695 | else {result.CloneOrShare(*this); result *= b;}
|
---|
[268] | 696 | return result;
|
---|
[245] | 697 | }
|
---|
| 698 |
|
---|
[944] | 699 | //! Substract a NDataBlock and return a NDataBlock: ND = NDthis - NDb
|
---|
[245] | 700 | template <class T>
|
---|
[268] | 701 | NDataBlock<T> NDataBlock<T>::Sub(const NDataBlock<T>& b) const
|
---|
[257] | 702 | // Pour A-B
|
---|
[245] | 703 | {
|
---|
[285] | 704 | if(mSz!=b.mSz)
|
---|
[265] | 705 | throw(SzMismatchError("NDataBlock operator C=A-B size mismatch/null\n"));
|
---|
[268] | 706 | NDataBlock<T> result; result.SetTemp(true);
|
---|
[245] | 707 | if(b.IsTemp()) {
|
---|
[268] | 708 | result.Share(b);
|
---|
[289] | 709 | T *p=result.Begin(), *pe=result.End(); T const *pa=Begin();
|
---|
[245] | 710 | while(p<pe) {*p = *pa++ - *p; p++;}
|
---|
[289] | 711 | } else {result.CloneOrShare(*this); result -= b;}
|
---|
[268] | 712 | return result;
|
---|
[245] | 713 | }
|
---|
| 714 |
|
---|
[944] | 715 | //! Divide by a NDataBlock and return a NDataBlock: ND = NDthis / NDb
|
---|
[245] | 716 | template <class T>
|
---|
[268] | 717 | NDataBlock<T> NDataBlock<T>::Div(const NDataBlock<T>& b) const
|
---|
[257] | 718 | // Pour A/B
|
---|
[245] | 719 | {
|
---|
[285] | 720 | if(mSz!=b.mSz)
|
---|
[265] | 721 | throw(SzMismatchError("NDataBlock operator C=A/B size mismatch/null\n"));
|
---|
[268] | 722 | NDataBlock<T> result; result.SetTemp(true);
|
---|
[245] | 723 | if(b.IsTemp()) {
|
---|
[268] | 724 | result.Share(b);
|
---|
[289] | 725 | T *p=result.Begin(), *pe=result.End(); T const *pa=Begin();
|
---|
[245] | 726 | while(p<pe) {*p = *pa++ / *p; p++;}
|
---|
[289] | 727 | } else {result.CloneOrShare(*this); result /= b;}
|
---|
[268] | 728 | return result;
|
---|
[245] | 729 | }
|
---|
| 730 |
|
---|
[269] | 731 |
|
---|
[275] | 732 | ///////////////////////////////////////////////////////////////
|
---|
[245] | 733 | #ifdef __CXX_PRAGMA_TEMPLATES__
|
---|
| 734 | #pragma define_template NDataBlock<uint_1>
|
---|
| 735 | #pragma define_template NDataBlock<uint_2>
|
---|
| 736 | #pragma define_template NDataBlock<int_2>
|
---|
| 737 | #pragma define_template NDataBlock<int_4>
|
---|
| 738 | #pragma define_template NDataBlock<int_8>
|
---|
| 739 | #pragma define_template NDataBlock<uint_4>
|
---|
| 740 | #pragma define_template NDataBlock<uint_8>
|
---|
| 741 | #pragma define_template NDataBlock<r_4>
|
---|
| 742 | #pragma define_template NDataBlock<r_8>
|
---|
[802] | 743 | #pragma define_template NDataBlock< complex<r_4> >
|
---|
| 744 | #pragma define_template NDataBlock< complex<r_8> >
|
---|
[245] | 745 | #endif
|
---|
| 746 |
|
---|
[269] | 747 | #if defined(ANSI_TEMPLATES) || defined(GNU_TEMPLATES)
|
---|
[245] | 748 | template class NDataBlock<uint_1>;
|
---|
| 749 | template class NDataBlock<uint_2>;
|
---|
| 750 | template class NDataBlock<int_2>;
|
---|
| 751 | template class NDataBlock<int_4>;
|
---|
| 752 | template class NDataBlock<int_8>;
|
---|
| 753 | template class NDataBlock<uint_4>;
|
---|
| 754 | template class NDataBlock<uint_8>;
|
---|
| 755 | template class NDataBlock<r_4>;
|
---|
| 756 | template class NDataBlock<r_8>;
|
---|
[802] | 757 | template class NDataBlock< complex<r_4> >;
|
---|
| 758 | template class NDataBlock< complex<r_8> >;
|
---|
[245] | 759 | #endif
|
---|