Changeset 2831 in Sophya for trunk/SophyaLib/HiStats/basedtable.h


Ignore:
Timestamp:
Nov 8, 2005, 5:16:44 PM (20 years ago)
Author:
ansari
Message:

1/ Prise en charge champ de type DateTimeField ds BaseDataTable , DataTable, SwPPFDataTable
2/ Methodes BaseDataTable completees - en particulier Print/WriteASCII, et
decodage de fichiers ASCII

Reza, 8 Nov 2005

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/HiStats/basedtable.h

    r2827 r2831  
    1818#include "dvlist.h"
    1919#include "segdatablock.h"
     20#include "tvector.h"
    2021
    2122namespace SOPHYA {
     
    3132                  FloatField=3, DoubleField=4,
    3233                  ComplexField=5, DoubleComplexField=6,
    33                   StringField=7, DateField=8};
     34                  StringField=7, DateTimeField=8};
    3435  // <=====================================================>
    3536
     37  //! Return the column type as a string (long or short depending on fgl=true/false)
    3638  static string     ColTypeToString(FieldType ft, bool fgl=false);
     39  //! Return the column type corresponding to \b sctyp
     40  static FieldType  StringToColType(string const & sctyp);
    3741
    3842  // constructeur , destructeur
     
    8286  inline sa_size_t  AddStringColumn(string const & cnom)
    8387  { return AddColumn(StringField, cnom); }
     88  //! Adds a column holding Date/Time value, named \b cnom
     89  inline sa_size_t  AddDateTimeColumn(const char * cnom)
     90  { return AddColumn(DateTimeField, cnom); }
     91  //! Adds a column holding Date/Time value, named \b cnom
     92  inline sa_size_t  AddDateTimeColumn(string const & cnom)
     93  { return AddColumn(DateTimeField, cnom); }
    8494 
    8595  inline sa_size_t  AddColumn(FieldType ft, const char * cnom)
     
    124134  virtual MuTyV *   GetLine(sa_size_t n) const ;
    125135
     136  //! Return the information stored in column \b k of the table, converted to double
     137  virtual TVector<r_8>  GetColumnD(sa_size_t k) const ;
     138
     139  //! Return the information stored in column named \b nom of the table, converted to double
     140  inline TVector<r_8>  GetColumnD(char const * nom) const
     141  { return  GetColumnD(IndexNom(nom)) ; }
     142  //! Return the information stored in column named \b nom of the table, converted to double
     143  inline TVector<r_8>  GetColumnD(string const & nom) const
     144  { return  GetColumnD(IndexNom(nom)) ; }
     145
    126146  //! Return the index for column name \b nom 
    127147  sa_size_t         IndexNom(char const* nom) const ;
     
    146166  virtual void Clear() = 0;
    147167
    148   //! Prints the table content - NOT YET IMPLEMENTED !
    149   void              Print(int num, int nmax=1) const ;
    150  
    151 //! Prints table definition and number of entries
     168  //! Prints  the table content (ascii dump)
     169  virtual ostream&  Print(ostream& os, sa_size_t lstart, sa_size_t lend,
     170                          sa_size_t lstep=1) const ;
     171  //! Prints  the table content (ascii dump) on stream \b os
     172  inline ostream&   Print(ostream& os) const
     173  { return Print(os, 0, NEntry(), 1); }
     174  //! Prints  the table content (ascii dump) on stream \b os
     175  inline ostream&   WriteASCII(ostream& os) const
     176  { return Print(os, 0, NEntry(), 1); }
     177
     178 
     179  //! Prints table definition and number of entries
    152180  void              Show(ostream& os) const ;
    153181  //! Prints table definition and number of entries on the standard output stream \b cout
    154182  inline void       Show() const { Show(cout) ; }
    155183 
     184  //! Return the associated DVList (info) object.
    156185  DVList&           Info() const ;
    157186 
    158187  // Remplissage depuis fichier ASCII
    159   int               FillFromASCIIFile(string const& fn);
     188  sa_size_t         FillFromASCIIFile(istream& is, char clm='#', const char* sep=" \t");
    160189 
    161190  //-------------------------------------------------------------
     
    175204  virtual string    LineHeaderToString() const;
    176205  virtual string    LineToString(sa_size_t n) const; 
     206
     207  //! Return a table row (line), formatted and converted to a string
     208  virtual string    TableRowToString(sa_size_t n, bool qstr, const char* sep=" ",
     209                                     int fw=12) const;
    177210
    178211  //  Pour la gestion de persistance PPF
Note: See TracChangeset for help on using the changeset viewer.