This commit is contained in:
2015-05-21 02:05:38 +02:00
parent 37ebf68d6b
commit 19cb6e5cbe
49 changed files with 21669 additions and 687 deletions
-175
View File
@@ -1,175 +0,0 @@
cmake_minimum_required(VERSION 2.8.3)
project(hos_cosgi_common)
## 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
)
## 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_common
CATKIN_DEPENDS hos_celix
# 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_cosgi_common
# src/${PROJECT_NAME}/hos_cosgi_common.cpp
# )
## Declare a cpp executable
# add_executable(hos_cosgi_common_node src/hos_cosgi_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_cosgi_common_node hos_cosgi_common_generate_messages_cpp)
## Specify libraries to link a library or executable target against
# target_link_libraries(hos_cosgi_common_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_cosgi_common hos_cosgi_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}
# )
#############
## Testing ##
#############
## Add gtest based cpp test target and link libraries
# catkin_add_gtest(${PROJECT_NAME}-test test/test_hos_cosgi_common.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)
###################
## 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}
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
endif(DOXYGEN_FOUND)
@@ -1,159 +0,0 @@
/*
* impl.h
*
* Created on: 09.05.2015
* Author: matzman
*/
#ifndef INCLUDE_HOS_COSGI_COMMON_HOS_COSGI_SERVICE_IMPLEMENTATION_H_
#define INCLUDE_HOS_COSGI_COMMON_HOS_COSGI_SERVICE_IMPLEMENTATION_H_
#include "interface.h"
#include <cstddef>
#include <mutex>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
namespace hos {
namespace cosgi{
namespace service {
namespace implementation {
template<class _Service>
struct ServiceInfo {
static const char* name;
static const int major;
static const int minor;
};
template<class _Service>
class Service : public virtual interface::Service {
public:
virtual const char* getServiceName() { return ServiceInfo<_Service>::name; };
virtual void getServiceVersion(int& major, int& minor) override {
major = ServiceInfo<_Service>::major;
minor = ServiceInfo<_Service>::minor;
}
};
template <class... _Args> class Observable {};
template<class _Event>
class Observable<_Event> : public virtual interface::Observable<_Event> {
protected:
std::mutex _observersMutex;
typedef interface::Observer<_Event> observer_type;
typedef std::unordered_set<observer_type*> observers_type;
observers_type _observers;
public:
virtual ~Observable() {}
virtual void addObserver(observer_type* o) override {
std::lock_guard<std::mutex> lock(_observersMutex);
if (o != nullptr) {
auto elem = _observers.find(o);
if (elem == _observers.end()) {
_observers.insert(o);
}
}
}
virtual void deleteObserver(observer_type* o) override {
std::lock_guard<std::mutex> lock(_observersMutex);
if (o != nullptr) {
auto elem = _observers.find(o);
if (elem != _observers.end()) {
_observers.erase(elem);
}
}
}
virtual void deleteObservers() override {
std::lock_guard<std::mutex> lock(_observersMutex);
_observers.clear();
};
virtual size_t countObservers() override {
std::lock_guard<std::mutex> lock(_observersMutex);
return _observers.size();
}
virtual void notifyObservers(const _Event* e) override {
std::lock_guard<std::mutex> lock(_observersMutex);
for (auto l : _observers) {
l->notificationReceived(this, e);
}
}
};
template<class _Key, class _Event>
class Observable<_Key, _Event> : public virtual interface::Observable<_Key, _Event> {
protected:
std::mutex _observersMutex;
typedef interface::Observer<_Key, _Event> observer_type;
typedef std::unordered_multimap<_Key, observer_type*> observers_type;
observers_type _observers;
public:
virtual ~Observable() {}
virtual void addObserver(_Key k, observer_type* o) override {
std::lock_guard<std::mutex> lock(_observersMutex);
if (o != nullptr) {
bool _found = false;
auto range = _observers.equal_range(k);
for (auto i = range.first; i != range.second; i++) {
if (i.second == o) {
_found = true;
break;
}
}
if (!_found) {
_observers.insert({k, o});
}
}
}
virtual void deleteObserver(_Key k, observer_type* o) override {
std::lock_guard<std::mutex> lock(_observersMutex);
if (o != nullptr) {
bool _found = false;
auto range = _observers.equal_range(k);
for (auto i = range.first; i != range.second; i++) {
if (i.second == o) {
_observers.erase(i);
break;
}
}
}
}
virtual void deleteObservers() override {
std::lock_guard<std::mutex> lock(_observersMutex);
_observers.clear();
}
virtual size_t countObservers() override {
std::lock_guard<std::mutex> lock(_observersMutex);
return _observers.size();
}
void notifyObservers(_Key k, const _Event* e) override {
std::lock_guard<std::mutex> lock(_observersMutex);
auto ol = _observers.equal_range(k);
std::for_each(ol.first, ol.second, [&](const typename observer_type::value_type& o) {
o.second->notificationReceived(this, k, e);
});
}
};
} // namespace implementation
} // namespace service
} // namespace cosgi
} // namespace hos
#endif /* INCLUDE_HOS_COSGI_COMMON_HOS_COSGI_SERVICE_IMPLEMENTATION_H_ */
-52
View File
@@ -1,52 +0,0 @@
<?xml version="1.0"?>
<package>
<name>hos_cosgi_common</name>
<version>0.0.0</version>
<description>The hos_cosgi_common package</description>
<!-- One maintainer tag required, multiple allowed, one person per tag -->
<!-- Example: -->
<!-- <maintainer email="jane.doe@example.com">Jane Doe</maintainer> -->
<maintainer email="matzman@todo.todo">matzman</maintainer>
<!-- One license tag required, multiple allowed, one license per tag -->
<!-- Commonly used license strings: -->
<!-- BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
<license>TODO</license>
<!-- Url tags are optional, but mutiple are allowed, one per tag -->
<!-- Optional attribute type can be: website, bugtracker, or repository -->
<!-- Example: -->
<!-- <url type="website">http://wiki.ros.org/hos_cosgi_common</url> -->
<!-- Author tags are optional, mutiple are allowed, one per tag -->
<!-- Authors do not have to be maintianers, but could be -->
<!-- Example: -->
<!-- <author email="jane.doe@example.com">Jane Doe</author> -->
<!-- The *_depend tags are used to specify dependencies -->
<!-- Dependencies can be catkin packages or system dependencies -->
<!-- Examples: -->
<!-- Use build_depend for packages you need at compile time: -->
<!-- <build_depend>message_generation</build_depend> -->
<!-- Use buildtool_depend for build tool packages: -->
<!-- <buildtool_depend>catkin</buildtool_depend> -->
<!-- Use run_depend for packages you need at runtime: -->
<!-- <run_depend>message_runtime</run_depend> -->
<!-- Use test_depend for packages you need only for testing: -->
<!-- <test_depend>gtest</test_depend> -->
<buildtool_depend>catkin</buildtool_depend>
<build_depend>hos_celix</build_depend>
<run_depend>hos_celix</run_depend>
<!-- The export tag contains other, unspecified, tags -->
<export>
<!-- Other tools can request additional information be placed here -->
</export>
</package>
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 2.8.3)
project(hos_cosgi_launcher)
project(hos_cosgi_core)
## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
@@ -7,8 +7,8 @@ project(hos_cosgi_launcher)
find_package(catkin REQUIRED COMPONENTS
hos_celix
roscpp
hos_cosgi_common
hos_cpp_common
hos_cpp_utils
hos_libvariant
)
## System dependencies are found with CMake's conventions
@@ -84,7 +84,7 @@ find_package(APR REQUIRED)
catkin_package(
INCLUDE_DIRS include/${PROJECT_NAME}/
# LIBRARIES hos_cosgi_launcher
CATKIN_DEPENDS hos_celix hos_cosgi_common
CATKIN_DEPENDS hos_celix
# DEPENDS system_lib
)
@@ -162,6 +162,11 @@ install(DIRECTORY include/${PROJECT_NAME}/
PATTERN ".svn" EXCLUDE
)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
OPTIONAL
)
## Mark other files for installation (e.g. launch and bag files, etc.)
# install(FILES
# # myfile1
@@ -181,3 +186,17 @@ install(DIRECTORY include/${PROJECT_NAME}/
## Add folders to be run by python nosetests
# catkin_add_nosetests(test)
###################
## 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)
@@ -4,10 +4,7 @@
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = hos_cosgi_common
PROJECT_NUMBER =
PROJECT_BRIEF =
PROJECT_LOGO =
PROJECT_NAME = hos_cosgi_core
OUTPUT_DIRECTORY = doc
CREATE_SUBDIRS = NO
ALLOW_UNICODE_NAMES = NO
@@ -27,9 +24,7 @@ ABBREVIATE_BRIEF = "The $name class" \
the
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = YES
STRIP_FROM_PATH =
STRIP_FROM_INC_PATH =
FULL_PATH_NAMES = NO
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
QT_AUTOBRIEF = NO
@@ -37,13 +32,10 @@ MULTILINE_CPP_IS_BRIEF = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 4
ALIASES =
TCL_SUBST =
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
OPTIMIZE_FOR_FORTRAN = NO
OPTIMIZE_OUTPUT_VHDL = NO
EXTENSION_MAPPING =
MARKDOWN_SUPPORT = YES
AUTOLINK_SUPPORT = YES
BUILTIN_STL_SUPPORT = NO
@@ -87,14 +79,10 @@ GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_FILES = YES
SHOW_NAMESPACES = YES
FILE_VERSION_FILTER =
LAYOUT_FILE =
CITE_BIB_FILES =
#---------------------------------------------------------------------------
# Configuration options related to warning and progress messages
#---------------------------------------------------------------------------
@@ -104,11 +92,11 @@ WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# Configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = @CMAKE_CURRENT_SOURCE_DIR@/include
INPUT = @CMAKE_CURRENT_SOURCE_DIR@/include \
@CMAKE_CURRENT_SOURCE_DIR@/src
INPUT_ENCODING = UTF-8
FILE_PATTERNS = *.c \
*.cc \
@@ -153,19 +141,10 @@ FILE_PATTERNS = *.c \
*.as \
*.js
RECURSIVE = YES
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXCLUDE_SYMBOLS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS = *
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
FILTER_SOURCE_PATTERNS =
USE_MDFILE_AS_MAINPAGE =
#---------------------------------------------------------------------------
# Configuration options related to source browsing
#---------------------------------------------------------------------------
@@ -183,18 +162,12 @@ VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = YES
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_EXTRA_STYLESHEET =
HTML_EXTRA_FILES =
HTML_COLORSTYLE_HUE = 220
HTML_COLORSTYLE_SAT = 100
HTML_COLORSTYLE_GAMMA = 80
@@ -207,20 +180,12 @@ DOCSET_BUNDLE_ID = org.doxygen.Project
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
DOCSET_PUBLISHER_NAME = Publisher
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
CHM_INDEX_ENCODING =
BINARY_TOC = NO
TOC_EXPAND = NO
GENERATE_QHP = NO
QCH_FILE =
QHP_NAMESPACE = org.doxygen.Project
QHP_VIRTUAL_FOLDER = doc
QHP_CUST_FILTER_NAME =
QHP_CUST_FILTER_ATTRS =
QHP_SECT_FILTER_ATTRS =
QHG_LOCATION =
GENERATE_ECLIPSEHELP = NO
ECLIPSE_DOC_ID = org.doxygen.Project
DISABLE_INDEX = NO
@@ -233,74 +198,10 @@ FORMULA_TRANSPARENT = YES
USE_MATHJAX = NO
MATHJAX_FORMAT = HTML-CSS
MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
MATHJAX_EXTENSIONS =
MATHJAX_CODEFILE =
SEARCHENGINE = YES
SERVER_BASED_SEARCH = NO
EXTERNAL_SEARCH = NO
SEARCHENGINE_URL =
SEARCHDATA_FILE = searchdata.xml
EXTERNAL_SEARCH_ID =
EXTRA_SEARCH_MAPPINGS =
#---------------------------------------------------------------------------
# Configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = YES
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4
EXTRA_PACKAGES =
LATEX_HEADER =
LATEX_FOOTER =
LATEX_EXTRA_FILES =
PDF_HYPERLINKS = YES
USE_PDFLATEX = YES
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
LATEX_SOURCE_CODE = NO
LATEX_BIB_STYLE = plain
#---------------------------------------------------------------------------
# Configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# Configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_SUBDIR =
MAN_LINKS = NO
#---------------------------------------------------------------------------
# Configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_OUTPUT = xml
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# Configuration options related to the DOCBOOK output
#---------------------------------------------------------------------------
GENERATE_DOCBOOK = NO
DOCBOOK_OUTPUT = docbook
DOCBOOK_PROGRAMLISTING = NO
#---------------------------------------------------------------------------
# Configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# Configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
@@ -308,16 +209,10 @@ ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration options related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
EXTERNAL_PAGES = YES
@@ -326,14 +221,11 @@ PERL_PATH = /usr/bin/perl
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = YES
MSCGEN_PATH =
DIA_PATH =
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = NO
DOT_NUM_THREADS = 0
DOT_FONTNAME = Helvetica
DOT_FONTSIZE = 10
DOT_FONTPATH =
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
GROUP_GRAPHS = YES
@@ -348,11 +240,6 @@ GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = png
INTERACTIVE_SVG = NO
DOT_PATH =
DOTFILE_DIRS =
MSCFILE_DIRS =
DIAFILE_DIRS =
PLANTUML_JAR_PATH =
DOT_GRAPH_MAX_NODES = 50
MAX_DOT_GRAPH_DEPTH = 0
DOT_TRANSPARENT = NO
@@ -0,0 +1,268 @@
#pragma once
#include "Interface.h"
#include <mutex>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
// main namespace
namespace hos {
namespace cosgi{
namespace service {
namespace implementation {
/**
* Template holding information about a service.
*
* Works in conjunction with the Service class below which is the implementation of interface::Service.
* Concrete services need to inherit the Service class and specialize this template.
*/
template<class _Service>
struct ServiceInfo {
static const char* name /** Service name. */;
static const int major /** Version major number. */;
static const int minor /** Version minor number. */;
};
/**
* Implementation of interface::Service.
*/
template<class _Service>
class Service
: public virtual interface::Service {
public:
/**
* Returns the name of the service.
*
* \return service name.
**/
virtual const char* getServiceName() {
return ServiceInfo<_Service>::name;
};
/**
* Returns the version of the service.
*
* \param[out] major version major number.
* \param[out] minor version minor number.
*/
virtual void getServiceVersion(int& major, int& minor) override {
major = ServiceInfo<_Service>::major;
minor = ServiceInfo<_Service>::minor;
}
};
/**
* Implementation of interface::Observable.
*
* This template does not provide any functionality, so do not use it but use only its specializations.
*/
template <class... _Args> class Observable {};
/**
* Implementation of interface::Observable<_Event>.
*
* Observers are stored in an std::unordered_set.
*/
template<class _Event>
class Observable<_Event>
: public virtual interface::Observable<_Event> {
protected:
typedef std::unordered_set<typename interface::Observable<_Event>::observer_type*> observers_type;
std::mutex _observersMutex;
observers_type _observers;
public:
virtual ~Observable() {}
/**
* Registers an observer.
*
* \param[in] o observer to be registered.
*/
virtual void addObserver(typename interface::Observable<_Event>::observer_type* o) override {
std::lock_guard<std::mutex> lock(_observersMutex);
if (o != nullptr) {
auto elem = _observers.find(o);
if (elem == _observers.end()) {
_observers.insert(o);
}
}
}
/**
* Unregisters an observer.
*
* \param[in] o observer to be unregistered.
*/
virtual void deleteObserver(typename interface::Observable<_Event>::observer_type* o) override {
std::lock_guard<std::mutex> lock(_observersMutex);
if (o != nullptr) {
auto elem = _observers.find(o);
if (elem != _observers.end()) {
_observers.erase(elem);
}
}
}
/**
* Unregisters all observers.
*/
virtual void deleteObservers() override {
std::lock_guard<std::mutex> lock(_observersMutex);
_observers.clear();
};
/**
* Returns the number of registered observers.
*
* \return number of registered observers.
*/
virtual size_t countObservers() override {
std::lock_guard<std::mutex> lock(_observersMutex);
return _observers.size();
}
/**
* Notify observers of a new event.
*
* \param[in] e event.
*/
virtual void notifyObservers(const _Event* e) override {
std::lock_guard<std::mutex> lock(_observersMutex);
for (auto l : _observers) {
l->notificationReceived(this, e);
}
}
};
/**
* Implementation of interface::Observable<_Key, _Event>.
*
* Observers are stored in an std::unordered_map using the filter key as map key.
*/
template<class _Key, class _Event>
class Observable<_Key, _Event>
: public virtual interface::Observable<_Key, _Event> {
protected:
typedef std::unordered_multimap<_Key, typename interface::Observable<_Key, _Event>::observer_type*> observers_type;
std::mutex _observersMutex;
observers_type _observers;
public:
virtual ~Observable() {}
/**
* Registers an observer.
*
* \param[in] k filter key.
* \param[in] o observer to be registered.
*/
virtual void addObserver(_Key k, typename interface::Observable<_Key, _Event>::observer_type* o) override {
std::lock_guard<std::mutex> lock(_observersMutex);
if (o != nullptr) {
bool _found = false;
auto range = _observers.equal_range(k);
for (auto i = range.first; i != range.second; i++) {
if (i.second == o) {
_found = true;
break;
}
}
if (!_found) {
_observers.insert({k, o});
}
}
}
/**
* Unregisters an observer.
*
* \param[in] k filter key.
* \param[in] o observer to be unregistered.
*/
virtual void deleteObserver(_Key k, typename interface::Observable<_Key, _Event>::observer_type* o) override {
std::lock_guard<std::mutex> lock(_observersMutex);
if (o != nullptr) {
bool _found = false;
auto range = _observers.equal_range(k);
for (auto i = range.first; i != range.second; i++) {
if (i.second == o) {
_observers.erase(i);
break;
}
}
}
}
/**
* Unregisters all observers.
*/
virtual void deleteObservers() override {
std::lock_guard<std::mutex> lock(_observersMutex);
_observers.clear();
}
/**
* Returns the number of registered observers.
*
* \return number of registered observers.
*/
virtual size_t countObservers() override {
std::lock_guard<std::mutex> lock(_observersMutex);
return _observers.size();
}
/**
* Notify observers of a new event.
*
* \param[in] k observer filter key.
* \param[in] e event.
*/
void notifyObservers(_Key k, const _Event* e) override {
std::lock_guard<std::mutex> lock(_observersMutex);
auto ol = _observers.equal_range(k);
std::for_each(ol.first, ol.second, [&](const typename interface::Observable<_Key, _Event>::observer_type::value_type& o) {
o.second->notificationReceived(this, k, e);
});
}
};
} // namespace implementation
} // namespace service
} // namespace cosgi
} // namespace hos
@@ -1,6 +1,4 @@
#pragma once
@@ -8,6 +6,7 @@
#include <cstddef>
// main namespace
namespace hos {
namespace cosgi{
@@ -35,8 +34,11 @@ public:
* Every public OSGI service interface class needs to inherit from this class.
* Defines generic methods to get information about a service.
*/
class Service : public virtual Object {
class Service
: public virtual Object {
public:
/**
* Returns the name of the service.
*
@@ -57,12 +59,13 @@ public:
* \param[out] minor version minor number.
*/
virtual void getServiceVersion(int& major, int& minor) = 0;
};
/**
* General template implementing the observer from the observer-pattern.
* Public OSGI interface template implementing the observer from the observer-pattern.
*
* This template does not provide any functionality, so do not use it but use only its specializations.
*/
@@ -71,7 +74,7 @@ template<class...> class Observer {};
/**
* General template implementing the observable from the observer-pattern.
* Public OSGI interface template implementing the observable from the observer-pattern.
*
* This template does not provide any functionality, so do not use it but use only its specializations.
*/
@@ -82,14 +85,18 @@ template<class...> class Observable {};
/**
* Convenience template merging the Object class and the Observable template into a single template.
*/
template<class... _Args> class ObservableObject : public virtual Object, public virtual Observable<_Args...> {};
template<class... _Args> class ObservableObject
: public virtual Object,
public virtual Observable<_Args...> {};
/**
* Convenience template merging the Service class and the Observable template into a single template.
*/
template<class... _Args> class ObservableService : public virtual Service, public virtual Observable<_Args...> {};
template<class... _Args> class ObservableService
: public virtual Service,
public virtual Observable<_Args...> {};
@@ -97,12 +104,16 @@ template<class... _Args> class ObservableService : public virtual Service, publi
* Specialization of the Observer template with one template argument (the event emitted from the observable).
*/
template<class _Event>
class Observer<_Event> : public virtual Object {
class Observer<_Event>
: public virtual Object {
public:
/**
* Specifies the type of compatible observables.
*/
typedef Observable<_Event> observable_type;
/**
* Function that is called when an event is emitted by the observable object.
*
@@ -110,6 +121,7 @@ public:
* \param[in] e the event (can be null).
*/
virtual void notificationReceived(observable_type* o, const _Event* e) = 0;
};
@@ -119,12 +131,16 @@ public:
* and the event emitted from the observable).
*/
template<class _Key, class _Event>
class Observer<_Key, _Event> : public virtual Object {
class Observer<_Key, _Event>
: public virtual Object {
public:
/**
* Specifies the type of compatible observables.
*/
typedef Observable<_Key, _Event> observable_type;
/**
* Function that is called when an event is emitted by the observable object.
*
@@ -133,6 +149,7 @@ public:
* \param[in] e the event (can be null).
*/
virtual void notificationReceived(observable_type* o, const _Key& key, const _Event* e) = 0;
};
@@ -143,41 +160,49 @@ public:
* When an event is emitted, all registered observers will be notified.
*/
template<class _Event>
class Observable<_Event> : public virtual Object {
protected:
/**
* Notify observers of a new event.
*
* \param[in] e event.
*/
virtual void notifyObservers(const _Event* e) = 0;
class Observable<_Event>
: public virtual Object {
public:
/**
* Specifies the type of compatible observers.
*/
typedef Observer<_Event> observer_type;
/**
* Registers an observer.
*
* \param[in] o observer to be registered.
*/
virtual void addObserver(observer_type* o) = 0;
/**
* Unregisters an observer.
*
* \param[in] o observer to be unregistered.
*/
virtual void deleteObserver(observer_type* o) = 0;
/**
* Unregisters all observers.
*/
virtual void deleteObservers() = 0;
/**
* Returns the number of registered observers.
*
* \return number of registered observers.
*/
virtual size_t countObservers() = 0;
/**
* Notify observers of a new event.
*
* \param[in] e event.
*/
virtual void notifyObservers(const _Event* e) = 0;
};
@@ -189,20 +214,16 @@ public:
* When an event is emitted, only observers registered under the specified key will be notified.
*/
template<class _Key, class _Event>
class Observable<_Key, _Event> : public virtual Object {
protected:
/**
* Notify observers of a new event.
*
* \param[in] key observer filter key.
* \param[in] e event.
*/
virtual void notifyObservers(const _Key& key, const _Event* e) = 0;
class Observable<_Key, _Event>
: public virtual Object {
public:
/**
* Specifies the type of compatible observers.
*/
typedef Observer<_Key, _Event> observer_type;
/**
* Registers an observer.
*
@@ -210,6 +231,7 @@ public:
* \param[in] o observer to be registered.
*/
virtual void addObserver(_Key& key, observer_type* o) = 0;
/**
* Unregisters an observer.
*
@@ -217,16 +239,27 @@ public:
* \param[in] o observer to be unregistered.
*/
virtual void deleteObserver(_Key& key, observer_type* o) = 0;
/**
* Unregisters all observers.
*/
virtual void deleteObservers() = 0;
/**
* Returns the number of registered observers.
*
* \return number of registered observers.
*/
virtual size_t countObservers() = 0;
/**
* Notify observers of a new event.
*
* \param[in] key observer filter key.
* \param[in] e event.
*/
virtual void notifyObservers(const _Key& key, const _Event* e) = 0;
};
@@ -0,0 +1,127 @@
#pragma once
#include <hos/cosgi/service/Interface.h>
// Forward declarations
namespace ros { class NodeHandle; }
// Service Namespace
namespace hos {
namespace cosgi {
namespace service {
namespace core {
/**
* Base class for events emitted by the CoreService.
*/
class CoreServiceEvent {
public:
/**
* CoreService event types.
*/
enum class EventType : int { STARTUP_FINISHED = 1, SHUTDOWN = 2 };
/**
* Event type.
*/
const EventType eventType;
/**
* Constructor.
*/
CoreServiceEvent(EventType type) : eventType(type) {}
};
/**
* Startup finished event.
*
* This event is emitted when all autostart bundles have been started and hos_cosgi_launcher is about to enter the main loop.
*/
class StartupFinishedEvent
: public CoreServiceEvent {
public:
StartupFinishedEvent() : CoreServiceEvent(EventType::STARTUP_FINISHED) {}
};
/**
* Shutdown event.
*
* This event is emitted when hos_cosgi_launcher is about to exit.
*/
class ShutdownEvent
: public CoreServiceEvent {
public:
ShutdownEvent() : CoreServiceEvent(EventType::SHUTDOWN) {}
};
/**
* Public COSGI interface of the CoreService.
*
* The CoreService is directly provided by hos_cosgi_launcher. The best way to test whether a bundle was started by
* hos_cosgi_launcher is to try to retrieve the CoreService.
*
* It offers following functionality:
* - Events indicating system events (currently startup, shutdown)
* - Request application shutdown.
* - Get ROS node handles.
*/
class CoreService
: public virtual interface::ObservableService<CoreServiceEvent> {
public:
/**
* The service name.
*/
static constexpr const char* SERVICE_NAME = "hos_core_service";
/**
* Returns a reference to a node handle with public namespace.
*
* The node handle was created using the default constructor.
*
* \return public node handle
*/
virtual ros::NodeHandle& getPublicNodeHandle() = 0;
/**
* Returns a reference to a node handle with private namespace.
*
* The node handle was created using namespace "~".
*
* \return private node handle
*/
virtual ros::NodeHandle& getPrivateNodeHandle() = 0;
/**
* Request an application shutdown
*/
virtual void requestShutdown() = 0;
};
} // namespace core
} // namespace service
} // namespace cosgi
} // namespace hos
@@ -1,8 +1,8 @@
<?xml version="1.0"?>
<package>
<name>hos_cosgi_launcher</name>
<name>hos_cosgi_core</name>
<version>0.0.0</version>
<description>The hos_cosgi_launcher package</description>
<description>The hos_cosgi_core package</description>
<!-- One maintainer tag required, multiple allowed, one person per tag -->
<!-- Example: -->
@@ -42,12 +42,12 @@
<buildtool_depend>catkin</buildtool_depend>
<build_depend>hos_celix</build_depend>
<build_depend>roscpp</build_depend>
<build_depend>hos_cosgi_common</build_depend>
<build_depend>hos_cpp_common</build_depend>
<build_depend>hos_cpp_utils</build_depend>
<build_depend>hos_libvariant</build_depend>
<run_depend>hos_celix</run_depend>
<run_depend>roscpp</run_depend>
<run_depend>hos_cosgi_common</run_depend>
<run_depend>hos_cpp_common</run_depend>
<run_depend>hos_cpp_utils</run_depend>
<run_depend>hos_libvariant</run_depend>
<!-- The export tag contains other, unspecified, tags -->
@@ -17,15 +17,15 @@ template<> const char* implementation::ServiceInfo<CoreServiceImpl>::name = serv
template<> const int implementation::ServiceInfo<CoreServiceImpl>::major = 0;
template<> const int implementation::ServiceInfo<CoreServiceImpl>::minor = 3;
CoreServiceImpl::CoreServiceImpl(ros::NodeHandle* publicNodeHandle, ros::NodeHandle* privateNodeHandle)
CoreServiceImpl::CoreServiceImpl(ros::NodeHandle& publicNodeHandle, ros::NodeHandle& privateNodeHandle)
: publicNodeHandle(publicNodeHandle), privateNodeHandle(privateNodeHandle) {}
ros::NodeHandle* CoreServiceImpl::getPublicNodeHandle() {
ros::NodeHandle& CoreServiceImpl::getPublicNodeHandle() {
return publicNodeHandle;
}
ros::NodeHandle* CoreServiceImpl::getPrivateNodeHandle() {
ros::NodeHandle& CoreServiceImpl::getPrivateNodeHandle() {
return privateNodeHandle;
}
@@ -8,8 +8,8 @@
#ifndef SRC_CORE_SERVICEIMPL_H_
#define SRC_CORE_SERVICEIMPL_H_
#include <hos/cosgi/service/core/core_service.h>
#include <hos/cosgi/service/implementation.h>
#include <hos/cosgi/service/core/CoreService.h>
#include <hos/cosgi/service/Implementation.h>
// Service Namespace
@@ -20,16 +20,16 @@ namespace core {
class CoreServiceImpl;
class CoreServiceImpl : public virtual CoreService, public virtual implementation::Service<CoreServiceImpl>, public virtual implementation::Observable<CoreEvent> {
class CoreServiceImpl : public virtual CoreService, public virtual implementation::Service<CoreServiceImpl>, public virtual implementation::Observable<CoreServiceEvent> {
private:
ros::NodeHandle* publicNodeHandle;
ros::NodeHandle* privateNodeHandle;
ros::NodeHandle publicNodeHandle;
ros::NodeHandle privateNodeHandle;
public:
CoreServiceImpl(ros::NodeHandle* publicNodeHandle, ros::NodeHandle* privateNodeHandle);
CoreServiceImpl(ros::NodeHandle& publicNodeHandle, ros::NodeHandle& privateNodeHandle);
virtual ros::NodeHandle* getPublicNodeHandle();
virtual ros::NodeHandle* getPrivateNodeHandle();
virtual ros::NodeHandle& getPublicNodeHandle();
virtual ros::NodeHandle& getPrivateNodeHandle();
virtual void requestShutdown();
};
@@ -102,7 +102,7 @@ int main(int argc, char **argv) {
bundle_getContext(fwBundle, &context);
// Create and register hos-core-service
CoreServiceImpl hosCoreService(&rosPublicNodeHandle, &rosPrivateNodeHandle);
CoreServiceImpl hosCoreService(rosPublicNodeHandle, rosPrivateNodeHandle);
service_registration_pt reg = nullptr;
bundleContext_registerService(context, (char*)CoreService::SERVICE_NAME, static_cast<CoreService*>(&hosCoreService), nullptr, &reg);
ROS_INFO("HOS core service registered");
@@ -7,10 +7,9 @@ project(hos_cosgi_devicerepository)
find_package(catkin REQUIRED COMPONENTS
hos_celix
hos_core_msgs
hos_cosgi_launcher
hos_cosgi_common
hos_cosgi_core
hos_libvariant
hos_cpp_common
hos_cpp_utils
roscpp
)
@@ -91,7 +90,7 @@ find_package(Boost REQUIRED)
catkin_package(
INCLUDE_DIRS include/${PROJECT_NAME}/
# LIBRARIES hos_cosgi_devicerepository
CATKIN_DEPENDS hos_celix hos_core_msgs hos_cosgi_launcher roscpp hos_cosgi_common hos_libvariant hos_cpp_common
CATKIN_DEPENDS hos_celix hos_core_msgs hos_cosgi_core roscpp hos_libvariant hos_cpp_utils
# DEPENDS system_lib
)
@@ -2,8 +2,8 @@
#define _HOS_DEVICEREPOSITORY_SERVICE_H_
#include <hos/common/observable.h>
#include <hos/cosgi/service/interface.h>
#include <hos/cosgi/service/Interface.h>
#include <hos/utils/observable.h>
#include <Variant/Variant.h>
#include <string>
#include <set>
@@ -1,5 +1,5 @@
<launch>
<node name="cosgi_devicerepository" pkg="hos_cosgi_launcher" type="hos_cosgi_launcher" output="screen">
<param name="autostart_bundles" value="$(find hos_cosgi_launcher)/../../build_isolated/hos_cosgi_devicerepository/hos_cosgi_devicerepository.zip $(find hos_cosgi_launcher)/../../build_isolated/hos_cosgi_ruleexecution_python/hos_cosgi_ruleexecution_python.zip $(find hos_cosgi_launcher)/../../build_isolated/hos_cosgi_ruleengine/hos_cosgi_ruleengine.zip $(find hos_cosgi_launcher)/../../devel_isolated/hos_celix/share/celix/bundles/shell.zip $(find hos_cosgi_launcher)/../../devel_isolated/hos_celix/share/celix/bundles/shell_tui.zip $(find hos_cosgi_launcher)/../../devel_isolated/hos_celix/share/celix/bundles/log_service.zip $(find hos_cosgi_launcher)/../../devel_isolated/hos_celix/share/celix/bundles/log_writer.zip $(find hos_cosgi_launcher)/../../devel_isolated/hos_celix/share/celix/bundles/log_writer_syslog.zip"/>
<node name="cosgi_devicerepository" pkg="hos_cosgi_core" type="hos_cosgi_launcher" output="screen">
<param name="autostart_bundles" value="$(find hos_cosgi_core)/../../build_isolated/hos_cosgi_devicerepository/hos_cosgi_devicerepository.zip $(find hos_cosgi_core)/../../build_isolated/hos_cosgi_ruleexecution_python/hos_cosgi_ruleexecution_python.zip $(find hos_cosgi_core)/../../build_isolated/hos_cosgi_ruleengine/hos_cosgi_ruleengine.zip $(find hos_cosgi_core)/../../devel_isolated/hos_celix/share/celix/bundles/shell.zip $(find hos_cosgi_core)/../../devel_isolated/hos_celix/share/celix/bundles/shell_tui.zip $(find hos_cosgi_core)/../../devel_isolated/hos_celix/share/celix/bundles/log_service.zip $(find hos_cosgi_core)/../../devel_isolated/hos_celix/share/celix/bundles/log_writer.zip $(find hos_cosgi_core)/../../devel_isolated/hos_celix/share/celix/bundles/log_writer_syslog.zip"/>
</node>
</launch>
+4 -6
View File
@@ -42,18 +42,16 @@
<buildtool_depend>catkin</buildtool_depend>
<build_depend>hos_celix</build_depend>
<build_depend>hos_core_msgs</build_depend>
<build_depend>hos_cosgi_launcher</build_depend>
<build_depend>hos_cosgi_core</build_depend>
<build_depend>roscpp</build_depend>
<build_depend>hos_cosgi_common</build_depend>
<build_depend>hos_libvariant</build_depend>
<build_depend>hos_cpp_common</build_depend>
<build_depend>hos_cpp_utils</build_depend>
<run_depend>hos_celix</run_depend>
<run_depend>hos_core_msgs</run_depend>
<run_depend>hos_cosgi_launcher</run_depend>
<run_depend>hos_cosgi_core</run_depend>
<run_depend>roscpp</run_depend>
<run_depend>hos_cosgi_common</run_depend>
<run_depend>hos_libvariant</run_depend>
<run_depend>hos_cpp_common</run_depend>
<run_depend>hos_cpp_utils</run_depend>
<!-- The export tag contains other, unspecified, tags -->
@@ -11,10 +11,10 @@ extern "C" {
#include "celix/bundle_context.h"
}
#include <hos/cosgi/service/core/core_service.h>
#include <hos/cosgi/service/core/CoreService.h>
#include "hos/cosgi/service/devicerepository/devicerepository_serviceimpl.h"
#include <hos/common/observable.h>
#include <hos/utils/observable.h>
#include <iostream>
#include <memory>
@@ -6,7 +6,8 @@
*/
#include "devicerepository_serviceimpl.h"
#include <hos/cosgi/service/core/core_service.h>
#include <hos/cosgi/service/core/CoreService.h>
#include <ros/ros.h>
#include <exception>
#include <iostream>
@@ -57,7 +58,7 @@ bool DeviceImpl::stateChanged() {
void DeviceRepositoryServiceImpl::setCoreService(service::core::CoreService* coreService) {
if (coreService && !this->coreService) {
this->coreService = coreService;
this->nodehandle = coreService->getPrivateNodeHandle();
this->nodehandle = &coreService->getPrivateNodeHandle();
int major = 0, minor = 0;
coreService->getServiceVersion(major, minor);
ROS_INFO_STREAM("DeviceRepositoryService: Found HOSCoreService Version " << major << "." << minor);
@@ -8,7 +8,6 @@
#ifndef SRC_HOS_COSGI_SERVICE_DEVICEREPOSITORY_DEVICEREPOSITORY_SERVICEIMPL_H_
#define SRC_HOS_COSGI_SERVICE_DEVICEREPOSITORY_DEVICEREPOSITORY_SERVICEIMPL_H_
#include <hos/cosgi/service/implementation.h>
#include <Variant/Variant.h>
#include <HosSchemaLoader/HosSchemaLoader.h>
#include <mutex>
@@ -19,6 +18,7 @@
#include <hos_core_msgs/DeviceStatusUpdate.h>
#include <hos_core_msgs/HosStatusUpdate.h>
#include <hos/cosgi/service/devicerepository/devicerepository_service.h>
#include <hos/cosgi/service/Implementation.h>
#include <ros/ros.h>
@@ -1,53 +0,0 @@
#ifndef SRC_HOS_CORE_SERVICE_H_
#define SRC_HOS_CORE_SERVICE_H_
#include <hos/common/observable.h>
#include <hos/cosgi/service/interface.h>
// Forward declarations
namespace ros {
class NodeHandle;
}
// Service Namespace
namespace hos {
namespace cosgi {
namespace service {
namespace core {
class CoreEvent {
public:
enum class EventType : int { STARTUP_FINISHED = 1 };
const EventType eventType;
CoreEvent(EventType type) : eventType(type) {}
};
class StartupFinishedEvent : public CoreEvent {
public:
StartupFinishedEvent() : CoreEvent(EventType::STARTUP_FINISHED) {}
};
class CoreService : public virtual interface::ObservableService<CoreEvent> {
public:
static constexpr const char* SERVICE_NAME = "hos_core_service";
virtual ros::NodeHandle* getPublicNodeHandle() = 0;
virtual ros::NodeHandle* getPrivateNodeHandle() = 0;
virtual void requestShutdown() = 0;
};
} // namespace core
} // namespace service
} // namespace cosgi
} // namespace hos
#endif /* SRC_HOS_CORE_SERVICE_H_ */
+3 -4
View File
@@ -6,11 +6,10 @@ project(hos_cosgi_ruleengine)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
hos_celix
hos_cosgi_common
hos_cosgi_devicerepository
hos_cosgi_launcher
hos_cosgi_core
hos_cosgi_scripting
hos_cpp_common
hos_cpp_utils
hos_libvariant
roscpp
hos_cpp_cron
@@ -91,7 +90,7 @@ find_package(Boost REQUIRED)
catkin_package(
INCLUDE_DIRS include/${PROJECT_NAME}/
# LIBRARIES hos_cosgi_ruleengine
CATKIN_DEPENDS hos_celix hos_cosgi_common hos_cosgi_devicerepository hos_cosgi_launcher hos_cpp_common hos_libvariant roscpp hos_cpp_cron hos_cosgi_scripting
CATKIN_DEPENDS hos_celix hos_cosgi_devicerepository hos_cosgi_core hos_cpp_utils hos_libvariant roscpp hos_cpp_cron hos_cosgi_scripting
# DEPENDS system_lib
)
@@ -9,8 +9,8 @@
#define INCLUDE_HOS_COSGI_RULEENGINE_HOS_COSGI_SERVICE_RULEENGINE_RULEENGINE_SERVICE_H_
#include <hos/common/observable.h>
#include <hos/cosgi/service/interface.h>
#include <hos/cosgi/service/Interface.h>
#include <hos/utils/observable.h>
#include <memory>
#include <Variant/Variant.h>
@@ -2,7 +2,7 @@
<group ns="/hos/rules/ruleengine0">
<param name="rulepkg01" textfile="$(find hos_cosgi_ruleengine)/test/rulepkg01.json"/>
</group>
<node name="cosgi_ruleengine" pkg="hos_cosgi_launcher" type="hos_cosgi_launcher" output="screen">
<param name="autostart_bundles" value="$(find hos_cosgi_launcher)/../../build_isolated/hos_cosgi_devicerepository/hos_cosgi_devicerepository.zip $(find hos_cosgi_launcher)/../../build_isolated/hos_cosgi_ruleengine/hos_cosgi_rulesngine.zip $(find hos_cosgi_launcher)/../../devel_isolated/hos_celix/share/celix/bundles/shell.zip $(find hos_cosgi_launcher)/../../devel_isolated/hos_celix/share/celix/bundles/shell_tui.zip $(find hos_cosgi_launcher)/../../devel_isolated/hos_celix/share/celix/bundles/log_service.zip $(find hos_cosgi_launcher)/../../devel_isolated/hos_celix/share/celix/bundles/log_writer.zip $(find hos_cosgi_launcher)/../../devel_isolated/hos_celix/share/celix/bundles/log_writer_syslog.zip"/>
<node name="cosgi_ruleengine" pkg="hos_cosgi_core" type="hos_cosgi_launcher" output="screen">
<param name="autostart_bundles" value="$(find hos_cosgi_core)/../../build_isolated/hos_cosgi_devicerepository/hos_cosgi_devicerepository.zip $(find hos_cosgi_core)/../../build_isolated/hos_cosgi_ruleengine/hos_cosgi_rulesngine.zip $(find hos_cosgi_core)/../../devel_isolated/hos_celix/share/celix/bundles/shell.zip $(find hos_cosgi_core)/../../devel_isolated/hos_celix/share/celix/bundles/shell_tui.zip $(find hos_cosgi_core)/../../devel_isolated/hos_celix/share/celix/bundles/log_service.zip $(find hos_cosgi_core)/../../devel_isolated/hos_celix/share/celix/bundles/log_writer.zip $(find hos_cosgi_core)/../../devel_isolated/hos_celix/share/celix/bundles/log_writer_syslog.zip"/>
</node>
</launch>
+4 -6
View File
@@ -41,19 +41,17 @@
<!-- <test_depend>gtest</test_depend> -->
<buildtool_depend>catkin</buildtool_depend>
<build_depend>hos_celix</build_depend>
<build_depend>hos_cosgi_common</build_depend>
<build_depend>hos_cosgi_devicerepository</build_depend>
<build_depend>hos_cosgi_launcher</build_depend>
<build_depend>hos_cosgi_core</build_depend>
<build_depend>hos_cosgi_scripting</build_depend>
<build_depend>hos_cpp_common</build_depend>
<build_depend>hos_cpp_utils</build_depend>
<build_depend>hos_libvariant</build_depend>
<build_depend>roscpp</build_depend>
<build_depend>hos_cpp_cron</build_depend>
<run_depend>hos_celix</run_depend>
<run_depend>hos_cosgi_common</run_depend>
<run_depend>hos_cosgi_devicerepository</run_depend>
<run_depend>hos_cosgi_launcher</run_depend>
<run_depend>hos_cpp_common</run_depend>
<run_depend>hos_cosgi_core</run_depend>
<run_depend>hos_cpp_utils</run_depend>
<run_depend>hos_libvariant</run_depend>
<run_depend>roscpp</run_depend>
<run_depend>hos_cpp_cron</run_depend>
@@ -20,7 +20,7 @@ extern "C" {
#include "celix/constants.h"
}
#include <hos/cosgi/service/core/core_service.h>
#include <hos/cosgi/service/core/CoreService.h>
#include "hos/cosgi/service/ruleengine/ruleengine_serviceimpl.h"
#include <memory>
#include <mutex>
@@ -12,7 +12,7 @@
#include <unordered_set>
#include <Variant/Variant.h>
#include <celix/bundle_context.h>
#include <hos/cosgi/service/core/core_service.h>
#include <hos/cosgi/service/core/CoreService.h>
#include <hos/cosgi/service/devicerepository/devicerepository_service.h>
#include <Variant/Variant.h>
@@ -35,7 +35,7 @@ template<> const int implementation::ServiceInfo<RuleEngineServiceImpl>::minor =
void RuleEngineServiceImpl::setCoreService(service::core::CoreService* coreService) {
if (coreService && !this->coreService) {
this->coreService = coreService;
this->nodehandle = coreService->getPrivateNodeHandle();
this->nodehandle = &coreService->getPrivateNodeHandle();
int major = 0, minor = 0;
coreService->getServiceVersion(major, minor);
ROS_INFO_STREAM("RuleEngineService: Found HOSCoreService Version " << major << "." << minor);
@@ -8,7 +8,6 @@
#ifndef INCLUDE_HOS_COSGI_RULEENGINE_HOS_RULEENGINE_SERVICE_IMPL_H_
#define INCLUDE_HOS_COSGI_RULEENGINE_HOS_RULEENGINE_SERVICE_IMPL_H_
#include <hos/cosgi/service/implementation.h>
#include <mutex>
#include <map>
#include <set>
@@ -19,6 +18,7 @@
#include <hos/cosgi/service/ruleengine/ruleengine_service.h>
#include <hos/cosgi/service/scripting/scripting_service.h>
#include <hos/cosgi/service/devicerepository/devicerepository_service.h>
#include <hos/cosgi/service/Implementation.h>
#include <ros/ros.h>
#include <memory>
#include <string>
+2 -2
View File
@@ -5,7 +5,7 @@ project(hos_cosgi_scripting)
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
hos_cosgi_common
hos_cosgi_core
hos_libvariant
)
@@ -81,7 +81,7 @@ find_package(catkin REQUIRED COMPONENTS
catkin_package(
INCLUDE_DIRS include/${PROJECT_NAME}/
# LIBRARIES hos_cosgi_scripting
CATKIN_DEPENDS hos_cosgi_common hos_libvariant
CATKIN_DEPENDS hos_cosgi_core hos_libvariant
# DEPENDS system_lib
)
@@ -9,7 +9,7 @@
#define INCLUDE_HOS_COSGI_SCRIPTING_HOS_COSGI_SERVICE_SCRIPTING_SCRIPTING_SERVICE_H_
#include <hos/cosgi/service/interface.h>
#include <hos/cosgi/service/Interface.h>
#include <Variant/Variant.h>
#include <memory>
+2 -2
View File
@@ -40,9 +40,9 @@
<!-- Use test_depend for packages you need only for testing: -->
<!-- <test_depend>gtest</test_depend> -->
<buildtool_depend>catkin</buildtool_depend>
<build_depend>hos_cosgi_common</build_depend>
<build_depend>hos_cosgi_core</build_depend>
<build_depend>hos_libvariant</build_depend>
<run_depend>hos_cosgi_common</run_depend>
<run_depend>hos_cosgi_core</run_depend>
<run_depend>hos_libvariant</run_depend>
@@ -6,11 +6,10 @@ project(hos_cosgi_scripting_python)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
hos_celix
hos_cosgi_common
hos_cosgi_launcher
hos_cosgi_core
hos_cosgi_scripting
hos_cosgi_devicerepository
hos_cpp_common
hos_cpp_utils
hos_libvariant
)
@@ -91,7 +90,7 @@ find_package(Boost REQUIRED COMPONENTS python)
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES hos_cosgi_ruleexecution_python
CATKIN_DEPENDS hos_celix hos_cosgi_common hos_cosgi_launcher hos_cosgi_scripting hos_cpp_common hos_libvariant hos_cosgi_devicerepository
CATKIN_DEPENDS hos_celix hos_cosgi_core hos_cosgi_scripting hos_cpp_utils hos_libvariant hos_cosgi_devicerepository
# DEPENDS system_lib
)
+4 -6
View File
@@ -41,17 +41,15 @@
<!-- <test_depend>gtest</test_depend> -->
<buildtool_depend>catkin</buildtool_depend>
<build_depend>hos_celix</build_depend>
<build_depend>hos_cosgi_common</build_depend>
<build_depend>hos_cosgi_launcher</build_depend>
<build_depend>hos_cosgi_core</build_depend>
<build_depend>hos_cosgi_scripting</build_depend>
<build_depend>hos_cpp_common</build_depend>
<build_depend>hos_cpp_utils</build_depend>
<build_depend>hos_libvariant</build_depend>
<build_depend>hos_cosgi_devicerepository</build_depend>
<run_depend>hos_celix</run_depend>
<run_depend>hos_cosgi_common</run_depend>
<run_depend>hos_cosgi_launcher</run_depend>
<run_depend>hos_cosgi_core</run_depend>
<run_depend>hos_cosgi_scripting</run_depend>
<run_depend>hos_cpp_common</run_depend>
<run_depend>hos_cpp_utils</run_depend>
<run_depend>hos_libvariant</run_depend>
<run_depend>hos_cosgi_devicerepository</run_depend>
@@ -19,7 +19,7 @@ extern "C" {
#include "celix/constants.h"
}
#include <hos/cosgi/service/core/core_service.h>
#include <hos/cosgi/service/core/CoreService.h>
#include <hos/cosgi/service/devicerepository/devicerepository_service.h>
#include "hos/cosgi/service/scripting/python/scripting_serviceimpl.h"
#include <memory>
@@ -6,9 +6,11 @@
*/
#include "scripting_serviceimpl.h"
#include <hos/cosgi/service/core/CoreService.h>
#include "PyHOSAPI.h"
#include <hos/cosgi/service/core/core_service.h>
#include <hos/cosgi/service/devicerepository/devicerepository_service.h>
@@ -26,7 +28,7 @@ template<> const int implementation::ServiceInfo<PyScriptingService>::minor = 8;
void PyScriptingService::setCoreService(service::core::CoreService* coreService) {
if (coreService && !this->coreService) {
this->coreService = coreService;
this->nodehandle = coreService->getPrivateNodeHandle();
this->nodehandle = &coreService->getPrivateNodeHandle();
int major = 0, minor = 0;
coreService->getServiceVersion(major, minor);
ROS_INFO_STREAM("PyRuleExecutionService: Found HOSCoreService Version " << major << "." << minor);
@@ -11,9 +11,9 @@
#include <ros/ros.h>
#include <Variant/Variant.h>
#include <boost/python.hpp>
#include <hos/cosgi/service/implementation.h>
#include <hos/cosgi/service/scripting/scripting_service.h>
#include <hos/cosgi/service/devicerepository/devicerepository_service.h>
#include <hos/cosgi/service/Implementation.h>
#include <memory>
+3 -4
View File
@@ -6,10 +6,9 @@ project(hos_cosgi_webserver)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
hos_celix
hos_cosgi_common
hos_cosgi_devicerepository
hos_cosgi_launcher
hos_cpp_common
hos_cosgi_core
hos_cpp_utils
hos_libhttpserver
hos_libvariant
roscpp
@@ -91,7 +90,7 @@ find_package(Boost REQUIRED)
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES hos_cosgi_webserver
# CATKIN_DEPENDS hos_celix hos_cosgi_common hos_cosgi_devicerepository hos_cosgi_launcher hos_cpp_common hos_libhttpserver hos_libvariant roscpp
# CATKIN_DEPENDS hos_celix hos_cosgi_devicerepository hos_cosgi_core hos_cpp_utils hos_libhttpserver hos_libvariant roscpp
# DEPENDS system_lib
)
@@ -9,7 +9,7 @@
#include <hos/common/observable.h>
#include <hos/cosgi/service/interface.h>
#include <hos/cosgi/service/Interface.h>
#include <memory>
#include <Variant/Variant.h>
+4 -6
View File
@@ -41,18 +41,16 @@
<!-- <test_depend>gtest</test_depend> -->
<buildtool_depend>catkin</buildtool_depend>
<build_depend>hos_celix</build_depend>
<build_depend>hos_cosgi_common</build_depend>
<build_depend>hos_cosgi_devicerepository</build_depend>
<build_depend>hos_cosgi_launcher</build_depend>
<build_depend>hos_cpp_common</build_depend>
<build_depend>hos_cosgi_core</build_depend>
<build_depend>hos_cpp_utils</build_depend>
<build_depend>hos_libhttpserver</build_depend>
<build_depend>hos_libvariant</build_depend>
<build_depend>roscpp</build_depend>
<run_depend>hos_celix</run_depend>
<run_depend>hos_cosgi_common</run_depend>
<run_depend>hos_cosgi_devicerepository</run_depend>
<run_depend>hos_cosgi_launcher</run_depend>
<run_depend>hos_cpp_common</run_depend>
<run_depend>hos_cosgi_core</run_depend>
<run_depend>hos_cpp_utils</run_depend>
<run_depend>hos_libhttpserver</run_depend>
<run_depend>hos_libvariant</run_depend>
<run_depend>roscpp</run_depend>
@@ -20,7 +20,7 @@ extern "C" {
#include "celix/constants.h"
}
#include <hos/cosgi/service/core/core_service.h>
#include <hos/cosgi/service/core/CoreService.h>
#include "hos/cosgi/service/webserver/webserver_serviceimpl.h"
#include <memory>
#include <mutex>
@@ -35,7 +35,7 @@ WebServerServiceImpl::~WebServerServiceImpl() {
void WebServerServiceImpl::setCoreService(service::core::CoreService* coreService) {
if (coreService && !this->coreService) {
this->coreService = coreService;
this->nodehandle = coreService->getPrivateNodeHandle();
this->nodehandle = &coreService->getPrivateNodeHandle();
int major = 0, minor = 0;
coreService->getServiceVersion(major, minor);
ROS_INFO_STREAM("WebServerService: Found HOSCoreService Version " << major << "." << minor);
@@ -8,13 +8,14 @@
#pragma once
#include <hos/cosgi/service/implementation.h>
#include <hos/cosgi/service/core/CoreService.h>
#include <mutex>
#include <map>
#include <set>
#include <hos/cosgi/service/devicerepository/devicerepository_service.h>
#include <hos/cosgi/service/webserver/webserver_service.h>
#include <hos/cosgi/service/core/core_service.h>
#include <hos/cosgi/service/Implementation.h>
#include <ros/ros.h>
#include <memory>
#include <string>
@@ -1,10 +1,13 @@
cmake_minimum_required(VERSION 2.8.3)
project(hos_cpp_common)
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)
find_package(catkin REQUIRED COMPONENTS
hos_libvariant
roscpp
)
## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system)
@@ -77,8 +80,8 @@ find_package(catkin REQUIRED)
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
INCLUDE_DIRS include/${PROJECT_NAME}/
# LIBRARIES hos_cpp_common
# CATKIN_DEPENDS other_catkin_pkg
LIBRARIES hos_cpp_utils
CATKIN_DEPENDS roscpp
# DEPENDS system_lib
)
@@ -86,6 +89,25 @@ catkin_package(
## Build ##
###########
add_definitions(
-std=c++11
-fPIC
)
include_directories(
${catkin_INCLUDE_DIRS}
include
include/hos_libvariant
)
## Declare a cpp library
add_library(hos_cpp_utils STATIC
src/HosSchemaLoader/HosSchemaLoader.cpp
)
target_link_libraries(hos_cpp_utils
${catkin_LIBRARIES}
)
## Specify additional locations of header files
## Your package locations should be listed before other locations
# include_directories(include)
@@ -111,6 +133,13 @@ catkin_package(
## Install ##
#############
## Mark executables and/or libraries for installation
install(TARGETS hos_cpp_utils
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
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
@@ -12,7 +12,7 @@
namespace hos {
namespace common {
namespace utils {
@@ -134,6 +134,6 @@ public:
};
} // namespace common
} // namespace utils
} // namespace hos
@@ -1,8 +1,8 @@
<?xml version="1.0"?>
<package>
<name>hos_cpp_common</name>
<name>hos_cpp_utils</name>
<version>0.0.0</version>
<description>The hos_cpp_common package</description>
<description>The hos_cpp_utils package</description>
<!-- One maintainer tag required, multiple allowed, one person per tag -->
<!-- Example: -->
@@ -33,13 +33,17 @@
<!-- Examples: -->
<!-- Use build_depend for packages you need at compile time: -->
<!-- <build_depend>message_generation</build_depend> -->
<!-- <build_depend>message_generation</build_depend>
<!-- Use buildtool_depend for build tool packages: -->
<!-- <buildtool_depend>catkin</buildtool_depend> -->
<!-- Use run_depend for packages you need at runtime: -->
<!-- <run_depend>message_runtime</run_depend> -->
<!-- <run_depend>hos_libvariant</run_depend> -->
<!-- Use test_depend for packages you need only for testing: -->
<!-- <test_depend>gtest</test_depend> -->
<buildtool_depend>catkin</buildtool_depend>
<build_depend>hos_libvariant</build_depend>
<run_depend>hos_libvariant</run_depend>
<!-- The export tag contains other, unspecified, tags -->
+2 -2
View File
@@ -7,7 +7,7 @@ project(hos_launch)
find_package(catkin REQUIRED COMPONENTS
hos_core_types
hos_cosgi_devicerepository
hos_cosgi_launcher
hos_cosgi_core
hos_cosgi_ruleengine
hos_cosgi_scripting_python
hos_philips_hue
@@ -85,7 +85,7 @@ find_package(catkin REQUIRED COMPONENTS
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES hos_launch
# CATKIN_DEPENDS hos_core_types hos_cosgi_devicerepository hos_cosgi_launcher hos_cosgi_ruleengine hos_cosgi_ruleexecution_python hos_philips_hue
# CATKIN_DEPENDS hos_core_types hos_cosgi_devicerepository hos_cosgi_core hos_cosgi_ruleengine hos_cosgi_ruleexecution_python hos_philips_hue
# DEPENDS system_lib
)
+2 -2
View File
@@ -42,13 +42,13 @@
<buildtool_depend>catkin</buildtool_depend>
<build_depend>hos_core_types</build_depend>
<build_depend>hos_cosgi_devicerepository</build_depend>
<build_depend>hos_cosgi_launcher</build_depend>
<build_depend>hos_cosgi_core</build_depend>
<build_depend>hos_cosgi_ruleengine</build_depend>
<build_depend>hos_cosgi_scripting_python</build_depend>
<build_depend>hos_philips_hue</build_depend>
<run_depend>hos_core_types</run_depend>
<run_depend>hos_cosgi_devicerepository</run_depend>
<run_depend>hos_cosgi_launcher</run_depend>
<run_depend>hos_cosgi_core</run_depend>
<run_depend>hos_cosgi_ruleengine</run_depend>
<run_depend>hos_cosgi_scripting_python</run_depend>
<run_depend>hos_philips_hue</run_depend>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,81 @@
# This file was generated by Autom4te Sun Sep 7 11:40:11 UTC 2014.
# It contains the lists of macros which have been traced.
# It can be safely removed.
@request = (
bless( [
'0',
1,
[
'/usr/share/autoconf'
],
[
'/usr/share/autoconf/autoconf/autoconf.m4f',
'aclocal.m4',
'configure.ac'
],
{
'AM_NLS' => 1,
'AM_EXTRA_RECURSIVE_TARGETS' => 1,
'AM_ENABLE_MULTILIB' => 1,
'AC_SUBST' => 1,
'AM_MAINTAINER_MODE' => 1,
'm4_pattern_allow' => 1,
'LT_CONFIG_LTDL_DIR' => 1,
'_LT_AC_TAGCONFIG' => 1,
'AC_CONFIG_LIBOBJ_DIR' => 1,
'LT_INIT' => 1,
'AM_PROG_MOC' => 1,
'_m4_warn' => 1,
'AC_CONFIG_SUBDIRS' => 1,
'AC_LIBSOURCE' => 1,
'AC_FC_PP_DEFINE' => 1,
'AM_PROG_F77_C_O' => 1,
'AC_CONFIG_AUX_DIR' => 1,
'AM_POT_TOOLS' => 1,
'AC_FC_PP_SRCEXT' => 1,
'LT_SUPPORTED_TAG' => 1,
'_AM_SUBST_NOTMAKE' => 1,
'_AM_COND_IF' => 1,
'AC_INIT' => 1,
'm4_include' => 1,
'AM_CONDITIONAL' => 1,
'AM_PROG_MKDIR_P' => 1,
'AC_FC_FREEFORM' => 1,
'AM_SILENT_RULES' => 1,
'AC_CONFIG_HEADERS' => 1,
'AC_CONFIG_FILES' => 1,
'AH_OUTPUT' => 1,
'AC_CANONICAL_HOST' => 1,
'AC_CANONICAL_SYSTEM' => 1,
'AM_PATH_GUILE' => 1,
'_AM_COND_ENDIF' => 1,
'm4_sinclude' => 1,
'AM_INIT_AUTOMAKE' => 1,
'AM_GNU_GETTEXT' => 1,
'm4_pattern_forbid' => 1,
'AM_AUTOMAKE_VERSION' => 1,
'AM_PROG_AR' => 1,
'AM_PROG_CXX_C_O' => 1,
'AM_PROG_CC_C_O' => 1,
'AC_CANONICAL_BUILD' => 1,
'AC_DEFINE_TRACE_LITERAL' => 1,
'sinclude' => 1,
'AC_CONFIG_LINKS' => 1,
'AM_PROG_FC_C_O' => 1,
'AC_SUBST_TRACE' => 1,
'AM_MAKEFILE_INCLUDE' => 1,
'AM_XGETTEXT_OPTION' => 1,
'include' => 1,
'_AM_COND_ELSE' => 1,
'AM_GNU_GETTEXT_INTL_SUBDIR' => 1,
'AC_PROG_LIBTOOL' => 1,
'AC_FC_SRCEXT' => 1,
'_AM_MAKEFILE_INCLUDE' => 1,
'AC_REQUIRE_AUX_FILE' => 1,
'AC_CANONICAL_TARGET' => 1,
'AM_PROG_LIBTOOL' => 1
}
], 'Autom4te::Request' )
);
File diff suppressed because it is too large Load Diff