Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/lib/coil/common/coil/Properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ namespace coil
: name(prop.name), value(prop.value),
default_value(prop.default_value), set_value(prop.set_value), root(nullptr), m_empty("")
{
std::vector<std::string> keys;
keys = prop.propertyNames();
const std::vector<std::string> keys(prop.propertyNames());
for (const auto & key : keys)
{
const Properties* node(nullptr);
Expand Down Expand Up @@ -121,8 +120,7 @@ namespace coil
default_value = prop.default_value;
set_value = prop.set_value;

std::vector<std::string> keys;
keys = prop.propertyNames();
const std::vector<std::string> keys(prop.propertyNames());
for (const auto & key : keys)
{
const Properties* node(prop.findNode(key));
Expand Down Expand Up @@ -569,8 +567,7 @@ namespace coil
*/
Properties& Properties::operator<<(const Properties& prop)
{
std::vector<std::string> keys;
keys = prop.propertyNames();
const std::vector<std::string> keys(prop.propertyNames());
for (size_t i(0), len(prop.size()); i < len; ++i)
{
(*this)[keys[i]] = prop[keys[i]];
Expand Down
3 changes: 2 additions & 1 deletion src/lib/rtm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,8 @@ else(VXWORKS)
if(CORBA MATCHES "RtORB")
add_library(${PROJECT_NAME}-static STATIC
$<TARGET_OBJECTS:${PROJECT_NAME}_objlib>
$<TARGET_OBJECTS:${COIL_PROJECT_NAME}_objlib>)
$<TARGET_OBJECTS:${COIL_PROJECT_NAME}_objlib>
${RTM_IDL_OBJECTS})
add_library(${PROJECT_NAME} SHARED
$<TARGET_OBJECTS:${PROJECT_NAME}_objlib>
$<TARGET_OBJECTS:${COIL_PROJECT_NAME}_objlib>)
Expand Down
4 changes: 4 additions & 0 deletions src/lib/rtm/CORBA_RTCUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,11 @@ namespace CORBA_RTCUtil
const RTC::PortService_ptr port1)
{
coil::Properties prop = prop_arg;
#ifndef ORB_IS_RTORB
RTC::ConnectorProfile_var conn_prof = new RTC::ConnectorProfile();
#else // ORB_IS_RTORB
RTC::ConnectorProfile_var conn_prof = RTC_ConnectorProfile__calloc();
#endif // ORB_IS_RTORB
std::string prof_name;
conn_prof->name = CORBA::string_dup(name.c_str());
conn_prof->connector_id = CORBA::string_dup("");
Expand Down
11 changes: 11 additions & 0 deletions src/lib/rtm/Manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1795,8 +1795,19 @@ namespace RTC
opt += "-ORBIIOPAddr " + endpoint;
}
}
else if (corba == "RtORB")
{
opt += " -ORBListenEndpoints " + endpoint;
std::vector<std::string> addr_port(coil::split(endpoint, ":"));
if(addr_port.size() > 1)
{
opt += " -ORBServerPort " + addr_port.back();
}
std::cerr << opt << std::endl;
}
else
{
std::cout << corba << std::endl;
}
}
}
Expand Down
20 changes: 15 additions & 5 deletions src/lib/rtm/NVUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,22 @@ namespace NVUtil
#ifndef ORB_IS_RTORB
void copyFromProperties(SDOPackage::NVList& nv, const coil::Properties& prop)
#else // ORB_IS_RTORB
void copyFromProperties(SDOPackage_NVList& nv, const coil::Properties& prop)
void copyFromProperties(SDOPackage_NVList& nv, const coil::Properties& prop)
#endif // ORB_IS_RTORB
{
std::vector<std::string> keys;
keys = prop.propertyNames();
const std::vector<std::string> keys(prop.propertyNames());
CORBA::ULong len(static_cast<CORBA::ULong>(keys.size()));
nv.length(len);

for (CORBA::ULong i = 0; i < len; ++i)
{
// Why RtORB does not copy string to Properties.
nv[i].name = CORBA::string_dup(keys[i].c_str());
#ifndef ORB_IS_RTORB
nv[i].value <<= prop[keys[i]].c_str();
#else // ORB_IS_RTORB
nv[i].value <<= CORBA::string_dup(prop[keys[i]].c_str());
#endif // ORB_IS_RTORB
}
}

Expand All @@ -127,8 +130,7 @@ namespace NVUtil
void mergeFromProperties(SDOPackage_NVList& nv, const coil::Properties& prop)
#endif // ORB_IS_RTORB
{
std::vector<std::string> keys;
keys = prop.propertyNames();
const std::vector<std::string> keys(prop.propertyNames());
#ifndef ORB_IS_RTORB
SDOPackage::NVList nve;
#else // ORB_IS_RTORB
Expand All @@ -153,7 +155,11 @@ namespace NVUtil
for (CORBA::ULong i = 0; i < ksize; ++i)
{
nv[i].name = CORBA::string_dup(keys[i].c_str());
#ifndef ORB_IS_RTORB
nv[i].value <<= prop[keys[i]].c_str();
#else // ORB_IS_RTORB
nv[i].value <<= CORBA::string_dup(prop[keys[i]].c_str());
#endif // ORB_IS_RTORB
}

for (CORBA::ULong i = 0; i < nsize; ++i)
Expand All @@ -178,7 +184,11 @@ namespace NVUtil
if (nv[i].value >>= value)
{
const char* name(nv[i].name);
#ifndef ORB_IS_RTORB
prop[name] = value;
#else // ORB_IS_RTORB
prop[std::string(name)] = std::string(value);
#endif // ORB_IS_RTORB
}
}
}
Expand Down
11 changes: 10 additions & 1 deletion src/lib/rtm/PortAdmin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ namespace RTC
PortProfile *pp;
pp = p->get_port_profile();
std::string name(pp->name);
delete pp;
#endif // ORB_IS_RTORB
return m_name == name;
}
Expand Down Expand Up @@ -121,7 +120,13 @@ namespace RTC
PortServiceList* PortAdmin::getPortServiceList() const
{
PortServiceList_var ports;
#ifndef ORB_IS_RTORB
ports = new PortServiceList(m_portRefs);
#else // ORB_IS_RTORB
RTC_PortServiceList* _ports = RTC_PortServiceList__calloc();
*_ports = m_portRefs;
ports = _ports;
#endif // ORB_IS_RTORB
return ports._retn();
}

Expand Down Expand Up @@ -151,7 +156,11 @@ namespace RTC
{
pp = m_portRefs[i]->get_port_profile();
port_profs[i] = *(pp);
#ifndef ORB_IS_RTORB
delete pp;
#else // ORB_IS_RTORB
RtORB_free_by_typecode_cpp(TC_RTC_PortProfile, pp, 0);
#endif // ORB_IS_RTORB
}
catch (...)
{
Expand Down
29 changes: 26 additions & 3 deletions src/lib/rtm/PortBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,13 @@ namespace RTC
updateConnectors();
std::lock_guard<std::mutex> guard(m_profile_mutex);
PortProfile_var prof;
#ifndef ORB_IS_RTORB
prof = new PortProfile(m_profile);
#else // ORB_IS_RTORB
PortProfile* _prof = RTC_PortProfile__calloc();
*_prof = m_profile;
prof = _prof;
#endif // ORB_IS_RTORB
return prof._retn();
}

Expand Down Expand Up @@ -134,7 +140,13 @@ namespace RTC

std::lock_guard<std::mutex> guard(m_profile_mutex);
ConnectorProfileList_var conn_prof;
#ifndef ORB_IS_RTORB
conn_prof = new ConnectorProfileList(m_profile.connector_profiles);
#else // ORB_IS_RTORB
RTC_ConnectorProfileList* _conn_prof = RTC_ConnectorProfileList__calloc();
*_conn_prof = m_profile.connector_profiles;
conn_prof = _conn_prof;
#endif // ORB_IS_RTORB
return conn_prof._retn();
}

Expand All @@ -157,11 +169,21 @@ namespace RTC
if (index < 0)
{
ConnectorProfile_var conn_prof;
#ifndef ORB_IS_RTORB
conn_prof = new ConnectorProfile();
#else // ORB_IS_RTORB
conn_prof = RTC_ConnectorProfile__calloc();
#endif // ORB_IS_RTORB
return conn_prof._retn();
}
ConnectorProfile_var conn_prof;
#ifndef ORB_IS_RTORB
conn_prof = new ConnectorProfile(m_profile.connector_profiles[index]);
#else // ORB_IS_RTORB
RTC_ConnectorProfile* _conn_prof = RTC_ConnectorProfile__calloc();
*_conn_prof = m_profile.connector_profiles[index];
conn_prof = _conn_prof;
#endif // ORB_IS_RTORB
return conn_prof._retn();
}

Expand Down Expand Up @@ -930,8 +952,10 @@ namespace RTC
}
}
#else // ORB_IS_RTORB
ConnectorProfileList* clist;
clist = new ConnectorProfileList(m_profile.connector_profiles);
ConnectorProfileList_var clist;
RTC_ConnectorProfileList* _clist = RTC_ConnectorProfileList__calloc();
*_clist = m_profile.connector_profiles;
clist = _clist;

for (CORBA::ULong i(0); i < clist->length(); ++i)
{
Expand All @@ -942,7 +966,6 @@ namespace RTC
RTC_WARN(("Dead connection: %s", id));
}
}
delete clist;
#endif // ORB_IS_RTORB
}

Expand Down
5 changes: 4 additions & 1 deletion src/lib/rtm/RTObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -654,9 +654,10 @@ namespace RTC
RTC_TRACE(("get_component_profile()"));
try
{
#ifndef ORB_IS_RTORB
ComponentProfile_var profile
= new ComponentProfile();
#ifndef ORB_IS_RTORB

profile->instance_name =
CORBA::string_dup(m_properties["instance_name"].c_str());
profile->type_name =
Expand All @@ -671,6 +672,8 @@ namespace RTC
CORBA::string_dup(m_properties["category"].c_str());
profile->port_profiles = m_portAdmin.getPortProfileList();
#else // ORB_IS_RTORB
ComponentProfile_var profile
= RTC_ComponentProfile__calloc();
profile->instance_name =
CORBA::string_dup(m_properties["instance_name"].c_str());
profile->type_name =
Expand Down
4 changes: 2 additions & 2 deletions src/lib/rtm/SystemLogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ namespace RTC
{
if (ostream_type != nullptr)
{
std::vector<std::string> vec(prop);
for (auto & str : vec)
const std::vector<std::string>& vec(prop);
for (const auto & str : vec)
{
ostream_type->write(level, m_name, getDate(), str);
}
Expand Down
9 changes: 7 additions & 2 deletions src/lib/rtm/idl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ link_directories(${ORB_LINK_DIR})
if(CORBA MATCHES "RtORB")
foreach(IDLSOURCE ${${PROJECT_NAME}_IDLSKEL};${${PROJECT_NAME}_IDLSTUB})
get_filename_component(IDLNAME ${IDLSOURCE} NAME_WE)
add_library(${IDLNAME} SHARED ${IDLSOURCE})
add_library(${IDLNAME}_objlib OBJECT ${IDLSOURCE})
add_library(${IDLNAME} SHARED $<TARGET_OBJECTS:${IDLNAME}_objlib>)
openrtm_gencode_set_compile_props(${IDLNAME}_objlib)
openrtm_gencode_set_compile_props(${IDLNAME})
target_include_directories(${IDLNAME} SYSTEM
target_include_directories(${IDLNAME}_objlib SYSTEM
PUBLIC ${PROJECT_BINARY_DIR}
PRIVATE ${CMAKE_BINARY_DIR}/src/lib
${CMAKE_SOURCE_DIR}/src/lib
Expand All @@ -50,9 +52,12 @@ if(CORBA MATCHES "RtORB")
ARCHIVE DESTINATION ${INSTALL_RTM_LIB_DIR}
RUNTIME DESTINATION ${INSTALL_RTM_BIN_DIR}
COMPONENT openrtm)

set(RTM_IDL_LIBS ${RTM_IDL_LIBS};${IDLNAME})
set(RTM_IDL_OBJECTS ${RTM_IDL_OBJECTS};$<TARGET_OBJECTS:${IDLNAME}_objlib>)
endforeach()
set(RTM_IDL_LIBS ${RTM_IDL_LIBS} PARENT_SCOPE)
set(RTM_IDL_OBJECTS ${RTM_IDL_OBJECTS} PARENT_SCOPE)
else()
add_library(${PROJECT_NAME}_objlib OBJECT ${${PROJECT_NAME}_IDLSKEL})
openrtm_gencode_set_compile_props(${PROJECT_NAME}_objlib)
Expand Down
23 changes: 21 additions & 2 deletions utils/openrtmNames/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,30 @@ set(OPENRTMNAMES_FILES NamingContext.h NamingContext.cpp
BindingIterator.h BindingIterator.cpp ObjectBinding.h ObjectBinding.cpp
RTObjectBinding.h RTObjectBinding.cpp ManagerBinding.h ManagerBinding.cpp)

add_executable(${target} openrtmNames.cpp ${OPENRTMNAMES_FILES})
add_library(${target}_objlib OBJECT ${OPENRTMNAMES_FILES})
openrtm_common_set_compile_props(${target}_objlib)
openrtm_set_link_props_shared(${target}_objlib)
openrtm_include_rtm(${target}_objlib)

add_executable(${target} openrtmNames.cpp $<TARGET_OBJECTS:${target}_objlib>)
openrtm_common_set_compile_props(${target})
openrtm_set_link_props_shared(${target})
openrtm_include_rtm(${target})

add_library(${targetDLL} SHARED OpenrtmNamesPlugin.cpp OpenrtmNamesPlugin.h ${OPENRTMNAMES_FILES})
add_library(${targetDLL} SHARED OpenrtmNamesPlugin.cpp OpenrtmNamesPlugin.h $<TARGET_OBJECTS:${target}_objlib>)
set_target_properties(${targetDLL} PROPERTIES PREFIX "")
openrtm_common_set_compile_props(${targetDLL})
openrtm_set_link_props_shared(${targetDLL})
openrtm_include_rtm(${targetDLL})

if(NOT WIN32)
add_library(${targetDLL}-static STATIC OpenrtmNamesPlugin.cpp OpenrtmNamesPlugin.h $<TARGET_OBJECTS:${target}_objlib>)
set_target_properties(${targetDLL}-static PROPERTIES OUTPUT_NAME ${targetDLL} CLEAN_DIRECT_OUTPUT 1)
openrtm_common_set_compile_props(${targetDLL}-static)
openrtm_set_link_props_shared(${targetDLL}-static)
openrtm_include_rtm(${targetDLL}-static)
endif()


set(libs ${RTM_PROJECT_NAME} ${ORB_LIBRARIES} ${DATATYPE_FACTORIES})
if(CORBA STREQUAL "TAO")
Expand Down Expand Up @@ -99,6 +112,12 @@ else(WIN32)
ARCHIVE DESTINATION ${INSTALL_RTM_EXT_DIR}/naming
RUNTIME DESTINATION ${INSTALL_RTM_EXT_DIR}/naming
COMPONENT utils)

install(TARGETS ${targetDLL}-static LIBRARY DESTINATION ${INSTALL_RTM_EXT_DIR}/naming
ARCHIVE DESTINATION ${INSTALL_RTM_EXT_DIR}/naming
RUNTIME DESTINATION ${INSTALL_RTM_EXT_DIR}/naming
COMPONENT utils)
install(FILES OpenrtmNamesPlugin.h DESTINATION ${INSTALL_RTM_EXT_DIR}/naming COMPONENT headers)
endif(WIN32)

if(SSL_ENABLE)
Expand Down
Loading