Argus Camera Sample Argus Camera Sample

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Private Member Functions | Private Attributes
ArgusSamples::ScopedGuard< T > Class Template Reference

RAII-syle class performing an action when control flow leaves the scope. More...

`#include <ScopedGuard.h>`

List of all members.

## Public Types

typedef bool(T::* | ActionType )()
| Action function type.

## Public Member Functions

| ScopedGuard (T *object, ActionType action)
| Constructor.
| ~ScopedGuard ()
| Destructor.
void | cancel ()
| Cancel the action associated with this instance.

## Private Member Functions

void | leaveScope ()
| Called when leaving the scope.
| ScopedGuard ()
| Hide default/copy constructor and assignment operator.
| ScopedGuard (ScopedGuard &other)
const ScopedGuard & | operator= (const ScopedGuard &)

## Private Attributes

T * | m_object
ActionType | m_action

## Detailed Description

### template<typename T>
class ArgusSamples::ScopedGuard< T >

RAII-syle class performing an action when control flow leaves the scope.

Typically the action to be performed is to undo a previous action in case of an error.

Definition at line 39 of file ScopedGuard.h.

## Member Typedef Documentation

template<typename T >

typedef bool(T::* ArgusSamples::ScopedGuard< T >::ActionType)()

Action function type.

Definition at line 45 of file ScopedGuard.h.

## Constructor & Destructor Documentation

template<typename T >

ArgusSamples::ScopedGuard< T >::ScopedGuard | ( | T * | object,
|  | ActionType | action
| ) |  |

inline

Constructor.

Parameters:

  object | [in] the object to perform the action on
  action | [in] the action to perform

Definition at line 53 of file ScopedGuard.h.

template<typename T >

ArgusSamples::ScopedGuard< T >::~ScopedGuard | ( |  | ) |

inline

Destructor.

Definition at line 61 of file ScopedGuard.h.

template<typename T >

ArgusSamples::ScopedGuard< T >::ScopedGuard | ( |  | ) |

private

Hide default/copy constructor and assignment operator.

template<typename T >

ArgusSamples::ScopedGuard< T >::ScopedGuard | ( | ScopedGuard< T > & | other | ) |

private

## Member Function Documentation

template<typename T >

void ArgusSamples::ScopedGuard< T >::cancel | ( |  | ) |

inline

Cancel the action associated with this instance.

Definition at line 69 of file ScopedGuard.h.

template<typename T >

void ArgusSamples::ScopedGuard< T >::leaveScope | ( |  | ) |

inline private

Called when leaving the scope.

Calls action and resets the action.

Definition at line 81 of file ScopedGuard.h.

template<typename T >

const ScopedGuard& ArgusSamples::ScopedGuard< T >::operator= | ( | const ScopedGuard< T > & |  | ) |

private

## Member Data Documentation

template<typename T >

ActionType ArgusSamples::ScopedGuard< T >::m_action

private

Definition at line 76 of file ScopedGuard.h.

template<typename T >

T* ArgusSamples::ScopedGuard< T >::m_object

private

Definition at line 75 of file ScopedGuard.h.

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

- common/ScopedGuard.h