use clang-format for Tutorial3

This commit is contained in:
Alexey Rybalchenko
2014-06-06 11:48:52 +02:00
parent 08e603911d
commit c03d4ad6d5
7 changed files with 127 additions and 105 deletions

View File

@@ -12,36 +12,40 @@
boost::shared_ptr<FairMQContextZMQ> FairMQSocketZMQ::fContext = boost::shared_ptr<FairMQContextZMQ>(new FairMQContextZMQ(1));
FairMQSocketZMQ::FairMQSocketZMQ(const string& type, int num, int numIoThreads) :
fBytesTx(0),
fBytesRx(0),
fMessagesTx(0),
fMessagesRx(0)
FairMQSocketZMQ::FairMQSocketZMQ(const string& type, int num, int numIoThreads)
: fBytesTx(0)
, fBytesRx(0)
, fMessagesTx(0)
, fMessagesRx(0)
{
stringstream id;
id << type << "." << num;
fId = id.str();
stringstream id;
id << type << "." << num;
fId = id.str();
int rc = zmq_ctx_set (fContext->GetContext(), ZMQ_IO_THREADS, numIoThreads);
if (rc != 0){
LOG(ERROR) << "failed configuring context, reason: " << zmq_strerror(errno);
}
fSocket = zmq_socket(fContext->GetContext(), GetConstant(type));
rc = zmq_setsockopt(fSocket, ZMQ_IDENTITY, &fId, fId.length());
if (rc != 0) {
LOG(ERROR) << "failed setting socket option, reason: " << zmq_strerror(errno);
}
if (type == "sub") {
rc = zmq_setsockopt(fSocket, ZMQ_SUBSCRIBE, NULL, 0);
if (rc != 0) {
LOG(ERROR) << "failed setting socket option, reason: " << zmq_strerror(errno);
int rc = zmq_ctx_set(fContext->GetContext(), ZMQ_IO_THREADS, numIoThreads);
if (rc != 0)
{
LOG(ERROR) << "failed configuring context, reason: " << zmq_strerror(errno);
}
}
LOG(INFO) << "created socket #" << fId;
fSocket = zmq_socket(fContext->GetContext(), GetConstant(type));
rc = zmq_setsockopt(fSocket, ZMQ_IDENTITY, &fId, fId.length());
if (rc != 0)
{
LOG(ERROR) << "failed setting socket option, reason: " << zmq_strerror(errno);
}
if (type == "sub")
{
rc = zmq_setsockopt(fSocket, ZMQ_SUBSCRIBE, NULL, 0);
if (rc != 0)
{
LOG(ERROR) << "failed setting socket option, reason: " << zmq_strerror(errno);
}
}
LOG(INFO) << "created socket #" << fId;
}
string FairMQSocketZMQ::GetId()