cprover
cpp_template_parameter.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module:
4 
5 Author: Daniel Kroening, kroening@cs.cmu.edu
6 
7 \*******************************************************************/
8 
9 
10 #ifndef CPROVER_CPP_CPP_TEMPLATE_PARAMETER_H
11 #define CPROVER_CPP_CPP_TEMPLATE_PARAMETER_H
12 
13 #include <util/expr.h>
14 
15 // A data structure for expressions of the form
16 // <typename T, int x, ...>
17 // Not to be confused with template arguments!
18 
20 {
21 public:
22  template_parametert():exprt(ID_template_parameter)
23  {
24  }
25 
26  #if 0
27  bool get_is_type() const
28  {
29  return get_bool(ID_is_type);
30  }
31 
32  void set_is_type(bool value)
33  {
34  set(ID_is_type, value);
35  }
36 
37  irep_idt get_identifier() const
38  {
39  return get(ID_identifier);
40  }
41 
42  void set_identifier(const irep_idt &identifier)
43  {
44  return set(ID_identifier, identifier);
45  }
46 
47  // the type of expression parameters
48  typet &type()
49  {
50  return static_cast<typet &>(add(ID_type));
51  }
52 
53  const typet &type() const
54  {
55  return static_cast<const typet &>(find(ID_type));
56  }
57  #endif
58 
60  {
61  return static_cast<exprt &>(add(ID_C_default_value));
62  }
63 
64  const exprt &default_argument() const
65  {
66  return static_cast<const exprt &>(find(ID_C_default_value));
67  }
68 
69  bool has_default_argument() const
70  {
71  return find(ID_C_default_value).is_not_nil();
72  }
73 };
74 
75 #endif // CPROVER_CPP_CPP_TEMPLATE_PARAMETER_H
The type of an expression.
Definition: type.h:20
bool is_not_nil() const
Definition: irep.h:104
const exprt & default_argument() const
typet & type()
Definition: expr.h:60
bool get_bool(const irep_namet &name) const
Definition: irep.cpp:240
Base class for all expressions.
Definition: expr.h:46
irept & add(const irep_namet &name)
Definition: irep.cpp:306
const irept & find(const irep_namet &name) const
Definition: irep.cpp:285