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