20#ifndef __CVC4__DATATYPE_H
21#define __CVC4__DATATYPE_H
47 const std::vector<DatatypeConstructor>* d_v;
66 const std::vector<DatatypeConstructorArg>* d_v;
113 inline std::string getName()
const throw();
131 bool isUnresolvedSelf()
const throw();
136 std::
string getName() const throw();
162 std::
string getTypeName() const;
167 bool isResolved() const throw();
187 std::vector<DatatypeConstructorArg> d_args;
190 const std::map<std::string, DatatypeType>& resolutions,
191 const std::vector<Type>& placeholders,
192 const std::vector<Type>& replacements,
193 const std::vector< SortConstructorType >& paramTypes,
194 const std::vector< DatatypeType >& paramReplacements,
size_t cindex)
207 Type doParametricSubstitution(
Type range,
208 const std::vector< SortConstructorType >& paramTypes,
209 const std::vector< DatatypeType >& paramReplacements);
275 std::
string getTesterName() const throw();
280 inline
size_t getNumArgs() const throw();
294 Type getSpecializedConstructorType(
Type returnType) const;
327 inline
bool isResolved() const throw();
360 bool involvesExternalType() const;
450 std::vector<Type> d_params;
452 std::vector<DatatypeConstructor> d_constructors;
488 const std::map<std::string, DatatypeType>& resolutions,
489 const std::vector<Type>& placeholders,
490 const std::vector<Type>& replacements,
491 const std::vector< SortConstructorType >& paramTypes,
492 const std::vector< DatatypeType >& paramReplacements)
499 inline explicit Datatype(std::string name,
bool isCo =
false);
505 inline Datatype(std::string name,
const std::vector<Type>& params,
bool isCo =
false);
514 inline std::string getName()
const throw();
517 inline
size_t getNumConstructors() const throw();
520 inline
bool isParametric() const throw();
523 inline
size_t getNumParameters() const throw();
526 inline
Type getParameter(
unsigned int i ) const;
529 inline
std::vector<
Type> getParameters() const;
532 inline
bool isCodatatype() const;
587 bool operator==(const
Datatype& other) const throw();
589 inline
bool operator!=(const
Datatype& other) const throw();
592 inline
bool isResolved() const throw();
627 bool involvesExternalType() const;
658inline DatatypeResolutionException::DatatypeResolutionException(std::string msg) :
677 d_involvesExt(false),
688 d_involvesExt(false),
697 return d_constructors.size();
701 return d_params.size() > 0;
705 return d_params.size();
710 CheckArgument(i < d_params.size(), i,
"type parameter index out of range for datatype");
724 return !(*
this == other);
732 return iterator(d_constructors,
true);
736 return iterator(d_constructors,
false);
748 return !d_tester.
isNull();
752 return d_args.size();
Representation for an unknown cardinality.
A simple representation of a cardinality.
const DatatypeConstructorArg & value_type
const DatatypeConstructorArg & operator*() const
DatatypeConstructorArgIterator & operator++()
bool operator==(const DatatypeConstructorArgIterator &other) const
bool operator!=(const DatatypeConstructorArgIterator &other) const
DatatypeConstructorArgIterator operator++(int)
const DatatypeConstructorArg * operator->() const
A Datatype constructor argument (i.e., a Datatype field).
bool isResolved() const
Returns true iff this constructor argument has been resolved.
DatatypeConstructorIterator & operator++()
const DatatypeConstructor & value_type
bool operator!=(const DatatypeConstructorIterator &other) const
const DatatypeConstructor & operator*() const
bool operator==(const DatatypeConstructorIterator &other) const
DatatypeConstructorIterator operator++(int)
const DatatypeConstructor * operator->() const
A constructor for a Datatype.
void addArg(std::string selectorName, Type selectorType)
Add an argument (i.e., a data field) of the given name and type to this Datatype constructor.
size_t getNumArgs() const
Get the number of arguments (so far) of this Datatype constructor.
std::string getName() const
Get the name of this Datatype constructor.
iterator begin()
Get the beginning iterator over DatatypeConstructor args.
iterator end()
Get the ending iterator over DatatypeConstructor args.
DatatypeConstructor(std::string name, std::string tester)
Create a new Datatype constructor with the given name for the constructor and the given name for the ...
DatatypeConstructorArgIterator const_iterator
The (const) type for iterators over constructor arguments.
DatatypeConstructor(std::string name)
Create a new Datatype constructor with the given name for the constructor and the same name (prefixed...
void addArg(std::string selectorName, DatatypeSelfType)
Add a self-referential (i.e., a data field) of the given name to this Datatype constructor that refer...
DatatypeConstructorArgIterator iterator
The type for iterators over constructor arguments.
void addArg(std::string selectorName, DatatypeUnresolvedType selectorType)
Add an argument (i.e., a data field) of the given name to this Datatype constructor that refers to an...
bool isResolved() const
Returns true iff this Datatype constructor has already been resolved.
An exception that is thrown when a datatype resolution fails.
A holder type (used in calls to DatatypeConstructor::addArg()) to allow a Datatype to refer to itself...
Class encapsulating the datatype type.
An unresolved type (used in calls to DatatypeConstructor::addArg()) to allow a Datatype to refer to i...
DatatypeUnresolvedType(std::string name)
std::string getName() const
The representation of an inductive datatype.
bool isParametric() const
Is this datatype parametric?
bool operator!=(const Datatype &other) const
Return true iff the two Datatypes are not the same.
void addConstructor(const DatatypeConstructor &c)
Add a constructor to this Datatype.
iterator end()
Get the ending iterator over DatatypeConstructors.
static size_t indexOf(Expr item)
Get the index of a constructor or tester in its datatype, or the index of a selector in its construct...
std::vector< Type > getParameters() const
Get parameters.
size_t getNumParameters() const
Get the nubmer of type parameters.
bool isCodatatype() const
is this a co-datatype?
static const Datatype & datatypeOf(Expr item)
Get the datatype of a constructor, selector, or tester operator.
size_t getNumConstructors() const
Get the number of constructors (so far) for this Datatype.
DatatypeConstructorIterator const_iterator
The (const) type for iterators over constructors.
DatatypeConstructorIterator iterator
The type for iterators over constructors.
Datatype(std::string name, bool isCo=false)
Create a new Datatype of the given name.
static size_t cindexOf(Expr item)
Get the index of constructor corresponding to selector.
Type getParameter(unsigned int i) const
Get parameter.
std::string getName() const
Get the name of this Datatype.
iterator begin()
Get the beginning iterator over DatatypeConstructors.
bool isResolved() const
Return true iff this Datatype has already been resolved.
Class encapsulating CVC4 expressions and methods for constructing new expressions.
bool isNull() const
Check if this is a null expression.
Class encapsulating the Selector type.
Class encapsulating CVC4 expression types.
Macros that should be defined everywhere during the building of the libraries and driver binary,...
CVC4's exception base class and some associated utilities.
[[ Add one-line brief description here ]]
std::ostream & operator<<(std::ostream &out, const TypeCheckingException &e)
void CheckArgument(bool cond, const T &arg, const char *fmt,...)
A hash function for Datatypes.
size_t operator()(const DatatypeConstructor *dtc) const
size_t operator()(const Datatype &dt) const
size_t operator()(const Datatype *dt) const
size_t operator()(const DatatypeConstructor &dtc) const
Interface for expression types.