Tkrzw
Public Member Functions | List of all members
tkrzw::AtomicSet< VALUETYPE > Class Template Referencefinal

Thread-safe wrapper of std::set. More...

#include <tkrzw_containers.h>

Public Member Functions

 AtomicSet ()
 Constructor. More...
 
bool Check (const VALUETYPE &data)
 Checks whether a record exists. More...
 
bool Insert (const VALUETYPE &data)
 Inserts a record. More...
 
bool Insert (VALUETYPE &&data)
 Inserts a record in move semantics. More...
 
bool Remove (const VALUETYPE &data)
 Removes a record. More...
 
bool IsEmpty () const
 Checks whether the set is empty. More...
 
VALUETYPE Pop ()
 Removes the least ID from the set. More...
 
void Clear ()
 Clears all IDs from the set. More...
 

Detailed Description

template<class VALUETYPE>
class tkrzw::AtomicSet< VALUETYPE >

Thread-safe wrapper of std::set.

Constructor & Destructor Documentation

◆ AtomicSet()

template<typename VALUETYPE >
tkrzw::AtomicSet< VALUETYPE >::AtomicSet

Constructor.

Member Function Documentation

◆ Check()

template<typename VALUETYPE >
bool tkrzw::AtomicSet< VALUETYPE >::Check ( const VALUETYPE &  data)

Checks whether a record exists.

Parameters
dataThe record data.
Returns
True if the record exists or false if not.

◆ Insert() [1/2]

template<typename VALUETYPE >
bool tkrzw::AtomicSet< VALUETYPE >::Insert ( const VALUETYPE &  data)

Inserts a record.

Parameters
dataThe record data.
Returns
True if the insertion is sucesss or false on failure.

◆ Insert() [2/2]

template<typename VALUETYPE >
bool tkrzw::AtomicSet< VALUETYPE >::Insert ( VALUETYPE &&  data)

Inserts a record in move semantics.

Parameters
dataThe record data.
Returns
True if the insertion is sucesss or false on failure.

◆ Remove()

template<typename VALUETYPE >
bool tkrzw::AtomicSet< VALUETYPE >::Remove ( const VALUETYPE &  data)

Removes a record.

Parameters
dataThe record data.
Returns
True on success or false on failure.

◆ IsEmpty()

template<typename VALUETYPE >
bool tkrzw::AtomicSet< VALUETYPE >::IsEmpty

Checks whether the set is empty.

Returns
True if the set is empty or false if not.

◆ Pop()

template<typename VALUETYPE >
VALUETYPE tkrzw::AtomicSet< VALUETYPE >::Pop

Removes the least ID from the set.

Returns
The least ID or the default value on failure.

◆ Clear()

template<typename VALUETYPE >
void tkrzw::AtomicSet< VALUETYPE >::Clear

Clears all IDs from the set.