Cerata
A library to generate structural hardware designs
cerata::TypeMapper Class Reference

A structure to dynamically define type mappings between flattened types. More...

#include <flattype.h>

+ Inheritance diagram for cerata::TypeMapper:
+ Collaboration diagram for cerata::TypeMapper:

Public Member Functions

 TypeMapper (Type *a, Type *b)
 TypeMapper constructor. Constructs an empty type mapping.
 
TypeMapperAdd (int64_t a, int64_t b)
 Add a mapping between two FlatTypes to the mapper.
 
MappingMatrix< int64_t > map_matrix ()
 Return the mapping matrix of this TypeMapper.
 
void SetMappingMatrix (MappingMatrix< int64_t > map_matrix)
 Set the mapping matrix of this TypeMapper.
 
std::vector< FlatTypeflat_a () const
 Return the list of flattened types on the "a"-side.
 
std::vector< FlatTypeflat_b () const
 Return the list of flattened types on the "b"-side.
 
Typea () const
 Return the type on the "a"-side.
 
Typeb () const
 Return the type on the "b"-side.
 
bool CanConvert (const Type *a, const Type *b) const
 Return true if this TypeMapper can map type a to type b.
 
std::shared_ptr< TypeMapperInverse () const
 Return a new TypeMapper that is the inverse of this TypeMapper.
 
std::vector< MappingPairGetUniqueMappingPairs ()
 Get a list of unique mapping pairs.
 
std::string ToString () const
 Return a human-readable string of this TypeMapper.
 
- Public Member Functions inherited from cerata::Named
 Named (std::string name)
 Named constructor.
 
std::string name () const
 Return the name of the object.
 
void SetName (std::string name)
 Change the name of the object.
 
virtual ~Named ()=default
 Destructor.
 

Static Public Member Functions

static std::shared_ptr< TypeMapperMake (Type *a)
 Construct a new TypeMapper from some type to itself, and return a smart pointer to it.
 
static std::shared_ptr< TypeMapperMakeImplicit (Type *a, Type *b)
 Construct a new TypeMapper from some type to another type, and automatically determine the type mapping.
 
static std::shared_ptr< TypeMapperMake (Type *a, Type *b)
 Construct a new, empty TypeMapper between two types.
 
static std::shared_ptr< TypeMapperMake (const std::shared_ptr< Type > &a, const std::shared_ptr< Type > &b)
 Construct a new, empty TypeMapper between two types.
 

Public Attributes

std::unordered_map< std::string, std::string > meta
 KV storage for metadata of tools or specific backend implementations.
 

Protected Attributes

std::vector< FlatTypefa_
 The list of flattened types on the "a"-side.
 
std::vector< FlatTypefb_
 The list of flattened types on the "b"-side.
 
Typea_
 Type of the "a"-side.
 
Typeb_
 Type of the "b"-side.
 
MappingMatrix< int64_t > matrix_
 The mapping matrix.
 

Detailed Description

A structure to dynamically define type mappings between flattened types.

Useful for ordered concatenation of N synthesizable types onto M synthesizable types in any way.

Definition at line 326 of file flattype.h.


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