open62541pp 0.15.0
C++ wrapper of open62541
Loading...
Searching...
No Matches
opcua::detail::ContextMap< Key, Item > Class Template Reference

#include <contextmap.hpp>

Detailed Description

template<typename Key, typename Item>
class opcua::detail::ContextMap< Key, Item >

Thread-safe map for context objects.

Context objects are reference as void* pointers in open62541 functions/callbacks. To prevent pointer-invalidation, the objects are stored as unique pointers. Stale objects will be removed when new objects are stored in the map.

Definition at line 35 of file contextmap.hpp.

Public Member Functions

Item * operator[] (Key key)
 
Item * insert (Key key, std::unique_ptr< Item > &&item)
 
size_t erase (Key key)
 
size_t eraseStale ()
 
bool contains (Key key) const
 
const Item * find (Key key) const
 
auto acquireLock () const
 
const auto & underlying () const noexcept
 

Member Function Documentation

◆ operator[]()

template<typename Key , typename Item >
Item * opcua::detail::ContextMap< Key, Item >::operator[] ( Key key)
inline

Access or insert specified element.

Definition at line 38 of file contextmap.hpp.

◆ insert()

template<typename Key , typename Item >
Item * opcua::detail::ContextMap< Key, Item >::insert ( Key key,
std::unique_ptr< Item > && item )
inline

Inserts an element or assigns to the current element if the key already exists.

Definition at line 49 of file contextmap.hpp.

◆ erase()

template<typename Key , typename Item >
size_t opcua::detail::ContextMap< Key, Item >::erase ( Key key)
inline

Definition at line 55 of file contextmap.hpp.

◆ eraseStale()

template<typename Key , typename Item >
size_t opcua::detail::ContextMap< Key, Item >::eraseStale ( )
inline

◆ contains()

template<typename Key , typename Item >
bool opcua::detail::ContextMap< Key, Item >::contains ( Key key) const
inline

Definition at line 75 of file contextmap.hpp.

◆ find()

template<typename Key , typename Item >
const Item * opcua::detail::ContextMap< Key, Item >::find ( Key key) const
inline

Definition at line 80 of file contextmap.hpp.

◆ acquireLock()

◆ underlying()

template<typename Key , typename Item >
const auto & opcua::detail::ContextMap< Key, Item >::underlying ( ) const
inlinenoexcept

Get access to the underlying map. Use acquireLock before any operation.

Definition at line 95 of file contextmap.hpp.