Beispiel #1
0
Rule::Rule(const Rule & rule) {
	m_useId = false;
	m_id = rule.GetEventId();
	if (m_id > 0)
		m_useId = true;
	m_source = rule.GetSource();
	m_alarmColor = rule.GetAlarmColor();
	m_ignore = rule.GetIgnore();
	m_type = rule.GetType();
	m_user = rule.GetUser();
	m_value = rule.GetValue();
	m_delay = rule.GetDelay();
	m_count = rule.GetCount();
	m_countTmp = 0;
	m_priority = rule.GetPriority();
}
Beispiel #2
0
void Rules::MergeRules(const Parameter &params)
{
  typedef std::set<Rule*, CompareRules> MergeRules;

  std::set<Rule*>::const_iterator iterOrig;
  for (iterOrig = m_keepRules.begin(); iterOrig != m_keepRules.end(); ++iterOrig) {
    Rule *origRule = *iterOrig;

    pair<MergeRules::iterator, bool> inserted = m_mergeRules.insert(origRule);
    if (!inserted.second) {
      // already there, just add count
      Rule &rule = **inserted.first;
      float newCount = rule.GetCount() + origRule->GetCount();
      rule.SetCount(newCount);
    }
  }
}