Verilog to Routing - VPR
Public Member Functions | Private Member Functions | Private Attributes
MetadataStorage< LookupKey > Class Template Reference

#include <metadata_storage.h>

Public Member Functions

void reserve (size_t s)
 
void add_metadata (const LookupKey &lookup_key, vtr::interned_string meta_key, vtr::interned_string meta_value)
 
vtr::flat_map< LookupKey, t_metadata_dict >::const_iterator find (const LookupKey &lookup_key) const
 
void clear ()
 
size_t size () const
 
vtr::flat_map< LookupKey, t_metadata_dict >::const_iterator begin () const
 
vtr::flat_map< LookupKey, t_metadata_dict >::const_iterator end () const
 

Private Member Functions

void check_for_map () const
 
void build_map () const
 

Private Attributes

std::vector< std::tuple< LookupKey, vtr::interned_string, vtr::interned_string > > data_
 
vtr::flat_map< LookupKey, t_metadata_dict > map_
 

Detailed Description

template<typename LookupKey>
class MetadataStorage< LookupKey >

MetadataStorage is a two phase data structure. In the first phase, metadata is added cheaply by simply pushing onto a vector. This is unsuitable for lookup, but is fast, and because strings are interned, not too expensive memory wise.

The second phase occurs after all data has been inserted. When/if a lookup is needed, the vector is sorted and the final metadata lookup is generated. In the event that the lookup is never needed, this saves the time spent building the lookup, and reduces the number of outstanding memory allocations dramatically.

Member Function Documentation

◆ add_metadata()

template<typename LookupKey>
void MetadataStorage< LookupKey >::add_metadata ( const LookupKey &  lookup_key,
vtr::interned_string  meta_key,
vtr::interned_string  meta_value 
)
inline

◆ begin()

template<typename LookupKey>
vtr::flat_map<LookupKey, t_metadata_dict>::const_iterator MetadataStorage< LookupKey >::begin ( ) const
inline

◆ build_map()

template<typename LookupKey>
void MetadataStorage< LookupKey >::build_map ( ) const
inlineprivate

◆ check_for_map()

template<typename LookupKey>
void MetadataStorage< LookupKey >::check_for_map ( ) const
inlineprivate

◆ clear()

template<typename LookupKey>
void MetadataStorage< LookupKey >::clear ( )
inline

◆ end()

template<typename LookupKey>
vtr::flat_map<LookupKey, t_metadata_dict>::const_iterator MetadataStorage< LookupKey >::end ( ) const
inline

◆ find()

template<typename LookupKey>
vtr::flat_map<LookupKey, t_metadata_dict>::const_iterator MetadataStorage< LookupKey >::find ( const LookupKey &  lookup_key) const
inline

◆ reserve()

template<typename LookupKey>
void MetadataStorage< LookupKey >::reserve ( size_t  s)
inline

◆ size()

template<typename LookupKey>
size_t MetadataStorage< LookupKey >::size ( ) const
inline

Field Documentation

◆ data_

template<typename LookupKey>
std::vector<std::tuple<LookupKey, vtr::interned_string, vtr::interned_string> > MetadataStorage< LookupKey >::data_
mutableprivate

◆ map_

template<typename LookupKey>
vtr::flat_map<LookupKey, t_metadata_dict> MetadataStorage< LookupKey >::map_
mutableprivate

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