mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-12 16:21:13 +00:00
- Avoid polling when only one input channel is used. - Send only handles for shared memory transport. - Avoid waiting in the rate logger thread when nothing to log. - Hide warnings from generated files - Fix #483
82 lines
2.9 KiB
C++
82 lines
2.9 KiB
C++
/********************************************************************************
|
|
* Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
|
|
* *
|
|
* This software is distributed under the terms of the *
|
|
* GNU Lesser General Public Licence version 3 (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_
|
|
|
|
#include <atomic>
|
|
|
|
#include <memory> // unique_ptr
|
|
|
|
#include "FairMQSocket.h"
|
|
#include "FairMQMessage.h"
|
|
#include "FairMQContextZMQ.h"
|
|
|
|
class FairMQSocketZMQ : public FairMQSocket
|
|
{
|
|
public:
|
|
FairMQSocketZMQ(const std::string& type, const std::string& name, const int numIoThreads, const std::string& id = "");
|
|
FairMQSocketZMQ(const FairMQSocketZMQ&) = delete;
|
|
FairMQSocketZMQ operator=(const FairMQSocketZMQ&) = delete;
|
|
|
|
virtual std::string GetId();
|
|
|
|
virtual bool Bind(const std::string& address);
|
|
virtual void Connect(const std::string& address);
|
|
|
|
virtual int Send(FairMQMessagePtr& msg, const int flags = 0);
|
|
virtual int Receive(FairMQMessagePtr& msg, const int flags = 0);
|
|
|
|
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);
|
|
|
|
virtual void* GetSocket() const;
|
|
virtual int GetSocket(int nothing) const;
|
|
virtual void Close();
|
|
virtual void Terminate();
|
|
|
|
virtual void Interrupt();
|
|
virtual void Resume();
|
|
|
|
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);
|
|
|
|
virtual unsigned long GetBytesTx() const;
|
|
virtual unsigned long GetBytesRx() const;
|
|
virtual unsigned long GetMessagesTx() const;
|
|
virtual unsigned long GetMessagesRx() const;
|
|
|
|
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;
|
|
|
|
static int GetConstant(const std::string& constant);
|
|
|
|
virtual ~FairMQSocketZMQ();
|
|
|
|
private:
|
|
void* fSocket;
|
|
std::string fId;
|
|
std::atomic<unsigned long> fBytesTx;
|
|
std::atomic<unsigned long> fBytesRx;
|
|
std::atomic<unsigned long> fMessagesTx;
|
|
std::atomic<unsigned long> fMessagesRx;
|
|
|
|
static std::unique_ptr<FairMQContextZMQ> fContext;
|
|
static std::atomic<bool> fInterrupted;
|
|
};
|
|
|
|
#endif /* FAIRMQSOCKETZMQ_H_ */
|