CBMC
Loading...
Searching...
No Matches
Classes | Public Member Functions | Private Attributes | Friends | List of all members
generic_parameter_specialization_mapt Class Reference

Author: Diffblue Ltd. More...

#include <generic_parameter_specialization_map.h>

+ Collaboration diagram for generic_parameter_specialization_mapt:

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 > &parameters, std::vector< reference_typet > types)
  Insert a specialization for each type parameters of a container.
 
void  pop (std::size_t container_index)
  Pop the top of the specialization stack for a given container.
 
  Pop the top of the specialization stack for the container associated with a given type parameter.
 

Private Attributes

std::unordered_map< irep_idt, container_paramtparam_to_container
  A map from parameter names to container_paramt instances.
 
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.
 

Friends

template<typename ostreamt >
 

Detailed Description

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.

Member Function Documentation

◆  insert()

std::size_t generic_parameter_specialization_mapt::insert ( const std::vector< java_generic_parametert > &  parameters,
std::vector< reference_typettypes 
)

Insert a specialization for each type parameters of a container.

Author: Diffblue Ltd.

Parameters
parameters The type parameters
types The type arguments
Returns
: The index of the added container

Definition at line 5 of file generic_parameter_specialization_map.cpp.

◆  pop() [1/2]

std::optional< reference_typet > generic_parameter_specialization_mapt::pop ( const irep_idtparameter_name )

Pop the top of the specialization stack for the container associated with a given type parameter.

Parameters
parameter_name The name of the type parameter
Returns
: The specialization for the given type parameter, if there was one before the pop, or an empty std::optional if the stack was empty

Definition at line 55 of file generic_parameter_specialization_map.cpp.

◆  pop() [2/2]

void generic_parameter_specialization_mapt::pop ( std::size_t  container_index )

Pop the top of the specialization stack for a given container.

Parameters
container_index The index of the container to pop

Definition at line 49 of file generic_parameter_specialization_map.cpp.

Friends And Related Symbol Documentation

◆  operator<<

template<typename ostreamt >
ostreamt & operator<< ( ostreamtstm,
const printertmap 
)
friend

Output a generic_parameter_specialization_mapt wrapped in a generic_parameter_specialization_mapt::printert to a stream.

Template Parameters
ostreamt The type of stream to output to (not restricted to be derived from std::ostream)
Parameters
stm The stream to output to
map The generic_parameter_specialization_mapt printer to output
Returns
: A reference to the stream passed in

Definition at line 86 of file generic_parameter_specialization_map.h.

Member Data Documentation

◆  container_to_specializations

std::vector<std::stack<std::vector<reference_typet> > > generic_parameter_specialization_mapt::container_to_specializations
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.

◆  param_to_container

std::unordered_map<irep_idt, container_paramt> generic_parameter_specialization_mapt::param_to_container
private

A map from parameter names to container_paramt instances.

Definition at line 33 of file generic_parameter_specialization_map.h.


The documentation for this class was generated from the following files:

AltStyle によって変換されたページ (->オリジナル) /