1 /* -*- c++ -*- */ 2 #ifndef SIMPLETYPES_H 3 #define SIMPLETYPES_H 4 5 #include <map> 6 #include <string> 7 8 namespace ProtoMol { 9 10 11 /// Pair of std::string 12 typedef std::pair<std::string, std::string> PairString; 13 14 /// Pair of int 15 typedef std::pair<int, int> PairInt; 16 17 /// Pair of unsigned int 18 typedef std::pair<unsigned int, unsigned int> PairUInt; 19 20 // struct PairUInt { 21 // PairUInt():first(0),second(0){} 22 // PairUInt(unsigned int a, unsigned int b):first(a),second(b){} 23 // unsigned int first,second; 24 // }; 25 26 /// Pair of sorted int, where first <= second 27 struct PairIntSorted { PairIntSortedPairIntSorted28 PairIntSorted():first(0),second(0){} PairIntSortedPairIntSorted29 PairIntSorted(unsigned int a, unsigned int b):first(std::min(a,b)),second(std::max(a,b)){} 30 bool operator<(const PairIntSorted& p) const{ 31 if (first < p.first) 32 return true; 33 else if (first > p.first) 34 return false; 35 else if (second < p.second) 36 return true; 37 return false; 38 } 39 bool operator==(const PairIntSorted& p) const {return (first == p.first && second == p.second);} 40 41 unsigned int first,second; 42 }; 43 44 /// Triple of int 45 struct TripleInt { TripleIntTripleInt46 TripleInt():h(0),k(0),l(0){} TripleIntTripleInt47 TripleInt(int a, int b,int c):h(a),k(b),l(c){} 48 int h;int k; int l; 49 }; 50 51 /// Place holder for any text string, avoiding implicit conversion 52 /// and distinguishing a text from and any other string 53 struct Text { TextText54 Text():text(""){} TextText55 Text(const std::string& t):text(t){} TextText56 Text(const char* t):text(t){} 57 58 std::string text; 59 }; 60 61 } 62 #endif /* TYPESELECTION_H */ 63