Zero MQ implimentation and example (Tutorial3)

git-svn-id: https://subversion.gsi.de/fairroot/fairbase/trunk@20162 0381ead4-6506-0410-b988-94b70fbc4730
This commit is contained in:
Mohammad Al-Turany
2013-06-07 08:07:48 +00:00
commit 231c7c8f7e
38 changed files with 2596 additions and 0 deletions

47
fairmq/FairMQSocket.h Normal file
View File

@@ -0,0 +1,47 @@
/*
* FairMQSocket.h
*
* Created on: Dec 5, 2012
* Author: dklein
*/
#ifndef FAIRMQSOCKET_H_
#define FAIRMQSOCKET_H_
#include <zmq.hpp>
#include <string>
#include "FairMQContext.h"
#include "FairMQMessage.h"
#include "Rtypes.h"
#include "TString.h"
class FairMQSocket
{
private:
zmq::socket_t* fSocket;
TString fId;
ULong_t fBytesTx;
ULong_t fBytesRx;
ULong_t fMessagesTx;
ULong_t fMessagesRx;
public:
const static TString TCP, IPC, INPROC;
FairMQSocket(FairMQContext* context, Int_t type, Int_t num);
virtual ~FairMQSocket();
TString GetId();
static TString GetTypeString(Int_t type);
Bool_t Send(FairMQMessage* msg);
Bool_t Receive(FairMQMessage* msg);
void Close();
Bool_t Bind(TString address);
Bool_t Connect(TString address);
zmq::socket_t* GetSocket();
ULong_t GetBytesTx();
ULong_t GetBytesRx();
ULong_t GetMessagesTx();
ULong_t GetMessagesRx();
};
#endif /* FAIRMQSOCKET_H_ */