diff options
author | chatty | 2000-11-28 14:52:15 +0000 |
---|---|---|
committer | chatty | 2000-11-28 14:52:15 +0000 |
commit | bcb19dbd53973ff7efd9b2838de121d1e23430f4 (patch) | |
tree | 4aa6404ca732d1a32e11b0be1762dcb7ef9fbdb6 /dnn/Criterion.cc | |
parent | 325530e630c68c7c10a2f4339f5b43434fcd0329 (diff) | |
download | ivy-league-bcb19dbd53973ff7efd9b2838de121d1e23430f4.zip ivy-league-bcb19dbd53973ff7efd9b2838de121d1e23430f4.tar.gz ivy-league-bcb19dbd53973ff7efd9b2838de121d1e23430f4.tar.bz2 ivy-league-bcb19dbd53973ff7efd9b2838de121d1e23430f4.tar.xz |
Lots of files were added around '96
Diffstat (limited to 'dnn/Criterion.cc')
-rwxr-xr-x | dnn/Criterion.cc | 142 |
1 files changed, 142 insertions, 0 deletions
diff --git a/dnn/Criterion.cc b/dnn/Criterion.cc new file mode 100755 index 0000000..edef576 --- /dev/null +++ b/dnn/Criterion.cc @@ -0,0 +1,142 @@ +/* + * DNN - Data News Network + * + * by Stephane Chatty + * + * Copyright 1993-1995 + * Centre d'Etudes de la Navigation Aerienne (CENA) + * + * Criteria. + * + * $Id$ + * $CurLog$ + */ + +#include "Criterion.h" + +DnnBaseCriterion :: DnnBaseCriterion () +{ +} + +DnnBaseCriterion :: ~DnnBaseCriterion () +{ +} + + +DnnAndCriterion :: DnnAndCriterion () +: DnnBaseCriterion (), + Conditions () +{ +} + +DnnAndCriterion :: ~DnnAndCriterion () +{ +} + +DnnAndCriterion& +DnnAndCriterion :: operator &= (DnnBaseCriterion& b) +{ + Conditions.Append (&b); + return *this; +} + +DnnAndCriterion& +DnnAndCriterion :: operator &= (DnnOrCriterion& b) +{ + Conditions.Append (&b); + return *this; +} + +DnnAndCriterion& +DnnAndCriterion :: operator &= (DnnAndCriterion& b) +{ + CcuListIterOf <DnnBaseCriterion> li = b.Conditions; + while (++li) + Conditions.Append (*li); + return *this; +} + +bool +DnnAndCriterion :: Test (DnnEvent& ev) +{ + bool res = true; + CcuListIterOf <DnnBaseCriterion> li = Conditions; + while (res && ++li) +#ifdef CPLUS_BUG22 + res = bool (res && (*li)->Test (ev)); +#else + res = res && (*li)->Test (ev); +#endif + return res; +} + + +DnnOrCriterion :: DnnOrCriterion () +: DnnBaseCriterion (), + Alternatives () +{ +} + +DnnOrCriterion :: ~DnnOrCriterion () +{ +} + +DnnOrCriterion& +DnnOrCriterion :: operator |= (DnnOrCriterion& b) +{ + CcuListIterOf <DnnBaseCriterion> li = b.Alternatives; + while (++li) + Alternatives.Append (*li); + return *this; +} + +DnnOrCriterion& +DnnOrCriterion :: operator |= (DnnBaseCriterion& b) +{ + Alternatives.Append (&b); + return *this; +} + +DnnOrCriterion& +DnnOrCriterion :: operator |= (DnnAndCriterion& b) +{ + Alternatives.Append (&b); + return *this; +} + +bool +DnnOrCriterion :: Test (DnnEvent& ev) +{ + bool res = false; + CcuListIterOf <DnnBaseCriterion> li = Alternatives; + while (!res && ++li) +#ifdef CPLUS_BUG22 + res = bool (res || (*li)->Test (ev)); +#else + res = res || (*li)->Test (ev); +#endif + return res; +} + + +DnnBasicCriterion :: DnnBasicCriterion () +: DnnBaseCriterion (), + Check (0) +{ +} + +DnnBasicCriterion :: DnnBasicCriterion (bool (*c) (DnnEvent&)) +: DnnBaseCriterion (), + Check (c) +{ +} + +DnnBasicCriterion :: ~DnnBasicCriterion () +{ +} + +bool +DnnBasicCriterion :: Test (DnnEvent& e) +{ + return Check ? (*Check) (e) : false; +} |