efl::eo::wref< T > Struct Template Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files
- Examples

- Data Structures
- Data Structure Index
- Class Hierarchy
- Data Fields

Public Member Functions
efl::eo::wref< T > Struct Template Reference
Efl_Cxx_API

Weak references to an EO Object. More...

## Public Member Functions
| wref ()
| Default constructor. More...
| wref (Eo *obj)
| Class constructor. More...
| wref (T obj)
| Class constructor. More...
| ~wref ()
| Class destructor.
eina::optional< T > | lock ()
| Try to acquire a strong reference to the underlying EO Object. More...
| wref (wref const &other)
| Copy constructor.
wref & | operator= (wref const &other)
| Assignment operator.

## Detailed Description

### template<typename T>
struct efl::eo::wref< T >

Weak references to an EO Object.

## Constructor & Destructor Documentation

template<typename T >

efl::eo::wref< T >::wref | ( |  | ) |
| inline

Default constructor.

Create a empty weak reference.

template<typename T >

efl::eo::wref< T >::wref | ( | Eo * | obj | ) |
| inlineexplicit

Class constructor.

Parameters

  obj | The EO Object to be referenced.

Create a weak reference to `obj`.

template<typename T >

efl::eo::wref< T >::wref | ( | T | obj | ) |
| inline

Class constructor.

Parameters

  obj | The EO C++ Object to be referenced.

Create a weak reference to `obj`.

## Member Function Documentation

template<typename T >

eina::optional<T> efl::eo::wref< T >::lock | ( |  | ) |
| inline

Try to acquire a strong reference to the underlying EO Object.

This function checks whether the weak reference still points to a valid EO Object. If the reference is still valid it increments the reference counter of the object and returns a pointer to it.

Returns
  If the lock was successfully acquired it returns a strong reference to the EO Object. Otherwise it returns an empty eina::optional.

Referenced by efl::eo::wref< T >::operator=(), efl::eo::wref< T >::wref(), and efl::eo::wref< T >::~wref().