1 |
|
---|
2 | #include "sopnamsp.h"
|
---|
3 | #include "ntupintf.h"
|
---|
4 | #include <stdlib.h>
|
---|
5 | #include <stdio.h>
|
---|
6 |
|
---|
7 | /*!
|
---|
8 | \class SOPHYA::NTupleInterface
|
---|
9 | \ingroup HiStats
|
---|
10 | Interface class (pure virtual) defining generic operations on NTuple,
|
---|
11 | a 2-dimensional data set with named columns
|
---|
12 | */
|
---|
13 |
|
---|
14 | //++
|
---|
15 | // Class NTupleInterface
|
---|
16 | // Lib HiStats
|
---|
17 | // include ntupintf.h
|
---|
18 | //
|
---|
19 | // Interface permettant de construire des vues NTuples (tableau lignes-colonnes)
|
---|
20 | // pour differents objets. Toutes les methodes ont une implementation par defaut.
|
---|
21 | //--
|
---|
22 |
|
---|
23 | //++
|
---|
24 | // NTupleInterface()
|
---|
25 | // Constructeur.
|
---|
26 | // virtual ~NTupleInterface()
|
---|
27 | // Destructeur
|
---|
28 | // uint_4 NbLines() const
|
---|
29 | // Nombre de lignes du tableau
|
---|
30 | // uint_4 NbColumns() const
|
---|
31 | // Nombre de colonnes du tableau
|
---|
32 | // r_8 * GetLineD(int n) const
|
---|
33 | // Renvoie un tableau avec le contenu de la ligne "n"
|
---|
34 | // r_8 GetCell(int n, int k) const
|
---|
35 | // Renvoie le contenu de la cellule correspondant a la ligne "n"
|
---|
36 | // et colonne "k"
|
---|
37 | // r_8 GetCell(int n, string const & nom) const
|
---|
38 | // Renvoie le contenu de la cellule correspondant a la ligne "n"
|
---|
39 | // pour la colonne identifiee par "nom"
|
---|
40 | // string GetCelltoString(int n, int k) const
|
---|
41 | // Renvoie le contenu de la cellule correspondant a la ligne "n"
|
---|
42 | // et colonne "k", sous forme de chaine de caracteres.
|
---|
43 | // string GetCell(int n, string const & nom) const
|
---|
44 | // Renvoie le contenu de la cellule correspondant a la ligne "n"
|
---|
45 | // pour la colonne identifiee par "nom", sous forme de chaine de caracteres.
|
---|
46 | // void GetMinMax(int k, double& min, double& max) const
|
---|
47 | // Renvoie la valeur mini et maxi de la colonne numero "k"
|
---|
48 | // void GetMinMax(string const & nom, double& min, double& max)
|
---|
49 | // Renvoie la valeur mini et maxi de la colonne identifiee par "nom"
|
---|
50 | // int ColumnIndex(string const & nom) const
|
---|
51 | // Renvoie le numero de colonne identifiee par "nom". Renvoie -1 (negatif)
|
---|
52 | // si colonne "nom" n'existe pas.
|
---|
53 | // string ColumnName(int k) const
|
---|
54 | // Renvoie le nom de la colonne numero "k"
|
---|
55 | // string VarList_C(const char* nomx=NULL) const
|
---|
56 | // Renvoie une chaine avec les declarations "C" pour les
|
---|
57 | // variables avec les noms de colonnes
|
---|
58 | // string LineHeaderToString()
|
---|
59 | // Renvoie une chaine avec les noms de colonnes, utilisables pour l'impression
|
---|
60 | // string LineToString(int n)
|
---|
61 | // Renvoie une chaine avec le contenu de la ligne "n", utilisable pour l'impression
|
---|
62 | //--
|
---|
63 |
|
---|
64 | /* --Methode-- */
|
---|
65 | NTupleInterface::NTupleInterface()
|
---|
66 | {
|
---|
67 | }
|
---|
68 | /* --Methode-- */
|
---|
69 | NTupleInterface::~NTupleInterface()
|
---|
70 | {
|
---|
71 | }
|
---|
72 |
|
---|
73 | //! Retuns the number of lines (rows) of the data set
|
---|
74 | /* --Methode-- */
|
---|
75 | uint_4 NTupleInterface::NbLines() const
|
---|
76 | {
|
---|
77 | return(0);
|
---|
78 | }
|
---|
79 |
|
---|
80 | //! Retuns the number of columns of the data set
|
---|
81 | /* --Methode-- */
|
---|
82 | uint_4 NTupleInterface::NbColumns() const
|
---|
83 | {
|
---|
84 | return(0);
|
---|
85 | }
|
---|
86 |
|
---|
87 | //! Retuns the content of a given line
|
---|
88 | /*!
|
---|
89 | An array (double *) containg all cells of a given line, converted to
|
---|
90 | float values is returned
|
---|
91 | */
|
---|
92 | /* --Methode-- */
|
---|
93 | r_8 * NTupleInterface::GetLineD(int ) const
|
---|
94 | {
|
---|
95 | return(NULL);
|
---|
96 | }
|
---|
97 |
|
---|
98 | //! Returns the content of a given cell
|
---|
99 | /*!
|
---|
100 | The cell is identified by the line and column number. Its content is
|
---|
101 | converted to a floating value.
|
---|
102 | */
|
---|
103 | /* --Methode-- */
|
---|
104 | r_8 NTupleInterface::GetCell(int , int ) const
|
---|
105 | {
|
---|
106 | return(0.);
|
---|
107 | }
|
---|
108 |
|
---|
109 | //! Returns the content of a given cell
|
---|
110 | /*!
|
---|
111 | The cell is identified by the line number and column name. Its content is
|
---|
112 | converted to a floating value.
|
---|
113 | */
|
---|
114 | /* --Methode-- */
|
---|
115 | r_8 NTupleInterface::GetCell(int n, string const & nom) const
|
---|
116 | {
|
---|
117 | return(GetCell(n, ColumnIndex(nom)));
|
---|
118 | }
|
---|
119 |
|
---|
120 | //! Returns the string representation of a given cell
|
---|
121 | /*!
|
---|
122 | The cell is identified by the line and column number. Its content is
|
---|
123 | converted to a string.
|
---|
124 | */
|
---|
125 | string NTupleInterface::GetCelltoString(int n, int k) const
|
---|
126 | {
|
---|
127 | char strg[64];
|
---|
128 | //sprintf(strg,"C%d= %g\n", k, GetCell(n, k));
|
---|
129 | sprintf(strg,"%g\n", GetCell(n, k));
|
---|
130 | return(strg);
|
---|
131 | }
|
---|
132 |
|
---|
133 | //! Returns the string representation of a given cell
|
---|
134 | /*!
|
---|
135 | The cell is identified by the line number and column name. Its content is
|
---|
136 | converted to a string.
|
---|
137 | */
|
---|
138 | string NTupleInterface::GetCelltoString(int n, string const & nom) const
|
---|
139 | {
|
---|
140 | return(GetCelltoString(n, ColumnIndex(nom)));
|
---|
141 | }
|
---|
142 |
|
---|
143 | //! Returns the minimum and maximum values for a given column
|
---|
144 | /* --Methode-- */
|
---|
145 | void NTupleInterface::GetMinMax(int , double& min, double& max) const
|
---|
146 | {
|
---|
147 | min = max = 0.;
|
---|
148 | }
|
---|
149 |
|
---|
150 | /* --Methode-- */
|
---|
151 | //! Returns the minimum and maximum values for a given named column
|
---|
152 | void NTupleInterface::GetMinMax(string const & , double& min, double& max) const
|
---|
153 | {
|
---|
154 | min = max = 0.;
|
---|
155 | }
|
---|
156 |
|
---|
157 | /* --Methode-- */
|
---|
158 | //! Returns the column index given the column name
|
---|
159 | int NTupleInterface::ColumnIndex(string const & nom) const
|
---|
160 | {
|
---|
161 | return(-1);
|
---|
162 | }
|
---|
163 |
|
---|
164 | /* --Methode-- */
|
---|
165 | //! Returns the column name corresponding to a column index.
|
---|
166 | string NTupleInterface::ColumnName(int k) const
|
---|
167 | {
|
---|
168 | return("");
|
---|
169 | }
|
---|
170 |
|
---|
171 | /* --Methode-- */
|
---|
172 | string NTupleInterface::VarList_C(const char*) const
|
---|
173 | {
|
---|
174 | return("");
|
---|
175 | }
|
---|
176 |
|
---|
177 | /* --Methode-- */
|
---|
178 | string NTupleInterface::LineHeaderToString() const
|
---|
179 | {
|
---|
180 | return("");
|
---|
181 | }
|
---|
182 |
|
---|
183 | /* --Methode-- */
|
---|
184 | string NTupleInterface::LineToString(int ) const
|
---|
185 | {
|
---|
186 | return("");
|
---|
187 | }
|
---|
188 |
|
---|
189 |
|
---|
190 |
|
---|