Changeset 895 in Sophya for trunk/SophyaLib/SUtils/datacards.h
- Timestamp:
- Apr 12, 2000, 7:49:54 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/SUtils/datacards.h
r754 r895 1 1 // This may look like C code, but it is really -*- C++ -*- 2 2 // 3 // $Id: datacards.h,v 1. 1 2000-03-02 16:10:59ansari Exp $3 // $Id: datacards.h,v 1.2 2000-04-12 17:49:43 ansari Exp $ 4 4 // 5 5 // Datacards, acquisition EROS II … … 14 14 #define DATACARDS_SEEN 15 15 16 #include "machdefs.h" 16 17 #include <string.h> 17 18 #include <string> … … 19 20 #include <list> 20 21 #include <vector> 21 #include <string>22 22 23 #include "peida.h" 23 24 namespace SOPHYA { 24 25 25 26 typedef int (*ProcCard)(string const& key, string const& toks); 26 27 27 class DataCards EXC_AWARE { 28 //! Class for decoding parameters from an ascii file. 29 30 class DataCards { 28 31 public: 32 29 33 DataCards(); 30 34 DataCards(string const& fn); 31 35 32 // nom dans variable d'environnement PEIDA_DATACARDS33 // par defaut, peida.datacards36 // nom dans variable d'environnement SOPHYA_DATACARDS 37 // par defaut, sophya.datacards 34 38 // Si pas chemin complet, on tente dans repertoire 35 // en cours, puis dans PEIDA_WORK39 // en cours, puis dans SOPHYA_WORK 36 40 37 41 virtual ~DataCards() {} … … 50 54 double DParam(string const& key, int numero = 0, double def = 0); 51 55 52 friend ostream& operator << (ostream& s, DataCards c);56 void Print(ostream& s) const; 53 57 54 p ublic:58 protected: 55 59 struct Card { 56 60 string kw; 57 61 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); } 59 64 }; 60 typedef list<Card> CardList;61 65 struct CrdPF { 62 66 ProcCard pf; 63 67 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); } 65 70 }; 66 typedef list<CrdPF> CrdPFList;67 protected:68 CardList cards;69 CrdPFList cpfs;70 71 71 72 void DoReadFile(string const& fn); … … 77 78 78 79 Card* FindKey(string const& key); 80 81 typedef list<Card> CardList; 82 typedef list<CrdPF> CrdPFList; 83 CardList cards; 84 CrdPFList cpfs; 85 79 86 struct KeyEq : binary_function<Card, string, bool> { 80 87 bool operator()(const Card& x, const string& y) const { return x.kw == y; } 81 88 }; 82 89 }; 90 91 //! operator << overloading - calls Print() 92 inline ostream& operator << (ostream& s, DataCards c) 93 { c.Print(s); return s; } 94 95 } // namespace SOPHYA 96 83 97 #endif
Note:
See TracChangeset
for help on using the changeset viewer.