MPD: Java::TrivialRef< T > Class Template Reference

MPD 0.20.18

Public Member Functions
Java::TrivialRef< T > Class Template Reference

Container for a global reference to a JNI object that gets initialised and deinitialised explicitly. More...

`#include <Ref.hxx>`

## Public Member Functions
constexpr | TrivialRef ()
| TrivialRef (const TrivialRef &other)=delete
TrivialRef & | operator= (const TrivialRef &other)=delete
bool | IsDefined () const
void | Set (JNIEnv *env, T _value)
| Obtain a global reference on the specified object and store it. More...
void | Clear (JNIEnv *env)
| Release the global reference and clear this object. More...
void | ClearOptional (JNIEnv *env)
| Release the global reference and clear this object. More...
T | Get () const
| operator T () const

## Detailed Description

### template<typename T>
class Java::TrivialRef< T >

Container for a global reference to a JNI object that gets initialised and deinitialised explicitly.

Since there is no implicit initialisation in the default constructor, this is a trivial C++ class. It should only be used for global variables that are implicitly initialised with zeroes.

Definition at line 128 of file Ref.hxx.

## Constructor & Destructor Documentation

## ◆ TrivialRef() [1/2]

template<typename T>

constexpr Java::TrivialRef< T >::TrivialRef | ( |  | ) |
| inline

Definition at line 132 of file Ref.hxx.

## ◆ TrivialRef() [2/2]

template<typename T>

Java::TrivialRef< T >::TrivialRef | ( | const TrivialRef< T > & | other | ) |
| delete

## Member Function Documentation

## ◆ Clear()

template<typename T>

void Java::TrivialRef< T >::Clear | ( | JNIEnv * | env | ) |
| inline

Release the global reference and clear this object.

Definition at line 155 of file Ref.hxx.

## ◆ ClearOptional()

template<typename T>

void Java::TrivialRef< T >::ClearOptional | ( | JNIEnv * | env | ) |
| inline

Release the global reference and clear this object.

It is allowed to call this method without ever calling Set().

Definition at line 166 of file Ref.hxx.

## ◆ Get()

template<typename T>

T Java::TrivialRef< T >::Get | ( |  | ) | const
| inline

Definition at line 171 of file Ref.hxx.

## ◆ IsDefined()

template<typename T>

bool Java::TrivialRef< T >::IsDefined | ( |  | ) | const
| inline

Definition at line 137 of file Ref.hxx.

## ◆ operator T()

template<typename T>

Java::TrivialRef< T >::operator T | ( |  | ) | const
| inline

Definition at line 175 of file Ref.hxx.

## ◆ operator=()

template<typename T>

TrivialRef& Java::TrivialRef< T >::operator= | ( | const TrivialRef< T > & | other | ) |
| delete

## ◆ Set()

template<typename T>

void Java::TrivialRef< T >::Set | ( | JNIEnv * | env,
|  | T | _value
| ) |  |
| inline

Obtain a global reference on the specified object and store it.

This object must not be set already.

Definition at line 145 of file Ref.hxx.

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

- java/Ref.hxx