15 #ifndef CORE_AGENT_AGENT_UID_GENERATOR_H_
16 #define CORE_AGENT_AGENT_UID_GENERATOR_H_
46 if (old_uids.size()) {
47 auto uid = old_uids.back();
49 return AgentUid(uid.GetIndex(), uid.GetReused() + 1);
70 std::atomic<typename AgentUid::Index_t>
counter_;
84 #if (!defined(__CLING__) || defined(__ROOTCLING__)) && defined(USE_DICT)
86 inline void AgentUidGenerator::Streamer(TBuffer& R__b) {
87 if (R__b.IsReading()) {
88 R__b.ReadClassBuffer(AgentUidGenerator::Class(),
this);
92 R__b.WriteClassBuffer(AgentUidGenerator::Class(),
this);
This class generates unique ids for agents.
BDM_CLASS_DEF_NV(AgentUidGenerator, 1)
AgentUidGenerator(const AgentUidGenerator &)=delete
AgentUid::Index_t GetHighestIndex() const
Thread-safe.
SharedData< std::vector< AgentUid > > tl_uids_
Thread local vector of AgentUids that can be reused.
std::atomic< typename AgentUid::Index_t > counter_
AgentUid::Index_t root_counter_
void ReuseAgentUid(const AgentUid &uid)
The SharedData class avoids false sharing between threads.
This class stores information about each thread. (e.g. to which NUMA node it belongs to....
int GetMyThreadId() const
int GetMaxThreads() const
Return the maximum number of threads.