Changeset 13332
- Timestamp:
- 04/12/12 10:23:18 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/pyscripts/pyfact/pyfits.h
r13317 r13332 37 37 #include <fstream> 38 38 #define izstream ifstream 39 //#warning Support for zipped FITS files disabled.39 #warning Support for zipped FITS files disabled. 40 40 #endif 41 41 … … 87 87 Columns cols; 88 88 Keys keys; 89 90 //------------ vectors containing the same info as cols and keys------ 91 // They are filled at the end of the contstuctor 92 // They are used py python, for retrieving the contents of the maps 93 // I did not find out how to return a map of <string, struct> via ROOT to python 94 // So I use this ugly hack. I guess its no problem, its just ugly 95 // 96 // btw: The way these variables are named, is imho as ugly as possible, 97 // but I will stick to it. 98 // usually a std::map contains key-value pairs 99 // that means the e.g. map<string, Entry> contains keys of type string 100 // and values of type Entry. 101 // but now the map itself was called 'keys', which means one should say: 102 // the keys of 'keys' are of type string 103 // and 104 // the value of 'keys' are of type Entry. 105 // not to forget that: 106 // one field of a value of 'keys' is named 'value' 107 108 // vectors for Keys keys; 109 vector<string> Py_KeyKeys; 110 vector<string> Py_KeyValues; 111 vector<string> Py_KeyComments; 112 vector<char> Py_KeyTypes; 113 114 // vectors for Columns cols; 115 vector<string> Py_ColumnKeys; 116 vector<size_t> Py_ColumnOffsets; 117 vector<size_t> Py_ColumnNums; 118 vector<size_t> Py_ColumnSizes; 119 vector<char> Py_ColumnTypes; 120 vector<string> Py_ColumnUnits; 121 //-end of----- vectors containing the same info as cols and keys------ 89 122 90 123 string Trim(const string &str, char c=' ') const … … 287 320 288 321 name = Get<string>("EXTNAME"); 289 } 290 322 323 324 Fill_Py_Vectors(); 325 } 326 327 void Fill_Py_Vectors(void) 328 { 329 // Fill the Py_ vectors see line: 90ff 330 // vectors for Keys keys; 331 for (Keys::const_iterator it=keys.begin(); it!=keys.end(); it++) 332 { 333 Py_KeyKeys.push_back(it->first); 334 Py_KeyValues.push_back(it->second.value); 335 Py_KeyComments.push_back(it->second.comment); 336 Py_KeyTypes.push_back(it->second.type); 337 } 338 339 // vectors for Columns cols; 340 for (Columns::const_iterator it=cols.begin(); it!=cols.end(); it++) 341 { 342 Py_ColumnKeys.push_back(it->first); 343 Py_ColumnTypes.push_back(it->second.type); 344 Py_ColumnOffsets.push_back(it->second.offset); 345 Py_ColumnNums.push_back(it->second.num); 346 Py_ColumnSizes.push_back(it->second.size); 347 Py_ColumnUnits.push_back(it->second.unit); 348 } 349 } 350 351 291 352 void PrintKeys(bool display_all=false) const 292 353 { … … 307 368 308 369 gLog << ___all___ << setw(2) << it->second.type << '|' << it->first << '=' << it->second.value << '/' << it->second.comment << '|' << endl; 309 }} 310 370 } 371 } 372 311 373 void PrintColumns() const 312 374 { … … 713 775 void PrintKeys() const { fTable.PrintKeys(); } 714 776 void PrintColumns() const { fTable.PrintColumns(); } 777 778 // 'Wrappers' for the Table's Getters of the Py Vectors 779 vector<string> GetPy_KeyKeys() {return fTable.Py_KeyKeys; } 780 vector<string> GetPy_KeyValues() {return fTable.Py_KeyValues; } 781 vector<string> GetPy_KeyComments() {return fTable.Py_KeyComments; } 782 vector<char> GetPy_KeyTypes() {return fTable.Py_KeyTypes; } 783 784 vector<string> GetPy_ColumnKeys() {return fTable.Py_ColumnKeys; } 785 vector<size_t> GetPy_ColumnOffsets() {return fTable.Py_ColumnOffsets; } 786 vector<size_t> GetPy_ColumnNums() {return fTable.Py_ColumnNums; } 787 vector<size_t> GetPy_ColumnSizes() {return fTable.Py_ColumnSizes;} 788 vector<char> GetPy_ColumnTypes() {return fTable.Py_ColumnTypes;} 789 vector<string> GetPy_ColumnUnits() {return fTable.Py_ColumnUnits;} 790 715 791 }; 716 792
Note:
See TracChangeset
for help on using the changeset viewer.