/* * DNN - Data News Network * * by Stephane Chatty * * Copyright 1993-1995 * Centre d'Etudes de la Navigation Aerienne (CENA) * * Criteria. * * $Id$ * $CurLog$ */ #include "Criterion.h" IvlBaseCriterion :: IvlBaseCriterion () { } IvlBaseCriterion :: ~IvlBaseCriterion () { } IvlAndCriterion :: IvlAndCriterion () : IvlBaseCriterion (), Conditions () { } IvlAndCriterion :: ~IvlAndCriterion () { } IvlAndCriterion& IvlAndCriterion :: operator &= (IvlBaseCriterion& b) { Conditions.Append (&b); return *this; } IvlAndCriterion& IvlAndCriterion :: operator &= (IvlOrCriterion& b) { Conditions.Append (&b); return *this; } IvlAndCriterion& IvlAndCriterion :: operator &= (IvlAndCriterion& b) { IvlListIterOf li = b.Conditions; while (++li) Conditions.Append (*li); return *this; } bool IvlAndCriterion :: Test (IvlEvent& ev) { bool res = true; IvlListIterOf li = Conditions; while (res && ++li) #ifdef CPLUS_BUG22 res = bool (res && (*li)->Test (ev)); #else res = res && (*li)->Test (ev); #endif return res; } IvlOrCriterion :: IvlOrCriterion () : IvlBaseCriterion (), Alternatives () { } IvlOrCriterion :: ~IvlOrCriterion () { } IvlOrCriterion& IvlOrCriterion :: operator |= (IvlOrCriterion& b) { IvlListIterOf li = b.Alternatives; while (++li) Alternatives.Append (*li); return *this; } IvlOrCriterion& IvlOrCriterion :: operator |= (IvlBaseCriterion& b) { Alternatives.Append (&b); return *this; } IvlOrCriterion& IvlOrCriterion :: operator |= (IvlAndCriterion& b) { Alternatives.Append (&b); return *this; } bool IvlOrCriterion :: Test (IvlEvent& ev) { bool res = false; IvlListIterOf li = Alternatives; while (!res && ++li) #ifdef CPLUS_BUG22 res = bool (res || (*li)->Test (ev)); #else res = res || (*li)->Test (ev); #endif return res; } IvlBasicCriterion :: IvlBasicCriterion () : IvlBaseCriterion (), Check (0) { } IvlBasicCriterion :: IvlBasicCriterion (bool (*c) (IvlEvent&)) : IvlBaseCriterion (), Check (c) { } IvlBasicCriterion :: ~IvlBasicCriterion () { } bool IvlBasicCriterion :: Test (IvlEvent& e) { return Check ? (*Check) (e) : false; }