.
This commit is contained in:
@@ -166,7 +166,7 @@ install(DIRECTORY ${CATKIN_DEVEL_PREFIX}/bin/
|
||||
)
|
||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cmake/
|
||||
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/cmake
|
||||
FILES_MATCHING PATTERN "*.cmake"
|
||||
# FILES_MATCHING PATTERN "*.cmake"
|
||||
)
|
||||
|
||||
# all install targets should use catkin DESTINATION variables
|
||||
|
||||
@@ -30,30 +30,29 @@ set(CELIX_DIR_FROM_FINDCELIX "${CMAKE_CURRENT_LIST_DIR}/../../../..")
|
||||
|
||||
|
||||
find_path(CELIX_INCLUDE_DIR celix_errno.h
|
||||
PATHS ${CELIX_DIR_FROM_FINDCELIX} $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local
|
||||
PATH_SUFFIXES include include/celix)
|
||||
PATHS ${CELIX_DIR_FROM_FINDCELIX} ${CMAKE_CURRENT_LIST_DIR}/../../.. $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local
|
||||
PATH_SUFFIXES include include/celix include/hos_celix include/hos_celix/celix)
|
||||
|
||||
find_library(CELIX_FRAMEWORK_LIBRARY NAMES celix_framework
|
||||
PATHS ${CELIX_DIR_FROM_FINDCELIX} $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local
|
||||
PATHS ${CELIX_DIR_FROM_FINDCELIX} ${CMAKE_CURRENT_LIST_DIR}/../../.. $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local
|
||||
PATH_SUFFIXES lib lib64)
|
||||
|
||||
find_library(CELIX_UTILS_LIBRARY NAMES celix_utils
|
||||
PATHS ${CELIX_DIR_FROM_FINDCELIX} $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local
|
||||
PATHS ${CELIX_DIR_FROM_FINDCELIX} ${CMAKE_CURRENT_LIST_DIR}/../../.. $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local
|
||||
PATH_SUFFIXES lib lib64)
|
||||
|
||||
find_program(CELIX_LAUNCHER NAMES celix
|
||||
PATHS ${CELIX_DIR_FROM_FINDCELIX} $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local
|
||||
PATH_SUFFIXES bin)
|
||||
PATHS ${CELIX_DIR_FROM_FINDCELIX} ${CMAKE_CURRENT_LIST_DIR}/../../.. $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local
|
||||
PATH_SUFFIXES bin lib/hos_celix)
|
||||
|
||||
find_file(CELIX_CMAKECELIX_FILE CMakeCelix.cmake
|
||||
PATHS ${CELIX_DIR_FROM_FINDCELIX} $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local
|
||||
PATH_SUFFIXES share/celix/cmake/modules)
|
||||
PATHS ${CELIX_DIR_FROM_FINDCELIX} ${CMAKE_CURRENT_LIST_DIR}/../../.. $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local
|
||||
PATH_SUFFIXES share/celix/cmake/modules share/hos_celix/cmake)
|
||||
|
||||
#NOTE assuming shell.zip is always installed.
|
||||
find_path(CELIX_BUNDLES_DIR shell.zip
|
||||
PATHS ${CELIX_DIR_FROM_FINDCELIX} $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local
|
||||
PATHS ${CELIX_DIR_FROM_FINDCELIX} ${CMAKE_CURRENT_LIST_DIR}/../../.. $ENV{CELIX_DIR} ${CELIX_DIR} /usr /usr/local
|
||||
PATH_SUFFIXES share/celix/bundles)
|
||||
|
||||
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
#define INCLUDE_HOS_COSGI_CORE_COSGI_CORE_H_
|
||||
|
||||
|
||||
namespace hos {
|
||||
namespace cosgi{
|
||||
|
||||
|
||||
class COSGI_Object_Interface {
|
||||
public:
|
||||
virtual ~COSGI_Object_Interface() {}
|
||||
@@ -22,4 +26,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
} // namespace cosgi
|
||||
} // namespace hos
|
||||
|
||||
#endif /* INCLUDE_HOS_COSGI_CORE_COSGI_CORE_H_ */
|
||||
|
||||
@@ -10,6 +10,7 @@ find_package(catkin REQUIRED COMPONENTS
|
||||
hos_cosgi_launcher
|
||||
hos_cosgi_core
|
||||
hos_libvariant
|
||||
hos_cpp_common
|
||||
roscpp
|
||||
)
|
||||
|
||||
@@ -90,7 +91,7 @@ find_package(Boost REQUIRED)
|
||||
catkin_package(
|
||||
INCLUDE_DIRS include
|
||||
# LIBRARIES hos_cosgi_devicerepository
|
||||
CATKIN_DEPENDS hos_celix hos_core_msgs hos_cosgi_launcher roscpp hos_cosgi_core hos_libvariant
|
||||
CATKIN_DEPENDS hos_celix hos_core_msgs hos_cosgi_launcher roscpp hos_cosgi_core hos_libvariant hos_cpp_common
|
||||
# DEPENDS system_lib
|
||||
)
|
||||
|
||||
@@ -110,10 +111,10 @@ include_directories(
|
||||
${APR_INCLUDE_DIR}
|
||||
${APR_INCLUDE_DIR}/apr-1.0
|
||||
include
|
||||
${hos_libvariant_INCLUDE_DIRS}/hos_libvariant
|
||||
)
|
||||
|
||||
|
||||
set(BUNDLE_SYMBOLICNAME "com.hos.hos_devicerepository")
|
||||
set(BUNDLE_SYMBOLICNAME "hos.hos_devicerepository")
|
||||
set(BUNDLE_VERSION "1.0.0")
|
||||
set(BUNDLE_NAME "hos_devicerepository")
|
||||
|
||||
@@ -121,6 +122,7 @@ bundle(hos_cosgi_devicerepository
|
||||
SOURCES
|
||||
${PROJECT_SOURCE_DIR}/src/bundle_activator
|
||||
${PROJECT_SOURCE_DIR}/src/hos_devicerepository_service_impl
|
||||
${PROJECT_SOURCE_DIR}/src/HosSchemaLoader
|
||||
)
|
||||
target_link_libraries(hos_cosgi_devicerepository
|
||||
${catkin_LIBRARIES}
|
||||
|
||||
+52
-18
@@ -3,39 +3,75 @@
|
||||
|
||||
|
||||
#include <hos_cosgi_core/cosgi_core.h>
|
||||
#include <hos_cpp_common/observable.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace libvariant {
|
||||
class Variant;
|
||||
}
|
||||
|
||||
|
||||
namespace hos {
|
||||
namespace cosgi {
|
||||
|
||||
|
||||
class DeviceEvent;
|
||||
class DeviceEventListener;
|
||||
|
||||
class GenericDevice : public COSGI_Object_Interface {
|
||||
public:
|
||||
virtual std::string getDeviceID() = 0;
|
||||
|
||||
virtual bool registerDeviceStatusListener(DeviceEventListener& listener) = 0;
|
||||
virtual bool unregisterDeviceStatusListener(DeviceEventListener& listener) = 0;
|
||||
};
|
||||
class GenericDevice;
|
||||
|
||||
|
||||
class DeviceEvent {
|
||||
public:
|
||||
enum class Type : int { ADDED = 1, REMOVED = 2, STATUS_UPDATE = 3, COMMAND = 4 };
|
||||
enum class EventType : int { DEVICE_ADDED = 1, DEVICE_REMOVED = 2, STATUS_UPDATED = 3, COMMAND_RECEIVED = 4 };
|
||||
DeviceEvent(GenericDevice* device, EventType type) : device(device), eventType(type) {}
|
||||
GenericDevice* device;
|
||||
Type type;
|
||||
EventType eventType;
|
||||
template<class T> T* as() { return (T*)this; }
|
||||
template<class T> const T* as() const { return (T*)this; }
|
||||
};
|
||||
|
||||
|
||||
class DeviceEventListener : public COSGI_Object_Interface {
|
||||
class DeviceAddedEvent : public DeviceEvent {
|
||||
public:
|
||||
virtual void deviceEventReceived(const DeviceEvent& event) = 0;
|
||||
DeviceAddedEvent(GenericDevice* device)
|
||||
: DeviceEvent(device, DeviceEvent::EventType::DEVICE_ADDED) {}
|
||||
};
|
||||
|
||||
class DeviceRemovedEvent : public DeviceEvent {
|
||||
public:
|
||||
DeviceRemovedEvent(GenericDevice* device)
|
||||
: DeviceEvent(device, DeviceEvent::EventType::DEVICE_REMOVED) {}
|
||||
};
|
||||
|
||||
class DeviceStatusEvent : public DeviceEvent {
|
||||
public:
|
||||
DeviceStatusEvent(GenericDevice* device, const libvariant::Variant& statusMsg)
|
||||
: DeviceEvent(device, DeviceEvent::EventType::STATUS_UPDATED), statusMsg(statusMsg) {}
|
||||
const libvariant::Variant& statusMsg;
|
||||
};
|
||||
|
||||
class DeviceCmdEvent : public DeviceEvent {
|
||||
public:
|
||||
DeviceCmdEvent(GenericDevice* device, const libvariant::Variant& cmdMsg)
|
||||
: DeviceEvent(device, DeviceEvent::EventType::COMMAND_RECEIVED), cmdMsg(cmdMsg) {}
|
||||
const libvariant::Variant& cmdMsg;
|
||||
};
|
||||
|
||||
|
||||
class HOSDeviceRepositoryService : public COSGI_Service_Interface {
|
||||
|
||||
class GenericDevice : public COSGI_Object_Interface, public common::IObservable<DeviceEvent> {
|
||||
public:
|
||||
virtual const std::string& getDeviceID() = 0;
|
||||
virtual const std::string& getDeviceType() = 0;
|
||||
virtual const std::string& getCmdTopic() = 0;
|
||||
virtual const std::string& getStatusTopic() = 0;
|
||||
|
||||
virtual const libvariant::Variant& getCurrentState() = 0;
|
||||
virtual const libvariant::Variant& getLastState() = 0;
|
||||
};
|
||||
|
||||
|
||||
class HOSDeviceRepositoryService : public COSGI_Service_Interface, public common::IObservable<DeviceEvent> {
|
||||
public:
|
||||
static constexpr const char* SERVICE_NAME = "hos_devicerepository_service";
|
||||
static constexpr int SERVICE_VERSION_MAJOR = 1;
|
||||
@@ -43,12 +79,10 @@ public:
|
||||
|
||||
virtual GenericDevice* getDevice(std::string device_id) = 0;
|
||||
virtual std::vector<GenericDevice*>& getDevices(std::vector<GenericDevice*>& devices) = 0;
|
||||
|
||||
virtual bool registerDeviceStatusListener(DeviceEventListener& listener) = 0;
|
||||
virtual bool unregisterDeviceStatusListener(DeviceEventListener& listener) = 0;
|
||||
};
|
||||
|
||||
|
||||
} // namespace cosgi
|
||||
} // namespace hos
|
||||
|
||||
#endif /* _HOS_DEVICEREPOSITORY_SERVICE_H_ */
|
||||
|
||||
@@ -46,12 +46,14 @@
|
||||
<build_depend>roscpp</build_depend>
|
||||
<build_depend>hos_cosgi_core</build_depend>
|
||||
<build_depend>hos_libvariant</build_depend>
|
||||
<build_depend>hos_cpp_common</build_depend>
|
||||
<run_depend>hos_celix</run_depend>
|
||||
<run_depend>hos_core_msgs</run_depend>
|
||||
<run_depend>hos_cosgi_launcher</run_depend>
|
||||
<run_depend>roscpp</run_depend>
|
||||
<run_depend>hos_cosgi_core</run_depend>
|
||||
<run_depend>hos_libvariant</run_depend>
|
||||
<run_depend>hos_cpp_common</run_depend>
|
||||
|
||||
|
||||
<!-- The export tag contains other, unspecified, tags -->
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* HosSchemaLoader.cpp
|
||||
*
|
||||
* Created on: 24.04.2015
|
||||
* Author: matzman
|
||||
*/
|
||||
|
||||
#include "HosSchemaLoader.h"
|
||||
|
||||
|
||||
namespace hos {
|
||||
|
||||
bool HosSchemaLoader::HandleMissing(const std::string &uri, LoaderError &error) {
|
||||
if (uri.compare(0, prefix.size(), prefix) == 0) {
|
||||
return loadTypeSchema(uri.substr(prefix.size()));
|
||||
} else {
|
||||
return SchemaLoader::HandleMissing(uri, error);
|
||||
}
|
||||
}
|
||||
|
||||
bool HosSchemaLoader::loadTypeSchema(std::string schema) {
|
||||
std::string pkey = std::string(ros_param_ns).append("/").append(schema);
|
||||
std::string pvalue;
|
||||
nodeHandle.getParam(pkey, pvalue);
|
||||
if (!pvalue.empty()) {
|
||||
libvariant::Variant v = libvariant::Deserialize(pvalue, libvariant::SERIALIZE_JSON);
|
||||
if (v.IsMap()) {
|
||||
std::string sk = std::string(prefix).append(schema);
|
||||
AddSchema(sk, v);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* HosSchemaLoader.h
|
||||
*
|
||||
* Created on: 24.04.2015
|
||||
* Author: matzman
|
||||
*/
|
||||
|
||||
#ifndef SRC_HOSSCHEMALOADER_H_
|
||||
#define SRC_HOSSCHEMALOADER_H_
|
||||
|
||||
#include <Variant/Schema.h>
|
||||
#include <ros/ros.h>
|
||||
#include <string>
|
||||
|
||||
namespace hos {
|
||||
|
||||
class HosSchemaLoader: public libvariant::SchemaLoader {
|
||||
private:
|
||||
std::string ros_param_ns;
|
||||
std::string prefix;
|
||||
ros::NodeHandle nodeHandle;
|
||||
bool loadTypeSchema(std::string schema);
|
||||
public:
|
||||
HosSchemaLoader(std::string ns = "/hos/types/repository",
|
||||
std::string prefix = "hos:schema://")
|
||||
: ros_param_ns(ns), prefix(prefix), nodeHandle("~") {}
|
||||
virtual bool HandleMissing(const std::string &uri, LoaderError &error);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* SRC_HOSSCHEMALOADER_H_ */
|
||||
@@ -14,9 +14,65 @@ extern "C" {
|
||||
#include <hos_cosgi_launcher/hos_core_service.h>
|
||||
#include "hos_devicerepository_service_impl.h"
|
||||
|
||||
using namespace hos::cosgi;
|
||||
|
||||
|
||||
#include <hos_cpp_common/observable.h>
|
||||
#include <iostream>
|
||||
|
||||
class Test01 : public hos::common::IObserver<DeviceEvent> {
|
||||
public:
|
||||
void notificationReceived(hos::common::IObservable<DeviceEvent>& o, const DeviceEvent* e) {
|
||||
switch (e->eventType) {
|
||||
case DeviceEvent::EventType::DEVICE_ADDED:
|
||||
{
|
||||
std::cout << "DeviceEvent: Device added: " << e->device->getDeviceID() << std::endl;
|
||||
}
|
||||
break;
|
||||
case DeviceEvent::EventType::DEVICE_REMOVED:
|
||||
{
|
||||
std::cout << "DeviceEvent: Device removed: " << e->device->getDeviceID() << std::endl;
|
||||
}
|
||||
break;
|
||||
case DeviceEvent::EventType::STATUS_UPDATED:
|
||||
{
|
||||
auto event = e->as<DeviceStatusEvent>();
|
||||
std::cout << "DeviceEvent: Device Updated: " << e->device->getDeviceID() << std::endl;
|
||||
std::cout << "message: ";
|
||||
libvariant::SerializeJSON(stdout, event->statusMsg, true);
|
||||
std::cout << std::endl;
|
||||
std::cout << "current: ";
|
||||
libvariant::SerializeJSON(stdout, event->device->getCurrentState(), true);
|
||||
std::cout << std::endl;
|
||||
std::cout << "last: ";
|
||||
libvariant::SerializeJSON(stdout, event->device->getLastState(), true);
|
||||
std::cout << std::endl;
|
||||
}
|
||||
break;
|
||||
case DeviceEvent::EventType::COMMAND_RECEIVED:
|
||||
{
|
||||
auto event = e->as<DeviceStatusEvent>();
|
||||
std::cout << "DeviceEvent: Device Command: " << e->device->getDeviceID() << std::endl;
|
||||
std::cout << "message: ";
|
||||
libvariant::SerializeJSON(stdout, event->statusMsg, true);
|
||||
std::cout << std::endl;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
std::cout << "DeviceEvent: Unknown event." << std::endl;
|
||||
}
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
} test01;
|
||||
|
||||
|
||||
|
||||
struct UserData {
|
||||
apr_pool_t* memoryPool = nullptr;
|
||||
hos::HOSDeviceRepositoryServiceImpl* serviceImpl = nullptr;
|
||||
hos::cosgi::HOSDeviceRepositoryServiceImpl* serviceImpl = nullptr;
|
||||
service_registration_pt serviceReg = nullptr;
|
||||
};
|
||||
|
||||
@@ -49,8 +105,8 @@ celix_status_t bundleActivator_start(void * userData, bundle_context_pt context)
|
||||
UserData* myUserData = (UserData*)userData;
|
||||
// Get HOS Core Service
|
||||
service_reference_pt ref = nullptr;
|
||||
bundleContext_getServiceReference(context, (char*)hos::HOSCoreService::SERVICE_NAME, &ref);
|
||||
hos::HOSCoreService* coreService = nullptr;
|
||||
bundleContext_getServiceReference(context, (char*)HOSCoreService::SERVICE_NAME, &ref);
|
||||
hos::cosgi::HOSCoreService* coreService = nullptr;
|
||||
bundleContext_getService(context, ref, (void**)&coreService);
|
||||
if (coreService == nullptr) {
|
||||
ROS_ERROR("DeviceRepositoryService: Could not retrieve HOSCoreService.");
|
||||
@@ -65,8 +121,9 @@ celix_status_t bundleActivator_start(void * userData, bundle_context_pt context)
|
||||
if (myUserData->serviceImpl != nullptr) {
|
||||
delete myUserData->serviceImpl;
|
||||
}
|
||||
myUserData->serviceImpl = new hos::HOSDeviceRepositoryServiceImpl(*coreService);
|
||||
bundleContext_registerService(context, (char*)hos::HOSDeviceRepositoryService::SERVICE_NAME, &myUserData->serviceImpl, nullptr, &myUserData->serviceReg);
|
||||
myUserData->serviceImpl = new hos::cosgi::HOSDeviceRepositoryServiceImpl(*coreService);
|
||||
myUserData->serviceImpl->addObserver(test01);
|
||||
bundleContext_registerService(context, (char*)hos::cosgi::HOSDeviceRepositoryService::SERVICE_NAME, myUserData->serviceImpl, nullptr, &myUserData->serviceReg);
|
||||
status = CELIX_SUCCESS;
|
||||
ROS_INFO("DeviceRepositoryService: Bundle successfully started");
|
||||
}
|
||||
|
||||
@@ -7,40 +7,125 @@
|
||||
|
||||
#include "hos_devicerepository_service_impl.h"
|
||||
#include <hos_cosgi_launcher/hos_core_service.h>
|
||||
#include "HosSchemaLoader.h"
|
||||
#include <ros/ros.h>
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
#include <unordered_set>
|
||||
|
||||
|
||||
namespace hos {
|
||||
namespace cosgi {
|
||||
|
||||
GenericDeviceImpl::GenericDeviceImpl(std::string deviceID, std::string type, std::string statusTopic, std::string cmdTopic)
|
||||
: deviceID(deviceID), deviceType(type), statusTopic(statusTopic), cmdTopic(cmdTopic) {
|
||||
std::cout << "GenericDeviceImpl(" << deviceID << ", " << type << ", " << statusTopic << ", " << cmdTopic << ")" << std::endl;
|
||||
}
|
||||
|
||||
void GenericDeviceImpl::handleStatusMsg(libvariant::Variant& msg) {
|
||||
lastState = currentState.Copy();
|
||||
currentState.Merge(msg);
|
||||
DeviceStatusEvent event(this, msg);
|
||||
notifyObservers(&event);
|
||||
}
|
||||
|
||||
void GenericDeviceImpl::handleCommandMsg(libvariant::Variant& msg) {
|
||||
DeviceCmdEvent event(this, msg);
|
||||
notifyObservers(&event);
|
||||
}
|
||||
|
||||
|
||||
bool GenericDeviceImpl::registerDeviceStatusListener(DeviceEventListener& listener) {
|
||||
std::lock_guard<std::mutex> lock(listenerMutex);
|
||||
auto elem = deviceListeners.find(&listener);
|
||||
if (elem == deviceListeners.end()) {
|
||||
deviceListeners.insert(&listener);
|
||||
return true;
|
||||
HOSDeviceRepositoryServiceImpl::HOSDeviceRepositoryServiceImpl(HOSCoreService& coreService)
|
||||
: coreService(coreService), nodehandle(coreService.getPrivateNodeHandle()) {
|
||||
nodehandle.getParam("device_repository_prefix", deviceRepositoryPrefix);
|
||||
nodehandle.getParam("hos_status_topic", hosStatusTopic);
|
||||
XmlRpc::XmlRpcValue rawValue;
|
||||
nodehandle.getParam(deviceRepositoryPrefix, rawValue);
|
||||
if (rawValue.getType() == XmlRpc::XmlRpcValue::TypeStruct) {
|
||||
for (auto iter = rawValue.begin(); iter != rawValue.end(); iter++) {
|
||||
std::string devname = (*iter).first;
|
||||
XmlRpc::XmlRpcValue devRaw = (*iter).second;
|
||||
try {
|
||||
addDevice(devname, devRaw);
|
||||
ROS_INFO_STREAM("Created device " << devname << ".");
|
||||
} catch (std::exception& e) {
|
||||
ROS_ERROR_STREAM("Could not create device " << devname << ": " << e.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
hosStatusSub = nodehandle.subscribe(hosStatusTopic, 1000, &HOSDeviceRepositoryServiceImpl::hosStatusMsgCallback, this);
|
||||
schemaLoader = new HosSchemaLoader();
|
||||
}
|
||||
|
||||
void HOSDeviceRepositoryServiceImpl::addDevice(std::string name) {
|
||||
std::stringstream ss;
|
||||
ss << deviceRepositoryPrefix << "/" << name;
|
||||
XmlRpc::XmlRpcValue rawValue;
|
||||
nodehandle.getParam(ss.str(), rawValue);
|
||||
addDevice(name, rawValue);
|
||||
}
|
||||
|
||||
bool GenericDeviceImpl::unregisterDeviceStatusListener(DeviceEventListener& listener) {
|
||||
std::lock_guard<std::mutex> lock(listenerMutex);
|
||||
auto elem = deviceListeners.find(&listener);
|
||||
if (elem != deviceListeners.end()) {
|
||||
deviceListeners.erase(elem);
|
||||
return true;
|
||||
void HOSDeviceRepositoryServiceImpl::addDevice(std::string name, XmlRpc::XmlRpcValue& rawValue) {
|
||||
GenericDevice* dev = _createDevice(name, rawValue);
|
||||
if (dev != nullptr) {
|
||||
devices.insert({name, dev});
|
||||
// cmd topic
|
||||
auto& entry = subscripedTopics[dev->getCmdTopic()];
|
||||
std::cout << "subCount1: " << entry.first << "." << std::endl;
|
||||
if (entry.first <= 0) {
|
||||
entry.second = nodehandle.subscribe(dev->getCmdTopic(), 1000, &HOSDeviceRepositoryServiceImpl::cmdMsgCallback, this);
|
||||
std::cout << "subscriped to " << dev->getCmdTopic() << "." << std::endl;
|
||||
}
|
||||
entry.first= entry.first + 1;
|
||||
subscripedTopics[dev->getCmdTopic()] = entry;
|
||||
// status topic
|
||||
entry = subscripedTopics[dev->getStatusTopic()];
|
||||
std::cout << "subCount2: " << entry.first << "." << std::endl;
|
||||
if (entry.first <= 0) {
|
||||
entry.second = nodehandle.subscribe(dev->getStatusTopic(), 1000, &HOSDeviceRepositoryServiceImpl::statusMsgCallback, this);
|
||||
std::cout << "subscriped to " << dev->getStatusTopic() << "." << std::endl;
|
||||
}
|
||||
entry.first= entry.first + 1;
|
||||
subscripedTopics[dev->getStatusTopic()] = entry;
|
||||
DeviceAddedEvent event(dev);
|
||||
notifyObservers(&event);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
HOSDeviceRepositoryServiceImpl::HOSDeviceRepositoryServiceImpl(HOSCoreService& coreService) :
|
||||
coreService(coreService) {
|
||||
auto& privateNodeHandle = coreService.getPrivateNodeHandle();
|
||||
privateNodeHandle.getParam("~device_repository_prefix", deviceRepositoryPrefix);
|
||||
GenericDevice* HOSDeviceRepositoryServiceImpl::_createDevice(std::string name, XmlRpc::XmlRpcValue& rawValue) {
|
||||
std::string type, statusTopic, cmdTopic;
|
||||
XmlRpc::XmlRpcValue& typeRaw = rawValue["type"];
|
||||
if (typeRaw.getType() != XmlRpc::XmlRpcValue::TypeString) {
|
||||
throw std::runtime_error("type is not a string.");
|
||||
}
|
||||
type = static_cast<std::string>(typeRaw);
|
||||
XmlRpc::XmlRpcValue& statusTopicRaw = rawValue["status_topic"];
|
||||
if (statusTopicRaw.getType() != XmlRpc::XmlRpcValue::TypeString) {
|
||||
throw std::runtime_error("statusTopic is not a string.");
|
||||
}
|
||||
statusTopic = static_cast<std::string>(statusTopicRaw);
|
||||
XmlRpc::XmlRpcValue& cmdTopicRaw = rawValue["cmd_topic"];
|
||||
if (cmdTopicRaw.getType() != XmlRpc::XmlRpcValue::TypeString) {
|
||||
throw std::runtime_error("cmdTopic is not a string.");
|
||||
}
|
||||
cmdTopic = static_cast<std::string>(cmdTopicRaw);
|
||||
return new GenericDeviceImpl(name, type, statusTopic, cmdTopic);
|
||||
}
|
||||
|
||||
|
||||
void HOSDeviceRepositoryServiceImpl::removeDevice(std::string name) {
|
||||
GenericDevice* dev = devices[name];
|
||||
if (dev != nullptr) {
|
||||
DeviceRemovedEvent event(dev);
|
||||
notifyObservers(&event);
|
||||
dev->notifyObservers(&event);
|
||||
devices.erase(name);
|
||||
delete dev;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GenericDevice* HOSDeviceRepositoryServiceImpl::getDevice(std::string device_id) {
|
||||
return this->devices[device_id];
|
||||
}
|
||||
@@ -52,26 +137,6 @@ std::vector<GenericDevice*>& HOSDeviceRepositoryServiceImpl::getDevices(std::vec
|
||||
return devices;
|
||||
}
|
||||
|
||||
bool HOSDeviceRepositoryServiceImpl::registerDeviceStatusListener(DeviceEventListener& listener) {
|
||||
std::lock_guard<std::mutex> lock(listenerMutex);
|
||||
auto elem = deviceListeners.find(&listener);
|
||||
if (elem == deviceListeners.end()) {
|
||||
deviceListeners.insert(&listener);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool HOSDeviceRepositoryServiceImpl::unregisterDeviceStatusListener(DeviceEventListener& listener) {
|
||||
std::lock_guard<std::mutex> lock(listenerMutex);
|
||||
auto elem = deviceListeners.find(&listener);
|
||||
if (elem != deviceListeners.end()) {
|
||||
deviceListeners.erase(elem);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void HOSDeviceRepositoryServiceImpl::getServiceVersion(int& major, int& minor) {
|
||||
major = SERVICE_VERSION_MAJOR;
|
||||
@@ -82,6 +147,77 @@ int HOSDeviceRepositoryServiceImpl::getRefCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void HOSDeviceRepositoryServiceImpl::statusMsgCallback(const hos_core_msgs::DeviceStatusUpdate::ConstPtr& msg) {
|
||||
std::cout << "HOSDeviceRepositoryServiceImpl::statusMsgCallback" << std::endl;
|
||||
libvariant::Variant s = schemaLoader->GetSchema(std::string("hos:schema://").append(msg->device_type).append("/status"));
|
||||
libvariant::Variant m = libvariant::Deserialize(msg->msg_body, libvariant::SERIALIZE_JSON);
|
||||
libvariant::SchemaResult sr = libvariant::SchemaValidate(s, m, schemaLoader);
|
||||
if (!sr.Error()) {
|
||||
GenericDevice* dev = devices[msg->device_id];
|
||||
if (dev != nullptr) {
|
||||
((GenericDeviceImpl*)dev)->handleStatusMsg(m);
|
||||
DeviceStatusEvent event(dev, m);
|
||||
notifyObservers(&event);
|
||||
}
|
||||
} else {
|
||||
ROS_ERROR_STREAM("Could not validate status message: " << sr.PrettyPrintMessage());
|
||||
}
|
||||
}
|
||||
|
||||
void HOSDeviceRepositoryServiceImpl::cmdMsgCallback(const hos_core_msgs::DeviceCommand::ConstPtr& msg) {
|
||||
std::cout << "HOSDeviceRepositoryServiceImpl::cmdMsgCallback" << std::endl;
|
||||
libvariant::Variant s = schemaLoader->GetSchema(std::string("hos:schema://").append(msg->device_type).append("/command"));
|
||||
libvariant::Variant m = libvariant::Deserialize(msg->msg_body, libvariant::SERIALIZE_JSON);
|
||||
libvariant::SchemaResult sr = libvariant::SchemaValidate(s, m, schemaLoader);
|
||||
if (!sr.Error()) {
|
||||
GenericDevice* dev = devices[msg->device_id];
|
||||
if (dev != nullptr) {
|
||||
((GenericDeviceImpl*)dev)->handleCommandMsg(m);
|
||||
DeviceCmdEvent event(dev, m);
|
||||
notifyObservers(&event);
|
||||
}
|
||||
} else {
|
||||
ROS_ERROR_STREAM("Could not validate command message: " << sr.PrettyPrintMessage());
|
||||
}
|
||||
}
|
||||
|
||||
void HOSDeviceRepositoryServiceImpl::hosStatusMsgCallback(const hos_core_msgs::HosStatusUpdate::ConstPtr& msg) {
|
||||
std::cout << "HOSDeviceRepositoryServiceImpl::hosStatusMsgCallback" << std::endl;
|
||||
libvariant::Variant s = schemaLoader->GetSchema(std::string("hos:schema://core/msgs/hosstatusupdate"));
|
||||
libvariant::Variant m = libvariant::Deserialize(msg->msg_body, libvariant::SERIALIZE_JSON);
|
||||
libvariant::SchemaResult sr = libvariant::SchemaValidate(s, m, schemaLoader);
|
||||
if (!sr.Error()) {
|
||||
if (m.Contains("devices")) {
|
||||
auto d = m["devices"];
|
||||
if (d.Contains("added") && d["added"].IsList()) {
|
||||
for (auto dev : d["added"].AsList()) {
|
||||
if (dev.IsString()) {
|
||||
std::string devname = dev.AsString();
|
||||
if (devices.find(devname) == devices.end()) {
|
||||
addDevice(devname);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (d.Contains("removed") && d["removed"].IsList()) {
|
||||
for (auto dev : d["removed"].AsList()) {
|
||||
if (dev.IsString()) {
|
||||
std::string devname = dev.AsString();
|
||||
if (devices.find(devname) == devices.end()) {
|
||||
removeDevice(devname);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ROS_ERROR_STREAM("Could not validate hos status message: " << sr.PrettyPrintMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace cosgi
|
||||
} // namespace hos
|
||||
|
||||
|
||||
|
||||
@@ -8,40 +8,78 @@
|
||||
#ifndef SRC_HOS_DEVICEREPOSITORY_SERVICE_IMPL_H_
|
||||
#define SRC_HOS_DEVICEREPOSITORY_SERVICE_IMPL_H_
|
||||
|
||||
#include <Variant/Variant.h>
|
||||
#include <hos_cosgi_devicerepository/hos_devicerepository_service.h>
|
||||
#include <mutex>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <hos_core_msgs/DeviceCommand.h>
|
||||
#include <hos_core_msgs/DeviceStatusUpdate.h>
|
||||
#include <hos_core_msgs/HosStatusUpdate.h>
|
||||
#include <hos_cpp_common/observable_impl.h>
|
||||
|
||||
|
||||
namespace XmlRpc {
|
||||
class XmlRpcValue;
|
||||
}
|
||||
|
||||
#include <ros/ros.h>
|
||||
|
||||
namespace hos {
|
||||
|
||||
class HosSchemaLoader;
|
||||
|
||||
namespace cosgi {
|
||||
|
||||
class HOSCoreService;
|
||||
|
||||
|
||||
class GenericDeviceImpl : public GenericDevice {
|
||||
OBSERVABLE_IMPL(DeviceEvent)
|
||||
private:
|
||||
std::mutex listenerMutex;
|
||||
std::set<DeviceEventListener*> deviceListeners;
|
||||
std::string deviceID;
|
||||
public:
|
||||
virtual std::string getDeviceID() { return deviceID; }
|
||||
std::string deviceType;
|
||||
std::string statusTopic;
|
||||
std::string cmdTopic;
|
||||
libvariant::Variant currentState;
|
||||
libvariant::Variant lastState;
|
||||
|
||||
virtual bool registerDeviceStatusListener(DeviceEventListener& listener);
|
||||
virtual bool unregisterDeviceStatusListener(DeviceEventListener& listener);
|
||||
public:
|
||||
GenericDeviceImpl(std::string deviceID, std::string deviceType, std::string statusTopic, std::string cmdTopic);
|
||||
|
||||
virtual const std::string& getDeviceID() { return deviceID; }
|
||||
virtual const std::string& getDeviceType() { return deviceType; }
|
||||
virtual const std::string& getCmdTopic() { return cmdTopic; }
|
||||
virtual const std::string& getStatusTopic() { return statusTopic; }
|
||||
|
||||
virtual const libvariant::Variant& getCurrentState() { return currentState; }
|
||||
virtual const libvariant::Variant& getLastState() { return lastState; }
|
||||
|
||||
void handleStatusMsg(libvariant::Variant& msg);
|
||||
void handleCommandMsg(libvariant::Variant& msg);
|
||||
};
|
||||
|
||||
|
||||
class HOSDeviceRepositoryServiceImpl : public HOSDeviceRepositoryService {
|
||||
OBSERVABLE_IMPL(DeviceEvent)
|
||||
private:
|
||||
typedef std::map<std::string, GenericDevice*> devicesMap_t;
|
||||
|
||||
ros::NodeHandle& nodehandle;
|
||||
HOSCoreService& coreService;
|
||||
devicesMap_t devices;
|
||||
std::mutex listenerMutex;
|
||||
std::set<DeviceEventListener*> deviceListeners;
|
||||
std::set<std::string> subscripedTopics;
|
||||
std::map<std::string, std::pair<int, ros::Subscriber>> subscripedTopics;
|
||||
|
||||
std::string deviceRepositoryPrefix = "/hos/devices/repository";
|
||||
std::string hosStatusTopic = "/hos/status/updates";
|
||||
|
||||
ros::Subscriber hosStatusSub;
|
||||
|
||||
HosSchemaLoader* schemaLoader = nullptr;
|
||||
|
||||
void addDevice(std::string name);
|
||||
void addDevice(std::string name, XmlRpc::XmlRpcValue& rawValue);
|
||||
GenericDevice* _createDevice(std::string name, XmlRpc::XmlRpcValue& rawValue);
|
||||
void removeDevice(std::string name);
|
||||
|
||||
public:
|
||||
HOSDeviceRepositoryServiceImpl(HOSCoreService& coreService);
|
||||
@@ -49,15 +87,18 @@ public:
|
||||
virtual GenericDevice* getDevice(std::string device_id);
|
||||
virtual std::vector<GenericDevice*>& getDevices(std::vector<GenericDevice*>& devices);
|
||||
|
||||
virtual bool registerDeviceStatusListener(DeviceEventListener& listener);
|
||||
virtual bool unregisterDeviceStatusListener(DeviceEventListener& listener);
|
||||
|
||||
virtual const char* getServiceName() { return SERVICE_NAME; }
|
||||
virtual void getServiceVersion(int& major, int& minor);
|
||||
|
||||
virtual int getRefCount();
|
||||
|
||||
void statusMsgCallback(const hos_core_msgs::DeviceStatusUpdate::ConstPtr& msg);
|
||||
void cmdMsgCallback(const hos_core_msgs::DeviceCommand::ConstPtr& msg);
|
||||
void hosStatusMsgCallback(const hos_core_msgs::HosStatusUpdate::ConstPtr& msg);
|
||||
};
|
||||
|
||||
|
||||
} // namespace cosgi
|
||||
} // namespace hos
|
||||
|
||||
|
||||
|
||||
@@ -155,11 +155,11 @@ install(TARGETS hos_cosgi_launcher
|
||||
)
|
||||
|
||||
## Mark cpp header files for installation
|
||||
# install(DIRECTORY include/${PROJECT_NAME}/
|
||||
# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
|
||||
# FILES_MATCHING PATTERN "*.h"
|
||||
# PATTERN ".svn" EXCLUDE
|
||||
# )
|
||||
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
|
||||
|
||||
@@ -10,6 +10,8 @@ namespace ros {
|
||||
}
|
||||
|
||||
namespace hos {
|
||||
namespace cosgi{
|
||||
|
||||
|
||||
class HOSCoreService : public COSGI_Service_Interface {
|
||||
public:
|
||||
@@ -22,6 +24,8 @@ public:
|
||||
virtual void requestShutdown() = 0;
|
||||
};
|
||||
|
||||
|
||||
} // namespace cosgi
|
||||
} // namespace hos
|
||||
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <ros/ros.h>
|
||||
|
||||
namespace hos {
|
||||
namespace cosgi{
|
||||
|
||||
|
||||
HOSCoreServiceImpl::HOSCoreServiceImpl(ros::NodeHandle& publicNodeHandle, ros::NodeHandle& privateNodeHandle)
|
||||
@@ -34,5 +35,7 @@ void HOSCoreServiceImpl::getServiceVersion(int& major, int& minor) {
|
||||
minor = SERVICE_VERSION_MINOR;
|
||||
}
|
||||
|
||||
|
||||
} // namespace cosgi
|
||||
} // namespace hos
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
|
||||
namespace hos {
|
||||
namespace cosgi{
|
||||
|
||||
class HOSCoreServiceImpl : public HOSCoreService {
|
||||
private:
|
||||
@@ -28,6 +29,7 @@ public:
|
||||
virtual void getServiceVersion(int& major, int& minor);
|
||||
};
|
||||
|
||||
} // namespace cosgi
|
||||
} // namespace hos
|
||||
|
||||
|
||||
|
||||
@@ -18,6 +18,9 @@ extern "C" { // celix does not provide C++ ready headers
|
||||
#include <string>
|
||||
|
||||
|
||||
using namespace hos::cosgi;
|
||||
|
||||
|
||||
std::function<void(int)> signalHandler;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
@@ -99,9 +102,9 @@ int main(int argc, char **argv) {
|
||||
bundle_context_pt context = nullptr;
|
||||
bundle_getContext(fwBundle, &context);
|
||||
// Create and register hos-core-service
|
||||
hos::HOSCoreServiceImpl hosCoreService(rosPublicNodeHandle, rosPrivateNodeHandle);
|
||||
HOSCoreServiceImpl hosCoreService(rosPublicNodeHandle, rosPrivateNodeHandle);
|
||||
service_registration_pt reg = nullptr;
|
||||
bundleContext_registerService(context, (char*)hos::HOSCoreService::SERVICE_NAME, static_cast<hos::HOSCoreService*>(&hosCoreService), nullptr, ®);
|
||||
bundleContext_registerService(context, (char*)HOSCoreService::SERVICE_NAME, static_cast<HOSCoreService*>(&hosCoreService), nullptr, ®);
|
||||
ROS_INFO("HOS core service registered");
|
||||
|
||||
|
||||
@@ -194,7 +197,7 @@ int main(int argc, char **argv) {
|
||||
std::cerr << ss.str();
|
||||
}
|
||||
|
||||
// Deinitialize celix framework
|
||||
// Deinitialize celix frameork
|
||||
if (fwBundle != nullptr) {
|
||||
bundle_stop(fwBundle);
|
||||
framework_waitForStop(framework);
|
||||
@@ -219,3 +222,5 @@ int main(int argc, char **argv) {
|
||||
ROS_INFO("Exiting ...");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,204 @@
|
||||
cmake_minimum_required(VERSION 2.8.3)
|
||||
project(hos_cosgi_rulesengine)
|
||||
|
||||
## 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
|
||||
hos_cosgi_devicerepository
|
||||
hos_cosgi_launcher
|
||||
hos_cpp_common
|
||||
hos_libvariant
|
||||
roscpp
|
||||
)
|
||||
|
||||
## 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)
|
||||
|
||||
################################################
|
||||
## 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_rulesengine
|
||||
CATKIN_DEPENDS hos_celix hos_cosgi_core hos_cosgi_devicerepository hos_cosgi_launcher hos_cpp_common hos_libvariant roscpp
|
||||
# DEPENDS system_lib
|
||||
)
|
||||
|
||||
###########
|
||||
## Build ##
|
||||
###########
|
||||
|
||||
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(
|
||||
${catkin_INCLUDE_DIRS}
|
||||
${APR_INCLUDE_DIR}
|
||||
${APR_INCLUDE_DIR}/apr-1.0
|
||||
include
|
||||
${hos_libvariant_INCLUDE_DIRS}/hos_libvariant
|
||||
)
|
||||
|
||||
set(BUNDLE_SYMBOLICNAME "hos.hos_rulesengine")
|
||||
set(BUNDLE_VERSION "1.0.0")
|
||||
set(BUNDLE_NAME "hos_rulesengine")
|
||||
|
||||
bundle(hos_cosgi_rulesengine
|
||||
SOURCES
|
||||
${PROJECT_SOURCE_DIR}/src/bundle_activator
|
||||
${PROJECT_SOURCE_DIR}/src/hos_rulesengine_service_impl
|
||||
)
|
||||
target_link_libraries(hos_cosgi_rulesengine
|
||||
${catkin_LIBRARIES}
|
||||
${APR_LIBRARIES}
|
||||
)
|
||||
|
||||
## Declare a cpp library
|
||||
# add_library(hos_cosgi_rulesengine
|
||||
# src/${PROJECT_NAME}/hos_cosgi_rulesengine.cpp
|
||||
# )
|
||||
|
||||
## Declare a cpp executable
|
||||
# add_executable(hos_cosgi_rulesengine_node src/hos_cosgi_rulesengine_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_rulesengine_node hos_cosgi_rulesengine_generate_messages_cpp)
|
||||
|
||||
## Specify libraries to link a library or executable target against
|
||||
# target_link_libraries(hos_cosgi_rulesengine_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_rulesengine.zip
|
||||
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
|
||||
|
||||
## 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_rulesengine hos_cosgi_rulesengine_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_rulesengine.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)
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* hos_rulesengine_service.h
|
||||
*
|
||||
* Created on: 26.04.2015
|
||||
* Author: matzman
|
||||
*/
|
||||
|
||||
#ifndef INCLUDE_HOS_COSGI_RULESENGINE_HOS_RULESENGINE_SERVICE_H_
|
||||
#define INCLUDE_HOS_COSGI_RULESENGINE_HOS_RULESENGINE_SERVICE_H_
|
||||
|
||||
|
||||
#include <hos_cosgi_core/cosgi_core.h>
|
||||
#include <hos_cpp_common/observable.h>
|
||||
|
||||
|
||||
namespace hos {
|
||||
namespace cosgi {
|
||||
|
||||
|
||||
class RulesEngineEvent;
|
||||
|
||||
|
||||
class HOSRulesEngineService : public COSGI_Service_Interface, public common::IObservable<RulesEngineEvent> {
|
||||
public:
|
||||
static constexpr const char* SERVICE_NAME = "hos_rulesengine_service";
|
||||
static constexpr int SERVICE_VERSION_MAJOR = 1;
|
||||
static constexpr int SERVICE_VERSION_MINOR = 0;
|
||||
};
|
||||
|
||||
|
||||
} // namespace cosgi
|
||||
} // namespace hos
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* INCLUDE_HOS_COSGI_RULESENGINE_HOS_RULESENGINE_SERVICE_H_ */
|
||||
@@ -0,0 +1,5 @@
|
||||
<launch>
|
||||
<node name="cosgi_rulesengine" 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_rulesengine/hos_cosgi_rulesengine.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>
|
||||
</launch>
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore">
|
||||
<eClassifiers xsi:type="ecore:EClass" name="RulesUnit">
|
||||
<eStructuralFeatures xsi:type="ecore:EReference" name="rules" lowerBound="1" upperBound="-1"
|
||||
eType="#//Rule" containment="true"/>
|
||||
<eStructuralFeatures xsi:type="ecore:EReference" name="context" eType="#//GlobalContext"
|
||||
containment="true"/>
|
||||
</eClassifiers>
|
||||
<eClassifiers xsi:type="ecore:EClass" name="Rule">
|
||||
<eOperations name="evaluate"/>
|
||||
<eOperations name="execute"/>
|
||||
<eStructuralFeatures xsi:type="ecore:EReference" name="conditions" lowerBound="1"
|
||||
upperBound="-1" eType="#//Condition" containment="true"/>
|
||||
<eStructuralFeatures xsi:type="ecore:EReference" name="body" lowerBound="1" eType="#//RuleBody"
|
||||
containment="true"/>
|
||||
</eClassifiers>
|
||||
<eClassifiers xsi:type="ecore:EClass" name="Condition">
|
||||
<eOperations name="evaluate"/>
|
||||
</eClassifiers>
|
||||
<eClassifiers xsi:type="ecore:EClass" name="ItemCondition" eSuperTypes="#//Condition"/>
|
||||
<eClassifiers xsi:type="ecore:EClass" name="TimeCondition" eSuperTypes="#//Condition"/>
|
||||
<eClassifiers xsi:type="ecore:EClass" name="SystemCondition" eSuperTypes="#//Condition"/>
|
||||
<eClassifiers xsi:type="ecore:EClass" name="GlobalContext"/>
|
||||
<eClassifiers xsi:type="ecore:EClass" name="RuleBody">
|
||||
<eOperations name="execute"/>
|
||||
</eClassifiers>
|
||||
<eClassifiers xsi:type="ecore:EClass" name="GlobalPythonContext" eSuperTypes="#//GlobalContext"/>
|
||||
<eClassifiers xsi:type="ecore:EClass" name="RulePythonBody" eSuperTypes="#//RuleBody"/>
|
||||
<eClassifiers xsi:type="ecore:EClass" name="RulesEngine">
|
||||
<eStructuralFeatures xsi:type="ecore:EReference" name="units" upperBound="-1"
|
||||
eType="#//RulesUnit" containment="true"/>
|
||||
</eClassifiers>
|
||||
</ecore:EPackage>
|
||||
@@ -0,0 +1,294 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmi:id="_9vHMAOxeEeSeBazpeuC4MQ" type="Ecore" measurementUnit="Pixel">
|
||||
<children xmi:type="notation:Shape" xmi:id="_9xiN4OxeEeSeBazpeuC4MQ" type="2001" fontName="Sans">
|
||||
<children xmi:type="notation:DecorationNode" xmi:id="_9xi08OxeEeSeBazpeuC4MQ" type="5001"/>
|
||||
<children xmi:type="notation:BasicCompartment" xmi:id="_9xi08exeEeSeBazpeuC4MQ" type="7001">
|
||||
<styles xmi:type="notation:SortingStyle" xmi:id="_9xi08uxeEeSeBazpeuC4MQ"/>
|
||||
<styles xmi:type="notation:FilteringStyle" xmi:id="_9xi08-xeEeSeBazpeuC4MQ"/>
|
||||
<layoutConstraint xmi:type="notation:Ratio" xmi:id="_JFWEcOxfEeSeBazpeuC4MQ" value="0.23076923076923078"/>
|
||||
</children>
|
||||
<children xmi:type="notation:BasicCompartment" xmi:id="_9xi09OxeEeSeBazpeuC4MQ" type="7002">
|
||||
<styles xmi:type="notation:SortingStyle" xmi:id="_9xi09exeEeSeBazpeuC4MQ"/>
|
||||
<styles xmi:type="notation:FilteringStyle" xmi:id="_9xi09uxeEeSeBazpeuC4MQ"/>
|
||||
<layoutConstraint xmi:type="notation:Ratio" xmi:id="_JFWEcexfEeSeBazpeuC4MQ" value="0.23076923076923078"/>
|
||||
</children>
|
||||
<children xmi:type="notation:BasicCompartment" xmi:id="_9xi09-xeEeSeBazpeuC4MQ" type="7003">
|
||||
<styles xmi:type="notation:SortingStyle" xmi:id="_9xi0-OxeEeSeBazpeuC4MQ"/>
|
||||
<styles xmi:type="notation:FilteringStyle" xmi:id="_9xi0-exeEeSeBazpeuC4MQ"/>
|
||||
<layoutConstraint xmi:type="notation:Ratio" xmi:id="_JFWEcuxfEeSeBazpeuC4MQ" value="0.23076923076923078"/>
|
||||
</children>
|
||||
<element xmi:type="ecore:EClass" href="rulesengine.ecore#//RulesUnit"/>
|
||||
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_9xiN4exeEeSeBazpeuC4MQ" x="115" y="115"/>
|
||||
</children>
|
||||
<children xmi:type="notation:Shape" xmi:id="_9xi0-uxeEeSeBazpeuC4MQ" type="2001" fontName="Sans">
|
||||
<children xmi:type="notation:DecorationNode" xmi:id="_9xi0_OxeEeSeBazpeuC4MQ" type="5001"/>
|
||||
<children xmi:type="notation:BasicCompartment" xmi:id="_9xi0_exeEeSeBazpeuC4MQ" type="7001">
|
||||
<styles xmi:type="notation:SortingStyle" xmi:id="_9xi0_uxeEeSeBazpeuC4MQ"/>
|
||||
<styles xmi:type="notation:FilteringStyle" xmi:id="_9xi0_-xeEeSeBazpeuC4MQ"/>
|
||||
</children>
|
||||
<children xmi:type="notation:BasicCompartment" xmi:id="_9xi1AOxeEeSeBazpeuC4MQ" type="7002">
|
||||
<children xmi:type="notation:Node" xmi:id="_al57sOxgEeSeBazpeuC4MQ" type="3002">
|
||||
<element xmi:type="ecore:EOperation" href="rulesengine.ecore#//Rule/evaluate"/>
|
||||
<layoutConstraint xmi:type="notation:Location" xmi:id="_al57sexgEeSeBazpeuC4MQ"/>
|
||||
</children>
|
||||
<children xmi:type="notation:Node" xmi:id="_cYeFgOxgEeSeBazpeuC4MQ" type="3002">
|
||||
<element xmi:type="ecore:EOperation" href="rulesengine.ecore#//Rule/execute"/>
|
||||
<layoutConstraint xmi:type="notation:Location" xmi:id="_cYeFgexgEeSeBazpeuC4MQ"/>
|
||||
</children>
|
||||
<styles xmi:type="notation:SortingStyle" xmi:id="_9xi1AexeEeSeBazpeuC4MQ"/>
|
||||
<styles xmi:type="notation:FilteringStyle" xmi:id="_9xi1AuxeEeSeBazpeuC4MQ"/>
|
||||
</children>
|
||||
<children xmi:type="notation:BasicCompartment" xmi:id="_9xi1A-xeEeSeBazpeuC4MQ" type="7003">
|
||||
<styles xmi:type="notation:SortingStyle" xmi:id="_9xi1BOxeEeSeBazpeuC4MQ"/>
|
||||
<styles xmi:type="notation:FilteringStyle" xmi:id="_9xi1BexeEeSeBazpeuC4MQ"/>
|
||||
</children>
|
||||
<element xmi:type="ecore:EClass" href="rulesengine.ecore#//Rule"/>
|
||||
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_9xi0--xeEeSeBazpeuC4MQ" x="335" y="110"/>
|
||||
</children>
|
||||
<children xmi:type="notation:Shape" xmi:id="_9xjcAOxeEeSeBazpeuC4MQ" type="2001" fontName="Sans">
|
||||
<children xmi:type="notation:DecorationNode" xmi:id="_9xjcAuxeEeSeBazpeuC4MQ" type="5001"/>
|
||||
<children xmi:type="notation:BasicCompartment" xmi:id="_9xjcA-xeEeSeBazpeuC4MQ" type="7001">
|
||||
<styles xmi:type="notation:SortingStyle" xmi:id="_9xjcBOxeEeSeBazpeuC4MQ"/>
|
||||
<styles xmi:type="notation:FilteringStyle" xmi:id="_9xjcBexeEeSeBazpeuC4MQ"/>
|
||||
</children>
|
||||
<children xmi:type="notation:BasicCompartment" xmi:id="_9xjcBuxeEeSeBazpeuC4MQ" type="7002">
|
||||
<children xmi:type="notation:Node" xmi:id="_RZeoYOxgEeSeBazpeuC4MQ" type="3002">
|
||||
<element xmi:type="ecore:EOperation" href="rulesengine.ecore#//Condition/evaluate"/>
|
||||
<layoutConstraint xmi:type="notation:Location" xmi:id="_RZeoYexgEeSeBazpeuC4MQ"/>
|
||||
</children>
|
||||
<styles xmi:type="notation:SortingStyle" xmi:id="_9xjcB-xeEeSeBazpeuC4MQ"/>
|
||||
<styles xmi:type="notation:FilteringStyle" xmi:id="_9xjcCOxeEeSeBazpeuC4MQ"/>
|
||||
</children>
|
||||
<children xmi:type="notation:BasicCompartment" xmi:id="_9xjcCexeEeSeBazpeuC4MQ" type="7003">
|
||||
<styles xmi:type="notation:SortingStyle" xmi:id="_9xjcCuxeEeSeBazpeuC4MQ"/>
|
||||
<styles xmi:type="notation:FilteringStyle" xmi:id="_9xjcC-xeEeSeBazpeuC4MQ"/>
|
||||
</children>
|
||||
<element xmi:type="ecore:EClass" href="rulesengine.ecore#//Condition"/>
|
||||
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_9xjcAexeEeSeBazpeuC4MQ" x="525" y="120"/>
|
||||
</children>
|
||||
<children xmi:type="notation:Shape" xmi:id="_9xjcDOxeEeSeBazpeuC4MQ" type="2001" fontName="Sans">
|
||||
<children xmi:type="notation:DecorationNode" xmi:id="_9xjcDuxeEeSeBazpeuC4MQ" type="5001"/>
|
||||
<children xmi:type="notation:BasicCompartment" xmi:id="_9xjcD-xeEeSeBazpeuC4MQ" type="7001">
|
||||
<styles xmi:type="notation:SortingStyle" xmi:id="_9xjcEOxeEeSeBazpeuC4MQ"/>
|
||||
<styles xmi:type="notation:FilteringStyle" xmi:id="_9xjcEexeEeSeBazpeuC4MQ"/>
|
||||
</children>
|
||||
<children xmi:type="notation:BasicCompartment" xmi:id="_9xjcEuxeEeSeBazpeuC4MQ" type="7002">
|
||||
<styles xmi:type="notation:SortingStyle" xmi:id="_9xjcE-xeEeSeBazpeuC4MQ"/>
|
||||
<styles xmi:type="notation:FilteringStyle" xmi:id="_9xjcFOxeEeSeBazpeuC4MQ"/>
|
||||
</children>
|
||||
<children xmi:type="notation:BasicCompartment" xmi:id="_9xjcFexeEeSeBazpeuC4MQ" type="7003">
|
||||
<styles xmi:type="notation:SortingStyle" xmi:id="_9xjcFuxeEeSeBazpeuC4MQ"/>
|
||||
<styles xmi:type="notation:FilteringStyle" xmi:id="_9xjcF-xeEeSeBazpeuC4MQ"/>
|
||||
</children>
|
||||
<element xmi:type="ecore:EClass" href="rulesengine.ecore#//ItemCondition"/>
|
||||
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_9xjcDexeEeSeBazpeuC4MQ" x="685" y="150"/>
|
||||
</children>
|
||||
<children xmi:type="notation:Shape" xmi:id="_9xkDEOxeEeSeBazpeuC4MQ" type="2001" fontName="Sans">
|
||||
<children xmi:type="notation:DecorationNode" xmi:id="_9xkDEuxeEeSeBazpeuC4MQ" type="5001"/>
|
||||
<children xmi:type="notation:BasicCompartment" xmi:id="_9xkDE-xeEeSeBazpeuC4MQ" type="7001">
|
||||
<styles xmi:type="notation:SortingStyle" xmi:id="_9xkDFOxeEeSeBazpeuC4MQ"/>
|
||||
<styles xmi:type="notation:FilteringStyle" xmi:id="_9xkDFexeEeSeBazpeuC4MQ"/>
|
||||
</children>
|
||||
<children xmi:type="notation:BasicCompartment" xmi:id="_9xkDFuxeEeSeBazpeuC4MQ" type="7002">
|
||||
<styles xmi:type="notation:SortingStyle" xmi:id="_9xkDF-xeEeSeBazpeuC4MQ"/>
|
||||
<styles xmi:type="notation:FilteringStyle" xmi:id="_9xkDGOxeEeSeBazpeuC4MQ"/>
|
||||
</children>
|
||||
<children xmi:type="notation:BasicCompartment" xmi:id="_9xkDGexeEeSeBazpeuC4MQ" type="7003">
|
||||
<styles xmi:type="notation:SortingStyle" xmi:id="_9xkDGuxeEeSeBazpeuC4MQ"/>
|
||||
<styles xmi:type="notation:FilteringStyle" xmi:id="_9xkDG-xeEeSeBazpeuC4MQ"/>
|
||||
</children>
|
||||
<element xmi:type="ecore:EClass" href="rulesengine.ecore#//TimeCondition"/>
|
||||
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_9xkDEexeEeSeBazpeuC4MQ" x="685" y="60"/>
|
||||
</children>
|
||||
<children xmi:type="notation:Shape" xmi:id="_9xkDHOxeEeSeBazpeuC4MQ" type="2001" fontName="Sans">
|
||||
<children xmi:type="notation:DecorationNode" xmi:id="_9xkDHuxeEeSeBazpeuC4MQ" type="5001"/>
|
||||
<children xmi:type="notation:BasicCompartment" xmi:id="_9xkDH-xeEeSeBazpeuC4MQ" type="7001">
|
||||
<styles xmi:type="notation:SortingStyle" xmi:id="_9xkDIOxeEeSeBazpeuC4MQ"/>
|
||||
<styles xmi:type="notation:FilteringStyle" xmi:id="_9xkDIexeEeSeBazpeuC4MQ"/>
|
||||
</children>
|
||||
<children xmi:type="notation:BasicCompartment" xmi:id="_9xkDIuxeEeSeBazpeuC4MQ" type="7002">
|
||||
<styles xmi:type="notation:SortingStyle" xmi:id="_9xkDI-xeEeSeBazpeuC4MQ"/>
|
||||
<styles xmi:type="notation:FilteringStyle" xmi:id="_9xkDJOxeEeSeBazpeuC4MQ"/>
|
||||
</children>
|
||||
<children xmi:type="notation:BasicCompartment" xmi:id="_9xkDJexeEeSeBazpeuC4MQ" type="7003">
|
||||
<styles xmi:type="notation:SortingStyle" xmi:id="_9xkDJuxeEeSeBazpeuC4MQ"/>
|
||||
<styles xmi:type="notation:FilteringStyle" xmi:id="_9xkDJ-xeEeSeBazpeuC4MQ"/>
|
||||
</children>
|
||||
<element xmi:type="ecore:EClass" href="rulesengine.ecore#//SystemCondition"/>
|
||||
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_9xkDHexeEeSeBazpeuC4MQ" x="690" y="240"/>
|
||||
</children>
|
||||
<children xmi:type="notation:Shape" xmi:id="_9xkqIOxeEeSeBazpeuC4MQ" type="2001" fontName="Sans">
|
||||
<children xmi:type="notation:DecorationNode" xmi:id="_9xkqIuxeEeSeBazpeuC4MQ" type="5001"/>
|
||||
<children xmi:type="notation:BasicCompartment" xmi:id="_9xkqI-xeEeSeBazpeuC4MQ" type="7001">
|
||||
<styles xmi:type="notation:SortingStyle" xmi:id="_9xkqJOxeEeSeBazpeuC4MQ"/>
|
||||
<styles xmi:type="notation:FilteringStyle" xmi:id="_9xkqJexeEeSeBazpeuC4MQ"/>
|
||||
</children>
|
||||
<children xmi:type="notation:BasicCompartment" xmi:id="_9xkqJuxeEeSeBazpeuC4MQ" type="7002">
|
||||
<styles xmi:type="notation:SortingStyle" xmi:id="_9xkqJ-xeEeSeBazpeuC4MQ"/>
|
||||
<styles xmi:type="notation:FilteringStyle" xmi:id="_9xkqKOxeEeSeBazpeuC4MQ"/>
|
||||
</children>
|
||||
<children xmi:type="notation:BasicCompartment" xmi:id="_9xkqKexeEeSeBazpeuC4MQ" type="7003">
|
||||
<styles xmi:type="notation:SortingStyle" xmi:id="_9xkqKuxeEeSeBazpeuC4MQ"/>
|
||||
<styles xmi:type="notation:FilteringStyle" xmi:id="_9xkqK-xeEeSeBazpeuC4MQ"/>
|
||||
</children>
|
||||
<element xmi:type="ecore:EClass" href="rulesengine.ecore#//GlobalContext"/>
|
||||
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_9xkqIexeEeSeBazpeuC4MQ" x="100" y="270"/>
|
||||
</children>
|
||||
<children xmi:type="notation:Shape" xmi:id="_9xkqLOxeEeSeBazpeuC4MQ" type="2001" fontName="Sans">
|
||||
<children xmi:type="notation:DecorationNode" xmi:id="_9xkqLuxeEeSeBazpeuC4MQ" type="5001"/>
|
||||
<children xmi:type="notation:BasicCompartment" xmi:id="_9xkqL-xeEeSeBazpeuC4MQ" type="7001">
|
||||
<styles xmi:type="notation:SortingStyle" xmi:id="_9xkqMOxeEeSeBazpeuC4MQ"/>
|
||||
<styles xmi:type="notation:FilteringStyle" xmi:id="_9xkqMexeEeSeBazpeuC4MQ"/>
|
||||
<layoutConstraint xmi:type="notation:Ratio" xmi:id="_CAJjYOxfEeSeBazpeuC4MQ" value="0.23076923076923078"/>
|
||||
</children>
|
||||
<children xmi:type="notation:BasicCompartment" xmi:id="_9xkqMuxeEeSeBazpeuC4MQ" type="7002">
|
||||
<children xmi:type="notation:Node" xmi:id="_NsA4IOxgEeSeBazpeuC4MQ" type="3002">
|
||||
<element xmi:type="ecore:EOperation" href="rulesengine.ecore#//RuleBody/execute"/>
|
||||
<layoutConstraint xmi:type="notation:Location" xmi:id="_NsA4IexgEeSeBazpeuC4MQ"/>
|
||||
</children>
|
||||
<styles xmi:type="notation:SortingStyle" xmi:id="_9xkqM-xeEeSeBazpeuC4MQ"/>
|
||||
<styles xmi:type="notation:FilteringStyle" xmi:id="_9xkqNOxeEeSeBazpeuC4MQ"/>
|
||||
<layoutConstraint xmi:type="notation:Ratio" xmi:id="_CAJjYexfEeSeBazpeuC4MQ" value="0.23076923076923078"/>
|
||||
</children>
|
||||
<children xmi:type="notation:BasicCompartment" xmi:id="_9xkqNexeEeSeBazpeuC4MQ" type="7003">
|
||||
<styles xmi:type="notation:SortingStyle" xmi:id="_9xkqNuxeEeSeBazpeuC4MQ"/>
|
||||
<styles xmi:type="notation:FilteringStyle" xmi:id="_9xkqN-xeEeSeBazpeuC4MQ"/>
|
||||
<layoutConstraint xmi:type="notation:Ratio" xmi:id="_CAJjYuxfEeSeBazpeuC4MQ" value="0.23076923076923078"/>
|
||||
</children>
|
||||
<element xmi:type="ecore:EClass" href="rulesengine.ecore#//RuleBody"/>
|
||||
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_9xkqLexeEeSeBazpeuC4MQ" x="335" y="240"/>
|
||||
</children>
|
||||
<children xmi:type="notation:Shape" xmi:id="_9xkqOOxeEeSeBazpeuC4MQ" type="2001" fontName="Sans">
|
||||
<children xmi:type="notation:DecorationNode" xmi:id="_9xlRMOxeEeSeBazpeuC4MQ" type="5001"/>
|
||||
<children xmi:type="notation:BasicCompartment" xmi:id="_9xlRMexeEeSeBazpeuC4MQ" type="7001">
|
||||
<styles xmi:type="notation:SortingStyle" xmi:id="_9xlRMuxeEeSeBazpeuC4MQ"/>
|
||||
<styles xmi:type="notation:FilteringStyle" xmi:id="_9xlRM-xeEeSeBazpeuC4MQ"/>
|
||||
</children>
|
||||
<children xmi:type="notation:BasicCompartment" xmi:id="_9xlRNOxeEeSeBazpeuC4MQ" type="7002">
|
||||
<styles xmi:type="notation:SortingStyle" xmi:id="_9xlRNexeEeSeBazpeuC4MQ"/>
|
||||
<styles xmi:type="notation:FilteringStyle" xmi:id="_9xlRNuxeEeSeBazpeuC4MQ"/>
|
||||
</children>
|
||||
<children xmi:type="notation:BasicCompartment" xmi:id="_9xlRN-xeEeSeBazpeuC4MQ" type="7003">
|
||||
<styles xmi:type="notation:SortingStyle" xmi:id="_9xlROOxeEeSeBazpeuC4MQ"/>
|
||||
<styles xmi:type="notation:FilteringStyle" xmi:id="_9xlROexeEeSeBazpeuC4MQ"/>
|
||||
</children>
|
||||
<element xmi:type="ecore:EClass" href="rulesengine.ecore#//GlobalPythonContext"/>
|
||||
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_9xkqOexeEeSeBazpeuC4MQ" x="85" y="375"/>
|
||||
</children>
|
||||
<children xmi:type="notation:Shape" xmi:id="_9xlROuxeEeSeBazpeuC4MQ" type="2001" fontName="Sans">
|
||||
<children xmi:type="notation:DecorationNode" xmi:id="_9xlRPOxeEeSeBazpeuC4MQ" type="5001"/>
|
||||
<children xmi:type="notation:BasicCompartment" xmi:id="_9xlRPexeEeSeBazpeuC4MQ" type="7001">
|
||||
<styles xmi:type="notation:SortingStyle" xmi:id="_9xlRPuxeEeSeBazpeuC4MQ"/>
|
||||
<styles xmi:type="notation:FilteringStyle" xmi:id="_9xlRP-xeEeSeBazpeuC4MQ"/>
|
||||
</children>
|
||||
<children xmi:type="notation:BasicCompartment" xmi:id="_9xlRQOxeEeSeBazpeuC4MQ" type="7002">
|
||||
<styles xmi:type="notation:SortingStyle" xmi:id="_9xlRQexeEeSeBazpeuC4MQ"/>
|
||||
<styles xmi:type="notation:FilteringStyle" xmi:id="_9xlRQuxeEeSeBazpeuC4MQ"/>
|
||||
</children>
|
||||
<children xmi:type="notation:BasicCompartment" xmi:id="_9xlRQ-xeEeSeBazpeuC4MQ" type="7003">
|
||||
<styles xmi:type="notation:SortingStyle" xmi:id="_9xlRROxeEeSeBazpeuC4MQ"/>
|
||||
<styles xmi:type="notation:FilteringStyle" xmi:id="_9xlRRexeEeSeBazpeuC4MQ"/>
|
||||
</children>
|
||||
<element xmi:type="ecore:EClass" href="rulesengine.ecore#//RulePythonBody"/>
|
||||
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_9xlRO-xeEeSeBazpeuC4MQ" x="320" y="350"/>
|
||||
</children>
|
||||
<children xmi:type="notation:Shape" xmi:id="_yt0zYOxfEeSeBazpeuC4MQ" type="2001" fontName="Sans">
|
||||
<children xmi:type="notation:DecorationNode" xmi:id="_yt1acOxfEeSeBazpeuC4MQ" type="5001"/>
|
||||
<children xmi:type="notation:BasicCompartment" xmi:id="_yt1acexfEeSeBazpeuC4MQ" type="7001">
|
||||
<styles xmi:type="notation:SortingStyle" xmi:id="_yt1acuxfEeSeBazpeuC4MQ"/>
|
||||
<styles xmi:type="notation:FilteringStyle" xmi:id="_yt1ac-xfEeSeBazpeuC4MQ"/>
|
||||
</children>
|
||||
<children xmi:type="notation:BasicCompartment" xmi:id="_yt1adOxfEeSeBazpeuC4MQ" type="7002">
|
||||
<styles xmi:type="notation:SortingStyle" xmi:id="_yt1adexfEeSeBazpeuC4MQ"/>
|
||||
<styles xmi:type="notation:FilteringStyle" xmi:id="_yt1aduxfEeSeBazpeuC4MQ"/>
|
||||
</children>
|
||||
<children xmi:type="notation:BasicCompartment" xmi:id="_yt1ad-xfEeSeBazpeuC4MQ" type="7003">
|
||||
<styles xmi:type="notation:SortingStyle" xmi:id="_yt1aeOxfEeSeBazpeuC4MQ"/>
|
||||
<styles xmi:type="notation:FilteringStyle" xmi:id="_yt1aeexfEeSeBazpeuC4MQ"/>
|
||||
</children>
|
||||
<element xmi:type="ecore:EClass" href="rulesengine.ecore#//RulesEngine"/>
|
||||
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_yt0zYexfEeSeBazpeuC4MQ" x="-55" y="115"/>
|
||||
</children>
|
||||
<styles xmi:type="notation:DiagramStyle" xmi:id="_9vHMAexeEeSeBazpeuC4MQ"/>
|
||||
<element xmi:type="ecore:EPackage" href="rulesengine.ecore#/"/>
|
||||
<edges xmi:type="notation:Connector" xmi:id="_9yG1oOxeEeSeBazpeuC4MQ" type="4003" source="_9xiN4OxeEeSeBazpeuC4MQ" target="_9xi0-uxeEeSeBazpeuC4MQ">
|
||||
<children xmi:type="notation:DecorationNode" xmi:id="_9yHcsOxeEeSeBazpeuC4MQ" type="6002">
|
||||
<layoutConstraint xmi:type="notation:Location" xmi:id="_9yHcsexeEeSeBazpeuC4MQ" x="56" y="-14"/>
|
||||
</children>
|
||||
<children xmi:type="notation:DecorationNode" xmi:id="_9yHcsuxeEeSeBazpeuC4MQ" type="6004">
|
||||
<layoutConstraint xmi:type="notation:Location" xmi:id="_9yHcs-xeEeSeBazpeuC4MQ" x="-7" y="11"/>
|
||||
</children>
|
||||
<styles xmi:type="notation:FontStyle" xmi:id="_9yG1oexeEeSeBazpeuC4MQ" fontName="Sans"/>
|
||||
<element xmi:type="ecore:EReference" href="rulesengine.ecore#//RulesUnit/rules"/>
|
||||
<bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_9yG1ouxeEeSeBazpeuC4MQ" points="[0, 0, 0, -60]$[0, 60, 0, 0]"/>
|
||||
</edges>
|
||||
<edges xmi:type="notation:Connector" xmi:id="_9yJR4OxeEeSeBazpeuC4MQ" type="4003" source="_9xiN4OxeEeSeBazpeuC4MQ" target="_9xkqIOxeEeSeBazpeuC4MQ">
|
||||
<children xmi:type="notation:DecorationNode" xmi:id="_9yJ48OxeEeSeBazpeuC4MQ" type="6002">
|
||||
<layoutConstraint xmi:type="notation:Location" xmi:id="_9yJ48exeEeSeBazpeuC4MQ" x="23" y="30"/>
|
||||
</children>
|
||||
<children xmi:type="notation:DecorationNode" xmi:id="_9yJ48uxeEeSeBazpeuC4MQ" type="6004">
|
||||
<layoutConstraint xmi:type="notation:Location" xmi:id="_9yJ48-xeEeSeBazpeuC4MQ" x="-13" y="-19"/>
|
||||
</children>
|
||||
<styles xmi:type="notation:FontStyle" xmi:id="_9yJR4exeEeSeBazpeuC4MQ" fontName="Sans"/>
|
||||
<element xmi:type="ecore:EReference" href="rulesengine.ecore#//RulesUnit/context"/>
|
||||
<bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_9yJR4uxeEeSeBazpeuC4MQ" points="[0, 0, 90, -60]$[-90, 60, 0, 0]"/>
|
||||
</edges>
|
||||
<edges xmi:type="notation:Connector" xmi:id="_9yMVMOxeEeSeBazpeuC4MQ" type="4003" source="_9xi0-uxeEeSeBazpeuC4MQ" target="_9xjcAOxeEeSeBazpeuC4MQ">
|
||||
<children xmi:type="notation:DecorationNode" xmi:id="_9yMVM-xeEeSeBazpeuC4MQ" type="6002">
|
||||
<layoutConstraint xmi:type="notation:Location" xmi:id="_9yMVNOxeEeSeBazpeuC4MQ" x="13" y="-12"/>
|
||||
</children>
|
||||
<children xmi:type="notation:DecorationNode" xmi:id="_9yMVNexeEeSeBazpeuC4MQ" type="6004">
|
||||
<layoutConstraint xmi:type="notation:Location" xmi:id="_9yMVNuxeEeSeBazpeuC4MQ" x="-15" y="13"/>
|
||||
</children>
|
||||
<styles xmi:type="notation:FontStyle" xmi:id="_9yMVMexeEeSeBazpeuC4MQ" fontName="Sans"/>
|
||||
<element xmi:type="ecore:EReference" href="rulesengine.ecore#//Rule/conditions"/>
|
||||
<bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_9yMVMuxeEeSeBazpeuC4MQ" points="[0, 0, 335, -60]$[-335, 60, 0, 0]"/>
|
||||
</edges>
|
||||
<edges xmi:type="notation:Connector" xmi:id="_9yQmoOxeEeSeBazpeuC4MQ" type="4003" source="_9xi0-uxeEeSeBazpeuC4MQ" target="_9xkqLOxeEeSeBazpeuC4MQ">
|
||||
<children xmi:type="notation:DecorationNode" xmi:id="_9yRNsOxeEeSeBazpeuC4MQ" type="6002">
|
||||
<layoutConstraint xmi:type="notation:Location" xmi:id="_9yRNsexeEeSeBazpeuC4MQ" x="21" y="22"/>
|
||||
</children>
|
||||
<children xmi:type="notation:DecorationNode" xmi:id="_9yRNsuxeEeSeBazpeuC4MQ" type="6004">
|
||||
<layoutConstraint xmi:type="notation:Location" xmi:id="_9yRNs-xeEeSeBazpeuC4MQ" x="-3" y="-20"/>
|
||||
</children>
|
||||
<styles xmi:type="notation:FontStyle" xmi:id="_9yQmoexeEeSeBazpeuC4MQ" fontName="Sans"/>
|
||||
<element xmi:type="ecore:EReference" href="rulesengine.ecore#//Rule/body"/>
|
||||
<bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_9yQmouxeEeSeBazpeuC4MQ" points="[0, 0, -51, -60]$[51, 60, 0, 0]"/>
|
||||
</edges>
|
||||
<edges xmi:type="notation:Connector" xmi:id="_9yTC4OxeEeSeBazpeuC4MQ" type="4004" source="_9xjcDOxeEeSeBazpeuC4MQ" target="_9xjcAOxeEeSeBazpeuC4MQ">
|
||||
<styles xmi:type="notation:FontStyle" xmi:id="_9yTC4exeEeSeBazpeuC4MQ" fontName="Sans"/>
|
||||
<element xsi:nil="true"/>
|
||||
<bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_9yTC4uxeEeSeBazpeuC4MQ" points="[-52, 0, 121, 30]$[-97, 0, 76, 30]$[-97, -30, 76, 0]$[-134, -30, 39, 0]"/>
|
||||
</edges>
|
||||
<edges xmi:type="notation:Connector" xmi:id="_9yURAOxeEeSeBazpeuC4MQ" type="4004" source="_9xkDEOxeEeSeBazpeuC4MQ" target="_9xjcAOxeEeSeBazpeuC4MQ">
|
||||
<styles xmi:type="notation:FontStyle" xmi:id="_9yURAexeEeSeBazpeuC4MQ" fontName="Sans"/>
|
||||
<element xsi:nil="true"/>
|
||||
<bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_9yURAuxeEeSeBazpeuC4MQ" points="[-53, -6, 121, -66]$[-98, -6, 76, -66]$[-98, 60, 76, 0]$[-135, 60, 39, 0]"/>
|
||||
</edges>
|
||||
<edges xmi:type="notation:Connector" xmi:id="_9yVfIOxeEeSeBazpeuC4MQ" type="4004" source="_9xkDHOxeEeSeBazpeuC4MQ" target="_9xjcAOxeEeSeBazpeuC4MQ">
|
||||
<styles xmi:type="notation:FontStyle" xmi:id="_9yVfIexeEeSeBazpeuC4MQ" fontName="Sans"/>
|
||||
<element xsi:nil="true"/>
|
||||
<bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_9yVfIuxeEeSeBazpeuC4MQ" points="[-61, 0, 126, 120]$[-111, 0, 76, 120]$[-111, -120, 76, 0]$[-148, -120, 39, 0]"/>
|
||||
</edges>
|
||||
<edges xmi:type="notation:Connector" xmi:id="_9yWtQOxeEeSeBazpeuC4MQ" type="4004" source="_9xkqOOxeEeSeBazpeuC4MQ" target="_9xkqIOxeEeSeBazpeuC4MQ">
|
||||
<styles xmi:type="notation:FontStyle" xmi:id="_9yWtQexeEeSeBazpeuC4MQ" fontName="Sans"/>
|
||||
<element xsi:nil="true"/>
|
||||
<bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_9yWtQuxeEeSeBazpeuC4MQ" points="[0, 0, 0, -60]$[0, 60, 0, 0]"/>
|
||||
</edges>
|
||||
<edges xmi:type="notation:Connector" xmi:id="_9yXUUOxeEeSeBazpeuC4MQ" type="4004" source="_9xlROuxeEeSeBazpeuC4MQ" target="_9xkqLOxeEeSeBazpeuC4MQ">
|
||||
<styles xmi:type="notation:FontStyle" xmi:id="_9yXUUexeEeSeBazpeuC4MQ" fontName="Sans"/>
|
||||
<element xsi:nil="true"/>
|
||||
<bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_9yXUUuxeEeSeBazpeuC4MQ" points="[0, 0, 58, -60]$[-58, 60, 0, 0]"/>
|
||||
</edges>
|
||||
<edges xmi:type="notation:Connector" xmi:id="_1U_p8OxfEeSeBazpeuC4MQ" type="4003" source="_yt0zYOxfEeSeBazpeuC4MQ" target="_9xiN4OxeEeSeBazpeuC4MQ">
|
||||
<children xmi:type="notation:DecorationNode" xmi:id="_1U_p8-xfEeSeBazpeuC4MQ" type="6002">
|
||||
<layoutConstraint xmi:type="notation:Location" xmi:id="_1U_p9OxfEeSeBazpeuC4MQ" x="10" y="-14"/>
|
||||
</children>
|
||||
<children xmi:type="notation:DecorationNode" xmi:id="_1U_p9exfEeSeBazpeuC4MQ" type="6004">
|
||||
<layoutConstraint xmi:type="notation:Location" xmi:id="_1U_p9uxfEeSeBazpeuC4MQ" x="-9" y="11"/>
|
||||
</children>
|
||||
<styles xmi:type="notation:FontStyle" xmi:id="_1U_p8exfEeSeBazpeuC4MQ" fontName="Sans"/>
|
||||
<element xmi:type="ecore:EReference" href="rulesengine.ecore#//RulesEngine/units"/>
|
||||
<bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_1U_p8uxfEeSeBazpeuC4MQ" points="[48, 8, -98, 8]$[137, 26, -9, 26]"/>
|
||||
</edges>
|
||||
</notation:Diagram>
|
||||
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0"?>
|
||||
<package>
|
||||
<name>hos_cosgi_rulesengine</name>
|
||||
<version>0.0.0</version>
|
||||
<description>The hos_cosgi_rulesengine 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_rulesengine</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>
|
||||
<build_depend>hos_cosgi_core</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_libvariant</build_depend>
|
||||
<build_depend>roscpp</build_depend>
|
||||
<run_depend>hos_celix</run_depend>
|
||||
<run_depend>hos_cosgi_core</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_libvariant</run_depend>
|
||||
<run_depend>roscpp</run_depend>
|
||||
|
||||
|
||||
<!-- The export tag contains other, unspecified, tags -->
|
||||
<export>
|
||||
<!-- Other tools can request additional information be placed here -->
|
||||
|
||||
</export>
|
||||
</package>
|
||||
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* bundle_activator.cpp
|
||||
*
|
||||
* Created on: 26.04.2015
|
||||
* Author: matzman
|
||||
*/
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
|
||||
#include <apr_general.h>
|
||||
|
||||
#include "ros/ros.h"
|
||||
|
||||
extern "C" {
|
||||
#include "hos_celix/bundle_activator.h"
|
||||
#include "hos_celix/bundle_context.h"
|
||||
}
|
||||
|
||||
#include <hos_cosgi_launcher/hos_core_service.h>
|
||||
#include "hos_rulesengine_service_impl.h"
|
||||
|
||||
using namespace hos::cosgi;
|
||||
|
||||
|
||||
|
||||
struct UserData {
|
||||
apr_pool_t* memoryPool = nullptr;
|
||||
hos::cosgi::HOSRulesEngineServiceImpl* serviceImpl = nullptr;
|
||||
service_registration_pt serviceReg = nullptr;
|
||||
};
|
||||
|
||||
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("RulesEngineService: Could not create APR memory pool (%i).", astatus);
|
||||
} else {
|
||||
// Create user data
|
||||
UserData* myUserData = (UserData*)apr_palloc(memoryPool, sizeof(UserData));
|
||||
if (myUserData != nullptr) {
|
||||
myUserData->memoryPool = memoryPool;
|
||||
*userData = (void*)myUserData;
|
||||
status = CELIX_SUCCESS;
|
||||
ROS_INFO("RulesEngineService: Bundle successfully created");
|
||||
} else {
|
||||
ROS_ERROR("RulesEngineService: Could not create user data struct");
|
||||
apr_pool_destroy(memoryPool);
|
||||
}
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
|
||||
celix_status_t status = CELIX_START_ERROR;
|
||||
if (userData != nullptr) {
|
||||
UserData* myUserData = (UserData*)userData;
|
||||
// Get HOS Core Service
|
||||
service_reference_pt ref = nullptr;
|
||||
bundleContext_getServiceReference(context, (char*)HOSCoreService::SERVICE_NAME, &ref);
|
||||
hos::cosgi::HOSCoreService* coreService = nullptr;
|
||||
bundleContext_getService(context, ref, (void**)&coreService);
|
||||
if (coreService == nullptr) {
|
||||
ROS_ERROR("RulesEngineService: Could not retrieve HOSCoreService.");
|
||||
} else {
|
||||
int major = 0, minor = 0;
|
||||
coreService->getServiceVersion(major, minor);
|
||||
ROS_INFO_STREAM("RulesEngineService: Found HOSCoreService Version " << major << "." << minor);
|
||||
// Get HOS DeviceRepository Service
|
||||
service_reference_pt ref2 = nullptr;
|
||||
bundleContext_getServiceReference(context, (char*)HOSDeviceRepositoryService::SERVICE_NAME, &ref2);
|
||||
hos::cosgi::HOSDeviceRepositoryService* repoService = nullptr;
|
||||
bundleContext_getService(context, ref2, (void**)&repoService);
|
||||
if (repoService == nullptr) {
|
||||
ROS_ERROR("RulesEngineService: Could not retrieve HOSDeviceRepositoryService.");
|
||||
} else {
|
||||
int major2 = 0, minor2 = 0;
|
||||
repoService->getServiceVersion(major2, minor2);
|
||||
ROS_INFO_STREAM("RulesEngineService: Found HOSDeviceRepositoryService Version " << major2 << "." << minor2);
|
||||
// Create and register hos-devicerepository-service
|
||||
if (myUserData->serviceReg != nullptr) {
|
||||
serviceRegistration_unregister(myUserData->serviceReg);
|
||||
}
|
||||
if (myUserData->serviceImpl != nullptr) {
|
||||
delete myUserData->serviceImpl;
|
||||
}
|
||||
myUserData->serviceImpl = new hos::cosgi::HOSRulesEngineServiceImpl(*coreService, *repoService);
|
||||
bundleContext_registerService(context, (char*)hos::cosgi::HOSRulesEngineServiceImpl::SERVICE_NAME, &myUserData->serviceImpl, nullptr, &myUserData->serviceReg);
|
||||
status = CELIX_SUCCESS;
|
||||
ROS_INFO("RulesEngineService: Bundle successfully started");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ROS_ERROR("RulesEngineService: Could not start bundle, user data struct is null");
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
|
||||
celix_status_t status = CELIX_ILLEGAL_STATE;
|
||||
if (userData != nullptr) {
|
||||
UserData* myUserData = (UserData*)userData;
|
||||
if (myUserData->serviceReg != nullptr) {
|
||||
serviceRegistration_unregister(myUserData->serviceReg);
|
||||
myUserData->serviceReg = nullptr;
|
||||
}
|
||||
if (myUserData->serviceImpl != nullptr) {
|
||||
delete myUserData->serviceImpl;
|
||||
myUserData->serviceImpl = nullptr;
|
||||
}
|
||||
ROS_INFO("RulesEngineService: Bundle successfully stopped");
|
||||
status = CELIX_SUCCESS;
|
||||
} else {
|
||||
ROS_ERROR("RulesEngineService: Could not stop bundle, user data struct is null");
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
|
||||
celix_status_t status = CELIX_ILLEGAL_STATE;
|
||||
if (userData != nullptr) {
|
||||
apr_pool_t* memoryPool = ((UserData*)userData)->memoryPool;
|
||||
if (memoryPool != nullptr) {
|
||||
apr_pool_destroy(memoryPool);
|
||||
ROS_INFO("RulesEngineService: Bundle successfully destroyed");
|
||||
} else {
|
||||
ROS_ERROR("RulesEngineService: Could not destroy bundle, there is no APR memory pool");
|
||||
}
|
||||
status = CELIX_SUCCESS;
|
||||
} else {
|
||||
ROS_ERROR("RulesEngineService: Could not destroy bundle, user data struct is null");
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* hos_rulesengine_service_impl.cpp
|
||||
*
|
||||
* Created on: 26.04.2015
|
||||
* Author: matzman
|
||||
*/
|
||||
|
||||
#include "hos_rulesengine_service_impl.h"
|
||||
#include <hos_cosgi_launcher/hos_core_service.h>
|
||||
#include <hos_cosgi_devicerepository/hos_devicerepository_service.h>
|
||||
#include <ros/ros.h>
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
#include <unordered_set>
|
||||
|
||||
|
||||
namespace hos {
|
||||
namespace cosgi {
|
||||
|
||||
HOSRulesEngineServiceImpl::HOSRulesEngineServiceImpl(HOSCoreService& coreService, HOSDeviceRepositoryService& repoService)
|
||||
: coreService(coreService), repoService(repoService), nodehandle(coreService.getPrivateNodeHandle()) {
|
||||
this->repoService.addObserver(*this);
|
||||
}
|
||||
|
||||
HOSRulesEngineServiceImpl::~HOSRulesEngineServiceImpl() {
|
||||
repoService.deleteObserver(*this);
|
||||
}
|
||||
|
||||
|
||||
void HOSRulesEngineServiceImpl::getServiceVersion(int& major, int& minor) {
|
||||
major = SERVICE_VERSION_MAJOR;
|
||||
minor = SERVICE_VERSION_MINOR;
|
||||
}
|
||||
|
||||
|
||||
void HOSRulesEngineServiceImpl::notificationReceived(IObservable<DeviceEvent>& o, const DeviceEvent* e) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
} // namespace cosgi
|
||||
} // namespace hos
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* hos_rulesengine_service_impl.h
|
||||
*
|
||||
* Created on: 26.04.2015
|
||||
* Author: matzman
|
||||
*/
|
||||
|
||||
#ifndef INCLUDE_HOS_COSGI_RULESENGINE_HOS_RULESENGINE_SERVICE_IMPL_H_
|
||||
#define INCLUDE_HOS_COSGI_RULESENGINE_HOS_RULESENGINE_SERVICE_IMPL_H_
|
||||
|
||||
#include <Variant/Variant.h>
|
||||
#include <hos_cosgi_rulesengine/hos_rulesengine_service.h>
|
||||
#include <hos_cosgi_devicerepository/hos_devicerepository_service.h>
|
||||
#include <mutex>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <hos_core_msgs/DeviceCommand.h>
|
||||
#include <hos_core_msgs/DeviceStatusUpdate.h>
|
||||
#include <hos_core_msgs/HosStatusUpdate.h>
|
||||
#include <hos_cpp_common/observable_impl.h>
|
||||
|
||||
|
||||
namespace XmlRpc {
|
||||
class XmlRpcValue;
|
||||
}
|
||||
|
||||
#include <ros/ros.h>
|
||||
|
||||
namespace hos {
|
||||
namespace cosgi {
|
||||
|
||||
class HOSCoreService;
|
||||
|
||||
|
||||
class HOSRulesEngineServiceImpl : public HOSRulesEngineService, public common::IObserver<DeviceEvent> {
|
||||
OBSERVABLE_IMPL(RulesEngineEvent)
|
||||
private:
|
||||
HOSCoreService& coreService;
|
||||
HOSDeviceRepositoryService& repoService;
|
||||
ros::NodeHandle& nodehandle;
|
||||
|
||||
public:
|
||||
HOSRulesEngineServiceImpl(HOSCoreService& coreService, HOSDeviceRepositoryService& repoService);
|
||||
~HOSRulesEngineServiceImpl();
|
||||
|
||||
virtual void notificationReceived(IObservable<DeviceEvent>& o, const DeviceEvent* e);
|
||||
|
||||
virtual const char* getServiceName() { return SERVICE_NAME; }
|
||||
virtual void getServiceVersion(int& major, int& minor);
|
||||
};
|
||||
|
||||
|
||||
} // namespace cosgi
|
||||
} // namespace hos
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* INCLUDE_HOS_COSGI_RULESENGINE_HOS_RULESENGINE_SERVICE_IMPL_H_ */
|
||||
@@ -0,0 +1,156 @@
|
||||
cmake_minimum_required(VERSION 2.8.3)
|
||||
project(hos_cpp_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)
|
||||
|
||||
## 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_cpp_common
|
||||
# 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_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 ##
|
||||
#############
|
||||
|
||||
# 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}
|
||||
# )
|
||||
|
||||
#############
|
||||
## 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()
|
||||
|
||||
## Add folders to be run by python nosetests
|
||||
# catkin_add_nosetests(test)
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* observable.h
|
||||
*
|
||||
* Created on: 25.04.2015
|
||||
* Author: matzman
|
||||
*/
|
||||
|
||||
#ifndef INCLUDE_HOS_CPP_COMMON_OBSERVABLE_H_
|
||||
#define INCLUDE_HOS_CPP_COMMON_OBSERVABLE_H_
|
||||
|
||||
|
||||
namespace hos {
|
||||
namespace common {
|
||||
|
||||
|
||||
template<class Event> class IObservable;
|
||||
|
||||
|
||||
template<class Event>
|
||||
class IObserver {
|
||||
public:
|
||||
virtual ~IObserver() {}
|
||||
virtual void notificationReceived(IObservable<Event>& o, const Event* e) = 0;
|
||||
};
|
||||
|
||||
|
||||
template<class Event>
|
||||
class IObservable {
|
||||
public:
|
||||
virtual ~IObservable() {}
|
||||
virtual void addObserver(IObserver<Event>& o) = 0;
|
||||
virtual void deleteObserver(IObserver<Event>& o) = 0;
|
||||
virtual void deleteObservers() = 0;
|
||||
virtual size_t countObservers() = 0;
|
||||
virtual void notifyObservers(const Event* e = nullptr) = 0;
|
||||
};
|
||||
|
||||
|
||||
} // namespace common
|
||||
} // namespace hos
|
||||
|
||||
|
||||
#endif /* INCLUDE_HOS_CPP_COMMON_OBSERVABLE_H_ */
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* observable_impl.h
|
||||
*
|
||||
* Created on: 25.04.2015
|
||||
* Author: matzman
|
||||
*/
|
||||
|
||||
#ifndef INCLUDE_HOS_CPP_COMMON_OBSERVABLE_IMPL_H_
|
||||
#define INCLUDE_HOS_CPP_COMMON_OBSERVABLE_IMPL_H_
|
||||
|
||||
#include "observable.h"
|
||||
#include <unordered_set>
|
||||
#include <mutex>
|
||||
|
||||
|
||||
namespace hos {
|
||||
namespace common {
|
||||
|
||||
#define OBSERVABLE_IMPL(Event) \
|
||||
protected: \
|
||||
std::mutex __listenersLock; \
|
||||
std::unordered_set<hos::common::IObserver<Event>*> __listeners; \
|
||||
public: \
|
||||
virtual void addObserver(hos::common::IObserver<Event>& o) { \
|
||||
std::lock_guard<std::mutex> lock(__listenersLock); \
|
||||
auto elem = __listeners.find(&o); \
|
||||
if (elem == __listeners.end()) { \
|
||||
__listeners.insert(&o); \
|
||||
} \
|
||||
} \
|
||||
virtual void deleteObserver(hos::common::IObserver<Event>& o) { \
|
||||
std::lock_guard<std::mutex> lock(__listenersLock); \
|
||||
auto elem = __listeners.find(&o); \
|
||||
if (elem != __listeners.end()) { \
|
||||
__listeners.erase(elem); \
|
||||
} \
|
||||
} \
|
||||
virtual void deleteObservers() { \
|
||||
std::lock_guard<std::mutex> lock(__listenersLock); \
|
||||
__listeners.clear(); \
|
||||
} \
|
||||
virtual size_t countObservers() { \
|
||||
return __listeners.size(); \
|
||||
} \
|
||||
virtual void notifyObservers(const Event* e = nullptr) { \
|
||||
std::lock_guard<std::mutex> lock(__listenersLock); \
|
||||
for (hos::common::IObserver<Event>* l : __listeners) { \
|
||||
l->notificationReceived(*this, e); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
template<class Event>
|
||||
class Observable : public IObservable<Event> {
|
||||
OBSERVABLE_IMPL(Event)
|
||||
public:
|
||||
virtual ~Observable() {}
|
||||
};
|
||||
|
||||
|
||||
} // namespace common
|
||||
} // namespace hos
|
||||
|
||||
#endif /* INCLUDE_HOS_CPP_COMMON_OBSERVABLE_IMPL_H_ */
|
||||
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0"?>
|
||||
<package>
|
||||
<name>hos_cpp_common</name>
|
||||
<version>0.0.0</version>
|
||||
<description>The hos_cpp_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_cpp_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>
|
||||
|
||||
|
||||
<!-- The export tag contains other, unspecified, tags -->
|
||||
<export>
|
||||
<!-- Other tools can request additional information be placed here -->
|
||||
|
||||
</export>
|
||||
</package>
|
||||
@@ -76,7 +76,7 @@ find_package(catkin REQUIRED)
|
||||
## CATKIN_DEPENDS: catkin_packages dependent projects also need
|
||||
## DEPENDS: system dependencies of this project that dependent projects also need
|
||||
catkin_package(
|
||||
INCLUDE_DIRS include
|
||||
INCLUDE_DIRS include/hos_libvariant
|
||||
LIBRARIES Variant
|
||||
# CATKIN_DEPENDS other_catkin_pkg
|
||||
# DEPENDS system_lib
|
||||
@@ -92,7 +92,7 @@ ExternalProject_Add( libvariant_project
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
CONFIGURE_COMMAND cmake ${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
-DCMAKE_INSTALL_PREFIX=${CATKIN_DEVEL_PREFIX}
|
||||
-DBUILD_SHARED_LIBS=FALSE
|
||||
-DBUILD_SHARED_LIBS=TRUE
|
||||
-DLIBVARIANT_BUILD_EXAMPLES=FALSE
|
||||
-DLIBVARIANT_BUILD_TESTS=FALSE
|
||||
-DLIBVARIANT_BUILD_WALL=TRUE
|
||||
@@ -104,8 +104,8 @@ ExternalProject_Add( libvariant_project
|
||||
INSTALL_COMMAND make install
|
||||
)
|
||||
|
||||
add_library( Variant STATIC IMPORTED )
|
||||
set_property( TARGET Variant PROPERTY IMPORTED_LOCATION "${CATKIN_DEVEL_PREFIX}/lib/libVariant.a")
|
||||
add_library( Variant SHARED IMPORTED )
|
||||
set_property( TARGET Variant PROPERTY IMPORTED_LOCATION "${CATKIN_DEVEL_PREFIX}/lib/libVariant.so")
|
||||
add_dependencies( Variant libvariant_project )
|
||||
|
||||
## Specify additional locations of header files
|
||||
|
||||
+1
-2
@@ -4,9 +4,8 @@
|
||||
*/
|
||||
#ifndef VARIANT_ARGPARSER_H
|
||||
#define VARIANT_ARGPARSER_H
|
||||
|
||||
#pragma once
|
||||
#include "../hos_libvariant/Variant.h"
|
||||
#include <Variant/Variant.h>
|
||||
#include <algorithm>
|
||||
#include <iosfwd>
|
||||
namespace libvariant {
|
||||
+1
-2
@@ -4,9 +4,8 @@
|
||||
*/
|
||||
#ifndef VARIANT_BLOB_H
|
||||
#define VARIANT_BLOB_H
|
||||
|
||||
#pragma once
|
||||
#include "../../../src/include/Variant/SharedPtr.h"
|
||||
#include <Variant/SharedPtr.h>
|
||||
#include <vector>
|
||||
#include <sys/uio.h>
|
||||
|
||||
+3
-4
@@ -20,15 +20,14 @@
|
||||
*/
|
||||
#ifndef VARIANT_EMITTER_H
|
||||
#define VARIANT_EMITTER_H
|
||||
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include "../../../src/include/Variant/Variant.h"
|
||||
#include "../../../src/include/Variant/Blob.h"
|
||||
#include "../../../src/include/Variant/EmitterOutput.h"
|
||||
#include <Variant/Variant.h>
|
||||
#include <Variant/Blob.h>
|
||||
#include <Variant/EmitterOutput.h>
|
||||
#include <iosfwd>
|
||||
#include <stdio.h>
|
||||
|
||||
+1
-2
@@ -20,11 +20,10 @@
|
||||
*/
|
||||
#ifndef VARIANT_EXCEPTIONS_H
|
||||
#define VARIANT_EXCEPTIONS_H
|
||||
#include <Variant/VariantDefines.h>
|
||||
#include <stdexcept>
|
||||
#include <iosfwd>
|
||||
#include <vector>
|
||||
|
||||
#include "../../../src/include/Variant/VariantDefines.h"
|
||||
namespace libvariant {
|
||||
|
||||
/// \brief Exception thrown when a key does not exist.
|
||||
+1
-1
@@ -22,7 +22,7 @@
|
||||
#ifndef VARIANT_EXTENSIONS_H
|
||||
#define VARIANT_EXTENSIONS_H
|
||||
|
||||
#include "../../../src/include/Variant/Variant.h"
|
||||
#include <Variant/Variant.h>
|
||||
|
||||
namespace libvariant {
|
||||
|
||||
+2
-3
@@ -4,10 +4,9 @@
|
||||
*/
|
||||
#ifndef VARIANT_GUESSFORMAT_H
|
||||
#define VARIANT_GUESSFORMAT_H
|
||||
|
||||
#pragma once
|
||||
#include "../../../src/include/Variant/Variant.h"
|
||||
#include "../../../src/include/Variant/Parser.h"
|
||||
#include <Variant/Variant.h>
|
||||
#include <Variant/Parser.h>
|
||||
namespace libvariant {
|
||||
|
||||
///
|
||||
+3
-4
@@ -4,13 +4,12 @@
|
||||
*/
|
||||
#ifndef VARIANT_PARSER_H
|
||||
#define VARIANT_PARSER_H
|
||||
|
||||
#pragma once
|
||||
#include <stdexcept>
|
||||
#include <stdint.h>
|
||||
#include "../../../src/include/Variant/Blob.h"
|
||||
#include "../../../src/include/Variant/ParserInput.h"
|
||||
#include "../../../src/include/Variant/Variant.h"
|
||||
#include <Variant/Blob.h>
|
||||
#include <Variant/ParserInput.h>
|
||||
#include <Variant/Variant.h>
|
||||
#include <deque>
|
||||
|
||||
namespace libvariant {
|
||||
+1
-2
@@ -20,11 +20,10 @@
|
||||
*/
|
||||
#ifndef VARIANT_PATH_H
|
||||
#define VARIANT_PATH_H
|
||||
|
||||
#pragma once
|
||||
#include <deque>
|
||||
#include <string>
|
||||
#include "../../../src/include/Variant/Exceptions.h"
|
||||
#include <Variant/Exceptions.h>
|
||||
namespace libvariant {
|
||||
|
||||
// A simple xpath like path functionality for Variant
|
||||
+3
-4
@@ -20,11 +20,10 @@
|
||||
*/
|
||||
#ifndef VARIANT_PAYLOAD_H
|
||||
#define VARIANT_PAYLOAD_H
|
||||
|
||||
#pragma once
|
||||
#include "../hos_libvariant/Variant.h"
|
||||
#include "../hos_libvariant/Emitter.h"
|
||||
#include "../hos_libvariant/Parser.h"
|
||||
#include <Variant/Variant.h>
|
||||
#include <Variant/Emitter.h>
|
||||
#include <Variant/Parser.h>
|
||||
namespace libvariant {
|
||||
|
||||
// Serialize and Deserialize a header, null byte, and a binary payload
|
||||
+1
-2
@@ -23,9 +23,8 @@
|
||||
*/
|
||||
#ifndef VARIANT_SCHEMA_H
|
||||
#define VARIANT_SCHEMA_H
|
||||
|
||||
#pragma once
|
||||
#include "../../../src/include/Variant/Variant.h"
|
||||
#include <Variant/Variant.h>
|
||||
#include <map>
|
||||
#include <iosfwd>
|
||||
#include <deque>
|
||||
+1
-2
@@ -20,10 +20,9 @@
|
||||
*/
|
||||
#ifndef VARIANT_SCHEMALOADER_H
|
||||
#define VARIANT_SCHEMALOADER_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../../../src/include/Variant/Schema.h"
|
||||
#include <Variant/Schema.h>
|
||||
|
||||
namespace libvariant {
|
||||
|
||||
+1
-2
@@ -4,9 +4,8 @@
|
||||
*/
|
||||
#ifndef VARIANT_SHAREDPTR_H
|
||||
#define VARIANT_SHAREDPTR_H
|
||||
|
||||
#pragma once
|
||||
#include "../hos_libvariant/Config.h"
|
||||
#include <Variant/Config.h>
|
||||
|
||||
#if defined(__GXX_EXPERIMENTAL_CXX0X) || __cplusplus >= 201103L || defined(HAVE_CXX11_SHAREDPTR)
|
||||
// The C++11 implementation is available
|
||||
+4
-5
@@ -24,12 +24,11 @@
|
||||
|
||||
#ifndef VARIANT_VARIANT_H
|
||||
#define VARIANT_VARIANT_H
|
||||
|
||||
#pragma once
|
||||
#include "../../../src/include/Variant/Blob.h"
|
||||
#include "../../../src/include/Variant/SharedPtr.h"
|
||||
#include "../../../src/include/Variant/Exceptions.h"
|
||||
#include "../../../src/include/Variant/VariantInternal.h"
|
||||
#include <Variant/Blob.h>
|
||||
#include <Variant/SharedPtr.h>
|
||||
#include <Variant/Exceptions.h>
|
||||
#include <Variant/VariantInternal.h>
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
+4
-5
@@ -20,15 +20,14 @@
|
||||
*/
|
||||
#ifndef VARIANT_BASE_H
|
||||
#define VARIANT_BASE_H
|
||||
#include <Variant/SharedPtr.h>
|
||||
#include <Variant/Blob.h>
|
||||
#include <Variant/Path.h>
|
||||
#include <Variant/VariantDefines.h>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "../hos_libvariant/Blob.h"
|
||||
#include "../hos_libvariant/Path.h"
|
||||
#include "../hos_libvariant/SharedPtr.h"
|
||||
#include "../hos_libvariant/VariantDefines.h"
|
||||
namespace libvariant {
|
||||
|
||||
struct RefTag {};
|
||||
@@ -3,10 +3,10 @@
|
||||
* \brief
|
||||
*/
|
||||
|
||||
#include <Variant/ArgParse.h>
|
||||
#include <Variant/Variant.h>
|
||||
#include <Variant/Schema.h>
|
||||
#include <iostream>
|
||||
#include "../../src/include/Variant/ArgParse.h"
|
||||
#include "../../src/include/Variant/Schema.h"
|
||||
#include "../../src/include/Variant/Variant.h"
|
||||
|
||||
using namespace libvariant;
|
||||
using namespace std;
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
* the json, yaml or xml formats and then write out
|
||||
* any of those formats.
|
||||
*/
|
||||
#include <Variant/Variant.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "../../src/include/Variant/Variant.h"
|
||||
|
||||
using namespace libvariant;
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
* \brief
|
||||
*/
|
||||
|
||||
#include <Variant/Variant.h>
|
||||
#include <stdio.h>
|
||||
#include "../../src/include/Variant/Variant.h"
|
||||
|
||||
// Import Variant from libvariant
|
||||
using libvariant::Variant;
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
* \brief
|
||||
*/
|
||||
|
||||
#include <Variant/Variant.h>
|
||||
#include <stdio.h>
|
||||
#include "../../src/include/Variant/Variant.h"
|
||||
|
||||
using libvariant::Variant;
|
||||
|
||||
|
||||
@@ -2,9 +2,8 @@
|
||||
* \author John Bridgman
|
||||
* \brief
|
||||
*/
|
||||
#include <Variant/Variant.h>
|
||||
#include <iostream>
|
||||
|
||||
#include "../../src/include/Variant/Variant.h"
|
||||
using libvariant::Variant;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
@@ -2,10 +2,9 @@
|
||||
* \author John Bridgman
|
||||
* \brief
|
||||
*/
|
||||
#include <Variant/Variant.h>
|
||||
#include <assert.h>
|
||||
#include <iostream>
|
||||
|
||||
#include "../../src/include/Variant/Variant.h"
|
||||
using libvariant::Variant;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
* \brief
|
||||
*/
|
||||
#include <iostream>
|
||||
#include <Variant/Variant.h>
|
||||
#include <string.h>
|
||||
#include "../../src/include/Variant/Variant.h"
|
||||
|
||||
using namespace libvariant;
|
||||
|
||||
|
||||
@@ -4,9 +4,8 @@
|
||||
*/
|
||||
#ifndef VARIANT_BLOB_H
|
||||
#define VARIANT_BLOB_H
|
||||
|
||||
#pragma once
|
||||
#include "../../../src/include/Variant/SharedPtr.h"
|
||||
#include <Variant/SharedPtr.h>
|
||||
#include <vector>
|
||||
#include <sys/uio.h>
|
||||
|
||||
|
||||
@@ -20,15 +20,14 @@
|
||||
*/
|
||||
#ifndef VARIANT_EMITTER_H
|
||||
#define VARIANT_EMITTER_H
|
||||
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include "../../../src/include/Variant/Variant.h"
|
||||
#include "../../../src/include/Variant/Blob.h"
|
||||
#include "../../../src/include/Variant/EmitterOutput.h"
|
||||
#include <Variant/Variant.h>
|
||||
#include <Variant/Blob.h>
|
||||
#include <Variant/EmitterOutput.h>
|
||||
#include <iosfwd>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
@@ -20,11 +20,10 @@
|
||||
*/
|
||||
#ifndef VARIANT_EXCEPTIONS_H
|
||||
#define VARIANT_EXCEPTIONS_H
|
||||
#include <Variant/VariantDefines.h>
|
||||
#include <stdexcept>
|
||||
#include <iosfwd>
|
||||
#include <vector>
|
||||
|
||||
#include "../../../src/include/Variant/VariantDefines.h"
|
||||
namespace libvariant {
|
||||
|
||||
/// \brief Exception thrown when a key does not exist.
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#ifndef VARIANT_EXTENSIONS_H
|
||||
#define VARIANT_EXTENSIONS_H
|
||||
|
||||
#include "../../../src/include/Variant/Variant.h"
|
||||
#include <Variant/Variant.h>
|
||||
|
||||
namespace libvariant {
|
||||
|
||||
|
||||
@@ -4,10 +4,9 @@
|
||||
*/
|
||||
#ifndef VARIANT_GUESSFORMAT_H
|
||||
#define VARIANT_GUESSFORMAT_H
|
||||
|
||||
#pragma once
|
||||
#include "../../../src/include/Variant/Variant.h"
|
||||
#include "../../../src/include/Variant/Parser.h"
|
||||
#include <Variant/Variant.h>
|
||||
#include <Variant/Parser.h>
|
||||
namespace libvariant {
|
||||
|
||||
///
|
||||
|
||||
@@ -4,13 +4,12 @@
|
||||
*/
|
||||
#ifndef VARIANT_PARSER_H
|
||||
#define VARIANT_PARSER_H
|
||||
|
||||
#pragma once
|
||||
#include <stdexcept>
|
||||
#include <stdint.h>
|
||||
#include "../../../src/include/Variant/Blob.h"
|
||||
#include "../../../src/include/Variant/ParserInput.h"
|
||||
#include "../../../src/include/Variant/Variant.h"
|
||||
#include <Variant/Blob.h>
|
||||
#include <Variant/ParserInput.h>
|
||||
#include <Variant/Variant.h>
|
||||
#include <deque>
|
||||
|
||||
namespace libvariant {
|
||||
|
||||
@@ -20,11 +20,10 @@
|
||||
*/
|
||||
#ifndef VARIANT_PATH_H
|
||||
#define VARIANT_PATH_H
|
||||
|
||||
#pragma once
|
||||
#include <deque>
|
||||
#include <string>
|
||||
#include "../../../src/include/Variant/Exceptions.h"
|
||||
#include <Variant/Exceptions.h>
|
||||
namespace libvariant {
|
||||
|
||||
// A simple xpath like path functionality for Variant
|
||||
|
||||
@@ -23,9 +23,8 @@
|
||||
*/
|
||||
#ifndef VARIANT_SCHEMA_H
|
||||
#define VARIANT_SCHEMA_H
|
||||
|
||||
#pragma once
|
||||
#include "../../../src/include/Variant/Variant.h"
|
||||
#include <Variant/Variant.h>
|
||||
#include <map>
|
||||
#include <iosfwd>
|
||||
#include <deque>
|
||||
|
||||
@@ -20,10 +20,9 @@
|
||||
*/
|
||||
#ifndef VARIANT_SCHEMALOADER_H
|
||||
#define VARIANT_SCHEMALOADER_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../../../src/include/Variant/Schema.h"
|
||||
#include <Variant/Schema.h>
|
||||
|
||||
namespace libvariant {
|
||||
|
||||
|
||||
@@ -4,9 +4,8 @@
|
||||
*/
|
||||
#ifndef VARIANT_SHAREDPTR_H
|
||||
#define VARIANT_SHAREDPTR_H
|
||||
|
||||
#pragma once
|
||||
#include "../../../include/hos_libvariant/Config.h"
|
||||
#include <Variant/Config.h>
|
||||
|
||||
#if defined(__GXX_EXPERIMENTAL_CXX0X) || __cplusplus >= 201103L || defined(HAVE_CXX11_SHAREDPTR)
|
||||
// The C++11 implementation is available
|
||||
|
||||
@@ -24,12 +24,11 @@
|
||||
|
||||
#ifndef VARIANT_VARIANT_H
|
||||
#define VARIANT_VARIANT_H
|
||||
|
||||
#pragma once
|
||||
#include "../../../src/include/Variant/Blob.h"
|
||||
#include "../../../src/include/Variant/SharedPtr.h"
|
||||
#include "../../../src/include/Variant/Exceptions.h"
|
||||
#include "../../../src/include/Variant/VariantInternal.h"
|
||||
#include <Variant/Blob.h>
|
||||
#include <Variant/SharedPtr.h>
|
||||
#include <Variant/Exceptions.h>
|
||||
#include <Variant/VariantInternal.h>
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -56,8 +56,6 @@ SOFTWARE.
|
||||
|
||||
|
||||
|
||||
#include "../../../src/lib/json/JSON_parser.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <float.h>
|
||||
@@ -67,6 +65,7 @@ SOFTWARE.
|
||||
#include <string.h>
|
||||
#include <locale.h>
|
||||
|
||||
#include "JSON_parser.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# if _MSC_VER >= 1400 /* Visual Studio 2005 and up */
|
||||
|
||||
@@ -3,8 +3,10 @@
|
||||
* \brief
|
||||
*/
|
||||
|
||||
#include "../../src/include/Variant/ArgParse.h"
|
||||
|
||||
#include <Variant/ArgParse.h>
|
||||
#include <Variant/Extensions.h>
|
||||
#include <Variant/Schema.h>
|
||||
#include <Variant/Path.h>
|
||||
#include <iostream>
|
||||
#include <string.h>
|
||||
#include <sstream>
|
||||
@@ -18,12 +20,8 @@
|
||||
#include <ctype.h>
|
||||
#include <libgen.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "../../src/include/Variant/Extensions.h"
|
||||
#include "../../src/include/Variant/Path.h"
|
||||
#include "../../src/include/Variant/Schema.h"
|
||||
#include "../../src/src/GuessScalar.h"
|
||||
#include "../../src/src/ParseBool.h"
|
||||
#include "GuessScalar.h"
|
||||
#include "ParseBool.h"
|
||||
|
||||
#if 0
|
||||
#define DBPRINT(x) std::cout << x
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
* \author John Bridgman
|
||||
* \brief
|
||||
*/
|
||||
#include "../../src/include/Variant/Blob.h"
|
||||
|
||||
#include <Variant/Blob.h>
|
||||
#include <stdlib.h>
|
||||
#include <new>
|
||||
#include <string.h>
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
* \author John Bridgman
|
||||
* \brief
|
||||
*/
|
||||
#include "../../src/src/BundleHdrEmitter.h"
|
||||
|
||||
#include "BundleHdrEmitter.h"
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <stdexcept>
|
||||
|
||||
@@ -4,10 +4,9 @@
|
||||
*/
|
||||
#ifndef VARIANT_BUNDLEHDREMITTER_H
|
||||
#define VARIANT_BUNDLEHDREMITTER_H
|
||||
|
||||
#pragma once
|
||||
#include "../../src/include/Variant/Emitter.h"
|
||||
#include "../../src/include/Variant/EmitterOutput.h"
|
||||
#include <Variant/Emitter.h>
|
||||
#include <Variant/EmitterOutput.h>
|
||||
#include <string.h>
|
||||
|
||||
namespace libvariant {
|
||||
|
||||
@@ -4,10 +4,9 @@
|
||||
*/
|
||||
#ifndef VARIANT_BUNDLEHDRPARSER_H
|
||||
#define VARIANT_BUNDLEHDRPARSER_H
|
||||
|
||||
#pragma once
|
||||
#include "../../src/include/Variant/Parser.h"
|
||||
#include "../../src/include/Variant/SharedPtr.h"
|
||||
#include <Variant/Parser.h>
|
||||
#include <Variant/SharedPtr.h>
|
||||
#include <deque>
|
||||
namespace libvariant {
|
||||
|
||||
|
||||
@@ -18,20 +18,19 @@
|
||||
* \author John Bridgman
|
||||
* \brief
|
||||
*/
|
||||
#include "../../src/include/Variant/Emitter.h"
|
||||
|
||||
#include "../../src/src/JSONEmitter.h"
|
||||
#include <Variant/Emitter.h>
|
||||
#include "JSONEmitter.h"
|
||||
#ifdef ENABLE_YAML
|
||||
#include "../../src/src/YAMLEmitter.h"
|
||||
#include "YAMLEmitter.h"
|
||||
#endif
|
||||
#ifdef ENABLE_XML
|
||||
#include "../../src/src/XMLPLISTEmitter.h"
|
||||
#include "XMLPLISTEmitter.h"
|
||||
#endif
|
||||
#ifdef ENABLE_MSGPACK
|
||||
#include "../../src/src/MsgPackEmitter.h"
|
||||
#include "MsgPackEmitter.h"
|
||||
#endif
|
||||
#include "../../src/src/BundleHdrEmitter.h"
|
||||
#include "../../src/include/Variant/EmitterOutput.h"
|
||||
#include "BundleHdrEmitter.h"
|
||||
#include <Variant/EmitterOutput.h>
|
||||
|
||||
namespace libvariant {
|
||||
EmitterImpl::~EmitterImpl() {}
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
* \brief
|
||||
*/
|
||||
|
||||
#include "../../src/include/Variant/EmitterOutput.h"
|
||||
|
||||
#include <Variant/EmitterOutput.h>
|
||||
#include <stdexcept>
|
||||
#include <streambuf>
|
||||
#include <sstream>
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
* \brief
|
||||
*/
|
||||
|
||||
#include "../../src/src/EventBuffer.h"
|
||||
|
||||
#include "EventBuffer.h"
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <ostream>
|
||||
|
||||
@@ -4,10 +4,9 @@
|
||||
*/
|
||||
#ifndef VARIANT_EVENTBUFFER_H
|
||||
#define VARIANT_EVENTBUFFER_H
|
||||
|
||||
#pragma once
|
||||
#include "../../src/include/Variant/Emitter.h"
|
||||
#include "../../src/include/Variant/Parser.h"
|
||||
#include <Variant/Emitter.h>
|
||||
#include <Variant/Parser.h>
|
||||
#include <deque>
|
||||
#include <iosfwd>
|
||||
namespace libvariant {
|
||||
|
||||
@@ -18,11 +18,9 @@
|
||||
* \author John Bridgman
|
||||
* \brief
|
||||
*/
|
||||
#include "../../src/include/Variant/Exceptions.h"
|
||||
|
||||
#include <Variant/Exceptions.h>
|
||||
#include <sstream>
|
||||
|
||||
#include "../../src/src/StackTrace.h"
|
||||
#include "StackTrace.h"
|
||||
|
||||
namespace libvariant {
|
||||
|
||||
|
||||
@@ -19,15 +19,14 @@
|
||||
* \brief Useful extension functions for Variants
|
||||
*/
|
||||
|
||||
#include "../../src/include/Variant/Extensions.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <Variant/Variant.h>
|
||||
#include <Variant/Extensions.h>
|
||||
#include <Variant/Path.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <set>
|
||||
#include "../../src/include/Variant/Path.h"
|
||||
#include "../../src/include/Variant/Variant.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
* \author John Bridgman
|
||||
* \brief
|
||||
*/
|
||||
#include "../../src/include/Variant/GuessFormat.h"
|
||||
|
||||
#include <Variant/GuessFormat.h>
|
||||
#include <ctype.h>
|
||||
|
||||
namespace libvariant {
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
* \author John Bridgman
|
||||
* \brief
|
||||
*/
|
||||
#include "../../src/src/GuessScalar.h"
|
||||
|
||||
#include "GuessScalar.h"
|
||||
#include <stdlib.h>
|
||||
#include <regex.h>
|
||||
#include <errno.h>
|
||||
|
||||
@@ -4,9 +4,8 @@
|
||||
*/
|
||||
#ifndef VARIANT_GUESSSCALAR_H
|
||||
#define VARIANT_GUESSSCALAR_H
|
||||
|
||||
#pragma once
|
||||
#include "../../src/include/Variant/Parser.h"
|
||||
#include <Variant/Parser.h>
|
||||
namespace libvariant {
|
||||
void GuessScalar(const char *value, unsigned length, const char *anchor, const char *tag,
|
||||
ParserImpl *p, ParserActions *action);
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
// World Wide Web at http://www.fsf.org.
|
||||
//=============================================================================
|
||||
|
||||
#include "../../src/src/JSONEmitter.h"
|
||||
|
||||
#include "JSONEmitter.h"
|
||||
#include <Variant/EmitterOutput.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdexcept>
|
||||
@@ -25,10 +25,8 @@
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
#include <cmath>
|
||||
|
||||
#include "../../src/include/Variant/EmitterOutput.h"
|
||||
#include "../../src/src/Base64.h"
|
||||
#include "../../src/src/BlobMagic.h"
|
||||
#include "Base64.h"
|
||||
#include "BlobMagic.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
@@ -20,13 +20,12 @@
|
||||
*/
|
||||
#ifndef VARIANT_JSONEMITTER_H
|
||||
#define VARIANT_JSONEMITTER_H
|
||||
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <deque>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include "../../src/include/Variant/Emitter.h"
|
||||
#include <Variant/Emitter.h>
|
||||
|
||||
namespace libvariant {
|
||||
|
||||
|
||||
@@ -17,9 +17,8 @@
|
||||
/** \file
|
||||
* \author John Bridgman
|
||||
*/
|
||||
#include "../../src/src/JSONParser.h"
|
||||
|
||||
#include "../../src/src/BlobMagic.h"
|
||||
#include "JSONParser.h"
|
||||
#include "BlobMagic.h"
|
||||
|
||||
namespace libvariant {
|
||||
|
||||
|
||||
@@ -3,9 +3,8 @@
|
||||
* \brief
|
||||
*/
|
||||
|
||||
#include "../../src/src/MsgPackEmitter.h"
|
||||
|
||||
#include "../../src/src/BlobMagic.h"
|
||||
#include "MsgPackEmitter.h"
|
||||
#include "BlobMagic.h"
|
||||
|
||||
static void msgpack_pack_string(msgpack_packer *packer, const char *str, unsigned len) {
|
||||
msgpack_pack_raw(packer, len);
|
||||
|
||||
@@ -4,14 +4,13 @@
|
||||
*/
|
||||
#ifndef VARIANT_MSGPACK_H
|
||||
#define VARIANT_MSGPACK_H
|
||||
|
||||
#pragma once
|
||||
#include "../../src/include/Variant/Variant.h"
|
||||
#include "../../src/include/Variant/EmitterOutput.h"
|
||||
#include "../../src/include/Variant/ParserInput.h"
|
||||
#include "../../src/include/Variant/Parser.h"
|
||||
#include "../../src/include/Variant/Emitter.h"
|
||||
#include "../../src/src/EventBuffer.h"
|
||||
#include <Variant/Variant.h>
|
||||
#include <Variant/EmitterOutput.h>
|
||||
#include <Variant/ParserInput.h>
|
||||
#include <Variant/Parser.h>
|
||||
#include <Variant/Emitter.h>
|
||||
#include "EventBuffer.h"
|
||||
#include <msgpack.h>
|
||||
namespace libvariant {
|
||||
|
||||
|
||||
@@ -3,11 +3,10 @@
|
||||
* \brief
|
||||
*/
|
||||
|
||||
#include "../../src/src/MsgPackParser.h"
|
||||
|
||||
#include "MsgPackParser.h"
|
||||
#include "BlobMagic.h"
|
||||
#include <msgpack/unpack_define.h>
|
||||
#include <sstream>
|
||||
#include "../../src/src/BlobMagic.h"
|
||||
|
||||
// vmpu = variant msg pack unpack
|
||||
|
||||
|
||||
@@ -5,10 +5,9 @@
|
||||
|
||||
#ifndef VARIANT_MSGPACKPARSER_H
|
||||
#define VARIANT_MSGPACKPARSER_H
|
||||
|
||||
#pragma once
|
||||
#include "../../src/include/Variant/ParserInput.h"
|
||||
#include "../../src/include/Variant/Parser.h"
|
||||
#include <Variant/ParserInput.h>
|
||||
#include <Variant/Parser.h>
|
||||
#include <msgpack.h>
|
||||
|
||||
struct vmpu_context;
|
||||
|
||||
@@ -17,8 +17,7 @@
|
||||
/** \file
|
||||
* \author John Bridgman
|
||||
*/
|
||||
#include "../../src/src/ParseBool.h"
|
||||
|
||||
#include "ParseBool.h"
|
||||
#include <ctype.h>
|
||||
|
||||
|
||||
|
||||
@@ -19,23 +19,21 @@
|
||||
* \brief
|
||||
*/
|
||||
|
||||
#include "../../src/include/Variant/Parser.h"
|
||||
|
||||
#include <Variant/Parser.h>
|
||||
#include <Variant/ParserInput.h>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "../../src/include/Variant/ParserInput.h"
|
||||
#include "../../src/src/JSONParser.h"
|
||||
#include "JSONParser.h"
|
||||
#ifdef ENABLE_YAML
|
||||
#include "../../src/src/YAMLParser.h"
|
||||
#include "YAMLParser.h"
|
||||
#endif
|
||||
#ifdef ENABLE_XML
|
||||
#include "../../src/src/XMLPLISTParser.h"
|
||||
#include "XMLPLISTParser.h"
|
||||
#endif
|
||||
#ifdef ENABLE_MSGPACK
|
||||
#include "../../src/src/MsgPackParser.h"
|
||||
#include "MsgPackParser.h"
|
||||
#endif
|
||||
#include "../../src/src/BundleHdrParser.h"
|
||||
#include "../../src/include/Variant/GuessFormat.h"
|
||||
#include "BundleHdrParser.h"
|
||||
#include <Variant/GuessFormat.h>
|
||||
namespace libvariant {
|
||||
|
||||
ParserActions::~ParserActions() {}
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
* \brief
|
||||
*/
|
||||
|
||||
#include "../../src/include/Variant/ParserInput.h"
|
||||
|
||||
#include <Variant/ParserInput.h>
|
||||
#include <stdexcept>
|
||||
#include <streambuf>
|
||||
#include <sstream>
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
* \author John Bridgman
|
||||
* \brief
|
||||
*/
|
||||
#include "../../src/include/Variant/Path.h"
|
||||
|
||||
#include <Variant/Path.h>
|
||||
#include <sstream>
|
||||
|
||||
namespace libvariant {
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
* \author John Bridgman
|
||||
* \brief
|
||||
*/
|
||||
#include "../../src/include/Variant/Payload.h"
|
||||
|
||||
#include <Variant/Payload.h>
|
||||
#include <Variant/Path.h>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <string.h>
|
||||
#include "../../src/include/Variant/Path.h"
|
||||
|
||||
#define PADDING_MOD 32
|
||||
|
||||
|
||||
@@ -21,9 +21,8 @@
|
||||
*/
|
||||
#ifndef VARIANT_XMLPLISTEMITTER_H
|
||||
#define VARIANT_XMLPLISTEMITTER_H
|
||||
|
||||
#pragma once
|
||||
#include "../../src/include/Variant/Emitter.h"
|
||||
#include <Variant/Emitter.h>
|
||||
#include <libxml/xmlwriter.h>
|
||||
#include <stdexcept>
|
||||
#include <deque>
|
||||
|
||||
@@ -20,13 +20,12 @@
|
||||
*/
|
||||
#ifndef VARIANT_XMLPLISTPARSER_H
|
||||
#define VARIANT_XMLPLISTPARSER_H
|
||||
|
||||
#pragma once
|
||||
#include <deque>
|
||||
#include <libxml/xmlreader.h>
|
||||
#include "../../src/include/Variant/Parser.h"
|
||||
#include "../../src/include/Variant/ParserInput.h"
|
||||
#include "../../src/include/Variant/SharedPtr.h"
|
||||
#include <Variant/Parser.h>
|
||||
#include <Variant/ParserInput.h>
|
||||
#include <Variant/SharedPtr.h>
|
||||
|
||||
|
||||
namespace libvariant {
|
||||
|
||||
@@ -22,14 +22,13 @@
|
||||
|
||||
#ifndef YAMLEMITTER_INC
|
||||
#define YAMLEMITTER_INC
|
||||
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
#include <memory>
|
||||
#include "../../src/include/Variant/Emitter.h"
|
||||
#include <Variant/Emitter.h>
|
||||
#include <yaml.h>
|
||||
#include <stdexcept>
|
||||
|
||||
|
||||
@@ -23,11 +23,10 @@
|
||||
|
||||
#ifndef YAMLPARSER_INC
|
||||
#define YAMLPARSER_INC
|
||||
|
||||
#pragma once
|
||||
#include "../../src/include/Variant/Parser.h"
|
||||
#include "../../src/include/Variant/ParserInput.h"
|
||||
#include "../../src/include/Variant/SharedPtr.h"
|
||||
#include <Variant/Parser.h>
|
||||
#include <Variant/ParserInput.h>
|
||||
#include <Variant/SharedPtr.h>
|
||||
#include <yaml.h>
|
||||
|
||||
namespace libvariant {
|
||||
|
||||
Regular → Executable
Regular → Executable
@@ -4,12 +4,11 @@
|
||||
*/
|
||||
#ifndef TESTCOMMON_H
|
||||
#define TESTCOMMON_H
|
||||
|
||||
#pragma once
|
||||
#include "../../src/src/EventBuffer.h"
|
||||
#include "../../src/include/Variant/Variant.h"
|
||||
#include "../../src/include/Variant/Parser.h"
|
||||
#include "../../src/include/Variant/Emitter.h"
|
||||
#include "EventBuffer.h"
|
||||
#include <Variant/Variant.h>
|
||||
#include <Variant/Parser.h>
|
||||
#include <Variant/Emitter.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user