Changeset 490 in Sophya for trunk/SophyaLib/NTools/ntuple.h
- Timestamp:
- Oct 21, 1999, 5:25:53 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/NTools/ntuple.h
r475 r490 1 // This may look like C code, but it is really -*- C++ -*- 1 2 // Class NTuple 2 3 // CMV+Reza Juillet 97 3 4 // CEA-DAPNIA LAL-IN2P3/CNRS 4 // added overloading of operator = F. Touze, Guy Le Meur 19-OCT-995 5 6 6 #ifndef NTUPLE_H_SEEN 7 7 #define NTUPLE_H_SEEN 8 9 #include "objfio.h" 8 10 9 11 #include <iostream.h> … … 11 13 #include <vector> 12 14 13 #if defined(__KCC__) 14 using std::string ; 15 #include <vector.h> 16 #endif 17 15 #include "ntupintf.h" 18 16 #include "ppersist.h" 19 17 #include "dvlist.h" 20 18 19 namespace PlanckDPC { 21 20 22 class NTuple : public PPersist{21 class NTuple : public AnyDataObj , public NTupleInterface { 23 22 public: 24 enum {classId = ClassId_NTuple };23 // enum {classId = ClassId_NTuple }; 25 24 26 25 NTuple(int nvar, char** noms, int blk=512); 27 26 NTuple(); 27 NTuple(const NTuple& NT); 28 28 NTuple(char* flnm); 29 29 virtual ~NTuple(); 30 30 31 NTuple &operator=(const NTuple &ntpl);32 31 NTuple& operator = (const NTuple& NT); 32 33 33 void Fill(r_4* x); 34 34 35 inline int_4 NEntry() { return(mNEnt); } 36 inline int_4 NVar() { return(mNVar); } 37 inline int_4 BLock() { return(mBlk); } 35 inline int_4 NEntry() const { return(mNEnt); } 36 inline int_4 NVar() const { return(mNVar); } 37 inline int_4 BLock() const { return(mBlk); } 38 // $CHECK$ Reza 21/10/99 Pourquoi faire BLock() ? 38 39 39 40 float GetVal(int n, int k) const; 40 inline float GetVal(int n, c har* nom) const41 { return(GetVal(n, IndexNom(nom)) ); }41 inline float GetVal(int n, const char* nom) const 42 { return(GetVal(n, IndexNom(nom)) ); } 42 43 int IndexNom(const char* nom) const ; 43 44 char* NomIndex(int k) const; 44 string VarList_C(const char* nomx=NULL) const;45 45 46 46 r_4* GetVec(int n, r_4* ret=NULL) const ; 47 47 r_8* GetVecD(int n, r_8* ret=NULL) const ; 48 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 49 // Impression, I/O 53 50 void Print(int num, int nmax=1) const ; 54 51 void Show(ostream& os) const; … … 57 54 DVList& Info(); 58 55 59 int_4 ClassId() const { return classId; } 60 static PPersist* Create() { return new NTuple;}56 // Remplissage depuis fichier ASCII 57 int FillFromASCIIFile(string const& fn, float defval=0.); 61 58 62 virtual void WriteSelf(POutPersist&) const;63 virtual void ReadSelf(PInPersist&);64 59 60 // Declaration de l interface NTuple 61 virtual uint_4 NbLines() const ; 62 virtual uint_4 NbColumns() const ; 63 virtual r_8 * GetLineD(int n) const ; 64 virtual r_8 GetCell(int n, int k) const ; 65 virtual r_8 GetCell(int n, string const & nom) const ; 66 virtual void GetMinMax(int k, double& min, double& max) const ; 67 virtual void GetMinMax(string const & nom, double& min, double& max) const ; 68 virtual int ColumnIndex(string const & nom) const ; 69 virtual string ColumnName(int k) const; 70 virtual string VarList_C(const char* nomx=NULL) const ; 71 virtual string LineHeaderToString() const; 72 virtual string LineToString(int n) const; 73 74 // Pour la gestion de persistance 75 friend class ObjFileIO<NTuple> ; 65 76 66 77 private: … … 81 92 { nt.Show(s); return(s); } 82 93 94 inline POutPersist& operator << (POutPersist& os, NTuple & obj) 95 { ObjFileIO<NTuple> fio(&obj); fio.Write(os); return(os); } 96 inline PInPersist& operator >> (PInPersist& is, NTuple & obj) 97 { ObjFileIO<NTuple> fio(&obj); fio.Read(is); return(is); } 98 99 // Classe pour la gestion de persistance 100 // ObjFileIO<NTuple> 101 83 102 #ifdef __MWERKS__ 84 103 __MSL_FIX_ITERATORS__(r_4*); 85 104 #endif 86 105 106 } // namespace PlanckDPC 107 87 108 #endif 88 109
Note:
See TracChangeset
for help on using the changeset viewer.