Extend DDS Example to use command interface

This commit is contained in:
Alexey Rybalchenko
2015-11-23 11:28:15 +01:00
parent 7744d8bc91
commit 90f0e3cb78
13 changed files with 181 additions and 238 deletions

View File

@@ -21,7 +21,6 @@
using namespace std;
FairMQExample3Processor::FairMQExample3Processor()
: fTaskIndex(0)
{
}
@@ -32,7 +31,6 @@ void FairMQExample3Processor::CustomCleanup(void *data, void *object)
void FairMQExample3Processor::Run()
{
// Check if we are still in the RUNNING state
while (CheckCurrentState(RUNNING))
{
// Create empty message to hold the input
@@ -46,7 +44,7 @@ void FairMQExample3Processor::Run()
// Modify the received string
string* text = new string(static_cast<char*>(input->GetData()), input->GetSize());
*text += " (modified by " + fId + to_string(fTaskIndex) + ")";
*text += " (modified by " + fId + ")";
// Create output message
unique_ptr<FairMQMessage> msg(fTransportFactory->CreateMessage(const_cast<char*>(text->c_str()), text->length(), CustomCleanup, text));
@@ -57,50 +55,6 @@ void FairMQExample3Processor::Run()
}
}
void FairMQExample3Processor::SetProperty(const int key, const string& value)
{
switch (key)
{
default:
FairMQDevice::SetProperty(key, value);
break;
}
}
string FairMQExample3Processor::GetProperty(const int key, const string& default_ /*= ""*/)
{
switch (key)
{
default:
return FairMQDevice::GetProperty(key, default_);
}
}
void FairMQExample3Processor::SetProperty(const int key, const int value)
{
switch (key)
{
case TaskIndex:
fTaskIndex = value;
break;
default:
FairMQDevice::SetProperty(key, value);
break;
}
}
int FairMQExample3Processor::GetProperty(const int key, const int default_ /*= 0*/)
{
switch (key)
{
case TaskIndex:
return fTaskIndex;
break;
default:
return FairMQDevice::GetProperty(key, default_);
}
}
FairMQExample3Processor::~FairMQExample3Processor()
{
}