Towards removing the Expr-level datatype.
Moves DatatypeIndex to its own file, which is the only thing that is necessary remaining from expr/datatype.h.
Also updates the datatype kinds file in preparation for the removal.
variable_type_map.h
datatype.h
datatype.cpp
+ datatype_index.h
+ datatype_index.cpp
dtype.h
dtype.cpp
dtype_cons.h
#include "base/check.h"
#include "expr/attribute.h"
+#include "expr/datatype.h"
#include "expr/dtype.h"
#include "expr/expr_manager.h"
#include "expr/expr_manager_scope.h"
out << t;
}
-DatatypeIndexConstant::DatatypeIndexConstant(unsigned index) : d_index(index) {}
-std::ostream& operator<<(std::ostream& out, const DatatypeIndexConstant& dic) {
- return out << "index_" << dic.getIndex();
-}
-
-
std::string Datatype::getName() const
{
ExprManagerScope ems(*d_em);
#include "base/exception.h"
#include "expr/expr.h"
#include "expr/type.h"
+#include "expr/datatype_index.h"
#include "util/hash.h"
};/* struct DatatypeHashFunction */
-
-/* stores an index to Datatype residing in NodeManager */
-class CVC4_PUBLIC DatatypeIndexConstant {
- public:
- DatatypeIndexConstant(unsigned index);
-
- unsigned getIndex() const { return d_index; }
- bool operator==(const DatatypeIndexConstant& uc) const
- {
- return d_index == uc.d_index;
- }
- bool operator!=(const DatatypeIndexConstant& uc) const
- {
- return !(*this == uc);
- }
- bool operator<(const DatatypeIndexConstant& uc) const
- {
- return d_index < uc.d_index;
- }
- bool operator<=(const DatatypeIndexConstant& uc) const
- {
- return d_index <= uc.d_index;
- }
- bool operator>(const DatatypeIndexConstant& uc) const
- {
- return !(*this <= uc);
- }
- bool operator>=(const DatatypeIndexConstant& uc) const
- {
- return !(*this < uc);
- }
-private:
- const unsigned d_index;
-};/* class DatatypeIndexConstant */
-
-std::ostream& operator<<(std::ostream& out, const DatatypeIndexConstant& dic) CVC4_PUBLIC;
-
-struct CVC4_PUBLIC DatatypeIndexConstantHashFunction {
- inline size_t operator()(const DatatypeIndexConstant& dic) const {
- return IntegerHashFunction()(dic.getIndex());
- }
-};/* struct DatatypeIndexConstantHashFunction */
-
-
-
// FUNCTION DECLARATIONS FOR OUTPUT STREAMS
std::ostream& operator<<(std::ostream& os, const Datatype& dt) CVC4_PUBLIC;
--- /dev/null
+/********************* */
+/*! \file datatype_index.cpp
+ ** \verbatim
+ ** Top contributors (to current version):
+ ** Andrew Reynolds, Morgan Deters, Tim King
+ ** This file is part of the CVC4 project.
+ ** Copyright (c) 2009-2020 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.\endverbatim
+ **
+ ** \brief A class representing an index to a datatype living in NodeManager.
+ **/
+#include "expr/datatype_index.h"
+
+#include <sstream>
+#include <string>
+#include "util/integer.h"
+
+using namespace std;
+
+namespace CVC4 {
+
+DatatypeIndexConstant::DatatypeIndexConstant(unsigned index) : d_index(index) {}
+std::ostream& operator<<(std::ostream& out, const DatatypeIndexConstant& dic)
+{
+ return out << "index_" << dic.getIndex();
+}
+
+size_t DatatypeIndexConstantHashFunction::operator()(
+ const DatatypeIndexConstant& dic) const
+{
+ return IntegerHashFunction()(dic.getIndex());
+}
+
+} // namespace CVC4
--- /dev/null
+/********************* */
+/*! \file datatype_index.h
+ ** \verbatim
+ ** Top contributors (to current version):
+ ** Andrew Reynolds, Morgan Deters, Tim King
+ ** This file is part of the CVC4 project.
+ ** Copyright (c) 2009-2020 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.\endverbatim
+ **
+ ** \brief A class representing an index to a datatype living in NodeManager.
+ **/
+
+#include "cvc4_public.h"
+
+#ifndef CVC4__DATATYPE_INDEX_H
+#define CVC4__DATATYPE_INDEX_H
+
+#include <iosfwd>
+#include "util/hash.h"
+
+namespace CVC4 {
+
+/* stores an index to Datatype residing in NodeManager */
+class CVC4_PUBLIC DatatypeIndexConstant
+{
+ public:
+ DatatypeIndexConstant(unsigned index);
+
+ unsigned getIndex() const { return d_index; }
+ bool operator==(const DatatypeIndexConstant& uc) const
+ {
+ return d_index == uc.d_index;
+ }
+ bool operator!=(const DatatypeIndexConstant& uc) const
+ {
+ return !(*this == uc);
+ }
+ bool operator<(const DatatypeIndexConstant& uc) const
+ {
+ return d_index < uc.d_index;
+ }
+ bool operator<=(const DatatypeIndexConstant& uc) const
+ {
+ return d_index <= uc.d_index;
+ }
+ bool operator>(const DatatypeIndexConstant& uc) const
+ {
+ return !(*this <= uc);
+ }
+ bool operator>=(const DatatypeIndexConstant& uc) const
+ {
+ return !(*this < uc);
+ }
+
+ private:
+ const unsigned d_index;
+}; /* class DatatypeIndexConstant */
+
+std::ostream& operator<<(std::ostream& out,
+ const DatatypeIndexConstant& dic) CVC4_PUBLIC;
+
+struct CVC4_PUBLIC DatatypeIndexConstantHashFunction
+{
+ size_t operator()(const DatatypeIndexConstant& dic) const;
+}; /* struct DatatypeIndexConstantHashFunction */
+
+} // namespace CVC4
+
+#endif /* CVC4__DATATYPE_H */
"a datatype type index"
cardinality DATATYPE_TYPE \
"%TYPE%.getDType().getCardinality(%TYPE%)" \
- "expr/datatype.h"
+ "expr/dtype.h"
well-founded DATATYPE_TYPE \
"%TYPE%.getDType().isWellFounded()" \
"%TYPE%.getDType().mkGroundTerm(%TYPE%)" \
- "expr/datatype.h"
+ "expr/dtype.h"
enumerator DATATYPE_TYPE \
"::CVC4::theory::datatypes::DatatypesEnumerator" \
operator PARAMETRIC_DATATYPE 1: "parametric datatype"
cardinality PARAMETRIC_DATATYPE \
"%TYPE%.getDType().getCardinality(%TYPE%)" \
- "expr/datatype.h"
+ "expr/dtype.h"
well-founded PARAMETRIC_DATATYPE \
"%TYPE%.getDType().isWellFounded()" \
"%TYPE%.getDType().mkGroundTerm(%TYPE%)" \
- "expr/datatype.h"
+ "expr/dtype.h"
enumerator PARAMETRIC_DATATYPE \
"::CVC4::theory::datatypes::DatatypesEnumerator" \
**/
#include "theory/quantifiers/sygus/ce_guided_single_inv_sol.h"
-#include "expr/datatype.h"
#include "expr/dtype.h"
#include "expr/node_algorithm.h"
#include "options/quantifiers_options.h"
#include <vector>
#include "context/cdhashmap.h"
+#include "expr/dtype.h"
#include "expr/node.h"
namespace CVC4 {