mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 16:46:47 +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-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)
|
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
|
Set(INCLUDE_DIRECTORIES
|
||||||
${CMAKE_SOURCE_DIR}/fairmq
|
${CMAKE_SOURCE_DIR}/fairmq
|
||||||
${CMAKE_SOURCE_DIR}/fairmq/zeromq
|
${CMAKE_SOURCE_DIR}/fairmq/zeromq
|
||||||
|
@ -17,7 +21,6 @@ Set(INCLUDE_DIRECTORIES
|
||||||
${CMAKE_SOURCE_DIR}/fairmq/devices
|
${CMAKE_SOURCE_DIR}/fairmq/devices
|
||||||
${CMAKE_SOURCE_DIR}/fairmq/tools
|
${CMAKE_SOURCE_DIR}/fairmq/tools
|
||||||
${CMAKE_SOURCE_DIR}/fairmq/options
|
${CMAKE_SOURCE_DIR}/fairmq/options
|
||||||
${CMAKE_SOURCE_DIR}/fairmq/deployment
|
|
||||||
${CMAKE_SOURCE_DIR}/examples/MQ/3-dds
|
${CMAKE_SOURCE_DIR}/examples/MQ/3-dds
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
)
|
)
|
||||||
|
@ -35,7 +38,6 @@ Include_Directories(SYSTEM ${SYSTEM_INCLUDE_DIRECTORIES})
|
||||||
Set(LINK_DIRECTORIES
|
Set(LINK_DIRECTORIES
|
||||||
${LINK_DIRECTORIES}
|
${LINK_DIRECTORIES}
|
||||||
${Boost_LIBRARY_DIRS}
|
${Boost_LIBRARY_DIRS}
|
||||||
${DDS_LIBRARY_DIR}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
Link_Directories(${LINK_DIRECTORIES})
|
Link_Directories(${LINK_DIRECTORIES})
|
||||||
|
@ -50,7 +52,9 @@ Set(SRCS
|
||||||
Set(DEPENDENCIES
|
Set(DEPENDENCIES
|
||||||
${DEPENDENCIES}
|
${DEPENDENCIES}
|
||||||
FairMQ
|
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)
|
set(LIBRARY_NAME FairMQExample3)
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
</declrequirement>
|
</declrequirement>
|
||||||
|
|
||||||
<decltask id="Sampler">
|
<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>
|
<requirement>SamplerWorker</requirement>
|
||||||
<properties>
|
<properties>
|
||||||
<id access="write">samplerAddr</id>
|
<id access="write">samplerAddr</id>
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
</decltask>
|
</decltask>
|
||||||
|
|
||||||
<decltask id="Processor">
|
<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>
|
<requirement>ProcessorWorker</requirement>
|
||||||
<properties>
|
<properties>
|
||||||
<id access="read">samplerAddr</id>
|
<id access="read">samplerAddr</id>
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
</decltask>
|
</decltask>
|
||||||
|
|
||||||
<decltask id="Sink">
|
<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>
|
<requirement>SinkWorker</requirement>
|
||||||
<properties>
|
<properties>
|
||||||
<id access="write">sinkAddr</id>
|
<id access="write">sinkAddr</id>
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "FairMQLogger.h"
|
#include "FairMQLogger.h"
|
||||||
#include "FairMQDDSTools.h"
|
|
||||||
#include "FairMQProgOptions.h"
|
#include "FairMQProgOptions.h"
|
||||||
#include "FairMQExample3Processor.h"
|
#include "FairMQExample3Processor.h"
|
||||||
|
#include "runSimpleMQStateMachine.h"
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
@ -25,17 +25,7 @@ int main(int argc, char** argv)
|
||||||
config.ParseAll(argc, argv);
|
config.ParseAll(argc, argv);
|
||||||
|
|
||||||
FairMQExample3Processor processor;
|
FairMQExample3Processor processor;
|
||||||
processor.CatchSignals();
|
runStateMachine(processor, config);
|
||||||
processor.SetConfig(config);
|
|
||||||
|
|
||||||
processor.ChangeState("INIT_DEVICE");
|
|
||||||
HandleConfigViaDDS(processor);
|
|
||||||
processor.WaitForEndOfState("INIT_DEVICE");
|
|
||||||
|
|
||||||
processor.ChangeState("INIT_TASK");
|
|
||||||
processor.WaitForEndOfState("INIT_TASK");
|
|
||||||
|
|
||||||
runDDSStateHandler(processor);
|
|
||||||
}
|
}
|
||||||
catch (std::exception& e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "FairMQLogger.h"
|
#include "FairMQLogger.h"
|
||||||
#include "FairMQDDSTools.h"
|
|
||||||
#include "FairMQProgOptions.h"
|
#include "FairMQProgOptions.h"
|
||||||
#include "FairMQExample3Sampler.h"
|
#include "FairMQExample3Sampler.h"
|
||||||
|
#include "runSimpleMQStateMachine.h"
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
@ -25,17 +25,7 @@ int main(int argc, char** argv)
|
||||||
config.ParseAll(argc, argv);
|
config.ParseAll(argc, argv);
|
||||||
|
|
||||||
FairMQExample3Sampler sampler;
|
FairMQExample3Sampler sampler;
|
||||||
sampler.CatchSignals();
|
runStateMachine(sampler, config);
|
||||||
sampler.SetConfig(config);
|
|
||||||
|
|
||||||
sampler.ChangeState("INIT_DEVICE");
|
|
||||||
HandleConfigViaDDS(sampler);
|
|
||||||
sampler.WaitForEndOfState("INIT_DEVICE");
|
|
||||||
|
|
||||||
sampler.ChangeState("INIT_TASK");
|
|
||||||
sampler.WaitForEndOfState("INIT_TASK");
|
|
||||||
|
|
||||||
runDDSStateHandler(sampler);
|
|
||||||
}
|
}
|
||||||
catch (std::exception& e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "FairMQLogger.h"
|
#include "FairMQLogger.h"
|
||||||
#include "FairMQDDSTools.h"
|
|
||||||
#include "FairMQProgOptions.h"
|
#include "FairMQProgOptions.h"
|
||||||
#include "FairMQExample3Sink.h"
|
#include "FairMQExample3Sink.h"
|
||||||
|
#include "runSimpleMQStateMachine.h"
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
@ -25,17 +25,7 @@ int main(int argc, char** argv)
|
||||||
config.ParseAll(argc, argv);
|
config.ParseAll(argc, argv);
|
||||||
|
|
||||||
FairMQExample3Sink sink;
|
FairMQExample3Sink sink;
|
||||||
sink.CatchSignals();
|
runStateMachine(sink, config);
|
||||||
sink.SetConfig(config);
|
|
||||||
|
|
||||||
sink.ChangeState("INIT_DEVICE");
|
|
||||||
HandleConfigViaDDS(sink);
|
|
||||||
sink.WaitForEndOfState("INIT_DEVICE");
|
|
||||||
|
|
||||||
sink.ChangeState("INIT_TASK");
|
|
||||||
sink.WaitForEndOfState("INIT_TASK");
|
|
||||||
|
|
||||||
runDDSStateHandler(sink);
|
|
||||||
}
|
}
|
||||||
catch (std::exception& e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user