Falaise  4.0.1
SuperNEMO Software Toolkit
snemo::service_traits< T > Struct Template Reference

Template struct for defining trait types and functions for a service. More...

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

Detailed Description

template<typename T>
struct snemo::service_traits< T >

Template struct for defining trait types and functions for a service.

No default implementation is replied, so all service classes must fully specialize service_traits as follows:

template <>
struct service_traits<MyService> {
// `label_type` is a compile time string, and should be equivalent to the
// service's typename, including any namespace
using label_type = BOOST_METAPARSE_STRING("MyService");
// `service_type` is the type to be extracted from @ref datatools::service_manager
// It is usually *not* the same as the instance type
using service_type = AServiceType;
// `instance_type` is the actual interface type that clients will use via
// @ref falaise::service_handle
using instance_type = MyService;
// `get` is a static function taking a reference to the service_type
// and returning a pointer to the served instance_type.
// In most cases, it calls a member function on the service_type instance
static instance_type* get(service_type& s) {
// get_served returns a ptr to MyService...
return s.get_served();
}
};
See also
snemo::service_handle

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