2424#include " Framework/ConfigurableHelpers.h"
2525#include " Framework/Condition.h"
2626#include " Framework/InitContext.h"
27- #include " Framework/ConfigContext.h"
2827#include " Framework/RootConfigParamHelpers.h"
29- #include " Framework/ExpressionHelpers.h"
30- #include " Framework/CommonServices.h"
3128#include " Framework/PluginManager.h"
32- #include " Framework/RootMessageContext.h"
3329#include " Framework/DeviceSpec.h"
3430
3531namespace o2 ::framework
@@ -551,43 +547,6 @@ struct OutputManager<BuildsNG<T>> {
551547 }
552548};
553549
554- template <typename T>
555- class has_instance
556- {
557- using one = char ;
558- struct two {
559- char x[2 ];
560- };
561-
562- template <typename C>
563- static one test (decltype (&C::instance));
564- template <typename C>
565- static two test (...);
566-
567- public:
568- enum { value = sizeof (test<T>(nullptr )) == sizeof (char ) };
569- };
570-
571- template <typename T>
572- class has_end_of_stream
573- {
574- using one = char ;
575- struct two {
576- char x[2 ];
577- };
578-
579- template <typename C>
580- static one test (decltype (&C::endOfStream));
581- template <typename C>
582- static two test (...);
583-
584- public:
585- enum { value = sizeof (test<T>(nullptr )) == sizeof (char ) };
586- };
587-
588- template <typename T>
589- inline constexpr bool has_end_of_stream_v = has_end_of_stream<T>::value;
590-
591550template <typename T>
592551struct ServiceManager {
593552 template <typename ANY>
@@ -623,7 +582,7 @@ struct ServiceManager<Service<T>> {
623582
624583 static bool prepare (InitContext& context, Service<T>& service)
625584 {
626- if constexpr (has_instance<T>::value ) {
585+ if constexpr (requires { T::instance ();} ) {
627586 service.service = &(T::instance ()); // Sigh...
628587 return true ;
629588 } else {
@@ -638,7 +597,7 @@ struct ServiceManager<Service<T>> {
638597 {
639598 // FIXME: for the moment we only need endOfStream to be
640599 // stateless. In the future we might want to pass it EndOfStreamContext
641- if constexpr (has_end_of_stream_v<T> ) {
600+ if constexpr (requires { T::endOfStream ();} ) {
642601 service.service ->endOfStream ();
643602 return true ;
644603 }
0 commit comments