source: Sophya/trunk/SophyaLib/HiStats/ntupintf.cc@ 2615

Last change on this file since 2615 was 2615, checked in by cmv, 21 years ago

using namespace sophya enleve de machdefs.h, nouveau sopnamsp.h cmv 10/09/2004

  • Property svn:executable set to *
File size: 4.9 KB
RevLine 
[1371]1
[2615]2#include "sopnamsp.h"
[1371]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
[2142]16// Lib HiStats
[1371]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-- */
65NTupleInterface::NTupleInterface()
66{
67}
68/* --Methode-- */
69NTupleInterface::~NTupleInterface()
70{
71}
72
73//! Retuns the number of lines (rows) of the data set
74/* --Methode-- */
75uint_4 NTupleInterface::NbLines() const
76{
77return(0);
78}
79
80//! Retuns the number of columns of the data set
81/* --Methode-- */
82uint_4 NTupleInterface::NbColumns() const
83{
84return(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-- */
93r_8 * NTupleInterface::GetLineD(int ) const
94{
95return(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-- */
104r_8 NTupleInterface::GetCell(int , int ) const
105{
106return(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-- */
115r_8 NTupleInterface::GetCell(int n, string const & nom) const
116{
117return(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*/
125string NTupleInterface::GetCelltoString(int n, int k) const
126{
127char strg[64];
128//sprintf(strg,"C%d= %g\n", k, GetCell(n, k));
129sprintf(strg,"%g\n", GetCell(n, k));
130return(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*/
138string NTupleInterface::GetCelltoString(int n, string const & nom) const
139{
140return(GetCelltoString(n, ColumnIndex(nom)));
141}
142
143//! Returns the minimum and maximum values for a given column
144/* --Methode-- */
145void NTupleInterface::GetMinMax(int , double& min, double& max) const
146{
147min = max = 0.;
148}
149
150/* --Methode-- */
151//! Returns the minimum and maximum values for a given named column
152void NTupleInterface::GetMinMax(string const & , double& min, double& max) const
153{
154min = max = 0.;
155}
156
157/* --Methode-- */
158//! Returns the column index given the column name
159int NTupleInterface::ColumnIndex(string const & nom) const
160{
161return(-1);
162}
163
164/* --Methode-- */
165//! Returns the column name corresponding to a column index.
166string NTupleInterface::ColumnName(int k) const
167{
168return("");
169}
170
171/* --Methode-- */
172string NTupleInterface::VarList_C(const char*) const
173{
174return("");
175}
176
177/* --Methode-- */
178string NTupleInterface::LineHeaderToString() const
179{
180return("");
181}
182
183/* --Methode-- */
184string NTupleInterface::LineToString(int ) const
185{
186return("");
187}
188
189
190
Note: See TracBrowser for help on using the repository browser.