The Gaudi Framework  v41r0 (bdbe7744)
Loading...
Searching...
No Matches
Gaudi::TestSuite::IntVectorsToIntVector Struct Referencefinal

Concatenates a list of input vectors into a single output vector. More...

Inheritance diagram for Gaudi::TestSuite::IntVectorsToIntVector:
Collaboration diagram for Gaudi::TestSuite::IntVectorsToIntVector:

Public Member Functions

 IntVectorsToIntVector (const std::string &name, ISvcLocator *svcLoc)
std::vector< int > operator() (const Gaudi::Functional::vector_of_const_< std::vector< int > > &intVectors) const override

Detailed Description

Concatenates a list of input vectors into a single output vector.

Definition at line 234 of file MakeAndConsume.cpp.

Constructor & Destructor Documentation

◆ IntVectorsToIntVector()

Gaudi::TestSuite::IntVectorsToIntVector::IntVectorsToIntVector ( const std::string & name,
ISvcLocator * svcLoc )
inline

Definition at line 238 of file MakeAndConsume.cpp.

239 : MergingTransformer( name, svcLoc, { "InputLocations", {} },
240 { "OutputLocation", "/Event/MyConcatenatedIntVector" } ) {}
details::MergingTransformer< Signature, Traits_, details::isLegacy< Traits_ > > MergingTransformer

Member Function Documentation

◆ operator()()

std::vector< int > Gaudi::TestSuite::IntVectorsToIntVector::operator() ( const Gaudi::Functional::vector_of_const_< std::vector< int > > & intVectors) const
inlineoverride

Definition at line 243 of file MakeAndConsume.cpp.

243 {
244 // Create a vector and pre-allocate enough space for the number of integers we have
245 auto nelements = std::accumulate( intVectors.begin(), intVectors.end(), 0,
246 []( const auto a, const auto b ) { return a + b.size(); } );
247 std::vector<int> out;
248 out.reserve( nelements );
249 // Concatenate the input vectors to form the output
250 for ( auto& intVector : intVectors ) {
251 info() << "Concatening vector " << intVector << endmsg;
252 out.insert( out.end(), intVector.begin(), intVector.end() );
253 // intVector.clear(); // should not be possible!!! and does indeed not compile ;-)
254 }
255 info() << "Storing output vector " << out << " to " << outputLocation() << endmsg;
256 return out;
257 }
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition MsgStream.h:198

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