PLCnext API Documentation 25.0.2.69
Public Types | Public Member Functions | List of all members
Arp::Base::Core::RaiiGuard Class Reference

This class is a utility class which provides a generic guard to implement the RAII idiom. More...

#include <RaiiGuard.hpp>

Public Types

using Operation = delegate< void(void)>
 

Public Member Functions

 RaiiGuard (Operation destructing)
 Constructs an RaiiGuard instance. More...
 
 RaiiGuard (Operation constructing, Operation destructing)
 Constructs an RaiiGuard instance. More...
 
 RaiiGuard (const RaiiGuard &arg)=delete
 
 RaiiGuard (RaiiGuard &&arg) noexcept=delete
 
RaiiGuardoperator= (const RaiiGuard &arg)=delete
 
RaiiGuardoperator= (RaiiGuard &&arg) noexcept=delete
 
 ~RaiiGuard (void)
 Invokes the destructing operation, which was passed to the constructor.
 

Detailed Description

This class is a utility class which provides a generic guard to implement the RAII idiom.

The operations to invoke at construction or destruction of the guard, are passed as delegate or lambda to the constructor.

Constructor & Destructor Documentation

◆ RaiiGuard() [1/2]

Arp::Base::Core::RaiiGuard::RaiiGuard ( Operation  destructing)
explicit

Constructs an RaiiGuard instance.

Parameters
destructingThe lambda operation invoked during destruction to free any resources.

◆ RaiiGuard() [2/2]

Arp::Base::Core::RaiiGuard::RaiiGuard ( Operation  constructing,
Operation  destructing 
)

Constructs an RaiiGuard instance.

Parameters
constructingThe lambda operation invoked during construction to allocate any resources.
destructingThe lambda operation invoked during destruction to free any resources.

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