Commit 355caec8 authored by Niklas Stefan Nolte's avatar Niklas Stefan Nolte 🔥

formatting

parent baa85795
Pipeline #1550124 failed with stages
in 27 minutes and 51 seconds
......@@ -31,7 +31,7 @@ namespace Gaudi::Functional {
// derived classes are NOT allowed to implement execute ...
StatusCode execute() override final {
try {
filter_evtcontext_t<In...>::apply( *static_cast<Derived const*>(this), this->m_inputs );
filter_evtcontext_t<In...>::apply( *static_cast<Derived const*>( this ), this->m_inputs );
return FilterDecision::PASSED;
} catch ( GaudiException& e ) {
( e.code() ? this->warning() : this->error() ) << e.message() << endmsg;
......@@ -48,7 +48,7 @@ namespace Gaudi::Functional {
// derived classes are NOT allowed to implement execute ...
StatusCode execute( const EventContext& ctx ) const override final {
try {
filter_evtcontext_t<In...>::apply( *static_cast<Derived const*>(this), ctx, this->m_inputs );
filter_evtcontext_t<In...>::apply( *static_cast<Derived const*>( this ), ctx, this->m_inputs );
return FilterDecision::PASSED;
} catch ( GaudiException& e ) {
( e.code() ? this->warning() : this->error() ) << e.message() << endmsg;
......
......@@ -22,7 +22,8 @@ namespace Gaudi::Functional {
struct Producer;
template <typename Derived, typename... Out, typename Traits_, bool legacy>
struct Producer<Derived, std::tuple<Out...>(), Traits_, legacy> : MultiTransformer<Derived, std::tuple<Out...>(), Traits_, legacy> {
struct Producer<Derived, std::tuple<Out...>(), Traits_, legacy>
: MultiTransformer<Derived, std::tuple<Out...>(), Traits_, legacy> {
using MultiTransformer<Derived, std::tuple<Out...>(), Traits_, legacy>::MultiTransformer;
};
......
......@@ -19,7 +19,8 @@ namespace Gaudi::Functional {
template <typename ScalarOp, typename TransformerSignature, typename Traits_ = Traits::useDefaults>
class ScalarTransformer;
template <typename ScalarOp, typename Out, typename... In, typename Traits_>
class ScalarTransformer<ScalarOp, Out( const In&... ), Traits_> : public Transformer<ScalarOp, Out( const In&... ), Traits_> {
class ScalarTransformer<ScalarOp, Out( const In&... ), Traits_>
: public Transformer<ScalarOp, Out( const In&... ), Traits_> {
/// Access the scalar operator
const ScalarOp& scalarOp() const { return static_cast<const ScalarOp&>( *this ); }
......
......@@ -41,11 +41,13 @@ namespace Gaudi ::Functional {
StatusCode execute() override final {
try {
if constexpr ( sizeof...( In ) == 0 ) {
put( std::get<0>( this->m_outputs ), ( *static_cast<Derived const*>(this) )() );
put( std::get<0>( this->m_outputs ), ( *static_cast<Derived const*>( this ) )() );
} else if constexpr ( std::tuple_size_v<filter_evtcontext<In...>> == 0 ) {
put( std::get<0>( this->m_outputs ), ( *static_cast<Derived const*>(this) )( Gaudi::Hive::currentContext() ) );
put( std::get<0>( this->m_outputs ),
( *static_cast<Derived const*>( this ) )( Gaudi::Hive::currentContext() ) );
} else {
put( std::get<0>( this->m_outputs ), filter_evtcontext_t<In...>::apply( *static_cast<Derived const*>(this), this->m_inputs ) );
put( std::get<0>( this->m_outputs ),
filter_evtcontext_t<In...>::apply( *static_cast<Derived const*>( this ), this->m_inputs ) );
}
return FilterDecision::PASSED;
} catch ( GaudiException& e ) {
......@@ -64,11 +66,12 @@ namespace Gaudi ::Functional {
StatusCode execute( const EventContext& ctx ) const override final {
try {
if constexpr ( sizeof...( In ) == 0 ) {
put( std::get<0>( this->m_outputs ), ( *static_cast<Derived const*>(this) )() );
put( std::get<0>( this->m_outputs ), ( *static_cast<Derived const*>( this ) )() );
} else if constexpr ( std::tuple_size_v<filter_evtcontext<In...>> == 0 ) {
put( std::get<0>( this->m_outputs ), ( *static_cast<Derived const*>(this) )( ctx ) );
put( std::get<0>( this->m_outputs ), ( *static_cast<Derived const*>( this ) )( ctx ) );
} else {
put( std::get<0>( this->m_outputs ), filter_evtcontext_t<In...>::apply( *static_cast<Derived const*>(this), ctx, this->m_inputs ) );
put( std::get<0>( this->m_outputs ),
filter_evtcontext_t<In...>::apply( *static_cast<Derived const*>( this ), ctx, this->m_inputs ) );
}
return FilterDecision::PASSED;
} catch ( GaudiException& e ) {
......@@ -130,15 +133,17 @@ namespace Gaudi ::Functional {
if constexpr ( sizeof...( In ) == 0 ) {
std::apply( [&ohandle...](
auto&&... data ) { ( put( ohandle, std::forward<decltype( data )>( data ) ), ... ); },
( *static_cast<Derived const*>(this) )() );
( *static_cast<Derived const*>( this ) )() );
} else if constexpr ( std::tuple_size_v<filter_evtcontext<In...>> == 0 ) {
std::apply( [&ohandle...](
auto&&... data ) { ( put( ohandle, std::forward<decltype( data )>( data ) ), ... ); },
( *static_cast<Derived const*>(this) )( ctx ) );
( *static_cast<Derived const*>( this ) )( ctx ) );
} else {
std::apply( [&ohandle...](
auto&&... data ) { ( put( ohandle, std::forward<decltype( data )>( data ) ), ... ); },
filter_evtcontext_t<In...>::apply( *static_cast<Derived const*>(this), ctx, this->m_inputs ) );
std::apply(
[&ohandle...]( auto&&... data ) {
( put( ohandle, std::forward<decltype( data )>( data ) ), ... );
},
filter_evtcontext_t<In...>::apply( *static_cast<Derived const*>( this ), ctx, this->m_inputs ) );
}
},
this->m_outputs );
......@@ -173,7 +178,7 @@ namespace Gaudi ::Functional {
( put( ohandle, std::forward<decltype( data )>( data ) ), ... );
return passed;
},
filter_evtcontext_t<In...>::apply( *static_cast<Derived const*>(this), this->m_inputs ) );
filter_evtcontext_t<In...>::apply( *static_cast<Derived const*>( this ), this->m_inputs ) );
GF_SUPPRESS_SPURIOUS_CLANG_WARNING_END
},
this->m_outputs )
......@@ -201,7 +206,8 @@ namespace Gaudi ::Functional {
( put( ohandle, std::forward<decltype( data )>( data ) ), ... );
return passed;
},
filter_evtcontext_t<In...>::apply( *static_cast<Derived const*>(this), ctx, this->m_inputs ) );
filter_evtcontext_t<In...>::apply( *static_cast<Derived const*>( this ), ctx,
this->m_inputs ) );
},
GF_SUPPRESS_SPURIOUS_CLANG_WARNING_END
......@@ -223,7 +229,8 @@ namespace Gaudi ::Functional {
using MultiTransformer = details::MultiTransformer<Derived, Signature, Traits_, details::isLegacy<Traits_>>;
template <typename Derived, typename Signature, typename Traits_ = Traits::useDefaults>
using MultiTransformerFilter = details::MultiTransformerFilter<Derived, Signature, Traits_, details::isLegacy<Traits_>>;
using MultiTransformerFilter =
details::MultiTransformerFilter<Derived, Signature, Traits_, details::isLegacy<Traits_>>;
} // namespace Gaudi::Functional
......
......@@ -58,12 +58,12 @@ namespace Gaudi::Examples {
DECLARE_COMPONENT( IntDataProducer )
struct VectorDataProducer final : Gaudi::Functional::Producer<VectorDataProducer,std::vector<int>(), BaseClass_t> {
struct VectorDataProducer final : Gaudi::Functional::Producer<VectorDataProducer, std::vector<int>(), BaseClass_t> {
VectorDataProducer( const std::string& name, ISvcLocator* svcLoc )
: Producer( name, svcLoc, KeyValue( "OutputLocation", "/Event/MyVector" ) ) {}
std::vector<int> operator()() const{
std::vector<int> operator()() const {
info() << "executing VectorDataProducer, storing [3,3,3,3] into " << outputLocation() << endmsg;
return {3, 3, 3, 3};
}
......@@ -108,7 +108,7 @@ namespace Gaudi::Examples {
: Transformer( name, svcLoc, KeyValue( "InputLocation", "/Event/MyInt" ),
KeyValue( "OutputLocation", "/Event/MyFloat" ) ) {}
float operator()( const int& input ) const{
float operator()( const int& input ) const {
info() << "Converting: " << input << " from " << inputLocation() << " and storing it into " << outputLocation()
<< endmsg;
return input;
......@@ -117,7 +117,8 @@ namespace Gaudi::Examples {
DECLARE_COMPONENT( IntToFloatData )
struct IntFloatToFloatData final : Gaudi::Functional::Transformer<IntFloatToFloatData, float( const int&, const float& ), BaseClass_t> {
struct IntFloatToFloatData final
: Gaudi::Functional::Transformer<IntFloatToFloatData, float( const int&, const float& ), BaseClass_t> {
IntFloatToFloatData( const std::string& name, ISvcLocator* svcLoc )
: Transformer( name, svcLoc,
......@@ -134,7 +135,8 @@ namespace Gaudi::Examples {
DECLARE_COMPONENT( IntFloatToFloatData )
struct IntIntToFloatFloatData final
: Gaudi::Functional::MultiTransformer<IntIntToFloatFloatData, std::tuple<float, float>( const int&, const int& ), BaseClass_t> {
: Gaudi::Functional::MultiTransformer<IntIntToFloatFloatData, std::tuple<float, float>( const int&, const int& ),
BaseClass_t> {
IntIntToFloatFloatData( const std::string& name, ISvcLocator* svcLoc )
: MultiTransformer(
name, svcLoc,
......@@ -142,7 +144,7 @@ namespace Gaudi::Examples {
{KeyValue( "OutputLocation1", {"/Event/MyMultiFloat1"} ),
KeyValue( "OutputLocation2", {"/Event/MyMultiFloat2"} )} ) {}
std::tuple<float, float> operator()( const int& input1, const int& input2 ) const{
std::tuple<float, float> operator()( const int& input1, const int& input2 ) const {
info() << "Number of inputs : " << inputLocationSize() << ", number of outputs : " << outputLocationSize()
<< endmsg;
info() << "Converting " << input1 << " from " << inputLocation<0>() << " and " << input2 << " from "
......@@ -188,25 +190,23 @@ namespace Gaudi::Examples {
FloatDataConsumer( const std::string& name, ISvcLocator* svcLoc )
: Consumer( name, svcLoc, KeyValue( "InputLocation", "/Event/MyFloat" ) ) {}
void operator()( const float& input ) const {
info() << "executing FloatDataConsumer: " << input << endmsg;
}
void operator()( const float& input ) const { info() << "executing FloatDataConsumer: " << input << endmsg; }
};
DECLARE_COMPONENT( FloatDataConsumer )
struct ContextConsumer final : Gaudi::Functional::Consumer<ContextConsumer, void( const EventContext& ), BaseClass_t> {
struct ContextConsumer final
: Gaudi::Functional::Consumer<ContextConsumer, void( const EventContext& ), BaseClass_t> {
using Consumer::Consumer;
void operator()( const EventContext& ctx ) const {
info() << "executing ContextConsumer, got " << ctx << endmsg;
}
void operator()( const EventContext& ctx ) const { info() << "executing ContextConsumer, got " << ctx << endmsg; }
};
DECLARE_COMPONENT( ContextConsumer )
struct ContextTransformer final : Gaudi::Functional::Transformer<ContextTransformer, int( const EventContext& ), BaseClass_t> {
struct ContextTransformer final
: Gaudi::Functional::Transformer<ContextTransformer, int( const EventContext& ), BaseClass_t> {
ContextTransformer( const std::string& name, ISvcLocator* svcLoc )
: Transformer( name, svcLoc, KeyValue{"OutputLoc", "/Event/SomeOtherInt"} ) {}
......@@ -219,7 +219,8 @@ namespace Gaudi::Examples {
DECLARE_COMPONENT( ContextTransformer )
struct ContextIntConsumer final : Gaudi::Functional::Consumer<ContextIntConsumer, void( const EventContext&, const int& ), BaseClass_t> {
struct ContextIntConsumer final
: Gaudi::Functional::Consumer<ContextIntConsumer, void( const EventContext&, const int& ), BaseClass_t> {
ContextIntConsumer( const std::string& name, ISvcLocator* svcLoc )
: Consumer( name, svcLoc, KeyValue( "InputLocation", "/Event/MyInt" ) ) {}
......@@ -231,7 +232,8 @@ namespace Gaudi::Examples {
DECLARE_COMPONENT( ContextIntConsumer )
struct VectorDoubleProducer final : Gaudi::Functional::Producer<VectorDoubleProducer, std::vector<double>(), BaseClass_t> {
struct VectorDoubleProducer final
: Gaudi::Functional::Producer<VectorDoubleProducer, std::vector<double>(), BaseClass_t> {
VectorDoubleProducer( const std::string& name, ISvcLocator* svcLoc )
: Producer( name, svcLoc, KeyValue( "OutputLocation", "/Event/MyVectorOfDoubles" ) ) {}
......
......@@ -21,7 +21,7 @@ namespace Gaudi {
struct CreateObject : Gaudi::Functional::Producer<CreateObject, ObjectType()> {
CreateObject( const std::string& name, ISvcLocator* svcLoc )
: Producer( name, svcLoc, KeyValue( "OutputLocation", "/Event/SomeData" ) ) {}
ObjectType operator()() const{
ObjectType operator()() const {
ObjectType o;
o.setVersion( 42 );
info() << "Created object with version " << static_cast<int>( o.version() ) << endmsg;
......
......@@ -18,8 +18,9 @@
namespace Gaudi {
namespace Examples {
struct SelectTracks final : Functional::Transformer<SelectTracks, Gaudi::Examples::MyTrack::Selection(
const Gaudi::Range_<Gaudi::Examples::MyTrack::ConstVector>& )> {
struct SelectTracks final
: Functional::Transformer<SelectTracks, Gaudi::Examples::MyTrack::Selection(
const Gaudi::Range_<Gaudi::Examples::MyTrack::ConstVector>& )> {
SelectTracks( const std::string& name, ISvcLocator* pSvc )
: Transformer( name, pSvc, {KeyValue( "InputData", {"MyTracks"} )},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment