1 |
|
/****************************************************************************** |
2 |
|
* Top contributors (to current version): |
3 |
|
* Mudathir Mohamed, Mathias Preiner |
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 for singleton operator for sets. |
14 |
|
*/ |
15 |
|
|
16 |
|
#include "cvc5_public.h" |
17 |
|
|
18 |
|
#ifndef CVC5__SINGLETON_OP_H |
19 |
|
#define CVC5__SINGLETON_OP_H |
20 |
|
|
21 |
|
#include <memory> |
22 |
|
|
23 |
|
namespace cvc5 { |
24 |
|
|
25 |
|
class TypeNode; |
26 |
|
|
27 |
|
/** |
28 |
|
* The class is an operator for kind SINGLETON used to construct singleton sets. |
29 |
|
* It specifies the type of the single element especially when it is a constant. |
30 |
|
* e.g. the type of rational 1 is Int, however |
31 |
|
* (singleton (singleton_op Real) 1) is of type (Set Real), not (Set Int). |
32 |
|
* Note that the type passed to the constructor is the element's type, not the |
33 |
|
* set type. |
34 |
|
*/ |
35 |
14331 |
class SingletonOp |
36 |
|
{ |
37 |
|
public: |
38 |
|
SingletonOp(const TypeNode& elementType); |
39 |
|
SingletonOp(const SingletonOp& op); |
40 |
|
|
41 |
|
/** return the type of the current object */ |
42 |
|
const TypeNode& getType() const; |
43 |
|
|
44 |
|
bool operator==(const SingletonOp& op) const; |
45 |
|
|
46 |
|
private: |
47 |
|
SingletonOp(); |
48 |
|
/** a pointer to the type of the singleton element */ |
49 |
|
std::unique_ptr<TypeNode> d_type; |
50 |
|
}; /* class Singleton */ |
51 |
|
|
52 |
|
std::ostream& operator<<(std::ostream& out, const SingletonOp& op); |
53 |
|
|
54 |
|
/** |
55 |
|
* Hash function for the SingletonHashFunction objects. |
56 |
|
*/ |
57 |
|
struct SingletonOpHashFunction |
58 |
|
{ |
59 |
|
size_t operator()(const SingletonOp& op) const; |
60 |
|
}; /* struct SingletonOpHashFunction */ |
61 |
|
|
62 |
|
} // namespace cvc5 |
63 |
|
|
64 |
|
#endif /* CVC5__SINGLETON_OP_H */ |