source: Sophya/trunk/SophyaLib/HiStats/ntuple.h@ 1046

Last change on this file since 1046 was 1046, checked in by ansari, 25 years ago

suppression methodes SetXVavl inutiles

File size: 3.1 KB
RevLine 
[763]1// This may look like C code, but it is really -*- C++ -*-
2// Class NTuple
3// CMV+Reza Juillet 97
4// CEA-DAPNIA LAL-IN2P3/CNRS
5
6#ifndef NTUPLE_H_SEEN
7#define NTUPLE_H_SEEN
8
9#include "objfio.h"
10
11#include <iostream.h>
12#include <string>
13#include <vector>
14
15#include "ntupintf.h"
16#include "ppersist.h"
17#include "dvlist.h"
18
19namespace SOPHYA {
20
[869]21// Forward class declaration for Fits handler
22class FITS_XNTuple;
23
[763]24class NTuple : public AnyDataObj , public NTupleInterface {
[846]25
[763]26public:
27// enum {classId = ClassId_NTuple };
28
29 NTuple(int nvar, char** noms, int blk=512);
30 NTuple();
31 NTuple(const NTuple& NT);
32 NTuple(char* flnm);
33 virtual ~NTuple();
34
35 NTuple& operator = (const NTuple& NT);
36
37 void Fill(r_4* x);
38
39 inline int_4 NEntry() const { return(mNEnt); }
40 inline int_4 NVar() const { return(mNVar); }
41 inline int_4 BLock() const { return(mBlk); }
42// $CHECK$ Reza 21/10/99 Pourquoi faire BLock() ?
43
44 float GetVal(int n, int k) const;
45 inline float GetVal(int n, const char* nom) const
46 { return(GetVal(n, IndexNom(nom)) ); }
47 int IndexNom(const char* nom) const ;
48 char* NomIndex(int k) const;
49
50 r_4* GetVec(int n, r_4* ret=NULL) const ;
51 r_8* GetVecD(int n, r_8* ret=NULL) const ;
52
53// Impression, I/O
54 void Print(int num, int nmax=1) const ;
55 void Show(ostream& os) const;
56 inline void Show() const { Show(cout); }
57
58 DVList& Info();
59
60// Remplissage depuis fichier ASCII
61 int FillFromASCIIFile(string const& fn, float defval=0.);
62
63
64// Declaration de l interface NTuple
65 virtual uint_4 NbLines() const ;
66 virtual uint_4 NbColumns() const ;
67 virtual r_8 * GetLineD(int n) const ;
68 virtual r_8 GetCell(int n, int k) const ;
69 virtual r_8 GetCell(int n, string const & nom) const ;
70 virtual void GetMinMax(int k, double& min, double& max) const ;
71 virtual void GetMinMax(string const & nom, double& min, double& max) const ;
72 virtual int ColumnIndex(string const & nom) const ;
73 virtual string ColumnName(int k) const;
74 virtual string VarList_C(const char* nomx=NULL) const ;
75 virtual string LineHeaderToString() const;
76 virtual string LineToString(int n) const;
77
78// Pour la gestion de persistance
79 friend class ObjFileIO<NTuple> ;
80
[1046]81 // pour fichiers FITS
82 friend class FITS_NTuple;
[869]83
[1046]84
[763]85private:
86 void Clean();
87
88 int_4 mNVar, mNEnt, mBlk, mNBlk;
89 r_4* mVar;
90 r_8* mVarD;
91 char* mNames;
92
93 vector<r_4*> mPtr;
94
95 DVList* mInfo; // Infos (variables) attachees au NTuple
96
97};
98
99inline ostream& operator << (ostream& s, NTuple const & nt)
100 { nt.Show(s); return(s); }
101
102inline POutPersist& operator << (POutPersist& os, NTuple & obj)
103{ ObjFileIO<NTuple> fio(&obj); fio.Write(os); return(os); }
104inline PInPersist& operator >> (PInPersist& is, NTuple & obj)
105{ ObjFileIO<NTuple> fio(&obj); fio.Read(is); return(is); }
106
107// Classe pour la gestion de persistance
108// ObjFileIO<NTuple>
109
[846]110
111
[763]112#ifdef __MWERKS__
113__MSL_FIX_ITERATORS__(r_4*);
114#endif
115
116} // namespace SOPHYA
117
118#endif
119
Note: See TracBrowser for help on using the repository browser.