FACT++  1.0
template<class T , class S >
void StateMachineDrive< T, S >::ReadDatabase ( bool  print = true)
inline

Definition at line 2899 of file drivectrl.cc.

References Source::angles, Source::dec, Source::mag, Source::name, Source::offset, print(), Source::ra, and DatabaseName::uri().

2900  {
2901 #ifdef HAVE_SQL
2902  Database db(fDatabase);
2903 
2904  T::Message("Connected to '"+db.uri()+"'");
2905 
2906  const mysqlpp::StoreQueryResult res =
2907  db.query("SELECT fSourceName, fRightAscension, fDeclination, fWobbleOffset, fWobbleAngle0, fWobbleAngle1, fMagnitude FROM Source").store();
2908 
2909  fSources.clear();
2910  for (vector<mysqlpp::Row>::const_iterator v=res.begin(); v<res.end(); v++)
2911  {
2912  const string name = (*v)[0].c_str();
2913 
2914  Source src;
2915  src.name = name;
2916  src.ra = (*v)[1];
2917  src.dec = (*v)[2];
2918  src.offset = (*v)[3];
2919  src.angles[0] = (*v)[4];
2920  src.angles[1] = (*v)[5];
2921  src.mag = (*v)[6] ? double((*v)[6]) : 0;
2922  AddSource(name, src);
2923 
2924  if (!print)
2925  continue;
2926 
2927  ostringstream msg;
2928  msg << " " << name << setprecision(8) << ": Ra=" << src.ra << "h Dec=" << src.dec << "deg";
2929  msg << " Wobble=[" << src.offset << "," << src.angles[0] << "," << src.angles[1] << "] Mag=" << src.mag;
2930  T::Message(msg);
2931  }
2932 #else
2933  T::Warn("MySQL support not compiled into the program.");
2934 #endif
2935  }
double mag
Definition: drivectrl.cc:126
array< double, 2 > angles
Definition: drivectrl.cc:129
string name
Definition: drivectrl.cc:123
void print(std::ostream &out) const
double dec
Definition: drivectrl.cc:125
bool AddSource(const string &name, const Source &src)
Definition: cosyctrl.cc:1497
double ra
Definition: drivectrl.cc:124
sources fSources
Definition: cosyctrl.cc:792
double offset
Definition: drivectrl.cc:128

+ Here is the call graph for this function: