1 |
|
/****************************************************************************** |
2 |
|
* Top contributors (to current version): |
3 |
|
* Andrew Reynolds |
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 |
|
* A class representing a type ascription. |
14 |
|
*/ |
15 |
|
|
16 |
|
#include "expr/ascription_type.h" |
17 |
|
|
18 |
|
#include <iostream> |
19 |
|
|
20 |
|
#include "expr/type_node.h" |
21 |
|
|
22 |
|
namespace cvc5 { |
23 |
|
|
24 |
442 |
AscriptionType::AscriptionType(TypeNode t) : d_type(new TypeNode(t)) {} |
25 |
|
|
26 |
99 |
AscriptionType::AscriptionType(const AscriptionType& at) |
27 |
99 |
: d_type(new TypeNode(at.getType())) |
28 |
|
{ |
29 |
99 |
} |
30 |
|
|
31 |
|
AscriptionType& AscriptionType::operator=(const AscriptionType& at) |
32 |
|
{ |
33 |
|
(*d_type) = at.getType(); |
34 |
|
return *this; |
35 |
|
} |
36 |
|
|
37 |
541 |
AscriptionType::~AscriptionType() {} |
38 |
2142 |
TypeNode AscriptionType::getType() const { return *d_type.get(); } |
39 |
541 |
bool AscriptionType::operator==(const AscriptionType& other) const |
40 |
|
{ |
41 |
541 |
return getType() == other.getType(); |
42 |
|
} |
43 |
|
bool AscriptionType::operator!=(const AscriptionType& other) const |
44 |
|
{ |
45 |
|
return getType() != other.getType(); |
46 |
|
} |
47 |
|
|
48 |
838 |
size_t AscriptionTypeHashFunction::operator()(const AscriptionType& at) const |
49 |
|
{ |
50 |
838 |
return std::hash<TypeNode>()(at.getType()); |
51 |
|
} |
52 |
|
|
53 |
|
std::ostream& operator<<(std::ostream& out, AscriptionType at) |
54 |
|
{ |
55 |
|
out << at.getType(); |
56 |
|
return out; |
57 |
|
} |
58 |
|
|
59 |
29340 |
} // namespace cvc5 |