Transports: use transportType as static member.

This commit is contained in:
Alexey Rybalchenko 2017-03-14 11:41:56 +01:00 committed by Mohammad Al-Turany
parent b237b3f9d7
commit 3c73c690f7
12 changed files with 24 additions and 15 deletions

View File

@ -22,9 +22,8 @@
using namespace std; using namespace std;
static FairMQ::Transport gTransportType = FairMQ::Transport::NN;
string FairMQMessageNN::fDeviceID = string(); string FairMQMessageNN::fDeviceID = string();
FairMQ::Transport FairMQMessageNN::fTransportType = FairMQ::Transport::NN;
FairMQMessageNN::FairMQMessageNN() FairMQMessageNN::FairMQMessageNN()
: fMessage(nullptr) : fMessage(nullptr)
@ -149,7 +148,7 @@ void FairMQMessageNN::SetDeviceId(const string& deviceId)
FairMQ::Transport FairMQMessageNN::GetType() const FairMQ::Transport FairMQMessageNN::GetType() const
{ {
return gTransportType; return fTransportType;
} }
void FairMQMessageNN::Copy(const unique_ptr<FairMQMessage>& msg) void FairMQMessageNN::Copy(const unique_ptr<FairMQMessage>& msg)

View File

@ -54,6 +54,7 @@ class FairMQMessageNN : public FairMQMessage
size_t fSize; size_t fSize;
bool fReceiving; bool fReceiving;
static std::string fDeviceID; static std::string fDeviceID;
static FairMQ::Transport fTransportType;
void Clear(); void Clear();
}; };

View File

@ -16,7 +16,7 @@
using namespace std; using namespace std;
static FairMQ::Transport gTransportType = FairMQ::Transport::NN; FairMQ::Transport FairMQTransportFactoryNN::fTransportType = FairMQ::Transport::NN;
FairMQTransportFactoryNN::FairMQTransportFactoryNN() FairMQTransportFactoryNN::FairMQTransportFactoryNN()
{ {
@ -60,5 +60,5 @@ FairMQPollerPtr FairMQTransportFactoryNN::CreatePoller(const FairMQSocket& cmdSo
FairMQ::Transport FairMQTransportFactoryNN::GetType() const FairMQ::Transport FairMQTransportFactoryNN::GetType() const
{ {
return gTransportType; return fTransportType;
} }

View File

@ -41,6 +41,9 @@ class FairMQTransportFactoryNN : public FairMQTransportFactory
virtual FairMQ::Transport GetType() const; virtual FairMQ::Transport GetType() const;
virtual ~FairMQTransportFactoryNN() {}; virtual ~FairMQTransportFactoryNN() {};
private:
static FairMQ::Transport fTransportType;
}; };
#endif /* FAIRMQTRANSPORTFACTORYNN_H_ */ #endif /* FAIRMQTRANSPORTFACTORYNN_H_ */

View File

@ -14,11 +14,10 @@
using namespace std; using namespace std;
using namespace FairMQ::shmem; using namespace FairMQ::shmem;
static FairMQ::Transport gTransportType = FairMQ::Transport::SHM;
// uint64_t FairMQMessageSHM::fMessageID = 0; // uint64_t FairMQMessageSHM::fMessageID = 0;
// string FairMQMessageSHM::fDeviceID = string(); // string FairMQMessageSHM::fDeviceID = string();
atomic<bool> FairMQMessageSHM::fInterrupted(false); atomic<bool> FairMQMessageSHM::fInterrupted(false);
FairMQ::Transport FairMQMessageSHM::fTransportType = FairMQ::Transport::SHM;
FairMQMessageSHM::FairMQMessageSHM() FairMQMessageSHM::FairMQMessageSHM()
: fMessage() : fMessage()
@ -234,7 +233,7 @@ void FairMQMessageSHM::SetDeviceId(const string& /*deviceId*/)
FairMQ::Transport FairMQMessageSHM::GetType() const FairMQ::Transport FairMQMessageSHM::GetType() const
{ {
return gTransportType; return fTransportType;
} }
void FairMQMessageSHM::Copy(const unique_ptr<FairMQMessage>& msg) void FairMQMessageSHM::Copy(const unique_ptr<FairMQMessage>& msg)

View File

@ -61,6 +61,7 @@ class FairMQMessageSHM : public FairMQMessage
bool fQueued; bool fQueued;
bool fMetaCreated; bool fMetaCreated;
static std::atomic<bool> fInterrupted; static std::atomic<bool> fInterrupted;
static FairMQ::Transport fTransportType;
bipc::managed_shared_memory::handle_t fHandle; bipc::managed_shared_memory::handle_t fHandle;
size_t fChunkSize; size_t fChunkSize;
void* fLocalPtr; void* fLocalPtr;

View File

@ -12,7 +12,7 @@
using namespace std; using namespace std;
static FairMQ::Transport gTransportType = FairMQ::Transport::SHM; FairMQ::Transport FairMQTransportFactorySHM::fTransportType = FairMQ::Transport::SHM;
FairMQTransportFactorySHM::FairMQTransportFactorySHM() FairMQTransportFactorySHM::FairMQTransportFactorySHM()
{ {
@ -59,6 +59,6 @@ FairMQPollerPtr FairMQTransportFactorySHM::CreatePoller(const FairMQSocket& cmdS
FairMQ::Transport FairMQTransportFactorySHM::GetType() const FairMQ::Transport FairMQTransportFactorySHM::GetType() const
{ {
return gTransportType; return fTransportType;
} }

View File

@ -35,6 +35,9 @@ class FairMQTransportFactorySHM : public FairMQTransportFactory
virtual FairMQ::Transport GetType() const; virtual FairMQ::Transport GetType() const;
virtual ~FairMQTransportFactorySHM() {}; virtual ~FairMQTransportFactorySHM() {};
private:
static FairMQ::Transport fTransportType;
}; };
#endif /* FAIRMQTRANSPORTFACTORYSHM_H_ */ #endif /* FAIRMQTRANSPORTFACTORYSHM_H_ */

View File

@ -20,9 +20,8 @@
using namespace std; using namespace std;
static FairMQ::Transport gTransportType = FairMQ::Transport::ZMQ;
string FairMQMessageZMQ::fDeviceID = string(); string FairMQMessageZMQ::fDeviceID = string();
FairMQ::Transport FairMQMessageZMQ::fTransportType = FairMQ::Transport::ZMQ;
FairMQMessageZMQ::FairMQMessageZMQ() FairMQMessageZMQ::FairMQMessageZMQ()
: fMessage() : fMessage()
@ -105,7 +104,7 @@ void FairMQMessageZMQ::SetDeviceId(const string& deviceId)
FairMQ::Transport FairMQMessageZMQ::GetType() const FairMQ::Transport FairMQMessageZMQ::GetType() const
{ {
return gTransportType; return fTransportType;
} }
void FairMQMessageZMQ::Copy(const unique_ptr<FairMQMessage>& msg) void FairMQMessageZMQ::Copy(const unique_ptr<FairMQMessage>& msg)

View File

@ -52,6 +52,7 @@ class FairMQMessageZMQ : public FairMQMessage
private: private:
zmq_msg_t fMessage; zmq_msg_t fMessage;
static std::string fDeviceID; static std::string fDeviceID;
static FairMQ::Transport fTransportType;
}; };
#endif /* FAIRMQMESSAGEZMQ_H_ */ #endif /* FAIRMQMESSAGEZMQ_H_ */

View File

@ -18,7 +18,7 @@
using namespace std; using namespace std;
static FairMQ::Transport gTransportType = FairMQ::Transport::ZMQ; FairMQ::Transport FairMQTransportFactoryZMQ::fTransportType = FairMQ::Transport::ZMQ;
FairMQTransportFactoryZMQ::FairMQTransportFactoryZMQ() FairMQTransportFactoryZMQ::FairMQTransportFactoryZMQ()
{ {
@ -64,5 +64,5 @@ FairMQPollerPtr FairMQTransportFactoryZMQ::CreatePoller(const FairMQSocket& cmdS
FairMQ::Transport FairMQTransportFactoryZMQ::GetType() const FairMQ::Transport FairMQTransportFactoryZMQ::GetType() const
{ {
return gTransportType; return fTransportType;
} }

View File

@ -42,6 +42,9 @@ class FairMQTransportFactoryZMQ : public FairMQTransportFactory
virtual FairMQ::Transport GetType() const; virtual FairMQ::Transport GetType() const;
virtual ~FairMQTransportFactoryZMQ() {}; virtual ~FairMQTransportFactoryZMQ() {};
private:
static FairMQ::Transport fTransportType;
}; };
#endif /* FAIRMQTRANSPORTFACTORYZMQ_H_ */ #endif /* FAIRMQTRANSPORTFACTORYZMQ_H_ */