KiCad PCB EDA Suite
UTIL::LINK Class Reference

#include <observable.h>

Public Member Functions

 LINK ()
 
 LINK (std::shared_ptr< DETAIL::OBSERVABLE_BASE::IMPL > token, void *observer)
 
 LINK (LINK &&other)
 
 LINK (const LINK &)=delete
 
void operator= (const LINK &)=delete
 
LINKoperator= (LINK &&other)
 
void reset ()
 
 operator bool () const
 
 ~LINK ()
 

Private Attributes

std::shared_ptr< DETAIL::OBSERVABLE_BASE::IMPLtoken_
 
void * observer_
 

Detailed Description

Definition at line 101 of file observable.h.

Constructor & Destructor Documentation

UTIL::LINK::LINK ( )

Definition at line 120 of file observable.cpp.

121  : observer_( nullptr )
122  {
123  }
UTIL::LINK::LINK ( std::shared_ptr< DETAIL::OBSERVABLE_BASE::IMPL token,
void *  observer 
)

Definition at line 126 of file observable.cpp.

127  : token_( std::move( token ) ), observer_( observer )
128  {
129  }
UTIL::LINK::LINK ( LINK &&  other)

Definition at line 132 of file observable.cpp.

133  : token_( std::move( other.token_ ) ), observer_( other.observer_ )
134  {
135  other.token_.reset();
136  }
UTIL::LINK::LINK ( const LINK )
delete
UTIL::LINK::~LINK ( )

Definition at line 154 of file observable.cpp.

References reset().

155  {
156  reset();
157  }

Member Function Documentation

UTIL::LINK::operator bool ( ) const
explicit

Definition at line 148 of file observable.cpp.

149  {
150  return token_ ? true : false;
151  }
void UTIL::LINK::operator= ( const LINK )
delete
LINK & UTIL::LINK::operator= ( LINK &&  other)

Definition at line 139 of file observable.cpp.

References observer_, and token_.

140  {
141  token_ = std::move( other.token_ );
142  other.token_.reset();
143  observer_ = other.observer_;
144  return *this;
145  }
void UTIL::LINK::reset ( )

Definition at line 160 of file observable.cpp.

References observer_, and token_.

Referenced by ~LINK().

161  {
162  if(token_)
163  {
164  token_->remove_observer( observer_ );
165  token_.reset();
166  }
167  }

Member Data Documentation

void* UTIL::LINK::observer_
private

Definition at line 119 of file observable.h.

Referenced by operator=(), and reset().

std::shared_ptr<DETAIL::OBSERVABLE_BASE::IMPL> UTIL::LINK::token_
private

Definition at line 118 of file observable.h.

Referenced by operator=(), and reset().


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