Resurgence (PY2022)
Codebase for the Husky Robotics 2021-2022 rover Resurgence
Loading...
Searching...
No Matches
util::RAIIHelper Class Reference

A helper class for executing a function when leaving a scope, in RAII-style. More...

#include <core.h>

Public Member Functions

 RAIIHelper (const std::function< void()> &f)
 Construct a new RAIIHelper.
 
 RAIIHelper (const RAIIHelper &)=delete
 
 RAIIHelper (RAIIHelper &&other)
 Move an RAIIHelper into another.
 
RAIIHelperoperator= (const RAIIHelper &)=delete
 
 ~RAIIHelper ()
 Destroy the RAIIHelper object, executing the given function, if not empty.
 

Detailed Description

A helper class for executing a function when leaving a scope, in RAII-style.

Constructor & Destructor Documentation

◆ RAIIHelper() [1/2]

util::RAIIHelper::RAIIHelper ( const std::function< void()> & f)

Construct a new RAIIHelper.

Parameters
fThe function to execute when this object is destructed.

◆ RAIIHelper() [2/2]

util::RAIIHelper::RAIIHelper ( RAIIHelper && other)

Move an RAIIHelper into another.

The RAIIHelper being moved is guaranteed to be empty after this, i.e. will not execute any code when being destructed.

Parameters
otherThe RAIIHelper to move.

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