source: Sophya/trunk/SophyaLib/NTools/ntuple.h@ 483

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

added overloading of perator = GLM,FT 19-OCT-99

File size: 2.2 KB
Line 
1// Class NTuple
2// CMV+Reza Juillet 97
3// CEA-DAPNIA LAL-IN2P3/CNRS
4// added overloading of operator = F. Touze, Guy Le Meur 19-OCT-99
5
6#ifndef NTUPLE_H_SEEN
7#define NTUPLE_H_SEEN
8
9#include <iostream.h>
10#include <string>
11#include <vector>
12
13#if defined(__KCC__)
14using std::string ;
15#include <vector.h>
16#endif
17
18#include "ppersist.h"
19#include "dvlist.h"
20
21
22class NTuple : public PPersist {
23public:
24 enum {classId = ClassId_NTuple };
25
26 NTuple(int nvar, char** noms, int blk=512);
27 NTuple();
28 NTuple(char* flnm);
29 virtual ~NTuple();
30
31 NTuple &operator=(const NTuple &ntpl);
32
33 void Fill(r_4* x);
34
35 inline int_4 NEntry() { return(mNEnt); }
36 inline int_4 NVar() { return(mNVar); }
37 inline int_4 BLock() { return(mBlk); }
38
39 float GetVal(int n, int k) const;
40 inline float GetVal(int n, char* nom) const
41 { return(GetVal(n, IndexNom(nom)) ); }
42 int IndexNom(const char* nom) const ;
43 char* NomIndex(int k) const;
44 string VarList_C(const char* nomx=NULL) const;
45
46 r_4* GetVec(int n, r_4* ret=NULL) const ;
47 r_8* GetVecD(int n, r_8* ret=NULL) const ;
48
49 void GetMinMax(int k, float& min, float& max) const ;
50 inline void GetMinMax(const char* nom, float& min, float& max) const
51 { GetMinMax(IndexNom(nom), min, max); }
52
53 void Print(int num, int nmax=1) const ;
54 void Show(ostream& os) const;
55 inline void Show() const { Show(cout); }
56
57 DVList& Info();
58
59 int_4 ClassId() const { return classId; }
60 static PPersist* Create() { return new NTuple;}
61
62 virtual void WriteSelf(POutPersist&) const;
63 virtual void ReadSelf(PInPersist&);
64
65
66private:
67 void Clean();
68
69 int_4 mNVar, mNEnt, mBlk, mNBlk;
70 r_4* mVar;
71 r_8* mVarD;
72 char* mNames;
73
74 vector<r_4*> mPtr;
75
76 DVList* mInfo; // Infos (variables) attachees au NTuple
77
78};
79
80inline ostream& operator << (ostream& s, NTuple const & nt)
81 { nt.Show(s); return(s); }
82
83#ifdef __MWERKS__
84__MSL_FIX_ITERATORS__(r_4*);
85#endif
86
87#endif
88
Note: See TracBrowser for help on using the repository browser.