Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
InstanceHandle< I, FA > Class Template Reference

#include "common/instancehandle.hpp"

Description

template<class I, class FA = I>
class lumiera::InstanceHandle< I, FA >

Handle tracking the registration of an interface, deregistering it on deletion.

Depending on which flavour of the ctor is used, either (bulk) registration of interfaces or plugin loading is triggered. The interface type is defined by type parameter. Additionally, choosing a facade interface as second type parameter causes installation of a proxy, which implements the facade by routing calls through the basic interface represented by this handle. This proxy will be "closed" automatically when this InstanceHandle goes out of scope. Of course, the proxy needs to be implemented somewhere, typically in interfaceproxy.cpp

Definition at line 183 of file instancehandle.hpp.

Public Member Functions

 InstanceHandle (string const &iName, uint version, size_t minminor, string const &impName)
 Set up an InstanceHandle representing a plugin.
 
 InstanceHandle (LumieraInterface descriptor)
 Set up an InstanceHandle managing the registration and deregistration of interface(s).
 
 ~InstanceHandle ()
 
FA * operator-> () const
 act as smart pointer to allow access through the facade.
 
I & get () const
 directly access the instance via the CL interface
 
 operator bool () const
 
bool operator! () const
 

Private Member Functions

bool isValid () const
 
- Private Member Functions inherited from NonCopyable
 ~NonCopyable ()=default
 
 NonCopyable ()=default
 
 NonCopyable (NonCopyable const &)=delete
 
NonCopyableoperator= (NonCopyable const &)=delete
 

Private Attributes

LumieraInterface desc_
 
I * instance_
 
facade::Link< I, FA > facadeLink_
 

Constructor & Destructor Documentation

◆ InstanceHandle() [1/2]

template<class I , class FA = I>
InstanceHandle ( string const &  iName,
uint  version,
size_t  minminor,
string const &  impName 
)
inline

Set up an InstanceHandle representing a plugin.

Should be placed at the client side.

Parameters
iNameunmangled name of the interface
versionmajor version
minminorminimum acceptable minor version number
impNameunmangled name of the instance (implementation)

Definition at line 198 of file instancehandle.hpp.

◆ InstanceHandle() [2/2]

template<class I , class FA = I>
InstanceHandle ( LumieraInterface  descriptor)
inline

Set up an InstanceHandle managing the registration and deregistration of interface(s).

Should be placed at the service providing side.

Parameters
a(single) interface descriptor, which can be created with LUMIERA_INTERFACE_INSTANCE and referred to by LUMIERA_INTERFACE_REF

Definition at line 213 of file instancehandle.hpp.

◆ ~InstanceHandle()

template<class I , class FA = I>
~InstanceHandle ( )
inline

Definition at line 221 of file instancehandle.hpp.

References InstanceHandle< I, FA >::desc_, InstanceHandle< I, FA >::instance_, lumiera_interface_close(), and lumiera_interfaceregistry_remove_interface().

+ Here is the call graph for this function:

Member Function Documentation

◆ operator->()

template<class I , class FA = I>
FA * operator-> ( ) const
inline

act as smart pointer to allow access through the facade.

Note
we don't provide operator*

Definition at line 234 of file instancehandle.hpp.

References InstanceHandle< I, FA >::facadeLink_.

◆ get()

template<class I , class FA = I>
I & get ( ) const
inline

directly access the instance via the CL interface

Definition at line 241 of file instancehandle.hpp.

References InstanceHandle< I, FA >::instance_.

Referenced by WrappedStandardExeBuilder::invokeOriginalBuilder().

+ Here is the caller graph for this function:

◆ operator bool()

template<class I , class FA = I>
operator bool ( ) const
inlineexplicit

Definition at line 249 of file instancehandle.hpp.

References InstanceHandle< I, FA >::isValid().

+ Here is the call graph for this function:

◆ operator!()

template<class I , class FA = I>
bool operator! ( ) const
inline

Definition at line 254 of file instancehandle.hpp.

References InstanceHandle< I, FA >::isValid().

+ Here is the call graph for this function:

◆ isValid()

template<class I , class FA = I>
bool isValid ( ) const
inlineprivate

Definition at line 262 of file instancehandle.hpp.

References InstanceHandle< I, FA >::instance_.

Referenced by InstanceHandle< I, FA >::operator bool(), and InstanceHandle< I, FA >::operator!().

+ Here is the caller graph for this function:

Member Data Documentation

◆ desc_

template<class I , class FA = I>
LumieraInterface desc_
private

Definition at line 186 of file instancehandle.hpp.

Referenced by InstanceHandle< I, FA >::~InstanceHandle().

◆ instance_

template<class I , class FA = I>
I* instance_
private

◆ facadeLink_

template<class I , class FA = I>
facade::Link<I,FA> facadeLink_
private

Definition at line 188 of file instancehandle.hpp.

Referenced by InstanceHandle< I, FA >::operator->().

+ Inheritance diagram for InstanceHandle< I, FA >:
+ Collaboration diagram for InstanceHandle< I, FA >:

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