FACT++  1.0
int StateMachineRateScan::EvalOptions ( Configuration conf)
inline

Definition at line 546 of file ratescan.cc.

References Error(), StateMachineRateScan::config::fCounterMax, StateMachineRateScan::config::fResolution, Configuration::GetDef(), Configuration::HasDef(), and Configuration::Vec().

547  {
548  // ---------- Setup run types ---------
549  const vector<string> types = conf.Vec<string>("type");
550  if (types.empty())
551  Warn("No types defined.");
552  else
553  Message("Defining types");
554 
555  for (auto it=types.begin(); it!=types.end(); it++)
556  {
557  Message(" -> "+ *it);
558 
559  if (fTypes.count(*it)>0)
560  {
561  Error("Type "+*it+" defined twice.");
562  return 1;
563  }
564 
565  config &c = fTypes[*it];
566  if (conf.HasDef("max-wait.", *it))
567  c.fCounterMax = conf.GetDef<int>("max-wait.", *it);
568  else
569  {
570  Error("Neither max-wait.default nor max-wait."+*it+" found.");
571  return 2;
572  }
573  if (conf.HasDef("resolution.", *it))
574  c.fResolution = conf.GetDef<double>("resolution.", *it);
575  else
576  {
577  Error("Neither resolution.default nor resolution."+*it+" found.");
578  return 2;
579  }
580  }
581  return -1;
582  }
std::vector< T > Vec(const std::string &var)
map< string, config > fTypes
Definition: ratescan.cc:38
T GetDef(const std::string &var, const S &val)
int Error(const std::string &str)
Definition: MessageImp.h:49
int Warn(const std::string &str)
Definition: MessageImp.h:48
int Message(const std::string &str)
Definition: MessageImp.h:46
bool HasDef(const std::string &var, const T &val)

+ Here is the call graph for this function: