Falaise  4.0.1
SuperNEMO Software Toolkit
Public Member Functions | List of all members
snemo::service_handle< T > Class Template Reference

Semi-smart pointer holding a service interface. More...

#include <falaise/snemo/services/service_handle.h>

Public Member Functions

 service_handle ()=default
 Default constructor. More...
 
 service_handle (datatools::service_manager &sm)
 Construct from a service provider. More...
 
T * operator-> () const
 Return pointer to service interface. More...
 

Detailed Description

template<typename T>
class snemo::service_handle< T >

Semi-smart pointer holding a service interface.

Provides a convenient adaptor interface over datatools::service_manager to ease checked access and use of service interfaces. It may be constructed from a datatools::service_manager instance as

void example(datatools::service_manager& p) {
// ... use someSvc ...
someSvc->some_service_memfn();
}

The template parameter must be a type for which a specialization of snemo::service_traits exists otherwise a compile-time error will be emitted Access and use of the service is checked at construction and access via

It is only a semi-smart pointer as it does not own the raw pointer to the service interface. The lifetime of service interface pointers is expected, but not guaranteed, to be equal to the lifetime of an flreconstruct process.

See also
falaise::processing::module

Constructor & Destructor Documentation

◆ service_handle() [1/2]

template<typename T>
snemo::service_handle< T >::service_handle ( )
default

Default constructor.

◆ service_handle() [2/2]

template<typename T>
snemo::service_handle< T >::service_handle ( datatools::service_manager sm)
inline

Construct from a service provider.

Member Function Documentation

◆ operator->()

template<typename T>
T* snemo::service_handle< T >::operator-> ( ) const
inline

Return pointer to service interface.

Exceptions
bad_service_accessif pointer is null

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