diff --git a/examples/1-1/Sampler.cxx b/examples/1-1/Sampler.cxx index 36f52986..ec3ce45e 100644 --- a/examples/1-1/Sampler.cxx +++ b/examples/1-1/Sampler.cxx @@ -17,8 +17,7 @@ Sampler::Sampler() : fText() , fMaxIterations(0) , fNumIterations(0) -{ -} +{} void Sampler::InitTask() { @@ -32,25 +31,22 @@ bool Sampler::ConditionalRun() // create a copy of the data with new(), that will be deleted after the transfer is complete string* text = new string(fText); - // create message object with a pointer to the data buffer, - // its size, + // create message object with a pointer to the data buffer, its size, // custom deletion function (called when transfer is done), // and pointer to the object managing the data buffer - FairMQMessagePtr msg(NewMessage(const_cast(text->c_str()), - text->length(), - [](void* /*data*/, void* object) { delete static_cast(object); }, - text)); + FairMQMessagePtr msg(NewMessage( + const_cast(text->c_str()), + text->length(), + [](void* /*data*/, void* object) { delete static_cast(object); }, + text)); LOG(info) << "Sending \"" << fText << "\""; - // in case of error or transfer interruption, return false to go to IDLE state + // in case of error or transfer interruption, return false to go to the Ready state // successfull transfer will return number of bytes transfered (can be 0 if sending an empty message). - if (Send(msg, "data") < 0) - { + if (Send(msg, "data") < 0) { return false; - } - else if (fMaxIterations > 0 && ++fNumIterations >= fMaxIterations) - { + } else if (fMaxIterations > 0 && ++fNumIterations >= fMaxIterations) { LOG(info) << "Configured maximum number of iterations reached. Leaving RUNNING state."; return false; } @@ -58,8 +54,6 @@ bool Sampler::ConditionalRun() return true; } -Sampler::~Sampler() -{ -} +Sampler::~Sampler() {} } // namespace example_1_1 diff --git a/examples/1-1/Sink.cxx b/examples/1-1/Sink.cxx index 28f290df..44d95645 100644 --- a/examples/1-1/Sink.cxx +++ b/examples/1-1/Sink.cxx @@ -33,23 +33,22 @@ void Sink::InitTask() fMaxIterations = fConfig->GetProperty("max-iterations"); } -// handler is called whenever a message arrives on "data", with a reference to the message and a sub-channel index (here 0) +// handler is called whenever a message arrives on "data", with a reference to the message and a +// sub-channel index (here 0) bool Sink::HandleData(FairMQMessagePtr& msg, int /*index*/) { LOG(info) << "Received: \"" << string(static_cast(msg->GetData()), msg->GetSize()) << "\""; - if (fMaxIterations > 0 && ++fNumIterations >= fMaxIterations) - { + if (fMaxIterations > 0 && ++fNumIterations >= fMaxIterations) { LOG(info) << "Configured maximum number of iterations reached. Leaving RUNNING state."; return false; } - // return true if want to be called again (otherwise return false go to IDLE state) + // return true if you want the handler to be called again (otherwise return false go to the + // Ready state) return true; } -Sink::~Sink() -{ -} +Sink::~Sink() {} } // namespace example_1_1