-/********************* */
-/*! \file type_enumerator.h
- ** \verbatim
- ** Original author: mdeters
- ** Major contributors: none
- ** Minor contributors (to current version): none
- ** This file is part of the CVC4 prototype.
- ** Copyright (c) 2009-2012 The Analysis of Computer Systems Group (ACSys)
- ** Courant Institute of Mathematical Sciences
- ** New York University
- ** See the file COPYING in the top-level source directory for licensing
- ** information.\endverbatim
- **
- ** \brief Enumerators for rationals and integers
- **
- ** Enumerators for rationals and integers.
- **/
-
-#include "cvc4_private.h"
-
-#ifndef __CVC4__THEORY__ARITH__TYPE_ENUMERATOR_H
-#define __CVC4__THEORY__ARITH__TYPE_ENUMERATOR_H
+/******************************************************************************
+ * Top contributors (to current version):
+ * Morgan Deters, Tim King, Mathias Preiner
+ *
+ * This file is part of the cvc5 project.
+ *
+ * Copyright (c) 2009-2022 by the authors listed in the file AUTHORS
+ * in the top-level source directory and their institutional affiliations.
+ * All rights reserved. See the file COPYING in the top-level source
+ * directory for licensing information.
+ * ****************************************************************************
+ *
+ * Enumerators for rationals and integers.
+ */
+
+#include "cvc5_private.h"
+
+#ifndef CVC5__THEORY__ARITH__TYPE_ENUMERATOR_H
+#define CVC5__THEORY__ARITH__TYPE_ENUMERATOR_H
+#include "expr/kind.h"
+#include "expr/type_node.h"
+#include "theory/type_enumerator.h"
#include "util/integer.h"
#include "util/rational.h"
-#include "theory/type_enumerator.h"
-#include "expr/type_node.h"
-#include "expr/kind.h"
-namespace CVC4 {
+namespace cvc5::internal {
namespace theory {
namespace arith {
class RationalEnumerator : public TypeEnumeratorBase<RationalEnumerator> {
Rational d_rat;
-public:
-
- RationalEnumerator(TypeNode type) throw(AssertionException) :
- TypeEnumeratorBase<RationalEnumerator>(type),
- d_rat(0) {
- Assert(type.getKind() == kind::TYPE_CONSTANT &&
- type.getConst<TypeConstant>() == REAL_TYPE);
+ public:
+ RationalEnumerator(TypeNode type, TypeEnumeratorProperties* tep = nullptr)
+ : TypeEnumeratorBase<RationalEnumerator>(type), d_rat(0)
+ {
+ Assert(type.getKind() == kind::TYPE_CONSTANT
+ && type.getConst<TypeConstant>() == REAL_TYPE);
}
- Node operator*() throw() {
- return NodeManager::currentNM()->mkConst(d_rat);
+ Node operator*() override
+ {
+ return NodeManager::currentNM()->mkConstReal(d_rat);
}
-
- RationalEnumerator& operator++() throw() {
+ RationalEnumerator& operator++() override
+ {
// sequence is 0, then diagonal with negatives interleaved
// ( 0, 1/1, -1/1, 2/1, -2/1, 1/2, -1/2, 3/1, -3/1, 1/3, -1/3,
// 4/1, -4/1, 3/2, -3/2, 2/3, -2/3, 1/4, -1/4, ...)
return *this;
}
- bool isFinished() throw() {
- return false;
- }
-
+ bool isFinished() override { return false; }
};/* class RationalEnumerator */
class IntegerEnumerator : public TypeEnumeratorBase<IntegerEnumerator> {
Integer d_int;
-public:
-
- IntegerEnumerator(TypeNode type) throw(AssertionException) :
- TypeEnumeratorBase<IntegerEnumerator>(type),
- d_int(0) {
- Assert(type.getKind() == kind::TYPE_CONSTANT &&
- type.getConst<TypeConstant>() == INTEGER_TYPE);
+ public:
+ IntegerEnumerator(TypeNode type, TypeEnumeratorProperties* tep = nullptr)
+ : TypeEnumeratorBase<IntegerEnumerator>(type), d_int(0)
+ {
+ Assert(type.getKind() == kind::TYPE_CONSTANT
+ && type.getConst<TypeConstant>() == INTEGER_TYPE);
}
- Node operator*() throw() {
- return NodeManager::currentNM()->mkConst(Rational(d_int));
+ Node operator*() override
+ {
+ return NodeManager::currentNM()->mkConstInt(Rational(d_int));
}
- IntegerEnumerator& operator++() throw() {
+ IntegerEnumerator& operator++() override
+ {
// sequence is 0, 1, -1, 2, -2, 3, -3, ...
if(d_int <= 0) {
d_int = -d_int + 1;
return *this;
}
- bool isFinished() throw() {
- return false;
- }
-
+ bool isFinished() override { return false; }
};/* class IntegerEnumerator */
-}/* CVC4::theory::arith namespace */
-}/* CVC4::theory namespace */
-}/* CVC4 namespace */
+} // namespace arith
+} // namespace theory
+} // namespace cvc5::internal
-#endif /* __CVC4__THEORY__ARITH__TYPE_ENUMERATOR_H */
+#endif /* CVC5__THEORY__ARITH__TYPE_ENUMERATOR_H */