mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 16:46:47 +00:00
Split serializer policies into serializer and deserializer policies, and change serializer method names message() to SerializeMsg() and DeserializeMsg()
Improve boost serializer performance
This commit is contained in:
parent
6518b7cd41
commit
6d65c4313a
|
@ -16,9 +16,9 @@
|
||||||
template <typename InputPolicy, typename OutputPolicy>
|
template <typename InputPolicy, typename OutputPolicy>
|
||||||
class GenericFileSink : public FairMQDevice, public InputPolicy, public OutputPolicy
|
class GenericFileSink : public FairMQDevice, public InputPolicy, public OutputPolicy
|
||||||
{
|
{
|
||||||
using InputPolicy::message;
|
//using InputPolicy::message;
|
||||||
//using OutputPolicy::InitOutFile;
|
//using OutputPolicy::InitOutFile;
|
||||||
using OutputPolicy::AddToFile;
|
//using OutputPolicy::AddToFile;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GenericFileSink();
|
GenericFileSink();
|
||||||
|
|
|
@ -56,7 +56,7 @@ void GenericFileSink<InputPolicy, OutputPolicy>::Run()
|
||||||
received = fPayloadInputs->at(0)->Receive(msg);
|
received = fPayloadInputs->at(0)->Receive(msg);
|
||||||
if(received>0)
|
if(received>0)
|
||||||
{
|
{
|
||||||
AddToFile(message(msg));
|
OutputPolicy::AddToFile(InputPolicy::DeSerializeMsg(msg));
|
||||||
receivedMsg++;
|
receivedMsg++;
|
||||||
}
|
}
|
||||||
delete msg;
|
delete msg;
|
||||||
|
|
|
@ -58,7 +58,7 @@ class GenericProcessor: public FairMQDevice,
|
||||||
|
|
||||||
void SendPart()
|
void SendPart()
|
||||||
{
|
{
|
||||||
fPayloadOutputs->at(0)->Send(OutputPolicy::message(TaskPolicy::GetData()), "snd-more");
|
fPayloadOutputs->at(0)->Send(OutputPolicy::SerializeMsg(TaskPolicy::GetData()), "snd-more");
|
||||||
OutputPolicy::CloseMessage();
|
OutputPolicy::CloseMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,9 +108,9 @@ class GenericProcessor: public FairMQDevice,
|
||||||
received = fPayloadInputs->at(0)->Receive(msg);
|
received = fPayloadInputs->at(0)->Receive(msg);
|
||||||
receivedMsgs++;
|
receivedMsgs++;
|
||||||
|
|
||||||
// InputPolicy::message(msg) --> deserialize data of msg and fill output container
|
// InputPolicy::DeSerializeMsg(msg) --> deserialize data of msg and fill output container
|
||||||
// TaskPolicy::ExecuteTask( ... ) --> process output container
|
// TaskPolicy::ExecuteTask( ... ) --> process output container
|
||||||
TaskPolicy::ExecuteTask(InputPolicy::message(msg));
|
TaskPolicy::ExecuteTask(InputPolicy::DeSerializeMsg(msg));
|
||||||
|
|
||||||
// OutputPolicy::fMessage point to msg
|
// OutputPolicy::fMessage point to msg
|
||||||
OutputPolicy::SetMessage(msg);
|
OutputPolicy::SetMessage(msg);
|
||||||
|
@ -119,7 +119,7 @@ class GenericProcessor: public FairMQDevice,
|
||||||
{
|
{
|
||||||
// TaskPolicy::GetOutputData() --> Get processed output container
|
// TaskPolicy::GetOutputData() --> Get processed output container
|
||||||
// OutputPolicy::message(...) --> Serialize output container and fill fMessage
|
// OutputPolicy::message(...) --> Serialize output container and fill fMessage
|
||||||
fPayloadOutputs->at(0)->Send(OutputPolicy::message(TaskPolicy::GetOutputData()));
|
fPayloadOutputs->at(0)->Send(OutputPolicy::SerializeMsg(TaskPolicy::GetOutputData()));
|
||||||
sentMsgs++;
|
sentMsgs++;
|
||||||
received = 0;
|
received = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,8 +42,8 @@
|
||||||
template <typename SamplerPolicy, typename OutputPolicy>
|
template <typename SamplerPolicy, typename OutputPolicy>
|
||||||
class GenericSampler: public FairMQDevice, public SamplerPolicy, public OutputPolicy
|
class GenericSampler: public FairMQDevice, public SamplerPolicy, public OutputPolicy
|
||||||
{
|
{
|
||||||
using SamplerPolicy::GetDataBranch; // get data from file
|
//using SamplerPolicy::GetDataBranch; // get data from file
|
||||||
using OutputPolicy::message; // serialize method
|
//using OutputPolicy::message; // serialize method
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum {
|
enum {
|
||||||
|
|
|
@ -62,7 +62,8 @@ void GenericSampler<SamplerPolicy,OutputPolicy>::Run()
|
||||||
//fSamplerTask->SetEventIndex(eventNr);
|
//fSamplerTask->SetEventIndex(eventNr);
|
||||||
FairMQMessage* msg = fTransportFactory->CreateMessage();
|
FairMQMessage* msg = fTransportFactory->CreateMessage();
|
||||||
OutputPolicy::SetMessage(msg);
|
OutputPolicy::SetMessage(msg);
|
||||||
fPayloadOutputs->at(0)->Send(message(GetDataBranch(eventNr)));
|
fPayloadOutputs->at(0)->Send(OutputPolicy::SerializeMsg(
|
||||||
|
SamplerPolicy::GetDataBranch(eventNr)));
|
||||||
++sentMsgs;
|
++sentMsgs;
|
||||||
|
|
||||||
if(msg)
|
if(msg)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user