CBMC
|
Author: Diffblue Ltd. More...
#include <generic_parameter_specialization_map.h>
Classes | |
struct | container_paramt |
The index of the container and the type parameter inside that container. More... | |
struct | printert |
A wrapper for a generic_parameter_specialization_mapt and a namespacet that can be output to a stream. More... | |
Public Member Functions | |
std::size_t | insert (const std::vector< java_generic_parametert > ¶meters, std::vector< reference_typet > types) |
Insert a specialization for each type parameters of a container. More... | |
void | pop (std::size_t container_index) |
Pop the top of the specialization stack for a given container. More... | |
std::optional< reference_typet > | pop (const irep_idt ¶meter_name) |
Pop the top of the specialization stack for the container associated with a given type parameter. More... | |
Private Attributes | |
std::unordered_map< irep_idt, container_paramt > | param_to_container |
A map from parameter names to container_paramt instances. More... | |
std::vector< std::stack< std::vector< reference_typet > > > | container_to_specializations |
The list of containers and, for each one, the stack of lists of specializations. More... | |
Friends | |
template<typename ostreamt > | |
ostreamt & | operator<< (ostreamt &stm, const printert &map) |
Output a generic_parameter_specialization_mapt wrapped in a generic_parameter_specialization_mapt::printert to a stream. More... | |
Author: Diffblue Ltd.
A map from generic type parameters to their specializations (type arguments) We need to map from the names of parameters to the container (class or method) that contains them as well as the particular specialization of that parameter. However we do not need the name of the container, merely the full set of specializations for the parameters of that container. We store a stack of specializations for each container for a particular context. Finding the value for a type parameter is a matter of following the specialization for that parameter, unwinding the stack of its container as you do so and repeating until one reaches a non-generic type.
Definition at line 23 of file generic_parameter_specialization_map.h.
std::size_t generic_parameter_specialization_mapt::insert | ( | const std::vector< java_generic_parametert > & | parameters, |
std::vector< reference_typet > | types | ||
) |
Insert a specialization for each type parameters of a container.
Author: Diffblue Ltd.
parameters | The type parameters |
types | The type arguments |
Definition at line 5 of file generic_parameter_specialization_map.cpp.
std::optional< reference_typet > generic_parameter_specialization_mapt::pop | ( | const irep_idt & | parameter_name | ) |
Pop the top of the specialization stack for the container associated with a given type parameter.
parameter_name | The name of the type parameter |
Definition at line 55 of file generic_parameter_specialization_map.cpp.
void generic_parameter_specialization_mapt::pop | ( | std::size_t | container_index | ) |
Pop the top of the specialization stack for a given container.
container_index | The index of the container to pop |
Definition at line 49 of file generic_parameter_specialization_map.cpp.
|
friend |
Output a generic_parameter_specialization_mapt wrapped in a generic_parameter_specialization_mapt::printert to a stream.
ostreamt | The type of stream to output to (not restricted to be derived from std::ostream) |
stm | The stream to output to |
map | The generic_parameter_specialization_mapt printer to output |
Definition at line 86 of file generic_parameter_specialization_map.h.
|
private |
The list of containers and, for each one, the stack of lists of specializations.
Definition at line 37 of file generic_parameter_specialization_map.h.
|
private |
A map from parameter names to container_paramt instances.
Definition at line 33 of file generic_parameter_specialization_map.h.