Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
duckdb::RegisteredStateManager Class Reference
Collaboration diagram for duckdb::RegisteredStateManager:

Public Member Functions

template<class T , typename... ARGS>
shared_ptr< T > GetOrCreate (const string &key, ARGS &&... args)
 
template<class T >
shared_ptr< T > Get (const string &key)
 
void Insert (const string &key, shared_ptr< ClientContextState > state_p)
 
void Remove (const string &key)
 
vector< shared_ptr< ClientContextState > > States ()
 

Private Attributes

mutex lock
 
unordered_map< string, shared_ptr< ClientContextState > > registered_state
 

Member Function Documentation

◆ 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()

template<class T >
shared_ptr< T > duckdb::RegisteredStateManager::Get ( const string &  key)
inline
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()

void duckdb::RegisteredStateManager::Insert ( const string &  key,
shared_ptr< ClientContextState state_p 
)
inline
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()

vector< shared_ptr< ClientContextState > > duckdb::RegisteredStateManager::States ( )
inline
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: