cvc4-1.4
kind_template.h
Go to the documentation of this file.
1/********************* */
17#include "cvc4_public.h"
18
19#ifndef __CVC4__KIND_H
20#define __CVC4__KIND_H
21
22#include <iostream>
23#include <sstream>
24
25#include "util/exception.h"
26
27namespace CVC4 {
28namespace kind {
29
31 UNDEFINED_KIND = -1,
32 NULL_EXPR,
33${kind_decls}
36};/* enum Kind_t */
37
38}/* CVC4::kind namespace */
39
40// import Kind into the "CVC4" namespace but keep the individual kind
41// constants under kind::
43
44namespace kind {
45
46inline std::ostream& operator<<(std::ostream&, CVC4::Kind) CVC4_PUBLIC;
47inline std::ostream& operator<<(std::ostream& out, CVC4::Kind k) {
48 using namespace CVC4::kind;
49
50 switch(k) {
51
52 /* special cases */
53 case UNDEFINED_KIND: out << "UNDEFINED_KIND"; break;
54 case NULL_EXPR: out << "NULL"; break;
55${kind_printers}
56 case LAST_KIND: out << "LAST_KIND"; break;
57 default: out << "UNKNOWNKIND!" << int(k); break;
58 }
59
60 return out;
61}
62
63#line 64 "${template}"
64
68/* TODO: This could be generated. */
69inline bool isAssociative(::CVC4::Kind k) {
70 switch(k) {
71 case kind::AND:
72 case kind::OR:
73 case kind::MULT:
74 case kind::PLUS:
75 return true;
76
77 default:
78 return false;
79 }
80}
81
82inline std::string kindToString(::CVC4::Kind k) {
83 std::stringstream ss;
84 ss << k;
85 return ss.str();
86}
87
89 inline size_t operator()(::CVC4::Kind k) const {
90 return k;
91 }
92};/* struct KindHashFunction */
93
94}/* CVC4::kind namespace */
95
100${type_constant_list}
101#line 102 "${template}"
103};/* enum TypeConstant */
104
109 inline size_t operator()(TypeConstant tc) const {
110 return tc;
111 }
112};/* struct TypeConstantHashFunction */
113
114inline std::ostream& operator<<(std::ostream& out, TypeConstant typeConstant) {
115 switch(typeConstant) {
116${type_constant_descriptions}
117#line 118 "${template}"
118 default:
119 out << "UNKNOWN_TYPE_CONSTANT";
120 break;
121 }
122 return out;
123}
124
125namespace theory {
126
128${theory_enum}
129#line 130 "${template}"
131};/* enum TheoryId */
132
133const TheoryId THEORY_FIRST = static_cast<TheoryId>(0);
135
136inline TheoryId& operator ++ (TheoryId& id) {
137 return id = static_cast<TheoryId>(((int)id) + 1);
138}
139
140inline std::ostream& operator<<(std::ostream& out, TheoryId theoryId) {
141 switch(theoryId) {
142${theory_descriptions}
143#line 144 "${template}"
144 default:
145 out << "UNKNOWN_THEORY";
146 break;
147 }
148 return out;
149}
150
152 switch(k) {
154 case kind::NULL_EXPR:
155 break;
156${kind_to_theory_id}
157#line 158 "${template}"
158 case kind::LAST_KIND:
159 break;
160 }
161 throw IllegalArgumentException("", "k", __PRETTY_FUNCTION__, "bad kind");
162}
163
165 switch(typeConstant) {
166${type_constant_to_theory_id}
167#line 168 "${template}"
168 case LAST_TYPE:
169 break;
170 }
171 throw IllegalArgumentException("", "k", __PRETTY_FUNCTION__, "bad type constant");
172}
173
174}/* CVC4::theory namespace */
175}/* CVC4 namespace */
176
177#endif /* __CVC4__KIND_H */
Macros that should be defined everywhere during the building of the libraries and driver binary,...
#define CVC4_PUBLIC
Definition cvc4_public.h:30
CVC4's exception base class and some associated utilities.
std::string kindToString(::CVC4::Kind k)
Definition kind.h:526
std::ostream & operator<<(std::ostream &, CVC4::Kind)
Definition kind.h:284
bool isAssociative(::CVC4::Kind k)
Returns true if the given kind is associative.
Definition kind.h:513
@ $
marks the upper-bound of this enumeration
@ MULT
arithmetic multiplication (N-ary) (33)
Definition kind.h:103
@ UNDEFINED_KIND
undefined
Definition kind.h:61
@ NULL_EXPR
Null kind.
Definition kind.h:62
@ PLUS
arithmetic addition (N-ary) (32)
Definition kind.h:102
@ AND
logical and (N-ary) (23)
Definition kind.h:89
@ LAST_KIND
marks the upper-bound of this enumeration
Definition kind.h:271
@ OR
logical or (N-ary) (26)
Definition kind.h:92
struct CVC4::options::out__option_t out
TheoryId typeConstantToTheoryId(::CVC4::TypeConstant typeConstant)
Definition kind.h:833
std::ostream & operator<<(std::ostream &out, TheoryId theoryId)
Definition kind.h:614
TheoryId & operator++(TheoryId &id)
Definition kind.h:610
const TheoryId THEORY_FIRST
Definition kind.h:607
@ THEORY_LAST
Definition kind.h:604
TheoryId kindToTheoryId(::CVC4::Kind k)
Definition kind.h:635
const TheoryId THEORY_SAT_SOLVER
Definition kind.h:608
Definition expr.h:106
::CVC4::kind::Kind_t Kind
Definition kind.h:279
std::ostream & operator<<(std::ostream &out, const TypeCheckingException &e)
TypeConstant
The enumeration for the built-in atomic types.
Definition kind.h:543
@ LAST_TYPE
Definition kind.h:556
We hash the constants with their values.
size_t operator()(TypeConstant tc) const
size_t operator()(::CVC4::Kind k) const