Skip to content

Commit

Permalink
Merge branch 'master' into updated-dataflow-semantics-rebased
Browse files Browse the repository at this point in the history
  • Loading branch information
meyerj committed Dec 6, 2017
2 parents bbc9c12 + 625df04 commit 64f956e
Show file tree
Hide file tree
Showing 90 changed files with 2,716 additions and 1,383 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ before_install:

install:
- export EXTRA_CMAKE_ARGS="-DENABLE_TESTS=ON -DENABLE_CORBA=ON -DCORBA_IMPLEMENTATION=OMNIORB"
- export CFLAGS="-std=c99 -Wall -Wextra -Wno-unused-parameter"
- export CXXFLAGS="-std=c++11 -Wall -Wextra -Wno-unused-parameter"
- mkdir -p build && cd build
- cmake .. -DCMAKE_INSTALL_PREFIX=$(pwd)/install $EXTRA_CMAKE_ARGS
- make -j2 install

script:
# Run tests
- export BOOST_TEST_LOG_LEVEL=message
- make -j1 check
18 changes: 10 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ STRING( REGEX MATCHALL "[0-9]+" RTT_VERSIONS ${RTT_VERSION} )
LIST( GET RTT_VERSIONS 0 RTT_VERSION_MAJOR)
LIST( GET RTT_VERSIONS 1 RTT_VERSION_MINOR)
LIST( GET RTT_VERSIONS 2 RTT_VERSION_PATCH)

MESSAGE( "Orocos RTT version ${VERSION} (${RTT_VERSION_MAJOR}.${RTT_VERSION_MINOR}.${RTT_VERSION_PATCH})" )
SET( RTT_SOVERSION ${RTT_VERSION_MAJOR}.${RTT_VERSION_MINOR} )
MESSAGE( "Orocos RTT version ${RTT_VERSION}" )

SET( PROJ_SOURCE_DIR ${orocos-rtt_SOURCE_DIR} )
SET( PROJ_BINARY_DIR ${orocos-rtt_BINARY_DIR} )
Expand All @@ -43,11 +43,6 @@ if (NOT EXISTS ${PROJ_SOURCE_DIR}/orocos-rtt.cmake)
INCLUDE(${PROJ_SOURCE_DIR}/orocos-rtt.default.cmake)
endif ()

OPTION(USE_CPP11 "Turn on to replace boost::bind with cpp11 bind." OFF)
if(USE_CPP11)
ADD_DEFINITIONS(-DUSE_CPP11)
endif(USE_CPP11)

# On Windows, the default CMAKE_INSTALL_PREFIX is either:
# C:\Program Files\orocos-rtt or C:\Program Files (x86)\orocos-rtt
# However, we want it to be either:
Expand Down Expand Up @@ -178,7 +173,14 @@ INSTALL(FILES UseOROCOS-RTT.cmake UseOROCOS-RTT-helpers.cmake config/cmake_unins
# Install package.xml
INSTALL(FILES package.xml DESTINATION share/rtt)

# Install an env-hook if catkin is found
# Install an env-hook in etc/orocos/${OROCOS_TARGET}/profile.d
configure_file(env-hooks/00.rtt.sh.in ${CMAKE_CURRENT_BINARY_DIR}/env-hooks/00.rtt.sh @ONLY)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/env-hooks/00.rtt.sh
DESTINATION etc/orocos/profile.d
)

# Install a catkin env-hook if catkin is installed
find_package(catkin QUIET)
if(catkin_FOUND)
catkin_add_env_hooks(00.rtt SHELLS sh DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/env-hooks)
Expand Down
2,719 changes: 1,819 additions & 900 deletions Doxyfile.in

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions config/check_depend.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -309,18 +309,18 @@ IF (CMAKE_COMPILER_IS_GNUCXX)

IF ( ${CXX_HAS_VERSION} EQUAL 0 )
# We are assuming here that -dumpversion is gcc specific.
IF( CXX_VERSION MATCHES "[4-5]\\.[0-9](\\.[0-9])?" )
IF( CXX_VERSION MATCHES "[4-6]\\.[0-9](\\.[0-9])?" )
MESSAGE(STATUS "Detected gcc4/5: ${CXX_VERSION}")
SET(RTT_GCC_HASVISIBILITY TRUE)
ELSE(CXX_VERSION MATCHES "[4-5]\\.[0-9](\\.[0-9])?")
ELSE(CXX_VERSION MATCHES "[4-6]\\.[0-9](\\.[0-9])?")
IF( CXX_VERSION MATCHES "3\\.[0-9](\\.[0-9])?" )
MESSAGE(STATUS "Detected gcc3: ${CXX_VERSION}")
ELSE( CXX_VERSION MATCHES "3\\.[0-9](\\.[0-9])?" )
MESSAGE("ERROR: You seem to be using gcc version:")
MESSAGE("${CXX_VERSION}")
MESSAGE( FATAL_ERROR "ERROR: For gcc, Orocos requires version 4.x or 3.x")
ENDIF( CXX_VERSION MATCHES "3\\.[0-9](\\.[0-9])?" )
ENDIF(CXX_VERSION MATCHES "[4-5]\\.[0-9](\\.[0-9])?")
ENDIF(CXX_VERSION MATCHES "[4-6]\\.[0-9](\\.[0-9])?")
ELSE ( ${CXX_HAS_VERSION} EQUAL 0)
MESSAGE("Could not determine gcc version: ${CXX_HAS_VERSION}")
ENDIF ( ${CXX_HAS_VERSION} EQUAL 0)
Expand Down
16 changes: 14 additions & 2 deletions env-hooks/00.rtt.sh.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
#!/bin/sh
export OROCOS_TARGET=@OROCOS_TARGET@
export RTT_COMPONENT_PATH=`echo $CMAKE_PREFIX_PATH | sed 's!:!/lib/orocos:!g' | sed 's!$!/lib/orocos!'`

: ${OROCOS_TARGET:=@OROCOS_TARGET@}

for file_path in `echo $CMAKE_PREFIX_PATH | tr : ' '` "@CMAKE_INSTALL_PREFIX@"; do
if [ ! -d "$file_path/lib/orocos" ]; then
continue
elif [ -z "$RTT_COMPONENT_PATH" ]; then
RTT_COMPONENT_PATH="$file_path/lib/orocos"
elif ! echo "$RTT_COMPONENT_PATH" | grep -q "$file_path/lib/orocos"; then
RTT_COMPONENT_PATH="$RTT_COMPONENT_PATH:$file_path/lib/orocos"
fi
done

export OROCOS_TARGET
export RTT_COMPONENT_PATH
6 changes: 4 additions & 2 deletions rtt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,12 @@ IF ( OS_RT_MALLOC )
IF (OS_RT_MALLOC_DEBUG)
SET( TLSF_FLAGS "${TLSF_FLAGS} -D_DEBUG_TLSF_")
ENDIF (OS_RT_MALLOC_DEBUG)

SET( TLSF_FLAGS "${TLSF_FLAGS} -fno-strict-aliasing")
SET_SOURCE_FILES_PROPERTIES( os/tlsf/tlsf.c PROPERTIES
COMPILE_FLAGS "${TLSF_FLAGS}")

set(TLSF_FLAGS "${TLSF_FLAGS}" CACHE INTERNAL "")

GET_SOURCE_FILE_PROPERTY( TLSF os/tlsf/tlsf.c COMPILE_FLAGS)
MESSAGE( "TLSF settings: ${TLSF}")

Expand Down Expand Up @@ -194,8 +196,8 @@ ENDIF ( BUILD_STATIC )
ADD_LIBRARY(orocos-rtt-${OROCOS_TARGET}_dynamic SHARED $ENV{GLOBAL_LIBRARY_SRCS})
SET_TARGET_PROPERTIES( orocos-rtt-${OROCOS_TARGET}_dynamic PROPERTIES
DEFINE_SYMBOL "RTT_DLL_EXPORT"
SOVERSION "${RTT_VERSION_MAJOR}.${RTT_VERSION_MINOR}"
VERSION "${RTT_VERSION}"
SOVERSION "${RTT_SOVERSION}"
OUTPUT_NAME orocos-rtt-${OROCOS_TARGET}
COMPILE_DEFINITIONS OROCOS_TARGET=${OROCOS_TARGET}
INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib"
Expand Down
20 changes: 5 additions & 15 deletions rtt/ExecutionEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@
#include "extras/SlaveActivity.hpp"

#include <boost/bind.hpp>
#include <boost/ref.hpp>
#ifndef USE_CPP11
#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>
#endif
#include <functional>
#include <algorithm>

#define ORONUM_EE_MQUEUE_SIZE 100
Expand Down Expand Up @@ -161,8 +155,8 @@ namespace RTT
found = true; // always true in order to be able to quit waitForMessages.
}
virtual void dispose() {}
virtual bool isError() const { return false;}

virtual bool isError() const { return false; }
bool done() const { return !mf->isLoaded() || found; }
};

bool ExecutionEngine::removeFunction( ExecutableInterface* f )
Expand All @@ -182,11 +176,7 @@ namespace RTT
// Running: create message on stack.
RemoveMsg rmsg(f,this);
if ( this->process(&rmsg) )
#ifdef USE_CPP11
this->waitForMessages( ! bind(&ExecutableInterface::isLoaded, f) || bind(&RemoveMsg::found,boost::ref(rmsg)) );
#else
this->waitForMessages( ! lambda::bind(&ExecutableInterface::isLoaded, f) || lambda::bind(&RemoveMsg::found,boost::ref(rmsg)) );
#endif
this->waitForMessages( boost::bind(&RemoveMsg::done, &rmsg) );
if (!rmsg.found)
return false;
}
Expand Down Expand Up @@ -378,7 +368,7 @@ namespace RTT
)
}
// in case start() or updateHook() called error(), this will be called:
if ( taskc->mTaskState == TaskCore::RunTimeError ) {
if (taskc->mTaskState == TaskCore::RunTimeError && taskc->mTargetState >= TaskCore::Running) {
TRY (
taskc->errorHook();
) CATCH(std::exception const& e,
Expand Down Expand Up @@ -408,7 +398,7 @@ namespace RTT
(*it)->exception(); // calls stopHook,cleanupHook
)
}
if ( (*it)->mTaskState == TaskCore::RunTimeError ){
if ((*it)->mTaskState == TaskCore::RunTimeError && (*it)->mTargetState == TaskCore::RunTimeError){
TRY (
(*it)->errorHook();
) CATCH(std::exception const& e,
Expand Down
43 changes: 18 additions & 25 deletions rtt/Logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
# endif
# endif
# ifdef OROSEM_REMOTE_LOGGING
# include <sstream>
# include "base/BufferLockFree.hpp"
# endif
#endif

Expand Down Expand Up @@ -133,7 +133,7 @@ namespace RTT
stdoutput( &str ),
#endif
#ifdef OROSEM_REMOTE_LOGGING
messagecnt(0),
remotestring(ORONUM_LOGGING_BUFSIZE,std::string(), true),
#endif
#if defined(OROSEM_FILE_LOGGING)
#if defined(OROSEM_LOG4CPP_LOGGING)
Expand Down Expand Up @@ -203,14 +203,7 @@ namespace RTT
fprintf( logfile, "%s%s\n", res.c_str(), fileline.str().c_str() );
#endif
#ifdef OROSEM_REMOTE_LOGGING
// detect buffer 'overflow'
if ( messagecnt >= ORONUM_LOGGING_BUFSIZE ) {
std::string dummy;
remotestream >> dummy; // FIFO principle: read 1 line
--messagecnt;
}
remotestream << res << fileline.str() << pf;
++messagecnt;
remotestring.Push(res+fileline.str()); // TODO, handle failure.
#endif
#if defined(OROSEM_FILE_LOGGING) || defined(OROSEM_REMOTE_LOGGING)
fileline.str("");
Expand All @@ -227,8 +220,7 @@ namespace RTT
std::stringstream fileline;
#endif
#if defined(OROSEM_REMOTE_LOGGING)
std::stringstream remotestream;
unsigned int messagecnt;
base::BufferLockFree<std::string> remotestring;
#endif
#if defined(OROSEM_FILE_LOGGING)
#if defined(OROSEM_LOG4CPP_LOGGING)
Expand Down Expand Up @@ -363,8 +355,9 @@ namespace RTT
}

void Logger::allowRealTime() {
*this << Logger::Warning << "Enabling Real-Time Logging !" <<Logger::endl;
// re-enable and then log, otherwise you might not get the log event!
d->allowRT = true;
*this << Logger::Warning << "Enabling Real-Time Logging !" <<Logger::endl;
}
void Logger::disallowRealTime() {
*this << Logger::Warning << "Disabling Real-Time Logging !" <<Logger::endl;
Expand Down Expand Up @@ -420,19 +413,25 @@ namespace RTT

Logger& Logger::in(const std::string& modname)
{
if ( !d->maylog() )
return *this;
os::MutexLock lock( d->inpguard );
d->moduleptr = modname.c_str();
return *this;
}

Logger& Logger::out(const std::string& oldmod)
{
if ( !d->maylog() )
return *this;
os::MutexLock lock( d->inpguard );
d->moduleptr = oldmod.c_str();
return *this;
}

std::string Logger::getLogModule() const {
if ( !d->maylog() )
return "";
os::MutexLock lock( d->inpguard );
std::string ret = d->moduleptr.c_str();
return ret;
Expand Down Expand Up @@ -504,16 +503,13 @@ namespace RTT
#ifdef OROSEM_REMOTE_LOGGING
if (!d->started)
return "";

os::MutexLock lock( d->inpguard );
std::string line;
{
os::MutexLock lock( d->inpguard );
getline( d->remotestream, line );
if ( !d->remotestream )
d->remotestream.clear();
}
if ( !line.empty() )
--d->messagecnt;
return line;
if(d->remotestring.Pop(line))
return line;
else
return "";
#else
return "";
#endif
Expand Down Expand Up @@ -583,9 +579,6 @@ namespace RTT
if ( d->maylogStdOut() ) {
#ifndef OROSEM_PRINTF_LOGGING
d->stdoutput->flush();
#endif
#if defined(OROSEM_REMOTE_LOGGING)
d->remotestream.flush();
#endif
}
#if defined(OROSEM_FILE_LOGGING)
Expand Down
17 changes: 12 additions & 5 deletions rtt/Property.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ namespace RTT
* @post ready() will be true if datasource is a valid pointer.
*/
Property(const std::string& name, const std::string& description,
typename internal::AssignableDataSource<DataSourceType>::shared_ptr datasource )
const typename internal::AssignableDataSource<DataSourceType>::shared_ptr& datasource )
: base::PropertyBase(name, description), _value( datasource )
{
// need to do this on the datasource in order to have access to set()/rvalue() of the data source.
Expand Down Expand Up @@ -373,14 +373,21 @@ namespace RTT
return new Property<T>(*this);
}

virtual Property<T>* copy() const
virtual Property<T>* create() const
{
return new Property<T>( _name, _description, _value );
return new Property<T>( _name, _description, T() );
}

virtual Property<T>* create() const
virtual Property<T>* create( const base::DataSourceBase::shared_ptr& datasource ) const
{
return new Property<T>( _name, _description, T() );
typename internal::AssignableDataSource<DataSourceType>::shared_ptr value
= internal::AssignableDataSource<DataSourceType>::narrow( datasource.get() );
Property<T>* prop = new Property<T>( _name, _description, value );
if ( datasource && !prop->ready() ) {
log(Error) << "Cannot initialize Property: "
<< "incompatible type ( destination type: " << getType() << ", source type: " << datasource->getTypeName() << ")." << endlog();
}
return prop;
}

virtual base::DataSourceBase::shared_ptr getDataSource() const {
Expand Down
4 changes: 2 additions & 2 deletions rtt/PropertyBag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ namespace RTT

for( const_iterator i = orig.mproperties.begin(); i != orig.mproperties.end(); ++i) {
if ( orig.ownsProperty( *i ) ) {
PropertyBase* copy = (*i)->copy();
PropertyBase* copy = (*i)->create( (*i)->getDataSource() );
this->ownProperty( copy );
} else {
this->add( *i );
Expand Down Expand Up @@ -615,7 +615,7 @@ namespace RTT
temp->update( (*sit) );
}
// step 3 : add result to target bag.
target.add( temp );
target.ownProperty( temp );
}
}
++it;
Expand Down
7 changes: 4 additions & 3 deletions rtt/Service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@
#include "TaskContext.hpp"
#include <algorithm>
#include "internal/mystd.hpp"
#include <boost/lambda/lambda.hpp>
#include <boost/lambda/construct.hpp>
#include <algorithm>

namespace RTT {
Expand Down Expand Up @@ -223,7 +221,10 @@ namespace RTT {
simpleoperations.erase(simpleoperations.begin() );
}

for_each(ownedoperations.begin(),ownedoperations.end(), lambda::delete_ptr() );
for( OperationList::const_iterator it = ownedoperations.begin(); it != ownedoperations.end(); ++it )
{
delete *it;
}
ownedoperations.clear();

OperationInterface::clear();
Expand Down
1 change: 1 addition & 0 deletions rtt/ServiceRequester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ namespace RTT
}

bool ServiceRequester::connectTo( Service::shared_ptr sp) {
if (!sp) return false;
for (OperationCallers::iterator it = mmethods.begin(); it != mmethods.end(); ++it) {
if ( !it->second->ready() ) {
if (sp->hasOperation( it->first )) {
Expand Down
12 changes: 6 additions & 6 deletions rtt/base/PropertyBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,18 +179,18 @@ namespace RTT
virtual PropertyBase* clone() const = 0;

/**
* Deliver a shallow copy of this PropertyBase with a shared
* DataSource. The original may be deleted and the clone can be
* transparantly used in its place or vice versa.
* Create a new default instance of the PropertyBase.
* This is a factory method to 'make something of the same type'.
* The new PropertyBase has the same name and description as this.
*/
virtual PropertyBase* copy() const = 0;
virtual PropertyBase* create() const = 0;

/**
* Create a new default instance of the PropertyBase.
* Create a new instance of the PropertyBase with a custom data source.
* This is a factory method to 'make something of the same type'.
* The new PropertyBase has the same name and description as this.
*/
virtual PropertyBase* create() const = 0;
virtual PropertyBase* create( const base::DataSourceBase::shared_ptr& datasource ) const = 0;

/**
* Get an assignable base::DataSource through which this PropertyBase
Expand Down
Loading

0 comments on commit 64f956e

Please sign in to comment.