FairMQ: Remove unused Attach method and unused socket flags

This commit is contained in:
Dennis Klein
2018-02-16 19:38:59 +01:00
committed by Mohammad Al-Turany
parent 3785c0e369
commit 3670dd8835
12 changed files with 117 additions and 183 deletions

View File

@@ -1,16 +1,10 @@
/********************************************************************************
* Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* Copyright (C) 2014-2018 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, *
* copied verbatim in the file "LICENSE" *
********************************************************************************/
/**
* FairMQSocketZMQ.cxx
*
* @since 2012-12-05
* @author D. Klein, A. Rybalchenko
*/
#include "FairMQSocketZMQ.h"
#include "FairMQMessageZMQ.h"
@@ -23,16 +17,13 @@ using namespace std;
atomic<bool> FairMQSocketZMQ::fInterrupted(false);
FairMQSocketZMQ::FairMQSocketZMQ(const string& type, const string& name, const string& id /*= ""*/, void* context)
: FairMQSocket(ZMQ_SNDMORE, ZMQ_RCVMORE, ZMQ_DONTWAIT)
, fSocket(nullptr)
, fId()
: fSocket(nullptr)
, fId(id + "." + name + "." + type)
, fBytesTx(0)
, fBytesRx(0)
, fMessagesTx(0)
, fMessagesRx(0)
{
fId = id + "." + name + "." + type;
assert(context);
fSocket = zmq_socket(context, GetConstant(type));
@@ -111,6 +102,16 @@ void FairMQSocketZMQ::Connect(const string& address)
}
}
int FairMQSocketZMQ::Send(FairMQMessagePtr& msg) { return Send(msg, 0); }
int FairMQSocketZMQ::SendAsync(FairMQMessagePtr& msg) { return Send(msg, ZMQ_DONTWAIT); }
int FairMQSocketZMQ::Receive(FairMQMessagePtr& msg) { return Receive(msg, 0); }
int FairMQSocketZMQ::ReceiveAsync(FairMQMessagePtr& msg) { return Receive(msg, ZMQ_DONTWAIT); }
int64_t FairMQSocketZMQ::Send(std::vector<std::unique_ptr<FairMQMessage>>& msgVec) { return Send(msgVec, 0); }
int64_t FairMQSocketZMQ::SendAsync(std::vector<std::unique_ptr<FairMQMessage>>& msgVec) { return Send(msgVec, ZMQ_DONTWAIT); }
int64_t FairMQSocketZMQ::Receive(std::vector<std::unique_ptr<FairMQMessage>>& msgVec) { return Receive(msgVec, 0); }
int64_t FairMQSocketZMQ::ReceiveAsync(std::vector<std::unique_ptr<FairMQMessage>>& msgVec) { return Receive(msgVec, ZMQ_DONTWAIT); }
int FairMQSocketZMQ::Send(FairMQMessagePtr& msg, const int flags)
{
int nbytes = -1;
@@ -202,7 +203,6 @@ int64_t FairMQSocketZMQ::Send(vector<FairMQMessagePtr>& msgVec, const int flags)
while (true)
{
totalSize = 0;
nbytes = -1;
repeat = false;
for (unsigned int i = 0; i < vecSize; ++i)

View File

@@ -1,16 +1,10 @@
/********************************************************************************
* Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* Copyright (C) 2014-2018 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, *
* copied verbatim in the file "LICENSE" *
********************************************************************************/
/**
* FairMQSocketZMQ.h
*
* @since 2012-12-05
* @author D. Klein, A. Rybalchenko
*/
#ifndef FAIRMQSOCKETZMQ_H_
#define FAIRMQSOCKETZMQ_H_
@@ -29,36 +23,41 @@ class FairMQSocketZMQ : public FairMQSocket
FairMQSocketZMQ(const FairMQSocketZMQ&) = delete;
FairMQSocketZMQ operator=(const FairMQSocketZMQ&) = delete;
virtual std::string GetId();
std::string GetId() override;
virtual bool Bind(const std::string& address);
virtual void Connect(const std::string& address);
bool Bind(const std::string& address) override;
void Connect(const std::string& address) override;
virtual int Send(FairMQMessagePtr& msg, const int flags = 0);
virtual int Receive(FairMQMessagePtr& msg, const int flags = 0);
int Send(FairMQMessagePtr& msg) override;
int SendAsync(FairMQMessagePtr& msg) override;
int Receive(FairMQMessagePtr& msg) override;
int ReceiveAsync(FairMQMessagePtr& msg) override;
virtual int64_t Send(std::vector<std::unique_ptr<FairMQMessage>>& msgVec, const int flags = 0);
virtual int64_t Receive(std::vector<std::unique_ptr<FairMQMessage>>& msgVec, const int flags = 0);
int64_t Send(std::vector<std::unique_ptr<FairMQMessage>>& msgVec) override;
int64_t SendAsync(std::vector<std::unique_ptr<FairMQMessage>>& msgVec) override;
int64_t Receive(std::vector<std::unique_ptr<FairMQMessage>>& msgVec) override;
int64_t ReceiveAsync(std::vector<std::unique_ptr<FairMQMessage>>& msgVec) override;
virtual void* GetSocket() const;
virtual int GetSocket(int nothing) const;
virtual void Close();
void* GetSocket() const override;
int GetSocket(int nothing) const override;
virtual void Interrupt();
virtual void Resume();
void Close() override;
virtual void SetOption(const std::string& option, const void* value, size_t valueSize);
virtual void GetOption(const std::string& option, void* value, size_t* valueSize);
void Interrupt() override;
void Resume() override;
virtual unsigned long GetBytesTx() const;
virtual unsigned long GetBytesRx() const;
virtual unsigned long GetMessagesTx() const;
virtual unsigned long GetMessagesRx() const;
void SetOption(const std::string& option, const void* value, size_t valueSize) override;
void GetOption(const std::string& option, void* value, size_t* valueSize) override;
virtual bool SetSendTimeout(const int timeout, const std::string& address, const std::string& method);
virtual int GetSendTimeout() const;
virtual bool SetReceiveTimeout(const int timeout, const std::string& address, const std::string& method);
virtual int GetReceiveTimeout() const;
unsigned long GetBytesTx() const override;
unsigned long GetBytesRx() const override;
unsigned long GetMessagesTx() const override;
unsigned long GetMessagesRx() const override;
bool SetSendTimeout(const int timeout, const std::string& address, const std::string& method) override;
int GetSendTimeout() const override;
bool SetReceiveTimeout(const int timeout, const std::string& address, const std::string& method) override;
int GetReceiveTimeout() const override;
static int GetConstant(const std::string& constant);
@@ -73,6 +72,11 @@ class FairMQSocketZMQ : public FairMQSocket
std::atomic<unsigned long> fMessagesRx;
static std::atomic<bool> fInterrupted;
int Send(FairMQMessagePtr& msg, const int flags = 0);
int Receive(FairMQMessagePtr& msg, const int flags = 0);
int64_t Send(std::vector<std::unique_ptr<FairMQMessage>>& msgVec, const int flags = 0);
int64_t Receive(std::vector<std::unique_ptr<FairMQMessage>>& msgVec, const int flags = 0);
};
#endif /* FAIRMQSOCKETZMQ_H_ */