Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • holau/Gaudi
  • dmagdali/Gaudi
  • pmunozpa/Gaudi
  • ssottoco/Gaudi
  • cvarni/Gaudi
  • mafila/Gaudi
  • admorris/Gaudi
  • staider/Gaudi
  • gunther/Gaudi
  • bstanisl/Gaudi
  • jtorasso/Gaudi
  • wochung/Gaudi
  • mveghel/Gaudi
  • averbyts/Gaudi
  • dguest/Gaudi
  • alboyer/Gaudi
  • dkonst/Gaudi
  • jcarcell/Gaudi
  • elmsheus/Gaudi
  • hpxgaudi/Gaudi
  • ganis/Gaudi
  • tadej/Gaudi
  • hahansen/Gaudi
  • juesseiv/Gaudi
  • imjelde/gaudida
  • jheuel/Gaudi
  • mimazure/Gaudi
  • masato/Gaudi
  • dcasperfaser/Gaudi
  • faser/offline/Gaudi
  • axu/Gaudi
  • sailer/Gaudi
  • amete/Gaudi
  • ponyisi/Gaudi
  • vavolkl/Gaudi
  • mstahl/Gaudi
  • wlampl/Gaudi
  • kreczko/Gaudi
  • emoyse/Gaudi
  • dhynds/Gaudi
  • sstahl/Gaudi
  • rcurrie/Gaudi
  • smh/Gaudi
  • valassi/Gaudi
  • bwynne/Gaudi_gaudi
  • abarton/Gaudi
  • tsulaia/gaudigaudi
  • mnowak/Gaudi
  • roiser/Gaudi
  • merrenst/Gaudi
  • mato/Gaudi
  • christos/Gaudi
  • goetz/Gaudi
  • goetz/AtlasGaudi
  • tsulaia/atlasgaudi
  • olupton/Gaudi
  • pseyfert/Gaudi
  • graemes/Gaudi
  • gianelle/Gaudi
  • akraszna/AtlasGaudi
  • cattanem/Gaudi
  • skluth/Gaudi
  • will/Gaudi
  • ssnyder/Gaudi
  • agonzale/Gaudi
  • leggett/AtlasGaudi
  • apearce/Gaudi
  • mnowak/Gaudi-ORIG
  • fwinkl/AtlasGaudi
  • bwynne/Gaudi_atlas
  • chamont/Gaudi
  • rmatev/Gaudi
  • lhcb/Gaudi
  • atlas/Gaudi
  • akraszna/GaudiGaudi
  • fwinkl/Gaudi
  • jonrob/Gaudi
  • azaborow/Gaudi
  • clemenci/Gaudi
  • hgraslan/Gaudi
  • srimanob/Gaudi
  • graven/Gaudi
  • hegner/Gaudi
  • gaudi/Gaudi
84 results
Show changes
Commits on Source (17)
Showing
with 213 additions and 193 deletions
......@@ -3,6 +3,7 @@
#include "GaudiAlg/FunctionalDetails.h"
#include "GaudiAlg/FunctionalUtilities.h"
#include "GaudiKernel/apply.h"
#include <utility>
namespace Gaudi
......@@ -23,7 +24,7 @@ namespace Gaudi
StatusCode execute() override final
{
try {
invoke( std::index_sequence_for<In...>{} );
Gaudi::apply( [&]( const auto&... i ) { ( *this )( details::deref( i.get() )... ); }, this->m_inputs );
} catch ( GaudiException& e ) {
( e.code() ? this->warning() : this->error() ) << e.message() << endmsg;
return e.code();
......@@ -33,13 +34,6 @@ namespace Gaudi
// ... instead, they must implement the following operator
virtual void operator()( const In&... ) const = 0;
private:
template <std::size_t... I>
void invoke( std::index_sequence<I...> ) const
{
( *this )( details::deref( std::get<I>( this->m_inputs ).get() )... );
}
};
}
}
......
......@@ -3,6 +3,7 @@
#include "GaudiAlg/FunctionalDetails.h"
#include "GaudiAlg/FunctionalUtilities.h"
#include "GaudiKernel/apply.h"
#include <type_traits>
#include <utility>
......@@ -25,7 +26,9 @@ namespace Gaudi
StatusCode execute() override final
{
try {
invoke( std::index_sequence_for<In...>{} );
this->setFilterPassed( Gaudi::apply(
[&]( auto&... handles ) { return details::as_const( *this )( details::deref( handles.get() )... ); },
this->m_inputs ) );
return StatusCode::SUCCESS;
} catch ( GaudiException& e ) {
( e.code() ? this->warning() : this->error() ) << e.message() << endmsg;
......@@ -35,15 +38,6 @@ namespace Gaudi
// ... instead, they must implement the following operator
virtual bool operator()( const In&... ) const = 0;
private:
// note: invoke is not const, as setFilterPassed is not (yet!) const
template <std::size_t... I>
void invoke( std::index_sequence<I...> )
{
auto pass = details::as_const( *this )( details::deref( std::get<I>( this->m_inputs ).get() )... );
this->setFilterPassed( pass );
}
};
}
}
......
......@@ -3,6 +3,7 @@
#include "GaudiAlg/FunctionalDetails.h"
#include "GaudiAlg/FunctionalUtilities.h"
#include "GaudiKernel/apply.h"
#include <utility>
namespace Gaudi
......@@ -23,7 +24,20 @@ namespace Gaudi
StatusCode execute() override final
{
try {
invoke( std::index_sequence_for<Out...>{} );
Gaudi::apply(
[&]( auto&... ohandle ) {
Gaudi::apply(
[&ohandle...]( auto&&... data ) {
#if __cplusplus < 201703L
(void)std::initializer_list<int>{
( details::put( ohandle, std::forward<decltype( data )>( data ) ), 0 )...};
#else
( details::put( ohandle, std::forward<decltype( data )>( data ) ), ... );
#endif
},
details::as_const( *this )() );
},
this->m_outputs );
} catch ( GaudiException& e ) {
( e.code() ? this->warning() : this->error() ) << e.message() << endmsg;
return e.code();
......@@ -33,14 +47,6 @@ namespace Gaudi
// ... instead, they must implement the following operator
virtual std::tuple<Out...> operator()() const = 0;
private:
template <std::size_t... O>
void invoke( std::index_sequence<O...> )
{
std::initializer_list<int>{
( details::put( std::get<O>( this->m_outputs ), std::get<O>( details::as_const( *this )() ) ), 0 )...};
}
};
template <typename Out, typename Traits_>
......@@ -51,10 +57,8 @@ namespace Gaudi
// derived classes are NOT allowed to implement execute ...
StatusCode execute() override final
{
using details::as_const;
using details::put;
try {
put( std::get<0>( this->m_outputs ), as_const( *this )() );
details::put( std::get<0>( this->m_outputs ), details::as_const( *this )() );
} catch ( GaudiException& e ) {
( e.code() ? this->warning() : this->error() ) << e.message() << endmsg;
return e.code();
......
......@@ -2,7 +2,6 @@
#define SCALAR_TRANSFORMER_H
#include "GaudiAlg/Transformer.h"
#include <utility>
namespace Gaudi
{
......@@ -19,14 +18,6 @@ namespace Gaudi
/// Access the scalar operator
const ScalarOp& scalarOp() const { return static_cast<const ScalarOp&>( *this ); }
private:
/// Call the scalar operator with the objects obtained from the given tuple
template <typename Tuple, typename Scalar, std::size_t... I>
inline decltype( auto ) getScalar( const Tuple& t, const Scalar& s, std::index_sequence<I...> ) const
{
return s( details::deref( std::get<I>( t ) )... );
}
public:
using Transformer<Out( const In&... ), Traits_>::Transformer;
......@@ -37,10 +28,12 @@ namespace Gaudi
Out out;
out.reserve( inrange.size() );
auto& scalar = scalarOp();
for ( const auto&& i : inrange ) {
details::insert( out, getScalar( i, scalar, std::index_sequence_for<In...>{} ) );
for ( const auto&& tuple : inrange ) {
/// Call the scalar operator with the objects obtained from the given tuple as arguments
details::insert(
out, Gaudi::apply( [&]( const auto&... i ) { return scalar( details::deref( i )... ); }, tuple ) );
}
details::applyPostProcessing( scalar, out ); // awaiting a post-processor call
details::applyPostProcessing( scalar, out );
return out;
}
};
......@@ -56,31 +49,6 @@ namespace Gaudi
/// Access the scalar operator
const ScalarOp& scalarOp() const { return static_cast<const ScalarOp&>( *this ); }
private:
/// Reserve the given size in all output containers
template <typename Tuple, std::size_t... I>
inline void reserve( Tuple& t, const std::size_t resSize, std::index_sequence<I...> ) const
{
std::initializer_list<long unsigned int>{( std::get<I>( t ).reserve( resSize ), I )...};
}
/// Call the scalar operator with the objects obtained from the given tuple
template <typename Tuple, typename Scalar, std::size_t... I>
inline decltype( auto ) getScalar( const Tuple& t, const Scalar& s, std::index_sequence<I...> ) const
{
return s( details::deref( std::get<I>( t ) )... );
}
/// Insert the returned tuple of objects into the correct containers
template <typename InTuple, typename OutTuple, std::size_t... I>
void insert( InTuple&& in, OutTuple& out, std::index_sequence<I...> ) const
{
if ( in ) {
std::initializer_list<long unsigned int>{
( details::insert( std::get<I>( out ), std::move( std::get<I>( *in ) ) ), I )...};
}
}
public:
using MultiTransformer<std::tuple<Out...>( const In&... ), Traits_>::MultiTransformer;
......@@ -89,10 +57,36 @@ namespace Gaudi
{
const auto inrange = details::zip::const_range( in... );
std::tuple<Out...> out;
reserve( out, inrange.size(), std::index_sequence_for<Out...>{} );
Gaudi::apply(
[sz = inrange.size()]( auto&&... o ) {
#if __cplusplus < 201703L
(void)std::initializer_list<int>{( o.reserve( sz ), 0 )...};
#else
( o.reserve( sz ), ... );
#endif
},
out );
auto& scalar = scalarOp();
for ( const auto&& i : inrange ) {
insert( getScalar( i, scalar, std::index_sequence_for<In...>{} ), out, std::index_sequence_for<Out...>{} );
for ( const auto&& tuple : inrange ) {
Gaudi::apply(
[&scalar, &tuple]( auto&... out ) {
/// Call the scalar operator with the objects obtained from the given tuple
auto data = Gaudi::apply(
[&scalar]( const auto&... args ) { return scalar( details::deref( args )... ); }, tuple );
if ( data ) {
Gaudi::apply(
[&out...]( auto&&... data ) {
#if __cplusplus < 201703L
(void)std::initializer_list<int>{
( details::insert( out, std::forward<decltype( data )>( data ) ), 0 )...};
#else
( details::insert( out, std::forward<decltype( data )>( data ) ), ... );
#endif
},
std::move( *data ) );
}
},
out );
}
details::applyPostProcessing( scalar, out ); // awaiting a post-processor call
return out;
......
......@@ -7,6 +7,7 @@
#include "GaudiAlg/FunctionalDetails.h"
#include "GaudiAlg/FunctionalUtilities.h"
#include "GaudiKernel/apply.h"
namespace Gaudi
{
......@@ -51,7 +52,16 @@ namespace Gaudi
StatusCode execute() override final
{
try {
invoke( std::index_sequence_for<In...>{} );
// TODO:FIXME: how does operator() know the number and order of expected outputs?
using details::as_const;
auto out = Gaudi::apply(
[&]( auto&... ihandle ) { return as_const( *this )( as_const( *ihandle.get() )... ); }, this->m_inputs );
if ( out.size() != m_outputs.size() ) {
throw GaudiException( "Error during transform: expected " + std::to_string( m_outputs.size() ) +
" containers, got " + std::to_string( out.size() ) + " instead",
this->name(), StatusCode::FAILURE );
}
for ( unsigned i = 0; i != out.size(); ++i ) details::put( m_outputs[i], std::move( out[i] ) );
return StatusCode::SUCCESS;
} catch ( GaudiException& e ) {
( e.code() ? this->warning() : this->error() ) << e.message() << endmsg;
......@@ -65,19 +75,6 @@ namespace Gaudi
virtual vector_of_<Out> operator()( const In&... ) const = 0;
private:
template <std::size_t... I>
void invoke( std::index_sequence<I...> )
{
// TODO:FIXME: how does operator() know the number and order of expected outputs?
using details::as_const;
auto out = as_const( *this )( as_const( *std::get<I>( this->m_inputs ).get() )... );
if ( out.size() != m_outputs.size() ) {
throw GaudiException( "Error during transform: expected " + std::to_string( m_outputs.size() ) +
" containers, got " + std::to_string( out.size() ) + " instead",
this->name(), StatusCode::FAILURE );
}
for ( unsigned i = 0; i != out.size(); ++i ) details::put( m_outputs[i], std::move( out[i] ) );
}
template <typename T>
using OutputHandle = details::OutputHandle_t<Traits_, details::remove_optional_t<T>>;
std::vector<std::string> m_outputLocations; // TODO/FIXME for now: use a call-back to update the actual handles!
......
......@@ -4,6 +4,7 @@
#include "GaudiAlg/FunctionalDetails.h"
#include "GaudiAlg/FunctionalUtilities.h"
#include "GaudiKernel/GaudiException.h"
#include "GaudiKernel/apply.h"
#include <type_traits>
#include <utility>
......@@ -33,7 +34,12 @@ namespace Gaudi
StatusCode execute() override final
{
try {
invoke( std::index_sequence_for<In...>{} );
Gaudi::apply(
[&]( const auto&... i ) {
details::put( std::get<0>( this->m_outputs ),
details::as_const( *this )( details::deref( i.get() )... ) );
},
this->m_inputs );
return StatusCode::SUCCESS;
} catch ( GaudiException& e ) {
( e.code() ? this->warning() : this->error() ) << e.message() << endmsg;
......@@ -43,14 +49,6 @@ namespace Gaudi
// instead they MUST implement this operator
virtual Out operator()( const In&... ) const = 0;
private:
template <std::size_t... I>
void invoke( std::index_sequence<I...> )
{
details::put( std::get<0>( this->m_outputs ),
details::as_const( *this )( details::deref( std::get<I>( this->m_inputs ).get() )... ) );
}
};
//
......@@ -70,7 +68,24 @@ namespace Gaudi
StatusCode execute() override final
{
try {
invoke( std::index_sequence_for<In...>{}, std::index_sequence_for<Out...>{} );
Gaudi::apply(
[&]( auto&... ohandle ) {
Gaudi::apply(
[&ohandle...]( auto&&... data ) {
#if __cplusplus < 201703L
(void)std::initializer_list<int>{
( details::put( ohandle, std::forward<decltype( data )>( data ) ), 0 )...};
#else
( details::put( ohandle, std::forward<decltype( data )>( data ) ), ... );
#endif
},
Gaudi::apply(
[&]( auto&... ihandle ) {
return details::as_const( *this )( details::deref( ihandle.get() )... );
},
this->m_inputs ) );
},
this->m_outputs );
return StatusCode::SUCCESS;
} catch ( GaudiException& e ) {
( e.code() ? this->warning() : this->error() ) << e.message() << endmsg;
......@@ -80,19 +95,6 @@ namespace Gaudi
// instead they MUST implement this operator
virtual std::tuple<Out...> operator()( const In&... ) const = 0;
private:
template <std::size_t... I, std::size_t... O>
void invoke( std::index_sequence<I...>, std::index_sequence<O...> )
{
auto out = details::as_const( *this )( details::deref( std::get<I>( this->m_inputs ).get() )... );
#if __cplusplus < 201703L
(void)std::initializer_list<int>{
( details::put( std::get<O>( this->m_outputs ), std::get<O>( std::move( out ) ) ), 0 )...};
#else
( details::put( std::get<O>( this->m_outputs ), std::get<O>( std::move( out ) ) ), ... );
#endif
}
};
//
......@@ -112,7 +114,25 @@ namespace Gaudi
StatusCode execute() override final
{
try {
invoke( std::index_sequence_for<In...>{}, std::index_sequence_for<Out...>{} );
Gaudi::apply(
[&]( auto&... ohandle ) {
Gaudi::apply(
[&ohandle..., this]( bool passed, auto&&... data ) {
this->setFilterPassed( passed );
#if __cplusplus < 201703L
(void)std::initializer_list<int>{
( details::put( ohandle, std::forward<decltype( data )>( data ) ), 0 )...};
#else
( details::put( ohandle, std::forward<decltype( data )>( data ) ), ... );
#endif
},
Gaudi::apply(
[&]( auto&... ihandle ) {
return details::as_const( *this )( details::deref( ihandle.get() )... );
},
this->m_inputs ) );
},
this->m_outputs );
return StatusCode::SUCCESS;
} catch ( GaudiException& e ) {
( e.code() ? this->warning() : this->error() ) << e.message() << endmsg;
......@@ -122,16 +142,6 @@ namespace Gaudi
// instead they MUST implement this operator
virtual std::tuple<bool, Out...> operator()( const In&... ) const = 0;
private:
template <std::size_t... I, std::size_t... O>
void invoke( std::index_sequence<I...>, std::index_sequence<O...> )
{
auto out = details::as_const( *this )( details::deref( std::get<I>( this->m_inputs ).get() )... );
this->setFilterPassed( std::get<0>( out ) );
(void)std::initializer_list<int>{
( details::put( std::get<O>( this->m_outputs ), std::get<O + 1>( std::move( out ) ) ), 0 )...};
}
};
}
}
......
......@@ -10,11 +10,6 @@ namespace
}
}
// A simple map to easily translate a state to its name
std::map<AlgsExecutionStates::State, std::string> AlgsExecutionStates::stateNames = {
{INITIAL, "INITIAL"}, {CONTROLREADY, "CONTROLREADY"}, {DATAREADY, "DATAREADY"}, {SCHEDULED, "SCHEDULED"},
{EVTACCEPTED, "EVTACCEPTED"}, {EVTREJECTED, "EVTREJECTED"}, {ERROR, "ERROR"}};
StatusCode AlgsExecutionStates::updateState( unsigned int iAlgo, State newState )
{
if ( iAlgo >= m_states.size() ) {
......@@ -31,8 +26,8 @@ StatusCode AlgsExecutionStates::updateState( unsigned int iAlgo, State newState
m_states[iAlgo] = newState;
return StatusCode::SUCCESS;
default:
log() << MSG::ERROR << "[AlgIndex " << iAlgo << "] Transition from " << stateNames.at( m_states[iAlgo] ) << " to "
<< stateNames.at( newState ) << " is not allowed" << endmsg;
log() << MSG::ERROR << "[AlgIndex " << iAlgo << "] Transition from " << m_states[iAlgo] << " to " << newState
<< " is not allowed" << endmsg;
m_states[iAlgo] = ERROR;
return StatusCode::FAILURE;
}
......
......@@ -38,8 +38,6 @@ public:
ERROR = 6
};
static std::map<State, std::string> stateNames;
AlgsExecutionStates( unsigned int algsNumber, SmartIF<IMessageSvc> MS )
: m_states( algsNumber, INITIAL ), m_MS( std::move( MS ) ){};
......@@ -111,10 +109,36 @@ public:
Iterator end( State kind ) { return {kind, m_states, m_states.end()}; }
};
/// Streaming of State values (required by C++11 scoped enums).
/// Streaming of State values
inline std::ostream& operator<<( std::ostream& s, AlgsExecutionStates::State x )
{
return s << static_cast<std::underlying_type_t<AlgsExecutionStates::State>>( x );
using State = AlgsExecutionStates::State;
switch ( x ) {
case State::INITIAL:
s << "INITIAL";
break;
case State::CONTROLREADY:
s << "CONTROLREADY";
break;
case State::DATAREADY:
s << "DATAREADY";
break;
case State::SCHEDULED:
s << "SCHEDULED";
break;
case State::EVTACCEPTED:
s << "EVTACCEPTED";
break;
case State::EVTREJECTED:
s << "EVTREJECTED";
break;
case State::ERROR:
s << "ERROR";
break;
default:
s << "UNKNOWN";
}
return s;
}
#endif // GAUDIHIVE_ALGSEXECUTIONSTATES_H
......@@ -694,8 +694,7 @@ StatusCode AvalancheSchedulerSvc::updateStates( int si, const int algo_index, Ev
partial_sc = promoteToAsyncScheduled( buffer.top(), iSlot, thisSlotPtr->eventContext );
ON_VERBOSE if ( partial_sc.isFailure() ) verbose()
<< "Could not apply transition from "
<< AlgsExecutionStates::stateNames[AlgsExecutionStates::State::DATAREADY] << " for algorithm "
<< "Could not apply transition from " << AlgsExecutionStates::State::DATAREADY << " for algorithm "
<< index2algname( buffer.top() ) << " on processing slot " << iSlot << endmsg;
buffer.pop();
......@@ -715,8 +714,7 @@ StatusCode AvalancheSchedulerSvc::updateStates( int si, const int algo_index, Ev
partial_sc = promoteToAsyncScheduled( algIndex, iSlot, thisSlotPtr->eventContext );
ON_VERBOSE if ( partial_sc.isFailure() ) verbose()
<< "Could not apply transition from "
<< AlgsExecutionStates::stateNames[AlgsExecutionStates::State::DATAREADY] << " for algorithm "
<< "Could not apply transition from " << AlgsExecutionStates::State::DATAREADY << " for algorithm "
<< index2algname( algIndex ) << " on processing slot " << iSlot << endmsg;
}
}
......@@ -1073,8 +1071,8 @@ StatusCode AvalancheSchedulerSvc::promoteToExecuted( unsigned int iAlgo, int si,
sc = thisSlot.allSubSlots[subSlotIndex].algsStates.updateState( iAlgo, state );
}
ON_VERBOSE if ( sc.isSuccess() ) verbose() << "Promoting " << algo->name() << " on slot " << si << " to "
<< AlgsExecutionStates::stateNames[state] << endmsg;
ON_VERBOSE if ( sc.isSuccess() ) verbose() << "Promoting " << algo->name() << " on slot " << si << " to " << state
<< endmsg;
ON_DEBUG debug() << "Algorithm " << algo->name() << " executed in slot " << si << ". Algorithms scheduled are "
<< m_algosInFlight << endmsg;
......@@ -1123,7 +1121,7 @@ StatusCode AvalancheSchedulerSvc::promoteToAsyncExecuted( unsigned int iAlgo, in
}
ON_VERBOSE if ( sc.isSuccess() ) verbose() << "[Asynchronous] Promoting " << algo->name() << " on slot " << si
<< " to " << AlgsExecutionStates::stateNames[state] << endmsg;
<< " to " << state << endmsg;
ON_DEBUG debug() << "[Asynchronous] Algorithm " << algo->name() << " executed in slot " << si
<< ". Algorithms scheduled are " << m_IOBoundAlgosInFlight << endmsg;
......
......@@ -46,7 +46,7 @@ private:
StatusCode deactivate();
/// Flag to track if the scheduler is active or not
bool m_isActive;
bool m_isActive = false;
/// The thread in which the activate function runs
std::thread m_thread;
......
......@@ -86,7 +86,7 @@ namespace concurrency
output << std::string( recursionLevel, ' ' ) << m_nodeName << " (" << m_nodeIndex << ")"
<< ", w/ decision: " << stateToString( node_decisions[m_nodeIndex] ) << "(" << node_decisions[m_nodeIndex]
<< ")"
<< ", in state: " << AlgsExecutionStates::stateNames[states[m_algoIndex]] << std::endl;
<< ", in state: " << states[m_algoIndex] << std::endl;
}
//---------------------------------------------------------------------------
......
......@@ -227,26 +227,9 @@ namespace precedence
std::string operator()( const AlgoProps& props ) const
{ // Returns algorithm's FSM state
using State = AlgsExecutionStates::State;
State state = m_slot.algsStates[props.m_algoIndex];
switch ( state ) {
case State::INITIAL:
return "INITIAL";
case State::CONTROLREADY:
return "CONTROLREADY";
case State::DATAREADY:
return "DATAREADY";
case State::SCHEDULED:
return "SCHEDULED";
case State::EVTACCEPTED:
return "EVTACCEPTED";
case State::EVTREJECTED:
return "EVTREJECTED";
case State::ERROR:
return "ERROR";
default:
return "UNKNOWN";
}
std::ostringstream oss;
oss << m_slot.algsStates[props.m_algoIndex];
return oss.str();
}
std::string operator()( const DecisionHubProps& ) const { return ""; }
......
......@@ -155,12 +155,15 @@ gaudi_add_unit_test(test_SystemTypeinfoName tests/src/test_SystemTypeinfoName.cp
gaudi_add_unit_test(test_SystemCmdLineArgs tests/src/test_SystemCmdLineArgs.cpp
LINK_LIBRARIES GaudiKernel
TYPE Boost)
gaudi_add_unit_test(test_reverse tests/src/test_reverse.cpp
gaudi_add_unit_test(test_apply tests/src/test_apply.cpp
LINK_LIBRARIES GaudiKernel
TYPE Boost)
gaudi_add_unit_test(test_compose tests/src/test_compose.cpp
LINK_LIBRARIES GaudiKernel
TYPE Boost)
gaudi_add_unit_test(test_reverse tests/src/test_reverse.cpp
LINK_LIBRARIES GaudiKernel
TYPE Boost)
gaudi_add_compile_test(test_StatusCodeFail tests/src/test_StatusCode_fail.cxx
ERRORS "FAIL01;FAIL02;FAIL03;FAIL04")
......
......@@ -130,7 +130,7 @@ public:
template <class T>
StatusCode service( const std::string& name, T*& svc, bool createIf = true ) const
{
return service_i( name, createIf, T::interfaceID(), reinterpret_cast<void**>( &svc ) );
return service_i( name, createIf, T::interfaceID(), (void**)&svc );
}
/** Access a service by name, type creating it if it doesn't already exist.
......
......@@ -231,7 +231,7 @@ public:
template <class T>
StatusCode service( const std::string& name, T*& psvc, bool createIf = true ) const
{
return service_i( name, createIf, T::interfaceID(), reinterpret_cast<void**>( &psvc ) );
return service_i( name, createIf, T::interfaceID(), (void**)&psvc );
}
/// Access a service by name and type, creating it if it doesn't already exist.
......
......@@ -90,7 +90,7 @@ public:
template <class T>
StatusCode service( const std::string& name, T*& psvc, bool createIf = false ) const
{
return service_i( name, createIf, T::interfaceID(), reinterpret_cast<void**>( &psvc ) );
return service_i( name, createIf, T::interfaceID(), (void**)&psvc );
}
/// Access a service by name, type creating it if it doesn't already exist.
......
#ifndef GAUDIKERNEL_DECLAREFACTORYENTRIES_H
#define GAUDIKERNEL_DECLAREFACTORYENTRIES_H 1
#ifdef ATLAS
// Backwards compatibility dummies
#define DECLARE_ALGORITHM( x ) /*dummy*/
#define DECLARE_NAMESPACE_ALGORITHM( n, x ) /*dummy*/
#define DECLARE_AUDITOR( x ) /*dummy*/
#define DECLARE_NAMESPACE_AUDITOR( n, x ) /*dummy*/
#define DECLARE_GENERIC_CONVERTER( x ) /* dummy */
#define DECLARE_NAMESPACE_GENERIC_CONVERTER( n, x ) /* dummy */
#define DECLARE_CONVERTER( x ) /*dummy*/
#define DECLARE_NAMESPACE_CONVERTER( n, x ) /*dummy */
#define DECLARE_SERVICE( x ) /*dummy*/
#define DECLARE_NAMESPACE_SERVICE( n, x ) /*dummy*/
#define DECLARE_ALGTOOL( x ) /*dummy*/
#define DECLARE_NAMESPACE_ALGTOOL( n, x ) /*dummy*/
#define DECLARE_TOOL( x ) /*dummy*/
#define DECLARE_NAMESPACE_TOOL( n, x ) /*dummy*/
#define DECLARE_FACTORY_ENTRIES( x ) void x##_load()
#else
#warning "obsolete empty header, please remove it"
#endif
#endif // GAUDIKERNEL_DECLAREFACTORYENTRIES_H
#ifndef GAUDIKERNEL_APPLY_H
#define GAUDIKERNEL_APPLY_H
#include "GaudiKernel/invoke.h"
namespace Gaudi
{
namespace detail
{
template <class F, class Tuple, std::size_t... I>
constexpr decltype( auto ) apply_impl( F&& f, Tuple&& t, std::index_sequence<I...> ) noexcept(
noexcept( Gaudi::invoke( std::forward<F>( f ), std::get<I>( std::forward<Tuple>( t ) )... ) ) )
{
return Gaudi::invoke( std::forward<F>( f ), std::get<I>( std::forward<Tuple>( t ) )... );
}
} // namespace detail
//
// implementation of std::apply -- see http://en.cppreference.com/w/cpp/utility/apply --
// Invokes the Callable object f with a tuple of arguments, i.e.
// returns f( std::get<0>(t), std::get<1>(t), ... )
//
template <class F, class Tuple>
constexpr decltype( auto ) apply( F&& f, Tuple&& t ) noexcept( noexcept(
detail::apply_impl( std::forward<F>( f ), std::forward<Tuple>( t ),
std::make_index_sequence<std::tuple_size<std::remove_reference_t<Tuple>>::value>{} ) ) )
{
return detail::apply_impl( std::forward<F>( f ), std::forward<Tuple>( t ),
std::make_index_sequence<std::tuple_size<std::remove_reference_t<Tuple>>::value>{} );
}
}
#endif
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE test_apply
#include <boost/test/unit_test.hpp>
#include <array>
#include <tuple>
#include "GaudiKernel/apply.h"
BOOST_AUTO_TEST_CASE( test_apply )
{
{
std::array<int, 3> a{1, 2, 3};
BOOST_CHECK( Gaudi::apply( []( int i, int j, int k ) { return i + j + k; }, a ) == 6 );
std::tuple<int, double> b{2, 2.1};
BOOST_CHECK( Gaudi::apply( []( int i, int j ) { return i + j; }, b ) == 4 );
}
}
---
version: v30r2
date: 2018-03-16
date: 2018-03-20
supported_builds: [CMake]
---
Package Coordinators: Marco Clemencic, Charles Leggett, Benedikt Hegner
......@@ -48,13 +48,13 @@ incompatible change.
* AvalancheSchedulerSvc: Fix undefined output ordering ([mr !635][])
* Fix warnings seen when compiling with gcc8 ([mr !638][])
* Prevent property deprecation warnings when unpickling options ([mr !641][])
* Fixed a couple of bugs found by Coverity ([mr !644][])
* [Build System][]
* Fixed typo in CMake option name ([mr !578][])
* Fix distcc support and add icecream ([mr !585][])
* Require Python 2.7 until Python 3 migration is complete ([mr !606][])
* Externalize shared python tools ([mr !612][])
* Remove restrictions on names of installed headers ([mr !615][])
* GaudiProjectConfig: Fix generated `__init__.py` files to handle symlinks ([mr !636][])
* [C++ Framework][]
* Add thread friendly `THistSvc` ([mr !455][])
* Make `Gaudi::Property<T>` work even if `T` is only copy-constructible ([mr !470][])
......@@ -174,10 +174,10 @@ The full list of changes can also be found on [Gitlab][].
[mr !633]: https://gitlab.cern.ch/gaudi/Gaudi/merge_requests/633
[mr !634]: https://gitlab.cern.ch/gaudi/Gaudi/merge_requests/634
[mr !635]: https://gitlab.cern.ch/gaudi/Gaudi/merge_requests/635
[mr !636]: https://gitlab.cern.ch/gaudi/Gaudi/merge_requests/636
[mr !638]: https://gitlab.cern.ch/gaudi/Gaudi/merge_requests/638
[mr !639]: https://gitlab.cern.ch/gaudi/Gaudi/merge_requests/639
[mr !641]: https://gitlab.cern.ch/gaudi/Gaudi/merge_requests/641
[mr !644]: https://gitlab.cern.ch/gaudi/Gaudi/merge_requests/644
[Bug Fix]: https://gitlab.cern.ch/gaudi/Gaudi/merge_requests?label_name%5B%5D=bug+fix&scope=all&state=merged&milestone_title=v30r2
[Build System]: https://gitlab.cern.ch/gaudi/Gaudi/merge_requests?label_name%5B%5D=build+system&scope=all&state=merged&milestone_title=v30r2
......