avcpp  2.0
Wrapper for the FFmpeg that simplify usage from C++ projects.
Public Member Functions | List of all members
av::ScopedValue< T, V > Class Template Reference

Functor to take next element in list/array. More...

#include <avutils.h>

Public Member Functions

 ScopedValue (T &var, const V &outValue)
 Ctor. More...
 
 ScopedValue (T &var, const V &inValue, const V &outValue)
 Ctor. More...
 
 ~ScopedValue ()
 

Detailed Description

template<typename T, typename V = T>
class av::ScopedValue< T, V >

Functor to take next element in list/array.

Teamplate class to set value for variable when out of scope will be occured. Use RAII idiom.

By default type of variable and value is same, but it can be simple overriden, use

ScopedValue<VariableType, OutValueType> scopedValue(variable, false);

instead

ScopedValue<VariableType> scopedValue(variable, false);

Constructor & Destructor Documentation

◆ ScopedValue() [1/2]

template<typename T , typename V = T>
av::ScopedValue< T, V >::ScopedValue ( T &  var,
const V &  outValue 
)
inline

Ctor.

Store reference to variable and output value.

Parameters
varvariable that must be set
outValuevalue of variable

◆ ScopedValue() [2/2]

template<typename T , typename V = T>
av::ScopedValue< T, V >::ScopedValue ( T &  var,
const V &  inValue,
const V &  outValue 
)
inline

Ctor.

Like previous one but automaticaly can assign initial value to variable.

Parameters
varvariable that must be set
inValueinitial value
outValueoutput value

◆ ~ScopedValue()

template<typename T , typename V = T>
av::ScopedValue< T, V >::~ScopedValue ( )
inline

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