Extend DDS Example to use command interface

This commit is contained in:
Alexey Rybalchenko
2015-11-23 11:28:15 +01:00
committed by Mohammad Al-Turany
parent 837e035457
commit c9c881c33c
13 changed files with 181 additions and 238 deletions

View File

@@ -21,7 +21,6 @@
using namespace std;
FairMQExample3Sampler::FairMQExample3Sampler()
: fText()
{
}
@@ -32,16 +31,15 @@ void FairMQExample3Sampler::CustomCleanup(void *data, void *object)
void FairMQExample3Sampler::Run()
{
// Check if we are still in the RUNNING state
while (CheckCurrentState(RUNNING))
{
boost::this_thread::sleep(boost::posix_time::milliseconds(1000));
string* text = new string(fText);
string* text = new string("Data");
unique_ptr<FairMQMessage> msg(fTransportFactory->CreateMessage(const_cast<char*>(text->c_str()), text->length(), CustomCleanup, text));
LOG(INFO) << "Sending \"" << fText << "\"";
LOG(INFO) << "Sending \"Data\"";
fChannels.at("data-out").at(0).Send(msg);
}
@@ -50,47 +48,3 @@ void FairMQExample3Sampler::Run()
FairMQExample3Sampler::~FairMQExample3Sampler()
{
}
void FairMQExample3Sampler::SetProperty(const int key, const string& value)
{
switch (key)
{
case Text:
fText = value;
break;
default:
FairMQDevice::SetProperty(key, value);
break;
}
}
string FairMQExample3Sampler::GetProperty(const int key, const string& default_ /*= ""*/)
{
switch (key)
{
case Text:
return fText;
break;
default:
return FairMQDevice::GetProperty(key, default_);
}
}
void FairMQExample3Sampler::SetProperty(const int key, const int value)
{
switch (key)
{
default:
FairMQDevice::SetProperty(key, value);
break;
}
}
int FairMQExample3Sampler::GetProperty(const int key, const int default_ /*= 0*/)
{
switch (key)
{
default:
return FairMQDevice::GetProperty(key, default_);
}
}