Changeset 18437 for trunk/FACT++
- Timestamp:
- 02/14/16 18:03:48 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/makeschedule.cc
r18436 r18437 116 116 // Source descrition 117 117 string name; 118 uint16_t key; 118 119 EquPosn equ; 119 120 … … 135 136 vector<string> preobs; 136 137 137 Source(const string &n="" ) : name(n), begin(0), threshold(std::numeric_limits<double>::max()) { }138 Source(const string &n="", uint16_t k=-1) : name(n), key(k), begin(0), threshold(std::numeric_limits<double>::max()) { } 138 139 139 140 //bool IsSpecial() const { return threshold==std::numeric_limits<double>::max(); } … … 456 457 } 457 458 458 const mysqlpp::StoreQueryResult res1 = db.query("SELECT fSourceName, fSourceKEY FROM Source").store(); 459 460 map<string, uint32_t> keys; 459 const mysqlpp::StoreQueryResult res1 = db.query("SELECT fMeasurementTypeName, fMeasurementTypeKEY FROM MeasurementType").store(); 460 map<string, uint32_t> types; 461 461 for (const auto &row: res1) 462 keys.emplace(string(row[0]), uint32_t(row[1]));463 464 const mysqlpp::StoreQueryResult res2 = db.query("SELECT fMeasurementTypeName, fMeasurementTypeKEY FROM MeasurementType").store();465 466 map<string, uint32_t> types;467 for (const auto &row: res2)468 462 types.emplace(string(row[0]), uint32_t(row[1])); 469 463 … … 487 481 488 482 if (src.name!="SLEEP") 489 str << "('" << tm << "', auto, 0, " << types["Data"] << ", " << keys[src.name]<< "), [Data: " << src.name << "]\n";483 str << "('" << tm << "', auto, 0, " << types["Data"] << ", " << src.key << "), [Data: " << src.name << "]\n"; 490 484 else 491 485 str << "('" << tm << "', auto, 0, " << types["Sleep"] << ", NULL), [Sleep]\n"; … … 568 562 cout << "Nsources = " << sourcenames.size() << "\n"; 569 563 570 string query = "SELECT fSourceName, f RightAscension, fDeclination FROM Source WHERE fSourceTypeKEY=1";564 string query = "SELECT fSourceName, fSourceKEY, fRightAscension, fDeclination FROM Source WHERE fSourceTypeKEY=1"; 571 565 if (sourcenames.size()>0) 572 566 query += " AND fSourceName IN ('" + boost::algorithm::join(sourcenames, "', '")+"')"; … … 583 577 const string name = string(row[0]); 584 578 585 Source src(name );586 587 src.equ.ra = double(row[ 1])*15;588 src.equ.dec = double(row[ 2]);579 Source src(name, row[1]); 580 581 src.equ.ra = double(row[2])*15; 582 src.equ.dec = double(row[3]); 589 583 590 584 src.maxzd = MyDouble(conf, "setup."+name+".max-zd");
Note:
See TracChangeset
for help on using the changeset viewer.