13 bool operator()(
const char *id1,
const char *id2)
const 14 {
return std::strcmp(id1, id2) < 0; }
21 inline const char *
findOrInsert(
const char *
string)
throw();
24 typedef std::multiset<const char *, StringLess> IdSet;
27 std::allocator<char> stringAllocator;
34 for(std::multiset<const char*, StringLess>::iterator iter =
35 idSet.begin(); iter != idSet.end(); iter++)
36 stringAllocator.deallocate(const_cast<char*>(*iter),
42 std::lock_guard<std::mutex> scoped_lock(
mutex);
44 IdSet::iterator
pos = idSet.lower_bound(
string);
45 if (pos != idSet.end() && std::strcmp(*pos,
string) == 0)
48 std::size_t
size = std::strlen(
string) + 1;
49 char *
unique = stringAllocator.allocate(size);
50 std::memcpy(unique,
string, size);
52 idSet.insert(pos, unique);
61 [[cms::thread_safe]]
static IdCache atomicIdCache;
65 const char *AtomicId::lookup(
const char *
string)
throw()
static boost::mutex mutex
Value & findOrInsert(std::map< Key, Value > &m, Key const &k)
def unique(seq, keepstr=True)