diff --git a/CMakeLists.txt b/CMakeLists.txt index 4bc83ee1f3..b68a08de95 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,7 @@ set(CMAKE_INSTALL_MESSAGE LAZY) # Set project version SET(FAIRROOT_MAJOR_VERSION 18) SET(FAIRROOT_MINOR_VERSION 6) -SET(FAIRROOT_PATCH_VERSION 7) +SET(FAIRROOT_PATCH_VERSION 8) if(APPLE) if(NOT DEFINED CMAKE_C_COMPILER) @@ -84,19 +84,8 @@ endif() SET(VMCWORKDIR ${CMAKE_SOURCE_DIR}/examples) -# Check if the compiler support specific C++11 features -# Up to now this is only a check since the code does not use -# any of the features of the new standard -Set(CheckSrcDir "${CMAKE_SOURCE_DIR}/cmake/checks") -include(CheckCXX11Features) include(CheckSymbolExists) -# FairRoot only uses C++11 or later, so we need an compiler which supports C++11 -# Check if the used compiler support C++11. If not stop with an error message -If(NOT _HAS_CXX11_FLAG) - Message(FATAL_ERROR "The used C++ compiler (${CMAKE_CXX_COMPILER}) does not support C++11. CbmRoot can only be compiled with compilers supporting C++11. Please install such a compiler.") -EndIf() - # Load some basic macros which are needed later on include(FairMacros) include(WriteConfigFile) diff --git a/base/MQ/CMakeLists.txt b/base/MQ/CMakeLists.txt index cc4be40c07..71dd807847 100644 --- a/base/MQ/CMakeLists.txt +++ b/base/MQ/CMakeLists.txt @@ -1,11 +1,33 @@ ################################################################################ -# Copyright (C) 2014-2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # +# Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # # # # This software is distributed under the terms of the # # GNU Lesser General Public Licence (LGPL) version 3, # # copied verbatim in the file "LICENSE" # ################################################################################ +### Wrapper around FairMQ::FairMQ to support API transition + +set(target FairMQ) + +set(headers FairMQ.h FairRunFairMQDevice.h) +add_library(${target} INTERFACE) +add_library(FairRoot::${target} ALIAS ${target}) +target_link_libraries(${target} INTERFACE FairMQ::FairMQ) +target_include_directories(${target} INTERFACE + $ + $ +) +install(TARGETS ${ARGS_TARGETS} + EXPORT ${PROJECT_EXPORT_SET} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ARCHIVE DESTINATION ${PROJECT_INSTALL_LIBDIR} + LIBRARY DESTINATION ${PROJECT_INSTALL_LIBDIR}) +install(FILES ${headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +unset(headers) + +### BaseMQ lib + set(target BaseMQ) set(sources @@ -61,8 +83,7 @@ target_link_libraries(${target} PUBLIC FairRoot::ParBase # FairParRootFileIo, FairRuntimeDb FairRoot::FairTools $<$:FairRoot::MbsAPI> - - FairMQ::FairMQ + FairRoot::FairMQ Boost::serialization Boost::filesystem diff --git a/base/MQ/FairMQ.h b/base/MQ/FairMQ.h new file mode 100644 index 0000000000..e28cac63c4 --- /dev/null +++ b/base/MQ/FairMQ.h @@ -0,0 +1,55 @@ +/******************************************************************************** + * Copyright (C) 2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ + +#ifndef FAIRROOT_BASE_MQ_FAIRMQ_H +#define FAIRROOT_BASE_MQ_FAIRMQ_H + +#include +#ifdef FAIRMQ_VERSION_DEC +#undef FAIRMQ_VERSION_DEC // bugged +#endif +#if defined FAIRMQ_VERSION_MAJOR && defined FAIRMQ_VERSION_MINOR && defined FAIRMQ_VERSION_PATCH +#define FAIRMQ_VERSION_DEC (FAIRMQ_VERSION_MAJOR * 100000) + (FAIRMQ_VERSION_MINOR * 1000) + (FAIRMQ_VERSION_PATCH * 10) +#else +#define FAIRMQ_VERSION_DEC 9999999 +#endif + +// see https://github.com/FairRootGroup/FairMQ/discussions/423 +#if FAIRMQ_VERSION_DEC < 104410 + +#include // for FairMQChannel +#include // for FairMQDevice +#include // for FairMQMessage, FairMQMessagePtr +#include // for FairMQParts +#include // for FairMQTransportFactory +#include // for FairMQProgOptions + +namespace fair { +namespace mq { +using Channel = ::FairMQChannel; +using Device = ::FairMQDevice; +using Message = ::FairMQMessage; +using MessagePtr = ::FairMQMessagePtr; +using Parts = ::FairMQParts; +using ProgOptions = ::FairMQProgOptions; +using TransportFactory = ::FairMQTransportFactory; +} // namespace mq +} // namespace fair + +#else + +#include // for fair::mq::Channel +#include // for fair::mq::Device +#include // for fair::mq::Message, fair::mq::MessagePtr +#include // for fair::mq::Parts +#include // for fair::mq::ProgOptions +#include // for fair::mq::TransportFactory + +#endif + +#endif // FAIRROOT_BASE_MQ_FAIRMQ_H diff --git a/base/MQ/FairRunFairMQDevice.h b/base/MQ/FairRunFairMQDevice.h new file mode 100644 index 0000000000..33dc590a5d --- /dev/null +++ b/base/MQ/FairRunFairMQDevice.h @@ -0,0 +1,53 @@ +/******************************************************************************** + * Copyright (C) 2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ + +#ifndef FAIRROOT_BASE_MQ_FAIRRUNFAIRMQDEVICE_H +#define FAIRROOT_BASE_MQ_FAIRRUNFAIRMQDEVICE_H + +#include +#ifdef FAIRMQ_VERSION_DEC +#undef FAIRMQ_VERSION_DEC // bugged +#endif +#if defined FAIRMQ_VERSION_MAJOR && defined FAIRMQ_VERSION_MINOR && defined FAIRMQ_VERSION_PATCH +#define FAIRMQ_VERSION_DEC (FAIRMQ_VERSION_MAJOR * 100000) + (FAIRMQ_VERSION_MINOR * 1000) + (FAIRMQ_VERSION_PATCH * 10) +#else +#define FAIRMQ_VERSION_DEC 9999999 +#endif + +#if FAIRMQ_VERSION_DEC < 104340 +#include +#include // for std::unique_ptr + +namespace fair { +namespace mq { +using Device = ::FairMQDevice; +using ProgOptions = ::FairMQProgOptions; +} // namespace mq +} // namespace fair +#else +// see https://github.com/FairRootGroup/FairMQ/commit/978191fa6c252714b73dde70d6737ac1cc4e529a +#include +#endif + +// FairRoot API during transition period +// to be implemented by the user, keeping the old const& arg for the transition +std::unique_ptr fairGetDevice(fair::mq::ProgOptions const&); + +// FairMQ API +#if FAIRMQ_VERSION_DEC < 104340 +// getDevice from +FairMQDevicePtr getDevice(fair::mq::ProgOptions const& options) { return fairGetDevice(options).release(); } +#elif FAIRMQ_VERSION_DEC < 104380 +// see https://github.com/FairRootGroup/FairMQ/commit/978191fa6c252714b73dde70d6737ac1cc4e529a +std::unique_ptr getDevice(fair::mq::ProgOptions const& options) { return fairGetDevice(options); } +#else +// see https://github.com/FairRootGroup/FairMQ/commit/a7dbeadd1c8f3f82c43067b05290e4393a44f1ac +std::unique_ptr getDevice(fair::mq::ProgOptions& options) { return fairGetDevice(options); } +#endif + +#endif // FAIRROOT_BASE_MQ_FAIRRUNFAIRMQDEVICE_H diff --git a/base/MQ/devices/BaseMQFileSink.h b/base/MQ/devices/BaseMQFileSink.h index 824f228dbb..eda26cf0c0 100644 --- a/base/MQ/devices/BaseMQFileSink.h +++ b/base/MQ/devices/BaseMQFileSink.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -16,12 +16,13 @@ #ifndef BASEMQFILESINK_H #define BASEMQFILESINK_H -#include -#include +#include "FairMQ.h" // for fair::mq::Device + +#include template class BaseMQFileSink - : public FairMQDevice + : public fair::mq::Device , public InputPolicy , public OutputPolicy { @@ -52,11 +53,10 @@ class BaseMQFileSink { int receivedMsg = 0; while (!NewStatePending()) { - std::unique_ptr msg(NewMessage()); + auto msg(NewMessage()); if (Receive(msg, fInputChanName) > 0) { - FairMQDevice::Deserialize( - *msg, InputPolicy::fInput); // get data from message. - OutputPolicy::Serialize(InputPolicy::fInput); // put data into output. + InputPolicy::Deserialize(*msg, InputPolicy::fInput); // get data from message. + OutputPolicy::Serialize(InputPolicy::fInput); // put data into output. receivedMsg++; } } diff --git a/base/MQ/devices/FairMQLmdSampler.h b/base/MQ/devices/FairMQLmdSampler.h index 1f89ed15d2..e4bb60fb33 100644 --- a/base/MQ/devices/FairMQLmdSampler.h +++ b/base/MQ/devices/FairMQLmdSampler.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -15,6 +15,7 @@ #ifndef FAIRMQLMDSAMPLER_H #define FAIRMQLMDSAMPLER_H +#include "FairMQ.h" // for fair::mq::Device, fair::mq::Parts extern "C" { #include "f_evt.h" @@ -22,16 +23,14 @@ extern "C" #include "s_filhe_swap.h" } -#include -#include -#include #include +#include #include #include #include #include -class FairMQLmdSampler : public FairMQDevice +class FairMQLmdSampler : public fair::mq::Device { public: FairMQLmdSampler() @@ -244,10 +243,10 @@ class FairMQLmdSampler : public FairMQDevice std::string chanName = fSubEventChanMap.at(key); // LOG(debug) << "chanName = " << chanName; - FairMQParts parts; + fair::mq::Parts parts; // send header - // std::unique_ptr header(fTransportFactory->CreateMessage(fSubEvent, sizeof(fSubEvent), + // auto header(fTransportFactory->CreateMessage(fSubEvent, sizeof(fSubEvent), // free_buffer, nullptr)); fChannels.at(chanName).at(0).SendPart(header); int* arraySize = new int(sebuflength); diff --git a/base/MQ/devices/FairMQProcessor.h b/base/MQ/devices/FairMQProcessor.h index 0e7312cb28..5cdaadc053 100644 --- a/base/MQ/devices/FairMQProcessor.h +++ b/base/MQ/devices/FairMQProcessor.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -15,13 +15,13 @@ #ifndef FAIRMQPROCESSOR_H_ #define FAIRMQPROCESSOR_H_ +#include "FairMQ.h" // for fair::mq::Device, fair::mq::MessagePtr #include "FairMQProcessorTask.h" -#include -#include +#include template -class FairMQProcessor : public FairMQDevice +class FairMQProcessor : public fair::mq::Device { public: FairMQProcessor() @@ -52,7 +52,7 @@ class FairMQProcessor : public FairMQDevice } fProcessorTask->InitTask(); - OnData(fInChannelName, [this](FairMQMessagePtr& msg, int /*index*/) { + OnData(fInChannelName, [this](fair::mq::MessagePtr& msg, int /*index*/) { ++fReceivedMsgs; fProcessorTask->SetPayload(msg); fProcessorTask->Exec(); diff --git a/base/MQ/devices/FairMQSampler.h b/base/MQ/devices/FairMQSampler.h index c07809c937..10fa1deaf3 100644 --- a/base/MQ/devices/FairMQSampler.h +++ b/base/MQ/devices/FairMQSampler.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -16,15 +16,15 @@ #define FAIRMQSAMPLER_H_ #include "FairFileSource.h" +#include "FairMQ.h" // for fair::mq::Device, fair::mq::MessagePtr #include "FairMQSamplerTask.h" #include "FairParRootFileIo.h" #include "FairRootFileSink.h" #include "FairRunAna.h" #include "FairRuntimeDb.h" -#include -#include #include +#include #include /** @@ -40,7 +40,7 @@ */ template -class FairMQSampler : public FairMQDevice +class FairMQSampler : public fair::mq::Device { public: FairMQSampler() @@ -130,7 +130,7 @@ class FairMQSampler : public FairMQDevice virtual bool ConditionalRun() { - FairMQMessagePtr msg; + fair::mq::MessagePtr msg; fSamplerTask->SetEventIndex(fSentMsgs); fFairRunAna->RunMQ(fSentMsgs); @@ -168,7 +168,7 @@ class FairMQSampler : public FairMQDevice { uint64_t numAcks = 0; for (Long64_t eventNr = 0; eventNr < fNumEvents; ++eventNr) { - FairMQMessagePtr ack(NewMessage()); + auto ack(NewMessage()); if (Receive(ack, fAckChannelName) >= 0) { ++numAcks; } diff --git a/base/MQ/devices/FairMQUnpacker.h b/base/MQ/devices/FairMQUnpacker.h index 692baba78d..89480e523c 100644 --- a/base/MQ/devices/FairMQUnpacker.h +++ b/base/MQ/devices/FairMQUnpacker.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -15,16 +15,16 @@ #ifndef FAIRMQUNPACKER_H #define FAIRMQUNPACKER_H +#include "FairMQ.h" // for fair::mq::Channel, fair::mq::Device #include "RootSerializer.h" -#include #include #include #include #include template -class FairMQUnpacker : public FairMQDevice +class FairMQUnpacker : public fair::mq::Device { public: FairMQUnpacker() @@ -105,11 +105,11 @@ class FairMQUnpacker : public FairMQDevice void Run() { - FairMQChannel& inputChannel = fChannels.at(fInputChannelName).at(0); + fair::mq::Channel& inputChannel = fChannels.at(fInputChannelName).at(0); while (!NewStatePending()) { - FairMQMessagePtr msgSize(NewMessage()); - FairMQMessagePtr msg(NewMessage()); + auto msgSize(NewMessage()); + auto msg(NewMessage()); if (inputChannel.Receive(msgSize) >= 0) { if (inputChannel.Receive(msg) >= 0) { @@ -123,7 +123,7 @@ class FairMQUnpacker : public FairMQDevice // } fUnpacker->DoUnpack(subEvtPtr, dataSize); - Serialize(*msg, fUnpacker->GetOutputData()); + SerializationType().Serialize(*msg, fUnpacker->GetOutputData()); Send(msg, fOutputChanName); fUnpacker->Reset(); } diff --git a/base/MQ/policies/Sampler/FairSourceMQInterface.h b/base/MQ/policies/Sampler/FairSourceMQInterface.h index da13ef5a34..4c15b0f15b 100644 --- a/base/MQ/policies/Sampler/FairSourceMQInterface.h +++ b/base/MQ/policies/Sampler/FairSourceMQInterface.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -13,7 +13,7 @@ #include "FairFileSource.h" #include "FairRunAna.h" -#include +#include #include #include diff --git a/base/MQ/policies/Sampler/SimpleTreeReader.h b/base/MQ/policies/Sampler/SimpleTreeReader.h index 73a819e353..f7efb071ff 100644 --- a/base/MQ/policies/Sampler/SimpleTreeReader.h +++ b/base/MQ/policies/Sampler/SimpleTreeReader.h @@ -1,3 +1,11 @@ +/******************************************************************************** + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ + /* * File: SimpleTreeReader.h * Author: winckler @@ -19,10 +27,7 @@ #include #include #include - -// FairRoot -#include -#include +#include template class BaseSimpleTreeReader diff --git a/base/MQ/policies/Serialization/BinaryBaseClassSerializer.h b/base/MQ/policies/Serialization/BinaryBaseClassSerializer.h index a8da5bc198..8aaa287703 100644 --- a/base/MQ/policies/Serialization/BinaryBaseClassSerializer.h +++ b/base/MQ/policies/Serialization/BinaryBaseClassSerializer.h @@ -1,3 +1,11 @@ +/******************************************************************************** + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ + /* * File: BinaryBaseClassSerializer.h * Author: winckler @@ -8,7 +16,7 @@ #ifndef BINARYBASECLASSSERIALIZER_H #define BINARYBASECLASSSERIALIZER_H -#include +#include "FairMQ.h" // for fair::mq::Message template class BinaryBaseClassSerializer @@ -25,7 +33,7 @@ class BinaryBaseClassSerializer virtual ~BinaryBaseClassSerializer() {} - void GetPayload(FairMQMessage* msg) + void GetPayload(fair::mq::Message* msg) { int inputSize = msg->GetSize(); if (inputSize > 0) { @@ -34,13 +42,13 @@ class BinaryBaseClassSerializer fPayload = static_cast(msg->GetData()); } - void SetMessage(FairMQMessage* msg) { fMessage = msg; } + void SetMessage(fair::mq::Message* msg) { fMessage = msg; } - FairMQMessage* GetMessage() { return fMessage; } + fair::mq::Message* GetMessage() { return fMessage; } protected: TPayload* fPayload; - FairMQMessage* fMessage; + fair::mq::Message* fMessage; int fNumInput; }; diff --git a/base/MQ/policies/Serialization/BoostSerializer.h b/base/MQ/policies/Serialization/BoostSerializer.h index 9576c9a14a..fe8609c01e 100644 --- a/base/MQ/policies/Serialization/BoostSerializer.h +++ b/base/MQ/policies/Serialization/BoostSerializer.h @@ -1,3 +1,11 @@ +/******************************************************************************** + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ + /* * File: BoostSerializer.h * Author: winckler @@ -8,18 +16,18 @@ #ifndef BOOSTSERIALIZER_H #define BOOSTSERIALIZER_H -#include -#include -#include +#include "FairMQ.h" // for fair::mq::Message namespace boost { namespace serialization { class access; } } // namespace boost +#include #include // input: a non-portable native binary archive #include // output: a non-portable native binary archive #include +#include #include #include #include @@ -59,7 +67,7 @@ template class BoostSerializer { public: - void Serialize(FairMQMessage& msg, DataType* data) + void Serialize(fair::mq::Message& msg, DataType* data) { std::ostringstream buffer; boost::archive::binary_oarchive outputArchive(buffer); @@ -69,7 +77,7 @@ class BoostSerializer std::memcpy(msg.GetData(), buffer.str().c_str(), size); } - void Serialize(FairMQMessage& msg, const DataType& data) + void Serialize(fair::mq::Message& msg, const DataType& data) { std::ostringstream buffer; boost::archive::binary_oarchive outputArchive(buffer); @@ -79,7 +87,7 @@ class BoostSerializer std::memcpy(msg.GetData(), buffer.str().c_str(), size); } - void Serialize(FairMQMessage& msg, const std::vector& dataVec) + void Serialize(fair::mq::Message& msg, const std::vector& dataVec) { std::ostringstream buffer; boost::archive::binary_oarchive outputArchive(buffer); @@ -89,7 +97,7 @@ class BoostSerializer std::memcpy(msg.GetData(), buffer.str().c_str(), size); } - void Serialize(FairMQMessage& msg, TClonesArray* input) + void Serialize(fair::mq::Message& msg, TClonesArray* input) { std::vector dataVec; for (int i = 0; i < input->GetEntriesFast(); ++i) { @@ -102,9 +110,9 @@ class BoostSerializer Serialize(msg, dataVec); } - void Serialize(FairMQMessage& msg, std::unique_ptr input) { Serialize(msg, input.get()); } + void Serialize(fair::mq::Message& msg, std::unique_ptr input) { Serialize(msg, input.get()); } - void Deserialize(FairMQMessage& msg, DataType& input) + void Deserialize(fair::mq::Message& msg, DataType& input) { std::string msgStr(static_cast(msg.GetData()), msg.GetSize()); std::istringstream buffer(msgStr); @@ -116,7 +124,7 @@ class BoostSerializer } } - void Deserialize(FairMQMessage& msg, std::vector& input) + void Deserialize(fair::mq::Message& msg, std::vector& input) { input.clear(); std::string msgStr(static_cast(msg.GetData()), msg.GetSize()); @@ -125,7 +133,7 @@ class BoostSerializer inputArchive >> input; } - void Deserialize(FairMQMessage& msg, TClonesArray* input) + void Deserialize(fair::mq::Message& msg, TClonesArray* input) { std::vector dataVec; Deserialize(msg, dataVec); @@ -136,12 +144,13 @@ class BoostSerializer } if (input->IsEmpty()) { - LOG(debug) << "BoostSerializer::Deserialize(FairMQMessage& msg, TClonesArray* input): No Output array!"; + LOG(debug) + << "BoostSerializer::Deserialize(fair::mq::Message& msg, TClonesArray* input): No Output array!"; } } } - void Deserialize(FairMQMessage& msg, std::unique_ptr& input) { Deserialize(msg, input.get()); } + void Deserialize(fair::mq::Message& msg, std::unique_ptr& input) { Deserialize(msg, input.get()); } }; #endif /* BOOSTSERIALIZER_H */ diff --git a/base/MQ/policies/Serialization/IOPolicy.h b/base/MQ/policies/Serialization/IOPolicy.h index 7aebe2582d..8dd95b2d18 100644 --- a/base/MQ/policies/Serialization/IOPolicy.h +++ b/base/MQ/policies/Serialization/IOPolicy.h @@ -1,3 +1,11 @@ +/******************************************************************************** + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ + #ifndef IOPOLICY_H #define IOPOLICY_H diff --git a/base/MQ/policies/Serialization/RootSerializer.h b/base/MQ/policies/Serialization/RootSerializer.h index e0ad0eb937..db1f28016f 100644 --- a/base/MQ/policies/Serialization/RootSerializer.h +++ b/base/MQ/policies/Serialization/RootSerializer.h @@ -1,3 +1,11 @@ +/******************************************************************************** + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ + /* * File: RootSerializer.h * Author: winckler @@ -8,7 +16,8 @@ #ifndef ROOTSERIALIZER_H #define ROOTSERIALIZER_H -#include +#include "FairMQ.h" // for fair::mq::Message + #include #include #include @@ -30,7 +39,7 @@ struct RootSerializer virtual ~RootSerializer() = default; template - void Serialize(FairMQMessage& msg, T* input) + void Serialize(fair::mq::Message& msg, T* input) { TMessage* tm = new TMessage(kMESS_OBJECT); tm->WriteObject(input); @@ -39,7 +48,7 @@ struct RootSerializer } template - void Serialize(FairMQMessage& msg, const std::unique_ptr& input) + void Serialize(fair::mq::Message& msg, const std::unique_ptr& input) { TMessage* tm = new TMessage(kMESS_OBJECT); tm->WriteObject(input.get()); @@ -48,7 +57,7 @@ struct RootSerializer } template - void Deserialize(FairMQMessage& msg, T*& output) + void Deserialize(fair::mq::Message& msg, T*& output) { delete output; FairTMessage tm(msg.GetData(), msg.GetSize()); @@ -56,7 +65,7 @@ struct RootSerializer } template - void Deserialize(FairMQMessage& msg, std::unique_ptr& output) + void Deserialize(fair::mq::Message& msg, std::unique_ptr& output) { FairTMessage tm(msg.GetData(), msg.GetSize()); output.reset(static_cast(tm.ReadObjectAny(tm.GetClass()))); diff --git a/base/MQ/policies/Storage/BinaryOutFileManager.h b/base/MQ/policies/Storage/BinaryOutFileManager.h index 7d36f4a0e7..74eb733280 100644 --- a/base/MQ/policies/Storage/BinaryOutFileManager.h +++ b/base/MQ/policies/Storage/BinaryOutFileManager.h @@ -1,3 +1,11 @@ +/******************************************************************************** + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ + /* * File: BinaryOutFileManager.h * Author: winckler @@ -26,12 +34,10 @@ class access; // FairRoot #include "BoostDataSaver.h" +#include "FairMQ.h" // for fair::mq::Message #include "TriviallyCopyableDataSaver.h" #include "baseMQtools.h" -#include -#include - #define GET_POLICY_ID(Policy) #Policy using BinArchive = boost::archive::binary_oarchive; @@ -62,7 +68,7 @@ class BinaryOutFileManager : public TStoragePolicy void SetFileProperties(const std::string& filename) { fFileName = filename; } - void AddToFile(FairMQMessage* msg) { TStoragePolicy::Write(fOutfile, msg); } + void AddToFile(fair::mq::Message* msg) { TStoragePolicy::Write(fOutfile, msg); } void AddToFile(TPayload* objArr, long size) { AppendObjArray(fOutfile, objArr, size); } diff --git a/base/MQ/policies/Storage/BoostDataSaver.h b/base/MQ/policies/Storage/BoostDataSaver.h index f4cdad40d2..cdb121c64c 100644 --- a/base/MQ/policies/Storage/BoostDataSaver.h +++ b/base/MQ/policies/Storage/BoostDataSaver.h @@ -1,3 +1,11 @@ +/******************************************************************************** + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ + /* * File: BoostDataSaver.h * Author: winckler @@ -8,6 +16,9 @@ #ifndef BOOSTDATASAVER_H #define BOOSTDATASAVER_H +// FairRoot +#include "FairMQ.h" // for fair::mq::Message + // std #include #include @@ -24,13 +35,11 @@ class access; #include #include #include - -// FairRoot -#include +#include template + typename TArchiveOut = boost::archive::binary_oarchive> class BoostDataSaver { public: @@ -52,7 +61,7 @@ class BoostDataSaver outArchive << dataVector; } - void Write(std::ofstream& outfile, FairMQMessage* msg) + void Write(std::ofstream& outfile, fair::mq::Message* msg) { std::vector objArr; std::string msgStr(static_cast(msg->GetData()), msg->GetSize()); diff --git a/base/MQ/policies/Storage/RootOutFileManager.h b/base/MQ/policies/Storage/RootOutFileManager.h index 18403692ac..e282695502 100644 --- a/base/MQ/policies/Storage/RootOutFileManager.h +++ b/base/MQ/policies/Storage/RootOutFileManager.h @@ -1,3 +1,11 @@ +/******************************************************************************** + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ + /* * File: RootOutFileManager.h * Author: winckler @@ -25,9 +33,7 @@ // FairRoot #include "FairLogger.h" - -#include -#include +#include "FairMQ.h" // for fair::mq::Message, fair::mq::ProgOptions template class RootOutFileManager @@ -111,7 +117,7 @@ class RootOutFileManager } } - void SetFileProperties(const FairMQProgOptions& config) + void SetFileProperties(const fair::mq::ProgOptions& config) { fFilename = config.GetValue("output-file-name"); fTreeName = config.GetValue("output-file-tree"); @@ -194,7 +200,7 @@ class RootOutFileManager } } - void AddToFile(FairMQMessage* msg) + void AddToFile(fair::mq::Message* msg) { int inputSize = msg->GetSize(); int numInput = 0; diff --git a/base/MQ/policies/Storage/TriviallyCopyableDataSaver.h b/base/MQ/policies/Storage/TriviallyCopyableDataSaver.h index dfc6b31444..997abfe573 100644 --- a/base/MQ/policies/Storage/TriviallyCopyableDataSaver.h +++ b/base/MQ/policies/Storage/TriviallyCopyableDataSaver.h @@ -1,3 +1,11 @@ +/******************************************************************************** + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ + /* * File: TriviallyCopyableDataSaver.h * Author: winckler @@ -8,7 +16,10 @@ #ifndef TRIVIALLYCOPYABLEDATASAVER_H #define TRIVIALLYCOPYABLEDATASAVER_H -#include +#include "FairMQ.h" // for fair::mq::Message + +#include +#include template class TriviallyCopyableDataSaver @@ -28,7 +39,7 @@ class TriviallyCopyableDataSaver } } - void Write(std::ofstream& outfile, FairMQMessage* msg) + void Write(std::ofstream& outfile, fair::mq::Message* msg) { int inputSize = msg->GetSize(); long sizeArr = 0; diff --git a/base/MQ/tasks/FairMQProcessorTask.cxx b/base/MQ/tasks/FairMQProcessorTask.cxx index 6836a4b880..20d5a6f371 100644 --- a/base/MQ/tasks/FairMQProcessorTask.cxx +++ b/base/MQ/tasks/FairMQProcessorTask.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -22,6 +22,6 @@ FairMQProcessorTask::~FairMQProcessorTask() {} void FairMQProcessorTask::Exec(Option_t* /*opt*/) {} -void FairMQProcessorTask::SetPayload(std::unique_ptr& msg) { fPayload = std::move(msg); } +void FairMQProcessorTask::SetPayload(std::unique_ptr& msg) { fPayload = std::move(msg); } -void FairMQProcessorTask::GetPayload(std::unique_ptr& msg) { msg = std::move(fPayload); } +void FairMQProcessorTask::GetPayload(std::unique_ptr& msg) { msg = std::move(fPayload); } diff --git a/base/MQ/tasks/FairMQProcessorTask.h b/base/MQ/tasks/FairMQProcessorTask.h index 3e0be24358..853e836ff0 100644 --- a/base/MQ/tasks/FairMQProcessorTask.h +++ b/base/MQ/tasks/FairMQProcessorTask.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -15,10 +15,9 @@ #ifndef FAIRMQPROCESSORTASK_H_ #define FAIRMQPROCESSORTASK_H_ +#include "FairMQ.h" // for fair::mq::Message #include "FairTask.h" -#include - class FairMQProcessorTask : public FairTask { public: @@ -30,11 +29,11 @@ class FairMQProcessorTask : public FairTask virtual void Exec(Option_t* opt = "0"); - void SetPayload(std::unique_ptr& msg); - void GetPayload(std::unique_ptr& msg); + void SetPayload(std::unique_ptr& msg); + void GetPayload(std::unique_ptr& msg); protected: - std::unique_ptr fPayload; + std::unique_ptr fPayload; }; #endif /* FAIRMQPROCESSORTASK_H_ */ diff --git a/base/MQ/tasks/FairMQSamplerTask.cxx b/base/MQ/tasks/FairMQSamplerTask.cxx index 5e4721819c..f9455b7e33 100644 --- a/base/MQ/tasks/FairMQSamplerTask.cxx +++ b/base/MQ/tasks/FairMQSamplerTask.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -53,6 +53,6 @@ void FairMQSamplerTask::SetBranch(const string& branch) { fBranch = branch; } void FairMQSamplerTask::SetEventIndex(Long64_t eventIndex) { fEventIndex = eventIndex; } -void FairMQSamplerTask::GetPayload(FairMQMessagePtr& msg) { msg = move(fPayload); } +void FairMQSamplerTask::GetPayload(fair::mq::MessagePtr& msg) { msg = move(fPayload); } -void FairMQSamplerTask::SetTransport(shared_ptr factory) { fTransportFactory = factory; } +void FairMQSamplerTask::SetTransport(shared_ptr factory) { fTransportFactory = factory; } diff --git a/base/MQ/tasks/FairMQSamplerTask.h b/base/MQ/tasks/FairMQSamplerTask.h index 229754c201..c600b23ac5 100644 --- a/base/MQ/tasks/FairMQSamplerTask.h +++ b/base/MQ/tasks/FairMQSamplerTask.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -16,10 +16,9 @@ #define FAIRMQSAMPLERTASK_H_ #include "FairEventHeader.h" -#include "FairMQTransportFactory.h" +#include "FairMQ.h" // for fair::mq::Message, fair::mq::TransportFactory #include "FairTask.h" -#include #include #include #include @@ -40,16 +39,16 @@ class FairMQSamplerTask : public FairTask void SetEventIndex(Long64_t eventIndex); void SetBranch(const std::string& branch); - void GetPayload(std::unique_ptr& msg); - void SetTransport(std::shared_ptr factory); + void GetPayload(std::unique_ptr& msg); + void SetTransport(std::shared_ptr factory); protected: std::string fBranch; TClonesArray* fInput; - FairMQMessagePtr fPayload; + fair::mq::MessagePtr fPayload; Long64_t fEventIndex; FairEventHeader* fEvtHeader; - std::shared_ptr fTransportFactory; + std::shared_ptr fTransportFactory; }; #endif /* FAIRMQSAMPLERTASK_H_ */ diff --git a/base/steer/FairRootManager.cxx b/base/steer/FairRootManager.cxx index 1420b2b3e3..b17eb87745 100644 --- a/base/steer/FairRootManager.cxx +++ b/base/steer/FairRootManager.cxx @@ -65,6 +65,8 @@ TMCMutex deleteMutex = TMCMUTEX_INITIALIZER; } // namespace Int_t FairRootManager::fgCounter = 0; +std::string FairRootManager::fFolderName = ""; +std::string FairRootManager::fTreeName = ""; FairRootManager* FairRootManager::Instance() { @@ -101,7 +103,6 @@ FairRootManager::FairRootManager() , fEntryNr(0) , fListFolder(0) , fSource(0) - , fSourceChain(new TChain(GetTreeName(), Form("/%s", GetFolderName()))) , fSignalChainList() , fEventHeader(new FairEventHeader()) , fSink(nullptr) @@ -159,6 +160,8 @@ FairRootManager::~FairRootManager() Bool_t FairRootManager::InitSource() { + // creating fSourceChain now, to give the user chance to change the tree and folder name + fSourceChain = new TChain(GetTreeName(), Form("/%s", GetFolderName())); LOG(debug) << "Call the initialiazer for the FairSource in FairRootManager "; if (fSource) { @@ -976,71 +979,69 @@ void FairRootManager::DeleteOldWriteoutBufferData() } } -char* FairRootManager::GetTreeName() +std::string FairRootManager::GetNameFromFile(const char* namekind) { - char* default_name = (char*)"cbmsim"; + std::string default_name = ""; + + if (strcmp(namekind, "treename=") && strcmp(namekind, "foldername=")) { + LOG(fatal) << "FairRootManager, requested " << namekind << ", while only treename= and foldername= available."; + return default_name; + } + char* workdir = getenv("VMCWORKDIR"); if (nullptr == workdir) { return default_name; } // Open file with output tree name - FILE* file = fopen(Form("%s/config/rootmanager.dat", workdir), "r"); + std::ifstream file(Form("%s/config/rootmanager.dat", workdir)); // If file does not exist -> default - if (nullptr == file) { + if (!file.is_open()) { return default_name; } - char str[100]; - while (nullptr != fgets(str, 100, file)) { - if (TString(str).Contains("treename")) { - char* treename = new char[100]; - if (1 == sscanf(str, "treename=%s", treename)) { - fclose(file); - return treename; - } - delete[] treename; + std::string line; + while (std::getline(file, line)) { + if (line.rfind(namekind, 0) == 0) { + line.replace(0, strlen(namekind), ""); + file.close(); + return line; } } - // Key "treename" was not found in file: return default - fclose(file); + file.close(); return default_name; } -char* FairRootManager::GetFolderName() +const char* FairRootManager::GetTreeName() { - char* default_name = (char*)"cbmout"; - if (!FairRun::Instance()->IsAna()) { - default_name = (char*)"cbmroot"; + if (fTreeName.length() > 0) { + return Form("%s", fTreeName.c_str()); } - char* workdir = getenv("VMCWORKDIR"); - if (nullptr == workdir) { - return default_name; + + std::string nameFromFile = GetNameFromFile("treename="); + if (nameFromFile.length() > 0) { + return Form("%s", nameFromFile.c_str()); } - // Open file with output tree name - FILE* file = fopen(Form("%s/config/rootmanager.dat", workdir), "r"); - // If file does not exist -> default - if (nullptr == file) { - return default_name; + return "cbmsim"; +} + +const char* FairRootManager::GetFolderName() +{ + if (fFolderName.length() > 0) { + return Form("%s", fFolderName.c_str()); } - char str[100]; - while (nullptr != fgets(str, 100, file)) { - if (TString(str).Contains("foldername")) { - char* foldername = new char[100]; - if (1 == sscanf(str, "foldername=%s", foldername)) { - fclose(file); - return foldername; - } - delete[] foldername; - } + std::string nameFromFile = GetNameFromFile("foldername="); + if (nameFromFile.length() > 0) { + return Form("%s", nameFromFile.c_str()); } - // Key "foldername" was not found in file: return default - fclose(file); - return default_name; + if (!FairRun::Instance()->IsAna()) { + return "cbmroot"; + } + return "cbmout"; } void FairRootManager::EmitMemoryBranchWrongTypeWarning(const char* brname, const char* type1, const char* type2) const @@ -1058,7 +1059,7 @@ void FairRootManager::UpdateFileName(TString& fileName) TFile* FairRootManager::GetOutFile() { - LOG(WARNING) << "FairRootManager::GetOutFile() deprecated. Use separate file to store additional data."; + LOG(warning) << "FairRootManager::GetOutFile() deprecated. Use separate file to store additional data."; auto sink = GetSink(); assert(sink->GetSinkType() == kFILESINK); auto rootFileSink = static_cast(sink); @@ -1067,7 +1068,7 @@ TFile* FairRootManager::GetOutFile() TTree* FairRootManager::GetOutTree() { - LOG(WARNING) << "FairRootManager::GetOutTree() deprecated. Use separate file to store additional data."; + LOG(warning) << "FairRootManager::GetOutTree() deprecated. Use separate file to store additional data."; auto sink = GetSink(); assert(sink->GetSinkType() == kFILESINK); auto rootFileSink = static_cast(sink); diff --git a/base/steer/FairRootManager.h b/base/steer/FairRootManager.h index 4752706601..11eede224b 100644 --- a/base/steer/FairRootManager.h +++ b/base/steer/FairRootManager.h @@ -266,9 +266,11 @@ class FairRootManager : public TObject void SetFinishRun(Bool_t val = kTRUE) { fFinishRun = val; } Bool_t FinishRun() { return fFinishRun; } - static char* GetTreeName(); + static void SetTreeName(const std::string& tname) { fTreeName = tname; } + static void SetFolderName(const std::string& tname) { fFolderName = tname; } - static char* GetFolderName(); + const static char* GetTreeName(); + const static char* GetFolderName(); /**public Members for multi-threading */ Int_t GetInstanceId() const { return fId; } @@ -352,6 +354,12 @@ class FairRootManager : public TObject */ std::map fMap; //! + /**folder name variable*/ + static std::string fFolderName; //! + /**tree name variable*/ + static std::string fTreeName; //! + static std::string GetNameFromFile(const char* namekind); + /// A map of branchnames to typeinformation + memory address; /// used for branches registered with RegisterAny; use of ptr here /// since type_info cannot be copied @@ -397,7 +405,7 @@ class FairRootManager : public TObject FairSource* fSource; - TChain* fSourceChain; + TChain* fSourceChain = nullptr; std::map fSignalChainList; //! FairEventHeader* fEventHeader; diff --git a/base/steer/FairRun.cxx b/base/steer/FairRun.cxx index d653dcef2c..6e9b56aaa7 100644 --- a/base/steer/FairRun.cxx +++ b/base/steer/FairRun.cxx @@ -164,7 +164,7 @@ Bool_t FairRun::GetWriteRunInfoFile() void FairRun::SetOutputFile(const char* fname) { - LOG(WARNING) << "FairRun::SetOutputFile() deprecated. Use FairRootFileSink."; + LOG(warning) << "FairRun::SetOutputFile() deprecated. Use FairRootFileSink."; fSink = new FairRootFileSink(fname); if (fRootManager) fRootManager->SetSink(fSink); @@ -173,7 +173,7 @@ void FairRun::SetOutputFile(const char* fname) void FairRun::SetOutputFile(TFile* f) { - LOG(WARNING) << "FairRun::SetOutputFile() deprecated. Use FairRootFileSink."; + LOG(warning) << "FairRun::SetOutputFile() deprecated. Use FairRootFileSink."; fSink = new FairRootFileSink(f); if (fRootManager) fRootManager->SetSink(fSink); @@ -183,7 +183,7 @@ void FairRun::SetOutputFile(TFile* f) void FairRun::SetOutputFileName(const TString& name) { - LOG(WARNING) << "FairRun::SetOutputFileName() deprecated. Use FairRootFileSink."; + LOG(warning) << "FairRun::SetOutputFileName() deprecated. Use FairRootFileSink."; fSink = new FairRootFileSink(name); if (fRootManager) fRootManager->SetSink(fSink); @@ -192,7 +192,7 @@ void FairRun::SetOutputFileName(const TString& name) TFile* FairRun::GetOutputFile() { - LOG(WARNING) << "FairRun::GetOutputFile() deprecated. Use separate file to store additional data."; + LOG(warning) << "FairRun::GetOutputFile() deprecated. Use separate file to store additional data."; auto sink = GetSink(); assert(sink->GetSinkType() == kFILESINK); auto rootFileSink = static_cast(sink); diff --git a/cmake/checks/CMakeLists.txt b/cmake/checks/CMakeLists.txt deleted file mode 100644 index c31ff7249d..0000000000 --- a/cmake/checks/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ - ################################################################################ - # Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # - # # - # This software is distributed under the terms of the # - # GNU Lesser General Public Licence (LGPL) version 3, # - # copied verbatim in the file "LICENSE" # - ################################################################################ - -project("c++11_test") - -cmake_minimum_required(VERSION 2.8.2) - -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}") -include(CheckCXX11Features.cmake) - -# GCC specifics -if(CMAKE_COMPILER_IS_GNUCXX) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -std=c++0x") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -ggdb") -endif() -# Visual Studio specifics -if(MSVC) - # Warning Level 4 for Debug builds - list(APPEND CMAKE_CXX_FLAGS_DEBUG " /W4") - list(REMOVE_DUPLICATES CMAKE_CXX_FLAGS_DEBUG) -endif() -# Clang -If(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -std=c++11") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -ggdb") -EndIf() - -#add_executable(testme "demo.cpp") -#foreach(flag ${CXX11_FEATURE_LIST}) -# set_property(TARGET testme -# APPEND PROPERTY COMPILE_DEFINITIONS ${flag} -# ) -#endforeach() - diff --git a/cmake/checks/cxx11-test-__func__.cpp b/cmake/checks/cxx11-test-__func__.cpp deleted file mode 100755 index 3bfd8a8935..0000000000 --- a/cmake/checks/cxx11-test-__func__.cpp +++ /dev/null @@ -1,8 +0,0 @@ -int main(void) -{ - if (!__func__) - return 1; - if (!(*__func__)) - return 1; - return 0; -} diff --git a/cmake/checks/cxx11-test-auto.cpp b/cmake/checks/cxx11-test-auto.cpp deleted file mode 100755 index 948648e993..0000000000 --- a/cmake/checks/cxx11-test-auto.cpp +++ /dev/null @@ -1,12 +0,0 @@ - -int main() -{ - auto i = 5; - auto f = 3.14159f; - auto d = 3.14159; - bool ret = ( - (sizeof(f) < sizeof(d)) && - (sizeof(i) == sizeof(int)) - ); - return ret ? 0 : 1; -} diff --git a/cmake/checks/cxx11-test-auto_fail_compile.cpp b/cmake/checks/cxx11-test-auto_fail_compile.cpp deleted file mode 100644 index 3c0e3f2e01..0000000000 --- a/cmake/checks/cxx11-test-auto_fail_compile.cpp +++ /dev/null @@ -1,7 +0,0 @@ -int main(void) -{ - // must fail because there is no initializer - auto i; - - return 0; -} diff --git a/cmake/checks/cxx11-test-auto_ret_type.cpp b/cmake/checks/cxx11-test-auto_ret_type.cpp deleted file mode 100644 index 937b683555..0000000000 --- a/cmake/checks/cxx11-test-auto_ret_type.cpp +++ /dev/null @@ -1,8 +0,0 @@ -auto foo(int i) -> int { - return i - 1; -} - -int main() -{ - return foo(1); -} diff --git a/cmake/checks/cxx11-test-class_override_final.cpp b/cmake/checks/cxx11-test-class_override_final.cpp deleted file mode 100644 index 5e938ff30e..0000000000 --- a/cmake/checks/cxx11-test-class_override_final.cpp +++ /dev/null @@ -1,21 +0,0 @@ -class base { -public: - virtual int foo(int a) - { return 4 + a; } - virtual int bar(int a) final - { return a - 2; } -}; - -class sub final : public base { -public: - virtual int foo(int a) override - { return 8 + 2 * a; }; -}; - -int main(void) -{ - base b; - sub s; - - return (b.foo(2) * 2 == s.foo(2)) ? 0 : 1; -} diff --git a/cmake/checks/cxx11-test-class_override_final_fail_compile.cpp b/cmake/checks/cxx11-test-class_override_final_fail_compile.cpp deleted file mode 100644 index bc00b278ed..0000000000 --- a/cmake/checks/cxx11-test-class_override_final_fail_compile.cpp +++ /dev/null @@ -1,25 +0,0 @@ -class base { -public: - virtual int foo(int a) - { return 4 + a; } - virtual int bar(int a) final - { return a - 2; } -}; - -class sub final : public base { -public: - virtual int foo(int a) override - { return 8 + 2 * a; }; - virtual int bar(int a) - { return a; } -}; - -class impossible : public sub { }; - -int main(void) -{ - base b; - sub s; - - return 1; -} diff --git a/cmake/checks/cxx11-test-constexpr.cpp b/cmake/checks/cxx11-test-constexpr.cpp deleted file mode 100755 index ed624512d8..0000000000 --- a/cmake/checks/cxx11-test-constexpr.cpp +++ /dev/null @@ -1,19 +0,0 @@ -constexpr int square(int x) -{ - return x*x; -} - -constexpr int the_answer() -{ - return 42; -} - -int main() -{ - int test_arr[square(3)]; - bool ret = ( - (square(the_answer()) == 1764) && - (sizeof(test_arr)/sizeof(test_arr[0]) == 9) - ); - return ret ? 0 : 1; -} diff --git a/cmake/checks/cxx11-test-constructor-delegation.cpp b/cmake/checks/cxx11-test-constructor-delegation.cpp deleted file mode 100644 index dcea2acd68..0000000000 --- a/cmake/checks/cxx11-test-constructor-delegation.cpp +++ /dev/null @@ -1,13 +0,0 @@ -class X -{ - public: - int i_; - X(int i) : i_(i) {} - X() : X(42) {} -}; - -int main(void) -{ - X val; - return (val.i_-42) ? 1 : 0; -} \ No newline at end of file diff --git a/cmake/checks/cxx11-test-cstdint.cpp b/cmake/checks/cxx11-test-cstdint.cpp deleted file mode 100755 index ca2c72ddd0..0000000000 --- a/cmake/checks/cxx11-test-cstdint.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include - -int main() -{ - bool test = - (sizeof(int8_t) == 1) && - (sizeof(int16_t) == 2) && - (sizeof(int32_t) == 4) && - (sizeof(int64_t) == 8); - return test ? 0 : 1; -} diff --git a/cmake/checks/cxx11-test-decltype.cpp b/cmake/checks/cxx11-test-decltype.cpp deleted file mode 100755 index 0dbb1cc520..0000000000 --- a/cmake/checks/cxx11-test-decltype.cpp +++ /dev/null @@ -1,10 +0,0 @@ -bool check_size(int i) -{ - return sizeof(int) == sizeof(decltype(i)); -} - -int main() -{ - bool ret = check_size(42); - return ret ? 0 : 1; -} diff --git a/cmake/checks/cxx11-test-funcptr-to-lambda-conversion.cpp b/cmake/checks/cxx11-test-funcptr-to-lambda-conversion.cpp deleted file mode 100644 index c5b27b2d4c..0000000000 --- a/cmake/checks/cxx11-test-funcptr-to-lambda-conversion.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -// test funcptr to lambda conversion in such pattern. Some old compiler may not compile the following code -// comment : direct lambda assignment to function ptr in the main() may still works for the same compilers, however. -using func_type = int(); -struct A -{ - int foo(func_type* f) - { - return f(); - } -}; - -struct B -{ - int bar(A& a) - { - return a.foo([](){return 42;}); - } -}; - -int main() -{ - A a; - B b; - return (42==b.bar(a)) ? 0 : 1; -} diff --git a/cmake/checks/cxx11-test-initializer_list.cpp b/cmake/checks/cxx11-test-initializer_list.cpp deleted file mode 100644 index 35e6c38429..0000000000 --- a/cmake/checks/cxx11-test-initializer_list.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include - -class seq { -public: - seq(std::initializer_list list); - - int length() const; -private: - std::vector m_v; -}; - -seq::seq(std::initializer_list list) - : m_v(list) -{ -} - -int seq::length() const -{ - return m_v.size(); -} - -int main(void) -{ - seq a = {18, 20, 2, 0, 4, 7}; - - return (a.length() == 6) ? 0 : 1; -} diff --git a/cmake/checks/cxx11-test-lambda.cpp b/cmake/checks/cxx11-test-lambda.cpp deleted file mode 100755 index 4c33ed58dd..0000000000 --- a/cmake/checks/cxx11-test-lambda.cpp +++ /dev/null @@ -1,5 +0,0 @@ -int main() -{ - int ret = 0; - return ([&ret]() -> int { return ret; })(); -} diff --git a/cmake/checks/cxx11-test-long_long.cpp b/cmake/checks/cxx11-test-long_long.cpp deleted file mode 100755 index 091112756a..0000000000 --- a/cmake/checks/cxx11-test-long_long.cpp +++ /dev/null @@ -1,7 +0,0 @@ -int main(void) -{ - long long l; - unsigned long long ul; - - return ((sizeof(l) >= 8) && (sizeof(ul) >= 8)) ? 0 : 1; -} diff --git a/cmake/checks/cxx11-test-nullptr.cpp b/cmake/checks/cxx11-test-nullptr.cpp deleted file mode 100755 index 9f41071531..0000000000 --- a/cmake/checks/cxx11-test-nullptr.cpp +++ /dev/null @@ -1,6 +0,0 @@ -int main(void) -{ - void *v = nullptr; - - return v ? 1 : 0; -} diff --git a/cmake/checks/cxx11-test-nullptr_fail_compile.cpp b/cmake/checks/cxx11-test-nullptr_fail_compile.cpp deleted file mode 100755 index 6a002bcb78..0000000000 --- a/cmake/checks/cxx11-test-nullptr_fail_compile.cpp +++ /dev/null @@ -1,6 +0,0 @@ -int main(void) -{ - int i = nullptr; - - return 1; -} diff --git a/cmake/checks/cxx11-test-regex.cpp b/cmake/checks/cxx11-test-regex.cpp deleted file mode 100644 index 2fe01c4fc9..0000000000 --- a/cmake/checks/cxx11-test-regex.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include -#include - -int parse_line(std::string const& line) -{ - std::string tmp; - if(std::regex_search(line, std::regex("(\\s)+(-)?(\\d)+//(-)?(\\d)+(\\s)+"))) { - tmp = std::regex_replace(line, std::regex("(-)?(\\d)+//(-)?(\\d)+"), std::string("V")); - } else if(std::regex_search(line, std::regex("(\\s)+(-)?(\\d)+/(-)?(\\d)+(\\s)+"))) { - tmp = std::regex_replace(line, std::regex("(-)?(\\d)+/(-)?(\\d)+"), std::string("V")); - } else if(std::regex_search(line, std::regex("(\\s)+(-)?(\\d)+/(-)?(\\d)+/(-)?(\\d)+(\\s)+"))) { - tmp = std::regex_replace(line, std::regex("(-)?(\\d)+/(-)?(\\d)+/(-)?(\\d)+"), std::string("V")); - } else { - tmp = std::regex_replace(line, std::regex("(-)?(\\d)+"), std::string("V")); - } - return static_cast(std::count(tmp.begin(), tmp.end(), 'V')); -} - -int main() -{ - bool test = (parse_line("f 7/7/7 -3/3/-3 2/-2/2") == 3) && - (parse_line("f 7//7 3//-3 -2//2") == 3) && - (parse_line("f 7/7 3/-3 -2/2") == 3) && - (parse_line("f 7 3 -2") == 3); - return test ? 0 : 1; -} diff --git a/cmake/checks/cxx11-test-rvalue-references.cpp b/cmake/checks/cxx11-test-rvalue-references.cpp deleted file mode 100644 index e6e7e5a98a..0000000000 --- a/cmake/checks/cxx11-test-rvalue-references.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#include - -class rvmove { -public: - void *ptr; - char *array; - - rvmove() - : ptr(0), - array(new char[10]) - { - ptr = this; - } - - rvmove(rvmove &&other) - : ptr(other.ptr), - array(other.array) - { - other.array = 0; - other.ptr = 0; - } - - ~rvmove() - { - assert(((ptr != 0) && (array != 0)) || ((ptr == 0) && (array == 0))); - delete[] array; - } - - rvmove &operator=(rvmove &&other) - { - delete[] array; - ptr = other.ptr; - array = other.array; - other.array = 0; - other.ptr = 0; - return *this; - } - - static rvmove create() - { - return rvmove(); - } -private: - rvmove(const rvmove &); - rvmove &operator=(const rvmove &); -}; - -int main() -{ - rvmove mine; - if (mine.ptr != &mine) - return 1; - mine = rvmove::create(); - if (mine.ptr == &mine) - return 1; - return 0; -} diff --git a/cmake/checks/cxx11-test-rvalue_references.cpp b/cmake/checks/cxx11-test-rvalue_references.cpp deleted file mode 100755 index 75fb5555e1..0000000000 --- a/cmake/checks/cxx11-test-rvalue_references.cpp +++ /dev/null @@ -1,15 +0,0 @@ -int foo(int& lvalue) -{ - return 123; -} - -int foo(int&& rvalue) -{ - return 321; -} - -int main() -{ - int i = 42; - return ((foo(i) == 123) && (foo(42) == 321)) ? 0 : 1; -} diff --git a/cmake/checks/cxx11-test-sharedpointer.cpp b/cmake/checks/cxx11-test-sharedpointer.cpp deleted file mode 100755 index 5ec3b40d07..0000000000 --- a/cmake/checks/cxx11-test-sharedpointer.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include -using std::shared_ptr; - -int main() -{ - - return 0; -} diff --git a/cmake/checks/cxx11-test-sizeof_member.cpp b/cmake/checks/cxx11-test-sizeof_member.cpp deleted file mode 100755 index 4902fc73ee..0000000000 --- a/cmake/checks/cxx11-test-sizeof_member.cpp +++ /dev/null @@ -1,14 +0,0 @@ -struct foo { - char bar; - int baz; -}; - -int main(void) -{ - bool ret = ( - (sizeof(foo::bar) == 1) && - (sizeof(foo::baz) >= sizeof(foo::bar)) && - (sizeof(foo) >= sizeof(foo::bar) + sizeof(foo::baz)) - ); - return ret ? 0 : 1; -} diff --git a/cmake/checks/cxx11-test-sizeof_member_fail.cpp b/cmake/checks/cxx11-test-sizeof_member_fail.cpp deleted file mode 100644 index 0348c2cea8..0000000000 --- a/cmake/checks/cxx11-test-sizeof_member_fail.cpp +++ /dev/null @@ -1,9 +0,0 @@ -struct foo { - int baz; - double bar; -}; - -int main(void) -{ - return (sizeof(foo::bar) == 4) ? 0 : 1; -} diff --git a/cmake/checks/cxx11-test-static_assert.cpp b/cmake/checks/cxx11-test-static_assert.cpp deleted file mode 100755 index 47c2fefb8b..0000000000 --- a/cmake/checks/cxx11-test-static_assert.cpp +++ /dev/null @@ -1,5 +0,0 @@ -int main(void) -{ - static_assert(0 < 1, "your ordering of integers is screwed"); - return 0; -} diff --git a/cmake/checks/cxx11-test-static_assert_fail_compile.cpp b/cmake/checks/cxx11-test-static_assert_fail_compile.cpp deleted file mode 100755 index 362fcdde9c..0000000000 --- a/cmake/checks/cxx11-test-static_assert_fail_compile.cpp +++ /dev/null @@ -1,5 +0,0 @@ -int main(void) -{ - static_assert(1 < 0, "your ordering of integers is screwed"); - return 0; -} diff --git a/cmake/checks/cxx11-test-variadic_templates.cpp b/cmake/checks/cxx11-test-variadic_templates.cpp deleted file mode 100755 index 4518e886fd..0000000000 --- a/cmake/checks/cxx11-test-variadic_templates.cpp +++ /dev/null @@ -1,23 +0,0 @@ -int Accumulate() -{ - return 0; -} - -template -int Accumulate(T v, Ts... vs) -{ - return v + Accumulate(vs...); -} - -template -int CountElements() -{ - return sizeof...(Is); -} - -int main() -{ - int acc = Accumulate(1, 2, 3, 4, -5); - int count = CountElements<1,2,3,4,5>(); - return ((acc == 5) && (count == 5)) ? 0 : 1; -} diff --git a/cmake/checks/demo.cpp b/cmake/checks/demo.cpp deleted file mode 100755 index f647d15b41..0000000000 --- a/cmake/checks/demo.cpp +++ /dev/null @@ -1,23 +0,0 @@ - -#include - -int main() -{ - std::cout << "Testing\n"; - std::cout << "Has static_assert: " << -#ifdef HAS_CXX11_STATIC_ASSERT - "yes :)" -#else - "no" -#endif - << "\n"; - std::cout << "Has variadic templates: " << -#ifdef HAS_CXX11_VARIADIC_TEMPLATES - "yes :)" -#else - "no" -#endif - << "\n"; - return 0; -} - diff --git a/cmake/modules/CheckCXX11Features.cmake b/cmake/modules/CheckCXX11Features.cmake deleted file mode 100644 index 4bd061fe6d..0000000000 --- a/cmake/modules/CheckCXX11Features.cmake +++ /dev/null @@ -1,154 +0,0 @@ - ################################################################################ - # Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # - # # - # This software is distributed under the terms of the # - # GNU Lesser General Public Licence (LGPL) version 3, # - # copied verbatim in the file "LICENSE" # - ################################################################################ -# - Check which parts of the C++11 standard the compiler supports -# -# When found it will set the following variables -# -# CXX11_COMPILER_FLAGS - the compiler flags needed to get C++11 features -# -# HAS_CXX11_AUTO - auto keyword -# HAS_CXX11_AUTO_RET_TYPE - function declaration with deduced return types -# HAS_CXX11_CLASS_OVERRIDE - override and final keywords for classes and methods -# HAS_CXX11_CONSTEXPR - constexpr keyword -# HAS_CXX11_CSTDINT_H - cstdint header -# HAS_CXX11_DECLTYPE - decltype keyword -# HAS_CXX11_FUNC - __func__ preprocessor constant -# HAS_CXX11_INITIALIZER_LIST - initializer list -# HAS_CXX11_LAMBDA - lambdas -# HAS_CXX11_LIB_REGEX - regex library -# HAS_CXX11_LONG_LONG - long long signed & unsigned types -# HAS_CXX11_NULLPTR - nullptr -# HAS_CXX11_RVALUE_REFERENCES - rvalue references -# HAS_CXX11_SIZEOF_MEMBER - sizeof() non-static members -# HAS_CXX11_STATIC_ASSERT - static_assert() -# HAS_CXX11_VARIADIC_TEMPLATES - variadic templates -# HAS_CXX11_SHAREDPOINTER - shared pointer - -#============================================================================= -# Copyright 2011,2012 Rolf Eike Beer -# Copyright 2012 Andreas Weis -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - -# -# Each feature may have up to 3 checks, every one of them in it's own file -# FEATURE.cpp - example that must build and return 0 when run -# FEATURE_fail.cpp - example that must build, but may not return 0 when run -# FEATURE_fail_compile.cpp - example that must fail compilation -# -# The first one is mandatory, the latter 2 are optional and do not depend on -# each other (i.e. only one may be present). -# - -if (NOT CMAKE_CXX_COMPILER_LOADED) - message(FATAL_ERROR "CheckCXX11Features modules only works if language CXX is enabled") -endif () - -cmake_minimum_required(VERSION 2.8.2) - -# -### Check for needed compiler flags -# -include(CheckCXXCompilerFlag) -check_cxx_compiler_flag("-std=c++11" _HAS_CXX11_FLAG) -if (NOT _HAS_CXX11_FLAG) - check_cxx_compiler_flag("-std=c++0x" _HAS_CXX0X_FLAG) -endif () - -if (_HAS_CXX11_FLAG) - set(CXX11_COMPILER_FLAGS "-std=c++11") -elseif (_HAS_CXX0X_FLAG) - set(CXX11_COMPILER_FLAGS "-std=c++0x") -endif () - -function(cxx11_check_feature FEATURE_NAME RESULT_VAR) - if (NOT DEFINED ${RESULT_VAR}) - set(_bindir "${CMAKE_CURRENT_BINARY_DIR}/cxx11/cxx11_${FEATURE_NAME}") - - set(_SRCFILE_BASE ${CheckSrcDir}/cxx11-test-${FEATURE_NAME}) - set(_LOG_NAME "\"${FEATURE_NAME}\"") - message(STATUS "Checking C++11 support for ${_LOG_NAME}") - - set(_SRCFILE "${_SRCFILE_BASE}.cpp") - set(_SRCFILE_FAIL "${_SRCFILE_BASE}_fail.cpp") - set(_SRCFILE_FAIL_COMPILE "${_SRCFILE_BASE}_fail_compile.cpp") - - if (CROSS_COMPILING) - try_compile(${RESULT_VAR} "${_bindir}" "${_SRCFILE}" - COMPILE_DEFINITIONS "${CXX11_COMPILER_FLAGS}") - if (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL}) - try_compile(${RESULT_VAR} "${_bindir}_fail" "${_SRCFILE_FAIL}" - COMPILE_DEFINITIONS "${CXX11_COMPILER_FLAGS}") - endif (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL}) - else (CROSS_COMPILING) - try_run(_RUN_RESULT_VAR _COMPILE_RESULT_VAR - "${_bindir}" "${_SRCFILE}" - COMPILE_DEFINITIONS "${CXX11_COMPILER_FLAGS}") - if (_COMPILE_RESULT_VAR AND NOT _RUN_RESULT_VAR) - set(${RESULT_VAR} TRUE) - else (_COMPILE_RESULT_VAR AND NOT _RUN_RESULT_VAR) - set(${RESULT_VAR} FALSE) - endif (_COMPILE_RESULT_VAR AND NOT _RUN_RESULT_VAR) - if (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL}) - try_run(_RUN_RESULT_VAR _COMPILE_RESULT_VAR - "${_bindir}_fail" "${_SRCFILE_FAIL}" - COMPILE_DEFINITIONS "${CXX11_COMPILER_FLAGS}") - if (_COMPILE_RESULT_VAR AND _RUN_RESULT_VAR) - set(${RESULT_VAR} TRUE) - else (_COMPILE_RESULT_VAR AND _RUN_RESULT_VAR) - set(${RESULT_VAR} FALSE) - endif (_COMPILE_RESULT_VAR AND _RUN_RESULT_VAR) - endif (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL}) - endif (CROSS_COMPILING) - if (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL_COMPILE}) - try_compile(_TMP_RESULT "${_bindir}_fail_compile" "${_SRCFILE_FAIL_COMPILE}" - COMPILE_DEFINITIONS "${CXX11_COMPILER_FLAGS}") - if (_TMP_RESULT) - set(${RESULT_VAR} FALSE) - else (_TMP_RESULT) - set(${RESULT_VAR} TRUE) - endif (_TMP_RESULT) - endif (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL_COMPILE}) - - if (${RESULT_VAR}) - message(STATUS "Checking C++11 support for ${_LOG_NAME}: works") - else (${RESULT_VAR}) - message(STATUS "Checking C++11 support for ${_LOG_NAME}: not supported") - endif (${RESULT_VAR}) - set(${RESULT_VAR} ${${RESULT_VAR}} CACHE INTERNAL "C++11 support for ${_LOG_NAME}") - endif (NOT DEFINED ${RESULT_VAR}) -endfunction(cxx11_check_feature) - -cxx11_check_feature("__func__" HAS_CXX11_FUNC) -cxx11_check_feature("auto" HAS_CXX11_AUTO) -cxx11_check_feature("auto_ret_type" HAS_CXX11_AUTO_RET_TYPE) -cxx11_check_feature("class_override_final" HAS_CXX11_CLASS_OVERRIDE) -cxx11_check_feature("constexpr" HAS_CXX11_CONSTEXPR) -cxx11_check_feature("constructor-delegation" HAS_CXX11_CONSTRUCTOR_DELEGATION) -cxx11_check_feature("cstdint" HAS_CXX11_CSTDINT_H) -cxx11_check_feature("decltype" HAS_CXX11_DECLTYPE) -cxx11_check_feature("initializer_list" HAS_CXX11_INITIALIZER_LIST) -cxx11_check_feature("lambda" HAS_CXX11_LAMBDA) -cxx11_check_feature("long_long" HAS_CXX11_LONG_LONG) -cxx11_check_feature("nullptr" HAS_CXX11_NULLPTR) -cxx11_check_feature("regex" HAS_CXX11_LIB_REGEX) -cxx11_check_feature("rvalue-references" HAS_CXX11_RVALUE_REFERENCES) -cxx11_check_feature("sizeof_member" HAS_CXX11_SIZEOF_MEMBER) -cxx11_check_feature("static_assert" HAS_CXX11_STATIC_ASSERT) -cxx11_check_feature("variadic_templates" HAS_CXX11_VARIADIC_TEMPLATES) -cxx11_check_feature("sharedpointer" HAS_CXX11_SHAREDPOINTER) -cxx11_check_feature("funcptr-to-lambda-conversion" HAS_CXX11_PATTERN1) - diff --git a/cmake/modules/FindROOT.cmake b/cmake/modules/FindROOT.cmake index bcba8db2a6..8cc353d43d 100644 --- a/cmake/modules/FindROOT.cmake +++ b/cmake/modules/FindROOT.cmake @@ -133,8 +133,14 @@ If(ROOT_FOUND) if("${ROOT_VERSION_MAJOR}.${ROOT_VERSION_MINOR}" VERSION_GREATER 6.16) Execute_Process(COMMAND ${ROOT_CONFIG_EXECUTABLE} --has-vmc OUTPUT_VARIABLE ROOT_vmc_FOUND + RESULT_VARIABLE __root_config_has_vmc_rc ) - String(STRIP ${ROOT_vmc_FOUND} ROOT_vmc_FOUND) + if(NOT __root_config_has_vmc_rc EQUAL 0) + set(ROOT_vmc_FOUND no) + else() + string(STRIP ${ROOT_vmc_FOUND} ROOT_vmc_FOUND) + endif() + unset(__root_config_has_vmc_rc) else() set(ROOT_vmc_FOUND yes) endif() @@ -174,8 +180,12 @@ If(ROOT_FOUND) Include(ROOTMacros) - # Aliases for imported VMC packages ROOT dependencies - foreach(_root_dep VMC Core RIO Tree Rint Physics MathCore Thread Geom EG EGPythia6) + # Setup targets for ROOT libraries (needed by VMC) + set(__root_targets_list Core RIO Tree Rint Physics MathCore Thread Geom EG EGPythia6) + if(ROOT_vmc_FOUND) + list(APPEND __root_targets_list VMC) + endif() + foreach(_root_dep ${__root_targets_list}) find_library(${_root_dep}_LIB ${_root_dep} PATHS ${ROOT_LIBRARY_DIR}) if(${_root_dep}_LIB) add_library(${_root_dep} SHARED IMPORTED GLOBAL) @@ -184,6 +194,7 @@ If(ROOT_FOUND) message(STATUS "ROOT::${_root_dep} target added by hand.") endif() endforeach(_root_dep) + unset(__root_targets_list) Else(ROOT_FOUND) diff --git a/examples/MQ/Lmd/CMakeLists.txt b/examples/MQ/Lmd/CMakeLists.txt index 20f49ef6f6..5912ddfd9a 100644 --- a/examples/MQ/Lmd/CMakeLists.txt +++ b/examples/MQ/Lmd/CMakeLists.txt @@ -1,5 +1,5 @@ ################################################################################ -# Copyright (C) 2014-2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # +# Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # # # # This software is distributed under the terms of the # # GNU Lesser General Public Licence (LGPL) version 3, # @@ -37,7 +37,7 @@ target_link_libraries(${target} PUBLIC FairRoot::BaseMQ # Serialization policies FairRoot::FairTools # FairLogger FairRoot::ExMbs - FairMQ::FairMQ + FairRoot::FairMQ Core ) @@ -51,13 +51,13 @@ install(TARGETS ${target} LIBRARY DESTINATION ${PROJECT_INSTALL_LIBDIR}) install(FILES ${headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) add_executable(ex-lmd-sampler runLmdSampler.cxx) -target_link_libraries(ex-lmd-sampler PRIVATE FairRoot::ExLmd FairRoot::BaseMQ FairMQ::FairMQ) +target_link_libraries(ex-lmd-sampler PRIVATE FairRoot::ExLmd FairRoot::BaseMQ FairRoot::FairMQ) add_executable(ex-lmd-mbs-unpacker runMBSMQUnpacker.cxx) -target_link_libraries(ex-lmd-mbs-unpacker PRIVATE FairRoot::ExLmd FairRoot::BaseMQ FairMQ::FairMQ) +target_link_libraries(ex-lmd-mbs-unpacker PRIVATE FairRoot::ExLmd FairRoot::BaseMQ FairRoot::FairMQ) add_executable(ex-lmd-mbs-sink runMBSSink.cxx) -target_link_libraries(ex-lmd-mbs-sink PRIVATE FairRoot::ExLmd FairRoot::BaseMQ Core FairRoot::ExMbs FairMQ::FairMQ) +target_link_libraries(ex-lmd-mbs-sink PRIVATE FairRoot::ExLmd FairRoot::BaseMQ Core FairRoot::ExMbs FairRoot::FairMQ) install(TARGETS ex-lmd-sampler ex-lmd-mbs-unpacker ex-lmd-mbs-sink RUNTIME DESTINATION ${PROJECT_INSTALL_DATADIR}/examples/MQ/Lmd/bin diff --git a/examples/MQ/Lmd/FairMBSUnpacker.cxx b/examples/MQ/Lmd/FairMBSUnpacker.cxx index 1d0e54e500..88d973463b 100644 --- a/examples/MQ/Lmd/FairMBSUnpacker.cxx +++ b/examples/MQ/Lmd/FairMBSUnpacker.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -10,7 +10,7 @@ #include // Fair headers -#include +#include // Land headers #include "FairMBSRawItem.h" diff --git a/examples/MQ/Lmd/runLmdSampler.cxx b/examples/MQ/Lmd/runLmdSampler.cxx index c658901f61..2c86446bbd 100644 --- a/examples/MQ/Lmd/runLmdSampler.cxx +++ b/examples/MQ/Lmd/runLmdSampler.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -13,7 +13,7 @@ */ #include "FairMQLmdSampler.h" -#include "runFairMQDevice.h" +#include "FairRunFairMQDevice.h" namespace bpo = boost::program_options; @@ -31,4 +31,7 @@ void addCustomOptions(bpo::options_description& options) // clang-format on } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new FairMQLmdSampler(); } +std::unique_ptr fairGetDevice(const fair::mq::ProgOptions& /*config*/) +{ + return std::unique_ptr(new FairMQLmdSampler()); +} diff --git a/examples/MQ/Lmd/runMBSMQUnpacker.cxx b/examples/MQ/Lmd/runMBSMQUnpacker.cxx index 3571c81a00..c0c3d12ac6 100644 --- a/examples/MQ/Lmd/runMBSMQUnpacker.cxx +++ b/examples/MQ/Lmd/runMBSMQUnpacker.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -14,7 +14,7 @@ #include "FairMBSUnpacker.h" #include "FairMQUnpacker.h" -#include "runFairMQDevice.h" +#include "FairRunFairMQDevice.h" namespace bpo = boost::program_options; @@ -32,4 +32,7 @@ void addCustomOptions(bpo::options_description& options) // clang-format on } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new FairMQUnpacker(); } +std::unique_ptr fairGetDevice(const fair::mq::ProgOptions& /*config*/) +{ + return std::unique_ptr>(new FairMQUnpacker()); +} diff --git a/examples/MQ/Lmd/runMBSSink.cxx b/examples/MQ/Lmd/runMBSSink.cxx index 2918b19f77..8ac1d9221b 100644 --- a/examples/MQ/Lmd/runMBSSink.cxx +++ b/examples/MQ/Lmd/runMBSSink.cxx @@ -1,16 +1,17 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * * copied verbatim in the file "LICENSE" * ********************************************************************************/ + #include "BaseMQFileSink.h" -#include "FairMBSRawItem.h" // data type for the OutputPolicy +#include "FairMBSRawItem.h" // data type for the OutputPolicy +#include "FairRunFairMQDevice.h" #include "IOPolicy.h" // fair::mq::policy:: #include "RootOutFileManager.h" // OutputPolicy #include "RootSerializer.h" // RootSerializer -#include "runFairMQDevice.h" #include // data type for the InputPolicy @@ -40,10 +41,10 @@ void addCustomOptions(bpo::options_description& options) // clang-format on } -FairMQDevicePtr getDevice(const FairMQProgOptions& config) +std::unique_ptr fairGetDevice(const fair::mq::ProgOptions& config) { - BaseMQFileSink>* sink = - new BaseMQFileSink>(); + using Sink = BaseMQFileSink>; + auto sink = std::unique_ptr(new Sink()); // call function member from deserialization policy sink->InitInputData(config.GetValue("hit-classname").c_str()); diff --git a/examples/MQ/histogramServer/CMakeLists.txt b/examples/MQ/histogramServer/CMakeLists.txt index 193347ce6d..e5c5f49e88 100644 --- a/examples/MQ/histogramServer/CMakeLists.txt +++ b/examples/MQ/histogramServer/CMakeLists.txt @@ -1,5 +1,5 @@ ################################################################################ -# Copyright (C) 2014-2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # +# Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # # # # This software is distributed under the terms of the # # GNU Lesser General Public Licence (LGPL) version 3, # @@ -38,7 +38,7 @@ target_link_libraries(${target} PUBLIC FairRoot::BaseMQ # Serialization policies FairRoot::FairTools # FairLogger FairRoot::ParBase - FairMQ::FairMQ + FairRoot::FairMQ Core Gpad @@ -56,10 +56,10 @@ install(TARGETS ${target} LIBRARY DESTINATION ${PROJECT_INSTALL_LIBDIR}) install(FILES ${headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) add_executable(ex-histo-device runExHistoDevice.cxx) -target_link_libraries(ex-histo-device PRIVATE FairRoot::ExHistogramServer FairMQ::FairMQ) +target_link_libraries(ex-histo-device PRIVATE FairRoot::ExHistogramServer FairRoot::FairMQ) add_executable(ex-histo-server runExHistoCanvasDrawer.cxx) -target_link_libraries(ex-histo-server PRIVATE FairRoot::ExHistogramServer FairMQ::FairMQ) +target_link_libraries(ex-histo-server PRIVATE FairRoot::ExHistogramServer FairRoot::FairMQ) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/fairmq-start-ex-histo.sh.in ${CMAKE_CURRENT_BINARY_DIR}/fairmq-start-ex-histo.sh) diff --git a/examples/MQ/histogramServer/FairMQExHistoDevice.cxx b/examples/MQ/histogramServer/FairMQExHistoDevice.cxx index 2b7f228b18..da2f51f725 100644 --- a/examples/MQ/histogramServer/FairMQExHistoDevice.cxx +++ b/examples/MQ/histogramServer/FairMQExHistoDevice.cxx @@ -1,10 +1,11 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * * copied verbatim in the file "LICENSE" * ********************************************************************************/ + #include "FairMQExHistoDevice.h" #include "RootSerializer.h" @@ -51,7 +52,7 @@ bool FairMQExHistoDevice::ConditionalRun() y = r * TMath::Sin(phi); fh_histo4.Fill(x, y); - FairMQMessagePtr message(NewMessage()); + auto message(NewMessage()); RootSerializer().Serialize(*message, &fArrayHisto); for (auto& channel : fChannels) { diff --git a/examples/MQ/histogramServer/FairMQExHistoDevice.h b/examples/MQ/histogramServer/FairMQExHistoDevice.h index 9840b9a4ae..c09b983f62 100644 --- a/examples/MQ/histogramServer/FairMQExHistoDevice.h +++ b/examples/MQ/histogramServer/FairMQExHistoDevice.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -8,13 +8,14 @@ #ifndef FAIRMQEXHISTODEVICE #define FAIRMQEXHISTODEVICE -#include +#include "FairMQ.h" // for fair::mq::Device + #include // for TH1F #include // for TH2F #include #include -class FairMQExHistoDevice : public FairMQDevice +class FairMQExHistoDevice : public fair::mq::Device { public: FairMQExHistoDevice(); diff --git a/examples/MQ/histogramServer/FairMQExHistoServer.cxx b/examples/MQ/histogramServer/FairMQExHistoServer.cxx index 96eef6f3fc..6ea1a6cadf 100644 --- a/examples/MQ/histogramServer/FairMQExHistoServer.cxx +++ b/examples/MQ/histogramServer/FairMQExHistoServer.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -40,7 +40,7 @@ void FairMQExHistoServer::InitTask() } } -bool FairMQExHistoServer::ReceiveData(FairMQMessagePtr& msg, int index) +bool FairMQExHistoServer::ReceiveData(fair::mq::MessagePtr& msg, int index) { TObject* tempObject = nullptr; RootSerializer().Deserialize(*msg, tempObject); diff --git a/examples/MQ/histogramServer/FairMQExHistoServer.h b/examples/MQ/histogramServer/FairMQExHistoServer.h index 7389e20c65..1485ad0b0e 100644 --- a/examples/MQ/histogramServer/FairMQExHistoServer.h +++ b/examples/MQ/histogramServer/FairMQExHistoServer.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -8,9 +8,9 @@ #ifndef FAIRMQEXHISTOSERVER #define FAIRMQEXHISTOSERVER +#include "FairMQ.h" // for fair::mq::Device, fair::mq::MessagePtr #include "FairMQExHistoCanvasDrawer.h" // for FairMQExHistoCanvasDrawer -#include #include #include #include @@ -18,7 +18,7 @@ #include #include -class FairMQExHistoServer : public FairMQDevice +class FairMQExHistoServer : public fair::mq::Device { public: FairMQExHistoServer(); @@ -35,7 +35,7 @@ class FairMQExHistoServer : public FairMQDevice protected: virtual void InitTask(); - bool ReceiveData(FairMQMessagePtr& msg, int index); + bool ReceiveData(fair::mq::MessagePtr& msg, int index); virtual void PreRun(); diff --git a/examples/MQ/histogramServer/runExHistoCanvasDrawer.cxx b/examples/MQ/histogramServer/runExHistoCanvasDrawer.cxx index a680adfa35..8af69e64ca 100644 --- a/examples/MQ/histogramServer/runExHistoCanvasDrawer.cxx +++ b/examples/MQ/histogramServer/runExHistoCanvasDrawer.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * diff --git a/examples/MQ/histogramServer/runExHistoDevice.cxx b/examples/MQ/histogramServer/runExHistoDevice.cxx index 2de490fc2b..129243f336 100644 --- a/examples/MQ/histogramServer/runExHistoDevice.cxx +++ b/examples/MQ/histogramServer/runExHistoDevice.cxx @@ -1,20 +1,19 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * * copied verbatim in the file "LICENSE" * ********************************************************************************/ + #include "FairMQExHistoDevice.h" -#include "runFairMQDevice.h" +#include "FairRunFairMQDevice.h" namespace bpo = boost::program_options; void addCustomOptions(bpo::options_description& /*options*/) {} -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) +std::unique_ptr fairGetDevice(const fair::mq::ProgOptions& /*config*/) { - FairMQExHistoDevice* histoDevice = new FairMQExHistoDevice(); - - return histoDevice; + return std::unique_ptr(new FairMQExHistoDevice()); } diff --git a/examples/MQ/histogramServer/runExHistoServer.h b/examples/MQ/histogramServer/runExHistoServer.h index cb8a9b0fcc..4d9a496528 100644 --- a/examples/MQ/histogramServer/runExHistoServer.h +++ b/examples/MQ/histogramServer/runExHistoServer.h @@ -1,12 +1,13 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * * copied verbatim in the file "LICENSE" * ********************************************************************************/ + #include "FairMQExHistoServer.h" -#include "runFairMQDevice.h" +#include "FairRunFairMQDevice.h" #include @@ -16,9 +17,9 @@ void addCustomOptions(bpo::options_description& /*options*/) {} std::unique_ptr getCanvasDrawer(); -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) +std::unique_ptr fairGetDevice(const fair::mq::ProgOptions& /*config*/) { - FairMQExHistoServer* histoServer = new FairMQExHistoServer(); + auto histoServer = std::unique_ptr(new FairMQExHistoServer()); histoServer->SetCanvasDrawer(getCanvasDrawer()); diff --git a/examples/MQ/parameters/CMakeLists.txt b/examples/MQ/parameters/CMakeLists.txt index 68b661e8cf..fd411bb3c7 100644 --- a/examples/MQ/parameters/CMakeLists.txt +++ b/examples/MQ/parameters/CMakeLists.txt @@ -1,5 +1,5 @@ ################################################################################ -# Copyright (C) 2014-2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # +# Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # # # # This software is distributed under the terms of the # # GNU Lesser General Public Licence (LGPL) version 3, # @@ -41,7 +41,7 @@ target_link_libraries(${target} PUBLIC FairRoot::BaseMQ # Serialization policies FairRoot::FairTools # FairLogger FairRoot::ParBase - FairMQ::FairMQ + FairRoot::FairMQ Core ) @@ -55,7 +55,7 @@ install(TARGETS ${target} LIBRARY DESTINATION ${PROJECT_INSTALL_LIBDIR}) install(FILES ${headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) add_executable(ex-params-client runExParamsClient.cxx) -target_link_libraries(ex-params-client PRIVATE FairRoot::ExParameters FairMQ::FairMQ) +target_link_libraries(ex-params-client PRIVATE FairRoot::ExParameters FairRoot::FairMQ) install(TARGETS ex-params-client RUNTIME DESTINATION ${PROJECT_INSTALL_DATADIR}/examples/MQ/parameters/bin diff --git a/examples/MQ/parameters/FairMQExParamsClient.cxx b/examples/MQ/parameters/FairMQExParamsClient.cxx index 4516f372ca..7ac04e5e70 100644 --- a/examples/MQ/parameters/FairMQExParamsClient.cxx +++ b/examples/MQ/parameters/FairMQExParamsClient.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -17,8 +17,8 @@ #include "FairMQExParamsParOne.h" #include "RootSerializer.h" -#include #include +#include #include // this_thread::sleep_for using namespace std; @@ -45,8 +45,8 @@ bool FairMQExParamsClient::ConditionalRun() // NewSimpleMessage creates a copy of the data and takes care of its destruction (after the transfer takes place). // Should only be used for small data because of the cost of an additional copy - FairMQMessagePtr req(NewSimpleMessage(fParameterName + "," + to_string(fRunId))); - FairMQMessagePtr rep(NewMessage()); + auto req(NewSimpleMessage(fParameterName + "," + to_string(fRunId))); + auto rep(NewMessage()); if (Send(req, "data") > 0) { if (Receive(rep, "data") >= 0) { diff --git a/examples/MQ/parameters/FairMQExParamsClient.h b/examples/MQ/parameters/FairMQExParamsClient.h index 1f755c7017..7b3ca0b2db 100644 --- a/examples/MQ/parameters/FairMQExParamsClient.h +++ b/examples/MQ/parameters/FairMQExParamsClient.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -15,11 +15,12 @@ #ifndef FAIRMQEXPARAMSCLIENT_H #define FAIRMQEXPARAMSCLIENT_H -#include +#include "FairMQ.h" // for fair::mq::Device + #include // uint64_t #include -class FairMQExParamsClient : public FairMQDevice +class FairMQExParamsClient : public fair::mq::Device { public: FairMQExParamsClient(); diff --git a/examples/MQ/parameters/runExParamsClient.cxx b/examples/MQ/parameters/runExParamsClient.cxx index f798bde191..f759d77f49 100644 --- a/examples/MQ/parameters/runExParamsClient.cxx +++ b/examples/MQ/parameters/runExParamsClient.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -7,7 +7,7 @@ ********************************************************************************/ #include "FairMQExParamsClient.h" -#include "runFairMQDevice.h" +#include "FairRunFairMQDevice.h" namespace bpo = boost::program_options; @@ -20,4 +20,7 @@ void addCustomOptions(bpo::options_description& options) // clang-format on } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new FairMQExParamsClient(); } +std::unique_ptr fairGetDevice(const fair::mq::ProgOptions& /*config*/) +{ + return std::unique_ptr(new FairMQExParamsClient()); +} diff --git a/examples/MQ/pixelAlternative/run/CMakeLists.txt b/examples/MQ/pixelAlternative/run/CMakeLists.txt index 3f98bfee4b..1a6a39a34b 100644 --- a/examples/MQ/pixelAlternative/run/CMakeLists.txt +++ b/examples/MQ/pixelAlternative/run/CMakeLists.txt @@ -24,7 +24,7 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/startFairMQPixAlt.sh_install DESTINATI set(exe_dependencies FairRoot::ExPixelAlt - FairMQ::FairMQ + FairRoot::FairMQ Boost::program_options ) diff --git a/examples/MQ/pixelAlternative/run/runPixAltFileSinkBin.cxx b/examples/MQ/pixelAlternative/run/runPixAltFileSinkBin.cxx index 7a21303ae9..042be18bc3 100644 --- a/examples/MQ/pixelAlternative/run/runPixAltFileSinkBin.cxx +++ b/examples/MQ/pixelAlternative/run/runPixAltFileSinkBin.cxx @@ -1,15 +1,14 @@ /******************************************************************************** - * Copyright (C) 2014-2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * * copied verbatim in the file "LICENSE" * ********************************************************************************/ -#include "runFairMQDevice.h" - // PixelAlternative example #include "FairMQPixAltFileSinkBin.h" +#include "FairRunFairMQDevice.h" namespace bpo = boost::program_options; @@ -23,4 +22,7 @@ void addCustomOptions(bpo::options_description& options) // clang-format on } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new FairMQPixAltFileSinkBin(); } +std::unique_ptr fairGetDevice(const fair::mq::ProgOptions& /*config*/) +{ + return std::unique_ptr(new FairMQPixAltFileSinkBin()); +} diff --git a/examples/MQ/pixelAlternative/run/runPixAltSamplerBin.cxx b/examples/MQ/pixelAlternative/run/runPixAltSamplerBin.cxx index 7f418a511e..d6bda42478 100644 --- a/examples/MQ/pixelAlternative/run/runPixAltSamplerBin.cxx +++ b/examples/MQ/pixelAlternative/run/runPixAltSamplerBin.cxx @@ -1,15 +1,14 @@ /******************************************************************************** - * Copyright (C) 2014-2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * * copied verbatim in the file "LICENSE" * ********************************************************************************/ -#include "runFairMQDevice.h" - // PixelAlternative example #include "FairMQPixAltSamplerBin.h" +#include "FairRunFairMQDevice.h" namespace bpo = boost::program_options; @@ -25,4 +24,7 @@ void addCustomOptions(bpo::options_description& options) // clang-format on } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new FairMQPixAltSamplerBin; } +std::unique_ptr fairGetDevice(const fair::mq::ProgOptions& /*config*/) +{ + return std::unique_ptr(new FairMQPixAltSamplerBin()); +} diff --git a/examples/MQ/pixelAlternative/run/runPixAltTaskProcessorBin.cxx b/examples/MQ/pixelAlternative/run/runPixAltTaskProcessorBin.cxx index affc929ef7..543f978877 100644 --- a/examples/MQ/pixelAlternative/run/runPixAltTaskProcessorBin.cxx +++ b/examples/MQ/pixelAlternative/run/runPixAltTaskProcessorBin.cxx @@ -1,16 +1,18 @@ /******************************************************************************** - * Copyright (C) 2014-2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * * copied verbatim in the file "LICENSE" * ********************************************************************************/ -#include "PixelAltFindHits.h" -#include "runFairMQDevice.h" - // PixelAlternative example #include "FairMQPixAltTaskProcessorBin.h" +#include "FairRunFairMQDevice.h" +#include "PixelAltFindHits.h" + +#include +#include namespace bpo = boost::program_options; @@ -26,16 +28,17 @@ void addCustomOptions(bpo::options_description& options) // clang-format on } -FairMQDevicePtr getDevice(const FairMQProgOptions& config) +std::unique_ptr fairGetDevice(const fair::mq::ProgOptions& config) { std::string taskname = config.GetValue("task-name"); std::cout << "get device with setting!" << std::endl; if (taskname == "PixelAltFindHits") { - return new FairMQPixAltTaskProcessorBin(); + using Processor = FairMQPixAltTaskProcessorBin; + return std::unique_ptr(new Processor()); } LOG(info) << "TASK \"" << taskname << "\" UNKNOWN!!!"; - return 0; + return {nullptr}; } diff --git a/examples/MQ/pixelAlternative/src/CMakeLists.txt b/examples/MQ/pixelAlternative/src/CMakeLists.txt index a20adf2245..199e0598aa 100644 --- a/examples/MQ/pixelAlternative/src/CMakeLists.txt +++ b/examples/MQ/pixelAlternative/src/CMakeLists.txt @@ -49,7 +49,7 @@ target_link_libraries(${target} PUBLIC FairRoot::ParBase FairRoot::BaseMQ # Serialization policies FairRoot::ExPixel - FairMQ::FairMQ + FairRoot::FairMQ Tree RIO # TFile diff --git a/examples/MQ/pixelAlternative/src/devices/FairMQPixAltFileSinkBin.cxx b/examples/MQ/pixelAlternative/src/devices/FairMQPixAltFileSinkBin.cxx index be4c283b4b..4bfc844f0b 100644 --- a/examples/MQ/pixelAlternative/src/devices/FairMQPixAltFileSinkBin.cxx +++ b/examples/MQ/pixelAlternative/src/devices/FairMQPixAltFileSinkBin.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -16,7 +16,7 @@ #include "PixelPayload.h" -#include +#include using namespace std; @@ -40,7 +40,7 @@ void FairMQPixAltFileSinkBin::Init() OnData(fInputChannelName, &FairMQPixAltFileSinkBin::StoreData); } -bool FairMQPixAltFileSinkBin::StoreData(FairMQParts& parts, int /*index*/) +bool FairMQPixAltFileSinkBin::StoreData(fair::mq::Parts& parts, int /*index*/) { if (parts.Size() == 0) return true; // probably impossible, but still check @@ -85,7 +85,7 @@ bool FairMQPixAltFileSinkBin::StoreData(FairMQParts& parts, int /*index*/) } if (fAckChannelName != "") { - unique_ptr msg(NewMessage()); + auto msg(NewMessage()); Send(msg, fAckChannelName); } return true; diff --git a/examples/MQ/pixelAlternative/src/devices/FairMQPixAltFileSinkBin.h b/examples/MQ/pixelAlternative/src/devices/FairMQPixAltFileSinkBin.h index 502bd6e1ba..f5aa00ffc5 100644 --- a/examples/MQ/pixelAlternative/src/devices/FairMQPixAltFileSinkBin.h +++ b/examples/MQ/pixelAlternative/src/devices/FairMQPixAltFileSinkBin.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -15,11 +15,12 @@ #ifndef FAIRMQPIXALTFILESINKBIN_H_ #define FAIRMQPIXALTFILESINKBIN_H_ -#include +#include "FairMQ.h" // for fair::mq::Device, fair::mq::Parts + #include #include -class FairMQPixAltFileSinkBin : public FairMQDevice +class FairMQPixAltFileSinkBin : public fair::mq::Device { public: FairMQPixAltFileSinkBin(); @@ -32,7 +33,7 @@ class FairMQPixAltFileSinkBin : public FairMQDevice void SetAckChannelName(const std::string& tstr) { fAckChannelName = tstr; } protected: - bool StoreData(FairMQParts&, int); + bool StoreData(fair::mq::Parts&, int); virtual void Init(); private: diff --git a/examples/MQ/pixelAlternative/src/devices/FairMQPixAltSamplerBin.cxx b/examples/MQ/pixelAlternative/src/devices/FairMQPixAltSamplerBin.cxx index 0a1a0f4732..d6d6446724 100644 --- a/examples/MQ/pixelAlternative/src/devices/FairMQPixAltSamplerBin.cxx +++ b/examples/MQ/pixelAlternative/src/devices/FairMQPixAltSamplerBin.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -14,11 +14,10 @@ #include "FairMQPixAltSamplerBin.h" -#include -#include #include #include #include +#include #include using namespace std; @@ -95,7 +94,7 @@ bool FairMQPixAltSamplerBin::ConditionalRun() bool FairMQPixAltSamplerBin::ReadBinFile() { - FairMQParts parts; + fair::mq::Parts parts; for (int iaggr = 0; iaggr < fAggregateLevel; iaggr++) { @@ -152,15 +151,14 @@ bool FairMQPixAltSamplerBin::ReadBinFile() header->fRunId = head[0]; header->fMCEntryNo = head[1]; header->fPartNo = head[2]; - FairMQMessagePtr msgHeader( - NewMessage(header, sizeof(PixelPayload::EventHeader), [](void* data, void* /*hint*/) { - delete static_cast(data); - })); + auto msgHeader(NewMessage(header, sizeof(PixelPayload::EventHeader), [](void* data, void* /*hint*/) { + delete static_cast(data); + })); parts.AddPart(std::move(msgHeader)); size_t digisSize = head[3] * sizeof(PixelPayload::Digi); - FairMQMessagePtr msgDigis(NewMessage(digisSize)); + auto msgDigis(NewMessage(digisSize)); PixelPayload::Digi* digiPayload = static_cast(msgDigis->GetData()); @@ -197,20 +195,20 @@ bool FairMQPixAltSamplerBin::ReadRootFile() fDigiBranch->GetEntry(fEventCounter); // create output multipart message - FairMQParts parts; + fair::mq::Parts parts; PixelPayload::EventHeader* header = new PixelPayload::EventHeader(); header->fRunId = fEventHeader->fRunId; header->fMCEntryNo = fEventHeader->fMCEntryNo; header->fPartNo = fEventHeader->fPartNo; - FairMQMessagePtr msgHeader(NewMessage(header, sizeof(PixelPayload::EventHeader), [](void* data, void* /*hint*/) { + auto msgHeader(NewMessage(header, sizeof(PixelPayload::EventHeader), [](void* data, void* /*hint*/) { delete static_cast(data); })); parts.AddPart(std::move(msgHeader)); size_t digisSize = sizeof(PixelPayload::Digi) * fDigiArray->size(); - FairMQMessagePtr msgDigis(NewMessage(digisSize)); + auto msgDigis(NewMessage(digisSize)); PixelPayload::Digi* digiPayload = static_cast(msgDigis->GetData()); for (int idigi = 0; idigi < (int)fDigiArray->size(); idigi++) { @@ -247,7 +245,7 @@ void FairMQPixAltSamplerBin::ListenForAcks() { if (fAckChannelName != "") { do { - FairMQMessagePtr ack(NewMessage()); + auto ack(NewMessage()); if (Receive(ack, fAckChannelName) >= 0) { fNofRecAcks++; } diff --git a/examples/MQ/pixelAlternative/src/devices/FairMQPixAltSamplerBin.h b/examples/MQ/pixelAlternative/src/devices/FairMQPixAltSamplerBin.h index f799004ab5..228c8e9352 100644 --- a/examples/MQ/pixelAlternative/src/devices/FairMQPixAltSamplerBin.h +++ b/examples/MQ/pixelAlternative/src/devices/FairMQPixAltSamplerBin.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -15,9 +15,9 @@ #ifndef FAIRMQPIXALTSAMPLERBIN_H_ #define FAIRMQPIXALTSAMPLERBIN_H_ +#include "FairMQ.h" // for fair::mq::Device, fair::mq::Parts #include "PixelPayload.h" -#include #include #include #include @@ -27,7 +27,7 @@ class TBranch; class TChain; -class FairMQPixAltSamplerBin : public FairMQDevice +class FairMQPixAltSamplerBin : public fair::mq::Device { public: FairMQPixAltSamplerBin(); diff --git a/examples/MQ/pixelAlternative/src/devices/FairMQPixAltTaskProcessorBin.h b/examples/MQ/pixelAlternative/src/devices/FairMQPixAltTaskProcessorBin.h index 44e540051a..f986abfd51 100644 --- a/examples/MQ/pixelAlternative/src/devices/FairMQPixAltTaskProcessorBin.h +++ b/examples/MQ/pixelAlternative/src/devices/FairMQPixAltTaskProcessorBin.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -11,19 +11,18 @@ #include "FairEventHeader.h" #include "FairGeoParSet.h" +#include "FairMQ.h" // for fair::mq::Device, fair::mq::Parts #include "FairParGenericSet.h" #include "PixelDigi.h" #include "PixelPayload.h" #include "RootSerializer.h" -#include -#include #include #include #include template -class FairMQPixAltTaskProcessorBin : public FairMQDevice +class FairMQPixAltTaskProcessorBin : public fair::mq::Device { public: FairMQPixAltTaskProcessorBin() @@ -56,7 +55,7 @@ class FairMQPixAltTaskProcessorBin : public FairMQDevice void SetParamChannelName(const std::string& tstr) { fParamChannelName = tstr; } protected: - bool ProcessData(FairMQParts& parts, int) + bool ProcessData(fair::mq::Parts& parts, int) { // LOG(debug)<<"message received with " << parts.Size() << " parts!"; fReceivedMsgs++; @@ -71,7 +70,7 @@ class FairMQPixAltTaskProcessorBin : public FairMQDevice LOG(info) << "received " << parts.Size() << " parts, will ignore last part!!!"; // creating output multipart message - FairMQParts partsOut; + fair::mq::Parts partsOut; for (int ievent = 0; ievent < parts.Size() / nPPE; ievent++) { // the first part should be the event header @@ -101,16 +100,15 @@ class FairMQPixAltTaskProcessorBin : public FairMQDevice header->fRunId = payloadE->fRunId; header->fMCEntryNo = payloadE->fMCEntryNo; header->fPartNo = payloadE->fPartNo; - FairMQMessagePtr msgHeader( - NewMessage(header, sizeof(PixelPayload::EventHeader), [](void* data, void* /*hint*/) { - delete static_cast(data); - })); + auto msgHeader(NewMessage(header, sizeof(PixelPayload::EventHeader), [](void* data, void* /*hint*/) { + delete static_cast(data); + })); partsOut.AddPart(std::move(msgHeader)); // create part with hits int hitsSize = nofDigis * sizeof(PixelPayload::Hit); - FairMQMessagePtr msgTCA = NewMessage(hitsSize); + auto msgTCA = NewMessage(hitsSize); PixelPayload::Hit* hitPayload = static_cast(msgTCA->GetData()); @@ -172,12 +170,11 @@ class FairMQPixAltTaskProcessorBin : public FairMQDevice std::string* reqStr = new std::string(paramName + "," + std::to_string(fCurrentRunId)); LOG(warn) << "Requesting parameter \"" << paramName << "\" for Run ID " << fCurrentRunId << " (" << thisPar << ")"; - FairMQMessagePtr req(NewMessage( - const_cast(reqStr->c_str()), - reqStr->length(), - [](void* /*data*/, void* obj) { delete static_cast(obj); }, - reqStr)); - FairMQMessagePtr rep(NewMessage()); + auto req(NewMessage(const_cast(reqStr->c_str()), + reqStr->length(), + [](void* /*data*/, void* obj) { delete static_cast(obj); }, + reqStr)); + auto rep(NewMessage()); if (Send(req, fParamChannelName) > 0) { if (Receive(rep, fParamChannelName) > 0) { diff --git a/examples/MQ/pixelDetector/run/CMakeLists.txt b/examples/MQ/pixelDetector/run/CMakeLists.txt index 3d0999348e..a436bc6669 100644 --- a/examples/MQ/pixelDetector/run/CMakeLists.txt +++ b/examples/MQ/pixelDetector/run/CMakeLists.txt @@ -76,7 +76,7 @@ endif() set(exe_dependencies FairRoot::ExPixel - FairMQ::FairMQ + FairRoot::FairMQ Boost::program_options ) diff --git a/examples/MQ/pixelDetector/run/runMQSim.cxx b/examples/MQ/pixelDetector/run/runMQSim.cxx index a2fd095785..1a135f5a55 100644 --- a/examples/MQ/pixelDetector/run/runMQSim.cxx +++ b/examples/MQ/pixelDetector/run/runMQSim.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014-2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -13,9 +13,9 @@ #include "FairOnlineSink.h" #include "FairParAsciiFileIo.h" #include "FairPrimaryGenerator.h" +#include "FairRunFairMQDevice.h" #include "Pixel.h" #include "PixelDigitize.h" -#include "runFairMQDevice.h" #include #include @@ -43,7 +43,7 @@ void addCustomOptions(bpo::options_description& options) ; } -FairMQDevicePtr getDevice(const FairMQProgOptions& config) +std::unique_ptr fairGetDevice(const fair::mq::ProgOptions& config) { gRandom->SetSeed(config.GetValue("random-seed")); @@ -65,10 +65,10 @@ FairMQDevicePtr getDevice(const FairMQProgOptions& config) } gSystem->Setenv("CONFIG_DIR", tutConfigDir.c_str()); - FairMQSimDevice* run = new FairMQSimDevice(); + auto run = std::unique_ptr(new FairMQSimDevice()); FairOnlineSink* sink = new FairOnlineSink(); - sink->SetMQRunDevice(run); + sink->SetMQRunDevice(run.get()); run->SetSink(sink); run->SetParamUpdateChannelName(config.GetValue("param-channel-name")); diff --git a/examples/MQ/pixelDetector/run/runPixelFileSink.cxx b/examples/MQ/pixelDetector/run/runPixelFileSink.cxx index d416886bc6..7fe682a962 100644 --- a/examples/MQ/pixelDetector/run/runPixelFileSink.cxx +++ b/examples/MQ/pixelDetector/run/runPixelFileSink.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014-2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -7,7 +7,7 @@ ********************************************************************************/ #include "FairMQPixelFileSink.h" -#include "runFairMQDevice.h" +#include "FairRunFairMQDevice.h" #include @@ -23,4 +23,7 @@ void addCustomOptions(bpo::options_description& options) // clang-format on } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new FairMQPixelFileSink(); } +std::unique_ptr fairGetDevice(const fair::mq::ProgOptions&) +{ + return std::unique_ptr(new FairMQPixelFileSink()); +} diff --git a/examples/MQ/pixelDetector/run/runPixelFileSinkBin.cxx b/examples/MQ/pixelDetector/run/runPixelFileSinkBin.cxx index a100bf6634..ee3d7201b2 100644 --- a/examples/MQ/pixelDetector/run/runPixelFileSinkBin.cxx +++ b/examples/MQ/pixelDetector/run/runPixelFileSinkBin.cxx @@ -1,15 +1,14 @@ /******************************************************************************** - * Copyright (C) 2014-2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * * copied verbatim in the file "LICENSE" * ********************************************************************************/ -#include "runFairMQDevice.h" - // PixelDetector example #include "FairMQPixelFileSinkBin.h" +#include "FairRunFairMQDevice.h" #include #include @@ -28,4 +27,7 @@ void addCustomOptions(bpo::options_description& options) // clang-format on } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new FairMQPixelFileSinkBin(); } +std::unique_ptr fairGetDevice(const fair::mq::ProgOptions&) +{ + return std::unique_ptr(new FairMQPixelFileSinkBin()); +} diff --git a/examples/MQ/pixelDetector/run/runPixelMerger.cxx b/examples/MQ/pixelDetector/run/runPixelMerger.cxx index 62f3daf88a..0f64f3b67e 100644 --- a/examples/MQ/pixelDetector/run/runPixelMerger.cxx +++ b/examples/MQ/pixelDetector/run/runPixelMerger.cxx @@ -1,18 +1,22 @@ /******************************************************************************** - * Copyright (C) 2014-2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * * copied verbatim in the file "LICENSE" * ********************************************************************************/ -#include "runFairMQDevice.h" - // PixelDetector example #include "FairMQPixelMerger.h" +#include "FairRunFairMQDevice.h" + +#include namespace bpo = boost::program_options; void addCustomOptions(bpo::options_description& /*options*/) {} -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new FairMQPixelMerger(); } +std::unique_ptr fairGetDevice(const fair::mq::ProgOptions&) +{ + return std::unique_ptr(new FairMQPixelMerger()); +} diff --git a/examples/MQ/pixelDetector/run/runPixelSampler.cxx b/examples/MQ/pixelDetector/run/runPixelSampler.cxx index db876ddb14..4b891b1f0b 100644 --- a/examples/MQ/pixelDetector/run/runPixelSampler.cxx +++ b/examples/MQ/pixelDetector/run/runPixelSampler.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014-2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -8,10 +8,10 @@ #include "PixelDigiBinSource.h" #include "PixelDigiSource.h" -#include "runFairMQDevice.h" // PixelDetector example #include "FairMQPixelSampler.h" +#include "FairRunFairMQDevice.h" #include #include @@ -32,12 +32,12 @@ void addCustomOptions(bpo::options_description& options) // clang-format on } -FairMQDevicePtr getDevice(const FairMQProgOptions& config) +std::unique_ptr fairGetDevice(const fair::mq::ProgOptions& config) { std::string samplerType = config.GetValue("sampler-type"); std::vector filename = config.GetValue>("file-name"); - FairMQPixelSampler* sampler = new FairMQPixelSampler(); + auto sampler = std::unique_ptr(new FairMQPixelSampler()); if (samplerType == "FairFileSource") { } else if (samplerType == "PixelDigiSource") { @@ -53,7 +53,7 @@ FairMQDevicePtr getDevice(const FairMQProgOptions& config) } else { LOG(error) << "Sampler \"" << samplerType << "\" unknown! Set it to \"FairFileSource\" or \"PixelDigiSource\" or \"PixelDigiBinSource\""; - return nullptr; + return {nullptr}; } return sampler; diff --git a/examples/MQ/pixelDetector/run/runPixelSamplerBin.cxx b/examples/MQ/pixelDetector/run/runPixelSamplerBin.cxx index 0119c559fa..0692553e14 100644 --- a/examples/MQ/pixelDetector/run/runPixelSamplerBin.cxx +++ b/examples/MQ/pixelDetector/run/runPixelSamplerBin.cxx @@ -1,15 +1,14 @@ /******************************************************************************** - * Copyright (C) 2014-2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * * copied verbatim in the file "LICENSE" * ********************************************************************************/ -#include "runFairMQDevice.h" - // PixelDetector example #include "FairMQPixelSamplerBin.h" +#include "FairRunFairMQDevice.h" #include #include @@ -29,4 +28,7 @@ void addCustomOptions(bpo::options_description& options) // clang-format on } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new FairMQPixelSamplerBin; } +std::unique_ptr fairGetDevice(const fair::mq::ProgOptions&) +{ + return std::unique_ptr(new FairMQPixelSamplerBin()); +} diff --git a/examples/MQ/pixelDetector/run/runPixelTaskProcessor.cxx b/examples/MQ/pixelDetector/run/runPixelTaskProcessor.cxx index 76eca413b8..864524baef 100644 --- a/examples/MQ/pixelDetector/run/runPixelTaskProcessor.cxx +++ b/examples/MQ/pixelDetector/run/runPixelTaskProcessor.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014-2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -10,10 +10,10 @@ #include "PixelFindHits.h" #include "PixelFindTracks.h" #include "PixelFitTracks.h" -#include "runFairMQDevice.h" // PixelDetector example #include "FairMQPixelTaskProcessor.h" +#include "FairRunFairMQDevice.h" #include @@ -37,21 +37,21 @@ void addCustomOptions(bpo::options_description& options) // clang-format on } -FairMQDevicePtr getDevice(const FairMQProgOptions& config) +std::unique_ptr fairGetDevice(const fair::mq::ProgOptions& config) { std::string taskname = config.GetValue("task-name"); LOG(info) << "get device with setting!"; if (taskname == "PixelFindHits") { - return new HitFinder(); + return std::unique_ptr(new HitFinder()); } else if (taskname == "PixelFindTracks") { - return new TrackFinder(); + return std::unique_ptr(new TrackFinder()); } else if (taskname == "PixelFitTracks") { - return new TrackFitter(); + return std::unique_ptr(new TrackFitter()); } else if (taskname == "PixelDigitize") { - return new Digitizer(); + return std::unique_ptr(new Digitizer()); } - return 0; + return {nullptr}; } diff --git a/examples/MQ/pixelDetector/run/runPixelTaskProcessorBin.cxx b/examples/MQ/pixelDetector/run/runPixelTaskProcessorBin.cxx index 11acb90c11..42bc038bf2 100644 --- a/examples/MQ/pixelDetector/run/runPixelTaskProcessorBin.cxx +++ b/examples/MQ/pixelDetector/run/runPixelTaskProcessorBin.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014-2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -7,10 +7,10 @@ ********************************************************************************/ #include "PixelFindHits.h" -#include "runFairMQDevice.h" // PixelDetector example #include "FairMQPixelTaskProcessorBin.h" +#include "FairRunFairMQDevice.h" #include @@ -31,16 +31,16 @@ void addCustomOptions(bpo::options_description& options) // clang-format on } -FairMQDevicePtr getDevice(const FairMQProgOptions& config) +std::unique_ptr fairGetDevice(const fair::mq::ProgOptions& config) { std::string taskname = config.GetValue("task-name"); LOG(info) << "get device with setting!"; if (taskname == "PixelFindHits") { - return new HitFinder(); + return std::unique_ptr(new HitFinder()); } LOG(info) << "TASK \"" << taskname << "\" UNKNOWN!!!"; - return 0; + return {nullptr}; } diff --git a/examples/MQ/pixelDetector/src/CMakeLists.txt b/examples/MQ/pixelDetector/src/CMakeLists.txt index bb72078c1e..4e82e24838 100644 --- a/examples/MQ/pixelDetector/src/CMakeLists.txt +++ b/examples/MQ/pixelDetector/src/CMakeLists.txt @@ -1,5 +1,5 @@ ################################################################################ -# Copyright (C) 2014-2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # +# Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # # # # This software is distributed under the terms of the # # GNU Lesser General Public Licence (LGPL) version 3, # @@ -80,11 +80,10 @@ target_link_libraries(${target} PUBLIC FairRoot::ParBase # FairParGenericSet FairRoot::ExMCStack FairRoot::ExPassive # FairCave + FairRoot::FairMQ Boost::serialization - FairMQ::FairMQ - Core MathCore RIO diff --git a/examples/MQ/pixelDetector/src/FairOnlineSink.cxx b/examples/MQ/pixelDetector/src/FairOnlineSink.cxx index 31a96be69f..fdc7cfe99a 100644 --- a/examples/MQ/pixelDetector/src/FairOnlineSink.cxx +++ b/examples/MQ/pixelDetector/src/FairOnlineSink.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence version 3 (LGPL) version 3, * @@ -17,7 +17,7 @@ #include "FairMQRunDevice.h" #include "FairRootManager.h" -#include +#include FairOnlineSink::FairOnlineSink() : FairSink() diff --git a/examples/MQ/pixelDetector/src/devices/FairMQPixelFileSink.cxx b/examples/MQ/pixelDetector/src/devices/FairMQPixelFileSink.cxx index ec8442f230..c7a4eb4703 100644 --- a/examples/MQ/pixelDetector/src/devices/FairMQPixelFileSink.cxx +++ b/examples/MQ/pixelDetector/src/devices/FairMQPixelFileSink.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -16,11 +16,11 @@ #include "RootSerializer.h" -#include #include #include #include #include +#include #include #include @@ -64,7 +64,7 @@ void FairMQPixelFileSink::InitTask() OnData(fInputChannelName, &FairMQPixelFileSink::StoreData); } -bool FairMQPixelFileSink::StoreData(FairMQParts& parts, int /*index*/) +bool FairMQPixelFileSink::StoreData(fair::mq::Parts& parts, int /*index*/) { bool creatingTree = false; std::vector tempObjects; @@ -92,7 +92,7 @@ bool FairMQPixelFileSink::StoreData(FairMQParts& parts, int /*index*/) tempObjects.clear(); if (fAckChannelName != "") { - unique_ptr msg(NewMessage()); + auto msg(NewMessage()); Send(msg, fAckChannelName); } return true; diff --git a/examples/MQ/pixelDetector/src/devices/FairMQPixelFileSink.h b/examples/MQ/pixelDetector/src/devices/FairMQPixelFileSink.h index 8e46003a66..188a8814cb 100644 --- a/examples/MQ/pixelDetector/src/devices/FairMQPixelFileSink.h +++ b/examples/MQ/pixelDetector/src/devices/FairMQPixelFileSink.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -15,14 +15,15 @@ #ifndef FAIRMQPIXELFILESINK_H_ #define FAIRMQPIXELFILESINK_H_ -#include +#include "FairMQ.h" // for fair::mq::Device, fair::mq::Parts + #include class TFile; class TObject; class TTree; -class FairMQPixelFileSink : public FairMQDevice +class FairMQPixelFileSink : public fair::mq::Device { public: FairMQPixelFileSink(); @@ -35,7 +36,7 @@ class FairMQPixelFileSink : public FairMQDevice void SetAckChannelName(const std::string& tstr) { fAckChannelName = tstr; } protected: - bool StoreData(FairMQParts&, int); + bool StoreData(fair::mq::Parts&, int); void InitTask() override; void ResetTask() override; diff --git a/examples/MQ/pixelDetector/src/devices/FairMQPixelFileSinkBin.cxx b/examples/MQ/pixelDetector/src/devices/FairMQPixelFileSinkBin.cxx index d90597b23c..f2c621c284 100644 --- a/examples/MQ/pixelDetector/src/devices/FairMQPixelFileSinkBin.cxx +++ b/examples/MQ/pixelDetector/src/devices/FairMQPixelFileSinkBin.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -18,7 +18,6 @@ #include "PixelHit.h" #include "PixelPayload.h" -#include #include #include #include @@ -27,6 +26,7 @@ #include #include #include +#include using namespace std; @@ -96,7 +96,7 @@ void FairMQPixelFileSinkBin::Init() OnData(fInputChannelName, &FairMQPixelFileSinkBin::StoreData); } -bool FairMQPixelFileSinkBin::StoreData(FairMQParts& parts, int /*index*/) +bool FairMQPixelFileSinkBin::StoreData(fair::mq::Parts& parts, int /*index*/) { if (parts.Size() == 0) return true; // probably impossible, but still check @@ -143,7 +143,7 @@ bool FairMQPixelFileSinkBin::StoreData(FairMQParts& parts, int /*index*/) } if (fAckChannelName != "") { - FairMQMessagePtr msg(NewMessage()); + auto msg(NewMessage()); Send(msg, fAckChannelName); } return true; diff --git a/examples/MQ/pixelDetector/src/devices/FairMQPixelFileSinkBin.h b/examples/MQ/pixelDetector/src/devices/FairMQPixelFileSinkBin.h index cdb9cd03e9..3bf901d6e3 100644 --- a/examples/MQ/pixelDetector/src/devices/FairMQPixelFileSinkBin.h +++ b/examples/MQ/pixelDetector/src/devices/FairMQPixelFileSinkBin.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -15,7 +15,8 @@ #ifndef FAIRMQPIXELFILESINKBIN_H_ #define FAIRMQPIXELFILESINKBIN_H_ -#include +#include "FairMQ.h" // for fair::mq::Device, fair::mq::Parts + #include #include @@ -24,7 +25,7 @@ class TFolder; class TObject; class TTree; -class FairMQPixelFileSinkBin : public FairMQDevice +class FairMQPixelFileSinkBin : public fair::mq::Device { public: FairMQPixelFileSinkBin(); @@ -42,7 +43,7 @@ class FairMQPixelFileSinkBin : public FairMQDevice void SetAckChannelName(const std::string& tstr) { fAckChannelName = tstr; } protected: - bool StoreData(FairMQParts&, int); + bool StoreData(fair::mq::Parts&, int); virtual void Init(); private: diff --git a/examples/MQ/pixelDetector/src/devices/FairMQPixelMerger.cxx b/examples/MQ/pixelDetector/src/devices/FairMQPixelMerger.cxx index a82e5d4e01..aa59a02a5c 100644 --- a/examples/MQ/pixelDetector/src/devices/FairMQPixelMerger.cxx +++ b/examples/MQ/pixelDetector/src/devices/FairMQPixelMerger.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -17,10 +17,10 @@ #include "PixelEventHeader.h" #include "RootSerializer.h" -#include #include #include #include // strcmp +#include using namespace std; @@ -40,7 +40,7 @@ FairMQPixelMerger::FairMQPixelMerger() void FairMQPixelMerger::Init() { OnData(fInputChannelName, &FairMQPixelMerger::MergeData); } -bool FairMQPixelMerger::MergeData(FairMQParts& parts, int /*index*/) +bool FairMQPixelMerger::MergeData(fair::mq::Parts& parts, int /*index*/) { bool printInfo = false; int nofReceivedParts = 0; // if set to -1, the data seems to be duplicated @@ -140,10 +140,10 @@ bool FairMQPixelMerger::MergeData(FairMQParts& parts, int /*index*/) fObjectMap.erase(fRet.first, fRet.second); } - FairMQMessagePtr messageTCA[10]; - FairMQParts partsOut; + fair::mq::MessagePtr messageTCA[10]; + fair::mq::Parts partsOut; - FairMQMessagePtr messFEH(NewMessage()); + auto messFEH(NewMessage()); RootSerializer().Serialize(*messFEH, fEventHeader); partsOut.AddPart(std::move(messFEH)); for (int iarray = 0; iarray < nofArrays; iarray++) { diff --git a/examples/MQ/pixelDetector/src/devices/FairMQPixelMerger.h b/examples/MQ/pixelDetector/src/devices/FairMQPixelMerger.h index 031512a724..561b090d8d 100644 --- a/examples/MQ/pixelDetector/src/devices/FairMQPixelMerger.h +++ b/examples/MQ/pixelDetector/src/devices/FairMQPixelMerger.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -15,7 +15,8 @@ #ifndef FAIRMQPIXELMERGER_H_ #define FAIRMQPIXELMERGER_H_ -#include +#include "FairMQ.h" // for fair::mq::Device, fair::mq::Parts + #include #include #include // pair @@ -25,7 +26,7 @@ class TObject; typedef std::multimap, int>, TObject*> MultiMapDef; -class FairMQPixelMerger : public FairMQDevice +class FairMQPixelMerger : public fair::mq::Device { public: FairMQPixelMerger(); @@ -34,7 +35,7 @@ class FairMQPixelMerger : public FairMQDevice void SetNofParts(int iparts) { fNofParts = iparts; } protected: - bool MergeData(FairMQParts&, int); + bool MergeData(fair::mq::Parts&, int); virtual void Init(); private: diff --git a/examples/MQ/pixelDetector/src/devices/FairMQPixelSampler.cxx b/examples/MQ/pixelDetector/src/devices/FairMQPixelSampler.cxx index ac6e8ca2fc..16f3434a91 100644 --- a/examples/MQ/pixelDetector/src/devices/FairMQPixelSampler.cxx +++ b/examples/MQ/pixelDetector/src/devices/FairMQPixelSampler.cxx @@ -19,12 +19,11 @@ #include "FairSource.h" #include "RootSerializer.h" -#include -#include #include #include #include #include +#include #include // move using namespace std; @@ -101,10 +100,10 @@ bool FairMQPixelSampler::ConditionalRun() if (readEventReturn != 0) return false; - FairMQParts parts; + fair::mq::Parts parts; for (int iobj = 0; iobj < fNObjects; iobj++) { - FairMQMessagePtr mess(NewMessage()); + auto mess(NewMessage()); RootSerializer().Serialize(*mess, fInputObjects[iobj]); parts.AddPart(std::move(mess)); } @@ -130,7 +129,7 @@ void FairMQPixelSampler::ListenForAcks() if (fAckChannelName != "") { Long64_t numAcks = 0; do { - unique_ptr ack(NewMessage()); + auto ack(NewMessage()); if (Receive(ack, fAckChannelName) >= 0) { numAcks++; } diff --git a/examples/MQ/pixelDetector/src/devices/FairMQPixelSampler.h b/examples/MQ/pixelDetector/src/devices/FairMQPixelSampler.h index 3380fe1453..ee75d3edb6 100644 --- a/examples/MQ/pixelDetector/src/devices/FairMQPixelSampler.h +++ b/examples/MQ/pixelDetector/src/devices/FairMQPixelSampler.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -15,7 +15,8 @@ #ifndef FAIRMQPIXELSAMPLER_H_ #define FAIRMQPIXELSAMPLER_H_ -#include +#include "FairMQ.h" // for fair::mq::Device, fair::mq::Parts + #include #include #include @@ -25,7 +26,7 @@ class FairSource; class FairRunAna; class TObject; -class FairMQPixelSampler : public FairMQDevice +class FairMQPixelSampler : public fair::mq::Device { public: FairMQPixelSampler(); diff --git a/examples/MQ/pixelDetector/src/devices/FairMQPixelSamplerBin.cxx b/examples/MQ/pixelDetector/src/devices/FairMQPixelSamplerBin.cxx index 322c0b7a7b..e9d98163ba 100644 --- a/examples/MQ/pixelDetector/src/devices/FairMQPixelSamplerBin.cxx +++ b/examples/MQ/pixelDetector/src/devices/FairMQPixelSamplerBin.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -20,11 +20,11 @@ #include "PixelDigi.h" #include "PixelPayload.h" -#include #include // for Int_t, Long64_t #include #include #include +#include #include // move using namespace std; @@ -93,7 +93,7 @@ bool FairMQPixelSamplerBin::ConditionalRun() if (readEventReturn != 0) return false; - FairMQParts parts; + fair::mq::Parts parts; for (int iobj = 0; iobj < fNObjects; iobj++) { if (strcmp(fInputObjects[iobj]->GetName(), "EventHeader.") == 0) { @@ -101,10 +101,9 @@ bool FairMQPixelSamplerBin::ConditionalRun() header->fRunId = ((FairEventHeader*)fInputObjects[iobj])->GetRunId(); header->fMCEntryNo = ((FairEventHeader*)fInputObjects[iobj])->GetMCEntryNumber(); header->fPartNo = 0; - FairMQMessagePtr msgHeader( - NewMessage(header, sizeof(PixelPayload::EventHeader), [](void* data, void* /*hint*/) { - delete static_cast(data); - })); + auto msgHeader(NewMessage(header, sizeof(PixelPayload::EventHeader), [](void* data, void* /*hint*/) { + delete static_cast(data); + })); parts.AddPart(std::move(msgHeader)); // LOG(debug) << "-----------------------------"; // LOG(debug) << "first part has size = " << sizeof(PixelPayload::EventHeader); @@ -112,7 +111,7 @@ bool FairMQPixelSamplerBin::ConditionalRun() Int_t nofEntries = ((TClonesArray*)fInputObjects[iobj])->GetEntries(); size_t digisSize = nofEntries * sizeof(PixelPayload::Digi); - FairMQMessagePtr msgTCA(NewMessage(digisSize)); + auto msgTCA(NewMessage(digisSize)); PixelPayload::Digi* digiPayload = static_cast(msgTCA->GetData()); @@ -155,7 +154,7 @@ void FairMQPixelSamplerBin::ListenForAcks() if (fAckChannelName != "") { Long64_t numAcks = 0; do { - FairMQMessagePtr ack(NewMessage()); + auto ack(NewMessage()); if (Receive(ack, fAckChannelName) >= 0) { numAcks++; } diff --git a/examples/MQ/pixelDetector/src/devices/FairMQPixelSamplerBin.h b/examples/MQ/pixelDetector/src/devices/FairMQPixelSamplerBin.h index e7360ccd22..eaede0eda7 100644 --- a/examples/MQ/pixelDetector/src/devices/FairMQPixelSamplerBin.h +++ b/examples/MQ/pixelDetector/src/devices/FairMQPixelSamplerBin.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -15,7 +15,8 @@ #ifndef FAIRMQPIXELSAMPLERBIN_H_ #define FAIRMQPIXELSAMPLERBIN_H_ -#include +#include "FairMQ.h" // for fair::mq::Device, fair::mq::Parts + #include #include #include @@ -25,7 +26,7 @@ class FairFileSource; class FairRunAna; class TObject; -class FairMQPixelSamplerBin : public FairMQDevice +class FairMQPixelSamplerBin : public fair::mq::Device { public: FairMQPixelSamplerBin(); diff --git a/examples/MQ/pixelDetector/src/devices/FairMQPixelTaskProcessor.h b/examples/MQ/pixelDetector/src/devices/FairMQPixelTaskProcessor.h index f791ee192e..9b95417003 100644 --- a/examples/MQ/pixelDetector/src/devices/FairMQPixelTaskProcessor.h +++ b/examples/MQ/pixelDetector/src/devices/FairMQPixelTaskProcessor.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -12,17 +12,16 @@ #include "FairEventHeader.h" #include "FairGeoParSet.h" #include "FairMCEventHeader.h" +#include "FairMQ.h" // for fair::mq::Device, fair::mq::Parts #include "FairParGenericSet.h" #include "RootSerializer.h" -#include -#include #include #include #include template -class FairMQPixelTaskProcessor : public FairMQDevice +class FairMQPixelTaskProcessor : public fair::mq::Device { public: FairMQPixelTaskProcessor() @@ -64,7 +63,7 @@ class FairMQPixelTaskProcessor : public FairMQDevice void SetStaticParameters(bool tbool) { fStaticParameters = tbool; } protected: - bool ProcessData(FairMQParts& parts, int) + bool ProcessData(fair::mq::Parts& parts, int) { TObject* objectToKeep = nullptr; @@ -117,20 +116,20 @@ class FairMQPixelTaskProcessor : public FairMQDevice fOutput->Add(objectToKeep); } - FairMQParts partsOut; + fair::mq::Parts partsOut; if (fEventHeader) { - FairMQMessagePtr mess(NewMessage()); + auto mess(NewMessage()); RootSerializer().Serialize(*mess, fEventHeader); partsOut.AddPart(std::move(mess)); } else if (fMCEventHeader) { - FairMQMessagePtr mess(NewMessage()); + auto mess(NewMessage()); RootSerializer().Serialize(*mess, fMCEventHeader); partsOut.AddPart(std::move(mess)); } for (int iobj = 0; iobj < fOutput->GetEntries(); iobj++) { - FairMQMessagePtr mess(NewMessage()); + auto mess(NewMessage()); RootSerializer().Serialize(*mess, fOutput->At(iobj)); partsOut.AddPart(std::move(mess)); } @@ -200,12 +199,11 @@ class FairMQPixelTaskProcessor : public FairMQDevice LOG(debug) << "Requesting parameter \"" << paramName << "\" for Run ID " << fCurrentRunId << " (" << thisPar << ")"; - FairMQMessagePtr req(NewMessage( - const_cast(reqStr->c_str()), - reqStr->length(), - [](void* /* data */, void* hint) { delete static_cast(hint); }, - reqStr)); - FairMQMessagePtr rep(NewMessage()); + auto req(NewMessage(const_cast(reqStr->c_str()), + reqStr->length(), + [](void* /* data */, void* hint) { delete static_cast(hint); }, + reqStr)); + auto rep(NewMessage()); if (Send(req, fParamChannelName) > 0) { if (Receive(rep, fParamChannelName) > 0) { diff --git a/examples/MQ/pixelDetector/src/devices/FairMQPixelTaskProcessorBin.h b/examples/MQ/pixelDetector/src/devices/FairMQPixelTaskProcessorBin.h index dca6bdbe1a..002cf9ac67 100644 --- a/examples/MQ/pixelDetector/src/devices/FairMQPixelTaskProcessorBin.h +++ b/examples/MQ/pixelDetector/src/devices/FairMQPixelTaskProcessorBin.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -11,20 +11,19 @@ #include "FairEventHeader.h" #include "FairGeoParSet.h" +#include "FairMQ.h" // for fair::mq::Device, fair::mq::Parts #include "FairParGenericSet.h" #include "PixelDigi.h" #include "PixelHit.h" #include "PixelPayload.h" #include "RootSerializer.h" -#include -#include #include #include #include template -class FairMQPixelTaskProcessorBin : public FairMQDevice +class FairMQPixelTaskProcessorBin : public fair::mq::Device { public: FairMQPixelTaskProcessorBin() @@ -71,7 +70,7 @@ class FairMQPixelTaskProcessorBin : public FairMQDevice void SetStaticParameters(bool tbool) { fStaticParameters = tbool; } protected: - bool ProcessData(FairMQParts& parts, int) + bool ProcessData(fair::mq::Parts& parts, int) { // LOG(debug) << "message received with " << parts.Size() << " parts!"; fReceivedMsgs++; @@ -117,18 +116,18 @@ class FairMQPixelTaskProcessorBin : public FairMQDevice // LOG(info) << " The blocking line... analyzing event " << fEventHeader->GetMCEntryNumber(); fFairTask->ExecMQ(fInput, fOutput); - FairMQParts partsOut; + fair::mq::Parts partsOut; PixelPayload::EventHeader* header = new PixelPayload::EventHeader(); header->fRunId = payloadE->fRunId; header->fMCEntryNo = payloadE->fMCEntryNo; header->fPartNo = payloadE->fPartNo; - FairMQMessagePtr msgHeader(NewMessage( - header, - sizeof(PixelPayload::EventHeader), - [](void* data, void* /*hint*/) { delete static_cast(data); }, - nullptr)); + auto msgHeader( + NewMessage(header, + sizeof(PixelPayload::EventHeader), + [](void* data, void* /*hint*/) { delete static_cast(data); }, + nullptr)); partsOut.AddPart(std::move(msgHeader)); for (int iobj = 0; iobj < fOutput->GetEntries(); iobj++) { @@ -136,7 +135,7 @@ class FairMQPixelTaskProcessorBin : public FairMQDevice Int_t nofEntries = ((TClonesArray*)fOutput->At(iobj))->GetEntries(); size_t hitsSize = nofEntries * sizeof(PixelPayload::Hit); - FairMQMessagePtr msgTCA(NewMessage(hitsSize)); + auto msgTCA(NewMessage(hitsSize)); PixelPayload::Hit* hitPayload = static_cast(msgTCA->GetData()); @@ -222,12 +221,11 @@ class FairMQPixelTaskProcessorBin : public FairMQDevice std::string* reqStr = new std::string(paramName + "," + std::to_string(fCurrentRunId)); LOG(warn) << "Requesting parameter \"" << paramName << "\" for Run ID " << fCurrentRunId << " (" << thisPar << ")"; - FairMQMessagePtr req(NewMessage( - const_cast(reqStr->c_str()), - reqStr->length(), - [](void* /* data */, void* hint) { delete static_cast(hint); }, - reqStr)); - FairMQMessagePtr rep(NewMessage()); + auto req(NewMessage(const_cast(reqStr->c_str()), + reqStr->length(), + [](void* /* data */, void* hint) { delete static_cast(hint); }, + reqStr)); + auto rep(NewMessage()); if (Send(req, fParamChannelName) > 0) { if (Receive(rep, fParamChannelName) > 0) { diff --git a/examples/MQ/pixelDetector/src/devices/FairMQRunDevice.cxx b/examples/MQ/pixelDetector/src/devices/FairMQRunDevice.cxx index 1f97002845..37713f30e6 100644 --- a/examples/MQ/pixelDetector/src/devices/FairMQRunDevice.cxx +++ b/examples/MQ/pixelDetector/src/devices/FairMQRunDevice.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence version 3 (LGPL) version 3, * @@ -18,12 +18,11 @@ #include "FairRootManager.h" #include "RootSerializer.h" -#include -#include #include #include #include #include // printf +#include using namespace std; @@ -32,10 +31,10 @@ std::mutex mtx; // mutex for critical section void FairMQRunDevice::SendObject(TObject* obj, const std::string& chan) { - FairMQMessagePtr mess(NewMessage()); + auto mess(NewMessage()); RootSerializer().Serialize(*mess, obj); - FairMQMessagePtr rep(NewMessage()); + auto rep(NewMessage()); printf("sending %s", obj->GetName()); if (Send(mess, chan) > 0) { @@ -57,7 +56,7 @@ void FairMQRunDevice::SendBranches() for (auto& mi : fChannels) { LOG(debug) << "trying channel >" << mi.first.data() << "<"; - FairMQParts parts; + fair::mq::Parts parts; for (Int_t t = 0; t < branchNameList->GetEntries(); t++) { ObjStr = static_cast(branchNameList->TList::At(t)); @@ -79,7 +78,7 @@ void FairMQRunDevice::SendBranches() TObject* objClone = (*mcTrackArray)->Clone(); LOG(debug) << "FairMQRunDevice::SendBranches() the track array has " << ((TClonesArray*)(objClone))->GetEntries() << " entries."; - FairMQMessagePtr mess(NewMessage()); + auto mess(NewMessage()); RootSerializer().Serialize(*mess, objClone); parts.AddPart(std::move(mess)); LOG(debug) << "channel >" << mi.first.data() << "< --> >" << ObjStr->GetString().Data() @@ -94,7 +93,7 @@ void FairMQRunDevice::SendBranches() TObject* object = FairRootManager::Instance()->GetObject(ObjStr->GetString()); if (object) { TObject* objClone = object->Clone(); - FairMQMessagePtr mess(NewMessage()); + auto mess(NewMessage()); RootSerializer().Serialize(*mess, objClone); parts.AddPart(std::move(mess)); LOG(debug) << "channel >" << mi.first.data() << "< --> >" << ObjStr->GetString().Data() << "<"; diff --git a/examples/MQ/pixelDetector/src/devices/FairMQRunDevice.h b/examples/MQ/pixelDetector/src/devices/FairMQRunDevice.h index e137178617..4a9b1c6b27 100644 --- a/examples/MQ/pixelDetector/src/devices/FairMQRunDevice.h +++ b/examples/MQ/pixelDetector/src/devices/FairMQRunDevice.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2017 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2017-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence version 3 (LGPL) version 3, * @@ -16,12 +16,13 @@ #ifndef FAIRMQRUNDEVICE_H_ #define FAIRMQRUNDEVICE_H_ -#include +#include "FairMQ.h" // for fair::mq::Device + #include class TObject; -class FairMQRunDevice : public FairMQDevice +class FairMQRunDevice : public fair::mq::Device { public: FairMQRunDevice() {} diff --git a/examples/MQ/pixelDetector/src/devices/FairMQSimDevice.cxx b/examples/MQ/pixelDetector/src/devices/FairMQSimDevice.cxx index c5a085d855..5c44f94e62 100644 --- a/examples/MQ/pixelDetector/src/devices/FairMQSimDevice.cxx +++ b/examples/MQ/pixelDetector/src/devices/FairMQSimDevice.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence version 3 (LGPL) version 3, * @@ -20,12 +20,11 @@ #include "FairRunSim.h" #include "FairRuntimeDb.h" -#include -#include #include #include #include #include // printf +#include using namespace std; @@ -91,12 +90,11 @@ void FairMQSimDevice::InitializeRun() // ----- ask the fParamMQServer ------------------------------------ // ----- receive the run number and sampler id --------------------- std::string* askForRunNumber = new string("ReportSimDevice"); - FairMQMessagePtr req(NewMessage( - const_cast(askForRunNumber->c_str()), - askForRunNumber->length(), - [](void* /*data*/, void* object) { delete static_cast(object); }, - askForRunNumber)); - FairMQMessagePtr rep(NewMessage()); + auto req(NewMessage(const_cast(askForRunNumber->c_str()), + askForRunNumber->length(), + [](void* /*data*/, void* object) { delete static_cast(object); }, + askForRunNumber)); + auto rep(NewMessage()); unsigned int runId = 0; if (Send(req, fUpdateChannelName) > 0) { diff --git a/examples/MQ/pixelDetector/src/devices/PixelFindHitsTask.cxx b/examples/MQ/pixelDetector/src/devices/PixelFindHitsTask.cxx index 33a1a476da..0360094dd4 100644 --- a/examples/MQ/pixelDetector/src/devices/PixelFindHitsTask.cxx +++ b/examples/MQ/pixelDetector/src/devices/PixelFindHitsTask.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -19,7 +19,6 @@ #include "PixelDigiPar.h" #include "PixelHit.h" -#include #include #include #include @@ -29,6 +28,7 @@ #include #include #include +#include PixelFindHitsTask::PixelFindHitsTask() : fGeoParSet(nullptr) diff --git a/examples/MQ/pixelSimSplit/run/CMakeLists.txt b/examples/MQ/pixelSimSplit/run/CMakeLists.txt index a264f764df..48a7a4a66b 100644 --- a/examples/MQ/pixelSimSplit/run/CMakeLists.txt +++ b/examples/MQ/pixelSimSplit/run/CMakeLists.txt @@ -41,7 +41,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/test-splitMQ.sh.in ${CMAKE_ set(exe_dependencies FairRoot::ExSimMQ - FairMQ::FairMQ + FairRoot::FairMQ Boost::program_options ) diff --git a/examples/MQ/pixelSimSplit/run/runMQChunkMerger.cxx b/examples/MQ/pixelSimSplit/run/runMQChunkMerger.cxx index ff9b71e058..f3337fcdc0 100644 --- a/examples/MQ/pixelSimSplit/run/runMQChunkMerger.cxx +++ b/examples/MQ/pixelSimSplit/run/runMQChunkMerger.cxx @@ -1,7 +1,16 @@ -#include "runFairMQDevice.h" +/******************************************************************************** + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ // MQRunSim #include "FairMQChunkMerger.h" +#include "FairRunFairMQDevice.h" + +#include namespace bpo = boost::program_options; @@ -14,4 +23,7 @@ void addCustomOptions(bpo::options_description& options) // clang-format on } -FairMQDevicePtr getDevice([[gnu::unused]] const FairMQProgOptions& config) { return new FairMQChunkMerger(); } +std::unique_ptr fairGetDevice(const fair::mq::ProgOptions&) +{ + return std::unique_ptr(new FairMQChunkMerger()); +} diff --git a/examples/MQ/pixelSimSplit/run/runMQGen.cxx b/examples/MQ/pixelSimSplit/run/runMQGen.cxx index 1303ec8733..32447c34ba 100644 --- a/examples/MQ/pixelSimSplit/run/runMQGen.cxx +++ b/examples/MQ/pixelSimSplit/run/runMQGen.cxx @@ -1,9 +1,16 @@ -#include "runFairMQDevice.h" +/******************************************************************************** + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ // MQRunSim #include "FairBoxGenerator.h" #include "FairMQPrimaryGeneratorDevice.h" #include "FairPrimaryGenerator.h" +#include "FairRunFairMQDevice.h" #include #include @@ -27,7 +34,7 @@ void addCustomOptions(bpo::options_description& options) // clang-format on } -FairMQDevicePtr getDevice(const FairMQProgOptions& config) +std::unique_ptr fairGetDevice(const fair::mq::ProgOptions& config) { gRandom->SetSeed(config.GetValue("random-seed")); @@ -49,15 +56,15 @@ FairMQDevicePtr getDevice(const FairMQProgOptions& config) boxGen->SetPhiRange(0, 360); primGen->AddGenerator(boxGen); - FairMQPrimaryGeneratorDevice* mqDevice = new FairMQPrimaryGeneratorDevice(); - LOG(INFO) << "Going to generate " << config.GetValue("nof-events") << " events."; + auto mqDevice = std::unique_ptr(new FairMQPrimaryGeneratorDevice()); + LOG(info) << "Going to generate " << config.GetValue("nof-events") << " events."; mqDevice->SetChunkSize(config.GetValue("chunk-size")); mqDevice->RunInPushMode(true); if (config.GetValue("running-mode") == "rr") { - LOG(INFO) << "Going to reply with data."; + LOG(info) << "Going to reply with data."; mqDevice->RunInPushMode(false); } else { - LOG(INFO) << "Going to push data."; + LOG(info) << "Going to push data."; } mqDevice->SetNofEvents(config.GetValue("nof-events")); diff --git a/examples/MQ/pixelSimSplit/run/runMQTrans.cxx b/examples/MQ/pixelSimSplit/run/runMQTrans.cxx index 84fb2ccb5b..41cd93004c 100644 --- a/examples/MQ/pixelSimSplit/run/runMQTrans.cxx +++ b/examples/MQ/pixelSimSplit/run/runMQTrans.cxx @@ -1,4 +1,10 @@ -#include "runFairMQDevice.h" +/******************************************************************************** + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ // MQRunSim #include "FairCave.h" @@ -6,6 +12,7 @@ #include "FairModule.h" #include "FairOnlineSink.h" #include "FairParAsciiFileIo.h" +#include "FairRunFairMQDevice.h" #include "PixelDigitize.h" #include @@ -32,7 +39,7 @@ void addCustomOptions(bpo::options_description& options) // clang-format on } -FairMQDevicePtr getDevice(const FairMQProgOptions& config) +std::unique_ptr fairGetDevice(const fair::mq::ProgOptions& config) { gRandom->SetSeed(config.GetValue("random-seed")); @@ -47,19 +54,19 @@ FairMQDevicePtr getDevice(const FairMQProgOptions& config) tut_configdir = dir + "/common/gconfig"; gSystem->Setenv("CONFIG_DIR", tut_configdir.Data()); - FairMQTransportDevice* run = new FairMQTransportDevice(); + auto run = std::unique_ptr(new FairMQTransportDevice()); run->RunInPullMode(true); if (config.GetValue("running-mode") == "rr") { - LOG(INFO) << "Going to request data."; + LOG(info) << "Going to request data."; run->RunInPullMode(false); } else { - LOG(INFO) << "Going to pull data."; + LOG(info) << "Going to pull data."; } // TString outputfilename = Form("outputfile_%d.root",(int)(getpid())); // FairRootFileSink* sink = new FairRootFileSink(outputfilename); FairOnlineSink* sink = new FairOnlineSink(); - sink->SetMQRunDevice(run); + sink->SetMQRunDevice(run.get()); run->SetSink(sink); run->SetParamUpdateChannelName(config.GetValue("param-channel-name")); diff --git a/examples/MQ/pixelSimSplit/src/CMakeLists.txt b/examples/MQ/pixelSimSplit/src/CMakeLists.txt index 585d5dd52c..867eb67ff6 100644 --- a/examples/MQ/pixelSimSplit/src/CMakeLists.txt +++ b/examples/MQ/pixelSimSplit/src/CMakeLists.txt @@ -1,5 +1,5 @@ ################################################################################ -# Copyright (C) 2014-2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # +# Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # # # # This software is distributed under the terms of the # # GNU Lesser General Public Licence (LGPL) version 3, # @@ -50,8 +50,7 @@ target_link_libraries(${target} PUBLIC FairRoot::ParBase FairRoot::ExMCStack FairRoot::ExPixel - - FairMQ::FairMQ + FairRoot::FairMQ Core ${VMCLIB} diff --git a/examples/MQ/pixelSimSplit/src/devices/FairMQChunkMerger.cxx b/examples/MQ/pixelSimSplit/src/devices/FairMQChunkMerger.cxx index b6bab5a7ea..84567b0ae3 100644 --- a/examples/MQ/pixelSimSplit/src/devices/FairMQChunkMerger.cxx +++ b/examples/MQ/pixelSimSplit/src/devices/FairMQChunkMerger.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -19,11 +19,11 @@ #include "FairMCTrack.h" #include "RootSerializer.h" -#include #include #include #include #include +#include #include using namespace std; @@ -51,7 +51,7 @@ void FairMQChunkMerger::Init() OnData(fInputChannelName, &FairMQChunkMerger::MergeData); } -bool FairMQChunkMerger::MergeData(FairMQParts& parts, int /*index*/) +bool FairMQChunkMerger::MergeData(fair::mq::Parts& parts, int /*index*/) { bool printInfo = false; int nofReceivedParts = 0; // if set to -1, the data seems to be duplicated @@ -169,17 +169,17 @@ bool FairMQChunkMerger::MergeData(FairMQParts& parts, int /*index*/) } fObjectMap.erase(fRet.first, fRet.second); - FairMQParts partsOut; + fair::mq::Parts partsOut; fMCSplitEventHeader->SetNofChunks(1); fMCSplitEventHeader->SetChunkStart(0); - FairMQMessagePtr messEH(NewMessage()); + auto messEH(NewMessage()); RootSerializer().Serialize(*messEH, fMCSplitEventHeader); partsOut.AddPart(std::move(messEH)); for (int iarray = 0; iarray < tcaVector.size(); ++iarray) { - FairMQMessagePtr mess(NewMessage()); + auto mess(NewMessage()); RootSerializer().Serialize(*mess, tcaVector[iarray]); partsOut.AddPart(std::move(mess)); } diff --git a/examples/MQ/pixelSimSplit/src/devices/FairMQChunkMerger.h b/examples/MQ/pixelSimSplit/src/devices/FairMQChunkMerger.h index 4312021be3..d0ea0d6c05 100644 --- a/examples/MQ/pixelSimSplit/src/devices/FairMQChunkMerger.h +++ b/examples/MQ/pixelSimSplit/src/devices/FairMQChunkMerger.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -15,7 +15,8 @@ #ifndef FAIRMQCHUNKMERGER_H_ #define FAIRMQCHUNKMERGER_H_ -#include +#include "FairMQ.h" // for fair::mq::Device + #include #include #include // pair @@ -25,7 +26,7 @@ class FairMCSplitEventHeader; typedef std::multimap, std::pair> MultiMapDef; -class FairMQChunkMerger : public FairMQDevice +class FairMQChunkMerger : public fair::mq::Device { public: FairMQChunkMerger(); @@ -34,7 +35,7 @@ class FairMQChunkMerger : public FairMQDevice void SetNofParts(int iparts) { fNofParts = iparts; } protected: - bool MergeData(FairMQParts&, int); + bool MergeData(fair::mq::Parts&, int); virtual void Init(); private: diff --git a/examples/MQ/pixelSimSplit/src/devices/FairMQPrimaryGeneratorDevice.cxx b/examples/MQ/pixelSimSplit/src/devices/FairMQPrimaryGeneratorDevice.cxx index 138afe0062..70d2375f77 100644 --- a/examples/MQ/pixelSimSplit/src/devices/FairMQPrimaryGeneratorDevice.cxx +++ b/examples/MQ/pixelSimSplit/src/devices/FairMQPrimaryGeneratorDevice.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence version 3 (LGPL) version 3, * @@ -20,10 +20,9 @@ #include "FairStack.h" #include "RootSerializer.h" -#include -#include #include #include +#include #include // move using namespace std; @@ -71,7 +70,7 @@ bool FairMQPrimaryGeneratorDevice::ConditionalRun() return GenerateAndSendData(); } -bool FairMQPrimaryGeneratorDevice::Reply([[gnu::unused]] FairMQMessagePtr& mPtr, [[gnu::unused]] int /*index*/) +bool FairMQPrimaryGeneratorDevice::Reply([[gnu::unused]] fair::mq::MessagePtr& mPtr, [[gnu::unused]] int /*index*/) { return GenerateAndSendData(); } @@ -87,7 +86,7 @@ bool FairMQPrimaryGeneratorDevice::GenerateAndSendData() if (fEventCounter > fNofEvents) return false; - FairMQParts parts; + fair::mq::Parts parts; // even if sending in chunks is set, send all of the primaries anyway, the transporter takes care of transporting // needed primaries create FairMCEventHeader, misuse not-yet-set fRunID to store begin @@ -104,11 +103,11 @@ bool FairMQPrimaryGeneratorDevice::GenerateAndSendData() meh->SetNPrim(prims->GetEntries() - fChunkPointer); } - FairMQMessagePtr messEH(NewMessage()); + auto messEH(NewMessage()); RootSerializer().Serialize(*messEH, meh); parts.AddPart(std::move(messEH)); - FairMQMessagePtr mess(NewMessage()); + auto mess(NewMessage()); RootSerializer().Serialize(*mess, prims); parts.AddPart(std::move(mess)); @@ -140,7 +139,7 @@ void FairMQPrimaryGeneratorDevice::ListenForAcks() if (fAckChannelName != "") { Long64_t numAcks = 0; do { - FairMQMessagePtr ack(NewMessage()); + auto ack(NewMessage()); if (Receive(ack, fAckChannelName) >= 0) { LOG(info) << "RECEIVED ACK!"; numAcks++; diff --git a/examples/MQ/pixelSimSplit/src/devices/FairMQPrimaryGeneratorDevice.h b/examples/MQ/pixelSimSplit/src/devices/FairMQPrimaryGeneratorDevice.h index 21a939d1d6..6cc4ee4633 100644 --- a/examples/MQ/pixelSimSplit/src/devices/FairMQPrimaryGeneratorDevice.h +++ b/examples/MQ/pixelSimSplit/src/devices/FairMQPrimaryGeneratorDevice.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2017 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2017-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence version 3 (LGPL) version 3, * @@ -16,7 +16,8 @@ #ifndef FAIRMQPRIMARYGENERATORDEVICE_H_ #define FAIRMQPRIMARYGENERATORDEVICE_H_ -#include +#include "FairMQ.h" // for fair::mq::Device, fair::mq::MessagePtr + #include #include #include @@ -26,7 +27,7 @@ class FairPrimaryGenerator; class TObject; class FairStack; -class FairMQPrimaryGeneratorDevice : public FairMQDevice +class FairMQPrimaryGeneratorDevice : public fair::mq::Device { public: FairMQPrimaryGeneratorDevice(); @@ -48,7 +49,7 @@ class FairMQPrimaryGeneratorDevice : public FairMQDevice void SetAckChannelName(std::string tstr) { fAckChannelName = tstr; } protected: - bool Reply(FairMQMessagePtr&, int); + bool Reply(fair::mq::MessagePtr&, int); virtual void InitTask(); virtual void PreRun(); virtual void PostRun(); diff --git a/examples/MQ/pixelSimSplit/src/devices/FairMQTransportDevice.cxx b/examples/MQ/pixelSimSplit/src/devices/FairMQTransportDevice.cxx index 292b0aac3b..d8d038334f 100644 --- a/examples/MQ/pixelSimSplit/src/devices/FairMQTransportDevice.cxx +++ b/examples/MQ/pixelSimSplit/src/devices/FairMQTransportDevice.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence version 3 (LGPL) version 3, * @@ -24,8 +24,6 @@ #include "FairTask.h" #include "RootSerializer.h" -#include -#include #include #include #include @@ -34,6 +32,7 @@ #include #include // for strcmp #include // dlopen +#include #include #include @@ -149,12 +148,11 @@ void FairMQTransportDevice::InitializeRun() // ----- ask the fParamMQServer ------------------------------------ // ----- receive the run number and sampler id --------------------- std::string* askForRunNumber = new string("ReportSimDevice"); - FairMQMessagePtr req(NewMessage( - const_cast(askForRunNumber->c_str()), - askForRunNumber->length(), - [](void* /*data*/, void* object) { delete static_cast(object); }, - askForRunNumber)); - FairMQMessagePtr rep(NewMessage()); + auto req(NewMessage(const_cast(askForRunNumber->c_str()), + askForRunNumber->length(), + [](void* /*data*/, void* object) { delete static_cast(object); }, + askForRunNumber)); + auto rep(NewMessage()); if (Send(req, fUpdateChannelName) > 0) { if (Receive(rep, fUpdateChannelName) > 0) { @@ -207,12 +205,11 @@ bool FairMQTransportDevice::ConditionalRun() return false; std::string* requestString = new string("RequestData"); - FairMQMessagePtr req(NewMessage( - const_cast(requestString->c_str()), - requestString->length(), - [](void* /*data*/, void* object) { delete static_cast(object); }, - requestString)); - FairMQParts parts; + auto req(NewMessage(const_cast(requestString->c_str()), + requestString->length(), + [](void* /*data*/, void* object) { delete static_cast(object); }, + requestString)); + fair::mq::Parts parts; // FairMQMessagePtr rep(NewMessage()); if (Send(req, fGeneratorChannelName) > 0) { @@ -233,7 +230,7 @@ bool FairMQTransportDevice::ConditionalRun() // return true; // } -bool FairMQTransportDevice::TransportData(FairMQParts& mParts, int /*index*/) +bool FairMQTransportDevice::TransportData(fair::mq::Parts& mParts, int /*index*/) { TClonesArray* chunk = nullptr; FairMCSplitEventHeader* meh = nullptr; diff --git a/examples/MQ/pixelSimSplit/src/devices/FairMQTransportDevice.h b/examples/MQ/pixelSimSplit/src/devices/FairMQTransportDevice.h index a01a3c1eda..e881d55e09 100644 --- a/examples/MQ/pixelSimSplit/src/devices/FairMQTransportDevice.h +++ b/examples/MQ/pixelSimSplit/src/devices/FairMQTransportDevice.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2017 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2017-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence version 3 (LGPL) version 3, * @@ -62,8 +62,8 @@ class FairMQTransportDevice : public FairMQRunDevice void RunInReqMode(bool tb = true) { fRunConditional = tb; }; protected: - bool TransportData(FairMQParts&, int); - // bool TransportData(FairMQMessagePtr&, int); + bool TransportData(fair::mq::Parts&, int); + // bool TransportData(fair::mq::MessagePtr&, int); virtual void Init(); virtual void InitTask(); virtual void PreRun(); diff --git a/examples/MQ/serialization/1-simple/Ex1Processor.h b/examples/MQ/serialization/1-simple/Ex1Processor.h index 29b349fd2a..74dab6910d 100644 --- a/examples/MQ/serialization/1-simple/Ex1Processor.h +++ b/examples/MQ/serialization/1-simple/Ex1Processor.h @@ -1,16 +1,24 @@ +/******************************************************************************** + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ + #ifndef EX1PROCESSOR_H #define EX1PROCESSOR_H +#include "FairMQ.h" // for fair::mq::Device #include "MyDigi.h" #include "MyHit.h" #include "RootSerializer.h" -#include #include #include #include -class Ex1Processor : public FairMQDevice +class Ex1Processor : public fair::mq::Device { public: Ex1Processor() {} @@ -22,7 +30,7 @@ class Ex1Processor : public FairMQDevice while (!NewStatePending()) { // Receive - FairMQMessagePtr msgIn(NewMessageFor("data1", 0)); + auto msgIn(NewMessageFor("data1", 0)); if (Receive(msgIn, "data1") > 0) { receivedMsgs++; @@ -34,7 +42,7 @@ class Ex1Processor : public FairMQDevice TClonesArray hits = FindHits(*digis); // Serialize - FairMQMessagePtr msgOut(NewMessageFor("data2", 0)); + auto msgOut(NewMessageFor("data2", 0)); RootSerializer().Serialize(*msgOut, &hits); // Send diff --git a/examples/MQ/serialization/1-simple/Ex1Sampler.h b/examples/MQ/serialization/1-simple/Ex1Sampler.h index d6770c436c..240c395d81 100644 --- a/examples/MQ/serialization/1-simple/Ex1Sampler.h +++ b/examples/MQ/serialization/1-simple/Ex1Sampler.h @@ -1,10 +1,18 @@ +/******************************************************************************** + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ + #ifndef EX1SAMPLER_H #define EX1SAMPLER_H +#include "FairMQ.h" // for fair::mq::Device #include "MyDigi.h" #include "RootSerializer.h" -#include #include #include #include @@ -12,7 +20,7 @@ #include #include -class Ex1Sampler : public FairMQDevice +class Ex1Sampler : public fair::mq::Device { public: Ex1Sampler() @@ -44,7 +52,7 @@ class Ex1Sampler : public FairMQDevice LOG(info) << "Number of events to process: " << numEvents; for (uint64_t i = 0; i < numEvents; i++) { - FairMQMessagePtr msg(NewMessage()); + auto msg(NewMessage()); fTree->GetEntry(i); RootSerializer().Serialize(*msg, fInput); if (Send(msg, "data1") >= 0) { @@ -63,7 +71,7 @@ class Ex1Sampler : public FairMQDevice } } - void Reset() + void Reset() override { if (fInputFile) { fInputFile->Close(); diff --git a/examples/MQ/serialization/1-simple/Ex1Sink.h b/examples/MQ/serialization/1-simple/Ex1Sink.h index c723e50c01..1acb8d9ab4 100644 --- a/examples/MQ/serialization/1-simple/Ex1Sink.h +++ b/examples/MQ/serialization/1-simple/Ex1Sink.h @@ -1,15 +1,23 @@ +/******************************************************************************** + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ + #ifndef EX1SINK_H #define EX1SINK_H +#include "FairMQ.h" // for fair::mq::Device #include "MyHit.h" #include "RootSerializer.h" -#include #include #include #include -class Ex1Sink : public FairMQDevice +class Ex1Sink : public fair::mq::Device { public: Ex1Sink() @@ -32,7 +40,7 @@ class Ex1Sink : public FairMQDevice { int receivedMsgs = 0; while (!NewStatePending()) { - FairMQMessagePtr msg(NewMessage()); + auto msg(NewMessage()); if (Receive(msg, "data2") > 0) { RootSerializer().Deserialize(*msg, fInput); receivedMsgs++; diff --git a/examples/MQ/serialization/1-simple/runEx1Processor.cxx b/examples/MQ/serialization/1-simple/runEx1Processor.cxx index aae9a381ce..84be809ea0 100644 --- a/examples/MQ/serialization/1-simple/runEx1Processor.cxx +++ b/examples/MQ/serialization/1-simple/runEx1Processor.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -7,7 +7,7 @@ ********************************************************************************/ #include "Ex1Processor.h" -#include "runFairMQDevice.h" +#include "FairRunFairMQDevice.h" namespace bpo = boost::program_options; @@ -19,4 +19,7 @@ void addCustomOptions(bpo::options_description& options) // clang-format on } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new Ex1Processor(); } +std::unique_ptr fairGetDevice(const fair::mq::ProgOptions& /*config*/) +{ + return std::unique_ptr(new Ex1Processor()); +} diff --git a/examples/MQ/serialization/1-simple/runEx1Sampler.cxx b/examples/MQ/serialization/1-simple/runEx1Sampler.cxx index 2385721f12..8446e40749 100644 --- a/examples/MQ/serialization/1-simple/runEx1Sampler.cxx +++ b/examples/MQ/serialization/1-simple/runEx1Sampler.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -13,7 +13,7 @@ */ #include "Ex1Sampler.h" -#include "runFairMQDevice.h" +#include "FairRunFairMQDevice.h" namespace bpo = boost::program_options; @@ -25,4 +25,7 @@ void addCustomOptions(bpo::options_description& options) // clang-format on } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new Ex1Sampler(); } +std::unique_ptr fairGetDevice(const fair::mq::ProgOptions& /*config*/) +{ + return std::unique_ptr(new Ex1Sampler()); +} diff --git a/examples/MQ/serialization/1-simple/runEx1Sink.cxx b/examples/MQ/serialization/1-simple/runEx1Sink.cxx index 02d970d07b..45bf6fbda8 100644 --- a/examples/MQ/serialization/1-simple/runEx1Sink.cxx +++ b/examples/MQ/serialization/1-simple/runEx1Sink.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -7,7 +7,7 @@ ********************************************************************************/ #include "Ex1Sink.h" -#include "runFairMQDevice.h" +#include "FairRunFairMQDevice.h" namespace bpo = boost::program_options; @@ -20,4 +20,7 @@ void addCustomOptions(bpo::options_description& options) // clang-format on } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new Ex1Sink(); } +std::unique_ptr fairGetDevice(const fair::mq::ProgOptions& /*config*/) +{ + return std::unique_ptr(new Ex1Sink()); +} diff --git a/examples/MQ/serialization/2-multipart/Ex2Processor.h b/examples/MQ/serialization/2-multipart/Ex2Processor.h index da86482dce..33e8711e6e 100644 --- a/examples/MQ/serialization/2-multipart/Ex2Processor.h +++ b/examples/MQ/serialization/2-multipart/Ex2Processor.h @@ -1,17 +1,24 @@ +/******************************************************************************** + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ + #ifndef EX2PROCESSOR_H #define EX2PROCESSOR_H #include "BoostSerializer.h" +#include "FairMQ.h" // for fair::mq::Device, fair::mq::Parts #include "MyDigi.h" #include "MyHit.h" #include "RootSerializer.h" #include "SerializerExample2.h" -#include -#include #include -class Ex2Processor : public FairMQDevice +class Ex2Processor : public fair::mq::Device { public: Ex2Processor() @@ -27,7 +34,7 @@ class Ex2Processor : public FairMQDevice int sentMsgs = 0; while (!NewStatePending()) { - FairMQParts partsIn; + fair::mq::Parts partsIn; if (Receive(partsIn, "data1") > 0) { Ex2Header* header = nullptr; @@ -38,7 +45,7 @@ class Ex2Processor : public FairMQDevice Exec(fInput, fOutput); - FairMQParts partsOut; + fair::mq::Parts partsOut; partsOut.AddPart(std::move(partsIn.At(0))); partsOut.AddPart(NewMessage()); diff --git a/examples/MQ/serialization/2-multipart/Ex2Sampler.h b/examples/MQ/serialization/2-multipart/Ex2Sampler.h index c75e14b6ac..4df405b267 100644 --- a/examples/MQ/serialization/2-multipart/Ex2Sampler.h +++ b/examples/MQ/serialization/2-multipart/Ex2Sampler.h @@ -1,18 +1,26 @@ +/******************************************************************************** + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ + #ifndef EX2SAMPLER_H #define EX2SAMPLER_H +#include "FairMQ.h" // for fair::mq::Device, fair::mq::Parts #include "MyDigi.h" #include "RootSerializer.h" #include "SerializerExample2.h" -#include #include #include #include #include #include -class Ex2Sampler : public FairMQDevice +class Ex2Sampler : public fair::mq::Device { public: Ex2Sampler() @@ -48,13 +56,13 @@ class Ex2Sampler : public FairMQDevice Ex2Header* header = new Ex2Header(); header->EventNumber = idx; - FairMQMessagePtr msgHeader(NewMessage()); + auto msgHeader(NewMessage()); SerializerEx2().Serialize(*msgHeader, header); - FairMQMessagePtr msg(NewMessage()); + auto msg(NewMessage()); RootSerializer().Serialize(*msg, fInput); - FairMQParts parts; + fair::mq::Parts parts; parts.AddPart(std::move(msgHeader)); parts.AddPart(std::move(msg)); @@ -75,7 +83,7 @@ class Ex2Sampler : public FairMQDevice } } - void Reset() + void Reset() override { if (fInputFile) { fInputFile->Close(); diff --git a/examples/MQ/serialization/2-multipart/Ex2Sink.h b/examples/MQ/serialization/2-multipart/Ex2Sink.h index 4f7af4f297..9b2f08cf63 100644 --- a/examples/MQ/serialization/2-multipart/Ex2Sink.h +++ b/examples/MQ/serialization/2-multipart/Ex2Sink.h @@ -1,15 +1,23 @@ +/******************************************************************************** + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ + #ifndef EX2SINK_H #define EX2SINK_H #include "BoostSerializer.h" +#include "FairMQ.h" // for fair::mq::Device, fair::mq::Parts #include "MyHit.h" #include "SerializerExample2.h" -#include #include #include -class Ex2Sink : public FairMQDevice +class Ex2Sink : public fair::mq::Device { public: Ex2Sink() @@ -32,7 +40,7 @@ class Ex2Sink : public FairMQDevice { int receivedMsgs = 0; while (!NewStatePending()) { - FairMQParts parts; + fair::mq::Parts parts; if (Receive(parts, "data2") > 0) { Ex2Header header; BoostSerializer().Deserialize(*(parts.At(0)), header); diff --git a/examples/MQ/serialization/2-multipart/SerializerExample2.h b/examples/MQ/serialization/2-multipart/SerializerExample2.h index db70fd5589..16f7f1674a 100644 --- a/examples/MQ/serialization/2-multipart/SerializerExample2.h +++ b/examples/MQ/serialization/2-multipart/SerializerExample2.h @@ -1,7 +1,7 @@ #ifndef BASICSERIALIZEREXAMPLE2_H #define BASICSERIALIZEREXAMPLE2_H -#include +#include "FairMQ.h" // for fair::mq::Message namespace boost { namespace serialization { @@ -30,12 +30,12 @@ void serialize(Archive& ar, Ex2Header& header, const unsigned int /*version*/) struct SerializerEx2 { - void Serialize(FairMQMessage& msg, Ex2Header* header) + void Serialize(fair::mq::Message& msg, Ex2Header* header) { msg.Rebuild(header, sizeof(header), [](void* ptr, void* /*hint*/) { delete static_cast(ptr); }); } - void Deserialize(FairMQMessage& msg, Ex2Header*& header) { header = static_cast(msg.GetData()); } + void Deserialize(fair::mq::Message& msg, Ex2Header*& header) { header = static_cast(msg.GetData()); } }; #endif diff --git a/examples/MQ/serialization/2-multipart/runEx2Processor.cxx b/examples/MQ/serialization/2-multipart/runEx2Processor.cxx index 481467282c..c4413cea31 100644 --- a/examples/MQ/serialization/2-multipart/runEx2Processor.cxx +++ b/examples/MQ/serialization/2-multipart/runEx2Processor.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -7,7 +7,7 @@ ********************************************************************************/ #include "Ex2Processor.h" -#include "runFairMQDevice.h" +#include "FairRunFairMQDevice.h" namespace bpo = boost::program_options; @@ -19,4 +19,7 @@ void addCustomOptions(bpo::options_description& options) // clang-format on } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new Ex2Processor(); } +std::unique_ptr fairGetDevice(const fair::mq::ProgOptions& /*config*/) +{ + return std::unique_ptr(new Ex2Processor()); +} diff --git a/examples/MQ/serialization/2-multipart/runEx2Sampler.cxx b/examples/MQ/serialization/2-multipart/runEx2Sampler.cxx index af84f30d17..5f77540a72 100644 --- a/examples/MQ/serialization/2-multipart/runEx2Sampler.cxx +++ b/examples/MQ/serialization/2-multipart/runEx2Sampler.cxx @@ -1,10 +1,11 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * * copied verbatim in the file "LICENSE" * ********************************************************************************/ + /* * File: runSamplerRoot.cxx * Author: winckler @@ -13,7 +14,7 @@ */ #include "Ex2Sampler.h" -#include "runFairMQDevice.h" +#include "FairRunFairMQDevice.h" namespace bpo = boost::program_options; @@ -25,4 +26,7 @@ void addCustomOptions(bpo::options_description& options) // clang-format on } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new Ex2Sampler(); } +std::unique_ptr fairGetDevice(const fair::mq::ProgOptions& /*config*/) +{ + return std::unique_ptr(new Ex2Sampler()); +} diff --git a/examples/MQ/serialization/2-multipart/runEx2Sink.cxx b/examples/MQ/serialization/2-multipart/runEx2Sink.cxx index b3cd10aea3..7e93c317e5 100644 --- a/examples/MQ/serialization/2-multipart/runEx2Sink.cxx +++ b/examples/MQ/serialization/2-multipart/runEx2Sink.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -7,7 +7,7 @@ ********************************************************************************/ #include "Ex2Sink.h" -#include "runFairMQDevice.h" +#include "FairRunFairMQDevice.h" namespace bpo = boost::program_options; @@ -20,4 +20,7 @@ void addCustomOptions(bpo::options_description& options) // clang-format on } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new Ex2Sink(); } +std::unique_ptr fairGetDevice(const fair::mq::ProgOptions& /*config*/) +{ + return std::unique_ptr(new Ex2Sink()); +} diff --git a/examples/MQ/serialization/CMakeLists.txt b/examples/MQ/serialization/CMakeLists.txt index ed3c559991..68e513158c 100644 --- a/examples/MQ/serialization/CMakeLists.txt +++ b/examples/MQ/serialization/CMakeLists.txt @@ -1,5 +1,5 @@ ################################################################################ -# Copyright (C) 2014-2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # +# Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # # # # This software is distributed under the terms of the # # GNU Lesser General Public Licence (LGPL) version 3, # @@ -41,8 +41,8 @@ target_link_libraries(${target} PUBLIC FairRoot::BaseMQ # Serialization policies FairRoot::FairTools # FairLogger FairRoot::ParBase + FairRoot::FairMQ - FairMQ::FairMQ Boost::serialization Core @@ -62,25 +62,25 @@ install(TARGETS ${target} LIBRARY DESTINATION ${PROJECT_INSTALL_LIBDIR}) install(FILES ${headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) add_executable(ex-serialization1-sampler 1-simple/runEx1Sampler.cxx) -target_link_libraries(ex-serialization1-sampler PRIVATE FairRoot::ExSerialization FairMQ::FairMQ) +target_link_libraries(ex-serialization1-sampler PRIVATE FairRoot::ExSerialization FairRoot::FairMQ) add_executable(ex-serialization1-processor 1-simple/runEx1Processor.cxx) -target_link_libraries(ex-serialization1-processor PRIVATE FairRoot::ExSerialization FairMQ::FairMQ) +target_link_libraries(ex-serialization1-processor PRIVATE FairRoot::ExSerialization FairRoot::FairMQ) add_executable(ex-serialization1-sink 1-simple/runEx1Sink.cxx) -target_link_libraries(ex-serialization1-sink PRIVATE FairRoot::ExSerialization FairMQ::FairMQ) +target_link_libraries(ex-serialization1-sink PRIVATE FairRoot::ExSerialization FairRoot::FairMQ) add_executable(ex-serialization2-sampler 2-multipart/runEx2Sampler.cxx) -target_link_libraries(ex-serialization2-sampler PRIVATE FairRoot::ExSerialization FairMQ::FairMQ) +target_link_libraries(ex-serialization2-sampler PRIVATE FairRoot::ExSerialization FairRoot::FairMQ) add_executable(ex-serialization2-processor 2-multipart/runEx2Processor.cxx) -target_link_libraries(ex-serialization2-processor PRIVATE FairRoot::ExSerialization FairMQ::FairMQ) +target_link_libraries(ex-serialization2-processor PRIVATE FairRoot::ExSerialization FairRoot::FairMQ) add_executable(ex-serialization2-sink 2-multipart/runEx2Sink.cxx) -target_link_libraries(ex-serialization2-sink PRIVATE FairRoot::ExSerialization FairMQ::FairMQ) +target_link_libraries(ex-serialization2-sink PRIVATE FairRoot::ExSerialization FairRoot::FairMQ) add_executable(ex-serialization-generate-data data_generator/runGenerateData.cxx) -target_link_libraries(ex-serialization-generate-data PRIVATE FairRoot::ExSerialization FairMQ::FairMQ) +target_link_libraries(ex-serialization-generate-data PRIVATE FairRoot::ExSerialization FairRoot::FairMQ) # Create a directory that will hold root input/output data file file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data_io) diff --git a/examples/MQ/serialization/data_generator/runGenerateData.cxx b/examples/MQ/serialization/data_generator/runGenerateData.cxx index 4b111d13fb..a3e834d2a5 100644 --- a/examples/MQ/serialization/data_generator/runGenerateData.cxx +++ b/examples/MQ/serialization/data_generator/runGenerateData.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -29,7 +29,7 @@ // FairRoot #include "RootOutFileManager.h" -#include +#include // FairRoot - Tutorial 7 #include "MyDigi.h" diff --git a/examples/advanced/Tutorial3/CMakeLists.txt b/examples/advanced/Tutorial3/CMakeLists.txt index 68c3eb5cbf..8bb3d14f24 100644 --- a/examples/advanced/Tutorial3/CMakeLists.txt +++ b/examples/advanced/Tutorial3/CMakeLists.txt @@ -126,8 +126,7 @@ target_link_libraries(${target} PUBLIC FairRoot::GeoBase # FairGeoSet FairRoot::ExMCStack FairRoot::ParBase # FairRuntimeDb, FairContFact, FairParamList - - FairMQ::FairMQ + FairRoot::FairMQ Boost::serialization $<$:protobuf::libprotobuf> @@ -150,15 +149,15 @@ install(TARGETS ${target} LIBRARY DESTINATION ${PROJECT_INSTALL_LIBDIR}) install(FILES ${headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) add_executable(tut3-sampler MQ/run/runTestDetectorSampler.cxx) -target_link_libraries(tut3-sampler PRIVATE FairRoot::BaseMQ FairRoot::ExTestDetector FairMQ::FairMQ) +target_link_libraries(tut3-sampler PRIVATE FairRoot::BaseMQ FairRoot::ExTestDetector FairRoot::FairMQ) target_compile_definitions(tut3-sampler PRIVATE ${defs}) add_executable(tut3-processor MQ/run/runTestDetectorProcessor.cxx) -target_link_libraries(tut3-processor PRIVATE FairRoot::BaseMQ FairRoot::ExTestDetector FairMQ::FairMQ) +target_link_libraries(tut3-processor PRIVATE FairRoot::BaseMQ FairRoot::ExTestDetector FairRoot::FairMQ) target_compile_definitions(tut3-processor PRIVATE ${defs}) add_executable(tut3-sink MQ/run/runTestDetectorFileSink.cxx) -target_link_libraries(tut3-sink PRIVATE FairRoot::BaseMQ FairRoot::ExTestDetector FairMQ::FairMQ) +target_link_libraries(tut3-sink PRIVATE FairRoot::BaseMQ FairRoot::ExTestDetector FairRoot::FairMQ) target_compile_definitions(tut3-sink PRIVATE ${defs}) install(TARGETS tut3-sampler tut3-processor tut3-sink diff --git a/examples/advanced/Tutorial3/MQ/fileSink/FairTestDetectorFileSink.h b/examples/advanced/Tutorial3/MQ/fileSink/FairTestDetectorFileSink.h index 8ffc4aa2d2..4e57ec5d65 100644 --- a/examples/advanced/Tutorial3/MQ/fileSink/FairTestDetectorFileSink.h +++ b/examples/advanced/Tutorial3/MQ/fileSink/FairTestDetectorFileSink.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -15,23 +15,23 @@ #ifndef FAIRTESTDETECTORFILESINK_H_ #define FAIRTESTDETECTORFILESINK_H_ +#include "FairMQ.h" // for fair::mq::Device #include "FairTestDetectorHit.h" #include "FairTestDetectorPayload.h" -#include -#include #include #include #include #include #include #include +#include #include #include #include template -class FairTestDetectorFileSink : public FairMQDevice +class FairTestDetectorFileSink : public fair::mq::Device { public: FairTestDetectorFileSink() diff --git a/examples/advanced/Tutorial3/MQ/fileSink/FairTestDetectorFileSinkBin.tpl b/examples/advanced/Tutorial3/MQ/fileSink/FairTestDetectorFileSinkBin.tpl index ca7587677c..8b79eb945e 100644 --- a/examples/advanced/Tutorial3/MQ/fileSink/FairTestDetectorFileSinkBin.tpl +++ b/examples/advanced/Tutorial3/MQ/fileSink/FairTestDetectorFileSinkBin.tpl @@ -1,3 +1,10 @@ +/******************************************************************************** + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ /* * File: FairTestDetectorFileSink.tpl * Author: winckler, A. Rybalchenko @@ -10,7 +17,7 @@ template<> void FairTestDetectorFileSink::InitTask() { - OnData(fInChannelName, [this](FairMQMessagePtr& msg, int /*index*/) { + OnData(fInChannelName, [this](fair::mq::MessagePtr& msg, int /*index*/) { ++fReceivedMsgs; fOutput->Delete(); @@ -28,7 +35,7 @@ void FairTestDetectorFileSink::In LOG(error) << "FairTestDetectorFileSink::Run(): No Output array!"; } - FairMQMessagePtr ack(fTransportFactory->CreateMessage()); + auto ack(fTransportFactory->CreateMessage()); fChannels.at(fAckChannelName).at(0).Send(ack); fTree.Fill(); diff --git a/examples/advanced/Tutorial3/MQ/fileSink/FairTestDetectorFileSinkBoost.tpl b/examples/advanced/Tutorial3/MQ/fileSink/FairTestDetectorFileSinkBoost.tpl index dc496cc917..a8b5774764 100644 --- a/examples/advanced/Tutorial3/MQ/fileSink/FairTestDetectorFileSinkBoost.tpl +++ b/examples/advanced/Tutorial3/MQ/fileSink/FairTestDetectorFileSinkBoost.tpl @@ -1,3 +1,10 @@ +/******************************************************************************** + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ /* * File: FairTestDetectorFileSink.tpl * Author: winckler, A. Rybalchenko @@ -14,7 +21,7 @@ template void FairTestDetectorFileSink::InitTask() { - OnData(fInChannelName, [this](FairMQMessagePtr& msg, int /*index*/) { + OnData(fInChannelName, [this](fair::mq::MessagePtr& msg, int /*index*/) { ++fReceivedMsgs; BoostSerializer().Deserialize(*msg, fOutput); @@ -23,7 +30,7 @@ void FairTestDetectorFileSink::InitTask() LOG(error) << "FairTestDetectorFileSink::Run(): No Output array!"; } - FairMQMessagePtr ack(NewMessage()); + auto ack(NewMessage()); Send(ack, fAckChannelName); fTree.Fill(); diff --git a/examples/advanced/Tutorial3/MQ/fileSink/FairTestDetectorFileSinkFlatBuffers.tpl b/examples/advanced/Tutorial3/MQ/fileSink/FairTestDetectorFileSinkFlatBuffers.tpl index 2ba626fa71..ac71fdc03f 100644 --- a/examples/advanced/Tutorial3/MQ/fileSink/FairTestDetectorFileSinkFlatBuffers.tpl +++ b/examples/advanced/Tutorial3/MQ/fileSink/FairTestDetectorFileSinkFlatBuffers.tpl @@ -1,3 +1,10 @@ +/******************************************************************************** + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ // Implementation of FairTestDetectorFileSink::Run() with Google FlatBuffers transport data format #ifdef FLATBUFFERS @@ -10,7 +17,7 @@ using namespace TestDetectorFlat; template<> void FairTestDetectorFileSink::InitTask() { - OnData(fInChannelName, [this](FairMQMessagePtr& msg, int /*index*/) { + OnData(fInChannelName, [this](fair::mq::MessagePtr& msg, int /*index*/) { ++fReceivedMsgs; fOutput->Delete(); @@ -31,7 +38,7 @@ void FairTestDetectorFileSink LOG(error) << "FairTestDetectorFileSink::Run(): No Output array!"; } - FairMQMessagePtr ack(fTransportFactory->CreateMessage()); + auto ack(fTransportFactory->CreateMessage()); fChannels.at(fAckChannelName).at(0).Send(ack); fTree.Fill(); diff --git a/examples/advanced/Tutorial3/MQ/fileSink/FairTestDetectorFileSinkMsgpack.tpl b/examples/advanced/Tutorial3/MQ/fileSink/FairTestDetectorFileSinkMsgpack.tpl index d08a969bbd..b350bddfeb 100644 --- a/examples/advanced/Tutorial3/MQ/fileSink/FairTestDetectorFileSinkMsgpack.tpl +++ b/examples/advanced/Tutorial3/MQ/fileSink/FairTestDetectorFileSinkMsgpack.tpl @@ -1,3 +1,10 @@ +/******************************************************************************** + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ // Implementation of FairTestDetectorFileSink::Run() with Msgpack data format #ifdef MSGPACK @@ -12,7 +19,7 @@ struct MsgPack template<> void FairTestDetectorFileSink::InitTask() { - OnData(fInChannelName, [this](FairMQMessagePtr& msg, int /*index*/) { + OnData(fInChannelName, [this](fair::mq::MessagePtr& msg, int /*index*/) { ++fReceivedMsgs; // deserialize @@ -43,7 +50,7 @@ void FairTestDetectorFileSink::InitTask() LOG(error) << "FairTestDetectorFileSink::Run(): No Output array!"; } - FairMQMessagePtr ack(fTransportFactory->CreateMessage()); + auto ack(fTransportFactory->CreateMessage()); fChannels.at(fAckChannelName).at(0).Send(ack); fTree.Fill(); diff --git a/examples/advanced/Tutorial3/MQ/fileSink/FairTestDetectorFileSinkProtobuf.tpl b/examples/advanced/Tutorial3/MQ/fileSink/FairTestDetectorFileSinkProtobuf.tpl index 3fd5642eb6..30743a3626 100644 --- a/examples/advanced/Tutorial3/MQ/fileSink/FairTestDetectorFileSinkProtobuf.tpl +++ b/examples/advanced/Tutorial3/MQ/fileSink/FairTestDetectorFileSinkProtobuf.tpl @@ -1,3 +1,10 @@ +/******************************************************************************** + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ /* * File: FairTestDetectorFileSink.tpl * Author: winckler, A. Rybalchenko @@ -13,7 +20,7 @@ template<> void FairTestDetectorFileSink::InitTask() { - OnData(fInChannelName, [this](FairMQMessagePtr& msg, int /*index*/) { + OnData(fInChannelName, [this](fair::mq::MessagePtr& msg, int /*index*/) { ++fReceivedMsgs; fOutput->Delete(); @@ -33,7 +40,7 @@ void FairTestDetectorFileSinkCreateMessage()); + auto ack(fTransportFactory->CreateMessage()); fChannels.at(fAckChannelName).at(0).Send(ack); fTree.Fill(); diff --git a/examples/advanced/Tutorial3/MQ/fileSink/FairTestDetectorFileSinkTMessage.tpl b/examples/advanced/Tutorial3/MQ/fileSink/FairTestDetectorFileSinkTMessage.tpl index 837100352b..8dab2a06ab 100644 --- a/examples/advanced/Tutorial3/MQ/fileSink/FairTestDetectorFileSinkTMessage.tpl +++ b/examples/advanced/Tutorial3/MQ/fileSink/FairTestDetectorFileSinkTMessage.tpl @@ -1,3 +1,10 @@ +/******************************************************************************** + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ /* * File: FairTestDetectorFileSink.tpl * Author: winckler, A. Rybalchenko @@ -12,14 +19,14 @@ template<> void FairTestDetectorFileSink::InitTask() { - OnData(fInChannelName, [this](FairMQMessagePtr& msg, int /*index*/) { + OnData(fInChannelName, [this](fair::mq::MessagePtr& msg, int /*index*/) { ++fReceivedMsgs; RootSerializer().Deserialize(*msg, fOutput); fTree.SetBranchAddress("Output", &fOutput); - FairMQMessagePtr ack(fTransportFactory->CreateMessage()); + auto ack(fTransportFactory->CreateMessage()); fChannels.at(fAckChannelName).at(0).Send(ack); fTree.Fill(); diff --git a/examples/advanced/Tutorial3/MQ/processorTask/FairTestDetectorMQRecoTask.h b/examples/advanced/Tutorial3/MQ/processorTask/FairTestDetectorMQRecoTask.h index e506133515..03f16dbe8e 100644 --- a/examples/advanced/Tutorial3/MQ/processorTask/FairTestDetectorMQRecoTask.h +++ b/examples/advanced/Tutorial3/MQ/processorTask/FairTestDetectorMQRecoTask.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -15,9 +15,8 @@ #include "FairTestDetectorPayload.h" #include "FairTestDetectorRecoTask.h" -#include -#include #include +#include template class FairTestDetectorMQRecoTask : public FairMQProcessorTask diff --git a/examples/advanced/Tutorial3/MQ/processorTask/FairTestDetectorMQRecoTaskBin.tpl b/examples/advanced/Tutorial3/MQ/processorTask/FairTestDetectorMQRecoTaskBin.tpl index e9753f34a6..1ab3846e24 100644 --- a/examples/advanced/Tutorial3/MQ/processorTask/FairTestDetectorMQRecoTaskBin.tpl +++ b/examples/advanced/Tutorial3/MQ/processorTask/FairTestDetectorMQRecoTaskBin.tpl @@ -1,3 +1,10 @@ +/******************************************************************************** + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ /* * File: FairTestDetectorMQRecoTask.tpl * Author: winckler diff --git a/examples/advanced/Tutorial3/MQ/processorTask/FairTestDetectorMQRecoTaskBoost.tpl b/examples/advanced/Tutorial3/MQ/processorTask/FairTestDetectorMQRecoTaskBoost.tpl index 9fccf427e5..9dbad58054 100644 --- a/examples/advanced/Tutorial3/MQ/processorTask/FairTestDetectorMQRecoTaskBoost.tpl +++ b/examples/advanced/Tutorial3/MQ/processorTask/FairTestDetectorMQRecoTaskBoost.tpl @@ -1,3 +1,10 @@ +/******************************************************************************** + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ /* * File: FairTestDetectorMQRecoTask.tpl * Author: winckler diff --git a/examples/advanced/Tutorial3/MQ/processorTask/FairTestDetectorMQRecoTaskFlatBuffers.tpl b/examples/advanced/Tutorial3/MQ/processorTask/FairTestDetectorMQRecoTaskFlatBuffers.tpl index af043f5796..165a70774c 100644 --- a/examples/advanced/Tutorial3/MQ/processorTask/FairTestDetectorMQRecoTaskFlatBuffers.tpl +++ b/examples/advanced/Tutorial3/MQ/processorTask/FairTestDetectorMQRecoTaskFlatBuffers.tpl @@ -1,3 +1,10 @@ +/******************************************************************************** + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ // Implementation of FairTestDetectorMQRecoTask::Exec() with Google FlatBuffers transport data format #ifdef FLATBUFFERS diff --git a/examples/advanced/Tutorial3/MQ/processorTask/FairTestDetectorMQRecoTaskMsgpack.tpl b/examples/advanced/Tutorial3/MQ/processorTask/FairTestDetectorMQRecoTaskMsgpack.tpl index 5767664e3f..114c0720a0 100644 --- a/examples/advanced/Tutorial3/MQ/processorTask/FairTestDetectorMQRecoTaskMsgpack.tpl +++ b/examples/advanced/Tutorial3/MQ/processorTask/FairTestDetectorMQRecoTaskMsgpack.tpl @@ -1,3 +1,10 @@ +/******************************************************************************** + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ /** * File: FairTestDetectorMQRecoTaskMsgpack.tpl * @since 2014-12-12 diff --git a/examples/advanced/Tutorial3/MQ/processorTask/FairTestDetectorMQRecoTaskProtobuf.tpl b/examples/advanced/Tutorial3/MQ/processorTask/FairTestDetectorMQRecoTaskProtobuf.tpl index aa15bb8164..346c0bd39c 100644 --- a/examples/advanced/Tutorial3/MQ/processorTask/FairTestDetectorMQRecoTaskProtobuf.tpl +++ b/examples/advanced/Tutorial3/MQ/processorTask/FairTestDetectorMQRecoTaskProtobuf.tpl @@ -1,3 +1,10 @@ +/******************************************************************************** + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ /* * File: FairTestDetectorMQRecoTask.tpl * Author: winckler diff --git a/examples/advanced/Tutorial3/MQ/processorTask/FairTestDetectorMQRecoTaskTMessage.tpl b/examples/advanced/Tutorial3/MQ/processorTask/FairTestDetectorMQRecoTaskTMessage.tpl index 6bdb432264..d131e273af 100644 --- a/examples/advanced/Tutorial3/MQ/processorTask/FairTestDetectorMQRecoTaskTMessage.tpl +++ b/examples/advanced/Tutorial3/MQ/processorTask/FairTestDetectorMQRecoTaskTMessage.tpl @@ -1,3 +1,10 @@ +/******************************************************************************** + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ /* * File: FairTestDetectorMQRecoTask.tpl * Author: winckler diff --git a/examples/advanced/Tutorial3/MQ/run/runTestDetectorFileSink.cxx b/examples/advanced/Tutorial3/MQ/run/runTestDetectorFileSink.cxx index 9b158611f0..902ea15f27 100644 --- a/examples/advanced/Tutorial3/MQ/run/runTestDetectorFileSink.cxx +++ b/examples/advanced/Tutorial3/MQ/run/runTestDetectorFileSink.cxx @@ -1,13 +1,13 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * * copied verbatim in the file "LICENSE" * ********************************************************************************/ +#include "FairRunFairMQDevice.h" #include "FairTestDetectorFileSink.h" -#include "runFairMQDevice.h" namespace bpo = boost::program_options; @@ -21,12 +21,13 @@ void addCustomOptions(bpo::options_description& options) // clang-format on } -FairMQDevicePtr getDevice(const FairMQProgOptions& config) +std::unique_ptr fairGetDevice(const fair::mq::ProgOptions& config) { std::string dataFormat = config.GetValue("data-format"); if (dataFormat == "binary") { - return new FairTestDetectorFileSink; + using Sink = FairTestDetectorFileSink; + return std::unique_ptr(new Sink()); } else if (dataFormat == "boost") { if (fair::base::serialization::has_BoostSerialization; + using Sink = FairTestDetectorFileSink; + return std::unique_ptr(new Sink()); } else if (dataFormat == "tmessage") { - return new FairTestDetectorFileSink; + using Sink = FairTestDetectorFileSink; + return std::unique_ptr(new Sink()); } #ifdef FLATBUFFERS else if (dataFormat == "flatbuffers") { - return new FairTestDetectorFileSink; + using Sink = FairTestDetectorFileSink; + return std::unique_ptr(new Sink()); } #endif #ifdef MSGPACK else if (dataFormat == "msgpack") { - return new FairTestDetectorFileSink; + using Sink = FairTestDetectorFileSink; + return std::unique_ptr(new Sink()); } #endif #ifdef PROTOBUF else if (dataFormat == "protobuf") { - return new FairTestDetectorFileSink; + using Sink = FairTestDetectorFileSink; + return std::unique_ptr(new Sink()); } #endif else { LOG(error) << "No valid data format provided. (--data-format binary|boost|flatbuffers|msgpack|protobuf|tmessage). "; - return nullptr; + return {nullptr}; } } diff --git a/examples/advanced/Tutorial3/MQ/run/runTestDetectorProcessor.cxx b/examples/advanced/Tutorial3/MQ/run/runTestDetectorProcessor.cxx index b06c809bfd..951b231968 100644 --- a/examples/advanced/Tutorial3/MQ/run/runTestDetectorProcessor.cxx +++ b/examples/advanced/Tutorial3/MQ/run/runTestDetectorProcessor.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -7,8 +7,8 @@ ********************************************************************************/ #include "FairMQProcessor.h" +#include "FairRunFairMQDevice.h" #include "FairTestDetectorMQRecoTask.h" -#include "runFairMQDevice.h" namespace bpo = boost::program_options; @@ -22,15 +22,16 @@ void addCustomOptions(bpo::options_description& options) // clang-format on } -FairMQDevicePtr getDevice(const FairMQProgOptions& config) +std::unique_ptr fairGetDevice(const fair::mq::ProgOptions& config) { std::string dataFormat = config.GetValue("data-format"); if (dataFormat == "binary") { - return new FairMQProcessor>; + using Processor = FairMQProcessor>; + return std::unique_ptr(new Processor()); } else if (dataFormat == "boost") { if (fair::base::serialization::has_BoostSerialization>; + using Processor = FairMQProcessor>; + return std::unique_ptr(new Processor()); } else if (dataFormat == "tmessage") { - return new FairMQProcessor< - FairTestDetectorMQRecoTask>; + using Processor = + FairMQProcessor>; + return std::unique_ptr(new Processor()); } #ifdef FLATBUFFERS else if (dataFormat == "flatbuffers") { - return new FairMQProcessor>; + using Processor = FairMQProcessor>; + return std::unique_ptr(new Processor()); } #endif #ifdef MSGPACK else if (dataFormat == "msgpack") { - return new FairMQProcessor< - FairTestDetectorMQRecoTask>; + using Processor = + FairMQProcessor>; + return std::unique_ptr(new Processor()); } #endif #ifdef PROTOBUF else if (dataFormat == "protobuf") { - return new FairMQProcessor>; + using Processor = FairMQProcessor>; + return std::unique_ptr(new Processor()); } #endif else { LOG(error) << "No valid data format provided. (--data-format binary|boost|flatbuffers|msgpack|protobuf|tmessage). "; - return nullptr; + return {nullptr}; } } diff --git a/examples/advanced/Tutorial3/MQ/run/runTestDetectorSampler.cxx b/examples/advanced/Tutorial3/MQ/run/runTestDetectorSampler.cxx index e7f6cdf341..d921e905f5 100644 --- a/examples/advanced/Tutorial3/MQ/run/runTestDetectorSampler.cxx +++ b/examples/advanced/Tutorial3/MQ/run/runTestDetectorSampler.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -7,8 +7,8 @@ ********************************************************************************/ #include "FairMQSampler.h" +#include "FairRunFairMQDevice.h" #include "FairTestDetectorDigiLoader.h" -#include "runFairMQDevice.h" namespace bpo = boost::program_options; @@ -26,12 +26,13 @@ void addCustomOptions(bpo::options_description& options) // clang-format on } -FairMQDevicePtr getDevice(const FairMQProgOptions& config) +std::unique_ptr fairGetDevice(const fair::mq::ProgOptions& config) { std::string dataFormat = config.GetValue("data-format"); if (dataFormat == "binary") { - return new FairMQSampler>; + using Sampler = FairMQSampler>; + return std::unique_ptr(new Sampler()); } else if (dataFormat == "boost") { if (fair::base::serialization::has_BoostSerialization>; + using Sampler = + FairMQSampler>; + return std::unique_ptr(new Sampler()); } else if (dataFormat == "tmessage") { - return new FairMQSampler>; + using Sampler = FairMQSampler>; + return std::unique_ptr(new Sampler()); } #ifdef FLATBUFFERS else if (dataFormat == "flatbuffers") { - return new FairMQSampler>; + using Sampler = FairMQSampler>; + return std::unique_ptr(new Sampler()); } #endif #ifdef MSGPACK else if (dataFormat == "msgpack") { - return new FairMQSampler>; + using Sampler = FairMQSampler>; + return std::unique_ptr(new Sampler()); } #endif #ifdef PROTOBUF else if (dataFormat == "protobuf") { - return new FairMQSampler>; + using Sampler = FairMQSampler>; + return std::unique_ptr(new Sampler()); } #endif else { diff --git a/examples/advanced/Tutorial3/MQ/samplerTask/FairTestDetectorDigiLoader.h b/examples/advanced/Tutorial3/MQ/samplerTask/FairTestDetectorDigiLoader.h index 297cc51bf8..fce29dad2d 100644 --- a/examples/advanced/Tutorial3/MQ/samplerTask/FairTestDetectorDigiLoader.h +++ b/examples/advanced/Tutorial3/MQ/samplerTask/FairTestDetectorDigiLoader.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -18,8 +18,8 @@ #include "FairTestDetectorDigi.h" #include "FairTestDetectorPayload.h" -#include #include +#include #include template diff --git a/examples/advanced/Tutorial3/MQ/samplerTask/FairTestDetectorDigiLoaderBin.tpl b/examples/advanced/Tutorial3/MQ/samplerTask/FairTestDetectorDigiLoaderBin.tpl index 975b71b7d4..33cc739927 100644 --- a/examples/advanced/Tutorial3/MQ/samplerTask/FairTestDetectorDigiLoaderBin.tpl +++ b/examples/advanced/Tutorial3/MQ/samplerTask/FairTestDetectorDigiLoaderBin.tpl @@ -1,3 +1,10 @@ +/******************************************************************************** + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ /* * File: FairTestDetectorDigiLoader.tpl * @since 2014-02-08 @@ -12,7 +19,7 @@ void FairTestDetectorDigiLoader int numEntries = fInput->GetEntriesFast(); size_t digisSize = numEntries * sizeof(TestDetectorPayload::Digi); - fPayload = FairMQMessagePtr(fTransportFactory->CreateMessage(digisSize)); + fPayload = fTransportFactory->CreateMessage(digisSize); TestDetectorPayload::Digi* digiPayload = static_cast(fPayload->GetData()); diff --git a/examples/advanced/Tutorial3/MQ/samplerTask/FairTestDetectorDigiLoaderBoost.tpl b/examples/advanced/Tutorial3/MQ/samplerTask/FairTestDetectorDigiLoaderBoost.tpl index 02ecc1cb65..a61d157bc7 100644 --- a/examples/advanced/Tutorial3/MQ/samplerTask/FairTestDetectorDigiLoaderBoost.tpl +++ b/examples/advanced/Tutorial3/MQ/samplerTask/FairTestDetectorDigiLoaderBoost.tpl @@ -1,3 +1,10 @@ +/******************************************************************************** + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ /* * File: FairTestDetectorDigiLoader.tpl * @since 2014-02-08 @@ -14,6 +21,6 @@ template void FairTestDetectorDigiLoader::Exec(Option_t* /*opt*/) { - fPayload = FairMQMessagePtr(fTransportFactory->CreateMessage()); + fPayload = fTransportFactory->CreateMessage(); BoostSerializer().Serialize(*fPayload, fInput); } diff --git a/examples/advanced/Tutorial3/MQ/samplerTask/FairTestDetectorDigiLoaderFlatBuffers.tpl b/examples/advanced/Tutorial3/MQ/samplerTask/FairTestDetectorDigiLoaderFlatBuffers.tpl index 5d69475af9..4969ceaa33 100644 --- a/examples/advanced/Tutorial3/MQ/samplerTask/FairTestDetectorDigiLoaderFlatBuffers.tpl +++ b/examples/advanced/Tutorial3/MQ/samplerTask/FairTestDetectorDigiLoaderFlatBuffers.tpl @@ -1,3 +1,10 @@ +/******************************************************************************** + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ // Implementation of FairTestDetectorDigiLoader::Exec() with Google FlatBuffers transport data format #ifdef FLATBUFFERS @@ -39,11 +46,11 @@ void FairTestDetectorDigiLoaderCreateMessage( + fPayload = fTransportFactory->CreateMessage( builder->GetBufferPointer(), builder->GetSize(), [](void* /* data */, void* obj) { delete static_cast(obj); }, - builder)); + builder); } #endif /* FLATBUFFERS */ diff --git a/examples/advanced/Tutorial3/MQ/samplerTask/FairTestDetectorDigiLoaderMsgpack.tpl b/examples/advanced/Tutorial3/MQ/samplerTask/FairTestDetectorDigiLoaderMsgpack.tpl index 74579f33cd..d6feb699a4 100644 --- a/examples/advanced/Tutorial3/MQ/samplerTask/FairTestDetectorDigiLoaderMsgpack.tpl +++ b/examples/advanced/Tutorial3/MQ/samplerTask/FairTestDetectorDigiLoaderMsgpack.tpl @@ -1,3 +1,10 @@ +/******************************************************************************** + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ /** * File: FairTestDetectorDigiLoaderMsgpack.tpl * @since 2014-12-12 @@ -34,11 +41,11 @@ void FairTestDetectorDigiLoader::Exec(Option_t* / packer.pack(digis); - fPayload = FairMQMessagePtr(fTransportFactory->CreateMessage( + fPayload = fTransportFactory->CreateMessage( sbuf->data(), sbuf->size(), [](void* /* data */, void* obj) { delete static_cast(obj); }, - sbuf)); + sbuf); } // MsgPackRef version sends the vector of tuples without copying it into the sbuffer @@ -62,8 +69,8 @@ void FairTestDetectorDigiLoader::Exec(Option_t* / // msgpack::pack(container->vbuf, container->digis); -// fPayload = FairMQMessagePtr(fTransportFactory->CreateMessage(container->vbuf.vector()->iov_base, -// container->vbuf.vector()->iov_len, free_vrefbuffer, container)); +// fPayload = fTransportFactory->CreateMessage(container->vbuf.vector()->iov_base, +// container->vbuf.vector()->iov_len, free_vrefbuffer, container); // } // MsgPackStream version copies the data values into a stream of tuples. @@ -81,7 +88,7 @@ void FairTestDetectorDigiLoader::Exec(Option_t* / // packer.pack(std::make_tuple(digi->GetX(), digi->GetY(), digi->GetZ(), digi->GetTimeStamp())); // } -// fPayload = FairMQMessagePtr(fTransportFactory->CreateMessage(sbuf->data(), sbuf->size(), free_sbuffer, sbuf)); +// fPayload = fTransportFactory->CreateMessage(sbuf->data(), sbuf->size(), free_sbuffer, sbuf); // } #endif /* MSGPACK */ diff --git a/examples/advanced/Tutorial3/MQ/samplerTask/FairTestDetectorDigiLoaderProtobuf.tpl b/examples/advanced/Tutorial3/MQ/samplerTask/FairTestDetectorDigiLoaderProtobuf.tpl index a01e130866..3be11d302e 100644 --- a/examples/advanced/Tutorial3/MQ/samplerTask/FairTestDetectorDigiLoaderProtobuf.tpl +++ b/examples/advanced/Tutorial3/MQ/samplerTask/FairTestDetectorDigiLoaderProtobuf.tpl @@ -1,3 +1,10 @@ +/******************************************************************************** + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ /** * File: FairTestDetectorDigiLoader.tpl * @since 2014-02-08 @@ -33,11 +40,11 @@ void FairTestDetectorDigiLoaderCreateMessage( - const_cast(str->c_str()), - str->length(), - [](void* /* data */, void* obj) { delete static_cast(obj); }, - str)); + fPayload = + fTransportFactory->CreateMessage(const_cast(str->c_str()), + str->length(), + [](void* /* data */, void* obj) { delete static_cast(obj); }, + str); } #endif /* PROTOBUF */ diff --git a/examples/advanced/Tutorial3/MQ/samplerTask/FairTestDetectorDigiLoaderTMessage.tpl b/examples/advanced/Tutorial3/MQ/samplerTask/FairTestDetectorDigiLoaderTMessage.tpl index 8c5e2b4e35..ccde3e4061 100644 --- a/examples/advanced/Tutorial3/MQ/samplerTask/FairTestDetectorDigiLoaderTMessage.tpl +++ b/examples/advanced/Tutorial3/MQ/samplerTask/FairTestDetectorDigiLoaderTMessage.tpl @@ -1,3 +1,10 @@ +/******************************************************************************** + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * + * copied verbatim in the file "LICENSE" * + ********************************************************************************/ /* * File: FairTestDetectorDigiLoader.tpl * @since 2014-02-08 @@ -12,6 +19,6 @@ template<> void FairTestDetectorDigiLoader::Exec(Option_t* /*opt*/) { - fPayload = FairMQMessagePtr(fTransportFactory->CreateMessage()); + fPayload = fTransportFactory->CreateMessage(); RootSerializer().Serialize(*fPayload, fInput); } diff --git a/examples/advanced/propagator/src/FairEveRecoTracksExample.cxx b/examples/advanced/propagator/src/FairEveRecoTracksExample.cxx index 4d9cd152ee..ba7c9a2ef3 100644 --- a/examples/advanced/propagator/src/FairEveRecoTracksExample.cxx +++ b/examples/advanced/propagator/src/FairEveRecoTracksExample.cxx @@ -197,23 +197,23 @@ InitStatus FairEveRecoTracksExample::Init() FairRootManager *mngr = FairRootManager::Instance(); fContainerReco = (TClonesArray *)mngr->GetObject("FairTutPropTracks"); if (fContainerReco == nullptr) { - LOG(ERROR) << "Reco traks not found"; + LOG(error) << "Reco traks not found"; return kFATAL; } fHits1 = (TClonesArray *)mngr->GetObject("FairTutPropHits"); fHits2 = (TClonesArray *)mngr->GetObject("FairTutPropHits2"); if (fHits1 == nullptr || fHits2 == nullptr) { - LOG(ERROR) << "Hits not found"; + LOG(error) << "Hits not found"; return kFATAL; } fContainerSim = (TClonesArray *)mngr->GetObject("MCTrack"); if (fContainerSim == nullptr) { - LOG(WARNING) << "No branch with MC tracks"; + LOG(warning) << "No branch with MC tracks"; } FairRunAna *ana = FairRunAna::Instance(); FairField *field = ana->GetField(); if (field == nullptr) { - LOG(ERROR) << "Lack of magnetic field map!"; + LOG(error) << "Lack of magnetic field map!"; field = new FairField(); } fRK = new FairRKPropagator(field); diff --git a/examples/common/eventdisplay/FairEveMCTracks.cxx b/examples/common/eventdisplay/FairEveMCTracks.cxx index 6df954035c..c6c1a084d6 100644 --- a/examples/common/eventdisplay/FairEveMCTracks.cxx +++ b/examples/common/eventdisplay/FairEveMCTracks.cxx @@ -155,7 +155,7 @@ InitStatus FairEveMCTracks::Init() FairRunAna *ana = FairRunAna::Instance(); FairField *field = ana->GetField(); if (field == nullptr) { - LOG(ERROR) << "Lack of magnetic field map!"; + LOG(error) << "Lack of magnetic field map!"; } else { fRK = new FairRKPropagator(field); } diff --git a/examples/common/mcstack/FairStack.cxx b/examples/common/mcstack/FairStack.cxx index ddc7edc59d..2ba1ae129f 100644 --- a/examples/common/mcstack/FairStack.cxx +++ b/examples/common/mcstack/FairStack.cxx @@ -334,7 +334,7 @@ void FairStack::Print(Option_t*) const LOG(info) << "FairStack: Number of primaries = " << fNPrimaries; LOG(info) << " Total number of particles = " << fNParticles; LOG(info) << " Number of tracks in output = " << fNTracks; - if (gLogger->IsLogNeeded(fair::Severity::DEBUG1)) { + if (gLogger->IsLogNeeded(fair::Severity::debug1)) { for (Int_t iTrack = 0; iTrack < fNTracks; iTrack++) { (static_cast(fTracks->At(iTrack))->Print(iTrack)); } diff --git a/examples/simulation/Tutorial4/src/mc/FairTutorialDet4.cxx b/examples/simulation/Tutorial4/src/mc/FairTutorialDet4.cxx index 29782de9c1..29af5a29cf 100644 --- a/examples/simulation/Tutorial4/src/mc/FairTutorialDet4.cxx +++ b/examples/simulation/Tutorial4/src/mc/FairTutorialDet4.cxx @@ -112,9 +112,9 @@ void FairTutorialDet4::SetParContainers() LOG(info) << "Set tutdet missallign parameters"; // Get Base Container FairRun* sim = FairRun::Instance(); - LOG_IF(FATAL, !sim) << "No run object"; + LOG_IF(fatal, !sim) << "No run object"; FairRuntimeDb* rtdb = sim->GetRuntimeDb(); - LOG_IF(FATAL, !rtdb) << "No runtime database"; + LOG_IF(fatal, !rtdb) << "No runtime database"; fMisalignPar = static_cast(rtdb->getContainer("FairTutorialDet4MissallignPar")); } diff --git a/examples/simulation/rutherford/src/FairRutherfordGeo.cxx b/examples/simulation/rutherford/src/FairRutherfordGeo.cxx index e07fedbc09..0ce0a29d9a 100644 --- a/examples/simulation/rutherford/src/FairRutherfordGeo.cxx +++ b/examples/simulation/rutherford/src/FairRutherfordGeo.cxx @@ -29,7 +29,7 @@ const char* FairRutherfordGeo::getModuleName(Int_t m) ASCII file should start with FairRutherford otherwise they will not be constructed */ - sprintf(modName, "rutherford%i", m + 1); + snprintf(modName, sizeof(modName), "rutherford%i", m + 1); return modName; } diff --git a/examples/simulation/rutherford/src/FairRutherfordGeo.h b/examples/simulation/rutherford/src/FairRutherfordGeo.h index ca2dd3d21e..601878209e 100644 --- a/examples/simulation/rutherford/src/FairRutherfordGeo.h +++ b/examples/simulation/rutherford/src/FairRutherfordGeo.h @@ -17,7 +17,7 @@ class FairRutherfordGeo : public FairGeoSet { protected: - char modName[20]; // name of module + char modName[22]; // name of module char eleName[20]; // substring for elements in module public: FairRutherfordGeo(); diff --git a/fairtools/FairMonitor.cxx b/fairtools/FairMonitor.cxx index 9d1cb535d4..e72d4373a5 100644 --- a/fairtools/FairMonitor.cxx +++ b/fairtools/FairMonitor.cxx @@ -296,7 +296,7 @@ void FairMonitor::PrintTask(TTask* tempTask, Int_t taskLevel) const printString.Insert(0, "[\033[43m"); else printString.Insert(0, "[\033[41m"); - LOG(INFO) << printString.Data(); + LOG(info) << printString.Data(); } TList* subTaskList = tempTask->GetListOfTasks(); diff --git a/geobase/FairGeoRootBuilder.cxx b/geobase/FairGeoRootBuilder.cxx index 932c6550ca..7fef0ac41a 100644 --- a/geobase/FairGeoRootBuilder.cxx +++ b/geobase/FairGeoRootBuilder.cxx @@ -127,8 +127,8 @@ Bool_t FairGeoRootBuilder::createNode(FairGeoNode* volu, Int_t hadFormat) tr = new TGeoTranslation(pos.getX(), pos.getY(), pos.getZ()); } else { nRot++; - char b[10]; - sprintf(b, "R%i", nRot); + char b[13]; + snprintf(b, sizeof(b), "R%i", nRot); TGeoRotation* r = new TGeoRotation(b); Double_t a[9]; for (Int_t i = 0; i < 9; i++) { diff --git a/parmq/CMakeLists.txt b/parmq/CMakeLists.txt index e00a1f4bdb..89ae77f63d 100644 --- a/parmq/CMakeLists.txt +++ b/parmq/CMakeLists.txt @@ -1,5 +1,5 @@ ################################################################################ -# Copyright (C) 2014-2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # +# Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # # # # This software is distributed under the terms of the # # GNU Lesser General Public Licence (LGPL) version 3, # @@ -35,8 +35,7 @@ target_link_libraries(${target} PUBLIC FairRoot::BaseMQ # Serialization policies FairRoot::ParBase # FairRuntimeDb, ... FairRoot::FairTools # FairLogger - - FairMQ::FairMQ + FairRoot::FairMQ Core Geom @@ -46,7 +45,7 @@ install(TARGETS ${target} LIBRARY DESTINATION ${PROJECT_INSTALL_LIBDIR}) install(FILES ${headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) add_executable(parmq-server runParameterMQServer.cxx) -target_link_libraries(parmq-server PRIVATE FairRoot::ParMQ FairMQ::FairMQ) +target_link_libraries(parmq-server PRIVATE FairRoot::ParMQ FairRoot::FairMQ) set_target_properties(parmq-server PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/") install(TARGETS parmq-server diff --git a/parmq/ParameterMQServer.cxx b/parmq/ParameterMQServer.cxx index 3f2872dee4..cd0ef934e8 100644 --- a/parmq/ParameterMQServer.cxx +++ b/parmq/ParameterMQServer.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -21,10 +21,10 @@ #include "FairRuntimeDb.h" #include "RootSerializer.h" -#include #include #include #include // getenv +#include using namespace std; @@ -114,7 +114,7 @@ void ParameterMQServer::InitTask() } } -bool ParameterMQServer::ProcessRequest(FairMQMessagePtr& req, int /*index*/) +bool ParameterMQServer::ProcessRequest(fair::mq::MessagePtr& req, int /*index*/) { string parameterName = ""; FairParGenericSet* par = nullptr; @@ -140,19 +140,19 @@ bool ParameterMQServer::ProcessRequest(FairMQMessagePtr& req, int /*index*/) if (par) { par->print(); - FairMQMessagePtr rep(NewMessage()); + auto rep(NewMessage()); RootSerializer().Serialize(*rep, par); if (Send(rep, fRequestChannelName, 0) < 0) { - LOG(ERROR) << "failed sending reply"; + LOG(error) << "failed sending reply"; return false; } } else { - LOG(ERROR) << "Parameter uninitialized! Sending empty message back"; + LOG(error) << "Parameter uninitialized! Sending empty message back"; // Send an empty message back to keep the REQ/REP cycle - FairMQMessagePtr rep(NewMessage()); + auto rep(NewMessage()); if (Send(rep, fRequestChannelName, 0) < 0) { - LOG(ERROR) << "failed sending reply"; + LOG(error) << "failed sending reply"; return false; } } @@ -160,7 +160,7 @@ bool ParameterMQServer::ProcessRequest(FairMQMessagePtr& req, int /*index*/) return true; } -bool ParameterMQServer::ProcessUpdate(FairMQMessagePtr& update, int /*index*/) +bool ParameterMQServer::ProcessUpdate(fair::mq::MessagePtr& update, int /*index*/) { gGeoManager = nullptr; // FairGeoParSet update deletes previous geometry because of resetting gGeoManager, so let's NULL it @@ -212,11 +212,10 @@ bool ParameterMQServer::ProcessUpdate(FairMQMessagePtr& update, int /*index*/) fRtdb->closeOutput(); } - FairMQMessagePtr msg(NewMessage( - const_cast(text->c_str()), - text->length(), - [](void* /*data*/, void* object) { delete static_cast(object); }, - text)); + auto msg(NewMessage(const_cast(text->c_str()), + text->length(), + [](void* /*data*/, void* object) { delete static_cast(object); }, + text)); if (Send(msg, fUpdateChannelName) < 0) { return false; diff --git a/parmq/ParameterMQServer.h b/parmq/ParameterMQServer.h index 0a2ac6541e..51c5a0fe5e 100644 --- a/parmq/ParameterMQServer.h +++ b/parmq/ParameterMQServer.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -15,12 +15,13 @@ #ifndef PARAMETERMQSERVER_H_ #define PARAMETERMQSERVER_H_ -#include +#include "FairMQ.h" // for fair::mq::Message, fair::mq::MessagePtr + #include class FairRuntimeDb; -class ParameterMQServer : public FairMQDevice +class ParameterMQServer : public fair::mq::Device { public: ParameterMQServer(); @@ -32,8 +33,8 @@ class ParameterMQServer : public FairMQDevice virtual void InitTask(); virtual void Init(); - bool ProcessRequest(FairMQMessagePtr&, int); - bool ProcessUpdate(FairMQMessagePtr&, int); + bool ProcessRequest(fair::mq::MessagePtr&, int); + bool ProcessUpdate(fair::mq::MessagePtr&, int); void SetFirstInputName(const std::string& firstInputName) { fFirstInputName = firstInputName; } std::string GetFirstInputName() { return fFirstInputName; } diff --git a/parmq/runParameterMQServer.cxx b/parmq/runParameterMQServer.cxx index 91acf5fb04..1c2a11500d 100644 --- a/parmq/runParameterMQServer.cxx +++ b/parmq/runParameterMQServer.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -12,8 +12,8 @@ * @author D. Klein, A. Rybalchenko */ +#include "FairRunFairMQDevice.h" #include "ParameterMQServer.h" -#include "runFairMQDevice.h" #include @@ -34,4 +34,7 @@ void addCustomOptions(bpo::options_description& options) // clang-format on } -FairMQDevicePtr getDevice(const FairMQProgOptions& /*config*/) { return new ParameterMQServer(); } +std::unique_ptr fairGetDevice(const fair::mq::ProgOptions& /*config*/) +{ + return std::unique_ptr(new ParameterMQServer()); +} diff --git a/templates/project_root_containers/CMakeLists.txt b/templates/project_root_containers/CMakeLists.txt index a021e82a11..9b048abaa9 100644 --- a/templates/project_root_containers/CMakeLists.txt +++ b/templates/project_root_containers/CMakeLists.txt @@ -34,8 +34,6 @@ SET(FAIRROOTPATH $ENV{FAIRROOTPATH}) set(CMAKE_MODULE_PATH "${FAIRROOTPATH}/share/fairbase/cmake/modules_old" ${CMAKE_MODULE_PATH}) set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" ${CMAKE_MODULE_PATH}) -Set(CheckSrcDir "${FAIRROOTPATH}/share/fairbase/cmake/checks") - find_package(FairRoot) # Load some basic macros which are needed later on @@ -155,16 +153,6 @@ SET(_LIBDIR ${CMAKE_BINARY_DIR}/lib) SET(LD_LIBRARY_PATH ${_LIBDIR} ${LD_LIBRARY_PATH}) - -# Check if the compiler support specific C++11 features -# Up to now this is only a check since the code does not use -# any of the features of the new standard -include(CheckCXX11Features) - -IF(HAS_CXX11_SHAREDPOINTER) - Add_Definitions(-DHAS_SHAREDPOINTER) -ENDIF(HAS_CXX11_SHAREDPOINTER) - # Recurse into the given subdirectories. This does not actually # cause another cmake executable to run. The same process will walk through # the project's entire directory structure. diff --git a/templates/project_stl_containers/CMakeLists.txt b/templates/project_stl_containers/CMakeLists.txt index a021e82a11..9b048abaa9 100644 --- a/templates/project_stl_containers/CMakeLists.txt +++ b/templates/project_stl_containers/CMakeLists.txt @@ -34,8 +34,6 @@ SET(FAIRROOTPATH $ENV{FAIRROOTPATH}) set(CMAKE_MODULE_PATH "${FAIRROOTPATH}/share/fairbase/cmake/modules_old" ${CMAKE_MODULE_PATH}) set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" ${CMAKE_MODULE_PATH}) -Set(CheckSrcDir "${FAIRROOTPATH}/share/fairbase/cmake/checks") - find_package(FairRoot) # Load some basic macros which are needed later on @@ -155,16 +153,6 @@ SET(_LIBDIR ${CMAKE_BINARY_DIR}/lib) SET(LD_LIBRARY_PATH ${_LIBDIR} ${LD_LIBRARY_PATH}) - -# Check if the compiler support specific C++11 features -# Up to now this is only a check since the code does not use -# any of the features of the new standard -include(CheckCXX11Features) - -IF(HAS_CXX11_SHAREDPOINTER) - Add_Definitions(-DHAS_SHAREDPOINTER) -ENDIF(HAS_CXX11_SHAREDPOINTER) - # Recurse into the given subdirectories. This does not actually # cause another cmake executable to run. The same process will walk through # the project's entire directory structure.