diff --git a/CMakeLists.txt b/CMakeLists.txt index 80863bfef..540b506d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,7 @@ endif() PROJECT(orocos-rtt) + SET( RTT_VERSION 2.8.0 ) STRING( REGEX MATCHALL "[0-9]+" RTT_VERSIONS ${RTT_VERSION} ) LIST( GET RTT_VERSIONS 0 RTT_VERSION_MAJOR) @@ -42,6 +43,11 @@ 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: diff --git a/rtt/ExecutionEngine.cpp b/rtt/ExecutionEngine.cpp index 2fb6867b9..61eb3f463 100644 --- a/rtt/ExecutionEngine.cpp +++ b/rtt/ExecutionEngine.cpp @@ -49,8 +49,10 @@ #include #include +#ifndef USE_CPP11 #include #include +#endif #include #include @@ -180,7 +182,11 @@ 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 if (!rmsg.found) return false; } diff --git a/rtt/InputPort.hpp b/rtt/InputPort.hpp index 808c35e32..5ce3fd15a 100644 --- a/rtt/InputPort.hpp +++ b/rtt/InputPort.hpp @@ -152,7 +152,11 @@ namespace RTT { FlowStatus result = NoData; // read and iterate if necessary. +#ifdef USE_CPP11 + cmanager.select_reader_channel( bind( &InputPort::do_read, this, boost::ref(sample), boost::ref(result), _1, _2), copy_old_data ); +#else cmanager.select_reader_channel( boost::bind( &InputPort::do_read, this, boost::ref(sample), boost::ref(result), boost::lambda::_1, boost::lambda::_2), copy_old_data ); +#endif return result; } diff --git a/rtt/OutputPort.hpp b/rtt/OutputPort.hpp index b6f631b5c..e41af8733 100644 --- a/rtt/OutputPort.hpp +++ b/rtt/OutputPort.hpp @@ -233,9 +233,15 @@ namespace RTT has_initial_sample = true; has_last_written_value = false; +#ifdef USE_CPP11 + cmanager.delete_if( bind( + &OutputPort::do_init, this, boost::ref(sample), _1) + ); +#else cmanager.delete_if( boost::bind( &OutputPort::do_init, this, boost::ref(sample), _1) ); +#endif } /** @@ -252,9 +258,15 @@ namespace RTT } has_last_written_value = keeps_last_written_value; +#ifdef USE_CPP11 + cmanager.delete_if( bind( + &OutputPort::do_write, this, boost::ref(sample), _1) + ); +#else cmanager.delete_if( boost::bind( &OutputPort::do_write, this, boost::ref(sample), boost::lambda::_1) ); +#endif } void write(base::DataSourceBase::shared_ptr source) diff --git a/rtt/internal/ConnectionManager.hpp b/rtt/internal/ConnectionManager.hpp index 27efad710..a7b7aa48a 100644 --- a/rtt/internal/ConnectionManager.hpp +++ b/rtt/internal/ConnectionManager.hpp @@ -56,7 +56,9 @@ #include #include #include +#ifndef USE_CPP11 #include +#endif #include #include diff --git a/rtt/internal/OperationInterfacePartFused.hpp b/rtt/internal/OperationInterfacePartFused.hpp index 0510676e7..b9c561183 100644 --- a/rtt/internal/OperationInterfacePartFused.hpp +++ b/rtt/internal/OperationInterfacePartFused.hpp @@ -59,7 +59,9 @@ #include #endif +#ifndef USE_CPP11 #include +#endif #include #include @@ -214,12 +216,21 @@ namespace RTT if ( args.size() != OperationInterfacePartFused::arity() ) throw wrong_number_of_args_exception(OperationInterfacePartFused::arity(), args.size() ); // note: in boost 1.41.0+ the function make_unfused() is available. #if BOOST_VERSION >= 104100 +#ifdef USE_CPP11 + return this->op->signals( boost::fusion::make_unfused(boost::bind(&FusedMSignal::invoke, + boost::make_shared >(func, SequenceFactory::assignable(args.begin()), subscriber), + _1 + ) + ) + ); +#else return this->op->signals( boost::fusion::make_unfused(boost::bind(&FusedMSignal::invoke, boost::make_shared >(func, SequenceFactory::assignable(args.begin()), subscriber), boost::lambda::_1 ) ) ); +#endif #else return this->op->signals( boost::fusion::make_unfused_generic(boost::bind(&FusedMSignal::invoke, boost::make_shared >(func, SequenceFactory::assignable(args.begin()),subscriber), diff --git a/rtt/internal/signal_template.hpp b/rtt/internal/signal_template.hpp index d7f15bcae..88f6c9be2 100644 --- a/rtt/internal/signal_template.hpp +++ b/rtt/internal/signal_template.hpp @@ -43,9 +43,11 @@ #include "NA.hpp" #ifdef ORO_SIGNAL_USE_LIST_LOCK_FREE +#ifndef USE_CPP11 #include #include #include +#endif #else #include "../os/MutexLock.hpp" #endif @@ -138,9 +140,14 @@ namespace RTT { // this code did initially not work under gcc 4.0/ubuntu breezy. // connection_t::get() const becomes an undefined symbol. // works under gcc 3.4 +#ifdef USE_CPP11 + mconnections.apply( bind(&connection_impl::emit, + bind( &applyEmit, _1) // works for any compiler +#else mconnections.apply( boost::lambda::bind(&connection_impl::emit, boost::lambda::bind( &applyEmit, boost::lambda::_1) // works for any compiler //not in gcc 4.0.2: boost::lambda::ll_static_cast(boost::lambda::bind(&connection_t::get, boost::lambda::_1)) +#endif #if OROCOS_SIGNATURE_NUM_ARGS != 0 ,OROCOS_SIGNATURE_ARGS #endif