mirror of
https://github.com/Icinga/icinga2.git
synced 2025-04-08 17:05:25 +02:00
Introduce Dictionary#GetRef()
This commit is contained in:
parent
2d167ccd28
commit
8bcae97ecc
@ -67,6 +67,20 @@ bool Dictionary::Get(const String& key, Value *result) const
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a value's address from a dictionary.
|
||||
*
|
||||
* @param key The key whose value's address should be retrieved.
|
||||
* @returns nullptr if the key was not found.
|
||||
*/
|
||||
const Value * Dictionary::GetRef(const String& key) const
|
||||
{
|
||||
std::shared_lock<std::shared_timed_mutex> lock (m_DataMutex);
|
||||
auto it (m_Data.find(key));
|
||||
|
||||
return it == m_Data.end() ? nullptr : &it->second;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a value in the dictionary.
|
||||
*
|
||||
|
@ -42,6 +42,7 @@ public:
|
||||
|
||||
Value Get(const String& key) const;
|
||||
bool Get(const String& key, Value *result) const;
|
||||
const Value * GetRef(const String& key) const;
|
||||
void Set(const String& key, Value value, bool overrideFrozen = false);
|
||||
bool Contains(const String& key) const;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user