Commit 30adbcea authored by Pierre-Alain Loizeau's avatar Pierre-Alain Loizeau Committed by Florian Uhlig
Browse files

MQ: Replace copy-paste declaration of message class by base header

parent 21e02957
/* Copyright (C) 2021 Facility for Antiproton and Ion Research in Europe, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: Pierre-Alain Loizeau [committer] */
#ifndef CBMMQTMESSAGE_H_
#define CBMMQTMESSAGE_H_
#include "TMessage.h"
// special class to expose protected TMessage constructor
class CbmMqTMessage : public TMessage {
public:
CbmMqTMessage(void* buf, Int_t len) : TMessage(buf, len) { ResetBit(kIsOwner); }
};
#endif /* CBMMQTMESSAGE_H_ */
......@@ -137,7 +137,7 @@ Bool_t CbmDeviceEventBuilderEtofStar2019::InitContainers()
if (Send(req, "parameters") > 0) {
if (Receive(rep, "parameters") >= 0) {
if (rep->GetSize() != 0) {
CbmMQTMessage tmsg(rep->GetData(), rep->GetSize());
CbmMqTMessage tmsg(rep->GetData(), rep->GetSize());
fUnpackPar = dynamic_cast<CbmStar2019TofPar*>(tmsg.ReadObject(tmsg.GetClass()));
LOG(info) << "Received unpack parameter from parmq server: " << fUnpackPar;
fUnpackPar->Print();
......
......@@ -10,6 +10,8 @@
#ifndef CBMDEVICEEVENTBUILDERETOFSTAR2019_H_
#define CBMDEVICEEVENTBUILDERETOFSTAR2019_H_
#include "CbmMqTMessage.h"
#include "Timeslice.hpp"
#include "FairMQDevice.h"
......@@ -86,10 +88,4 @@ private:
const UInt_t kuBinDumpEndWord = 0xFAEBDEEF;
};
// special class to expose protected TMessage constructor
class CbmMQTMessage : public TMessage {
public:
CbmMQTMessage(void* buf, Int_t len) : TMessage(buf, len) { ResetBit(kIsOwner); }
};
#endif /* CBMDEVICEEVENTBUILDERETOFSTAR2019_H_ */
......@@ -12,6 +12,7 @@
#ifndef CBMDEVICETRIGGERHANDLERETOF_H_
#define CBMDEVICETRIGGERHANDLERETOF_H_
#include "CbmMqTMessage.h"
#include "CbmTofStarData2019.h"
#include "MicrosliceDescriptor.hpp"
......@@ -20,12 +21,10 @@
#include "FairMQDevice.h"
#include "Rtypes.h"
#include "TMessage.h"
#include <map>
#include <vector>
class CbmMQTMessage;
// Relevant TOF classes
extern "C" int star_rhicf_write(unsigned int trg_word, void* dta, int bytes);
......@@ -78,10 +77,4 @@ private:
// histograms
};
// special class to expose protected TMessage constructor
class CbmMQTMessage : public TMessage {
public:
CbmMQTMessage(void* buf, Int_t len) : TMessage(buf, len) { ResetBit(kIsOwner); }
};
#endif /* CBMDEVICETRIGGERHANDLERETOF_H_ */
......@@ -9,6 +9,7 @@ set(INCLUDE_DIRECTORIES
${CBMDATA_DIR}/tof
${CBMBASE_DIR}
${CBMDETECTORBASE_DIR}/tof
${CBMROOT_SOURCE_DIR}/MQ/base
)
Set(SYSTEM_INCLUDE_DIRECTORIES
......@@ -22,7 +23,7 @@ Set(SYSTEM_INCLUDE_DIRECTORIES
${VMC_INCLUDE_DIRS}
${IPC_INCLUDE_DIRECTORY}
${CBMROOT_SOURCE_DIR}/external/cppzmq
${CBMROOT_SOURCE_DIR}/external/cppzmq
${CBMROOT_SOURCE_DIR}/reco/detectors/tof
)
......@@ -74,7 +75,7 @@ set(DEPENDENCIES
CbmBase
CbmData
CbmTofBase
Geom
Geom
Core
MathCore
Tree
......
......@@ -427,7 +427,7 @@ Bool_t CbmDeviceHitBuilderTof::InitContainers()
if (Send(req, Channel) > 0) {
if (Receive(rep, Channel) >= 0) {
if (rep->GetSize() != 0) {
CbmMQTMessage tmsg(rep->GetData(), rep->GetSize());
CbmMqTMessage tmsg(rep->GetData(), rep->GetSize());
switch (iSet) {
case 0:
fDigiPar = static_cast<CbmTofDigiPar*>(tmsg.ReadObject(tmsg.GetClass()));
......
......@@ -12,6 +12,7 @@
#ifndef CBMDEVICEHITBUILDERTOF_H_
#define CBMDEVICEHITBUILDERTOF_H_
#include "CbmMqTMessage.h"
#include "CbmTofAddress.h" // in cbmdata/tof
#include "CbmTofGeoHandler.h" // in tof/TofTools
......@@ -30,7 +31,6 @@
#include <map>
#include <vector>
class CbmMQTMessage;
class CbmHistManager;
// Relevant TOF classes
class CbmTofDigi;
......@@ -286,10 +286,4 @@ private:
TFile* fOutRootFile; // pointer to root output file
};
// special class to expose protected TMessage constructor
class CbmMQTMessage : public TMessage {
public:
CbmMQTMessage(void* buf, Int_t len) : TMessage(buf, len) { ResetBit(kIsOwner); }
};
#endif /* CBMDEVICEHITBUILDERTOF_H_ */
......@@ -26,7 +26,6 @@
/// FAIRSOFT headers (geant, boost, ...)
#include "Rtypes.h"
#include "TMessage.h"
#include "TObjArray.h"
/// C/C++ headers
......@@ -129,11 +128,4 @@ private:
bool SendHistograms();
};
// special class to expose protected TMessage constructor
class CbmMQTMessage : public TMessage {
public:
CbmMQTMessage(void* buf, Int_t len) : TMessage(buf, len) { ResetBit(kIsOwner); }
};
#endif /* CBMDEVICEBUILDRAWEVENTS_H_ */
......@@ -442,7 +442,7 @@ Bool_t CbmDeviceMcbmEventBuilderWin::InitParameters( TList* fParCList )
{
if( 0 != rep->GetSize() )
{
CbmMQTMessage tmsg( rep->GetData(), rep->GetSize() );
CbmMqTMessage tmsg( rep->GetData(), rep->GetSize() );
newObj = static_cast< FairParGenericSet* >( tmsg.ReadObject( tmsg.GetClass() ) );
LOG( info ) << "Received unpack parameter from the server:";
newObj->print();
......
......@@ -14,6 +14,7 @@
/// CBM headers
#include "CbmMcbm2019TimeWinEventBuilderAlgo.h"
#include "CbmMqTMessage.h"
#include "CbmMuchBeamTimeDigi.h"
#include "CbmPsdDigi.h"
#include "CbmRichDigi.h"
......@@ -26,7 +27,6 @@
/// FAIRSOFT headers (geant, boost, ...)
#include "Rtypes.h"
#include "TMessage.h"
#include "TObjArray.h"
/// C/C++ headers
......@@ -134,11 +134,4 @@ private:
bool SendHistograms();
};
// special class to expose protected TMessage constructor
class CbmMQTMessage : public TMessage {
public:
CbmMQTMessage(void* buf, Int_t len) : TMessage(buf, len) { ResetBit(kIsOwner); }
};
#endif /* CBMDEVICEMCBMEVTBUILDERWIN_H_ */
......@@ -302,7 +302,7 @@ Bool_t CbmDeviceMcbmEventSink::InitParameters( TList* fParCList )
{
if( 0 != rep->GetSize() )
{
CbmMQTMessage tmsg( rep->GetData(), rep->GetSize() );
CbmMqTMessage tmsg( rep->GetData(), rep->GetSize() );
newObj = static_cast< FairParGenericSet* >( tmsg.ReadObject( tmsg.GetClass() ) );
LOG( info ) << "Received unpack parameter from the server:";
newObj->print();
......
......@@ -14,6 +14,7 @@
/// CBM headers
#include "CbmEvent.h"
#include "CbmMqTMessage.h"
#include "CbmMuchBeamTimeDigi.h"
#include "CbmPsdDigi.h"
#include "CbmRichDigi.h"
......@@ -29,7 +30,6 @@
/// FAIRSOFT headers (geant, boost, ...)
#include "Rtypes.h"
#include "TClonesArray.h"
#include "TMessage.h"
#include "TObjArray.h"
/// C/C++ headers
......@@ -160,11 +160,4 @@ private:
void Finish();
};
// special class to expose protected TMessage constructor
class CbmMQTMessage : public TMessage {
public:
CbmMQTMessage(void* buf, Int_t len) : TMessage(buf, len) { ResetBit(kIsOwner); }
};
#endif /* CBMDEVICEMCBMEVTSINK_H_ */
......@@ -150,7 +150,7 @@ Bool_t CbmDeviceMcbmMonitorPulser::InitContainers()
if ( Send(req, "parameters") > 0 ) {
if ( Receive( rep, "parameters" ) >= 0) {
if ( rep->GetSize() != 0 ) {
CbmMQTMessage tmsg( rep->GetData(), rep->GetSize() );
CbmMqTMessage tmsg( rep->GetData(), rep->GetSize() );
newObj = static_cast< FairParGenericSet* >( tmsg.ReadObject( tmsg.GetClass() ) );
LOG( info ) << "Received unpack parameter from the server:";
newObj->print();
......
......@@ -12,6 +12,7 @@
#ifndef CBMDEVICEMCBMMONITORPULSER_H_
#define CBMDEVICEMCBMMONITORPULSER_H_
#include "CbmMqTMessage.h"
#include "CbmMuchBeamTimeDigi.h"
#include "CbmPsdDigi.h"
#include "CbmRichDigi.h"
......@@ -22,7 +23,6 @@
#include "FairMQDevice.h"
#include "Rtypes.h"
#include "TMessage.h"
#include "TObjArray.h"
#include <chrono>
......@@ -262,11 +262,4 @@ private:
/*********************** SHOULD GO IN ALGO ****************************/
};
// special class to expose protected TMessage constructor
class CbmMQTMessage : public TMessage {
public:
CbmMQTMessage(void* buf, Int_t len) : TMessage(buf, len) { ResetBit(kIsOwner); }
};
#endif /* CBMDEVICEMCBMMONITORPULSER_H_ */
......@@ -219,7 +219,7 @@ Bool_t CbmDeviceMcbmUnpack::InitParameters(TList* fParCList)
if (Send(req, "parameters") > 0) {
if (Receive(rep, "parameters") >= 0) {
if (0 != rep->GetSize()) {
CbmMQTMessage tmsg(rep->GetData(), rep->GetSize());
CbmMqTMessage tmsg(rep->GetData(), rep->GetSize());
newObj = static_cast<FairParGenericSet*>(tmsg.ReadObject(tmsg.GetClass()));
LOG(info) << "Received unpack parameter from the server:";
newObj->print();
......
......@@ -12,12 +12,13 @@
#ifndef CBMDEVICEMCBMUNPACK_H_
#define CBMDEVICEMCBMUNPACK_H_
#include "CbmMqTMessage.h"
#include "Timeslice.hpp"
#include "FairMQDevice.h"
#include "Rtypes.h"
#include "TMessage.h"
#include "TObjArray.h"
#include <map>
......@@ -101,11 +102,4 @@ private:
bool SendUnpData();
};
// special class to expose protected TMessage constructor
class CbmMQTMessage : public TMessage {
public:
CbmMQTMessage(void* buf, Int_t len) : TMessage(buf, len) { ResetBit(kIsOwner); }
};
#endif /* CBMDEVICEMCBMUNPACK_H_ */
......@@ -165,7 +165,7 @@ Bool_t CbmDeviceMonitorPsd::InitContainers()
if (Send(req, "parameters") > 0) {
if (Receive(rep, "parameters") >= 0) {
if (rep->GetSize() != 0) {
CbmMQTMessage tmsg(rep->GetData(), rep->GetSize());
CbmMqTMessage tmsg(rep->GetData(), rep->GetSize());
newObj = static_cast<FairParGenericSet*>(tmsg.ReadObject(tmsg.GetClass()));
LOG(info) << "Received unpack parameter from the server:";
newObj->print();
......
......@@ -13,12 +13,13 @@
#ifndef CBMDEVICEMONITORPSD_H_
#define CBMDEVICEMONITORPSD_H_
#include "CbmMqTMessage.h"
#include "Timeslice.hpp"
#include "FairMQDevice.h"
#include "Rtypes.h"
#include "TMessage.h"
#include "TObjArray.h"
#include <chrono>
......@@ -95,11 +96,4 @@ private:
bool SendHistograms();
};
// special class to expose protected TMessage constructor
class CbmMQTMessage : public TMessage {
public:
CbmMQTMessage(void* buf, Int_t len) : TMessage(buf, len) { ResetBit(kIsOwner); }
};
#endif /* CBMDEVICEMONITORPSD_H_ */
......@@ -112,7 +112,7 @@ bool CbmDeviceMonitorReqT0::InitContainers()
if (Send(req, "parameters") > 0) {
if (Receive(rep, "parameters") >= 0) {
if (rep->GetSize() != 0) {
CbmMQTMessage tmsg(rep->GetData(), rep->GetSize());
CbmMqTMessage tmsg(rep->GetData(), rep->GetSize());
newObj = static_cast<FairParGenericSet*>(tmsg.ReadObject(tmsg.GetClass()));
LOG(info) << "Received unpack parameter from the server:";
newObj->print();
......
......@@ -5,12 +5,13 @@
#ifndef CBMDEVICEMONITORREQT0_H_
#define CBMDEVICEMONITORREQT0_H_
#include "CbmMqTMessage.h"
#include "Timeslice.hpp"
#include "FairMQDevice.h"
#include "Rtypes.h"
#include "TMessage.h"
#include "TObjArray.h"
#include <chrono>
......@@ -82,11 +83,4 @@ private:
bool SendHistograms();
};
// special class to expose protected TMessage constructor
class CbmMQTMessage : public TMessage {
public:
CbmMQTMessage(void* buf, Int_t len) : TMessage(buf, len) { ResetBit(kIsOwner); }
};
#endif /* CBMDEVICEMONITORREQT0_H_ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment