mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 00:31:14 +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>
|
||||
class GenericFileSink : public FairMQDevice, public InputPolicy, public OutputPolicy
|
||||
{
|
||||
using InputPolicy::message;
|
||||
//using InputPolicy::message;
|
||||
//using OutputPolicy::InitOutFile;
|
||||
using OutputPolicy::AddToFile;
|
||||
//using OutputPolicy::AddToFile;
|
||||
|
||||
public:
|
||||
GenericFileSink();
|
||||
|
|
|
@ -56,7 +56,7 @@ void GenericFileSink<InputPolicy, OutputPolicy>::Run()
|
|||
received = fPayloadInputs->at(0)->Receive(msg);
|
||||
if(received>0)
|
||||
{
|
||||
AddToFile(message(msg));
|
||||
OutputPolicy::AddToFile(InputPolicy::DeSerializeMsg(msg));
|
||||
receivedMsg++;
|
||||
}
|
||||
delete msg;
|
||||
|
|
|
@ -58,7 +58,7 @@ class GenericProcessor: public FairMQDevice,
|
|||
|
||||
void SendPart()
|
||||
{
|
||||
fPayloadOutputs->at(0)->Send(OutputPolicy::message(TaskPolicy::GetData()), "snd-more");
|
||||
fPayloadOutputs->at(0)->Send(OutputPolicy::SerializeMsg(TaskPolicy::GetData()), "snd-more");
|
||||
OutputPolicy::CloseMessage();
|
||||
}
|
||||
|
||||
|
@ -108,9 +108,9 @@ class GenericProcessor: public FairMQDevice,
|
|||
received = fPayloadInputs->at(0)->Receive(msg);
|
||||
receivedMsgs++;
|
||||
|
||||
// InputPolicy::message(msg) --> deserialize data of msg and fill output container
|
||||
// TaskPolicy::ExecuteTask( ... ) --> process output container
|
||||
TaskPolicy::ExecuteTask(InputPolicy::message(msg));
|
||||
// InputPolicy::DeSerializeMsg(msg) --> deserialize data of msg and fill output container
|
||||
// TaskPolicy::ExecuteTask( ... ) --> process output container
|
||||
TaskPolicy::ExecuteTask(InputPolicy::DeSerializeMsg(msg));
|
||||
|
||||
// OutputPolicy::fMessage point to msg
|
||||
OutputPolicy::SetMessage(msg);
|
||||
|
@ -119,7 +119,7 @@ class GenericProcessor: public FairMQDevice,
|
|||
{
|
||||
// TaskPolicy::GetOutputData() --> Get processed output container
|
||||
// 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++;
|
||||
received = 0;
|
||||
}
|
||||
|
|
|
@ -42,8 +42,8 @@
|
|||
template <typename SamplerPolicy, typename OutputPolicy>
|
||||
class GenericSampler: public FairMQDevice, public SamplerPolicy, public OutputPolicy
|
||||
{
|
||||
using SamplerPolicy::GetDataBranch; // get data from file
|
||||
using OutputPolicy::message; // serialize method
|
||||
//using SamplerPolicy::GetDataBranch; // get data from file
|
||||
//using OutputPolicy::message; // serialize method
|
||||
|
||||
public:
|
||||
enum {
|
||||
|
|
|
@ -62,7 +62,8 @@ void GenericSampler<SamplerPolicy,OutputPolicy>::Run()
|
|||
//fSamplerTask->SetEventIndex(eventNr);
|
||||
FairMQMessage* msg = fTransportFactory->CreateMessage();
|
||||
OutputPolicy::SetMessage(msg);
|
||||
fPayloadOutputs->at(0)->Send(message(GetDataBranch(eventNr)));
|
||||
fPayloadOutputs->at(0)->Send(OutputPolicy::SerializeMsg(
|
||||
SamplerPolicy::GetDataBranch(eventNr)));
|
||||
++sentMsgs;
|
||||
|
||||
if(msg)
|
||||
|
|
Loading…
Reference in New Issue
Block a user