diff options
author | Dejan Jovanović <dejan@cs.nyu.edu> | 2012-12-21 19:08:26 -0500 |
---|---|---|
committer | Dejan Jovanović <dejan@cs.nyu.edu> | 2012-12-21 19:08:26 -0500 |
commit | d1cd7732b17b280ad17d12a84399ff05cd1d77c4 (patch) | |
tree | 3e87311558c4d845c97ffdaad42cd748ddf6febf /src/theory | |
parent | 3614e4664567cfdb5fcbec0efe45e279369aba86 (diff) |
adding copy constructor for the datatype enumerator
fixes bug 484
Diffstat (limited to 'src/theory')
-rw-r--r-- | src/theory/datatypes/type_enumerator.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/theory/datatypes/type_enumerator.h b/src/theory/datatypes/type_enumerator.h index d8557fcaf..2a14d7fba 100644 --- a/src/theory/datatypes/type_enumerator.h +++ b/src/theory/datatypes/type_enumerator.h @@ -57,6 +57,7 @@ class DatatypesEnumerator : public TypeEnumeratorBase<DatatypesEnumerator> { } } + public: DatatypesEnumerator(TypeNode type) throw() : @@ -91,6 +92,25 @@ public: newEnumerators(); } + DatatypesEnumerator(const DatatypesEnumerator& other) : + TypeEnumeratorBase<DatatypesEnumerator>(other.getType()), + d_datatype(other.d_datatype), + d_ctor(other.d_ctor), + d_zeroCtor(other.d_zeroCtor), + d_argEnumerators(NULL) { + + if (other.d_argEnumerators != NULL) { + d_argEnumerators = new TypeEnumerator*[d_datatype[d_ctor].getNumArgs()]; + for(size_t a = 0; a < d_datatype[d_ctor].getNumArgs(); ++a) { + if (other.d_argEnumerators[a] != NULL) { + d_argEnumerators[a] = new TypeEnumerator(*other.d_argEnumerators[a]); + } else { + d_argEnumerators[a] = NULL; + } + } + } + } + ~DatatypesEnumerator() throw() { deleteEnumerators(); } |