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

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

cmv 19/5/99

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