Changeset 11564
- Timestamp:
- 07/24/11 17:51:26 (13 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/Converter.cc
r11496 r11564 977 977 } 978 978 979 string Converter::ToFormat(const vector<string> &fits) 980 { 981 ostringstream str; 982 for (vector<string>::const_iterator it=fits.begin(); it!=fits.end(); it++) 983 { 984 size_t id=0; 985 int n; 986 987 try 988 { 989 n = stoi(*it, &id); 990 } 991 catch (exception&) 992 { 993 n = 1; 994 } 995 996 if (n==0) 997 continue; 998 999 switch ((*it)[id]) 1000 { 1001 case 'L': 1002 case 'B': str << ";C:" << n; break; 1003 case 'J': str << ";I:" << n; break; 1004 case 'I': str << ";S:" << n; break; 1005 case 'K': str << ";X:" << n; break; 1006 case 'E': str << ";F:" << n; break; 1007 case 'D': str << ";D:" << n; break; 1008 default: 1009 throw runtime_error("ToFormat - id not known."); 1010 } 1011 } 1012 1013 return str.str().substr(1); 1014 } 1015 979 1016 980 1017 void Converter::Print(std::ostream &out) const -
trunk/FACT++/src/Converter.h
r11211 r11564 101 101 std::vector<char> ToFits(const void* src, size_t size) const; 102 102 103 static std::string ToFormat(const std::vector<std::string> &fits); 104 103 105 template<typename T> 104 106 static std::string GetHex(const void *dat, size_t size, size_t col=0, bool prefix=true)
Note:
See TracChangeset
for help on using the changeset viewer.