Verilog to Routing - VPR
|
#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_ |
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.
|
inline |
|
inline |
|
inlineprivate |
|
inlineprivate |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
mutableprivate |
|
mutableprivate |