1 |
|
/****************************************************************************** |
2 |
|
* Top contributors (to current version): |
3 |
|
* Tim King, Kshitij Bansal, Andres Noetzli |
4 |
|
* |
5 |
|
* This file is part of the cvc5 project. |
6 |
|
* |
7 |
|
* Copyright (c) 2009-2021 by the authors listed in the file AUTHORS |
8 |
|
* in the top-level source directory and their institutional affiliations. |
9 |
|
* All rights reserved. See the file COPYING in the top-level source |
10 |
|
* directory for licensing information. |
11 |
|
* **************************************************************************** |
12 |
|
* |
13 |
|
* [[ Add one-line brief description here ]] |
14 |
|
* |
15 |
|
* [[ Add lengthier description here ]] |
16 |
|
* \todo document this file |
17 |
|
*/ |
18 |
|
|
19 |
|
#include "expr/emptyset.h" |
20 |
|
|
21 |
|
#include <iostream> |
22 |
|
|
23 |
|
#include "expr/type_node.h" |
24 |
|
|
25 |
|
namespace cvc5 { |
26 |
|
|
27 |
|
std::ostream& operator<<(std::ostream& out, const EmptySet& asa) { |
28 |
|
return out << "emptyset(" << asa.getType() << ')'; |
29 |
|
} |
30 |
|
|
31 |
10781 |
size_t EmptySetHashFunction::operator()(const EmptySet& es) const { |
32 |
10781 |
return std::hash<TypeNode>()(es.getType()); |
33 |
|
} |
34 |
|
|
35 |
|
/** |
36 |
|
* Constructs an emptyset of the specified type. Note that the argument |
37 |
|
* is the type of the set itself, NOT the type of the elements. |
38 |
|
*/ |
39 |
2837 |
EmptySet::EmptySet(const TypeNode& setType) : d_type(new TypeNode(setType)) {} |
40 |
|
|
41 |
3951 |
EmptySet::EmptySet(const EmptySet& es) : d_type(new TypeNode(es.getType())) {} |
42 |
|
|
43 |
|
EmptySet& EmptySet::operator=(const EmptySet& es) { |
44 |
|
(*d_type) = es.getType(); |
45 |
|
return *this; |
46 |
|
} |
47 |
|
|
48 |
6788 |
EmptySet::~EmptySet() {} |
49 |
26349 |
const TypeNode& EmptySet::getType() const { return *d_type; } |
50 |
4823 |
bool EmptySet::operator==(const EmptySet& es) const |
51 |
|
{ |
52 |
4823 |
return getType() == es.getType(); |
53 |
|
} |
54 |
|
|
55 |
|
bool EmptySet::operator!=(const EmptySet& es) const { return !(*this == es); } |
56 |
|
bool EmptySet::operator<(const EmptySet& es) const |
57 |
|
{ |
58 |
|
return getType() < es.getType(); |
59 |
|
} |
60 |
|
|
61 |
|
bool EmptySet::operator<=(const EmptySet& es) const |
62 |
|
{ |
63 |
|
return getType() <= es.getType(); |
64 |
|
} |
65 |
|
|
66 |
|
bool EmptySet::operator>(const EmptySet& es) const { return !(*this <= es); } |
67 |
|
bool EmptySet::operator>=(const EmptySet& es) const { return !(*this < es); } |
68 |
29340 |
} // namespace cvc5 |