◆ GetOrCreate()
template<
class T , typename... ARGS>
| shared_ptr< T > duckdb::RegisteredStateManager::GetOrCreate |
( |
const string & |
key, |
|
|
ARGS &&... |
args |
|
) |
| |
|
inline |
40964 {
40965 lock_guard<mutex> l(lock);
40966 auto lookup = registered_state.find(key);
40967 if (lookup != registered_state.end()) {
40968 return shared_ptr_cast<ClientContextState, T>(lookup->second);
40969 }
40970 auto cache = make_shared_ptr<T>(std::forward<ARGS>(args)...);
40971 registered_state[key] = cache;
40972 return cache;
40973 }
◆ Get()
40976 {
40977 lock_guard<mutex> l(lock);
40978 auto lookup = registered_state.find(key);
40979 if (lookup == registered_state.end()) {
40980 return nullptr;
40981 }
40982 return shared_ptr_cast<ClientContextState, T>(lookup->second);
40983 }
◆ Insert()
40985 {
40986 lock_guard<mutex> l(lock);
40987 registered_state.insert(make_pair(key, std::move(state_p)));
40988 }
◆ Remove()
| void duckdb::RegisteredStateManager::Remove |
( |
const string & |
key | ) |
|
|
inline |
40990 {
40991 lock_guard<mutex> l(lock);
40992 registered_state.erase(key);
40993 }
◆ States()
40995 {
40996 lock_guard<mutex> l(lock);
40997 vector<shared_ptr<ClientContextState>> states;
40998 for (auto &entry : registered_state) {
40999 states.push_back(entry.second);
41000 }
41001 return states;
41002 }
The documentation for this class was generated from the following file: