timemory 3.3.0
Modular C++ Toolkit for Performance Analysis and Logging. Profiling API and Tools for C, C++, CUDA, Fortran, and Python. The C++ template API is essentially a framework to creating tools: it is designed to provide a unifying interface for recording various performance measurements alongside data logging and interfaces to other tools.
tim::hash Namespace Reference

Classes

struct  hasher
 
struct  static_string
 

Typedefs

using hash_value_t = size_t
 
using hash_map_t = std::unordered_map< hash_value_t, std::string >
 
using hash_alias_map_t = std::unordered_map< hash_value_t, hash_value_t >
 
using hash_map_ptr_t = std::shared_ptr< hash_map_t >
 
using hash_map_ptr_pair_t = std::pair< hash_map_ptr_t, hash_map_ptr_t >
 
using hash_alias_ptr_t = std::shared_ptr< hash_alias_map_t >
 
using hash_resolver_t = std::function< bool(hash_value_t, std::string &)>
 
using hash_resolver_vec_t = std::vector< hash_resolver_t >
 

Functions

 TIMEMORY_HASH_LINKAGE (hash_map_ptr_t &) get_hash_ids()
 
 TIMEMORY_HASH_LINKAGE (hash_alias_ptr_t &) get_hash_aliases()
 
 TIMEMORY_HASH_LINKAGE (std::shared_ptr< hash_resolver_vec_t > &) get_hash_resolvers()
 
 TIMEMORY_HASH_LINKAGE (hash_value_t) get_hash_id(const hash_alias_ptr_t &_hash_alias
 
 if (_alias_itr !=_hash_alias->end()) return _alias_itr -> second
 
 TIMEMORY_HASH_LINKAGE (void) add_hash_id(const hash_map_ptr_t &
 
 TIMEMORY_HASH_LINKAGE (void) add_hash_id(hash_value_t _hash_id
 
 if (_reported.count(_hash_id) > 0) return
 
_reported insert (_hash_id)
 
 if (!_hash_map)
 
 for (const auto &aitr :*_hash_alias)
 
 for (auto &mitr :*_hash_map)
 
 if (_hash_id > 0)
 
 TIMEMORY_HASH_LINKAGE (typename hash_map_t::const_iterator) find_hash_identifier(const hash_map_ptr_t &_hash_map
 
 if (_map_itr !=_hash_map->end()) return _map_itr = &_map_itr->second
 
return _hash_map end ()
 
 TIMEMORY_HASH_LINKAGE (typename hash_map_t::const_iterator) find_hash_identifier(hash_value_t _hash_id)
 
 TIMEMORY_HASH_LINKAGE (bool) get_hash_identifier(const hash_map_ptr_t &_hash_map
 
 if (static_string::is_registered(_hash_id)) = reinterpret_cast<const char*>(_hash_id)
 
 if (_hash_alias)
 
 TIMEMORY_HASH_LINKAGE (std::string) get_hash_identifier(hash_value_t _hash_id)
 
 TIMEMORY_HASH_LINKAGE (bool) get_hash_identifier(hash_value_t _hash_id
 
 TIMEMORY_HASH_LINKAGE (std::string) get_hash_identifier(const hash_map_ptr_t &_hash_map
 
 if (get_hash_identifier(_hash_map, _hash_alias, _hash_id, _ret)) return *_ret
 
 hash_identifier_error (_hash_map, _hash_alias, _hash_id)
 
hash_map_ptr_tget_hash_ids ()
 
hash_alias_ptr_tget_hash_aliases ()
 
std::shared_ptr< hash_resolver_vec_t > & get_hash_resolvers ()
 
template<typename Tp , std::enable_if_t< concepts::is_string_type< std::decay_t< Tp > >::value, int > = 0>
hash_value_t get_hash_id (Tp &&_prefix)
 
hash_value_t get_combined_hash_id (hash_value_t _lhs, hash_value_t _rhs)
 
template<typename Tp , std::enable_if_t<!std::is_integral< std::decay_t< Tp > >::value, int > = 0>
hash_value_t get_combined_hash_id (hash_value_t _lhs, Tp &&_rhs)
 
hash_value_t get_hash_id (const hash_alias_ptr_t &_hash_alias, hash_value_t _hash_id)
 
hash_value_t add_hash_id (hash_map_ptr_t &_hash_map, string_view_cref_t _prefix)
 add an string to the given hash-map (if it doesn't already exist) and return the hash More...
 
hash_value_t add_hash_id (string_view_cref_t _prefix)
 add an string to the default hash-map (if it doesn't already exist) and return the hash More...
 
void add_hash_id (const hash_map_ptr_t &_hash_map, const hash_alias_ptr_t &_hash_alias, hash_value_t _hash_id, hash_value_t _alias_hash_id)
 
void add_hash_id (const hash_alias_ptr_t &_hash_alias, hash_value_t _hash_id, hash_value_t _alias_hash_id)
 
void add_hash_id (hash_value_t _hash_id, hash_value_t _alias_hash_id)
 
void hash_identifier_error (const hash_map_ptr_t &_hash_map, const hash_alias_ptr_t &_hash_alias, hash_value_t _hash_id)
 
string_view_t get_hash_identifier_fast (hash_value_t _hash)
 this does not check other threads or aliases. Only call this function when you know that the hash exists on the thread and is not an alias More...
 
bool get_hash_identifier_fast (hash_value_t _hash, std::string *&_v)
 
bool get_hash_identifier_fast (hash_value_t _hash, const char *&_v)
 
hash_map_t::const_iterator find_hash_identifier (const hash_map_ptr_t &_hash_map, const hash_alias_ptr_t &_hash_alias, hash_value_t _hash_id)
 
hash_map_t::const_iterator find_hash_identifier (hash_value_t _hash_id)
 
bool get_hash_identifier (const hash_map_ptr_t &_hash_map, const hash_alias_ptr_t &_hash_alias, hash_value_t _hash_id, std::string *&_ret)
 
bool get_hash_identifier (const hash_map_ptr_t &_hash_map, const hash_alias_ptr_t &_hash_alias, hash_value_t _hash_id, const char *&_ret)
 
bool get_hash_identifier (hash_value_t _hash_id, std::string *&_ret)
 
bool get_hash_identifier (hash_value_t _hash_id, const char *&_ret)
 
std::string get_hash_identifier (const hash_map_ptr_t &_hash_map, const hash_alias_ptr_t &_hash_alias, hash_value_t _hash_id)
 
std::string get_hash_identifier (hash_value_t _hash_id)
 
template<typename FuncT >
size_t add_hash_resolver (FuncT &&_func)
 
std::string demangle_hash_identifier (std::string, char bdelim='[', char edelim=']')
 
template<typename... Args>
auto get_demangled_hash_identifier (Args &&... _args)
 
template<typename T >
size_t get_hash (T &&obj)
 
size_t get_hash (string_view_cref_t str)
 
size_t get_hash (const char *cstr)
 

Variables

hash_value_t _hash_id
 
const hash_alias_ptr_t_hash_alias
 
const hash_alias_ptr_t hash_value_t hash_value_t _alias_hash_id
 
auto _alias_itr = _hash_alias->find(_hash_id)
 
const hash_alias_ptr_t hash_value_t std::string *& _ret
 
auto _map_itr = _hash_map->find(_hash_id)
 
 true
 
return false
 

Typedef Documentation

◆ hash_alias_map_t

using tim::hash::hash_alias_map_t = typedef std::unordered_map<hash_value_t, hash_value_t>

Definition at line 86 of file types.hpp.

◆ hash_alias_ptr_t

using tim::hash::hash_alias_ptr_t = typedef std::shared_ptr<hash_alias_map_t>

Definition at line 89 of file types.hpp.

◆ hash_map_ptr_pair_t

Definition at line 88 of file types.hpp.

◆ hash_map_ptr_t

using tim::hash::hash_map_ptr_t = typedef std::shared_ptr<hash_map_t>

Definition at line 87 of file types.hpp.

◆ hash_map_t

using tim::hash::hash_map_t = typedef std::unordered_map<hash_value_t, std::string>

Definition at line 85 of file types.hpp.

◆ hash_resolver_t

using tim::hash::hash_resolver_t = typedef std::function<bool(hash_value_t, std::string&)>

Definition at line 90 of file types.hpp.

◆ hash_resolver_vec_t

using tim::hash::hash_resolver_vec_t = typedef std::vector<hash_resolver_t>

Definition at line 91 of file types.hpp.

◆ hash_value_t

using tim::hash::hash_value_t = typedef size_t

Definition at line 84 of file types.hpp.

Function Documentation

◆ add_hash_id() [1/5]

void tim::hash::add_hash_id ( const hash_alias_ptr_t _hash_alias,
hash_value_t  _hash_id,
hash_value_t  _alias_hash_id 
)

◆ add_hash_id() [2/5]

void tim::hash::add_hash_id ( const hash_map_ptr_t _hash_map,
const hash_alias_ptr_t _hash_alias,
hash_value_t  _hash_id,
hash_value_t  _alias_hash_id 
)

◆ add_hash_id() [3/5]

hash_value_t tim::hash::add_hash_id ( hash_map_ptr_t _hash_map,
string_view_cref_t  _prefix 
)
inline

add an string to the given hash-map (if it doesn't already exist) and return the hash

Definition at line 190 of file types.hpp.

191{
193 if(_hash_map && _hash_map->find(_hash_id) == _hash_map->end())
194 {
195 (*_hash_map)[_hash_id] = std::string{ _prefix };
196 }
197 return _hash_id;
198}
hash_value_t get_hash_id(const hash_alias_ptr_t &_hash_alias, hash_value_t _hash_id)
hash_value_t _hash_id
Definition: definition.hpp:114
size_t hash_value_t
Definition: types.hpp:84
char const std::string & _prefix
Definition: config.cpp:55
tim::mpl::apply< std::string > string
Definition: macros.hpp:53

◆ add_hash_id() [4/5]

void tim::hash::add_hash_id ( hash_value_t  _hash_id,
hash_value_t  _alias_hash_id 
)

◆ add_hash_id() [5/5]

hash_value_t tim::hash::add_hash_id ( string_view_cref_t  _prefix)
inline

add an string to the default hash-map (if it doesn't already exist) and return the hash

Definition at line 210 of file types.hpp.

211{
213}
hash_map_ptr_t & get_hash_ids()
void add_hash_id(hash_value_t _hash_id, hash_value_t _alias_hash_id)

◆ add_hash_resolver()

template<typename FuncT >
size_t tim::hash::add_hash_resolver ( FuncT &&  _func)

Definition at line 315 of file types.hpp.

316{
317 auto _resolvers = get_hash_resolvers();
318 if(!_resolvers)
319 return 0;
320 _resolvers->emplace_back(std::forward<FuncT>(_func));
321 return _resolvers->size();
322}
std::shared_ptr< hash_resolver_vec_t > & get_hash_resolvers()

◆ demangle_hash_identifier()

std::string tim::hash::demangle_hash_identifier ( std::string  ,
char  bdelim = '[',
char  edelim = ']' 
)

◆ end()

return _hash_map tim::hash::end ( )

◆ find_hash_identifier() [1/2]

hash_map_t::const_iterator tim::hash::find_hash_identifier ( const hash_map_ptr_t _hash_map,
const hash_alias_ptr_t _hash_alias,
hash_value_t  _hash_id 
)

◆ find_hash_identifier() [2/2]

hash_map_t::const_iterator tim::hash::find_hash_identifier ( hash_value_t  _hash_id)

◆ for() [1/2]

tim::hash::for ( auto &mitr :*  _hash_map)

Definition at line 199 of file definition.hpp.

199 : *_hash_map)
200 {
201 if(_hash_id == mitr.first)
202 {
203 fprintf(stderr,
204 "[%s@%s:%i]> found hash identifier %llu in hash map via iteration "
205 "after uomap->find failed! This might be an ABI or an integer "
206 "overflow problem\n",
207 __FUNCTION__, TIMEMORY_TRUNCATED_FILE_STRING(__FILE__).c_str(),
208 __LINE__, (unsigned long long) _hash_id);
209 }
210 }
#define TIMEMORY_TRUNCATED_FILE_STRING(FILE)
Definition: macros.hpp:95

◆ for() [2/2]

tim::hash::for ( const auto &aitr :*  _hash_alias)

Definition at line 179 of file definition.hpp.

179 : *_hash_alias)
180 {
181 if(_hash_id == aitr.first)
182 {
183 for(const auto& mitr : *_hash_map)
184 {
185 if(mitr.first == aitr.second)
186 {
187 fprintf(stderr,
188 "[%s@%s:%i]> found hash identifier %llu in alias map via "
189 "iteration after uomap->find failed! This might be an ABI or "
190 "an integer overflow problem\n",
191 __FUNCTION__,
192 TIMEMORY_TRUNCATED_FILE_STRING(__FILE__).c_str(), __LINE__,
193 (unsigned long long) _hash_id);
194 }
195 }
196 }
197 }
const hash_alias_ptr_t & _hash_alias
Definition: definition.hpp:124

◆ get_combined_hash_id() [1/2]

hash_value_t tim::hash::get_combined_hash_id ( hash_value_t  _lhs,
hash_value_t  _rhs 
)

Definition at line 161 of file types.hpp.

162{
163 return (_lhs ^= _rhs + 0x9e3779b9 + (_lhs << 6) + (_lhs >> 2));
164}

◆ get_combined_hash_id() [2/2]

template<typename Tp , std::enable_if_t<!std::is_integral< std::decay_t< Tp > >::value, int > = 0>
hash_value_t tim::hash::get_combined_hash_id ( hash_value_t  _lhs,
Tp &&  _rhs 
)

Definition at line 170 of file types.hpp.

171{
172 return get_combined_hash_id(_lhs, get_hash_id(std::forward<Tp>(_rhs)));
173}
hash_value_t get_combined_hash_id(hash_value_t _lhs, Tp &&_rhs)
Definition: types.hpp:170

Referenced by tim::scope::config::compute_hash().

◆ get_demangled_hash_identifier()

template<typename... Args>
auto tim::hash::get_demangled_hash_identifier ( Args &&...  _args)

Definition at line 337 of file types.hpp.

338{
339 return demangle_hash_identifier(get_hash_identifier(std::forward<Args>(_args)...));
340}
std::string get_hash_identifier(hash_value_t _hash_id)
std::string demangle_hash_identifier(std::string, char bdelim='[', char edelim=']')
std::array< char *, 4 > _args

◆ get_hash() [1/3]

size_t tim::hash::get_hash ( const char *  cstr)

Definition at line 218 of file utility.hpp.

219{
220 return std::hash<string_view_t>{}(cstr);
221}

◆ get_hash() [2/3]

size_t tim::hash::get_hash ( string_view_cref_t  str)

Definition at line 212 of file utility.hpp.

213{
214 return std::hash<string_view_t>{}(str);
215}

◆ get_hash() [3/3]

template<typename T >
size_t tim::hash::get_hash ( T &&  obj)

Definition at line 206 of file utility.hpp.

207{
208 return std::hash<decay_t<T>>()(std::forward<T>(obj));
209}

Referenced by tim::hash::hasher< T >::operator()().

◆ get_hash_aliases()

hash_alias_ptr_t & tim::hash::get_hash_aliases ( )

◆ get_hash_id() [1/2]

hash_value_t tim::hash::get_hash_id ( const hash_alias_ptr_t _hash_alias,
hash_value_t  _hash_id 
)

◆ get_hash_id() [2/2]

template<typename Tp , std::enable_if_t< concepts::is_string_type< std::decay_t< Tp > >::value, int > = 0>
hash_value_t tim::hash::get_hash_id ( Tp &&  _prefix)

Definition at line 143 of file types.hpp.

144{
145 return std::hash<string_view_t>{}(std::forward<Tp>(_prefix));
146}

◆ get_hash_identifier() [1/6]

std::string tim::hash::get_hash_identifier ( const hash_map_ptr_t _hash_map,
const hash_alias_ptr_t _hash_alias,
hash_value_t  _hash_id 
)

◆ get_hash_identifier() [2/6]

bool tim::hash::get_hash_identifier ( const hash_map_ptr_t _hash_map,
const hash_alias_ptr_t _hash_alias,
hash_value_t  _hash_id,
const char *&  _ret 
)

◆ get_hash_identifier() [3/6]

bool tim::hash::get_hash_identifier ( const hash_map_ptr_t _hash_map,
const hash_alias_ptr_t _hash_alias,
hash_value_t  _hash_id,
std::string *&  _ret 
)

◆ get_hash_identifier() [4/6]

std::string tim::hash::get_hash_identifier ( hash_value_t  _hash_id)

◆ get_hash_identifier() [5/6]

bool tim::hash::get_hash_identifier ( hash_value_t  _hash_id,
const char *&  _ret 
)

◆ get_hash_identifier() [6/6]

bool tim::hash::get_hash_identifier ( hash_value_t  _hash_id,
std::string *&  _ret 
)

◆ get_hash_identifier_fast() [1/3]

string_view_t tim::hash::get_hash_identifier_fast ( hash_value_t  _hash)
inline

this does not check other threads or aliases. Only call this function when you know that the hash exists on the thread and is not an alias

Definition at line 252 of file types.hpp.

253{
254 auto& _hash_ids = get_hash_ids();
255 auto itr = _hash_ids->find(_hash);
256 if(itr != _hash_ids->end())
257 return itr->second;
258 return string_view_t{};
259}
std::string string_view_t
Definition: language.hpp:102

◆ get_hash_identifier_fast() [2/3]

bool tim::hash::get_hash_identifier_fast ( hash_value_t  _hash,
const char *&  _v 
)
inline

Definition at line 272 of file types.hpp.

273{
274 auto& _hash_ids = get_hash_ids();
275 auto itr = _hash_ids->find(_hash);
276 if(itr != _hash_ids->end())
277 return (_v = itr->second.c_str(), true);
278 return false;
279}

◆ get_hash_identifier_fast() [3/3]

bool tim::hash::get_hash_identifier_fast ( hash_value_t  _hash,
std::string *&  _v 
)
inline

Definition at line 262 of file types.hpp.

263{
264 auto& _hash_ids = get_hash_ids();
265 auto itr = _hash_ids->find(_hash);
266 if(itr != _hash_ids->end())
267 return (_v = &itr->second, true);
268 return false;
269}

◆ get_hash_ids()

hash_map_ptr_t & tim::hash::get_hash_ids ( )

◆ get_hash_resolvers()

std::shared_ptr< hash_resolver_vec_t > & tim::hash::get_hash_resolvers ( )

◆ hash_identifier_error() [1/2]

tim::hash::hash_identifier_error ( _hash_map  ,
_hash_alias  ,
_hash_id   
)

◆ hash_identifier_error() [2/2]

void tim::hash::hash_identifier_error ( const hash_map_ptr_t _hash_map,
const hash_alias_ptr_t _hash_alias,
hash_value_t  _hash_id 
)

◆ if() [1/8]

tim::hash::if ( _hash_map)

Definition at line 159 of file definition.hpp.

160 {
161 fprintf(stderr,
162 "[%s@%s:%i]> hash identifier %llu could not be found bc the pointer to "
163 "the hash map is null\n",
164 __FUNCTION__, TIMEMORY_TRUNCATED_FILE_STRING(__FILE__).c_str(), __LINE__,
165 (unsigned long long) _hash_id);
166 return;
167 }

◆ if() [2/8]

tim::hash::if ( _alias_itr = _hash_alias->end()) -> second

Definition at line 279 of file definition.hpp.

280 {
281 return find_hash_identifier(_hash_map, _hash_alias, _alias_itr->second);
282 }
hash_map_t::const_iterator find_hash_identifier(const hash_map_ptr_t &_hash_map, const hash_alias_ptr_t &_hash_alias, hash_value_t _hash_id)
auto _alias_itr
Definition: definition.hpp:278

◆ if() [3/8]

tim::hash::if ( _hash_alias  )

Definition at line 317 of file definition.hpp.

318 {
319 auto _alias_itr = _hash_alias->find(_hash_id);
320 if(_alias_itr != _hash_alias->end())
321 {
322 return get_hash_identifier(_hash_map, _hash_alias, _alias_itr->second, _ret);
323 }
324 }
bool get_hash_identifier(const hash_map_ptr_t &_hash_map, const hash_alias_ptr_t &_hash_alias, hash_value_t _hash_id, std::string *&_ret)
const hash_alias_ptr_t hash_value_t std::string *& _ret
Definition: definition.hpp:300

◆ if() [4/8]

tim::hash::if ( _hash_id  ,
 
)

Definition at line 212 of file definition.hpp.

213 {
214 std::stringstream ss;
215 ss << "Error! node with hash " << _hash_id
216 << " does not have an associated string!\n";
217 static std::set<hash_value_t> _reported{};
218 if(_reported.count(_hash_id) == 0)
219 {
220 _reported.emplace(_hash_id);
221 bool _found_direct = (_hash_map->find(_hash_id) != _hash_map->end());
222 ss << " Found in map : " << std::boolalpha << _found_direct << '\n';
223 bool _found_alias = (_hash_alias->find(_hash_id) != _hash_alias->end());
224 ss << " Found in alias map : " << std::boolalpha << _found_alias << '\n';
225 if(_found_alias)
226 {
227 auto aitr = _hash_alias->find(_hash_id);
228 ss << " Found aliasing : " << aitr->first << " -> " << aitr->second
229 << '\n';
230 auto mitr = _hash_map->find(aitr->second);
231 if(mitr != _hash_map->end())
232 ss << " Found mapping : " << mitr->first << " -> " << mitr->second
233 << '\n';
234 else
235 ss << " Missing mapping\n";
236 }
237 else
238 {
239 ss << " Missing aliasing\n";
240 }
241 ss << " Hash map:\n";
242 auto _w = 20;
243 for(const auto& itr : *_hash_map)
244 ss << " " << std::setw(_w) << itr.first << " : " << (itr.second)
245 << "\n";
246 if(!_hash_alias->empty())
247 {
248 ss << " Alias hash map:\n";
249 for(const auto& itr : *_hash_alias)
250 ss << " " << std::setw(_w) << itr.first << " : " << itr.second
251 << "\n";
252 }
253 auto _registry = static_string::get_registry();
254 if(!_registry.empty())
255 {
256 ss << " Static strings:\n";
257 for(const auto* itr : _registry)
258 {
259 ss << " " << std::setw(_w)
260 << reinterpret_cast<std::size_t>(itr) << " : " << itr << "\n";
261 }
262 }
263 fprintf(stderr, "%s", ss.str().c_str());
264 }
265 }

◆ if() [5/8]

tim::hash::if ( _map_itr = _hash_map->end()) = &_map_itr->second

◆ if() [6/8]

tim::hash::if ( _reported.  count_hash_id,
 
)

◆ if() [7/8]

tim::hash::if ( get_hash_identifier(_hash_map, _hash_alias, _hash_id, _ret )

◆ if() [8/8]

tim::hash::if ( static_string::is_registered(_hash_id ) = reinterpret_cast<const char*>(_hash_id)

Definition at line 311 of file definition.hpp.

312 {
313 auto itr = _hash_map->emplace(_hash_id, reinterpret_cast<const char*>(_hash_id));
314 return (_ret = &itr.first->second, true);
315 }

◆ insert()

_reported tim::hash::insert ( _hash_id  )

◆ TIMEMORY_HASH_LINKAGE() [1/12]

tim::hash::TIMEMORY_HASH_LINKAGE ( bool  ) const &

◆ TIMEMORY_HASH_LINKAGE() [2/12]

tim::hash::TIMEMORY_HASH_LINKAGE ( bool  )

◆ TIMEMORY_HASH_LINKAGE() [3/12]

tim::hash::TIMEMORY_HASH_LINKAGE ( hash_alias_ptr_t )

Definition at line 74 of file definition.hpp.

76{
77 static thread_local auto _inst =
78 get_shared_ptr_pair_instance<hash_alias_map_t, TIMEMORY_API>();
79 static thread_local auto _dtor = scope::destructor{ []() {
80 auto _main = get_shared_ptr_pair_main_instance<hash_alias_map_t, TIMEMORY_API>();
81 if(!_inst || !_main || _inst == _main)
82 return;
83 auto_lock_t _lk{ type_mutex<hash_alias_map_t>(), std::defer_lock };
84 if(!_lk.owns_lock())
85 _lk.lock();
86 for(const auto& itr : *_inst)
87 {
88 if(_main->find(itr.first) == _main->end())
89 _main->emplace(itr.first, itr.second);
90 }
91 } };
92 return _inst;
93 (void) _dtor;
94}
std::unique_lock< mutex_t > auto_lock_t
Unique lock type around mutex_t.
Definition: locking.hpp:42
provides an object which can be returned from functions that will execute the lambda provided during ...
Definition: types.hpp:700

◆ TIMEMORY_HASH_LINKAGE() [4/12]

tim::hash::TIMEMORY_HASH_LINKAGE ( hash_map_ptr_t )

Definition at line 50 of file definition.hpp.

52{
53 static thread_local auto _inst =
54 get_shared_ptr_pair_instance<hash_map_t, TIMEMORY_API>();
55 static thread_local auto _dtor = scope::destructor{ []() {
56 auto _main = get_shared_ptr_pair_main_instance<hash_map_t, TIMEMORY_API>();
57 if(!_inst || !_main || _inst == _main)
58 return;
59 auto_lock_t _lk{ type_mutex<hash_map_t>(), std::defer_lock };
60 if(!_lk.owns_lock())
61 _lk.lock();
62 for(const auto& itr : *_inst)
63 {
64 if(_main->find(itr.first) == _main->end())
65 _main->emplace(itr.first, itr.second);
66 }
67 } };
68 return _inst;
69 (void) _dtor;
70}

◆ TIMEMORY_HASH_LINKAGE() [5/12]

tim::hash::TIMEMORY_HASH_LINKAGE ( hash_value_t  ) const &

◆ TIMEMORY_HASH_LINKAGE() [6/12]

tim::hash::TIMEMORY_HASH_LINKAGE ( std::shared_ptr< hash_resolver_vec_t > &  )

Definition at line 98 of file definition.hpp.

100{
101 static auto _inst = []() {
102 auto _subinst = get_shared_ptr_lone_instance<hash_resolver_vec_t, TIMEMORY_API>();
103 if(_subinst && _subinst->empty())
104 _subinst->reserve(10);
105 return _subinst;
106 }();
107 return _inst;
108}

◆ TIMEMORY_HASH_LINKAGE() [7/12]

tim::hash::TIMEMORY_HASH_LINKAGE ( std::string  ) const &

◆ TIMEMORY_HASH_LINKAGE() [8/12]

tim::hash::TIMEMORY_HASH_LINKAGE ( std::string  )

Definition at line 362 of file definition.hpp.

364{
365 std::string* _ret = nullptr;
367 return *_ret;
369 return std::string("unknown-hash=") + std::to_string(_hash_id);
370}
hash_alias_ptr_t & get_hash_aliases()
hash_identifier_error(_hash_map, _hash_alias, _hash_id)

◆ TIMEMORY_HASH_LINKAGE() [9/12]

tim::hash::TIMEMORY_HASH_LINKAGE ( typename hash_map_t::const_iterator  ) const &

◆ TIMEMORY_HASH_LINKAGE() [10/12]

tim::hash::TIMEMORY_HASH_LINKAGE ( typename hash_map_t::const_iterator  )

Definition at line 289 of file definition.hpp.

◆ TIMEMORY_HASH_LINKAGE() [11/12]

tim::hash::TIMEMORY_HASH_LINKAGE ( void  ) const &

◆ TIMEMORY_HASH_LINKAGE() [12/12]

tim::hash::TIMEMORY_HASH_LINKAGE ( void  )

Variable Documentation

◆ _alias_hash_id

hash_value_t tim::hash::_alias_hash_id
Initial value:
{
const hash_alias_ptr_t hash_value_t hash_value_t _alias_hash_id
Definition: definition.hpp:126

Definition at line 125 of file definition.hpp.

◆ _alias_itr

auto tim::hash::_alias_itr = _hash_alias->find(_hash_id)

Definition at line 278 of file definition.hpp.

◆ _hash_alias

const hash_alias_ptr_t & tim::hash::_hash_alias

Definition at line 124 of file definition.hpp.

◆ _hash_id

const hash_alias_ptr_t hash_value_t tim::hash::_hash_id
Initial value:

Definition at line 113 of file definition.hpp.

◆ _map_itr

auto tim::hash::_map_itr = _hash_map->find(_hash_id)

Definition at line 306 of file definition.hpp.

◆ _ret

const char *& tim::hash::_ret
Initial value:
{
if(!_hash_map)
return false

Definition at line 299 of file definition.hpp.

◆ false

return tim::hash::false

Definition at line 326 of file definition.hpp.

◆ true

tim::hash::true

Definition at line 308 of file definition.hpp.