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

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

Creation module DPC/NTools Reza 09/04/99

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