Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F99923591
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Jan 27, 07:31
Size
8 KB
Mime Type
text/x-diff
Expires
Wed, Jan 29, 07:31 (1 d, 4 h)
Engine
blob
Format
Raw Data
Handle
23873751
Attached To
R6622 liboncilla
View Options
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8c44898..a35191e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,143 +1,143 @@
PROJECT( liboncilla C CXX )
CMAKE_MINIMUM_REQUIRED( VERSION 2.6 )
SET( LIBNAME "oncilla" )
SET( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE )
SET( LIBONCILLA_CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake )
SET( CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE )
# CMake module path and modules
FIND_PACKAGE( RSC REQUIRED )
SET(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${RSC_CMAKE_MODULE_PATH}" )
MESSAGE( STATUS "RSC version: ${RSC_VERSION}" )
INCLUDE( CheckIncludeFileCXX )
INCLUDE( InstallFilesRecursive )
INCLUDE( EnableCoverageReport )
INCLUDE( EnableSlocCount )
INCLUDE( GenerateDoxygen )
INCLUDE( GenerateCppcheck )
INCLUDE( PedanticCompilerWarnings )
INCLUDE( SuperPedanticCompilerWarnings )
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# --- user options ---
OPTION(BUILD_TESTS "Decide whether unit-tests are built" ON)
OPTION(BUILD_EXAMPLES "Decide whether the examples are built" ON)
OPTION(BUILD_DOCS "Decide whether the docygen documentation is built" OFF)
# Dependencies
FIND_PACKAGE(Threads REQUIRED)
MESSAGE(STATUS "Threading library: ${CMAKE_THREAD_LIBS_INIT}")
FIND_PACKAGE(RCI REQUIRED)
MESSAGE(STATUS "RCI version: ${RCI_VERSION}")
ADD_DEFINITIONS(${RCI_DEFINITIONS})
# --- global definitions ---
SET(LIBONCILLA_NAME "${LIBNAME}")
SET(DRIVER_TEST_NAME "OncillaTest")
SET(NODE_TEST_NAME "${DRIVER_TEST_NAME}Nodes")
SET(LIBONCILLA_VERSION_MAJOR 0)
SET(LIBONCILLA_VERSION_MINOR 2)
-SET(LIBONCILLA_VERSION_PATCH 0)
+SET(LIBONCILLA_VERSION_PATCH 1)
SET(LIBONCILLA_VERSION_STRING "${LIBONCILLA_VERSION_MAJOR}.${LIBONCILLA_VERSION_MINOR}.${LIBONCILLA_VERSION_PATCH}")
SET(LIBONCILLA_VERSION_ABI "${LIBONCILLA_VERSION_MAJOR}.${LIBONCILLA_VERSION_MINOR}")
SET(LIBONCILLA_CMAKE_MODULE_PATH "share/cmake/Modules")
SET(OUTPUT_PATH ${PROJECT_BINARY_DIR}/build)
SET(ARCHIVE_OUTPUT_PATH ${OUTPUT_PATH})
SET(LIBRARY_OUTPUT_PATH ${OUTPUT_PATH})
SET(EXECUTABLE_OUTPUT_PATH ${OUTPUT_PATH})
# Includes
INCLUDE_DIRECTORIES(BEFORE src
${PROJECT_BINARY_DIR}/src)
INCLUDE_DIRECTORIES(SYSTEM
${RCI_INCLUDE_DIRS}
${RSC_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS})
ADD_SUBDIRECTORY(src)
IF(BUILD_TESTS)
ENABLE_TESTING()
INCLUDE(ProvideGoogleMock)
MESSAGE(STATUS "Building tests - deactivate by adapting BUILD_TESTS")
IF(GMOCK_AVAILABLE)
ADD_SUBDIRECTORY(test)
ELSE()
MESSAGE(WARNING "Could not build unit tests even though desired because Google Mock could not be installed.")
ENDIF()
ENDIF()
IF(BUILD_EXAMPLES)
ADD_SUBDIRECTORY(examples)
ENDIF()
# --- cmake config file ---
SET(LIB_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX})
IF(CMAKE_LINK_LIBRARY_SUFFIX)
SET(LIB_SUFFIX ${CMAKE_LINK_LIBRARY_SUFFIX})
ENDIF()
# --- pkgconfig file ---
SET(PKG_CONFIG_FILE lib${LIBONCILLA_NAME}-${LIBONCILLA_VERSION_MAJOR}.pc )
CONFIGURE_FILE(lib${LIBONCILLA_NAME}.pc.in ${PKG_CONFIG_FILE} @ONLY)
INSTALL(FILES ${CMAKE_BINARY_DIR}/${PKG_CONFIG_FILE} DESTINATION lib/pkgconfig)
# --- cmake config file ---
SET(LIB_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX})
IF(CMAKE_LINK_LIBRARY_SUFFIX)
SET(LIB_SUFFIX ${CMAKE_LINK_LIBRARY_SUFFIX})
ENDIF()
CONFIGURE_FILE(${CMAKE_PROJECT_NAME}Config.cmake.in ${CMAKE_PROJECT_NAME}Config.cmake @ONLY)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}Config.cmake DESTINATION share/lib${LIBNAME})
# --- documentation generation ---
IF(BUILD_DOCS)
ADD_SUBDIRECTORY(doc)
ENDIF(BUILD_DOCS)
# --- coverage ---
IF(BUILD_TESTS)
ENABLE_COVERAGE_REPORT(TARGETS ${LIBONCILLA_NAME} TESTS ${DTO_TEST_NAME} ${INTEGRATED_TEST_NAME} FILTER "*3rdparty*" "*test/*")
ENDIF(BUILD_TESTS)
# --- sloccount ---
ENABLE_SLOCCOUNT(FOLDERS src test examples)
# --- cppcheck ---
GENERATE_CPPCHECK(SOURCES src test examples
"${CMAKE_CURRENT_BINARY_DIR}/src" "${CMAKE_CURRENT_BINARY_DIR}/test" "${CMAKE_CURRENT_BINARY_DIR}/examples"
ENABLE_IDS style)
# --- package ---
INCLUDE(CheckLSBTypes)
SET(CPACK_PACKAGE_VERSION_MAJOR ${LIBONCILLA_VERSION_MAJOR})
SET(CPACK_PACKAGE_VERSION_MINOR ${LIBONCILLA_VERSION_MINOR})
SET(CPACK_PACKAGE_VERSION_PATCH ${LIBONCILLA_VERSION_PATCH})
SET(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
SET(CPACK_PACKAGE_FILE_NAME ${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION}_${LSB_CODENAME}_${LSB_PROCESSOR_ARCH})
SET(CPACK_GENERATOR "TGZ")
SET(CPACK_PACKAGE_VENDOR "CoR-Lab Bielefeld University")
# IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
# SET(CPACK_GENERATOR "${CPACK_GENERATOR};DEB")
# SET(CPACK_DEBIAN_PACKAGE_NAME "amarsi-liboncilla")
# SET(CPACK_DEBIAN_PACKAGE_VERSION ${LIBONCILLA_VERSION_MAJOR}.${LIBONCILLA_VERSION_MINOR}.${LIBONCILLA_VERSION_PATCH})
# SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Arne Nordmann (anordman@cor-lab.uni-bielefeld.de)")
# SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION "AMARSi RCI representations of the AMARSi quadruped robot 'Oncilla'.")
# SET(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
# SET(CPACK_DEBIAN_PACKAGE_SECTION "devel")
# SET(CPACK_DEBIAN_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
# SET(CPACK_DEBIAN_PACKAGE_DEPENDS "amarsi-rci-all")
# SET(CPACK_DEBIAN_PACKAGE_SUGGESTS "cmake, cmake-data, doxygen, lcov, cppcheck, sloccount")
# ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
INCLUDE(CPack)
diff --git a/src/liboncilla/BackendFactory.cpp b/src/liboncilla/BackendFactory.cpp
index e064a60..bda3e32 100644
--- a/src/liboncilla/BackendFactory.cpp
+++ b/src/liboncilla/BackendFactory.cpp
@@ -1,97 +1,100 @@
/**
* \file BackendFactory.cpp
*
* \date Jun 21, 2012
* \author Alexandre Tuleu
*/
#include "BackendFactory.h"
#include <dlfcn.h>
#include <stdexcept>
namespace rci {
namespace oncilla {
BackendFactory & BackendFactory::Instance(){
static BackendFactory * s_rci_oncilla_backend_factory = new BackendFactory();
return *s_rci_oncilla_backend_factory;
}
void BackendFactory::RegisterBackend(Priority p, EntryPtr e){
EntryByPriority::const_iterator fi = d_entries.find(p);
if(fi != d_entries.end()){
return;
}
d_entries.insert(std::make_pair(p,e));
}
BackendFactory::EntryPtr BackendFactory::HighestPriorityBackend(){
LoadExternalBackend();
EntryByPriority::const_reverse_iterator fi = d_entries.rbegin();
if (fi == d_entries.rend()){
return 0;
}
return fi->second;
}
void BackendFactory::LoadExternalBackend(){
for(SetOfBackendName::const_iterator n = d_unloaded.begin();
n != d_unloaded.end();
++n){
#ifndef NDEBUG
std::cerr << "Looking for module '" << *n << "' : " << std::flush;
#endif
char * error;
void * module_handle = dlopen(n->c_str(),RTLD_NOW);
if((error = dlerror()) != NULL ){
#ifndef NDEBUG
std::cerr << std::endl << " got an error : '" << error << "'" << std::endl;
+#else
+ std::cerr << "Got an error while trying to open module '" << *n
+ << "' : " << error << std::endl;
#endif
continue;
}
#ifndef NDEBUG
std::cerr << " found." << std::endl;
#endif
liboncilla_backend_entry_fct entry = (liboncilla_backend_entry_fct) dlsym(module_handle,"liboncilla_webots_backend_entry");
if((error = dlerror()) != NULL){
throw std::runtime_error("Could not find 'liboncilla_webots_backend_entry' symbol in '" + (*n) + "'.");
}
(*entry)();
d_loaded.insert(std::make_pair(*n,module_handle));
}
d_unloaded.clear();
}
void BackendFactory::AddAdditionalBackend(const std::string& name){
ListOfLoadedBackend::const_iterator fi = d_loaded.find(name);
if( fi != d_loaded.end()){
return;
}
d_unloaded.insert(name);
}
BackendFactory::BackendFactory(){
d_unloaded.insert("liboncilla-webots.so");
d_unloaded.insert("liboncilla-hw.so");
}
BackendFactory::~BackendFactory(){
for(ListOfLoadedBackend::iterator b = d_loaded.begin();
b != d_loaded.end();
++b) {
char * error;
dlclose(b->second);
if( (error = dlerror()) != NULL){
std::cerr << "Could not unload module '" << b->first << "' : "
<< std::endl
<< " error : '" << error << "'." << std::endl;
}
}
}
} /* namespace oncilla */
} /* namespace rci */
Event Timeline
Log In to Comment