mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 00:31:14 +00:00
Refactor DDS example and tools to be able to run with/without DDS
This commit is contained in:
parent
dc72912b19
commit
e7ad0d6c34
|
@ -10,6 +10,10 @@ configure_file(${CMAKE_SOURCE_DIR}/examples/MQ/3-dds/ex3-dds-topology.xml ${CMAK
|
|||
configure_file(${CMAKE_SOURCE_DIR}/examples/MQ/3-dds/ex3-dds-hosts.cfg ${CMAKE_BINARY_DIR}/bin/config/ex3-dds-hosts.cfg COPYONLY)
|
||||
configure_file(${CMAKE_SOURCE_DIR}/examples/MQ/3-dds/ex3-dds.json ${CMAKE_BINARY_DIR}/bin/config/ex3-dds.json COPYONLY)
|
||||
|
||||
If(DDS_FOUND)
|
||||
add_definitions(-DDDS_FOUND)
|
||||
EndIf(DDS_FOUND)
|
||||
|
||||
Set(INCLUDE_DIRECTORIES
|
||||
${CMAKE_SOURCE_DIR}/fairmq
|
||||
${CMAKE_SOURCE_DIR}/fairmq/zeromq
|
||||
|
@ -17,7 +21,6 @@ Set(INCLUDE_DIRECTORIES
|
|||
${CMAKE_SOURCE_DIR}/fairmq/devices
|
||||
${CMAKE_SOURCE_DIR}/fairmq/tools
|
||||
${CMAKE_SOURCE_DIR}/fairmq/options
|
||||
${CMAKE_SOURCE_DIR}/fairmq/deployment
|
||||
${CMAKE_SOURCE_DIR}/examples/MQ/3-dds
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
@ -35,7 +38,6 @@ Include_Directories(SYSTEM ${SYSTEM_INCLUDE_DIRECTORIES})
|
|||
Set(LINK_DIRECTORIES
|
||||
${LINK_DIRECTORIES}
|
||||
${Boost_LIBRARY_DIRS}
|
||||
${DDS_LIBRARY_DIR}
|
||||
)
|
||||
|
||||
Link_Directories(${LINK_DIRECTORIES})
|
||||
|
@ -50,7 +52,9 @@ Set(SRCS
|
|||
Set(DEPENDENCIES
|
||||
${DEPENDENCIES}
|
||||
FairMQ
|
||||
dds_intercom_lib
|
||||
${DDS_INTERCOM_LIBRARY_SHARED}
|
||||
${DDS_PROTOCOL_LIBRARY_SHARED} # also link the two DDS dependency libraries to avoid linking issues on some osx systems
|
||||
${DDS_USER_DEFAULTS_LIBRARY_SHARED}
|
||||
)
|
||||
|
||||
set(LIBRARY_NAME FairMQExample3)
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
</declrequirement>
|
||||
|
||||
<decltask id="Sampler">
|
||||
<exe reachable="true">@CMAKE_BINARY_DIR@/bin/ex3-sampler --id sampler --log-color false --mq-config @CMAKE_BINARY_DIR@/bin/config/ex3-dds.json</exe>
|
||||
<exe reachable="true">@CMAKE_BINARY_DIR@/bin/ex3-sampler --id sampler --log-color false --control dds --mq-config @CMAKE_BINARY_DIR@/bin/config/ex3-dds.json</exe>
|
||||
<requirement>SamplerWorker</requirement>
|
||||
<properties>
|
||||
<id access="write">samplerAddr</id>
|
||||
|
@ -24,7 +24,7 @@
|
|||
</decltask>
|
||||
|
||||
<decltask id="Processor">
|
||||
<exe reachable="true">@CMAKE_BINARY_DIR@/bin/ex3-processor --id processor_%taskIndex% --config-key processor --log-color false --mq-config @CMAKE_BINARY_DIR@/bin/config/ex3-dds.json</exe>
|
||||
<exe reachable="true">@CMAKE_BINARY_DIR@/bin/ex3-processor --id processor_%taskIndex% --config-key processor --log-color false --control dds --mq-config @CMAKE_BINARY_DIR@/bin/config/ex3-dds.json</exe>
|
||||
<requirement>ProcessorWorker</requirement>
|
||||
<properties>
|
||||
<id access="read">samplerAddr</id>
|
||||
|
@ -33,7 +33,7 @@
|
|||
</decltask>
|
||||
|
||||
<decltask id="Sink">
|
||||
<exe reachable="true">@CMAKE_BINARY_DIR@/bin/ex3-sink --id sink --log-color false --mq-config @CMAKE_BINARY_DIR@/bin/config/ex3-dds.json</exe>
|
||||
<exe reachable="true">@CMAKE_BINARY_DIR@/bin/ex3-sink --id sink --log-color false --control dds --mq-config @CMAKE_BINARY_DIR@/bin/config/ex3-dds.json</exe>
|
||||
<requirement>SinkWorker</requirement>
|
||||
<properties>
|
||||
<id access="write">sinkAddr</id>
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
*/
|
||||
|
||||
#include "FairMQLogger.h"
|
||||
#include "FairMQDDSTools.h"
|
||||
#include "FairMQProgOptions.h"
|
||||
#include "FairMQExample3Processor.h"
|
||||
#include "runSimpleMQStateMachine.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
@ -25,17 +25,7 @@ int main(int argc, char** argv)
|
|||
config.ParseAll(argc, argv);
|
||||
|
||||
FairMQExample3Processor processor;
|
||||
processor.CatchSignals();
|
||||
processor.SetConfig(config);
|
||||
|
||||
processor.ChangeState("INIT_DEVICE");
|
||||
HandleConfigViaDDS(processor);
|
||||
processor.WaitForEndOfState("INIT_DEVICE");
|
||||
|
||||
processor.ChangeState("INIT_TASK");
|
||||
processor.WaitForEndOfState("INIT_TASK");
|
||||
|
||||
runDDSStateHandler(processor);
|
||||
runStateMachine(processor, config);
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
*/
|
||||
|
||||
#include "FairMQLogger.h"
|
||||
#include "FairMQDDSTools.h"
|
||||
#include "FairMQProgOptions.h"
|
||||
#include "FairMQExample3Sampler.h"
|
||||
#include "runSimpleMQStateMachine.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
@ -25,17 +25,7 @@ int main(int argc, char** argv)
|
|||
config.ParseAll(argc, argv);
|
||||
|
||||
FairMQExample3Sampler sampler;
|
||||
sampler.CatchSignals();
|
||||
sampler.SetConfig(config);
|
||||
|
||||
sampler.ChangeState("INIT_DEVICE");
|
||||
HandleConfigViaDDS(sampler);
|
||||
sampler.WaitForEndOfState("INIT_DEVICE");
|
||||
|
||||
sampler.ChangeState("INIT_TASK");
|
||||
sampler.WaitForEndOfState("INIT_TASK");
|
||||
|
||||
runDDSStateHandler(sampler);
|
||||
runStateMachine(sampler, config);
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
*/
|
||||
|
||||
#include "FairMQLogger.h"
|
||||
#include "FairMQDDSTools.h"
|
||||
#include "FairMQProgOptions.h"
|
||||
#include "FairMQExample3Sink.h"
|
||||
#include "runSimpleMQStateMachine.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
@ -25,17 +25,7 @@ int main(int argc, char** argv)
|
|||
config.ParseAll(argc, argv);
|
||||
|
||||
FairMQExample3Sink sink;
|
||||
sink.CatchSignals();
|
||||
sink.SetConfig(config);
|
||||
|
||||
sink.ChangeState("INIT_DEVICE");
|
||||
HandleConfigViaDDS(sink);
|
||||
sink.WaitForEndOfState("INIT_DEVICE");
|
||||
|
||||
sink.ChangeState("INIT_TASK");
|
||||
sink.WaitForEndOfState("INIT_TASK");
|
||||
|
||||
runDDSStateHandler(sink);
|
||||
runStateMachine(sink, config);
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user