namespace CVC4 {
-ArrayStoreAll::ArrayStoreAll(const ArrayType& type,
- const Expr& expr) throw(IllegalArgumentException)
- : d_type(NULL), d_expr(NULL) {
+ArrayStoreAll::ArrayStoreAll(const ArrayType& type, const Expr& expr)
+ : d_type(), d_expr() {
// this check is stronger than the assertion check in the expr manager that
// ArrayTypes are actually array types
// because this check is done in production builds too
// Delay allocation until the checks above have been performed. If these fail,
// the memory for d_type and d_expr should not leak. The alternative is catch,
// delete and re-throw.
- d_type = new ArrayType(type);
- d_expr = new Expr(expr);
+ d_type.reset(new ArrayType(type));
+ d_expr.reset(new Expr(expr));
}
ArrayStoreAll::ArrayStoreAll(const ArrayStoreAll& other)
: d_type(new ArrayType(other.getType())),
d_expr(new Expr(other.getExpr())) {}
-ArrayStoreAll::~ArrayStoreAll() throw() {
- delete d_expr;
- delete d_type;
-}
+ArrayStoreAll::~ArrayStoreAll() throw() {}
ArrayStoreAll& ArrayStoreAll::operator=(const ArrayStoreAll& other) {
(*d_type) = other.getType();
return getType() == asa.getType() && getExpr() == asa.getExpr();
}
+bool ArrayStoreAll::operator!=(const ArrayStoreAll& asa) const throw() {
+ return !(*this == asa);
+}
+
bool ArrayStoreAll::operator<(const ArrayStoreAll& asa) const throw() {
return (getType() < asa.getType()) ||
(getType() == asa.getType() && getExpr() < asa.getExpr());
(getType() == asa.getType() && getExpr() <= asa.getExpr());
}
+bool ArrayStoreAll::operator>(const ArrayStoreAll& asa) const throw() {
+ return !(*this <= asa);
+}
+
+bool ArrayStoreAll::operator>=(const ArrayStoreAll& asa) const throw() {
+ return !(*this < asa);
+}
+
std::ostream& operator<<(std::ostream& out, const ArrayStoreAll& asa) {
return out << "__array_store_all__(" << asa.getType() << ", " << asa.getExpr()
<< ')';
return TypeHashFunction()(asa.getType()) * ExprHashFunction()(asa.getExpr());
}
-} /* CVC4 namespace */
+} // namespace CVC4
#include "cvc4_public.h"
-#pragma once
+#ifndef __CVC4__ARRAY_STORE_ALL_H
+#define __CVC4__ARRAY_STORE_ALL_H
#include <iosfwd>
-
-#include "base/exception.h"
+#include <memory>
namespace CVC4 {
- // messy; Expr needs ArrayStoreAll (because it's the payload of a
- // CONSTANT-kinded expression), and ArrayStoreAll needs Expr.
- class Expr;
- class ArrayType;
-}/* CVC4 namespace */
-
+// messy; Expr needs ArrayStoreAll (because it's the payload of a
+// CONSTANT-kinded expression), and ArrayStoreAll needs Expr.
+class Expr;
+class ArrayType;
+} // namespace CVC4
namespace CVC4 {
class CVC4_PUBLIC ArrayStoreAll {
-public:
- ArrayStoreAll(const ArrayStoreAll& other);
+ public:
+ /**
+ * @throws IllegalArgumentException if `type` is not an array or if `expr` is
+ * not a constant of type `type`.
+ */
+ ArrayStoreAll(const ArrayType& type, const Expr& expr);
+ ~ArrayStoreAll() throw();
+ ArrayStoreAll(const ArrayStoreAll& other);
ArrayStoreAll& operator=(const ArrayStoreAll& other);
- ArrayStoreAll(const ArrayType& type, const Expr& expr)
- throw(IllegalArgumentException);
-
- ~ArrayStoreAll() throw();
-
const ArrayType& getType() const throw();
-
const Expr& getExpr() const throw();
bool operator==(const ArrayStoreAll& asa) const throw();
-
- bool operator!=(const ArrayStoreAll& asa) const throw() {
- return !(*this == asa);
- }
-
+ bool operator!=(const ArrayStoreAll& asa) const throw();
bool operator<(const ArrayStoreAll& asa) const throw();
bool operator<=(const ArrayStoreAll& asa) const throw();
- bool operator>(const ArrayStoreAll& asa) const throw() {
- return !(*this <= asa);
- }
- bool operator>=(const ArrayStoreAll& asa) const throw() {
- return !(*this < asa);
- }
+ bool operator>(const ArrayStoreAll& asa) const throw();
+ bool operator>=(const ArrayStoreAll& asa) const throw();
-private:
- ArrayType* d_type;
- Expr* d_expr;
-};/* class ArrayStoreAll */
+ private:
+ std::unique_ptr<ArrayType> d_type;
+ std::unique_ptr<Expr> d_expr;
+}; /* class ArrayStoreAll */
-std::ostream& operator<<(std::ostream& out, const ArrayStoreAll& asa) CVC4_PUBLIC;
+std::ostream& operator<<(std::ostream& out,
+ const ArrayStoreAll& asa) CVC4_PUBLIC;
/**
* Hash function for the ArrayStoreAll constants.
*/
struct CVC4_PUBLIC ArrayStoreAllHashFunction {
size_t operator()(const ArrayStoreAll& asa) const;
-};/* struct ArrayStoreAllHashFunction */
+}; /* struct ArrayStoreAllHashFunction */
+
+} // namespace CVC4
-}/* CVC4 namespace */
+#endif /* __CVC4__ARRAY_STORE_ALL_H */