From 17c598a8f0d0d57fc8fb7bd9eea42a161b071c2e Mon Sep 17 00:00:00 2001 From: hattori Date: Mon, 14 Jul 2014 13:42:27 +0000 Subject: [PATCH] =?UTF-8?q?OpenRTM1.1.1=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 5 +++- cmake_modules/FindOpenRTM.cmake | 3 +- hrplib/hrpRTM/SimulationExecutionContext.cpp | 31 +++++++++++++++++--- 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6efb2de3a..8879fc3ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -271,12 +271,15 @@ elseif( OPENRTM_VERSION STREQUAL OPENRTM_VERSION110 ) else() set(OPENHRP_RTM_IDL_DIR "${OpenHRP_SOURCE_DIR}/idl/OpenRTM/${OPENRTM_VERSION}") endif() + if( OPENRTM_VERSION STREQUAL OPENRTM_VERSION042 ) set(ADDITIONAL_SYMBOL "OPENRTM_VERSION_042") +elseif( OPENRTM_VERSION STREQUAL OPENRTM_VERSION100 OR OPENRTM_VERSION STREQUAL OPENRTM_VERSION110 ) + set(ADDITIONAL_SYMBOL "OPENRTM_VERSION110") endif() if(UNIX) - if(OPENRTM_VERSION STREQUAL OPENRTM_VERSION110) + if(OPENRTM_VERSION STREQUAL OPENRTM_VERSION110 OR OPENRTM_VERSION STREQUAL OPENRTM_VERSION111) set(OPENRTM_IDL_DIR "${OPENRTM_DIR}/include/openrtm-1.1/rtm/idl") else() set(OPENRTM_IDL_DIR "${OPENRTM_DIR}/include/rtm/idl") diff --git a/cmake_modules/FindOpenRTM.cmake b/cmake_modules/FindOpenRTM.cmake index be06ed4ec..a6bee0065 100644 --- a/cmake_modules/FindOpenRTM.cmake +++ b/cmake_modules/FindOpenRTM.cmake @@ -7,6 +7,7 @@ set(OPENRTM_VERSION100 "1.0.0") set(OPENRTM_VERSION101 "1.0.1") set(OPENRTM_VERSION102 "1.0.2") set(OPENRTM_VERSION110 "1.1.0") +set(OPENRTM_VERSION111 "1.1.1") set(OPENRTM_PKG_CONFIG_FOUND FALSE) #Additional threshold OpenRTM versions switching processing set(OPENRTM_DEFAULT_VERSION ${OPENRTM_VERSION100}) @@ -45,7 +46,7 @@ if(UNIX) if(RESULT EQUAL 0) if(OPENRTM_DIR) - if(OPENRTM_VERSION STREQUAL OPENRTM_VERSION110) + if(OPENRTM_VERSION STREQUAL OPENRTM_VERSION110 OR OPENRTM_VERSION STREQUAL OPENRTM_VERSION111) list(APPEND OPENRTM_INCLUDE_DIRS "${OPENRTM_DIR}/include/openrtm-1.1/rtm/idl") list(APPEND OPENRTM_INCLUDE_DIRS "${OPENRTM_DIR}/include/openrtm-1.1") list(APPEND OPENRTM_INCLUDE_DIRS "${OPENRTM_DIR}/include/coil-1.1") diff --git a/hrplib/hrpRTM/SimulationExecutionContext.cpp b/hrplib/hrpRTM/SimulationExecutionContext.cpp index 072ee1406..6aaf84594 100644 --- a/hrplib/hrpRTM/SimulationExecutionContext.cpp +++ b/hrplib/hrpRTM/SimulationExecutionContext.cpp @@ -1,4 +1,7 @@ #include +#if !defined(OPENRTM_VERSION042) && !defined(OPENRTM_VERSION110) +#include +#endif #include "SimulationExecutionContext.h" namespace RTC @@ -18,6 +21,7 @@ namespace RTC ReturnCode_t SimulationExecutionContext::stop() throw (CORBA::SystemException) { +#if defined(OPENRTM_VERSION042) || defined(OPENRTM_VERSION110) if (!m_running) return RTC::PRECONDITION_NOT_MET; OpenRTM::ExtTrigExecutionContextService_var extTrigExecContext = @@ -31,13 +35,22 @@ namespace RTC std::for_each(m_comps.begin(), m_comps.end(), invoke_on_shutdown()); // change EC thread state -#ifdef OPENRTM_VERSION_042 + #ifdef OPENRTM_VERSION_042 m_state = false; -#else + #else //m_running = false; m_svc = false; -#endif + #endif return RTC::RTC_OK; +#else + ReturnCode_t ret = OpenHRPExecutionContext::stop(); + if (ret == RTC_OK){ + OpenRTM::ExtTrigExecutionContextService_var extTrigExecContext = + OpenRTM::ExtTrigExecutionContextService::_narrow(this->getObjRef()); + m_cg->unsubscribe(extTrigExecContext); + } + return RTC::RTC_OK; +#endif } OpenHRP::ClockGenerator_var SimulationExecutionContext::m_cg; @@ -51,10 +64,20 @@ void SimulationECInit(RTC::Manager* manager) try{ CORBA::Object_ptr obj = cn.resolve("ClockGenerator"); RTC::SimulationExecutionContext::m_cg = OpenHRP::ClockGenerator::_narrow(obj); - + +#if defined(OPENRTM_VERSION042) || defined(OPENRTM_VERSION110) manager->registerECFactory("SimulationEC", RTC::ECCreate, RTC::ECDelete); +#else + RTC::ExecutionContextFactory:: + instance().addFactory("SimulationEC", + ::coil::Creator< ::RTC::ExecutionContextBase, + ::RTC::SimulationExecutionContext>, + ::coil::Destructor< ::RTC::ExecutionContextBase, + ::RTC::OpenHRPExecutionContext>); +#endif + }catch(RTC::CorbaNaming::NotFound& ex){ std::cerr << "SimultationExecutionContext: can not find ClockGenerator" << std::endl;