From a3125d0e906b6f5a22cc183248b7087851bad450 Mon Sep 17 00:00:00 2001 From: matzman Date: Mon, 25 May 2015 16:04:58 +0200 Subject: [PATCH] . --- src/hos_celix/CMakeLists.txt | 144 +--------- src/hos_core_msgs/CMakeLists.txt | 123 +-------- src/hos_core_types/CMakeLists.txt | 143 +--------- .../hos/cosgi/service/Interface.h | 4 - src/hos_cosgi_core/src/launcher.cpp | 2 +- src/hos_cosgi_devicerepository/CMakeLists.txt | 142 ++-------- src/hos_cosgi_devicerepository/Doxyfile.in | 248 ++++++++++++++++++ .../DeviceRepositoryServiceImpl.h | 6 +- src/hos_cosgi_ruleengine/CMakeLists.txt | 147 ++--------- src/hos_cosgi_ruleengine/Doxyfile.in | 248 ++++++++++++++++++ .../service/ruleengine/RuleEngineService.h | 32 +++ .../hos/cosgi/service/ruleengine/rules/Rule.h | 7 - .../rules/conditions/RuleConditionImpl.h | 4 +- .../src/BundleActivator.cpp | 68 +++-- .../ruleengine/RuleEngineServiceImpl.cpp | 106 +++++--- .../ruleengine/RuleEngineServiceImpl.h | 88 +++---- .../service/ruleengine/rules/RuleImpl.cpp | 37 +-- .../cosgi/service/ruleengine/rules/RuleImpl.h | 80 +++--- .../ruleengine/rules/RulePackageImpl.cpp | 38 +-- .../ruleengine/rules/RulePackageImpl.h | 93 ++++--- .../rules/conditions/DeviceMsgCondition.cpp | 11 +- .../rules/conditions/DeviceMsgCondition.h | 2 +- src/hos_cosgi_ruleengine/test/rulepkg01.json | 18 +- src/hos_cosgi_scripting/CMakeLists.txt | 151 ++--------- src/hos_cosgi_scripting/Doxyfile.in | 247 +++++++++++++++++ src/hos_cosgi_scripting_python/CMakeLists.txt | 189 ++++--------- src/hos_cosgi_scripting_python/Doxyfile.in | 247 +++++++++++++++++ .../src/BundleActivator.cpp | 2 +- .../python/PyScriptingServiceImpl.cpp | 12 +- .../scripting/python/PyScriptingServiceImpl.h | 6 +- .../scripting/python/hosapi/PyHOSAPI.h | 8 +- .../service/scripting/python/utils/utils.cpp | 6 +- src/hos_cosgi_webserver/CMakeLists.txt | 154 ++--------- src/hos_cosgi_webserver/Doxyfile.in | 248 ++++++++++++++++++ src/hos_cpp_cron/CMakeLists.txt | 13 + src/hos_cpp_utils/CMakeLists.txt | 149 ++--------- src/hos_cpp_utils/Doxyfile.in | 248 ++++++++++++++++++ src/hos_deps/CMakeLists.txt | 14 +- src/hos_dummy/CMakeLists.txt | 12 + src/hos_launch/CMakeLists.txt | 12 + src/hos_philips_hue/CMakeLists.txt | 13 + src/hos_python_utils/CMakeLists.txt | 12 + 42 files changed, 2094 insertions(+), 1440 deletions(-) create mode 100644 src/hos_cosgi_devicerepository/Doxyfile.in create mode 100644 src/hos_cosgi_ruleengine/Doxyfile.in create mode 100644 src/hos_cosgi_scripting/Doxyfile.in create mode 100644 src/hos_cosgi_scripting_python/Doxyfile.in create mode 100644 src/hos_cosgi_webserver/Doxyfile.in create mode 100644 src/hos_cpp_utils/Doxyfile.in diff --git a/src/hos_celix/CMakeLists.txt b/src/hos_celix/CMakeLists.txt index 72044ca6..7360dd14 100644 --- a/src/hos_celix/CMakeLists.txt +++ b/src/hos_celix/CMakeLists.txt @@ -1,94 +1,26 @@ cmake_minimum_required(VERSION 2.8.3) project(hos_celix) + ## Find catkin macros and libraries -## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) -## is used, also find other catkin packages find_package(catkin REQUIRED) -## System dependencies are found with CMake's conventions -# find_package(Boost REQUIRED COMPONENTS system) - - -## Uncomment this if the package has a setup.py. This macro ensures -## modules and global scripts declared therein get installed -## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html -# catkin_python_setup() - -################################################ -## Declare ROS messages, services and actions ## -################################################ - -## To declare and build messages, services or actions from within this -## package, follow these steps: -## * Let MSG_DEP_SET be the set of packages whose message types you use in -## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...). -## * In the file package.xml: -## * add a build_depend and a run_depend tag for each package in MSG_DEP_SET -## * If MSG_DEP_SET isn't empty the following dependencies might have been -## pulled in transitively but can be declared for certainty nonetheless: -## * add a build_depend tag for "message_generation" -## * add a run_depend tag for "message_runtime" -## * In this file (CMakeLists.txt): -## * add "message_generation" and every package in MSG_DEP_SET to -## find_package(catkin REQUIRED COMPONENTS ...) -## * add "message_runtime" and every package in MSG_DEP_SET to -## catkin_package(CATKIN_DEPENDS ...) -## * uncomment the add_*_files sections below as needed -## and list every .msg/.srv/.action file to be processed -## * uncomment the generate_messages entry below -## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...) - -## Generate messages in the 'msg' folder -# add_message_files( -# FILES -# Message1.msg -# Message2.msg -# ) - -## Generate services in the 'srv' folder -# add_service_files( -# FILES -# Service1.srv -# Service2.srv -# ) - -## Generate actions in the 'action' folder -# add_action_files( -# FILES -# Action1.action -# Action2.action -# ) - -## Generate added messages and services with any dependencies listed here -# generate_messages( -# DEPENDENCIES -# std_msgs # Or other packages containing msgs -# ) - ################################### ## catkin specific configuration ## ################################### -## The catkin_package macro generates cmake config files for your package -## Declare things to be passed to dependent projects -## INCLUDE_DIRS: uncomment this if you package contains header files -## LIBRARIES: libraries you create in this project that dependent projects also need -## CATKIN_DEPENDS: catkin_packages dependent projects also need -## DEPENDS: system dependencies of this project that dependent projects also need + catkin_package( INCLUDE_DIRS include/${PROJECT_NAME}/ LIBRARIES celix_framework celix_utils dependency_manager2 CFG_EXTRAS celix-extras.cmake -# CATKIN_DEPENDS other_catkin_pkg -# DEPENDS system_lib ) + ########### ## Build ## ########### - include(ExternalProject) ExternalProject_Add( celix_project @@ -125,28 +57,6 @@ set_property( TARGET dependency_manager2 PROPERTY IMPORTED_LOCATION "${CATKIN_DE add_dependencies( dependency_manager2 celix_project ) - -## Specify additional locations of header files -## Your package locations should be listed before other locations -# include_directories(include) - -## Declare a cpp library -# add_library(hos_celix -# src/${PROJECT_NAME}/hos_celix.cpp -# ) - -## Declare a cpp executable -# add_executable(hos_celix_node src/hos_celix_node.cpp) - -## Add cmake target dependencies of the executable/library -## as an example, message headers may need to be generated before nodes -# add_dependencies(hos_celix_node hos_celix_generate_messages_cpp) - -## Specify libraries to link a library or executable target against -# target_link_libraries(hos_celix_node -# ${catkin_LIBRARIES} -# ) - ############# ## Install ## ############# @@ -169,46 +79,14 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cmake/ # FILES_MATCHING PATTERN "*.cmake" ) -# all install targets should use catkin DESTINATION variables -# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html -## Mark executable scripts (Python etc.) for installation -## in contrast to setup.py, you can choose the destination -# install(PROGRAMS -# scripts/my_python_script -# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} -# ) +################### +## Documentation ## +################### -## Mark executables and/or libraries for installation -# install(TARGETS hos_celix hos_celix_node -# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} -# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} -# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} -# ) +# We have no documentation, so we create an empty target +find_package(Doxygen) +if(DOXYGEN_FOUND) + add_custom_target(doc) +endif(DOXYGEN_FOUND) -## Mark cpp header files for installation -# install(DIRECTORY include/${PROJECT_NAME}/ -# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} -# FILES_MATCHING PATTERN "*.h" -# PATTERN ".svn" EXCLUDE -# ) - -## Mark other files for installation (e.g. launch and bag files, etc.) -# install(FILES -# # myfile1 -# # myfile2 -# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} -# ) - -############# -## Testing ## -############# - -## Add gtest based cpp test target and link libraries -# catkin_add_gtest(${PROJECT_NAME}-test test/test_hos_celix.cpp) -# if(TARGET ${PROJECT_NAME}-test) -# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME}) -# endif() - -## Add folders to be run by python nosetests -# catkin_add_nosetests(test) diff --git a/src/hos_core_msgs/CMakeLists.txt b/src/hos_core_msgs/CMakeLists.txt index b241d21f..c67740e2 100644 --- a/src/hos_core_msgs/CMakeLists.txt +++ b/src/hos_core_msgs/CMakeLists.txt @@ -2,45 +2,15 @@ cmake_minimum_required(VERSION 2.8.3) project(hos_core_msgs) ## Find catkin macros and libraries -## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) -## is used, also find other catkin packages find_package(catkin REQUIRED COMPONENTS message_generation ) -## System dependencies are found with CMake's conventions -# find_package(Boost REQUIRED COMPONENTS system) - - -## Uncomment this if the package has a setup.py. This macro ensures -## modules and global scripts declared therein get installed -## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html -# catkin_python_setup() ################################################ ## Declare ROS messages, services and actions ## ################################################ -## To declare and build messages, services or actions from within this -## package, follow these steps: -## * Let MSG_DEP_SET be the set of packages whose message types you use in -## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...). -## * In the file package.xml: -## * add a build_depend and a run_depend tag for each package in MSG_DEP_SET -## * If MSG_DEP_SET isn't empty the following dependencies might have been -## pulled in transitively but can be declared for certainty nonetheless: -## * add a build_depend tag for "message_generation" -## * add a run_depend tag for "message_runtime" -## * In this file (CMakeLists.txt): -## * add "message_generation" and every package in MSG_DEP_SET to -## find_package(catkin REQUIRED COMPONENTS ...) -## * add "message_runtime" and every package in MSG_DEP_SET to -## catkin_package(CATKIN_DEPENDS ...) -## * uncomment the add_*_files sections below as needed -## and list every .msg/.srv/.action file to be processed -## * uncomment the generate_messages entry below -## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...) - ## Generate messages in the 'msg' folder add_message_files( DIRECTORY msg @@ -50,114 +20,41 @@ add_message_files( HosStatusUpdate.msg ) -## Generate services in the 'srv' folder -# add_service_files( -# FILES -# Service1.srv -# Service2.srv -# ) - -## Generate actions in the 'action' folder -# add_action_files( -# FILES -# Action1.action -# Action2.action -# ) - ## Generate added messages and services with any dependencies listed here generate_messages( # DEPENDENCIES # std_msgs # Or other packages containing msgs ) + ################################### ## catkin specific configuration ## ################################### -## The catkin_package macro generates cmake config files for your package -## Declare things to be passed to dependent projects -## INCLUDE_DIRS: uncomment this if you package contains header files -## LIBRARIES: libraries you create in this project that dependent projects also need -## CATKIN_DEPENDS: catkin_packages dependent projects also need -## DEPENDS: system dependencies of this project that dependent projects also need + catkin_package( INCLUDE_DIRS include -# LIBRARIES hos_core_msgs CATKIN_DEPENDS message_runtime -# DEPENDS system_lib ) -########### -## Build ## -########### - -## Specify additional locations of header files -## Your package locations should be listed before other locations -# include_directories(include) -include_directories( - ${catkin_INCLUDE_DIRS} -) - -## Declare a cpp library -# add_library(hos_core_msgs -# src/${PROJECT_NAME}/hos_core_msgs.cpp -# ) - -## Declare a cpp executable -# add_executable(hos_core_msgs_node src/hos_core_msgs_node.cpp) - -## Add cmake target dependencies of the executable/library -## as an example, message headers may need to be generated before nodes -# add_dependencies(hos_core_msgs_node hos_core_msgs_generate_messages_cpp) - -## Specify libraries to link a library or executable target against -# target_link_libraries(hos_core_msgs_node -# ${catkin_LIBRARIES} -# ) ############# ## Install ## ############# -# all install targets should use catkin DESTINATION variables -# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html - -## Mark executable scripts (Python etc.) for installation -## in contrast to setup.py, you can choose the destination -# install(PROGRAMS -# scripts/my_python_script -# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} -# ) - -## Mark executables and/or libraries for installation -# install(TARGETS hos_core_msgs hos_core_msgs_node -# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} -# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} -# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} -# ) - ## Mark cpp header files for installation install(DIRECTORY include/${PROJECT_NAME}/ DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} FILES_MATCHING PATTERN "*.h" - PATTERN ".svn" EXCLUDE ) -## Mark other files for installation (e.g. launch and bag files, etc.) -# install(FILES -# # myfile1 -# # myfile2 -# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} -# ) -############# -## Testing ## -############# +################### +## Documentation ## +################### -## Add gtest based cpp test target and link libraries -# catkin_add_gtest(${PROJECT_NAME}-test test/test_hos_core_msgs.cpp) -# if(TARGET ${PROJECT_NAME}-test) -# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME}) -# endif() +# We have no documentation, so we create an empty target +find_package(Doxygen) +if(DOXYGEN_FOUND) + add_custom_target(doc) +endif(DOXYGEN_FOUND) -## Add folders to be run by python nosetests -# catkin_add_nosetests(test) diff --git a/src/hos_core_types/CMakeLists.txt b/src/hos_core_types/CMakeLists.txt index eea7a3af..3eb86a7d 100644 --- a/src/hos_core_types/CMakeLists.txt +++ b/src/hos_core_types/CMakeLists.txt @@ -2,110 +2,15 @@ cmake_minimum_required(VERSION 2.8.3) project(hos_core_types) ## Find catkin macros and libraries -## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) -## is used, also find other catkin packages find_package(catkin REQUIRED) -## System dependencies are found with CMake's conventions -# find_package(Boost REQUIRED COMPONENTS system) - - -## Uncomment this if the package has a setup.py. This macro ensures -## modules and global scripts declared therein get installed -## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html -# catkin_python_setup() - -################################################ -## Declare ROS messages, services and actions ## -################################################ - -## To declare and build messages, services or actions from within this -## package, follow these steps: -## * Let MSG_DEP_SET be the set of packages whose message types you use in -## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...). -## * In the file package.xml: -## * add a build_depend and a run_depend tag for each package in MSG_DEP_SET -## * If MSG_DEP_SET isn't empty the following dependencies might have been -## pulled in transitively but can be declared for certainty nonetheless: -## * add a build_depend tag for "message_generation" -## * add a run_depend tag for "message_runtime" -## * In this file (CMakeLists.txt): -## * add "message_generation" and every package in MSG_DEP_SET to -## find_package(catkin REQUIRED COMPONENTS ...) -## * add "message_runtime" and every package in MSG_DEP_SET to -## catkin_package(CATKIN_DEPENDS ...) -## * uncomment the add_*_files sections below as needed -## and list every .msg/.srv/.action file to be processed -## * uncomment the generate_messages entry below -## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...) - -## Generate messages in the 'msg' folder -# add_message_files( -# FILES -# Message1.msg -# Message2.msg -# ) - -## Generate services in the 'srv' folder -# add_service_files( -# FILES -# Service1.srv -# Service2.srv -# ) - -## Generate actions in the 'action' folder -# add_action_files( -# FILES -# Action1.action -# Action2.action -# ) - -## Generate added messages and services with any dependencies listed here -# generate_messages( -# DEPENDENCIES -# std_msgs # Or other packages containing msgs -# ) ################################### ## catkin specific configuration ## ################################### -## The catkin_package macro generates cmake config files for your package -## Declare things to be passed to dependent projects -## INCLUDE_DIRS: uncomment this if you package contains header files -## LIBRARIES: libraries you create in this project that dependent projects also need -## CATKIN_DEPENDS: catkin_packages dependent projects also need -## DEPENDS: system dependencies of this project that dependent projects also need catkin_package( -# INCLUDE_DIRS include -# LIBRARIES hos_core_types -# CATKIN_DEPENDS other_catkin_pkg -# DEPENDS system_lib ) -########### -## Build ## -########### - -## Specify additional locations of header files -## Your package locations should be listed before other locations -# include_directories(include) - -## Declare a cpp library -# add_library(hos_core_types -# src/${PROJECT_NAME}/hos_core_types.cpp -# ) - -## Declare a cpp executable -# add_executable(hos_core_types src/hos_core_types_node.cpp) - -## Add cmake target dependencies of the executable/library -## as an example, message headers may need to be generated before nodes -# add_dependencies(hos_core_types_node hos_core_types_generate_messages_cpp) - -## Specify libraries to link a library or executable target against -# target_link_libraries(hos_core_types_node -# ${catkin_LIBRARIES} -# ) ############# ## Install ## @@ -117,46 +22,14 @@ foreach(dir launch schema) ) endforeach(dir) -# all install targets should use catkin DESTINATION variables -# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html -## Mark executable scripts (Python etc.) for installation -## in contrast to setup.py, you can choose the destination -# install(PROGRAMS -# scripts/my_python_script -# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} -# ) +################### +## Documentation ## +################### -## Mark executables and/or libraries for installation -# install(TARGETS hos_core_types hos_core_types_node -# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} -# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} -# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} -# ) +# We have no documentation, so we create an empty target +find_package(Doxygen) +if(DOXYGEN_FOUND) + add_custom_target(doc) +endif(DOXYGEN_FOUND) -## Mark cpp header files for installation -# install(DIRECTORY include/${PROJECT_NAME}/ -# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} -# FILES_MATCHING PATTERN "*.h" -# PATTERN ".svn" EXCLUDE -# ) - -## Mark other files for installation (e.g. launch and bag files, etc.) -# install(FILES -# # myfile1 -# # myfile2 -# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} -# ) - -############# -## Testing ## -############# - -## Add gtest based cpp test target and link libraries -# catkin_add_gtest(${PROJECT_NAME}-test test/test_hos_core_types.cpp) -# if(TARGET ${PROJECT_NAME}-test) -# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME}) -# endif() - -## Add folders to be run by python nosetests -# catkin_add_nosetests(test) diff --git a/src/hos_cosgi_core/include/hos_cosgi_core/hos/cosgi/service/Interface.h b/src/hos_cosgi_core/include/hos_cosgi_core/hos/cosgi/service/Interface.h index 5e81173a..463e047c 100644 --- a/src/hos_cosgi_core/include/hos_cosgi_core/hos/cosgi/service/Interface.h +++ b/src/hos_cosgi_core/include/hos_cosgi_core/hos/cosgi/service/Interface.h @@ -24,10 +24,6 @@ namespace interface { class Object { public: virtual ~Object() {} - - template T* castPtr() { - return dynamic_cast(this); - } }; diff --git a/src/hos_cosgi_core/src/launcher.cpp b/src/hos_cosgi_core/src/launcher.cpp index 7d0fe4bb..703dc261 100644 --- a/src/hos_cosgi_core/src/launcher.cpp +++ b/src/hos_cosgi_core/src/launcher.cpp @@ -113,7 +113,7 @@ int main(int argc, char **argv) { // Create and register hos-core-service CoreServiceImpl hosCoreService(rosPublicNodeHandle, rosPrivateNodeHandle); service_registration_pt reg = nullptr; - bundleContext_registerService(context, (char*)CoreService::SERVICE_NAME, static_cast(&hosCoreService), nullptr, ®); + bundleContext_registerService(context, (char*)CoreService::SERVICE_NAME, &hosCoreService, nullptr, ®); ROS_INFO("HOS core service registered"); diff --git a/src/hos_cosgi_devicerepository/CMakeLists.txt b/src/hos_cosgi_devicerepository/CMakeLists.txt index 35bda688..63700594 100644 --- a/src/hos_cosgi_devicerepository/CMakeLists.txt +++ b/src/hos_cosgi_devicerepository/CMakeLists.txt @@ -2,8 +2,6 @@ cmake_minimum_required(VERSION 2.8.3) project(hos_cosgi_devicerepository) ## Find catkin macros and libraries -## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) -## is used, also find other catkin packages find_package(catkin REQUIRED COMPONENTS hos_celix hos_core_msgs @@ -14,87 +12,22 @@ find_package(catkin REQUIRED COMPONENTS ) ## System dependencies are found with CMake's conventions -# find_package(Boost REQUIRED COMPONENTS system) - - -## Uncomment this if the package has a setup.py. This macro ensures -## modules and global scripts declared therein get installed -## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html -# catkin_python_setup() - find_package(APR REQUIRED) find_package(CELIX REQUIRED) find_package(Boost REQUIRED) find_package(libvariant REQUIRED) -################################################ -## Declare ROS messages, services and actions ## -################################################ - -## To declare and build messages, services or actions from within this -## package, follow these steps: -## * Let MSG_DEP_SET be the set of packages whose message types you use in -## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...). -## * In the file package.xml: -## * add a build_depend and a run_depend tag for each package in MSG_DEP_SET -## * If MSG_DEP_SET isn't empty the following dependencies might have been -## pulled in transitively but can be declared for certainty nonetheless: -## * add a build_depend tag for "message_generation" -## * add a run_depend tag for "message_runtime" -## * In this file (CMakeLists.txt): -## * add "message_generation" and every package in MSG_DEP_SET to -## find_package(catkin REQUIRED COMPONENTS ...) -## * add "message_runtime" and every package in MSG_DEP_SET to -## catkin_package(CATKIN_DEPENDS ...) -## * uncomment the add_*_files sections below as needed -## and list every .msg/.srv/.action file to be processed -## * uncomment the generate_messages entry below -## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...) - -## Generate messages in the 'msg' folder -# add_message_files( -# FILES -# Message1.msg -# Message2.msg -# ) - -## Generate services in the 'srv' folder -# add_service_files( -# FILES -# Service1.srv -# Service2.srv -# ) - -## Generate actions in the 'action' folder -# add_action_files( -# FILES -# Action1.action -# Action2.action -# ) - -## Generate added messages and services with any dependencies listed here -# generate_messages( -# DEPENDENCIES -# hos_core_msgs -# ) - ################################### ## catkin specific configuration ## ################################### -## The catkin_package macro generates cmake config files for your package -## Declare things to be passed to dependent projects -## INCLUDE_DIRS: uncomment this if you package contains header files -## LIBRARIES: libraries you create in this project that dependent projects also need -## CATKIN_DEPENDS: catkin_packages dependent projects also need -## DEPENDS: system dependencies of this project that dependent projects also need + catkin_package( INCLUDE_DIRS include/${PROJECT_NAME}/ -# LIBRARIES hos_cosgi_devicerepository - CATKIN_DEPENDS hos_celix hos_core_msgs hos_cosgi_core roscpp hos_deps hos_cpp_utils -# DEPENDS system_lib + CATKIN_DEPENDS hos_celix hos_core_msgs hos_cosgi_core roscpp hos_cpp_utils ) + ########### ## Build ## ########### @@ -103,14 +36,11 @@ add_definitions( -std=c++11 ) -## Specify additional locations of header files -## Your package locations should be listed before other locations -# include_directories(include) include_directories( + include/${PROJECT_NAME}/ ${catkin_INCLUDE_DIRS} ${APR_INCLUDE_DIR} ${APR_INCLUDE_DIR}/apr-1.0 - include/${PROJECT_NAME}/ ${libvariant_INCLUDE_DIR} ) @@ -123,28 +53,13 @@ bundle(hos_cosgi_devicerepository ${PROJECT_SOURCE_DIR}/src/BundleActivator ${PROJECT_SOURCE_DIR}/src/hos/cosgi/service/devicerepository/DeviceRepositoryServiceImpl ) + target_link_libraries(hos_cosgi_devicerepository ${catkin_LIBRARIES} ${APR_LIBRARIES} ${libvariant_LIBRARY} ) -## Declare a cpp library -# add_library(hos_cosgi_itemrepository -# src/${PROJECT_NAME}/hos_cosgi_devicerepository.cpp -# ) - -## Declare a cpp executable -# add_executable(hos_cosgi_itemrepository_node src/hos_cosgi_itemrepository_node.cpp) - -## Add cmake target dependencies of the executable/library -## as an example, message headers may need to be generated before nodes -# add_dependencies(hos_cosgi_itemrepository_node hos_cosgi_itemrepository_generate_messages_cpp) - -## Specify libraries to link a library or executable target against -# target_link_libraries(hos_cosgi_itemrepository_node -# ${catkin_LIBRARIES} -# ) ############# ## Install ## @@ -161,39 +76,22 @@ install(FILES DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/bundles ) -# all install targets should use catkin DESTINATION variables -# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html +install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc + DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} + OPTIONAL +) -## Mark executable scripts (Python etc.) for installation -## in contrast to setup.py, you can choose the destination -# install(PROGRAMS -# scripts/my_python_script -# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} -# ) -## Mark executables and/or libraries for installation -# install(TARGETS hos_cosgi_itemrepository hos_cosgi_itemrepository_node -# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} -# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} -# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} -# ) +################### +## Documentation ## +################### -## Mark other files for installation (e.g. launch and bag files, etc.) -# install(FILES -# # myfile1 -# # myfile2 -# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} -# ) +find_package(Doxygen) +if(DOXYGEN_FOUND) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) + add_custom_target(doc + ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) +endif(DOXYGEN_FOUND) -############# -## Testing ## -############# - -## Add gtest based cpp test target and link libraries -# catkin_add_gtest(${PROJECT_NAME}-test test/test_hos_cosgi_itemrepository.cpp) -# if(TARGET ${PROJECT_NAME}-test) -# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME}) -# endif() - -## Add folders to be run by python nosetests -# catkin_add_nosetests(test) diff --git a/src/hos_cosgi_devicerepository/Doxyfile.in b/src/hos_cosgi_devicerepository/Doxyfile.in new file mode 100644 index 00000000..7870f526 --- /dev/null +++ b/src/hos_cosgi_devicerepository/Doxyfile.in @@ -0,0 +1,248 @@ +# Doxyfile 1.8.8 + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +DOXYFILE_ENCODING = UTF-8 +PROJECT_NAME = hos_cosgi_devicerepository +OUTPUT_DIRECTORY = doc +CREATE_SUBDIRS = NO +ALLOW_UNICODE_NAMES = NO +OUTPUT_LANGUAGE = English +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = NO +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +QT_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 4 +OPTIMIZE_OUTPUT_FOR_C = NO +OPTIMIZE_OUTPUT_JAVA = NO +OPTIMIZE_FOR_FORTRAN = NO +OPTIMIZE_OUTPUT_VHDL = NO +MARKDOWN_SUPPORT = YES +AUTOLINK_SUPPORT = YES +BUILTIN_STL_SUPPORT = NO +CPP_CLI_SUPPORT = NO +SIP_SUPPORT = NO +IDL_PROPERTY_SUPPORT = YES +DISTRIBUTE_GROUP_DOC = NO +SUBGROUPING = YES +INLINE_GROUPED_CLASSES = NO +INLINE_SIMPLE_STRUCTS = NO +TYPEDEF_HIDES_STRUCT = NO +LOOKUP_CACHE_SIZE = 0 +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = YES +EXTRACT_PRIVATE = NO +EXTRACT_PACKAGE = NO +EXTRACT_STATIC = NO +EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_METHODS = NO +EXTRACT_ANON_NSPACES = NO +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = NO +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +SHOW_GROUPED_MEMB_INC = NO +FORCE_LOCAL_INCLUDES = NO +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +SORT_MEMBERS_CTORS_1ST = NO +SORT_GROUP_NAMES = NO +SORT_BY_SCOPE_NAME = NO +STRICT_PROTO_MATCHING = NO +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_FILES = YES +SHOW_NAMESPACES = YES +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_FORMAT = "$file:$line: $text" +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = @CMAKE_CURRENT_SOURCE_DIR@/include \ + @CMAKE_CURRENT_SOURCE_DIR@/src +INPUT_ENCODING = UTF-8 +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.idl \ + *.ddl \ + *.odl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.cs \ + *.d \ + *.php \ + *.php4 \ + *.php5 \ + *.phtml \ + *.inc \ + *.m \ + *.markdown \ + *.md \ + *.mm \ + *.dox \ + *.py \ + *.f90 \ + *.f \ + *.for \ + *.tcl \ + *.vhd \ + *.vhdl \ + *.ucf \ + *.qsf \ + *.as \ + *.js +RECURSIVE = YES +EXCLUDE_SYMLINKS = NO +EXAMPLE_PATTERNS = * +EXAMPLE_RECURSIVE = NO +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = NO +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = NO +REFERENCES_RELATION = NO +REFERENCES_LINK_SOURCE = YES +SOURCE_TOOLTIPS = YES +USE_HTAGS = NO +VERBATIM_HEADERS = YES +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 5 +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_COLORSTYLE_HUE = 220 +HTML_COLORSTYLE_SAT = 100 +HTML_COLORSTYLE_GAMMA = 80 +HTML_TIMESTAMP = YES +HTML_DYNAMIC_SECTIONS = NO +HTML_INDEX_NUM_ENTRIES = 100 +GENERATE_DOCSET = NO +DOCSET_FEEDNAME = "Doxygen generated docs" +DOCSET_BUNDLE_ID = org.doxygen.Project +DOCSET_PUBLISHER_ID = org.doxygen.Publisher +DOCSET_PUBLISHER_NAME = Publisher +GENERATE_HTMLHELP = NO +GENERATE_CHI = NO +BINARY_TOC = NO +TOC_EXPAND = NO +GENERATE_QHP = NO +QHP_NAMESPACE = org.doxygen.Project +QHP_VIRTUAL_FOLDER = doc +GENERATE_ECLIPSEHELP = NO +ECLIPSE_DOC_ID = org.doxygen.Project +DISABLE_INDEX = NO +GENERATE_TREEVIEW = YES +ENUM_VALUES_PER_LINE = 4 +TREEVIEW_WIDTH = 250 +EXT_LINKS_IN_WINDOW = NO +FORMULA_FONTSIZE = 10 +FORMULA_TRANSPARENT = YES +USE_MATHJAX = NO +MATHJAX_FORMAT = HTML-CSS +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest +SEARCHENGINE = YES +SERVER_BASED_SEARCH = NO +EXTERNAL_SEARCH = NO +SEARCHDATA_FILE = searchdata.xml +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = NO +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration options related to external references +#--------------------------------------------------------------------------- +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +EXTERNAL_PAGES = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = NO +DOT_NUM_THREADS = 0 +DOT_FONTNAME = Helvetica +DOT_FONTSIZE = 10 +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +UML_LIMIT_NUM_FIELDS = 10 +TEMPLATE_RELATIONS = NO +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +CALLER_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +INTERACTIVE_SVG = NO +DOT_GRAPH_MAX_NODES = 50 +MAX_DOT_GRAPH_DEPTH = 0 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES diff --git a/src/hos_cosgi_devicerepository/src/hos/cosgi/service/devicerepository/DeviceRepositoryServiceImpl.h b/src/hos_cosgi_devicerepository/src/hos/cosgi/service/devicerepository/DeviceRepositoryServiceImpl.h index 2d19b1a1..7e4ffe9b 100644 --- a/src/hos_cosgi_devicerepository/src/hos/cosgi/service/devicerepository/DeviceRepositoryServiceImpl.h +++ b/src/hos_cosgi_devicerepository/src/hos/cosgi/service/devicerepository/DeviceRepositoryServiceImpl.h @@ -130,11 +130,13 @@ public: /** - * Implementation of device repository service + * Implementation of DeviceRepositoryService. **/ class DeviceRepositoryServiceImpl : public virtual DeviceRepositoryService, - public implementation::ObservableService { + public implementation::Service, + public implementation::Observable { + //public implementation::ObservableService { /* Why does this one not work? */ private: typedef std::map> devicesMap_t; diff --git a/src/hos_cosgi_ruleengine/CMakeLists.txt b/src/hos_cosgi_ruleengine/CMakeLists.txt index c0b26819..848e3f29 100644 --- a/src/hos_cosgi_ruleengine/CMakeLists.txt +++ b/src/hos_cosgi_ruleengine/CMakeLists.txt @@ -2,8 +2,6 @@ cmake_minimum_required(VERSION 2.8.3) project(hos_cosgi_ruleengine) ## Find catkin macros and libraries -## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) -## is used, also find other catkin packages find_package(catkin REQUIRED COMPONENTS hos_celix hos_cosgi_devicerepository @@ -16,83 +14,19 @@ find_package(catkin REQUIRED COMPONENTS ) ## System dependencies are found with CMake's conventions -# find_package(Boost REQUIRED COMPONENTS system) - - -## Uncomment this if the package has a setup.py. This macro ensures -## modules and global scripts declared therein get installed -## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html -# catkin_python_setup() - find_package(APR REQUIRED) find_package(CELIX REQUIRED) find_package(Boost REQUIRED) find_package(libvariant REQUIRED) -################################################ -## Declare ROS messages, services and actions ## -################################################ -## To declare and build messages, services or actions from within this -## package, follow these steps: -## * Let MSG_DEP_SET be the set of packages whose message types you use in -## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...). -## * In the file package.xml: -## * add a build_depend and a run_depend tag for each package in MSG_DEP_SET -## * If MSG_DEP_SET isn't empty the following dependencies might have been -## pulled in transitively but can be declared for certainty nonetheless: -## * add a build_depend tag for "message_generation" -## * add a run_depend tag for "message_runtime" -## * In this file (CMakeLists.txt): -## * add "message_generation" and every package in MSG_DEP_SET to -## find_package(catkin REQUIRED COMPONENTS ...) -## * add "message_runtime" and every package in MSG_DEP_SET to -## catkin_package(CATKIN_DEPENDS ...) -## * uncomment the add_*_files sections below as needed -## and list every .msg/.srv/.action file to be processed -## * uncomment the generate_messages entry below -## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...) - -## Generate messages in the 'msg' folder -# add_message_files( -# FILES -# Message1.msg -# Message2.msg -# ) - -## Generate services in the 'srv' folder -# add_service_files( -# FILES -# Service1.srv -# Service2.srv -# ) - -## Generate actions in the 'action' folder -# add_action_files( -# FILES -# Action1.action -# Action2.action -# ) - -## Generate added messages and services with any dependencies listed here -# generate_messages( -# DEPENDENCIES -# std_msgs # Or other packages containing msgs -# ) ################################### ## catkin specific configuration ## ################################### -## The catkin_package macro generates cmake config files for your package -## Declare things to be passed to dependent projects -## INCLUDE_DIRS: uncomment this if you package contains header files -## LIBRARIES: libraries you create in this project that dependent projects also need -## CATKIN_DEPENDS: catkin_packages dependent projects also need -## DEPENDS: system dependencies of this project that dependent projects also need + catkin_package( INCLUDE_DIRS include/${PROJECT_NAME}/ -# LIBRARIES hos_cosgi_ruleengine - CATKIN_DEPENDS hos_celix hos_cosgi_devicerepository hos_cosgi_core hos_cpp_utils hos_deps roscpp hos_cpp_cron hos_cosgi_scripting -# DEPENDS system_lib + CATKIN_DEPENDS hos_celix hos_cosgi_core hos_cpp_utils roscpp ) ########### @@ -103,14 +37,11 @@ add_definitions( -std=c++11 ) -## Specify additional locations of header files -## Your package locations should be listed before other locations -# include_directories(include) include_directories( + include/${PROJECT_NAME}/ ${catkin_INCLUDE_DIRS} ${APR_INCLUDE_DIR} ${APR_INCLUDE_DIR}/apr-1.0 - include/${PROJECT_NAME}/ ${libvariant_INCLUDE_DIR} ) @@ -129,28 +60,13 @@ bundle(hos_cosgi_ruleengine ${PROJECT_SOURCE_DIR}/src/hos/cosgi/service/ruleengine/rules/conditions/LogicalAndCondition ${PROJECT_SOURCE_DIR}/src/hos/cosgi/service/ruleengine/rules/conditions/DeviceMsgCondition ) + target_link_libraries(hos_cosgi_ruleengine ${catkin_LIBRARIES} ${APR_LIBRARIES} ${libvariant_LIBRARY} ) -## Declare a cpp library -# add_library(hos_cosgi_ruleengine -# src/${PROJECT_NAME}/hos_cosgi_ruleengine.cpp -# ) - -## Declare a cpp executable -# add_executable(hos_cosgi_ruleengine_node src/hos_cosgi_ruleengine_node.cpp) - -## Add cmake target dependencies of the executable/library -## as an example, message headers may need to be generated before nodes -# add_dependencies(hos_cosgi_ruleengine_node hos_cosgi_ruleengine_generate_messages_cpp) - -## Specify libraries to link a library or executable target against -# target_link_libraries(hos_cosgi_ruleengine_node -# ${catkin_LIBRARIES} -# ) ############# ## Install ## @@ -167,46 +83,21 @@ install(FILES DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/bundles ) -# all install targets should use catkin DESTINATION variables -# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html +install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc + DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} + OPTIONAL +) -## Mark executable scripts (Python etc.) for installation -## in contrast to setup.py, you can choose the destination -# install(PROGRAMS -# scripts/my_python_script -# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} -# ) -## Mark executables and/or libraries for installation -# install(TARGETS hos_cosgi_ruleengine hos_cosgi_ruleengine_node -# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} -# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} -# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} -# ) +################### +## Documentation ## +################### -## Mark cpp header files for installation -# install(DIRECTORY include/${PROJECT_NAME}/ -# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} -# FILES_MATCHING PATTERN "*.h" -# PATTERN ".svn" EXCLUDE -# ) - -## Mark other files for installation (e.g. launch and bag files, etc.) -# install(FILES -# # myfile1 -# # myfile2 -# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} -# ) - -############# -## Testing ## -############# - -## Add gtest based cpp test target and link libraries -# catkin_add_gtest(${PROJECT_NAME}-test test/test_hos_cosgi_ruleengine.cpp) -# if(TARGET ${PROJECT_NAME}-test) -# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME}) -# endif() - -## Add folders to be run by python nosetests -# catkin_add_nosetests(test) +find_package(Doxygen) +if(DOXYGEN_FOUND) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) + add_custom_target(doc + ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) +endif(DOXYGEN_FOUND) diff --git a/src/hos_cosgi_ruleengine/Doxyfile.in b/src/hos_cosgi_ruleengine/Doxyfile.in new file mode 100644 index 00000000..0e0d315b --- /dev/null +++ b/src/hos_cosgi_ruleengine/Doxyfile.in @@ -0,0 +1,248 @@ +# Doxyfile 1.8.8 + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +DOXYFILE_ENCODING = UTF-8 +PROJECT_NAME = hos_cosgi_ruleengine +OUTPUT_DIRECTORY = doc +CREATE_SUBDIRS = NO +ALLOW_UNICODE_NAMES = NO +OUTPUT_LANGUAGE = English +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = NO +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +QT_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 4 +OPTIMIZE_OUTPUT_FOR_C = NO +OPTIMIZE_OUTPUT_JAVA = NO +OPTIMIZE_FOR_FORTRAN = NO +OPTIMIZE_OUTPUT_VHDL = NO +MARKDOWN_SUPPORT = YES +AUTOLINK_SUPPORT = YES +BUILTIN_STL_SUPPORT = NO +CPP_CLI_SUPPORT = NO +SIP_SUPPORT = NO +IDL_PROPERTY_SUPPORT = YES +DISTRIBUTE_GROUP_DOC = NO +SUBGROUPING = YES +INLINE_GROUPED_CLASSES = NO +INLINE_SIMPLE_STRUCTS = NO +TYPEDEF_HIDES_STRUCT = NO +LOOKUP_CACHE_SIZE = 0 +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = YES +EXTRACT_PRIVATE = NO +EXTRACT_PACKAGE = NO +EXTRACT_STATIC = NO +EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_METHODS = NO +EXTRACT_ANON_NSPACES = NO +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = NO +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +SHOW_GROUPED_MEMB_INC = NO +FORCE_LOCAL_INCLUDES = NO +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +SORT_MEMBERS_CTORS_1ST = NO +SORT_GROUP_NAMES = NO +SORT_BY_SCOPE_NAME = NO +STRICT_PROTO_MATCHING = NO +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_FILES = YES +SHOW_NAMESPACES = YES +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_FORMAT = "$file:$line: $text" +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = @CMAKE_CURRENT_SOURCE_DIR@/include \ + @CMAKE_CURRENT_SOURCE_DIR@/src +INPUT_ENCODING = UTF-8 +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.idl \ + *.ddl \ + *.odl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.cs \ + *.d \ + *.php \ + *.php4 \ + *.php5 \ + *.phtml \ + *.inc \ + *.m \ + *.markdown \ + *.md \ + *.mm \ + *.dox \ + *.py \ + *.f90 \ + *.f \ + *.for \ + *.tcl \ + *.vhd \ + *.vhdl \ + *.ucf \ + *.qsf \ + *.as \ + *.js +RECURSIVE = YES +EXCLUDE_SYMLINKS = NO +EXAMPLE_PATTERNS = * +EXAMPLE_RECURSIVE = NO +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = NO +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = NO +REFERENCES_RELATION = NO +REFERENCES_LINK_SOURCE = YES +SOURCE_TOOLTIPS = YES +USE_HTAGS = NO +VERBATIM_HEADERS = YES +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 5 +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_COLORSTYLE_HUE = 220 +HTML_COLORSTYLE_SAT = 100 +HTML_COLORSTYLE_GAMMA = 80 +HTML_TIMESTAMP = YES +HTML_DYNAMIC_SECTIONS = NO +HTML_INDEX_NUM_ENTRIES = 100 +GENERATE_DOCSET = NO +DOCSET_FEEDNAME = "Doxygen generated docs" +DOCSET_BUNDLE_ID = org.doxygen.Project +DOCSET_PUBLISHER_ID = org.doxygen.Publisher +DOCSET_PUBLISHER_NAME = Publisher +GENERATE_HTMLHELP = NO +GENERATE_CHI = NO +BINARY_TOC = NO +TOC_EXPAND = NO +GENERATE_QHP = NO +QHP_NAMESPACE = org.doxygen.Project +QHP_VIRTUAL_FOLDER = doc +GENERATE_ECLIPSEHELP = NO +ECLIPSE_DOC_ID = org.doxygen.Project +DISABLE_INDEX = NO +GENERATE_TREEVIEW = YES +ENUM_VALUES_PER_LINE = 4 +TREEVIEW_WIDTH = 250 +EXT_LINKS_IN_WINDOW = NO +FORMULA_FONTSIZE = 10 +FORMULA_TRANSPARENT = YES +USE_MATHJAX = NO +MATHJAX_FORMAT = HTML-CSS +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest +SEARCHENGINE = YES +SERVER_BASED_SEARCH = NO +EXTERNAL_SEARCH = NO +SEARCHDATA_FILE = searchdata.xml +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = NO +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration options related to external references +#--------------------------------------------------------------------------- +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +EXTERNAL_PAGES = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = NO +DOT_NUM_THREADS = 0 +DOT_FONTNAME = Helvetica +DOT_FONTSIZE = 10 +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +UML_LIMIT_NUM_FIELDS = 10 +TEMPLATE_RELATIONS = NO +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +CALLER_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +INTERACTIVE_SVG = NO +DOT_GRAPH_MAX_NODES = 50 +MAX_DOT_GRAPH_DEPTH = 0 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES diff --git a/src/hos_cosgi_ruleengine/include/hos_cosgi_ruleengine/hos/cosgi/service/ruleengine/RuleEngineService.h b/src/hos_cosgi_ruleengine/include/hos_cosgi_ruleengine/hos/cosgi/service/ruleengine/RuleEngineService.h index 1f514b19..a9e5fc5b 100644 --- a/src/hos_cosgi_ruleengine/include/hos_cosgi_ruleengine/hos/cosgi/service/ruleengine/RuleEngineService.h +++ b/src/hos_cosgi_ruleengine/include/hos_cosgi_ruleengine/hos/cosgi/service/ruleengine/RuleEngineService.h @@ -16,6 +16,14 @@ namespace libvariant { class Variant; } namespace hos { namespace cosgi { namespace service { + + +// forward declarations +namespace devicerepository { class DeviceRepositoryService; } +namespace core { class CoreService; } + + +// service namespace namespace ruleengine { @@ -92,6 +100,30 @@ public: * \param[in] factory rule condition factory. */ virtual void registerRuleConditionFactory(const std::string& type, std::shared_ptr factory) noexcept = 0; + + + /* Interface for third-party conditions. */ + + /** + * Returns the rule condition factory responsible for the given condition type. + * + * \param[in] type condition type identifier. + */ + virtual RuleConditionFactory* getRuleConditionFactory(const std::string& type) noexcept = 0; + + /** + * Returns a reference to the device repository service. + * + * \return device respository service. + */ + virtual devicerepository::DeviceRepositoryService* getDeviceRepository() noexcept = 0; + + /** + * Returns a reference to the core service. + * + * \return core service. + */ + virtual core::CoreService* getCoreService() noexcept = 0; }; diff --git a/src/hos_cosgi_ruleengine/include/hos_cosgi_ruleengine/hos/cosgi/service/ruleengine/rules/Rule.h b/src/hos_cosgi_ruleengine/include/hos_cosgi_ruleengine/hos/cosgi/service/ruleengine/rules/Rule.h index 6bc0338e..94e436f3 100644 --- a/src/hos_cosgi_ruleengine/include/hos_cosgi_ruleengine/hos/cosgi/service/ruleengine/rules/Rule.h +++ b/src/hos_cosgi_ruleengine/include/hos_cosgi_ruleengine/hos/cosgi/service/ruleengine/rules/Rule.h @@ -126,13 +126,6 @@ public: virtual void conditionStateChanged(bool newState, const conditions::ConditionTriggerType& trigger, const libvariant::Variant& lcontext = libvariant::Variant()) noexcept = 0; - /** - * Returns a reference to the device repository service. - * - * \return device repository service. - */ - virtual devicerepository::DeviceRepositoryService* getDeviceRepository() noexcept = 0; - }; diff --git a/src/hos_cosgi_ruleengine/include/hos_cosgi_ruleengine/hos/cosgi/service/ruleengine/rules/conditions/RuleConditionImpl.h b/src/hos_cosgi_ruleengine/include/hos_cosgi_ruleengine/hos/cosgi/service/ruleengine/rules/conditions/RuleConditionImpl.h index fced1ba1..3d682b41 100644 --- a/src/hos_cosgi_ruleengine/include/hos_cosgi_ruleengine/hos/cosgi/service/ruleengine/rules/conditions/RuleConditionImpl.h +++ b/src/hos_cosgi_ruleengine/include/hos_cosgi_ruleengine/hos/cosgi/service/ruleengine/rules/conditions/RuleConditionImpl.h @@ -3,6 +3,7 @@ #include "RuleCondition.h" +#include @@ -20,7 +21,8 @@ namespace conditions { * Base class for condition implementations. */ class RuleConditionImpl - : public virtual RuleCondition { + : public virtual RuleCondition, + public implementation::Object { protected: diff --git a/src/hos_cosgi_ruleengine/src/BundleActivator.cpp b/src/hos_cosgi_ruleengine/src/BundleActivator.cpp index d20e6a5c..35f0f35a 100644 --- a/src/hos_cosgi_ruleengine/src/BundleActivator.cpp +++ b/src/hos_cosgi_ruleengine/src/BundleActivator.cpp @@ -1,29 +1,21 @@ -/* - * bundle_activator.cpp - * - * Created on: 26.04.2015 - * Author: matzman - */ +// std #include #include - -#include - -#include "ros/ros.h" - -extern "C" { - #include "celix/bundle_activator.h" - #include "celix/bundle_context.h" - #include "celix/service_listener.h" - #include "celix/service_reference.h" - #include "celix/constants.h" -} - -#include -#include "hos/cosgi/service/ruleengine/RuleEngineServiceImpl.h" +#include #include #include +// ROS +#include +// APR +#include +// Celix +#include +// CoreService +#include "hos/cosgi/service/ruleengine/RuleEngineServiceImpl.h" +#include +#include + using namespace hos::cosgi::service::ruleengine; @@ -32,6 +24,8 @@ using namespace hos::cosgi::service::devicerepository; using namespace hos::cosgi::service::core; using namespace hos::cosgi; + + struct UserData { apr_pool_t* memoryPool = nullptr; std::unique_ptr serviceImpl = nullptr; @@ -41,40 +35,49 @@ struct UserData { }; + celix_status_t cb_serviceChanged(void* listener, service_event_pt event) { UserData* myUserData = (UserData*) ((serviceListener*)listener)->handle; if (event->type == OSGI_FRAMEWORK_SERVICE_EVENT_REGISTERED) { char* serviceName = nullptr; bool checkReg = false; serviceReference_getProperty(event->reference, (char*)OSGI_FRAMEWORK_OBJECTCLASS, &serviceName); + if (serviceName && std::strcmp(serviceName, DeviceRepositoryService::SERVICE_NAME) == 0) { DeviceRepositoryService *service = nullptr; bundleContext_getService(myUserData->bundleContext, event->reference, (void**)&service); myUserData->serviceImpl->setRepoService(service); checkReg = true; + } else if (serviceName && std::strcmp(serviceName, ScriptingService::SERVICE_NAME) == 0) { ScriptingService *service = nullptr; bundleContext_getService(myUserData->bundleContext, event->reference, (void**)&service); myUserData->serviceImpl->addExecutionBackend(service); checkReg = true; } - // Register hos-devicerepository-service + + // Register rule engine service if (checkReg && !myUserData->serviceReg && myUserData->serviceImpl->isInitialized()) { bundleContext_registerService(myUserData->bundleContext, (char*)RuleEngineServiceImpl::SERVICE_NAME, myUserData->serviceImpl.get(), nullptr, &myUserData->serviceReg); } + } else if (event->type == OSGI_FRAMEWORK_SERVICE_EVENT_UNREGISTERING) { } return CELIX_SUCCESS; } + + celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) { celix_status_t status = CELIX_START_ERROR; apr_pool_t* memoryPool = nullptr; + // Create APR memory pool apr_status_t astatus = apr_pool_create(&memoryPool, NULL); if (astatus != APR_SUCCESS) { ROS_ERROR("RuleEngineService: Could not create APR memory pool (%i).", astatus); } else { + // Create user data UserData* myUserData = (UserData*)apr_palloc(memoryPool, sizeof(UserData)); if (myUserData != nullptr) { @@ -83,6 +86,7 @@ celix_status_t bundleActivator_create(bundle_context_pt context, void **userData *userData = (void*)myUserData; status = CELIX_SUCCESS; ROS_INFO("RuleEngineService: Bundle successfully created"); + } else { ROS_ERROR("RuleEngineService: Could not create user data struct"); apr_pool_destroy(memoryPool); @@ -91,17 +95,21 @@ celix_status_t bundleActivator_create(bundle_context_pt context, void **userData return status; } + + celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) { celix_status_t status = CELIX_SUCCESS; if (userData != nullptr) { UserData* myUserData = (UserData*)userData; - // Create hos-devicerepository-service + + // Create rule engine service if (myUserData->serviceReg != nullptr) { serviceRegistration_unregister(myUserData->serviceReg); myUserData->serviceReg = nullptr; } myUserData->serviceImpl.reset(new RuleEngineServiceImpl()); - // Get HOS Core Service + + // Get core Service service_reference_pt ref = nullptr; bundleContext_getServiceReference(context, (char*)CoreService::SERVICE_NAME, &ref); CoreService* coreService = nullptr; @@ -111,7 +119,8 @@ celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) } else { myUserData->serviceImpl->setCoreService(coreService); } - // Get HOS Core Service + + // Get device repository service service_reference_pt ref2 = nullptr; bundleContext_getServiceReference(context, (char*)DeviceRepositoryService::SERVICE_NAME, &ref2); DeviceRepositoryService* repoService = nullptr; @@ -119,14 +128,17 @@ celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) if (repoService) { myUserData->serviceImpl->setRepoService(repoService); } - // Register hos-devicerepository-service + + // Register rule engine service if (myUserData->serviceImpl->isInitialized()) { bundleContext_registerService(context, (char*)RuleEngineServiceImpl::SERVICE_NAME, myUserData->serviceImpl.get(), nullptr, &myUserData->serviceReg); } + // Register service listener myUserData->myServiceListener.handle = myUserData; myUserData->myServiceListener.serviceChanged = cb_serviceChanged; bundleContext_addServiceListener(context, &myUserData->myServiceListener, nullptr); + ROS_INFO("RuleEngineService: Bundle successfully started"); } else { ROS_ERROR("RuleEngineService: Could not start bundle, user data struct is null"); @@ -134,6 +146,8 @@ celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) return status; } + + celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) { celix_status_t status = CELIX_ILLEGAL_STATE; if (userData != nullptr) { @@ -154,6 +168,8 @@ celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) return status; } + + celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) { celix_status_t status = CELIX_ILLEGAL_STATE; if (userData != nullptr) { diff --git a/src/hos_cosgi_ruleengine/src/hos/cosgi/service/ruleengine/RuleEngineServiceImpl.cpp b/src/hos_cosgi_ruleengine/src/hos/cosgi/service/ruleengine/RuleEngineServiceImpl.cpp index a4e0618e..6483fcb4 100644 --- a/src/hos_cosgi_ruleengine/src/hos/cosgi/service/ruleengine/RuleEngineServiceImpl.cpp +++ b/src/hos_cosgi_ruleengine/src/hos/cosgi/service/ruleengine/RuleEngineServiceImpl.cpp @@ -1,41 +1,44 @@ -/* - * hos_ruleengine_service_impl.cpp - * - * Created on: 26.04.2015 - * Author: matzman - */ -#include +#include "RuleEngineServiceImpl.h" +// std #include #include #include +// ROS +#include +// libvariant #include -#include +// HOS #include #include -#include - -#include "RuleEngineServiceImpl.h" - +#include +// HOS internal #include "rules/conditions/LogicalAndCondition.h" #include "rules/conditions/LogicalOrCondition.h" #include "rules/conditions/DeviceMsgCondition.h" #include "rules/RulePackageImpl.h" + +// Service Namespace namespace hos { namespace cosgi { namespace service { namespace ruleengine { + using namespace ::libvariant; -template<> const char* implementation::ServiceInfo::name = service::ruleengine::RuleEngineService::SERVICE_NAME; -template<> const int implementation::ServiceInfo::major = 0; -template<> const int implementation::ServiceInfo::minor = 6; -void RuleEngineServiceImpl::setCoreService(service::core::CoreService* coreService) { +// Service information +template<> const char* implementation::ServiceInfo::name = service::ruleengine::RuleEngineService::SERVICE_NAME; +template<> const int implementation::ServiceInfo::major = 1; +template<> const int implementation::ServiceInfo::minor = 0; + + + +void RuleEngineServiceImpl::setCoreService(service::core::CoreService* coreService) noexcept { if (coreService && !this->coreService) { this->coreService = coreService; this->nodehandle = &coreService->getPrivateNodeHandle(); @@ -48,7 +51,8 @@ void RuleEngineServiceImpl::setCoreService(service::core::CoreService* coreServi } } -void RuleEngineServiceImpl::setRepoService(devicerepository::DeviceRepositoryService* repoService) { + +void RuleEngineServiceImpl::setRepoService(devicerepository::DeviceRepositoryService* repoService) noexcept { if (repoService && !this->repoService) { this->repoService = repoService; int major = 0, minor = 0; @@ -60,16 +64,21 @@ void RuleEngineServiceImpl::setRepoService(devicerepository::DeviceRepositorySer } } -void RuleEngineServiceImpl::init() { + +void RuleEngineServiceImpl::init() noexcept { + // Get public parameters nodehandle->getParam("ruleengine_prefix", ruleEnginePrefix); - XmlRpc::XmlRpcValue rawValue; - nodehandle->getParam(ruleEnginePrefix, rawValue); - schemaLoader.reset(new utils::SchemaLoader()); + + // Register condition factories registerRuleConditionFactory("logical_or", std::make_shared()); registerRuleConditionFactory("logical_and", std::make_shared()); registerRuleConditionFactory("devicestatusmsg", std::make_shared()); registerRuleConditionFactory("devicecommandmsg", std::make_shared()); registerRuleConditionFactory("devicestatechange", std::make_shared()); + + // Create rule packages + XmlRpc::XmlRpcValue rawValue; + nodehandle->getParam(ruleEnginePrefix, rawValue); if (rawValue.getType() == XmlRpc::XmlRpcValue::TypeStruct) { for (auto pkg : rawValue) { std::string pname = pkg.first; @@ -82,11 +91,13 @@ void RuleEngineServiceImpl::init() { } } } + initialized = true; ROS_INFO_STREAM("RuleEngineService: Initialized and Ready."); } -void RuleEngineServiceImpl::addRulePkg(std::string name) { + +void RuleEngineServiceImpl::addRulePkg(const std::string& name) { std::stringstream ss; ss << ruleEnginePrefix << "/" << name; XmlRpc::XmlRpcValue rawValue; @@ -94,20 +105,26 @@ void RuleEngineServiceImpl::addRulePkg(std::string name) { addRulePkg(name, static_cast(rawValue)); } -void RuleEngineServiceImpl::addRulePkg(std::string name, std::string rawValue) { - Variant s = schemaLoader->GetSchema(std::string("hos:schema://core/configs/rulepackage")); + +void RuleEngineServiceImpl::addRulePkg(const std::string& name, const std::string& rawValue) { + // Validate config + auto schemaLoader = coreService->getSchemaLoader(); + Variant s = schemaLoader.GetSchema(std::string("hos:schema://core/configs/rulepackage")); Variant m = Deserialize(rawValue, SERIALIZE_JSON); - SchemaResult sr = SchemaValidate(s, m, schemaLoader.get()); + SchemaResult sr = SchemaValidate(s, m, &schemaLoader); if (!sr.Error()) { + + // Crerate rule package std::shared_ptr pkg = rules::RulePackageImpl::createRulePackage(this, name, m); if (pkg) { - if (pkg->getScriptingService()) { + if (pkg->getScriptingService()) { // we have a suitable scripting service rulePkgs.insert({name, pkg}); pkg->setEnabled(true); - } else { + } else { // we don't have a suitable scripting service noExecRulePkgs.insert({name, pkg}); std::cout << "No execution service found for rule package \"" << name << "\"" << std::endl; } + } else { throw std::runtime_error("Unknown error during rule package creation."); } @@ -124,11 +141,14 @@ void RuleEngineServiceImpl::addRulePkg(std::string name, std::string rawValue) { } } -void RuleEngineServiceImpl::removeRulePkg(std::string name) { + +void RuleEngineServiceImpl::removeRulePkg(const std::string& name) noexcept { rulePkgs.erase(name); + noExecRulePkgs.erase(name); } -void RuleEngineServiceImpl::addExecutionBackend(scripting::ScriptingService* service) { + +void RuleEngineServiceImpl::addExecutionBackend(scripting::ScriptingService* service) noexcept { if (execServices.find(service->getLanguage()) == execServices.end()) { execServices.insert({service->getLanguage(), service}); ROS_INFO_STREAM("RuleEngineService: Added execution service \"" << service->getLanguage() << "\"."); @@ -136,7 +156,7 @@ void RuleEngineServiceImpl::addExecutionBackend(scripting::ScriptingService* ser } -scripting::ScriptingService* RuleEngineServiceImpl::getExecutionBackend(std::string language) { +scripting::ScriptingService* RuleEngineServiceImpl::getExecutionBackend(const std::string& language) noexcept { auto s = execServices.find(language); if (s != execServices.end()) { return s->second; @@ -150,6 +170,15 @@ void RuleEngineServiceImpl::registerRuleConditionFactory(const std::string& type } +RuleConditionFactory* RuleEngineServiceImpl::getRuleConditionFactory(const std::string& type) noexcept { + RuleConditionFactory* retval = nullptr; + try { + retval = condFactories.at(type).get(); + } catch(...) {} + return retval; +} + + std::weak_ptr RuleEngineServiceImpl::getRulePackage(const std::string& name) noexcept { std::weak_ptr retval; try { @@ -165,12 +194,19 @@ std::weak_ptr RuleEngineServiceImpl::getRulePackage(const st std::vector> RuleEngineServiceImpl::getRulePackages() noexcept { - + std::vector> retval; + for (auto p : rulePkgs) { + retval.push_back(p.second); + } + for (auto p : noExecRulePkgs) { + retval.push_back(p.second); + } + return retval; } size_t RuleEngineServiceImpl::getRulePackageCount() noexcept { - + return rulePkgs.size() + noExecRulePkgs.size(); } @@ -180,9 +216,3 @@ size_t RuleEngineServiceImpl::getRulePackageCount() noexcept { } // namespace cosgi } // namespace hos - - - - - - diff --git a/src/hos_cosgi_ruleengine/src/hos/cosgi/service/ruleengine/RuleEngineServiceImpl.h b/src/hos_cosgi_ruleengine/src/hos/cosgi/service/ruleengine/RuleEngineServiceImpl.h index e9642891..11c5299d 100644 --- a/src/hos_cosgi_ruleengine/src/hos/cosgi/service/ruleengine/RuleEngineServiceImpl.h +++ b/src/hos_cosgi_ruleengine/src/hos/cosgi/service/ruleengine/RuleEngineServiceImpl.h @@ -2,38 +2,26 @@ #pragma once - -#include -#include -#include +#include +// hos includes +#include +#include +#include +#include #include #include #include #include -#include -#include -#include -#include +// ROS includes #include +// std includes +#include +#include +#include #include #include -// Forward declarations -namespace XmlRpc { -class XmlRpcValue; -} -namespace hos { -namespace cosgi { -namespace service { -namespace core { -class CoreService; -} -} -} -} - - // Service Namespace namespace hos { @@ -41,12 +29,17 @@ namespace cosgi { namespace service { namespace ruleengine { + +// Forward declaration namespace rules { class RulePackageImpl; } +/** + * Implementation of RuleEngineService. + **/ class RuleEngineServiceImpl : public virtual RuleEngineService, public implementation::Service { @@ -67,57 +60,52 @@ private: execServiceMap_t execServices; condFactoryMap_t condFactories; - std::unique_ptr schemaLoader; - bool initialized = false; - void addRulePkg(std::string name); - void addRulePkg(std::string name, std::string rawValue); - void removeRulePkg(std::string name); + void addRulePkg(const std::string& name); + void addRulePkg(const std::string& name, const std::string& rawValue); + void removeRulePkg(const std::string& name) noexcept; - void init(); + void init() noexcept; public: /* Initialization */ - void setCoreService(service::core::CoreService* coreService); + void setCoreService(service::core::CoreService* coreService) noexcept; - void setRepoService(devicerepository::DeviceRepositoryService* repoService); + void setRepoService(devicerepository::DeviceRepositoryService* repoService) noexcept; /* Public Service Implementations */ virtual void registerRuleConditionFactory(const std::string& type, std::shared_ptr factory) noexcept override; + virtual RuleConditionFactory* getRuleConditionFactory(const std::string& type) noexcept override; + virtual std::weak_ptr getRulePackage(const std::string& name) noexcept override; virtual std::vector> getRulePackages() noexcept override; - virtual size_t getRulePackageCount() noexcept override; - - /* Internal Stuff */ - - bool isInitialized() { return initialized; } - - void addExecutionBackend(scripting::ScriptingService* service); - - scripting::ScriptingService* getExecutionBackend(std::string language); - - std::shared_ptr getRuleConditionFactory(std::string type) { - return condFactories[type]; - } - - utils::SchemaLoader* getHOSSchemaLoader() { - return schemaLoader.get(); - } - - devicerepository::DeviceRepositoryService* getDeviceRepository() { + virtual devicerepository::DeviceRepositoryService* getDeviceRepository() noexcept override { return repoService; } + virtual core::CoreService* getCoreService() noexcept override { + return coreService; + } + + + /* Internal */ + + bool isInitialized() noexcept { return initialized; } + + void addExecutionBackend(scripting::ScriptingService* service) noexcept; + + scripting::ScriptingService* getExecutionBackend(const std::string& language) noexcept; + }; diff --git a/src/hos_cosgi_ruleengine/src/hos/cosgi/service/ruleengine/rules/RuleImpl.cpp b/src/hos_cosgi_ruleengine/src/hos/cosgi/service/ruleengine/rules/RuleImpl.cpp index 665f9b8d..dc586dfb 100644 --- a/src/hos_cosgi_ruleengine/src/hos/cosgi/service/ruleengine/rules/RuleImpl.cpp +++ b/src/hos_cosgi_ruleengine/src/hos/cosgi/service/ruleengine/rules/RuleImpl.cpp @@ -1,24 +1,11 @@ -/* - * Rule.cpp - * - * Created on: 29.04.2015 - * Author: matzman - */ - -#include "../rules/RuleImpl.h" - -#include -#include +#include "RuleImpl.h" +#include "RulePackageImpl.h" +#include "../RuleEngineServiceImpl.h" #include -#include -#include #include #include -#include "../rules/RulePackageImpl.h" - -#include "../RuleEngineServiceImpl.h" namespace hos { @@ -28,19 +15,18 @@ namespace ruleengine { namespace rules { -RuleImpl::RuleImpl(RulePackageImpl* parent, std::string name) - : parent(parent), name(name) {} std::shared_ptr RuleImpl::createRuleCondition(const Variant& condition) { std::shared_ptr retval; if (condition.IsMap() && condition.HasPath("type") && condition["type"].IsString()) { if (condition.HasPath("$schema")) { - SchemaResult sr = SchemaValidate(Variant(), condition, parent->parent->getHOSSchemaLoader()); + auto schemaLoader = parent->getParent()->getCoreService()->getSchemaLoader(); + SchemaResult sr = SchemaValidate(Variant(), condition, &schemaLoader); if (sr.Error()) { throw std::runtime_error(sr.PrettyPrintMessage()); } } - auto conditionFactory = parent->getConditionFactory(condition["type"].AsString()); + auto conditionFactory = parent->getParent()->getRuleConditionFactory(condition["type"].AsString()); if (conditionFactory) { auto cond = conditionFactory->createCondition(this, condition); if (cond) { @@ -57,7 +43,8 @@ std::shared_ptr RuleImpl::createRuleCondition(const V return retval; } -std::shared_ptr RuleImpl::createRule(RulePackageImpl* parent, std::string name, Variant raw) { + +std::shared_ptr RuleImpl::createRule(RulePackageImpl* parent, const std::string& name, const Variant& raw) { std::shared_ptr retval; if (!parent->getRule(name).expired()) { throw std::runtime_error("Rule with the same name already exists."); @@ -102,10 +89,6 @@ std::shared_ptr RuleImpl::createRule(RulePackageImpl* parent, std::str } -devicerepository::DeviceRepositoryService* RuleImpl::getDeviceRepository() noexcept { - return parent->parent->getDeviceRepository(); -} - void RuleImpl::setEnabled(bool enabled) noexcept { if (this->enabled != enabled) { if (condition) { @@ -126,6 +109,7 @@ void RuleImpl::executeScript(const libvariant::Variant& lContext) { } } + void RuleImpl::executeExitScript(const libvariant::Variant& lContext) { if (enabled && exitScript) { try { @@ -169,8 +153,11 @@ void RuleImpl::conditionStateChanged(bool newState, const conditions::ConditionT } } + + } /* namespace rule */ } /* namespace ruleengine */ } /* namespace service */ } /* namespace cosgi */ } /* namespace hos */ + diff --git a/src/hos_cosgi_ruleengine/src/hos/cosgi/service/ruleengine/rules/RuleImpl.h b/src/hos_cosgi_ruleengine/src/hos/cosgi/service/ruleengine/rules/RuleImpl.h index 92abfb45..4888fc52 100644 --- a/src/hos_cosgi_ruleengine/src/hos/cosgi/service/ruleengine/rules/RuleImpl.h +++ b/src/hos_cosgi_ruleengine/src/hos/cosgi/service/ruleengine/rules/RuleImpl.h @@ -2,92 +2,88 @@ #pragma once - -#include #include -#include - +#include +#include +#include #include "RulePackageImpl.h" +#include #include #include #include -#include -// Forward declarations -namespace hos { -namespace cosgi { -namespace service { -namespace devicerepository { -class Device; -class DeviceEvent; -class DeviceRepositoryService; -} -namespace ruleengine { -namespace rules { -class RulePackageImpl; -} -} -namespace scripting { -class ScriptingService; -class GlobalScriptContext; -class Script; -} -} -} -namespace utils { -class SchemaLoader; -} -} - +// main namespace namespace hos { namespace cosgi { namespace service { namespace ruleengine { namespace rules { -using namespace ::libvariant; -class RuleImpl : public virtual Rule { +using namespace libvariant; + + + +/** + * Implementation of Rule. + */ +class RuleImpl + : public virtual Rule, + public implementation::Object { + private: + + RulePackageImpl* parent; + std::string name; std::shared_ptr script; std::shared_ptr exitScript; std::shared_ptr condition; + bool enabled = false; bool currentState = false; public: - RulePackageImpl* const parent; - const std::string name; - RuleImpl(RulePackageImpl* parent, const std::string name); - static std::shared_ptr createRule(RulePackageImpl* parent, const std::string name, Variant raw); + /* Initialization */ - virtual RulePackage* getParent() noexcept { - return parent->castPtr(); + RuleImpl(RulePackageImpl* parent, const std::string& name) + : parent(parent), name(name) {} + + static std::shared_ptr createRule(RulePackageImpl* parent, const std::string& name, const Variant& raw); + + + /* Public Service Implementations */ + + virtual RulePackage* getParent() noexcept override { + return parent; } - virtual const std::string& getName() noexcept { + virtual const std::string& getName() noexcept override { return name; } virtual bool isActive() noexcept override { return currentState; } + virtual bool evaluate() override; + virtual void executeScript(const libvariant::Variant& lContext = libvariant::Variant()) override; + virtual void executeExitScript(const libvariant::Variant& lContext = libvariant::Variant()) override; virtual bool isEnabled() noexcept override { return enabled; } + virtual void setEnabled(bool enabled) noexcept override; - void conditionStateChanged(bool newState, const conditions::ConditionTriggerType& category, const Variant& lcontext = Variant()) noexcept override; + virtual void conditionStateChanged(bool newState, const conditions::ConditionTriggerType& category, const Variant& lcontext = Variant()) noexcept override; std::shared_ptr createRuleCondition(const Variant& raw) override; - devicerepository::DeviceRepositoryService* getDeviceRepository() noexcept override; + }; diff --git a/src/hos_cosgi_ruleengine/src/hos/cosgi/service/ruleengine/rules/RulePackageImpl.cpp b/src/hos_cosgi_ruleengine/src/hos/cosgi/service/ruleengine/rules/RulePackageImpl.cpp index 8d3e16ad..dd90a094 100644 --- a/src/hos_cosgi_ruleengine/src/hos/cosgi/service/ruleengine/rules/RulePackageImpl.cpp +++ b/src/hos_cosgi_ruleengine/src/hos/cosgi/service/ruleengine/rules/RulePackageImpl.cpp @@ -1,31 +1,24 @@ -/* - * RulePackage.cpp - * - * Created on: 29.04.2015 - * Author: matzman - */ +#include "RulePackageImpl.h" #include "RuleImpl.h" - #include #include #include -#include "../RuleEngineServiceImpl.h" -#include "RulePackageImpl.h" + +// main namespace namespace hos { namespace cosgi { namespace service { namespace ruleengine { namespace rules { -RulePackageImpl::RulePackageImpl(service::ruleengine::RuleEngineServiceImpl* parent, const std::string name, const std::string language, const Variant raw) - : parent(parent), name(name), language(language), rawValue(raw) {} -RulePackageImpl::~RulePackageImpl() {} -std::shared_ptr RulePackageImpl::createRulePackage(service::ruleengine::RuleEngineServiceImpl* parent, std::string name, Variant raw) { +std::shared_ptr RulePackageImpl::createRulePackage( service::ruleengine::RuleEngineServiceImpl* parent, + const std::string& name, + const Variant& raw ) { std::shared_ptr retval; if (!parent->getRulePackage(name).expired()) { std::stringstream ss; @@ -33,18 +26,28 @@ std::shared_ptr RulePackageImpl::createRulePackage(service::rul throw std::runtime_error(ss.str()); } if (raw.IsMap()) { + + // language std::string language; if (raw.HasPath("language") && raw["language"].IsString()) { language = raw["language"].AsString(); } else { throw std::runtime_error("Rule package JSON is missing language parameter or parameter has wrong type."); } + + // create rule package retval = std::make_shared(parent, name, language, raw); + + // retrieve scripting service retval->executionService = parent->getExecutionBackend(retval->language); if (retval->executionService) { + + // create global script context if (raw.HasPath("globalcontext")) { retval->globalContext = retval->executionService->createGlobalScriptContext(raw["globalcontext"]); } + + // create rules if (raw.HasPath("rules") && raw["rules"].IsMap()) { for (auto r : raw["rules"].AsMap()) { try { @@ -59,6 +62,7 @@ std::shared_ptr RulePackageImpl::createRulePackage(service::rul if (retval->rules.size() == 0) { throw std::runtime_error("Rule package has no rules."); } + } else { throw std::runtime_error("Rule package JSON is missing rules parameter or parameter has wrong type."); } @@ -78,18 +82,15 @@ std::weak_ptr RulePackageImpl::getRule(const std::string& name) noexcept { return retval; } + std::vector> RulePackageImpl::getRules() noexcept { std::vector> retval; for (auto item : this->rules) { - retval.push_back(dynamic_pointer_cast(item.second)); + retval.push_back(std::static_pointer_cast(item.second)); } return retval; } -std::shared_ptr RulePackageImpl::getConditionFactory(std::string type) { - return parent->getRuleConditionFactory(type); -} - void RulePackageImpl::setEnabled(bool enabled) noexcept { if (this->enabled != enabled) { @@ -107,3 +108,4 @@ void RulePackageImpl::setEnabled(bool enabled) noexcept { } /* namespace service */ } /* namespace cosgi */ } /* namespace hos */ + diff --git a/src/hos_cosgi_ruleengine/src/hos/cosgi/service/ruleengine/rules/RulePackageImpl.h b/src/hos_cosgi_ruleengine/src/hos/cosgi/service/ruleengine/rules/RulePackageImpl.h index 4b921994..27528712 100644 --- a/src/hos_cosgi_ruleengine/src/hos/cosgi/service/ruleengine/rules/RulePackageImpl.h +++ b/src/hos_cosgi_ruleengine/src/hos/cosgi/service/ruleengine/rules/RulePackageImpl.h @@ -2,93 +2,110 @@ #pragma once - #include #include #include "../RuleEngineServiceImpl.h" +#include #include #include #include #include -#include + + + +namespace hos { +namespace cosgi { +namespace service { +namespace ruleengine { +namespace rules { // Forward declarations -namespace hos { -namespace cosgi { -namespace service { -namespace ruleengine { -class RuleEngineServiceImpl; -class RuleConditionFactory; -namespace rules { class RuleImpl; -} -} -namespace scripting { -class GlobalScriptContext; -} -} -} -} -namespace hos { -namespace cosgi { -namespace service { -namespace ruleengine { -namespace rules { - using namespace ::libvariant; + + +/** + * Implementation of RulePackage. + */ class RulePackageImpl - : public virtual RulePackage { + : public virtual RulePackage, + public implementation::Object { private: typedef std::map> ruleMap_t; + + service::ruleengine::RuleEngineServiceImpl* parent; + std::string name; + std::string language; + Variant rawValue; + service::scripting::ScriptingService* executionService = nullptr; std::shared_ptr globalContext; ruleMap_t rules; - Variant rawValue; - bool enabled = false; + bool enabled = false; public: - static std::shared_ptr createRulePackage(service::ruleengine::RuleEngineServiceImpl* parent, std::string name, Variant raw); - RulePackageImpl(service::ruleengine::RuleEngineServiceImpl* parent, const std::string name, const std::string language, Variant raw); - virtual ~RulePackageImpl(); + /* Initialization */ - service::ruleengine::RuleEngineServiceImpl* const parent; - const std::string name; - const std::string language; + static std::shared_ptr createRulePackage( service::ruleengine::RuleEngineServiceImpl* parent, + const std::string& name, + const Variant& raw ); + + RulePackageImpl( service::ruleengine::RuleEngineServiceImpl* parent, + const std::string& name, + const std::string& language, + const Variant& raw ) + : parent(parent), name(name), language(language), rawValue(raw) {} + + + /* Public Service Implementations */ virtual service::ruleengine::RuleEngineService* getParent() noexcept override { - return parent->castPtr(); + return parent; } virtual const std::string& getName() noexcept override { return name; - }; + } + virtual const std::string& getLanguage() noexcept override { return language; } virtual std::weak_ptr getRule(const std::string& name) noexcept override; + virtual std::vector> getRules() noexcept override; - virtual size_t getRuleCount() noexcept override { return rules.size(); } + + virtual size_t getRuleCount() noexcept override { + return rules.size(); + } virtual bool isEnabled() noexcept override { return enabled; } + virtual void setEnabled(bool enabled) noexcept override; - virtual service::scripting::ScriptingService* getScriptingService() noexcept override { return executionService; } - virtual std::weak_ptr getGlobalScriptContext() noexcept override { return globalContext; } - std::shared_ptr getConditionFactory(std::string type); + virtual service::scripting::ScriptingService* getScriptingService() noexcept override { + return executionService; + } + + virtual std::weak_ptr getGlobalScriptContext() noexcept override { + return globalContext; + } + }; + + } /* namespace rules */ } /* namespace ruleengine */ } /* namespace service */ diff --git a/src/hos_cosgi_ruleengine/src/hos/cosgi/service/ruleengine/rules/conditions/DeviceMsgCondition.cpp b/src/hos_cosgi_ruleengine/src/hos/cosgi/service/ruleengine/rules/conditions/DeviceMsgCondition.cpp index 12155647..835b4649 100644 --- a/src/hos_cosgi_ruleengine/src/hos/cosgi/service/ruleengine/rules/conditions/DeviceMsgCondition.cpp +++ b/src/hos_cosgi_ruleengine/src/hos/cosgi/service/ruleengine/rules/conditions/DeviceMsgCondition.cpp @@ -23,7 +23,7 @@ void DeviceMsgCondition::notificationReceived(interface::ObserverdeviceID.compare(e->device->getDeviceID()) == 0) { ROS_INFO_STREAM("Rule " << parent->getName() << ": Device " << deviceID << " appeared."); device = e->device; - parent->getDeviceRepository()->deleteObserver(devicerepository::DeviceEventType::DEVICE_ADDED, this); + parent->getParent()->getParent()->getDeviceRepository()->deleteObserver(devicerepository::DeviceEventType::DEVICE_ADDED, this); _registerAsListener(); } break; @@ -32,7 +32,7 @@ void DeviceMsgCondition::notificationReceived(interface::ObservergetName() << ": Device " << deviceID << " disappeared."); device->deleteObserver(this); device = nullptr; - parent->getDeviceRepository()->addObserver(devicerepository::DeviceEventType::DEVICE_ADDED, this); + parent->getParent()->getParent()->getDeviceRepository()->addObserver(devicerepository::DeviceEventType::DEVICE_ADDED, this); } break; default: @@ -43,21 +43,22 @@ void DeviceMsgCondition::notificationReceived(interface::Observerenabled != enabled) { if (enabled) { - auto repoService = parent->getDeviceRepository(); + auto repoService = parent->getParent()->getParent()->getDeviceRepository(); auto device = repoService->getDevice(deviceID); if (!device.expired()) { this->device = device.lock().get(); _registerAsListener(); } else { ROS_ERROR_STREAM("Rule " << parent->getName() << ": Could not find device " << deviceID); - parent->getDeviceRepository()->addObserver(devicerepository::DeviceEventType::DEVICE_ADDED, this); + auto repoService = parent->getParent()->getParent()->getDeviceRepository(); + repoService->addObserver(devicerepository::DeviceEventType::DEVICE_ADDED, this); } } else { if (device) { device->deleteObserver(this); device = nullptr; } - parent->getDeviceRepository()->deleteObserver(this); + parent->getParent()->getParent()->getDeviceRepository()->deleteObserver(this); } this->enabled = enabled; } diff --git a/src/hos_cosgi_ruleengine/src/hos/cosgi/service/ruleengine/rules/conditions/DeviceMsgCondition.h b/src/hos_cosgi_ruleengine/src/hos/cosgi/service/ruleengine/rules/conditions/DeviceMsgCondition.h index 3b079180..f40daa88 100644 --- a/src/hos_cosgi_ruleengine/src/hos/cosgi/service/ruleengine/rules/conditions/DeviceMsgCondition.h +++ b/src/hos_cosgi_ruleengine/src/hos/cosgi/service/ruleengine/rules/conditions/DeviceMsgCondition.h @@ -8,7 +8,7 @@ #include -// main Namespace +// main namespace namespace hos { namespace cosgi { namespace service { diff --git a/src/hos_cosgi_ruleengine/test/rulepkg01.json b/src/hos_cosgi_ruleengine/test/rulepkg01.json index 823852e7..3f741eab 100644 --- a/src/hos_cosgi_ruleengine/test/rulepkg01.json +++ b/src/hos_cosgi_ruleengine/test/rulepkg01.json @@ -1,6 +1,6 @@ { "language": "python", - "globalcontext": { "code": "print \"GlobalContext: Init!\"\nvar1 = 66.6\nvar2 = 0"}, + "globalcontext": { "code": "print(\"GlobalContext: Init!\")\nvar1 = 66.6\nvar2 = 0"}, "rules": { "rule01": { "condition": { @@ -15,16 +15,16 @@ } ] }, - "script": { "code": "global var2\nprint \"Hello World1: \" + str(var2)\nvar2 = var2 + 1\nimport __main__\nprint \"__main__.__dict__: \" + str(__main__.__dict__)\nprint \"event_type: \" + event_type\nprint \"devices: \" + str(Devices.keys())\nprint \"DeviceCount: \" + str(len(Devices))\nprint \"test: \" + str(Devices[\"dummySwitch1\"])" }, - "exitscript": { "code": "print \"Hello from exitscript1\"" } + "script": { "code": "global var2\nprint(\"Hello World1: \" + str(var2))\nvar2 = var2 + 1\nimport __main__\nprint(\"__main__.__dict__: \" + str(__main__.__dict__))\nprint(\"event_type: \" + event_type)\nprint(\"devices: \" + str(Devices.keys()))\nprint(\"DeviceCount: \" + str(len(Devices)))\nprint(\"test: \" + str(Devices[\"dummySwitch1\"]))" }, + "exitscript": { "code": "print(\"Hello from exitscript1\")" } }, "rule02": { "condition": { "type": "devicestatechange", "deviceid": "dummySwitch0" }, - "script": { "code": "print \"Hello World2: \" + str(var2)\nvar2 = var2 + 1\nimport __main__\nprint \"__main__.__dict__: \" + str(__main__.__dict__)\nprint \"test: \" + event_type" }, - "exitscript": { "code": "print \"Hello from exitscript2\"" } + "script": { "code": "print(\"Hello World2: \" + str(var2))\nvar2 = var2 + 1\nimport __main__\nprint(\"__main__.__dict__: \" + str(__main__.__dict__))\nprint(\"test: \" + event_type)" }, + "exitscript": { "code": "print(\"Hello from exitscript2\")" } }, "rule03": { "condition": { @@ -37,8 +37,8 @@ } ] }, - "script": { "code": "print \"Hello World3: \" + str(var2)\nvar2 = var2 + 1\nimport __main__\nprint \"__main__.__dict__: \" + str(__main__.__dict__)\nprint \"test: \" + event_type" }, - "exitscript": { "code": "print \"Hello from exitscript2\"" } + "script": { "code": "print(\"Hello World3: \" + str(var2))\nvar2 = var2 + 1\nimport __main__\nprint(\"__main__.__dict__: \" + str(__main__.__dict__))\nprint(\"test: \" + event_type)" }, + "exitscript": { "code": "print(\"Hello from exitscript2\")" } }, "rule04": { "condition": { @@ -53,7 +53,7 @@ } ] }, - "script": { "code": "print \"Dimmer 0 reached 100\"\nDevices[\"dummySwitch1\"].sendCommand({\"switch\": {\"set\": True}})" } + "script": { "code": "print(\"Dimmer 0 reached 100\")\nDevices[\"dummySwitch1\"].sendCommand({\"switch\": {\"set\": True}})" } }, "rule05": { "condition": { @@ -68,7 +68,7 @@ } ] }, - "script": { "code": "print \"Dimmer 0 left 100\"\nDevices[\"dummySwitch1\"].sendCommand({\"switch\": {\"set\": False}})" } + "script": { "code": "print(\"Dimmer 0 left 100\")\nDevices[\"dummySwitch1\"].sendCommand({\"switch\": {\"set\": False}})" } } } } \ No newline at end of file diff --git a/src/hos_cosgi_scripting/CMakeLists.txt b/src/hos_cosgi_scripting/CMakeLists.txt index 95eb45ae..b5a6d5a8 100644 --- a/src/hos_cosgi_scripting/CMakeLists.txt +++ b/src/hos_cosgi_scripting/CMakeLists.txt @@ -2,91 +2,22 @@ cmake_minimum_required(VERSION 2.8.3) project(hos_cosgi_scripting) ## Find catkin macros and libraries -## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) -## is used, also find other catkin packages find_package(catkin REQUIRED COMPONENTS hos_cosgi_core hos_deps ) - +## System dependencies are found with CMake's conventions find_package(libvariant REQUIRED) -## System dependencies are found with CMake's conventions -# find_package(Boost REQUIRED COMPONENTS system) - - -## Uncomment this if the package has a setup.py. This macro ensures -## modules and global scripts declared therein get installed -## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html -# catkin_python_setup() - -################################################ -## Declare ROS messages, services and actions ## -################################################ - -## To declare and build messages, services or actions from within this -## package, follow these steps: -## * Let MSG_DEP_SET be the set of packages whose message types you use in -## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...). -## * In the file package.xml: -## * add a build_depend and a run_depend tag for each package in MSG_DEP_SET -## * If MSG_DEP_SET isn't empty the following dependencies might have been -## pulled in transitively but can be declared for certainty nonetheless: -## * add a build_depend tag for "message_generation" -## * add a run_depend tag for "message_runtime" -## * In this file (CMakeLists.txt): -## * add "message_generation" and every package in MSG_DEP_SET to -## find_package(catkin REQUIRED COMPONENTS ...) -## * add "message_runtime" and every package in MSG_DEP_SET to -## catkin_package(CATKIN_DEPENDS ...) -## * uncomment the add_*_files sections below as needed -## and list every .msg/.srv/.action file to be processed -## * uncomment the generate_messages entry below -## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...) - -## Generate messages in the 'msg' folder -# add_message_files( -# FILES -# Message1.msg -# Message2.msg -# ) - -## Generate services in the 'srv' folder -# add_service_files( -# FILES -# Service1.srv -# Service2.srv -# ) - -## Generate actions in the 'action' folder -# add_action_files( -# FILES -# Action1.action -# Action2.action -# ) - -## Generate added messages and services with any dependencies listed here -# generate_messages( -# DEPENDENCIES -# std_msgs # Or other packages containing msgs -# ) - ################################### ## catkin specific configuration ## ################################### -## The catkin_package macro generates cmake config files for your package -## Declare things to be passed to dependent projects -## INCLUDE_DIRS: uncomment this if you package contains header files -## LIBRARIES: libraries you create in this project that dependent projects also need -## CATKIN_DEPENDS: catkin_packages dependent projects also need -## DEPENDS: system dependencies of this project that dependent projects also need + catkin_package( - INCLUDE_DIRS include/${PROJECT_NAME}/ -# LIBRARIES hos_cosgi_scripting - CATKIN_DEPENDS hos_cosgi_core hos_deps -# DEPENDS system_lib + INCLUDE_DIRS include/${PROJECT_NAME}/ + CATKIN_DEPENDS hos_cosgi_core ) ########### @@ -99,26 +30,6 @@ include_directories( ${libvariant_INCLUDE_DIR} ) -## Specify additional locations of header files -## Your package locations should be listed before other locations -# include_directories(include) - -## Declare a cpp library -# add_library(hos_cosgi_scripting -# src/${PROJECT_NAME}/hos_cosgi_scripting.cpp -# ) - -## Declare a cpp executable -# add_executable(hos_cosgi_scripting_node src/hos_cosgi_scripting_node.cpp) - -## Add cmake target dependencies of the executable/library -## as an example, message headers may need to be generated before nodes -# add_dependencies(hos_cosgi_scripting_node hos_cosgi_scripting_generate_messages_cpp) - -## Specify libraries to link a library or executable target against -# target_link_libraries(hos_cosgi_scripting_node -# ${catkin_LIBRARIES} -# ) ############# ## Install ## @@ -130,46 +41,22 @@ install(DIRECTORY include/${PROJECT_NAME}/ FILES_MATCHING PATTERN "*.h" ) -# all install targets should use catkin DESTINATION variables -# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html +install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc + DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} + OPTIONAL +) -## Mark executable scripts (Python etc.) for installation -## in contrast to setup.py, you can choose the destination -# install(PROGRAMS -# scripts/my_python_script -# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} -# ) -## Mark executables and/or libraries for installation -# install(TARGETS hos_cosgi_scripting hos_cosgi_scripting_node -# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} -# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} -# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} -# ) +################### +## Documentation ## +################### -## Mark cpp header files for installation -# install(DIRECTORY include/${PROJECT_NAME}/ -# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} -# FILES_MATCHING PATTERN "*.h" -# PATTERN ".svn" EXCLUDE -# ) +find_package(Doxygen) +if(DOXYGEN_FOUND) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) + add_custom_target(doc + ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) +endif(DOXYGEN_FOUND) -## Mark other files for installation (e.g. launch and bag files, etc.) -# install(FILES -# # myfile1 -# # myfile2 -# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} -# ) - -############# -## Testing ## -############# - -## Add gtest based cpp test target and link libraries -# catkin_add_gtest(${PROJECT_NAME}-test test/test_hos_cosgi_scripting.cpp) -# if(TARGET ${PROJECT_NAME}-test) -# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME}) -# endif() - -## Add folders to be run by python nosetests -# catkin_add_nosetests(test) diff --git a/src/hos_cosgi_scripting/Doxyfile.in b/src/hos_cosgi_scripting/Doxyfile.in new file mode 100644 index 00000000..d7492c7a --- /dev/null +++ b/src/hos_cosgi_scripting/Doxyfile.in @@ -0,0 +1,247 @@ +# Doxyfile 1.8.8 + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +DOXYFILE_ENCODING = UTF-8 +PROJECT_NAME = hos_cosgi_scripting +OUTPUT_DIRECTORY = doc +CREATE_SUBDIRS = NO +ALLOW_UNICODE_NAMES = NO +OUTPUT_LANGUAGE = English +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = NO +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +QT_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 4 +OPTIMIZE_OUTPUT_FOR_C = NO +OPTIMIZE_OUTPUT_JAVA = NO +OPTIMIZE_FOR_FORTRAN = NO +OPTIMIZE_OUTPUT_VHDL = NO +MARKDOWN_SUPPORT = YES +AUTOLINK_SUPPORT = YES +BUILTIN_STL_SUPPORT = NO +CPP_CLI_SUPPORT = NO +SIP_SUPPORT = NO +IDL_PROPERTY_SUPPORT = YES +DISTRIBUTE_GROUP_DOC = NO +SUBGROUPING = YES +INLINE_GROUPED_CLASSES = NO +INLINE_SIMPLE_STRUCTS = NO +TYPEDEF_HIDES_STRUCT = NO +LOOKUP_CACHE_SIZE = 0 +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = YES +EXTRACT_PRIVATE = NO +EXTRACT_PACKAGE = NO +EXTRACT_STATIC = NO +EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_METHODS = NO +EXTRACT_ANON_NSPACES = NO +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = NO +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +SHOW_GROUPED_MEMB_INC = NO +FORCE_LOCAL_INCLUDES = NO +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +SORT_MEMBERS_CTORS_1ST = NO +SORT_GROUP_NAMES = NO +SORT_BY_SCOPE_NAME = NO +STRICT_PROTO_MATCHING = NO +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_FILES = YES +SHOW_NAMESPACES = YES +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_FORMAT = "$file:$line: $text" +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = @CMAKE_CURRENT_SOURCE_DIR@/include +INPUT_ENCODING = UTF-8 +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.idl \ + *.ddl \ + *.odl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.cs \ + *.d \ + *.php \ + *.php4 \ + *.php5 \ + *.phtml \ + *.inc \ + *.m \ + *.markdown \ + *.md \ + *.mm \ + *.dox \ + *.py \ + *.f90 \ + *.f \ + *.for \ + *.tcl \ + *.vhd \ + *.vhdl \ + *.ucf \ + *.qsf \ + *.as \ + *.js +RECURSIVE = YES +EXCLUDE_SYMLINKS = NO +EXAMPLE_PATTERNS = * +EXAMPLE_RECURSIVE = NO +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = NO +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = NO +REFERENCES_RELATION = NO +REFERENCES_LINK_SOURCE = YES +SOURCE_TOOLTIPS = YES +USE_HTAGS = NO +VERBATIM_HEADERS = YES +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 5 +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_COLORSTYLE_HUE = 220 +HTML_COLORSTYLE_SAT = 100 +HTML_COLORSTYLE_GAMMA = 80 +HTML_TIMESTAMP = YES +HTML_DYNAMIC_SECTIONS = NO +HTML_INDEX_NUM_ENTRIES = 100 +GENERATE_DOCSET = NO +DOCSET_FEEDNAME = "Doxygen generated docs" +DOCSET_BUNDLE_ID = org.doxygen.Project +DOCSET_PUBLISHER_ID = org.doxygen.Publisher +DOCSET_PUBLISHER_NAME = Publisher +GENERATE_HTMLHELP = NO +GENERATE_CHI = NO +BINARY_TOC = NO +TOC_EXPAND = NO +GENERATE_QHP = NO +QHP_NAMESPACE = org.doxygen.Project +QHP_VIRTUAL_FOLDER = doc +GENERATE_ECLIPSEHELP = NO +ECLIPSE_DOC_ID = org.doxygen.Project +DISABLE_INDEX = NO +GENERATE_TREEVIEW = YES +ENUM_VALUES_PER_LINE = 4 +TREEVIEW_WIDTH = 250 +EXT_LINKS_IN_WINDOW = NO +FORMULA_FONTSIZE = 10 +FORMULA_TRANSPARENT = YES +USE_MATHJAX = NO +MATHJAX_FORMAT = HTML-CSS +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest +SEARCHENGINE = YES +SERVER_BASED_SEARCH = NO +EXTERNAL_SEARCH = NO +SEARCHDATA_FILE = searchdata.xml +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = NO +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration options related to external references +#--------------------------------------------------------------------------- +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +EXTERNAL_PAGES = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = NO +DOT_NUM_THREADS = 0 +DOT_FONTNAME = Helvetica +DOT_FONTSIZE = 10 +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +UML_LIMIT_NUM_FIELDS = 10 +TEMPLATE_RELATIONS = NO +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +CALLER_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +INTERACTIVE_SVG = NO +DOT_GRAPH_MAX_NODES = 50 +MAX_DOT_GRAPH_DEPTH = 0 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES diff --git a/src/hos_cosgi_scripting_python/CMakeLists.txt b/src/hos_cosgi_scripting_python/CMakeLists.txt index 81e63529..8307c597 100644 --- a/src/hos_cosgi_scripting_python/CMakeLists.txt +++ b/src/hos_cosgi_scripting_python/CMakeLists.txt @@ -2,8 +2,6 @@ cmake_minimum_required(VERSION 2.8.3) project(hos_cosgi_scripting_python) ## Find catkin macros and libraries -## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) -## is used, also find other catkin packages find_package(catkin REQUIRED COMPONENTS hos_celix hos_cosgi_core @@ -13,106 +11,63 @@ find_package(catkin REQUIRED COMPONENTS hos_deps ) +set(USE_PYTHON_VERSION 2 CACHE STRING "Use Python version") + ## System dependencies are found with CMake's conventions -# find_package(Boost REQUIRED COMPONENTS system) - - -## Uncomment this if the package has a setup.py. This macro ensures -## modules and global scripts declared therein get installed -## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html -# catkin_python_setup() - find_package(APR REQUIRED) find_package(CELIX REQUIRED) -find_package(Boost REQUIRED COMPONENTS python) find_package(libvariant REQUIRED) +find_package(PythonLibs ${USE_PYTHON_VERSION} REQUIRED) +if (USE_PYTHON_VERSION EQUAL 2) + find_package(Boost REQUIRED COMPONENTS python) +elseif(USE_PYTHON_VERSION EQUAL 3) + #find_package(Boost REQUIRED COMPONENTS python-py34) + + # Taken from http://code.metager.de/source/xref/lib/OpenImageIO/src/python/CMakeLists.txt: + #Finding the python3 component for boost is a little tricky, since it has + #different names on different systems. Try the most common ones + #(boost_python3, boost_python-py34, …). + foreach (_boost_py3_lib python3 python-py34 python-py33 python-py32) + find_package (Boost 1.42 QUIET COMPONENTS ${_boost_py3_lib}) + string (TOUPPER ${_boost_py3_lib} boost_py3_lib_name) + if (Boost_${boost_py3_lib_name}_FOUND) + #Not the most beautiful thing to do, but that gets them included in + #the target_link_libraries(…) call farther down + set (Boost_PYTHON_LIBRARIES ${Boost_${boost_py3_lib_name}_LIBRARIES}) + break () + endif () + endforeach () + +else() + message( FATAL_ERROR "Unsupported Python version ${USE_PYTHON_VERSION}" ) +endif() -################################################ -## Declare ROS messages, services and actions ## -################################################ - -## To declare and build messages, services or actions from within this -## package, follow these steps: -## * Let MSG_DEP_SET be the set of packages whose message types you use in -## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...). -## * In the file package.xml: -## * add a build_depend and a run_depend tag for each package in MSG_DEP_SET -## * If MSG_DEP_SET isn't empty the following dependencies might have been -## pulled in transitively but can be declared for certainty nonetheless: -## * add a build_depend tag for "message_generation" -## * add a run_depend tag for "message_runtime" -## * In this file (CMakeLists.txt): -## * add "message_generation" and every package in MSG_DEP_SET to -## find_package(catkin REQUIRED COMPONENTS ...) -## * add "message_runtime" and every package in MSG_DEP_SET to -## catkin_package(CATKIN_DEPENDS ...) -## * uncomment the add_*_files sections below as needed -## and list every .msg/.srv/.action file to be processed -## * uncomment the generate_messages entry below -## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...) - -## Generate messages in the 'msg' folder -# add_message_files( -# FILES -# Message1.msg -# Message2.msg -# ) - -## Generate services in the 'srv' folder -# add_service_files( -# FILES -# Service1.srv -# Service2.srv -# ) - -## Generate actions in the 'action' folder -# add_action_files( -# FILES -# Action1.action -# Action2.action -# ) - -## Generate added messages and services with any dependencies listed here -# generate_messages( -# DEPENDENCIES -# std_msgs # Or other packages containing msgs -# ) ################################### ## catkin specific configuration ## ################################### -## The catkin_package macro generates cmake config files for your package -## Declare things to be passed to dependent projects -## INCLUDE_DIRS: uncomment this if you package contains header files -## LIBRARIES: libraries you create in this project that dependent projects also need -## CATKIN_DEPENDS: catkin_packages dependent projects also need -## DEPENDS: system dependencies of this project that dependent projects also need + catkin_package( -# INCLUDE_DIRS include -# LIBRARIES hos_cosgi_ruleexecution_python - CATKIN_DEPENDS hos_celix hos_cosgi_core hos_cosgi_scripting hos_cpp_utils hos_deps hos_cosgi_devicerepository -# DEPENDS system_lib + CATKIN_DEPENDS hos_celix hos_cosgi_core hos_cosgi_scripting hos_cpp_utils ) + ########### ## Build ## ########### add_definitions( -std=c++11 + -D_PYTHON_${USE_PYTHON_VERSION}_ ) -## Specify additional locations of header files -## Your package locations should be listed before other locations -# include_directories(include) include_directories( ${catkin_INCLUDE_DIRS} ${APR_INCLUDE_DIR} ${APR_INCLUDE_DIR}/apr-1.0 - include ${libvariant_INCLUDE_DIR} - /usr/include/python2.7 + ${PYTHON_INCLUDE_DIRS} ) set(BUNDLE_SYMBOLICNAME "hos.hos_scripting_python") @@ -126,87 +81,41 @@ bundle(hos_cosgi_scripting_python ${PROJECT_SOURCE_DIR}/src/hos/cosgi/service/scripting/python/utils/utils ${PROJECT_SOURCE_DIR}/src/hos/cosgi/service/scripting/python/hosapi/PyHOSAPI ) + target_link_libraries(hos_cosgi_scripting_python ${catkin_LIBRARIES} ${APR_LIBRARIES} ${Boost_LIBRARIES} - ${libvariant_LIBRARY} - python2.7 + ${libvariant_LIBRARIES} + ${PYTHON_LIBRARIES} ) -## Declare a cpp library -# add_library(hos_cosgi_ruleexecution_python -# src/${PROJECT_NAME}/hos_cosgi_ruleexecution_python.cpp -# ) - -## Declare a cpp executable -# add_executable(hos_cosgi_ruleexecution_python_node src/hos_cosgi_ruleexecution_python_node.cpp) - -## Add cmake target dependencies of the executable/library -## as an example, message headers may need to be generated before nodes -# add_dependencies(hos_cosgi_ruleexecution_python_node hos_cosgi_ruleexecution_python_generate_messages_cpp) - -## Specify libraries to link a library or executable target against -# target_link_libraries(hos_cosgi_ruleexecution_python_node -# ${catkin_LIBRARIES} -# ) ############# ## Install ## ############# -## Mark cpp header files for installation -#install(DIRECTORY include/${PROJECT_NAME}/ -# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} -# FILES_MATCHING PATTERN "*.h" -#) - install(FILES ${CMAKE_BINARY_DIR}/hos_cosgi_scripting_python.zip DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/bundles ) +install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc + DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} + OPTIONAL +) -# all install targets should use catkin DESTINATION variables -# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html -## Mark executable scripts (Python etc.) for installation -## in contrast to setup.py, you can choose the destination -# install(PROGRAMS -# scripts/my_python_script -# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} -# ) +################### +## Documentation ## +################### -## Mark executables and/or libraries for installation -# install(TARGETS hos_cosgi_ruleexecution_python hos_cosgi_ruleexecution_python_node -# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} -# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} -# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} -# ) +find_package(Doxygen) +if(DOXYGEN_FOUND) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) + add_custom_target(doc + ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) +endif(DOXYGEN_FOUND) -## Mark cpp header files for installation -# install(DIRECTORY include/${PROJECT_NAME}/ -# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} -# FILES_MATCHING PATTERN "*.h" -# PATTERN ".svn" EXCLUDE -# ) - -## Mark other files for installation (e.g. launch and bag files, etc.) -# install(FILES -# # myfile1 -# # myfile2 -# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} -# ) - -############# -## Testing ## -############# - -## Add gtest based cpp test target and link libraries -# catkin_add_gtest(${PROJECT_NAME}-test test/test_hos_cosgi_ruleexecution_python.cpp) -# if(TARGET ${PROJECT_NAME}-test) -# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME}) -# endif() - -## Add folders to be run by python nosetests -# catkin_add_nosetests(test) diff --git a/src/hos_cosgi_scripting_python/Doxyfile.in b/src/hos_cosgi_scripting_python/Doxyfile.in new file mode 100644 index 00000000..31b0f0c6 --- /dev/null +++ b/src/hos_cosgi_scripting_python/Doxyfile.in @@ -0,0 +1,247 @@ +# Doxyfile 1.8.8 + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +DOXYFILE_ENCODING = UTF-8 +PROJECT_NAME = hos_cosgi_scripting_python +OUTPUT_DIRECTORY = doc +CREATE_SUBDIRS = NO +ALLOW_UNICODE_NAMES = NO +OUTPUT_LANGUAGE = English +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = NO +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +QT_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 4 +OPTIMIZE_OUTPUT_FOR_C = NO +OPTIMIZE_OUTPUT_JAVA = NO +OPTIMIZE_FOR_FORTRAN = NO +OPTIMIZE_OUTPUT_VHDL = NO +MARKDOWN_SUPPORT = YES +AUTOLINK_SUPPORT = YES +BUILTIN_STL_SUPPORT = NO +CPP_CLI_SUPPORT = NO +SIP_SUPPORT = NO +IDL_PROPERTY_SUPPORT = YES +DISTRIBUTE_GROUP_DOC = NO +SUBGROUPING = YES +INLINE_GROUPED_CLASSES = NO +INLINE_SIMPLE_STRUCTS = NO +TYPEDEF_HIDES_STRUCT = NO +LOOKUP_CACHE_SIZE = 0 +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = YES +EXTRACT_PRIVATE = NO +EXTRACT_PACKAGE = NO +EXTRACT_STATIC = NO +EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_METHODS = NO +EXTRACT_ANON_NSPACES = NO +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = NO +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +SHOW_GROUPED_MEMB_INC = NO +FORCE_LOCAL_INCLUDES = NO +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +SORT_MEMBERS_CTORS_1ST = NO +SORT_GROUP_NAMES = NO +SORT_BY_SCOPE_NAME = NO +STRICT_PROTO_MATCHING = NO +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_FILES = YES +SHOW_NAMESPACES = YES +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_FORMAT = "$file:$line: $text" +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = @CMAKE_CURRENT_SOURCE_DIR@/src +INPUT_ENCODING = UTF-8 +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.idl \ + *.ddl \ + *.odl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.cs \ + *.d \ + *.php \ + *.php4 \ + *.php5 \ + *.phtml \ + *.inc \ + *.m \ + *.markdown \ + *.md \ + *.mm \ + *.dox \ + *.py \ + *.f90 \ + *.f \ + *.for \ + *.tcl \ + *.vhd \ + *.vhdl \ + *.ucf \ + *.qsf \ + *.as \ + *.js +RECURSIVE = YES +EXCLUDE_SYMLINKS = NO +EXAMPLE_PATTERNS = * +EXAMPLE_RECURSIVE = NO +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = NO +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = NO +REFERENCES_RELATION = NO +REFERENCES_LINK_SOURCE = YES +SOURCE_TOOLTIPS = YES +USE_HTAGS = NO +VERBATIM_HEADERS = YES +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 5 +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_COLORSTYLE_HUE = 220 +HTML_COLORSTYLE_SAT = 100 +HTML_COLORSTYLE_GAMMA = 80 +HTML_TIMESTAMP = YES +HTML_DYNAMIC_SECTIONS = NO +HTML_INDEX_NUM_ENTRIES = 100 +GENERATE_DOCSET = NO +DOCSET_FEEDNAME = "Doxygen generated docs" +DOCSET_BUNDLE_ID = org.doxygen.Project +DOCSET_PUBLISHER_ID = org.doxygen.Publisher +DOCSET_PUBLISHER_NAME = Publisher +GENERATE_HTMLHELP = NO +GENERATE_CHI = NO +BINARY_TOC = NO +TOC_EXPAND = NO +GENERATE_QHP = NO +QHP_NAMESPACE = org.doxygen.Project +QHP_VIRTUAL_FOLDER = doc +GENERATE_ECLIPSEHELP = NO +ECLIPSE_DOC_ID = org.doxygen.Project +DISABLE_INDEX = NO +GENERATE_TREEVIEW = YES +ENUM_VALUES_PER_LINE = 4 +TREEVIEW_WIDTH = 250 +EXT_LINKS_IN_WINDOW = NO +FORMULA_FONTSIZE = 10 +FORMULA_TRANSPARENT = YES +USE_MATHJAX = NO +MATHJAX_FORMAT = HTML-CSS +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest +SEARCHENGINE = YES +SERVER_BASED_SEARCH = NO +EXTERNAL_SEARCH = NO +SEARCHDATA_FILE = searchdata.xml +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = NO +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration options related to external references +#--------------------------------------------------------------------------- +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +EXTERNAL_PAGES = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = NO +DOT_NUM_THREADS = 0 +DOT_FONTNAME = Helvetica +DOT_FONTSIZE = 10 +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +UML_LIMIT_NUM_FIELDS = 10 +TEMPLATE_RELATIONS = NO +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +CALLER_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +INTERACTIVE_SVG = NO +DOT_GRAPH_MAX_NODES = 50 +MAX_DOT_GRAPH_DEPTH = 0 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES diff --git a/src/hos_cosgi_scripting_python/src/BundleActivator.cpp b/src/hos_cosgi_scripting_python/src/BundleActivator.cpp index 2e6f97b8..cde70553 100644 --- a/src/hos_cosgi_scripting_python/src/BundleActivator.cpp +++ b/src/hos_cosgi_scripting_python/src/BundleActivator.cpp @@ -46,7 +46,7 @@ celix_status_t cb_serviceChanged(void* listener, service_event_pt event) { myUserData->serviceImpl->setRepoService(service); checkReg = true; } - // Register hos-devicerepository-service + // Register python scripting service if (checkReg && !myUserData->serviceReg && myUserData->serviceImpl->isInitialized()) { bundleContext_registerService(myUserData->bundleContext, (char*)PyScriptingService::SERVICE_NAME, myUserData->serviceImpl.get(), nullptr, &myUserData->serviceReg); } diff --git a/src/hos_cosgi_scripting_python/src/hos/cosgi/service/scripting/python/PyScriptingServiceImpl.cpp b/src/hos_cosgi_scripting_python/src/hos/cosgi/service/scripting/python/PyScriptingServiceImpl.cpp index f5708feb..c7ccffe2 100644 --- a/src/hos_cosgi_scripting_python/src/hos/cosgi/service/scripting/python/PyScriptingServiceImpl.cpp +++ b/src/hos_cosgi_scripting_python/src/hos/cosgi/service/scripting/python/PyScriptingServiceImpl.cpp @@ -64,7 +64,13 @@ void PyScriptingService::init() noexcept { ROS_INFO_STREAM("PyScriptingService: Python Version: " << version); // Initialize HOS Python API - inithos(); + #if defined ( _PYTHON_2_ ) + inithos(); + #elif defined ( _PYTHON_3_ ) + init_module_hos(); + #else + #error "Python version not defined" + #endif deviceService.reset(new hosapi::PyDeviceRepositoryWrapper(repoService)); initialized = true; @@ -109,12 +115,12 @@ std::shared_ptr PyScriptingService::createScript(con void PyScript::execute( std::shared_ptr gContext, const libvariant::Variant& lContext ) { try { - auto gCont = dynamic_pointer_cast(gContext); // Get global scope boost::python::object* gscope; if (gContext) { - gscope = &dynamic_pointer_cast(gContext)->getPyObject(); + auto gCont = dynamic_pointer_cast(gContext); + gscope = &gCont->getPyObject(); } else { gscope = &service->getPyDefaultScrope(); } diff --git a/src/hos_cosgi_scripting_python/src/hos/cosgi/service/scripting/python/PyScriptingServiceImpl.h b/src/hos_cosgi_scripting_python/src/hos/cosgi/service/scripting/python/PyScriptingServiceImpl.h index 2207ed06..7d44395f 100644 --- a/src/hos_cosgi_scripting_python/src/hos/cosgi/service/scripting/python/PyScriptingServiceImpl.h +++ b/src/hos_cosgi_scripting_python/src/hos/cosgi/service/scripting/python/PyScriptingServiceImpl.h @@ -39,7 +39,8 @@ using namespace libvariant; * Python implementation of GlobalScriptContext. */ class PyGlobalScriptContext - : public virtual service::scripting::GlobalScriptContext { + : public virtual service::scripting::GlobalScriptContext, + public implementation::Object { private: @@ -70,7 +71,8 @@ public: * Python implementation of Script. */ class PyScript - : public virtual service::scripting::Script { + : public virtual service::scripting::Script, + public implementation::Object { private: diff --git a/src/hos_cosgi_scripting_python/src/hos/cosgi/service/scripting/python/hosapi/PyHOSAPI.h b/src/hos_cosgi_scripting_python/src/hos/cosgi/service/scripting/python/hosapi/PyHOSAPI.h index d1318c4d..6b0dea95 100644 --- a/src/hos_cosgi_scripting_python/src/hos/cosgi/service/scripting/python/hosapi/PyHOSAPI.h +++ b/src/hos_cosgi_scripting_python/src/hos/cosgi/service/scripting/python/hosapi/PyHOSAPI.h @@ -12,7 +12,13 @@ /** * This function declares the python hos module. */ -extern "C" void inithos(); +#if defined ( _PYTHON_2_ ) + extern "C" void inithos(); +#elif defined ( _PYTHON_3_ ) + extern "C" void init_module_hos(); +#else + #error "Python version not defined" +#endif diff --git a/src/hos_cosgi_scripting_python/src/hos/cosgi/service/scripting/python/utils/utils.cpp b/src/hos_cosgi_scripting_python/src/hos/cosgi/service/scripting/python/utils/utils.cpp index 8974d887..d1617db9 100644 --- a/src/hos_cosgi_scripting_python/src/hos/cosgi/service/scripting/python/utils/utils.cpp +++ b/src/hos_cosgi_scripting_python/src/hos/cosgi/service/scripting/python/utils/utils.cpp @@ -48,14 +48,14 @@ boost::python::object convertVariantToBoostPython(const libvariant::Variant& var libvariant::Variant convertBoostPythonTovariant(const boost::python::object& obj) noexcept { libvariant::Variant retval; if (!obj.is_none()) { - if (PyObject_TypeCheck(obj.ptr(), &PyString_Type)) { + if (PyObject_TypeCheck(obj.ptr(), &PyUnicode_Type)) { retval = libvariant::Variant(boost::python::extract(obj)); } else if (PyObject_TypeCheck(obj.ptr(), &PyBool_Type)) { retval = libvariant::Variant(boost::python::extract(obj)); } else if (PyObject_TypeCheck(obj.ptr(), &PyFloat_Type)) { retval = libvariant::Variant(boost::python::extract(obj)); - } else if (PyObject_TypeCheck(obj.ptr(), &PyInt_Type)) { - retval = libvariant::Variant(boost::python::extract(obj)); + } else if (PyObject_TypeCheck(obj.ptr(), &PyLong_Type)) { + retval = libvariant::Variant(boost::python::extract(obj)); } else if (PyObject_TypeCheck(obj.ptr(), &PyDict_Type)) { boost::python::dict dict = boost::python::extract(obj); for (int i = 0; i < boost::python::len(dict); i++) { diff --git a/src/hos_cosgi_webserver/CMakeLists.txt b/src/hos_cosgi_webserver/CMakeLists.txt index e318223e..14961e68 100644 --- a/src/hos_cosgi_webserver/CMakeLists.txt +++ b/src/hos_cosgi_webserver/CMakeLists.txt @@ -2,8 +2,6 @@ cmake_minimum_required(VERSION 2.8.3) project(hos_cosgi_webserver) ## Find catkin macros and libraries -## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) -## is used, also find other catkin packages find_package(catkin REQUIRED COMPONENTS hos_celix hos_cosgi_devicerepository @@ -14,87 +12,23 @@ find_package(catkin REQUIRED COMPONENTS ) ## System dependencies are found with CMake's conventions -# find_package(Boost REQUIRED COMPONENTS system) - - -## Uncomment this if the package has a setup.py. This macro ensures -## modules and global scripts declared therein get installed -## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html -# catkin_python_setup() - find_package(APR REQUIRED) find_package(CELIX REQUIRED) find_package(Boost REQUIRED) find_package(libvariant REQUIRED) find_package(libhttpserver REQUIRED) -################################################ -## Declare ROS messages, services and actions ## -################################################ - -## To declare and build messages, services or actions from within this -## package, follow these steps: -## * Let MSG_DEP_SET be the set of packages whose message types you use in -## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...). -## * In the file package.xml: -## * add a build_depend and a run_depend tag for each package in MSG_DEP_SET -## * If MSG_DEP_SET isn't empty the following dependencies might have been -## pulled in transitively but can be declared for certainty nonetheless: -## * add a build_depend tag for "message_generation" -## * add a run_depend tag for "message_runtime" -## * In this file (CMakeLists.txt): -## * add "message_generation" and every package in MSG_DEP_SET to -## find_package(catkin REQUIRED COMPONENTS ...) -## * add "message_runtime" and every package in MSG_DEP_SET to -## catkin_package(CATKIN_DEPENDS ...) -## * uncomment the add_*_files sections below as needed -## and list every .msg/.srv/.action file to be processed -## * uncomment the generate_messages entry below -## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...) - -## Generate messages in the 'msg' folder -# add_message_files( -# FILES -# Message1.msg -# Message2.msg -# ) - -## Generate services in the 'srv' folder -# add_service_files( -# FILES -# Service1.srv -# Service2.srv -# ) - -## Generate actions in the 'action' folder -# add_action_files( -# FILES -# Action1.action -# Action2.action -# ) - -## Generate added messages and services with any dependencies listed here -# generate_messages( -# DEPENDENCIES -# std_msgs # Or other packages containing msgs -# ) ################################### ## catkin specific configuration ## ################################### -## The catkin_package macro generates cmake config files for your package -## Declare things to be passed to dependent projects -## INCLUDE_DIRS: uncomment this if you package contains header files -## LIBRARIES: libraries you create in this project that dependent projects also need -## CATKIN_DEPENDS: catkin_packages dependent projects also need -## DEPENDS: system dependencies of this project that dependent projects also need + catkin_package( -# INCLUDE_DIRS include -# LIBRARIES hos_cosgi_webserver -# CATKIN_DEPENDS hos_celix hos_cosgi_devicerepository hos_cosgi_core hos_cpp_utils hos_libhttpserver hos_libvariant roscpp -# DEPENDS system_lib + INCLUDE_DIRS include/${PROJECT_NAME}/ + CATKIN_DEPENDS hos_celix hos_cosgi_core hos_cpp_utils roscpp ) + ########### ## Build ## ########### @@ -103,15 +37,12 @@ add_definitions( -std=c++11 ) -## Specify additional locations of header files -## Your package locations should be listed before other locations -# include_directories(include) include_directories( + include/${PROJECT_NAME}/ ${catkin_INCLUDE_DIRS} ${APR_INCLUDE_DIR} ${APR_INCLUDE_DIR}/apr-1.0 - include/${PROJECT_NAME}/ - ${libvariant_INCLUDE_DIR} + ${libvariant_INCLUDE_DIRS} ${libhttpserver_INCLUDE_DIRS} ) @@ -126,6 +57,7 @@ bundle(hos_cosgi_webserver ${PROJECT_SOURCE_DIR}/src/hos/cosgi/service/webserver/resources/DevicesHTTPResource ${PROJECT_SOURCE_DIR}/src/hos/cosgi/service/webserver/resources/SchemaHTTPResource ) + target_link_libraries(hos_cosgi_webserver ${catkin_LIBRARIES} ${APR_LIBRARIES} @@ -134,23 +66,6 @@ target_link_libraries(hos_cosgi_webserver ) -## Declare a cpp library -# add_library(hos_cosgi_webserver -# src/${PROJECT_NAME}/hos_cosgi_webserver.cpp -# ) - -## Declare a cpp executable -# add_executable(hos_cosgi_webserver_node src/hos_cosgi_webserver_node.cpp) - -## Add cmake target dependencies of the executable/library -## as an example, message headers may need to be generated before nodes -# add_dependencies(hos_cosgi_webserver_node hos_cosgi_webserver_generate_messages_cpp) - -## Specify libraries to link a library or executable target against -# target_link_libraries(hos_cosgi_webserver_node -# ${catkin_LIBRARIES} -# ) - ############# ## Install ## ############# @@ -166,47 +81,22 @@ install(FILES DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/bundles ) +install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc + DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} + OPTIONAL +) -# all install targets should use catkin DESTINATION variables -# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html -## Mark executable scripts (Python etc.) for installation -## in contrast to setup.py, you can choose the destination -# install(PROGRAMS -# scripts/my_python_script -# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} -# ) +################### +## Documentation ## +################### -## Mark executables and/or libraries for installation -# install(TARGETS hos_cosgi_webserver hos_cosgi_webserver_node -# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} -# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} -# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} -# ) +find_package(Doxygen) +if(DOXYGEN_FOUND) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) + add_custom_target(doc + ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) +endif(DOXYGEN_FOUND) -## Mark cpp header files for installation -# install(DIRECTORY include/${PROJECT_NAME}/ -# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} -# FILES_MATCHING PATTERN "*.h" -# PATTERN ".svn" EXCLUDE -# ) - -## Mark other files for installation (e.g. launch and bag files, etc.) -# install(FILES -# # myfile1 -# # myfile2 -# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} -# ) - -############# -## Testing ## -############# - -## Add gtest based cpp test target and link libraries -# catkin_add_gtest(${PROJECT_NAME}-test test/test_hos_cosgi_webserver.cpp) -# if(TARGET ${PROJECT_NAME}-test) -# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME}) -# endif() - -## Add folders to be run by python nosetests -# catkin_add_nosetests(test) diff --git a/src/hos_cosgi_webserver/Doxyfile.in b/src/hos_cosgi_webserver/Doxyfile.in new file mode 100644 index 00000000..ed73b7ec --- /dev/null +++ b/src/hos_cosgi_webserver/Doxyfile.in @@ -0,0 +1,248 @@ +# Doxyfile 1.8.8 + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +DOXYFILE_ENCODING = UTF-8 +PROJECT_NAME = hos_cosgi_webserver +OUTPUT_DIRECTORY = doc +CREATE_SUBDIRS = NO +ALLOW_UNICODE_NAMES = NO +OUTPUT_LANGUAGE = English +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = NO +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +QT_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 4 +OPTIMIZE_OUTPUT_FOR_C = NO +OPTIMIZE_OUTPUT_JAVA = NO +OPTIMIZE_FOR_FORTRAN = NO +OPTIMIZE_OUTPUT_VHDL = NO +MARKDOWN_SUPPORT = YES +AUTOLINK_SUPPORT = YES +BUILTIN_STL_SUPPORT = NO +CPP_CLI_SUPPORT = NO +SIP_SUPPORT = NO +IDL_PROPERTY_SUPPORT = YES +DISTRIBUTE_GROUP_DOC = NO +SUBGROUPING = YES +INLINE_GROUPED_CLASSES = NO +INLINE_SIMPLE_STRUCTS = NO +TYPEDEF_HIDES_STRUCT = NO +LOOKUP_CACHE_SIZE = 0 +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = YES +EXTRACT_PRIVATE = NO +EXTRACT_PACKAGE = NO +EXTRACT_STATIC = NO +EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_METHODS = NO +EXTRACT_ANON_NSPACES = NO +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = NO +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +SHOW_GROUPED_MEMB_INC = NO +FORCE_LOCAL_INCLUDES = NO +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +SORT_MEMBERS_CTORS_1ST = NO +SORT_GROUP_NAMES = NO +SORT_BY_SCOPE_NAME = NO +STRICT_PROTO_MATCHING = NO +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_FILES = YES +SHOW_NAMESPACES = YES +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_FORMAT = "$file:$line: $text" +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = @CMAKE_CURRENT_SOURCE_DIR@/include \ + @CMAKE_CURRENT_SOURCE_DIR@/src +INPUT_ENCODING = UTF-8 +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.idl \ + *.ddl \ + *.odl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.cs \ + *.d \ + *.php \ + *.php4 \ + *.php5 \ + *.phtml \ + *.inc \ + *.m \ + *.markdown \ + *.md \ + *.mm \ + *.dox \ + *.py \ + *.f90 \ + *.f \ + *.for \ + *.tcl \ + *.vhd \ + *.vhdl \ + *.ucf \ + *.qsf \ + *.as \ + *.js +RECURSIVE = YES +EXCLUDE_SYMLINKS = NO +EXAMPLE_PATTERNS = * +EXAMPLE_RECURSIVE = NO +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = NO +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = NO +REFERENCES_RELATION = NO +REFERENCES_LINK_SOURCE = YES +SOURCE_TOOLTIPS = YES +USE_HTAGS = NO +VERBATIM_HEADERS = YES +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 5 +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_COLORSTYLE_HUE = 220 +HTML_COLORSTYLE_SAT = 100 +HTML_COLORSTYLE_GAMMA = 80 +HTML_TIMESTAMP = YES +HTML_DYNAMIC_SECTIONS = NO +HTML_INDEX_NUM_ENTRIES = 100 +GENERATE_DOCSET = NO +DOCSET_FEEDNAME = "Doxygen generated docs" +DOCSET_BUNDLE_ID = org.doxygen.Project +DOCSET_PUBLISHER_ID = org.doxygen.Publisher +DOCSET_PUBLISHER_NAME = Publisher +GENERATE_HTMLHELP = NO +GENERATE_CHI = NO +BINARY_TOC = NO +TOC_EXPAND = NO +GENERATE_QHP = NO +QHP_NAMESPACE = org.doxygen.Project +QHP_VIRTUAL_FOLDER = doc +GENERATE_ECLIPSEHELP = NO +ECLIPSE_DOC_ID = org.doxygen.Project +DISABLE_INDEX = NO +GENERATE_TREEVIEW = YES +ENUM_VALUES_PER_LINE = 4 +TREEVIEW_WIDTH = 250 +EXT_LINKS_IN_WINDOW = NO +FORMULA_FONTSIZE = 10 +FORMULA_TRANSPARENT = YES +USE_MATHJAX = NO +MATHJAX_FORMAT = HTML-CSS +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest +SEARCHENGINE = YES +SERVER_BASED_SEARCH = NO +EXTERNAL_SEARCH = NO +SEARCHDATA_FILE = searchdata.xml +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = NO +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration options related to external references +#--------------------------------------------------------------------------- +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +EXTERNAL_PAGES = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = NO +DOT_NUM_THREADS = 0 +DOT_FONTNAME = Helvetica +DOT_FONTSIZE = 10 +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +UML_LIMIT_NUM_FIELDS = 10 +TEMPLATE_RELATIONS = NO +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +CALLER_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +INTERACTIVE_SVG = NO +DOT_GRAPH_MAX_NODES = 50 +MAX_DOT_GRAPH_DEPTH = 0 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES diff --git a/src/hos_cpp_cron/CMakeLists.txt b/src/hos_cpp_cron/CMakeLists.txt index 411399d1..4c429a61 100644 --- a/src/hos_cpp_cron/CMakeLists.txt +++ b/src/hos_cpp_cron/CMakeLists.txt @@ -160,3 +160,16 @@ install(DIRECTORY include/${PROJECT_NAME}/ ## Add folders to be run by python nosetests # catkin_add_nosetests(test) + + +################### +## Documentation ## +################### + +# We have no documentation, so we create an empty target +find_package(Doxygen) +if(DOXYGEN_FOUND) + add_custom_target(doc) +endif(DOXYGEN_FOUND) + + diff --git a/src/hos_cpp_utils/CMakeLists.txt b/src/hos_cpp_utils/CMakeLists.txt index 881459af..7afbcb90 100644 --- a/src/hos_cpp_utils/CMakeLists.txt +++ b/src/hos_cpp_utils/CMakeLists.txt @@ -2,90 +2,22 @@ cmake_minimum_required(VERSION 2.8.3) project(hos_cpp_utils) ## Find catkin macros and libraries -## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) -## is used, also find other catkin packages find_package(catkin REQUIRED COMPONENTS roscpp hos_deps ) -message("CMAKE_MODULE_PATH: ${CMAKE_MODULE_PATH}") -find_package(libvariant REQUIRED) -message("libvariant_INCLUDE_DIR: ${libvariant_INCLUDE_DIR}") -message("libvariant_LIBRARY: ${libvariant_LIBRARY}") - ## System dependencies are found with CMake's conventions -# find_package(Boost REQUIRED COMPONENTS system) +find_package(libvariant REQUIRED) -## Uncomment this if the package has a setup.py. This macro ensures -## modules and global scripts declared therein get installed -## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html -# catkin_python_setup() - -################################################ -## Declare ROS messages, services and actions ## -################################################ - -## To declare and build messages, services or actions from within this -## package, follow these steps: -## * Let MSG_DEP_SET be the set of packages whose message types you use in -## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...). -## * In the file package.xml: -## * add a build_depend and a run_depend tag for each package in MSG_DEP_SET -## * If MSG_DEP_SET isn't empty the following dependencies might have been -## pulled in transitively but can be declared for certainty nonetheless: -## * add a build_depend tag for "message_generation" -## * add a run_depend tag for "message_runtime" -## * In this file (CMakeLists.txt): -## * add "message_generation" and every package in MSG_DEP_SET to -## find_package(catkin REQUIRED COMPONENTS ...) -## * add "message_runtime" and every package in MSG_DEP_SET to -## catkin_package(CATKIN_DEPENDS ...) -## * uncomment the add_*_files sections below as needed -## and list every .msg/.srv/.action file to be processed -## * uncomment the generate_messages entry below -## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...) - -## Generate messages in the 'msg' folder -# add_message_files( -# FILES -# Message1.msg -# Message2.msg -# ) - -## Generate services in the 'srv' folder -# add_service_files( -# FILES -# Service1.srv -# Service2.srv -# ) - -## Generate actions in the 'action' folder -# add_action_files( -# FILES -# Action1.action -# Action2.action -# ) - -## Generate added messages and services with any dependencies listed here -# generate_messages( -# DEPENDENCIES -# std_msgs # Or other packages containing msgs -# ) - ################################### ## catkin specific configuration ## ################################### -## The catkin_package macro generates cmake config files for your package -## Declare things to be passed to dependent projects -## INCLUDE_DIRS: uncomment this if you package contains header files -## LIBRARIES: libraries you create in this project that dependent projects also need -## CATKIN_DEPENDS: catkin_packages dependent projects also need -## DEPENDS: system dependencies of this project that dependent projects also need + catkin_package( - INCLUDE_DIRS include/${PROJECT_NAME}/ - LIBRARIES hos_cpp_utils + INCLUDE_DIRS include/${PROJECT_NAME}/ + LIBRARIES hos_cpp_utils ) ########### @@ -98,40 +30,21 @@ add_definitions( ) include_directories( + include/${PROJECT_NAME}/ ${catkin_INCLUDE_DIRS} ${libvariant_INCLUDE_DIR} - include/hos_cpp_utils ) ## Declare a cpp library add_library(hos_cpp_utils STATIC src/hos/utils/SchemaLoader.cpp ) + target_link_libraries(hos_cpp_utils ${catkin_LIBRARIES} ${libvariant_LIBRARY} ) -## Specify additional locations of header files -## Your package locations should be listed before other locations -# include_directories(include) - -## Declare a cpp library -# add_library(hos_cpp_common -# src/${PROJECT_NAME}/hos_cpp_common.cpp -# ) - -## Declare a cpp executable -# add_executable(hos_cpp_common_node src/hos_cpp_common_node.cpp) - -## Add cmake target dependencies of the executable/library -## as an example, message headers may need to be generated before nodes -# add_dependencies(hos_cpp_common_node hos_cpp_common_generate_messages_cpp) - -## Specify libraries to link a library or executable target against -# target_link_libraries(hos_cpp_common_node -# ${catkin_LIBRARIES} -# ) ############# ## Install ## @@ -144,46 +57,28 @@ install(TARGETS hos_cpp_utils RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} ) -# all install targets should use catkin DESTINATION variables -# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html - -## Mark executable scripts (Python etc.) for installation -## in contrast to setup.py, you can choose the destination -# install(PROGRAMS -# scripts/my_python_script -# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} -# ) - -## Mark executables and/or libraries for installation -# install(TARGETS hos_cpp_common hos_cpp_common_node -# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} -# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} -# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} -# ) - ## Mark cpp header files for installation install(DIRECTORY include/${PROJECT_NAME}/ DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} FILES_MATCHING PATTERN "*.h" - PATTERN ".svn" EXCLUDE ) -## Mark other files for installation (e.g. launch and bag files, etc.) -# install(FILES -# # myfile1 -# # myfile2 -# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} -# ) +install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc + DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} + OPTIONAL +) -############# -## Testing ## -############# -## Add gtest based cpp test target and link libraries -# catkin_add_gtest(${PROJECT_NAME}-test test/test_hos_cpp_common.cpp) -# if(TARGET ${PROJECT_NAME}-test) -# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME}) -# endif() +################### +## Documentation ## +################### + +find_package(Doxygen) +if(DOXYGEN_FOUND) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) + add_custom_target(doc + ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) +endif(DOXYGEN_FOUND) -## Add folders to be run by python nosetests -# catkin_add_nosetests(test) diff --git a/src/hos_cpp_utils/Doxyfile.in b/src/hos_cpp_utils/Doxyfile.in new file mode 100644 index 00000000..bf240a3c --- /dev/null +++ b/src/hos_cpp_utils/Doxyfile.in @@ -0,0 +1,248 @@ +# Doxyfile 1.8.8 + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +DOXYFILE_ENCODING = UTF-8 +PROJECT_NAME = hos_cpp_utils +OUTPUT_DIRECTORY = doc +CREATE_SUBDIRS = NO +ALLOW_UNICODE_NAMES = NO +OUTPUT_LANGUAGE = English +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = NO +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +QT_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 4 +OPTIMIZE_OUTPUT_FOR_C = NO +OPTIMIZE_OUTPUT_JAVA = NO +OPTIMIZE_FOR_FORTRAN = NO +OPTIMIZE_OUTPUT_VHDL = NO +MARKDOWN_SUPPORT = YES +AUTOLINK_SUPPORT = YES +BUILTIN_STL_SUPPORT = NO +CPP_CLI_SUPPORT = NO +SIP_SUPPORT = NO +IDL_PROPERTY_SUPPORT = YES +DISTRIBUTE_GROUP_DOC = NO +SUBGROUPING = YES +INLINE_GROUPED_CLASSES = NO +INLINE_SIMPLE_STRUCTS = NO +TYPEDEF_HIDES_STRUCT = NO +LOOKUP_CACHE_SIZE = 0 +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = YES +EXTRACT_PRIVATE = NO +EXTRACT_PACKAGE = NO +EXTRACT_STATIC = NO +EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_METHODS = NO +EXTRACT_ANON_NSPACES = NO +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = NO +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +SHOW_GROUPED_MEMB_INC = NO +FORCE_LOCAL_INCLUDES = NO +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +SORT_MEMBERS_CTORS_1ST = NO +SORT_GROUP_NAMES = NO +SORT_BY_SCOPE_NAME = NO +STRICT_PROTO_MATCHING = NO +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_FILES = YES +SHOW_NAMESPACES = YES +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_FORMAT = "$file:$line: $text" +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = @CMAKE_CURRENT_SOURCE_DIR@/include \ + @CMAKE_CURRENT_SOURCE_DIR@/src +INPUT_ENCODING = UTF-8 +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.idl \ + *.ddl \ + *.odl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.cs \ + *.d \ + *.php \ + *.php4 \ + *.php5 \ + *.phtml \ + *.inc \ + *.m \ + *.markdown \ + *.md \ + *.mm \ + *.dox \ + *.py \ + *.f90 \ + *.f \ + *.for \ + *.tcl \ + *.vhd \ + *.vhdl \ + *.ucf \ + *.qsf \ + *.as \ + *.js +RECURSIVE = YES +EXCLUDE_SYMLINKS = NO +EXAMPLE_PATTERNS = * +EXAMPLE_RECURSIVE = NO +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = NO +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = NO +REFERENCES_RELATION = NO +REFERENCES_LINK_SOURCE = YES +SOURCE_TOOLTIPS = YES +USE_HTAGS = NO +VERBATIM_HEADERS = YES +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 5 +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_COLORSTYLE_HUE = 220 +HTML_COLORSTYLE_SAT = 100 +HTML_COLORSTYLE_GAMMA = 80 +HTML_TIMESTAMP = YES +HTML_DYNAMIC_SECTIONS = NO +HTML_INDEX_NUM_ENTRIES = 100 +GENERATE_DOCSET = NO +DOCSET_FEEDNAME = "Doxygen generated docs" +DOCSET_BUNDLE_ID = org.doxygen.Project +DOCSET_PUBLISHER_ID = org.doxygen.Publisher +DOCSET_PUBLISHER_NAME = Publisher +GENERATE_HTMLHELP = NO +GENERATE_CHI = NO +BINARY_TOC = NO +TOC_EXPAND = NO +GENERATE_QHP = NO +QHP_NAMESPACE = org.doxygen.Project +QHP_VIRTUAL_FOLDER = doc +GENERATE_ECLIPSEHELP = NO +ECLIPSE_DOC_ID = org.doxygen.Project +DISABLE_INDEX = NO +GENERATE_TREEVIEW = YES +ENUM_VALUES_PER_LINE = 4 +TREEVIEW_WIDTH = 250 +EXT_LINKS_IN_WINDOW = NO +FORMULA_FONTSIZE = 10 +FORMULA_TRANSPARENT = YES +USE_MATHJAX = NO +MATHJAX_FORMAT = HTML-CSS +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest +SEARCHENGINE = YES +SERVER_BASED_SEARCH = NO +EXTERNAL_SEARCH = NO +SEARCHDATA_FILE = searchdata.xml +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = NO +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration options related to external references +#--------------------------------------------------------------------------- +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +EXTERNAL_PAGES = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = NO +DOT_NUM_THREADS = 0 +DOT_FONTNAME = Helvetica +DOT_FONTSIZE = 10 +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +UML_LIMIT_NUM_FIELDS = 10 +TEMPLATE_RELATIONS = NO +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +CALLER_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +INTERACTIVE_SVG = NO +DOT_GRAPH_MAX_NODES = 50 +MAX_DOT_GRAPH_DEPTH = 0 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES diff --git a/src/hos_deps/CMakeLists.txt b/src/hos_deps/CMakeLists.txt index 70a83ec7..7f74d626 100644 --- a/src/hos_deps/CMakeLists.txt +++ b/src/hos_deps/CMakeLists.txt @@ -21,4 +21,16 @@ catkin_package( install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/cmake/ # FILES_MATCHING PATTERN "*.cmake" -) \ No newline at end of file +) + + +################### +## Documentation ## +################### + +# We have no documentation, so we create an empty target +find_package(Doxygen) +if(DOXYGEN_FOUND) + add_custom_target(doc) +endif(DOXYGEN_FOUND) + diff --git a/src/hos_dummy/CMakeLists.txt b/src/hos_dummy/CMakeLists.txt index 561abd51..9f0635ef 100644 --- a/src/hos_dummy/CMakeLists.txt +++ b/src/hos_dummy/CMakeLists.txt @@ -168,3 +168,15 @@ catkin_install_python(PROGRAMS ## Add folders to be run by python nosetests # catkin_add_nosetests(test) + + +################### +## Documentation ## +################### + +# We have no documentation, so we create an empty target +find_package(Doxygen) +if(DOXYGEN_FOUND) + add_custom_target(doc) +endif(DOXYGEN_FOUND) + diff --git a/src/hos_launch/CMakeLists.txt b/src/hos_launch/CMakeLists.txt index 3ddc15de..65cbece0 100644 --- a/src/hos_launch/CMakeLists.txt +++ b/src/hos_launch/CMakeLists.txt @@ -168,3 +168,15 @@ install(DIRECTORY launch ## Add folders to be run by python nosetests # catkin_add_nosetests(test) + + +################### +## Documentation ## +################### + +# We have no documentation, so we create an empty target +find_package(Doxygen) +if(DOXYGEN_FOUND) + add_custom_target(doc) +endif(DOXYGEN_FOUND) + diff --git a/src/hos_philips_hue/CMakeLists.txt b/src/hos_philips_hue/CMakeLists.txt index 06553622..5275df3c 100644 --- a/src/hos_philips_hue/CMakeLists.txt +++ b/src/hos_philips_hue/CMakeLists.txt @@ -167,3 +167,16 @@ catkin_install_python(PROGRAMS ## Add folders to be run by python nosetests # catkin_add_nosetests(test) + + +################### +## Documentation ## +################### + +# We have no documentation, so we create an empty target +find_package(Doxygen) +if(DOXYGEN_FOUND) + add_custom_target(doc) +endif(DOXYGEN_FOUND) + + diff --git a/src/hos_python_utils/CMakeLists.txt b/src/hos_python_utils/CMakeLists.txt index 09e14706..df4297cf 100644 --- a/src/hos_python_utils/CMakeLists.txt +++ b/src/hos_python_utils/CMakeLists.txt @@ -160,3 +160,15 @@ include_directories( ## Add folders to be run by python nosetests # catkin_add_nosetests(test) + + +################### +## Documentation ## +################### + +# We have no documentation, so we create an empty target +find_package(Doxygen) +if(DOXYGEN_FOUND) + add_custom_target(doc) +endif(DOXYGEN_FOUND) +