uvco 0.1
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
uvco::FlagGuard Class Reference

#include <internal_utils.h>

Public Member Functions

 FlagGuard (const FlagGuard &)=delete
 
 FlagGuard (FlagGuard &&)=delete
 
FlagGuardoperator= (const FlagGuard &)=delete
 
FlagGuardoperator= (FlagGuard &&)=delete
 
 FlagGuard (bool &flag)
 Uses Boost assert to ensure that the flag is not already set.
 
 ~FlagGuard ()
 

Private Attributes

bool & flag_
 

Detailed Description

Assert that an operation is concurrently running only one at a time, by setting a flag in the constructor and unsetting it in the destructor.

Constructor & Destructor Documentation

◆ FlagGuard() [1/3]

uvco::FlagGuard::FlagGuard ( const FlagGuard )
delete

◆ FlagGuard() [2/3]

uvco::FlagGuard::FlagGuard ( FlagGuard &&  )
delete

◆ FlagGuard() [3/3]

uvco::FlagGuard::FlagGuard ( bool &  flag)
explicit

Uses Boost assert to ensure that the flag is not already set.

48 : flag_{flag} {
49 BOOST_ASSERT(!flag_);
50 flag = true;
51}
bool & flag_
Definition internal_utils.h:203

◆ ~FlagGuard()

uvco::FlagGuard::~FlagGuard ( )
53{ flag_ = false; }

Member Function Documentation

◆ operator=() [1/2]

FlagGuard & uvco::FlagGuard::operator= ( const FlagGuard )
delete

◆ operator=() [2/2]

FlagGuard & uvco::FlagGuard::operator= ( FlagGuard &&  )
delete

Member Data Documentation

◆ flag_

bool& uvco::FlagGuard::flag_
private

The documentation for this class was generated from the following files: