Changeset 17776
- Timestamp:
- 05/05/14 09:43:20 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/mcore/FITS.h
r17749 r17776 13 13 14 14 #include <stdint.h> 15 #include <string.h> 16 17 #include <vector> 18 #include <string> 19 20 #ifndef __CINT__ 21 #include <unordered_set> 22 #endif 15 23 16 24 namespace FITS 17 25 { 26 static inline bool IsReservedKeyWord(const std::string &key) 27 { 28 #ifndef __CINT__ 29 static const std::unordered_set<std::string> keys = 30 { 31 "DATASUM", "END", "EXTNAME", "PCOUNT", "NAXIS", 32 "NAXIS1", "NAXIS2", "RAWSUM", "SIMPLE", "TFIELDS", 33 "THEAP", "XTENSION", "ZHEAPPTR", "ZNAXIS1", "ZNAXIS2", 34 "ZPCOUNT", "ZRATIO", "ZSHRINK", "ZTABLE", "ZTILELEN", 35 }; 36 37 static const std::unordered_set<std::string> short_keys = 38 { 39 "TFORM", "TUNIT", "TTYPE", "ZCTYP", "ZFORM", 40 }; 41 42 if (keys.find(key)!=keys.end()) 43 return true; 44 45 const std::string five = key.substr(0, 5); 46 return short_keys.find(five)!=short_keys.end(); 47 #endif 48 } 49 50 static inline std::string CommentFromType(char type) 51 { 52 std::string comment; 53 54 switch (type) 55 { 56 case 'L': comment = "[1-byte BOOL]"; break; 57 case 'A': comment = "[1-byte CHAR]"; break; 58 case 'B': comment = "[1-byte BOOL]"; break; 59 case 'I': comment = "[2-byte INT]"; break; 60 case 'J': comment = "[4-byte INT]"; break; 61 case 'K': comment = "[8-byte INT]"; break; 62 case 'E': comment = "[4-byte FLOAT]"; break; 63 case 'D': comment = "[8-byte FLOAT]"; break; 64 case 'Q': comment = "[var. Length]"; break; 65 } 66 67 return comment; 68 } 69 70 static inline uint32_t SizeFromType(char type) 71 { 72 size_t size = 0; 73 74 switch (type) 75 { 76 case 'L': 77 case 'A': 78 case 'B': size = 1; break; 79 case 'I': size = 2; break; 80 case 'J': 81 case 'E': size = 4; break; 82 case 'K': 83 case 'D': size = 8; break; 84 case 'Q': size = 16; break; 85 } 86 87 return size; 88 } 18 89 19 90 //Identifier of the compression schemes processes … … 67 138 ordering(o), 68 139 numProcs(n) 69 {} 140 { 141 } 70 142 } __attribute__((__packed__)); 71 143 #endif
Note:
See TracChangeset
for help on using the changeset viewer.