uvco 0.1
Loading...
Searching...
No Matches
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.

86 : flag_{flag} {
87 BOOST_ASSERT(!flag_);
88 flag = true;
89}
bool & flag_
Definition internal_utils.h:182

◆ ~FlagGuard()

uvco::FlagGuard::~FlagGuard ( )
91{ 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: