Changeset 895 in Sophya for trunk/SophyaLib/SUtils/datacards.h


Ignore:
Timestamp:
Apr 12, 2000, 7:49:54 PM (25 years ago)
Author:
ansari
Message:

Documentation de fichiers - Reza 12/4/2000

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/SUtils/datacards.h

    r754 r895  
    11// This may look like C code, but it is really -*- C++ -*-
    22//
    3 // $Id: datacards.h,v 1.1 2000-03-02 16:10:59 ansari Exp $
     3// $Id: datacards.h,v 1.2 2000-04-12 17:49:43 ansari Exp $
    44//
    55// Datacards, acquisition EROS II
     
    1414#define DATACARDS_SEEN
    1515
     16#include "machdefs.h"
    1617#include <string.h>
    1718#include <string>
     
    1920#include <list>
    2021#include <vector>
    21 #include <string>
    2222
    23 #include "peida.h"
     23
     24namespace SOPHYA { 
    2425
    2526typedef int (*ProcCard)(string const& key, string const& toks);
    2627 
    27 class DataCards EXC_AWARE {
     28//! Class for decoding parameters from  an ascii file.
     29   
     30class DataCards  {
    2831public:
     32
    2933   DataCards();                 
    3034   DataCards(string const& fn);
    3135
    32            // nom dans variable d'environnement PEIDA_DATACARDS
    33            // par defaut, peida.datacards                       
     36           // nom dans variable d'environnement SOPHYA_DATACARDS
     37           // par defaut, sophya.datacards                       
    3438           // Si pas chemin complet, on tente dans repertoire
    35            // en cours, puis dans PEIDA_WORK
     39           // en cours, puis dans SOPHYA_WORK
    3640
    3741   virtual ~DataCards() {}
     
    5054   double  DParam(string const& key, int numero = 0, double def = 0);
    5155   
    52    friend ostream& operator << (ostream& s, DataCards c);
     56   void    Print(ostream& s) const;
    5357
    54 public:
     58protected:
    5559   struct Card {
    5660     string kw;
    5761     vector<string> tokens;
    58          STRUCTCOMPF(Card,kw)
     62     bool operator == (Card const & b) const { return(kw == b.kw); }
     63     bool operator < (Card const & b) const { return(kw < b.kw); }
    5964   };
    60    typedef list<Card> CardList;
    6165   struct CrdPF {
    6266     ProcCard pf;
    6367     string  patt;
    64          STRUCTCOMPF(CrdPF,pf)
     68     bool operator == (CrdPF const & b) const { return(pf == b.pf); }
     69     bool operator < (CrdPF const & b) const { return(pf == b.pf); }
    6570   };
    66    typedef list<CrdPF> CrdPFList;
    67 protected:
    68    CardList cards;
    69    CrdPFList cpfs;
    7071
    7172   void  DoReadFile(string const& fn);
     
    7778   
    7879   Card* FindKey(string const& key);
     80
     81   typedef list<Card> CardList;
     82   typedef list<CrdPF> CrdPFList;
     83   CardList cards;
     84   CrdPFList cpfs;
     85
    7986   struct KeyEq : binary_function<Card, string, bool> {
    8087    bool operator()(const Card& x, const string& y) const { return x.kw == y; }
    8188   };
    8289};
     90
     91//! operator << overloading - calls Print()
     92inline ostream& operator << (ostream& s, DataCards c)
     93{ c.Print(s); return s; }
     94
     95} // namespace SOPHYA
     96
    8397#endif
Note: See TracChangeset for help on using the changeset viewer.