mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-17 10:31:46 +00:00
formatting, change and clean generic_sampler and SimpleTreeReader
This commit is contained in:
committed by
Mohammad Al-Turany
parent
d0c20d3729
commit
6ce6887212
@@ -41,7 +41,7 @@
|
||||
* CONTAINER_TYPE source_type::GetOutData() // must be there to compile
|
||||
* source_type::SetFileProperties(Args&... args) // must be there to compile
|
||||
*
|
||||
* void BindSendPart(std::function<void(int)> callback) // enabled if exists
|
||||
* void BindSendHeader(std::function<void(int)> callback) // enabled if exists
|
||||
* void BindGetSocketNumber(std::function<int()> callback) // enabled if exists
|
||||
* void BindGetCurrentIndex(std::function<int()> callback) // enabled if exists
|
||||
*
|
||||
@@ -97,7 +97,7 @@ class base_GenericSampler : public FairMQDevice, public T, public U
|
||||
virtual void SetProperty(const int key, const std::string& value);
|
||||
virtual std::string GetProperty(const int key, const std::string& default_ = "");
|
||||
|
||||
void SendPart(int socketIdx);
|
||||
void SendHeader(int socketIdx=0);
|
||||
int GetSocketNumber() const;
|
||||
int GetCurrentIndex() const;
|
||||
void SetContinuous(bool flag);
|
||||
@@ -158,12 +158,12 @@ class base_GenericSampler : public FairMQDevice, public T, public U
|
||||
|
||||
// automatically enable or disable the call of policy function members for binding of host functions.
|
||||
// this template functions use SFINAE to detect the existence of the policy function signature.
|
||||
template<typename S = source_type,FairMQ::tools::enable_if_hasNot_BindSendPart<S> = 0>
|
||||
template<typename S = source_type,FairMQ::tools::enable_if_hasNot_BindSendHeader<S> = 0>
|
||||
void BindingSendPart() {}
|
||||
template<typename S = source_type,FairMQ::tools::enable_if_has_BindSendPart<S> = 0>
|
||||
template<typename S = source_type,FairMQ::tools::enable_if_has_BindSendHeader<S> = 0>
|
||||
void BindingSendPart()
|
||||
{
|
||||
source_type::BindSendPart(std::bind(&base_GenericSampler::SendPart,this,std::placeholders::_1) );
|
||||
source_type::BindSendHeader(std::bind(&base_GenericSampler::SendPart,this,std::placeholders::_1) );
|
||||
}
|
||||
|
||||
template<typename S = source_type,FairMQ::tools::enable_if_hasNot_BindGetSocketNumber<S> = 0>
|
||||
|
@@ -62,11 +62,6 @@ void base_GenericSampler<T,U,K,L>::Run()
|
||||
p.Send(serialization_type::SerializeMsg(source_type::GetOutData()));
|
||||
sentMsgs++;
|
||||
|
||||
if (fChannels[fOutChanName].size() > 1)
|
||||
{
|
||||
fCurrentIdx++;
|
||||
}
|
||||
|
||||
// Optional event rate limiting
|
||||
// --fEventCounter;
|
||||
// while (fEventCounter == 0) {
|
||||
@@ -78,11 +73,6 @@ void base_GenericSampler<T,U,K,L>::Run()
|
||||
break;
|
||||
}
|
||||
}
|
||||
// if more than one socket, remove the last incrementation
|
||||
if (fChannels[fOutChanName].size() > 1)
|
||||
{
|
||||
fCurrentIdx--;
|
||||
}
|
||||
|
||||
if (!CheckCurrentState(RUNNING))
|
||||
{
|
||||
@@ -99,16 +89,12 @@ void base_GenericSampler<T,U,K,L>::Run()
|
||||
|
||||
|
||||
template <typename T, typename U, typename K, typename L>
|
||||
void base_GenericSampler<T,U,K,L>::SendPart(int socketIdx)
|
||||
void base_GenericSampler<T,U,K,L>::SendHeader(int socketIdx)
|
||||
{
|
||||
fCurrentIdx++;
|
||||
if (fCurrentIdx < fNumEvents)
|
||||
{
|
||||
std::unique_ptr<FairMQMessage> msg(fTransportFactory->CreateMessage());
|
||||
serialization_type::SetMessage(msg.get());
|
||||
source_type::SetIndex(fCurrentIdx);
|
||||
fChannels[fOutChanName].at(socketIdx).Send(serialization_type::SerializeMsg(source_type::GetOutData()), "snd-more");
|
||||
}
|
||||
|
||||
std::unique_ptr<FairMQMessage> msg(fTransportFactory->CreateMessage());
|
||||
serialization_type::SetMessage(msg.get());
|
||||
fChannels.at(fOutChanName).at(socketIdx).Send(serialization_type::SerializeMsg(source_type::GetOutData()), "snd-more");
|
||||
}
|
||||
|
||||
|
||||
|
@@ -64,7 +64,7 @@ CONTAINER_TYPE source_type::GetOutData(); // must be there to compile
|
||||
|
||||
source_type::SetFileProperties(Args&... args); // if called by the host, then must be there to compile
|
||||
|
||||
void source_type::BindSendPart(std::function<void(int)> callback); // enabled if exists
|
||||
void source_type::BindSendHeader(std::function<void(int)> callback); // enabled if exists
|
||||
void source_type::BindGetSocketNumber(std::function<int()> callback); // enabled if exists
|
||||
void source_type::BindGetCurrentIndex(std::function<int()> callback); // enabled if exists
|
||||
```
|
||||
|
Reference in New Issue
Block a user