source: Sophya/trunk/SophyaLib/BaseTools/ndatablock.cc@ 273

Last change on this file since 273 was 273, checked in by ansari, 26 years ago

Pb instances FIO_NDataBlock<T> Reza 27/04/99

File size: 18.6 KB
Line 
1// Gestion de block de donnees avec partage de references
2// C.Magneville 04/99
3// LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA
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#include "objfio.h"
12
13using namespace PlanckDPC;
14
15//define DEBUG_NDATABLOCK
16
17#ifdef DEBUG_NDATABLOCK
18 static size_t NallocData = 0;
19 static size_t NallocSRef = 0;
20#endif
21
22// LOGIQUE DE BASE:
23// - le createur par copie et la surcharge de l operateur = "partage" les donnees
24// - gestion du partage de reference
25
26//************ Createur, Destructeur, gestion des donnees
27
28template <class T>
29NDataBlock<T>::NDataBlock(size_t n)
30// Createur d'une structure de "n" donnees
31: mSz(0), mSRef(NULL), mIsTemp(false)
32{
33#ifdef DEBUG_NDATABLOCK
34cout<<"DEBUG_NDataBlock::NDataBlock("<<this<<",n="<<n<<")"<<endl;
35#endif
36
37Alloc(n);
38}
39
40template <class T>
41NDataBlock<T>::NDataBlock(size_t n, T* data, Bridge* br)
42// Createur d'une structure de "n" donnees, avec donnees preallouees
43: mSz(0), mSRef(NULL), mIsTemp(false)
44{
45#ifdef DEBUG_NDATABLOCK
46cout<<"DEBUG_NDataBlock::NDataBlock("<<this
47 <<",data="<<data<<",br="<<br<<")"<<endl;
48#endif
49
50Alloc(n,data,br);
51}
52
53template <class T>
54NDataBlock<T>::NDataBlock()
55// Createur par default
56: mSz(0), mSRef(NULL), mIsTemp(false)
57{
58#ifdef DEBUG_NDATABLOCK
59cout<<"DEBUG_NDataBlock::NDataBlock("<<this<<") default"<<endl;
60#endif
61}
62
63template <class T>
64NDataBlock<T>::NDataBlock(const NDataBlock<T>& a)
65// Createur par copie
66// ATTENTION: partage les donnees avec "a"
67// Ecriture: NDataBlock a = b;
68// NDataBlock a(b)
69: mSz(0), mSRef(NULL), mIsTemp(false)
70{
71#ifdef DEBUG_NDATABLOCK
72cout<<"DEBUG_NDataBlock::NDataBlock("<<this<<",&a="<<&a<<") a.(mSz="
73 <<a.mSz<<" mSRef="<<a.mSRef<<" IsTemp="<<a.IsTemp()<<")"<<endl;
74#endif
75
76Share(a);
77}
78
79template <class T>
80NDataBlock<T>::NDataBlock(const NDataBlock<T>& a,bool share)
81// Createur avec choix de partager ou non
82: mSz(0), mSRef(NULL), mIsTemp(false)
83{
84#ifdef DEBUG_NDATABLOCK
85cout<<"DEBUG_NDataBlock::NDataBlock("<<this<<",&a="<<&a<<",sh=<<"<<share<<")"
86 <<" a.(mSz="<<a.mSz<<" mSRef="<<a.mSRef<<" IsTemp="<<a.IsTemp()<<")"<<endl;
87#endif
88
89if(share) Share(a); else Clone(a);
90}
91
92template <class T>
93NDataBlock<T>::~NDataBlock()
94// Destructeur
95{
96#ifdef DEBUG_NDATABLOCK
97cout<<"DEBUG_NDataBlock::~NDataBlock("<<this<<")"<<endl;
98#endif
99
100Delete();
101}
102
103template <class T>
104void NDataBlock<T>::SetTemp(bool temp) const
105// Set temporary
106{
107mIsTemp=temp;
108
109#ifdef DEBUG_NDATABLOCK
110cout<<"DEBUG_NDataBlock::SetTemp("<<this<<","<<temp
111 <<"), mSz="<<mSz<<" mSRef="<<mSRef<<" IsTemp="<<mIsTemp<<endl;
112#endif
113}
114
115template <class T>
116void NDataBlock<T>::Alloc(size_t n,T* data,Bridge* br)
117// Allocation d'un NOUVEL espace de stoquage
118// Si data==NULL : allocation de l'espace memoire
119// data!=NULL : partage des donnees avec l'adresse data
120// Si br==NULL : les donnees nous appartiennent
121// br!=NULL : les donnees ne nous appartiennent pas (ex Blitz)
122// Exemple: on veut connecter a un tableau de T*
123// -- On veut que NDataBlock ne desalloue pas le tableau
124// float *x = new float[5]; ... remplissage de x[] ...;
125// NDataBlock A(5,x,new Bridge);
126// delete [] x; // Il faut deleter explicitement
127// -- On veut que NDataBlock desalloue le tableau
128// ( Ne Pas Faire "delete [] x;" )
129// float *x = new float[5]; ... remplissage de x[] ...;
130// NDataBlock A(5,x);
131// -- Autre solution:
132// NDataBlock A(5); A.FillFrom(5,x);
133{
134#ifdef DEBUG_NDATABLOCK
135cout<<"DEBUG_NDataBlock::Alloc("<<this<<","
136 <<n<<","<<data<<","<<br<<") mSz="<<mSz
137 <<" mSRef="<<mSRef<<" IsTemp="<<mIsTemp<<endl;
138#endif
139
140if(n==0) throw(SzMismatchError("NDataBlock::Alloc n==0\n"));
141if(mSRef) Delete();
142mSz = n;
143mSRef = new NDREF;
144mSRef->nref = 1;
145if(data) mSRef->data = data; else mSRef->data = new T[n];
146mSRef->bridge = br;
147
148#ifdef DEBUG_NDATABLOCK
149if(!data) NallocData++; NallocSRef++;
150cout<<"...DEBUG_NDataBlock::Alloc mSz="<<mSz<<" mSRef="<<mSRef
151 <<" mSRef->nref="<<mSRef->nref<<" mSRef->data="<< mSRef->data
152 <<" mSRef->bridge="<<mSRef->bridge<<" IsTemp="<<mIsTemp
153 <<" Total("<<NallocData<<","<<NallocSRef<<")"<<endl;
154#endif
155}
156
157template <class T>
158void NDataBlock<T>::Clone(const NDataBlock<T>& a)
159// Clone (copie de donnee) a partir de "a"
160{
161 #ifdef DEBUG_NDATABLOCK
162 cout<<"DEBUG_NDataBlock::Clone("<<this<<","<<&a<<") a.(mSz="
163 <<a.mSz<<" mSRef="<<a.mSRef<<" IsTemp="<<a.IsTemp()
164 <<"), mSz="<<mSz<<" mSRef="<<mSRef<<" IsTemp="<<mIsTemp<<endl;
165 #endif
166if(!a.mSRef) {mSz=0; mSRef=NULL;} // cas ou "a" est cree par defaut
167else if(a.IsTemp()) Share(a);
168else {Alloc(a.mSz); memcpy(Data(),a.Data(),mSz*sizeof(T));}
169}
170
171template <class T>
172void NDataBlock<T>::Share(const NDataBlock<T>& a)
173// Partage des donnees avec "a"
174{
175#ifdef DEBUG_NDATABLOCK
176cout<<"DEBUG_NDataBlock::Share("<<this<<","<<&a<<")";
177if(&a!=NULL) cout<<" a.(mSz="<<a.mSz<<" mSRef="<<a.mSRef
178 <<" IsTemp="<<a.IsTemp()<<")";
179cout<<", mSz="<<mSz<<" mSRef="<<mSRef<<" IsTemp="<<mIsTemp<<endl;
180#endif
181
182if(&a==NULL) throw(NullPtrError("NDataBlock::Share &a==NULL\n"));
183// on ne peut partager si "a" pas alloue
184if(!a.mSRef) throw(NullPtrError("NDataBlock::Share not allocated a\n"));
185if(mSRef) Delete();
186mSz = a.mSz; mSRef = a.mSRef; mSRef->nref++;
187
188#ifdef DEBUG_NDATABLOCK
189cout<<"...DEBUG_NDataBlock::Share mSz="<<mSz<<" mSRef="<<mSRef
190 <<" mSRef->nref="<<mSRef->nref<<" mSRef->data="<< mSRef->data
191 <<" mSRef->bridge="<<mSRef->bridge<<" IsTemp="<<mIsTemp<<endl;
192#endif
193}
194
195template <class T>
196void NDataBlock<T>::Delete(void)
197// Pour detruire les pointeurs en tenant compte des references
198{
199#ifdef DEBUG_NDATABLOCK
200cout<<"DEBUG_NDataBlock::Delete("<<this<<") mSz="<<mSz
201 <<" mSRef="<<mSRef<<" IsTemp="<<mIsTemp;
202if(mSRef)
203 cout<<" mSRef->nref="<<mSRef->nref<<" mSRef->data="
204 <<mSRef->data<<" mSRef->bridge="<<mSRef->bridge;
205cout<<endl;
206#endif
207
208if(mSRef==NULL) return; // cas du createur par defaut
209mSRef->nref--;
210if(mSRef->nref != 0) {
211
212#ifdef DEBUG_NDATABLOCK
213cout<<"...DEBUG_NDataBlock::Delete() pas de desallocation il reste nref="
214 <<mSRef->nref<<endl;
215#endif
216
217 return;
218}
219
220#ifdef DEBUG_NDATABLOCK
221if(!mSRef->bridge) NallocData--; NallocSRef--;
222cout<<"...DEBUG_NDataBlock::Delete() desallocation complete il reste nref="
223 <<mSRef->nref<<" Total("<<NallocData<<","<<NallocSRef<<")"<<endl;
224#endif
225
226// Si il y a un Bridge les donnees ne n'appartiennent pas, on detruit le Bridge
227if(mSRef->bridge) delete mSRef->bridge;
228// sinon, les donnees ont ete allouees par nos soins, on libere l'espace memoire
229else delete [] mSRef->data;
230mSRef->bridge=NULL; mSRef->data=NULL;
231delete mSRef; mSRef=NULL;
232}
233
234template <class T>
235void NDataBlock<T>::Reset(T v)
236{
237if(mSRef==NULL) return;
238if(mSRef->data==NULL) return;
239if(mSz==0) return;
240T *p=Begin(), *pe=End();
241while(p<pe) *p++ = v;
242}
243
244template <class T>
245void NDataBlock<T>::ReSize(size_t n)
246// Re-dimension, dans ce cas re-allocation de la place
247{
248// Pas de realloc, si pas de changement de taille ?
249if (n == mSz) return; // $CHECK$ A verifier , Reza 26/04/99
250Alloc(n);
251}
252
253template <class T>
254void NDataBlock<T>::FillFrom(size_t n,T* data)
255// Remplissage par un tableau de donnees
256// - Si classe vide : creation de l'espace memoire
257// - Si classe connectee : on ecrit selon la longueur
258{
259if(data==NULL) throw(NullPtrError("NDataBlock::FillFrom data==NULL\n"));
260if(n==0) throw(ParmError("NDataBlock::FillFrom n<=0\n"));
261if(mSRef==NULL) Alloc(n); // cas du createur par default
262if(mSz<n) n= mSz;
263memcpy(Data(),data,n*sizeof(T));
264}
265
266//**** Impression
267
268template <class T>
269void NDataBlock<T>::Print(ostream& os,size_t i1,size_t n) const
270// Impression de n elements a partir de i1
271{
272size_t nr = 0;
273T* p = NULL; Bridge* br = NULL;
274if(mSRef) {nr = mSRef->nref; p = mSRef->data; br = mSRef->bridge;}
275os<<"NDataBlock::Print("<<this<<",Sz="<<mSz<<",IsTemp="<<mIsTemp<<")\n"
276 <<" mSRef="<<mSRef<<"(nref="<<nr<<",data="<<p
277 <<",bridge="<<br<<")"<<endl;
278if(i1>=mSz || n<=0 || !p) return;
279size_t i2 = i1+n; if(i2>mSz) i2=mSz;
280size_t im = 1; bool enl=false;
281while(i1<i2) {
282 enl = false;
283 os<<" "<<(*this)(i1); i1++;
284 if(im==8) {os<<"\n"; im=1; enl=true;} else im++;
285}
286if(!enl) os<<endl;
287}
288
289//**** Surcharge de = : NDataBlock=NDataBlock; NDataBlock=<T> b;
290
291template <class T>
292NDataBlock<T>& NDataBlock<T>::operator = (const NDataBlock<T>& a)
293// surcharge avec partage des donnees
294// Ecriture: NDataBlock a; a = b;
295// NDataBlock a(10); a = b; (a est re-affecte)
296{
297#ifdef DEBUG_NDATABLOCK
298cout<<"DEBUG_NDataBlock::operator=("<<this<<","<<&a<<") a.(mSz="
299 <<a.mSz<<" mSRef="<<a.mSRef<<" IsTemp="<<a.IsTemp()
300 <<"), mSz="<<mSz<<" mSRef="<<mSRef<<" IsTemp="<<mIsTemp<<endl;
301#endif
302
303if(this == &a) return *this;
304if(a.mSz!=mSz)
305 throw(SzMismatchError("NDataBlock::operator=A size mismatch/null\n"));
306Share(a);
307return *this;
308}
309
310template <class T>
311NDataBlock<T>& NDataBlock<T>::operator = (T v)
312// surcharge avec copie des donnees (pas de partage)
313// "this" est sur-ecrit, attention au partage de reference!
314// NDataBlock a; a = v; ou bien NDataBlock a(10); a = v;
315{
316#ifdef DEBUG_NDATABLOCK
317cout<<"DEBUG_NDataBlock::operator=("<<this<<","<<v<<")"
318 <<" mSz="<<mSz<<" mSRef="<<mSRef<<" IsTemp="<<mIsTemp<<endl;
319#endif
320
321if(mSz==0) throw(SzMismatchError("NDataBlock::operator=v null size\n"));
322T *p=Begin(), *pe=End();
323while (p<pe) *p++ = v;
324return *this;
325}
326
327template <class T>
328T NDataBlock<T>::Sum(size_t i1,size_t n) const
329// Somme des elements de i1 a i1+n-1
330{
331if(i1>=mSz) return 0;
332if(n>mSz) n = mSz; if(n==0) n = mSz-i1;
333T const *p=Begin()+i1, *pe=p+n;
334T val = 0;
335while (p<pe) val += *p++;
336return val;
337}
338
339template <class T>
340T NDataBlock<T>::Product(size_t i1,size_t n) const
341// Produit des elements de i1 a i1+n-1
342{
343if(i1>=mSz) return 0;
344if(n>mSz) n = mSz; if(n==0) n = mSz-i1;
345T const *p=Begin()+i1, *pe=p+n;
346T val = 0;
347while (p<pe) val *= *p++;
348return val;
349}
350
351//**** Surcharge de +=,-=,*=,/= (INPLACE): NDataBlock += <T> b;
352
353template <class T>
354NDataBlock<T>& NDataBlock<T>::operator += (T b)
355{
356if(mSz==0) throw(SzMismatchError("NDataBlock::operator+=v null size\n"));
357T *p=Begin(), *pe=End();
358while (p<pe) *p++ += b;
359return *this;
360}
361
362template <class T>
363NDataBlock<T>& NDataBlock<T>::operator -= (T b)
364{
365if(mSz==0) throw(SzMismatchError("NDataBlock::operator-=v null size\n"));
366T *p=Begin(), *pe=End();
367while (p<pe) *p++ -= b;
368return *this;
369}
370
371template <class T>
372NDataBlock<T>& NDataBlock<T>::operator *= (T b)
373{
374if(mSz==0) throw(SzMismatchError("NDataBlock::operator*=v null size\n"));
375T *p=Begin(), *pe=End();
376while (p<pe) *p++ *= b;
377return *this;
378}
379
380template <class T>
381NDataBlock<T>& NDataBlock<T>::operator /= (T b)
382{
383if(b==(T) 0) throw(ParmError("NDataBlock::operator/=v divide by zero\n"));
384if(mSz==0) throw(SzMismatchError("NDataBlock::operator/=v null size\n"));
385T *p=Begin(), *pe=End();
386while (p<pe) *p++ /= b;
387return *this;
388}
389
390//**** Surcharge de +=,-=,*=,/= (INPLACE): NDataBlock += NDataBlock;
391
392template <class T>
393NDataBlock<T>& NDataBlock<T>::operator += (const NDataBlock<T>& a)
394{
395if(mSz==0 || mSz!=a.mSz)
396 throw(SzMismatchError("NDataBlock::operator+=A size mismatch/null"));
397T *p=Begin(), *pe=End();
398T const * pa=a.Begin();
399while (p<pe) *p++ += *pa++; // ca marche meme si *this=a
400return *this;
401}
402
403template <class T>
404NDataBlock<T>& NDataBlock<T>::operator -= (const NDataBlock<T>& a)
405{
406if(mSz==0 || mSz!=a.mSz)
407 throw(SzMismatchError("NDataBlock::operator-=A size mismatch/null"));
408T *p=Begin(), *pe=End();
409T const *pa=a.Begin();
410while (p<pe) *p++ -= *pa++; // ca marche meme si *this=a
411return *this;
412}
413
414template <class T>
415NDataBlock<T>& NDataBlock<T>::operator *= (const NDataBlock<T>& a)
416{
417if(mSz==0 || mSz!=a.mSz)
418 throw(SzMismatchError("NDataBlock::operator*=A size mismatch/null"));
419T *p=Begin(), *pe=End();
420T const *pa=a.Begin();
421while (p<pe) *p++ *= *pa++; // ca marche meme si *this=a
422return *this;
423}
424
425template <class T>
426NDataBlock<T>& NDataBlock<T>::operator /= (const NDataBlock<T>& a)
427{
428if(mSz==0 || mSz!=a.mSz)
429 throw(SzMismatchError("NDataBlock::operator/=A size mismatch/null"));
430T *p=Begin(), *pe=End();
431T const *pa=a.Begin();
432while (p<pe) *p++ /= *pa++;
433return *this;
434}
435
436//**** Surcharge de +,-,*,/ : NDataBlock = NDataBlock+<T>b; NDataBlock = <T>b+NDataBlock;
437// ATTENTION: re-affectation imposee
438
439template <class T>
440NDataBlock<T> NDataBlock<T>::Add(T b) const
441// Pour A+b
442{
443NDataBlock<T> result(*this,false); result.SetTemp(true);
444result += b;
445return result;
446}
447
448template <class T>
449NDataBlock<T> NDataBlock<T>::Sub(T b) const
450// Pour A-b
451{
452NDataBlock<T> result(*this,false); result.SetTemp(true);
453return result -= b;
454}
455
456template <class T>
457NDataBlock<T> NDataBlock<T>::SubInv(T b) const
458// Pour b-A
459{
460NDataBlock<T> result(*this,false); result.SetTemp(true);
461T *p=result.Begin(), *pe=result.End();
462T const *pa=this->Begin();
463while(p<pe) {*p++ = b - *pa++;}
464return result;
465}
466
467template <class T>
468NDataBlock<T> NDataBlock<T>::Mul(T b) const
469// Pour A*b
470{
471NDataBlock<T> result(*this,false); result.SetTemp(true);
472return result *= b;
473}
474
475template <class T>
476NDataBlock<T> NDataBlock<T>::Div(T b) const
477// Pour A/b
478{
479NDataBlock<T> result(*this,false); result.SetTemp(true);
480return result /= b;
481}
482
483template <class T>
484NDataBlock<T> NDataBlock<T>::DivInv(T b) const
485// Pour b/A
486{
487NDataBlock<T> result(*this,false); result.SetTemp(true);
488T *p=result.Begin(), *pe=result.End();
489T const *pa = this->Begin();
490while(p<pe) {*p++ = b / *pa++;}
491return result;
492}
493
494//**** Surcharge de +,-,*,/ : NDataBlock = NDataBlock+NDataBlock;
495
496template <class T>
497NDataBlock<T> NDataBlock<T>::Add(const NDataBlock<T>& b) const
498// Pour A+B
499{
500if(this->mSz!=b.mSz)
501 throw(SzMismatchError("NDataBlock operator C=A+B size mismatch/null\n"));
502NDataBlock<T> result; result.SetTemp(true);
503if(b.IsTemp()) {
504 result.Share(b);
505 result += *this;
506} else {
507 result.Clone(*this);
508 result += b;
509}
510return result;
511}
512
513template <class T>
514NDataBlock<T> NDataBlock<T>::Mul(const NDataBlock<T>& b) const
515// Pour A*B
516{
517if(this->mSz!=b.mSz)
518 throw(SzMismatchError("NDataBlock operator C=A*B size mismatch/null\n"));
519NDataBlock<T> result; result.SetTemp(true);
520if(b.IsTemp()) {
521 result.Share(b);
522 result *= *this;
523} else {
524 result.Clone(*this);
525 result *= b;
526}
527return result;
528}
529
530template <class T>
531NDataBlock<T> NDataBlock<T>::Sub(const NDataBlock<T>& b) const
532// Pour A-B
533{
534if(this->mSz!=b.mSz)
535 throw(SzMismatchError("NDataBlock operator C=A-B size mismatch/null\n"));
536NDataBlock<T> result; result.SetTemp(true);
537if(b.IsTemp()) {
538 result.Share(b);
539 T *p=result.Begin(), *pe=result.End();
540 T const *pa=this->Begin();
541 while(p<pe) {*p = *pa++ - *p; p++;}
542} else {
543 result.Clone(*this);
544 result -= b;
545}
546return result;
547}
548
549template <class T>
550NDataBlock<T> NDataBlock<T>::Div(const NDataBlock<T>& b) const
551// Pour A/B
552{
553if(this->mSz!=b.mSz)
554 throw(SzMismatchError("NDataBlock operator C=A/B size mismatch/null\n"));
555NDataBlock<T> result; result.SetTemp(true);
556if(b.IsTemp()) {
557 result.Share(b);
558 T *p=result.Begin(), *pe=result.End();
559 T const *pa=this->Begin();
560 while(p<pe) {*p = *pa++ / *p; p++;}
561} else {
562 result.Clone(*this);
563 result /= b;
564}
565return result;
566}
567
568
569// -------------------------------------------------------------------------
570// Les objets delegues pour la gestion de persistance
571// -------------------------------------------------------------------------
572
573/*
574template <class T>
575void ObjFileIO< NDataBlock<T> >::ReadSelf(PInPersist& is)
576template <class T>
577void ObjFileIO< NDataBlock<T> >::WriteSelf(POutPersist& os)
578*/
579
580template <class T>
581FIO_NDataBlock<T>::FIO_NDataBlock()
582{
583dobj=new NDataBlock<T>;
584}
585
586template <class T>
587FIO_NDataBlock<T>::FIO_NDataBlock(string const & filename)
588{
589dobj=new NDataBlock<T>;
590Read(filename);
591}
592
593template <class T>
594FIO_NDataBlock<T>::FIO_NDataBlock(const NDataBlock<T> & obj)
595{
596dobj = new NDataBlock<T>(obj);
597}
598
599template <class T>
600FIO_NDataBlock<T>::FIO_NDataBlock(const NDataBlock<T> * obj)
601{
602dobj = new NDataBlock<T>(*obj);
603}
604
605template <class T>
606FIO_NDataBlock<T>::~FIO_NDataBlock()
607{
608if (dobj) delete dobj;
609}
610
611template <class T>
612AnyDataObj* FIO_NDataBlock<T>::DataObj()
613{
614return(dobj);
615}
616
617
618template <class T>
619void FIO_NDataBlock<T>::ReadSelf(PInPersist& is)
620{
621// On lit les 3 premiers uint_8
622uint_8 itab[3];
623is.Get(itab, 3);
624if (dobj == NULL) dobj = new NDataBlock<T>(itab[1]);
625else dobj->ReSize(itab[1]);
626// On lit le tableau de nombres
627PIOSReadArray(is, dobj->Data(), dobj->Size());
628}
629
630
631template <class T>
632void FIO_NDataBlock<T>::WriteSelf(POutPersist& os) const
633{
634if (dobj == NULL) return; // Attention - $CHECK$ Reza 26/04/99
635// On ecrit 3 uint_4
636// 0 : Numero de version, 1 : Taille, 2 reserve a l
637uint_8 itab[3];
638itab[0] = 1;
639itab[1] = dobj->Size();
640itab[2] = 0;
641os.Put(itab, 3);
642// On ecrit le tableau de nombres
643PIOSWriteArray(os, dobj->Data(), dobj->Size());
644}
645
646
647#ifdef __CXX_PRAGMA_TEMPLATES__
648#pragma define_template NDataBlock<uint_1>
649#pragma define_template NDataBlock<uint_2>
650#pragma define_template NDataBlock<int_2>
651#pragma define_template NDataBlock<int_4>
652#pragma define_template NDataBlock<int_8>
653#pragma define_template NDataBlock<uint_2>
654#pragma define_template NDataBlock<uint_4>
655#pragma define_template NDataBlock<uint_8>
656#pragma define_template NDataBlock<r_4>
657#pragma define_template NDataBlock<r_8>
658#pragma define_template NDataBlock< complex<float> >
659#pragma define_template NDataBlock< complex<double> >
660
661// Instances des delegues FileIO (PPersist)
662#pragma define_template FIO_NDataBlock<uint_1>
663#pragma define_template FIO_NDataBlock<uint_2>
664#pragma define_template FIO_NDataBlock<int_2>
665#pragma define_template FIO_NDataBlock<int_4>
666#pragma define_template FIO_NDataBlock<int_8>
667#pragma define_template FIO_NDataBlock<uint_2>
668#pragma define_template FIO_NDataBlock<uint_4>
669#pragma define_template FIO_NDataBlock<uint_8>
670#pragma define_template FIO_NDataBlock<r_8>
671#pragma define_template FIO_NDataBlock<r_4>
672#pragma define_template FIO_NDataBlock< complex<float> >
673#pragma define_template FIO_NDataBlock< complex<double> >
674
675#endif
676
677
678#if defined(ANSI_TEMPLATES) || defined(GNU_TEMPLATES)
679template class NDataBlock<uint_1>;
680template class NDataBlock<uint_2>;
681template class NDataBlock<int_2>;
682template class NDataBlock<int_4>;
683template class NDataBlock<int_8>;
684template class NDataBlock<uint_2>;
685template class NDataBlock<uint_4>;
686template class NDataBlock<uint_8>;
687template class NDataBlock<r_4>;
688template class NDataBlock<r_8>;
689template class NDataBlock< complex<float> >;
690template class NDataBlock< complex<double> >;
691
692// Instances des delegues FileIO (PPersist)
693template class FIO_NDataBlock<uint_1>;
694template class FIO_NDataBlock<uint_2>;
695template class FIO_NDataBlock<int_2>;
696template class FIO_NDataBlock<int_4>;
697template class FIO_NDataBlock<int_8>;
698template class FIO_NDataBlock<uint_2>;
699template class FIO_NDataBlock<uint_4>;
700template class FIO_NDataBlock<uint_8>;
701template class FIO_NDataBlock<r_8>;
702template class FIO_NDataBlock<r_4>;
703template class FIO_NDataBlock< complex<float> >;
704template class FIO_NDataBlock< complex<double> >;
705#endif
Note: See TracBrowser for help on using the repository browser.