From 531e5f31b24fc4e1ecf8d4d20b6353c0e6e0f6ab Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Mon, 12 Nov 2012 15:47:32 +0100 Subject: [PATCH 01/63] internal: make InputPortSource assignable This allows other code to have a reference to the internal data, in case this is needed for performance reasons. Signed-off-by: Peter Soetens --- rtt/internal/InputPortSource.hpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/rtt/internal/InputPortSource.hpp b/rtt/internal/InputPortSource.hpp index bcd074c23..cc9d76b37 100644 --- a/rtt/internal/InputPortSource.hpp +++ b/rtt/internal/InputPortSource.hpp @@ -57,9 +57,14 @@ namespace RTT * call base::InputPortInterface::getDataSource() to get the corresponding data * source. This is your duty to destroy the port when it is not needed * anymore. + * + * @note Although this DataSource is assignable, writing to it is not causing + * any change in the port. You should not use the set() functions of this object. + * We provide this interface in order to allow other + * code to take a non-const reference to the read data. */ template - class InputPortSource : public DataSource + class InputPortSource : public AssignableDataSource { InputPort* port; mutable T mvalue; @@ -83,7 +88,7 @@ namespace RTT void reset() { port->clear(); } bool evaluate() const { - return port->read(mvalue) == NewData; + return port->read(mvalue, false) == NewData; } typename DataSource::result_t value() const @@ -97,9 +102,17 @@ namespace RTT else return T(); } - DataSource* clone() const + virtual void set( typename AssignableDataSource::param_t t ) { + mvalue = t; + } + + virtual typename AssignableDataSource::reference_t set() { + return mvalue; + } + + AssignableDataSource* clone() const { return new InputPortSource(*port); } - DataSource* copy( std::map& alreadyCloned ) const + AssignableDataSource* copy( std::map& alreadyCloned ) const { return const_cast*>(this); } }; }} From f0038e766a4f6e6a75f2db3389b089d6a26ddd31 Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Mon, 12 Nov 2012 23:31:55 +0100 Subject: [PATCH 02/63] ports: provide InputPort::getDataSample() This is the counterpart of OutputPort::setDataSample() and allows receiving parties to initialize internal data structures according to the expected size of the data on this port. Signed-off-by: Peter Soetens --- rtt/InputPort.hpp | 16 ++++++++++++++++ rtt/base/BufferInterface.hpp | 5 +++++ rtt/base/BufferLockFree.hpp | 11 +++++++++++ rtt/base/BufferLocked.hpp | 6 ++++++ rtt/base/BufferUnSync.hpp | 5 +++++ rtt/base/ChannelElement.hpp | 8 ++++++++ rtt/base/DataObjectUnSync.hpp | 6 ++++++ rtt/internal/ChannelBufferElement.hpp | 4 ++++ rtt/internal/ChannelDataElement.hpp | 5 +++++ rtt/internal/InputPortSource.hpp | 4 +++- 10 files changed, 69 insertions(+), 1 deletion(-) diff --git a/rtt/InputPort.hpp b/rtt/InputPort.hpp index 56bb6b418..edae63750 100644 --- a/rtt/InputPort.hpp +++ b/rtt/InputPort.hpp @@ -174,6 +174,22 @@ namespace RTT return RTT::NewData; } + /** + * Get a sample of the data on this port, without actually reading the port's data. + * It's the complement of OutputPort::setDataSample() and serves to retrieve the size + * of a variable sized data type T. Returns default T if !connected() or if the + * OutputPort did not use setDataSample(). Returns an example T otherwise. + * In case multiple inputs are connected to this port a sample from the currently read + * connection will be returned. + */ + void getDataSample(T& sample) + { + typename base::ChannelElement::shared_ptr input = static_cast< base::ChannelElement* >( cmanager.getCurrentChannel() ); + if ( input ) { + sample = input->data_sample(); + } + } + /** Returns the types::TypeInfo object for the port's type */ virtual const types::TypeInfo* getTypeInfo() const { return internal::DataSourceTypeInfo::getTypeInfo(); } diff --git a/rtt/base/BufferInterface.hpp b/rtt/base/BufferInterface.hpp index fe666a781..ead17ba3c 100644 --- a/rtt/base/BufferInterface.hpp +++ b/rtt/base/BufferInterface.hpp @@ -131,6 +131,11 @@ namespace RTT * @nrt */ virtual void data_sample( const T& sample ) = 0; + + /** + * Reads back a data sample. + */ + virtual T data_sample() const = 0; }; }} diff --git a/rtt/base/BufferLockFree.hpp b/rtt/base/BufferLockFree.hpp index fbc4abcaa..8ad75b54e 100644 --- a/rtt/base/BufferLockFree.hpp +++ b/rtt/base/BufferLockFree.hpp @@ -100,6 +100,17 @@ namespace RTT mpool.data_sample(sample); } + virtual T data_sample() const + { + T result = T(); + Item* mitem = mpool.allocate(); + if (mitem != 0) { + result = *mitem; + mpool.deallocate( mitem ); + } + return result; + } + size_type capacity() const { diff --git a/rtt/base/BufferLocked.hpp b/rtt/base/BufferLocked.hpp index c14207be9..3e4a56ccf 100644 --- a/rtt/base/BufferLocked.hpp +++ b/rtt/base/BufferLocked.hpp @@ -84,6 +84,12 @@ namespace RTT { buf.resize(cap, sample); buf.resize(0); + lastSample = sample; + } + + virtual T data_sample() const + { + return lastSample; } /** diff --git a/rtt/base/BufferUnSync.hpp b/rtt/base/BufferUnSync.hpp index c006df5d2..741eb37e3 100644 --- a/rtt/base/BufferUnSync.hpp +++ b/rtt/base/BufferUnSync.hpp @@ -79,6 +79,11 @@ namespace RTT buf.resize(0); } + virtual T data_sample() const + { + return lastSample; + } + /** * Destructor */ diff --git a/rtt/base/ChannelElement.hpp b/rtt/base/ChannelElement.hpp index f03e856f4..20cd7faf0 100644 --- a/rtt/base/ChannelElement.hpp +++ b/rtt/base/ChannelElement.hpp @@ -87,6 +87,14 @@ namespace RTT { namespace base { return false; } + virtual value_t data_sample() + { + typename ChannelElement::shared_ptr input = boost::static_pointer_cast< ChannelElement >(getInput()); + if (input) + return input->data_sample(); + return value_t(); + } + /** Writes a new sample on this connection. \a sample is the sample to * write. * diff --git a/rtt/base/DataObjectUnSync.hpp b/rtt/base/DataObjectUnSync.hpp index 9f3d8dbe2..a235033c8 100644 --- a/rtt/base/DataObjectUnSync.hpp +++ b/rtt/base/DataObjectUnSync.hpp @@ -82,6 +82,12 @@ namespace RTT virtual void data_sample( const DataType& sample ) { Set(sample); } + + virtual T data_sample() const + { + return data; + } + }; }} diff --git a/rtt/internal/ChannelBufferElement.hpp b/rtt/internal/ChannelBufferElement.hpp index 4e143bdf6..c38a00704 100644 --- a/rtt/internal/ChannelBufferElement.hpp +++ b/rtt/internal/ChannelBufferElement.hpp @@ -118,6 +118,10 @@ namespace RTT { namespace internal { return base::ChannelElement::data_sample(sample); } + virtual T data_sample() + { + return buffer->data_sample(); + } }; }} diff --git a/rtt/internal/ChannelDataElement.hpp b/rtt/internal/ChannelDataElement.hpp index 6559f5d68..a6958de39 100644 --- a/rtt/internal/ChannelDataElement.hpp +++ b/rtt/internal/ChannelDataElement.hpp @@ -107,6 +107,11 @@ namespace RTT { namespace internal { return base::ChannelElement::data_sample(sample); } + virtual T data_sample() + { + return data->Get(); + } + }; }} diff --git a/rtt/internal/InputPortSource.hpp b/rtt/internal/InputPortSource.hpp index cc9d76b37..29ae77d35 100644 --- a/rtt/internal/InputPortSource.hpp +++ b/rtt/internal/InputPortSource.hpp @@ -73,7 +73,9 @@ namespace RTT typedef typename boost::intrusive_ptr > shared_ptr; InputPortSource(InputPort& port) - : port(&port), mvalue() { } + : port(&port), mvalue() { + port.getDataSample( mvalue ); + } /** * Called by owner port to notify that it is being From 97649cc303608934fc609c9b6cdd8590e3cd0696 Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Mon, 12 Nov 2012 23:57:24 +0100 Subject: [PATCH 03/63] ports: no longer cache the InputPortSource This allows us to shorten the lifetime of the InputPortSource with respect to the port. Signed-off-by: Peter Soetens --- rtt/InputPort.hpp | 12 ++++-------- rtt/base/InputPortInterface.hpp | 3 +-- rtt/internal/InputPortSource.hpp | 10 ---------- 3 files changed, 5 insertions(+), 20 deletions(-) diff --git a/rtt/InputPort.hpp b/rtt/InputPort.hpp index edae63750..d10c2ba4f 100644 --- a/rtt/InputPort.hpp +++ b/rtt/InputPort.hpp @@ -63,7 +63,6 @@ namespace RTT class InputPort : public base::InputPortInterface { friend class internal::ConnOutputEndpoint; - typename internal::InputPortSource::shared_ptr data_source; virtual bool connectionAdded( base::ChannelElementBase::shared_ptr channel_input, ConnPolicy const& policy ) { return true; } @@ -96,9 +95,9 @@ namespace RTT public: InputPort(std::string const& name = "unnamed", ConnPolicy const& default_policy = ConnPolicy()) : base::InputPortInterface(name, default_policy) - , data_source(0) {} + {} - virtual ~InputPort() { disconnect(); if (data_source) data_source->dropPort(); } + virtual ~InputPort() { disconnect(); } /** \overload */ FlowStatus read(base::DataSourceBase::shared_ptr source) @@ -209,14 +208,11 @@ namespace RTT { return new OutputPort(this->getName()); } /** Returns a base::DataSourceBase interface to read this port. The returned - * data source is always the same object and will be destroyed when the - * port is destroyed. + * data source is always a new object. */ base::DataSourceBase* getDataSource() { - if (data_source) return data_source.get(); - data_source = new internal::InputPortSource(*this); - return data_source.get(); + return new internal::InputPortSource(*this); } virtual bool createStream(ConnPolicy const& policy) diff --git a/rtt/base/InputPortInterface.hpp b/rtt/base/InputPortInterface.hpp index 0ce671df4..b08fce40c 100644 --- a/rtt/base/InputPortInterface.hpp +++ b/rtt/base/InputPortInterface.hpp @@ -105,8 +105,7 @@ namespace RTT virtual bool removeConnection(internal::ConnID* cid); /** Returns a DataSourceBase interface to read this port. The returned - * data source is always the same object and will be destroyed when the - * port is destroyed. + * data source is always a new object. */ virtual DataSourceBase* getDataSource() = 0; diff --git a/rtt/internal/InputPortSource.hpp b/rtt/internal/InputPortSource.hpp index 29ae77d35..e0738012d 100644 --- a/rtt/internal/InputPortSource.hpp +++ b/rtt/internal/InputPortSource.hpp @@ -77,16 +77,6 @@ namespace RTT port.getDataSample( mvalue ); } - /** - * Called by owner port to notify that it is being - * destructed. Since this InputPortSource is refcounted, - * we need a way to tell it that the port no longer - * exists. - */ - void dropPort() { - port = 0; - } - void reset() { port->clear(); } bool evaluate() const { From dfb6fab8ab1153cdc3bd03e1e081182bf88f4441 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 15 Nov 2012 17:46:04 +0100 Subject: [PATCH 04/63] scripting: fixed ValueParser for PropertyBag properties that are owned by services Signed-off-by: Johannes Meyer --- rtt/scripting/ValueParser.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rtt/scripting/ValueParser.cpp b/rtt/scripting/ValueParser.cpp index 8699babce..d720c8095 100644 --- a/rtt/scripting/ValueParser.cpp +++ b/rtt/scripting/ValueParser.cpp @@ -114,9 +114,9 @@ namespace RTT void ValueParser::seenpeer() { // inform propparser of new peer : - //std::cerr << "ValueParser: seenpeer : "<< peerparser.peer()->getName() - // <<" has props :" << (peerparser.peer()->properties() != 0) << std::endl; - propparser.setPropertyBag( peerparser.peer()->provides()->properties() ); + //std::cerr << "ValueParser: seenpeer : "<< peerparser.taskObject()->getName() + // <<" has props :" << (peerparser.taskObject()->properties() != 0) << std::endl; + propparser.setPropertyBag( peerparser.taskObject()->properties() ); } void ValueParser::seenboolconstant( iter_t begin, iter_t end ) From f6dd83523bbe52036f50407e60ab3c6d77dd730d Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Sat, 17 Nov 2012 18:27:17 +0100 Subject: [PATCH 05/63] doc: initial 2.6 release notes Signed-off-by: Peter Soetens --- doc/xml/orocos-rtt-changes.xml | 200 ++++++++++++--------------------- 1 file changed, 74 insertions(+), 126 deletions(-) diff --git a/doc/xml/orocos-rtt-changes.xml b/doc/xml/orocos-rtt-changes.xml index fce94a2bf..c9a99c24a 100644 --- a/doc/xml/orocos-rtt-changes.xml +++ b/doc/xml/orocos-rtt-changes.xml @@ -3,8 +3,8 @@ "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ Orocos"> - - + + ] > @@ -36,30 +36,48 @@ Toolchain 2.2 Changes Toolchain 2.3 Changes Toolchain 2.4 Changes + Toolchain 2.5 Changes
- Caveats + Important Caveats This release is binary incompatible with RTT &oldversion;.x. You need to recompile the whole toolchain and all your applications in order to use this release. - - Take care that all previously built components and plugins in the <install>/lib/orocos directory and subdirectories - are removed, since the plugin loader may not find older versions. Especially on 'ROS' systems, which have - such files in their <packagename>/lib/ directory. + Take care that all previously built components and plugins in the + <install>/lib/orocos directory and subdirectories are removed, since the component + and plugin loaders may get confused if older versions are found. - You can only attach one callback to an EvenPort, during the addEventPort() function call. - If you need multiple call-backs, you need to call these yourself from the function you've - provided to addEventPort(). In this regard, the port->getNewDataOnPortEvent() call has - been removed. You can enable it by defining ORO_SIGNALLING_PORTS in the cmake - configuration step, but this feature will be removed eventually. + There was an API change in the (RTT internal) RTT::types::TypeInfo + class. If you inherited directly or indirectly from this class, you'll probably need to + inherit from RTT::types::TypeInfoGenerator instead and fabricate a + installTypeInfoObject() function. There is generally no change needed on your + side if you inherited from RTT::types::TemplateTypeInfo, + RTT::types::StructTypeInfo or similar classes, since these classes + have implemented installTypeInfoObject() function for you and inherit + from RTT::types::TypeInfoGenerator. + + + + + There was an API change in the (RTT internal) + RTT::marsh::PropertyLoader class. It requires now a TaskContext or + Service in the constructor and no longer as argument to the rest of the API. + + + + + We no longer load component libraries with the RTLD_GLOBAL flag. + This means you must link + with all required libraries at link time, and not rely on symbol resolution during the + loading by the deployer. @@ -68,16 +86,14 @@ ROS Users - The Orocos Toolchain 2.5.x will only be released in ROS Electric. This comes with a - major overhaul of the Electric ROS integration packages of RTT. The ROS Wiki contains - the necessary upgrade steps you need to take to migrate existing code to the new ROS - package structure. ROS Wiki on rtt_ros_integration. + The Orocos Toolchain 2.6.x will only be released in ROS Fuerte and later. + - The Orocos-ROS integration and the Orocos Toolchain are available as Ubuntu packages - from http://packages.ros.org/ros/ubuntu distroname main. - See ROS Wiki on installing ROS. + We fixed issues of conflicting typekits (see more on that below). This means that its + allowed now to load typekits from ROS and non-ROS packages, describing the same + structs. @@ -89,41 +105,31 @@ - Switching between OROCOS_TARGET configurations is now more robust. - In environments where multiple OROCOS_TARGET are possible (for example xenomai/gnulinux), - the OROCOS_TARGET environment variable can be set and will be picked up by the UseOrocos.cmake - macros. + Autoproj updates + This release includes the latest Autoproj version and consequently features in + order to manage your build process and code repository versions. ROS_ROOT is no longer influencing your build, unless you're in a ROS_PACKAGE_PATH - In &oldversion;, the build system would switch to ROS-style if the user had defined the - ROS_ROOT environment variable. In &version;, the build system will only switch if the - package being built is a ROS package, ie, it is underneath the ROS_PACKAGE_PATH. + The last cornercases of ROS_ROOT influencing our build behavior have been ironed out in this release - This allows better integration with AutoProj. + This fixes integration with AutoProj. - ROS package builds no longer install in a <package>/install subdirectory - All Orocos Toolchain ROS packages now install in the <orocos-toolchain>/install directory. - As such both ROS and non-ROS builds have the same directory layout. You can still use 'rosrun' - to run an OCL program, since these are still available in the package as well. - - - This allows better integration with AutoProj. + RTT and OCL builds with clang++ 3.0 + This allows you to speed up RTT builds significantly. - RTT builds with clang++ 2.9 - This allows you to speed up RTT builds significantly. - - - This allows better integration with AutoProj. + It's now possible to create applications that setup a CORBA proxy, without + linking to TAO/OMNIORB directly, but only to the RTT corba transport. See the + RTT::corba::TaskContextFactory class. @@ -133,76 +139,62 @@ - An important fix was applied when two or more output ports were connected to one - input port, which led to dropping data samples from time to time. + A new connection type has been introduced, BUFFER_CIRCULAR. + This new type can be used in the ConnPolicy.type field in order to have circular + buffers instead of the classical non-circular buffer. - -
-
- Data Types, Toolkits and Typekits - - The Typekits now support fixed size arrays better. Especially, there is no need anymore for having - one typekit for each size of an array. The ROS fixed-size array implementation in Electric makes use of - this feature. - For this, there was some class-reordering in the TypeInfo hierarchy, but it should remain transparant - for existing users. + Exceptions thrown in operations are now detected and handled. When + an operation threw an exception, this resulted in undefined behavior. The exception is + now caught by RTT and the caller side receives an std::runtime_exception exception. + Passing exceptions is not supported, so this is a last-resort solution to cope with + misbehaving operations. + The ComponentLoader is from now on part of RTT instead of OCL. + This means you no longer need a DeploymentComponent to import typekits or component + packages.
- Operating Systems + Data Types, Toolkits and Typekits + We restructured typekits such that it is now allowed to load multiple typekits for the same type. - There were the usual fixes for new compilers or header locations for - all Operating Systems: Linux, Mac OS-X and Win32. + If these typekits name the type differently, the names will function as an alias. Also, + TypeInfo object pointers are now constant and can no longer become invalid in a running + application. The restructuring allows one to install a TypeInfo object and later-on + add features such as type decomposition or transports. The classical TypeInfo subclasses + all have been adapted, but if you created your own TypeInfo variant, you will need to + update your code minimally. - - - The CPU affinity Thread function for Xenomai is implemented but not yet stable. We - are delving into this but already provide it to allow more testing. + See the Caveats section above in case you wrote a custom typekit. - Xenomai threads now run with a default stack size of 128kb, instead of 32kb. This may still - be too little if you have scripts which load scripts or have heavy stack use. In that case, - use the RTT::os::Thread::setStackSize function before creating a new Thread/Activity. - - - - - The Xenomai main() thread now runs with priority 0 instead of 10. Since this is the - thread which is doing all the setup work, it shouldn't have defaulted - to a real-time priority. - - - - - There have been a bunch of patches for Mac OS-X, but more testing is still necessary. + The internal function getMember is now much more efficient and faster. There's now also + a real-time version of getMember, if you provide it a ReferenceDataSource such that a + reference to the member can be given without allocating a DataSource for it.
- Orocos scripting + Operating Systems - RTT script functions can now be decorated with 'global', 'local' and 'export'. 'local' is the - default and keeps a function local to the scripting service. 'export' attaches the script - function to the interface of the component it belongs to. 'global' puts the function in - the GlobalService, such that other scripts in other components can use it directly, without - the need to refer to a component. + Creating a Linux thread now prints the TID or PID instead of the POSIX id, such that + RTT threads can be correlated to normal Unix tools such as top or ps. @@ -220,50 +212,6 @@ for the latest changes - - - The TLSF branch of Lua has been merged, which will allow hard real-time script execution in the near - future. Further minor releases will pollish this feature more. - - - - - Your scripts have now access to the RTT globals using the rtt.globals - table. These are the scheduler types, data flow & operations return codes and constants for initializing - ConnectionPolicy objects. - - - -
-
- TimerComponent - - - - The TimerComponent was changed to have one port for each timer ID as well in addition to one port - for all timer ID's. This avoid spurious wake-ups (triggers and calls of updateHook() ) - of components waiting for timer events on event ports. - - - You are advised to update your deployment to make use of the new timer ports. - - - -
-
- Deployment - - - - The Deployment XML format now also accepts an 'Affinity' field which allows to specify a - CPU mask on which the thread may run. - There is a new operation called 'setActivityOnCPU' which takes an affinity parameter - as well. - - - NOTE: this function is still experimental and not yet stable on Xenomai. - -
@@ -271,9 +219,9 @@ - The reporting component has been rewritten such that it behaves consistently. When - being periodic, it will sample all input ports at the frequency it runs. When being - triggered, it will log the ports which have new data. + The reporting component has been rewritten (again) boosting its performance sometimes a + 1000-fold (but at least a 100-fold), especially when using the NetCDF reporting component. We can now reliably log + a dozen ports at 1kHz, using only 10% cpu on an Intel i7 system. From 160defc3dd02bcc70ee7be09bcea134b6afd46b0 Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Wed, 21 Nov 2012 23:12:35 +0100 Subject: [PATCH 06/63] cmake: if IS_ROS_PACKAGE and generating for CDT, force the output paths Otherwise, it just won't generate a correct CDT project with most cmake versions. : Signed-off-by: Peter Soetens --- UseOROCOS-RTT.cmake | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/UseOROCOS-RTT.cmake b/UseOROCOS-RTT.cmake index 846ce88c1..4e38d9466 100644 --- a/UseOROCOS-RTT.cmake +++ b/UseOROCOS-RTT.cmake @@ -31,6 +31,14 @@ if(OROCOS-RTT_FOUND) if ( "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${path}" OR "${CMAKE_CURRENT_SOURCE_DIR}" MATCHES "${path}/" ) set(IS_ROS_PACKAGE TRUE) message("This package is in your ROS_PACKAGE_PATH, so I'm using rosbuild-style package building.") + + if (CMAKE_GENERATOR STREQUAL "Eclipse CDT4 - Unix Makefiles") + message("Eclipse Generator detected. I'm setting EXECUTABLE_OUTPUT_PATH and LIBRARY_OUTPUT_PATH") + #set the default path for built executables to the "bin" directory + set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) + #set the default path for built libraries to the "lib" directory + set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) + endif() endif() endforeach() From eb6c491489ed278265f9bd2b819483d044c3ec2c Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Thu, 22 Nov 2012 00:22:43 +0100 Subject: [PATCH 07/63] internal: code cleanup and re-ordering in BindStorage Let all cases inherit from RStore Log errors to Error, and not Debug Log errors in ExecutionEngine Signed-off-by: Peter Soetens --- rtt/ExecutionEngine.cpp | 9 ++ rtt/base/OperationCallerBase.hpp | 5 ++ rtt/internal/BindStorage.hpp | 108 ++++++++++++------------ rtt/internal/FusedFunctorDataSource.hpp | 1 - 4 files changed, 67 insertions(+), 56 deletions(-) diff --git a/rtt/ExecutionEngine.cpp b/rtt/ExecutionEngine.cpp index fa3f20913..58234fb08 100644 --- a/rtt/ExecutionEngine.cpp +++ b/rtt/ExecutionEngine.cpp @@ -406,6 +406,15 @@ namespace RTT } void ExecutionEngine::setExceptionTask() { + std::string name; + TaskContext* tc = dynamic_cast(taskc); + if (tc) + name = tc->getName(); + else if (taskc) + name = "TaskCore"; + else + name = "GlobalEngine"; + log(Error) << "in "<exception(); } diff --git a/rtt/base/OperationCallerBase.hpp b/rtt/base/OperationCallerBase.hpp index 98f3f15b8..f1578f32f 100644 --- a/rtt/base/OperationCallerBase.hpp +++ b/rtt/base/OperationCallerBase.hpp @@ -69,6 +69,11 @@ namespace RTT */ virtual OperationCallerBase* cloneI(ExecutionEngine* caller) const = 0; + /** + * Executed when the operation execution resulted in a + * C++ exception. Must report the error to the ExecutionEngine + * of the owner of this operation. + */ virtual void reportError() = 0; }; } diff --git a/rtt/internal/BindStorage.hpp b/rtt/internal/BindStorage.hpp index de7775a91..c7608dc96 100644 --- a/rtt/internal/BindStorage.hpp +++ b/rtt/internal/BindStorage.hpp @@ -70,7 +70,6 @@ namespace RTT T& get() { return arg; } void operator()(T a) { arg = a; } - operator T() { return arg;} }; @@ -84,26 +83,17 @@ namespace RTT T& get() { return *arg; } void operator()(T& a) { arg = &a; } - operator T&() { return *arg;} }; template std::ostream& operator<<(std::ostream& o, AStore& a) { o << "aarg:"< - struct RStore { - T arg; + template<> + struct RStore { bool executed; bool error; - RStore() : arg(), executed(false), error(false) {} + RStore() : executed(false), error(false) {} void checkError() const { if(error) throw std::runtime_error("Unable to complete the operation call. The called operation has thrown an exception"); @@ -117,10 +107,39 @@ namespace RTT return executed; } - //bool operator()() { return executed; } + template + void exec(F f) { + error = false; + try{ + f(); + } catch (std::exception& e) { + log(Error) << "Exception raised while executing an operation : " << e.what() << Logger::nl; + exception_what = e.what(); + error = true; + } catch (...) { + exception_what = "Unknown exception raised while executing an operation."; + error = true; + } + executed = true; + } + + void result() { checkError(); return; } + }; + + /** + * Store a return value which may be a void, reference, const reference or + * any other type. We need these specialisations because the collection + * of the results will be different if R is non-void or poid (appears as + * first arg of collect() or not respectively). So RStore is the only + * instance that knows if a return value was stored or not. + */ + template + struct RStore : public RStore { + T arg; + RStore() : arg() {} T& result() { checkError(); return arg; } - operator T&() { checkError(); return arg;} + operator T&() { return arg;} /** * Stores the result of a function. @@ -133,6 +152,9 @@ namespace RTT error = false; try{ arg = f(); + } catch (std::exception& e) { + log(Error) << "Exception raised while executing an operation : " << e.what() << Logger::nl; + error = true; } catch (...) { error = true; } @@ -141,31 +163,20 @@ namespace RTT }; template - struct RStore + struct RStore : public RStore { T* arg; - bool executed; - bool error; - RStore() : arg(), executed(false), error(false) {} - - void checkError() const { - if(error) throw std::runtime_error("Unable to complete the operation call. The called operation has thrown an exception"); - } - - bool isError() const { - return error; - } - - bool isExecuted() const { - return executed; - } + RStore() : arg() {} template void exec(F f) { error = false; try{ arg = &f(); - } catch(...) { + } catch (std::exception& e) { + log(Error) << "Exception raised while executing an operation : " << e.what() << endlog(); + error = true; + } catch (...) { error = true; } executed = true; @@ -178,28 +189,12 @@ namespace RTT }; template - struct RStore { + struct RStore : public RStore { T arg; - bool executed; - bool error; - RStore() : arg(), executed(false), error(false) {} - - void checkError() const { - if(error) throw std::runtime_error("Unable to complete the operation call. The called operation has thrown an exception"); - } - - bool isError() const { - return error; - } - - bool isExecuted() const { - return executed; - } - - //bool operator()() { return executed; } + RStore() : arg() {} T& result() { checkError(); return arg; } - operator T&() { return arg;} + operator T&() { checkError(); return arg;} /** * Stores the result of a function. @@ -212,6 +207,9 @@ namespace RTT error = false; try{ arg = f(); + } catch (std::exception& e) { + log(Error) << "Exception raised while executing an operation : " << e.what() << endlog(); + error = true; } catch(...) { error = true; } @@ -243,15 +241,15 @@ namespace RTT error = false; try{ f(); - } catch(...) { + } catch (std::exception& e) { + log(Error) << "Exception raised while executing an operation : " << e.what() << endlog(); + error = true; + } catch (...) { error = true; } executed = true; } - //bool operator()() { return executed; } - - void result() { checkError(); return; } }; template diff --git a/rtt/internal/FusedFunctorDataSource.hpp b/rtt/internal/FusedFunctorDataSource.hpp index f920c28a8..d9edb1d00 100644 --- a/rtt/internal/FusedFunctorDataSource.hpp +++ b/rtt/internal/FusedFunctorDataSource.hpp @@ -307,7 +307,6 @@ namespace RTT value_t get() const { FusedMCallDataSource::evaluate(); - ret.checkError(); return ret.result(); } From 0ab6990da1daf296a18d20f23cb0533ff54f98f8 Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Thu, 22 Nov 2012 00:53:20 +0100 Subject: [PATCH 08/63] operations: reorganize code such that local operation objects are lighter code-size We move some generic functions to template-less base classes. From a memory footprint perspective, it remains the same, or even increases for RemoteOperationCallers, but decreases the virtual function table sizes. Signed-off-by: Peter Soetens --- rtt/base/OperationCallerBase.hpp | 6 -- rtt/base/OperationCallerInterface.cpp | 51 ++++++++++++++ rtt/base/OperationCallerInterface.hpp | 38 ++++++++-- rtt/internal/LocalOperationCaller.hpp | 96 ++++++++------------------ rtt/internal/RemoteOperationCaller.hpp | 18 ----- rtt/scripting/ScriptParser.cpp | 1 + 6 files changed, 112 insertions(+), 98 deletions(-) create mode 100644 rtt/base/OperationCallerInterface.cpp diff --git a/rtt/base/OperationCallerBase.hpp b/rtt/base/OperationCallerBase.hpp index f1578f32f..eb5876048 100644 --- a/rtt/base/OperationCallerBase.hpp +++ b/rtt/base/OperationCallerBase.hpp @@ -69,12 +69,6 @@ namespace RTT */ virtual OperationCallerBase* cloneI(ExecutionEngine* caller) const = 0; - /** - * Executed when the operation execution resulted in a - * C++ exception. Must report the error to the ExecutionEngine - * of the owner of this operation. - */ - virtual void reportError() = 0; }; } } diff --git a/rtt/base/OperationCallerInterface.cpp b/rtt/base/OperationCallerInterface.cpp new file mode 100644 index 000000000..2893d421b --- /dev/null +++ b/rtt/base/OperationCallerInterface.cpp @@ -0,0 +1,51 @@ +#include "OperationCallerInterface.hpp" +#include "../internal/GlobalEngine.hpp" + +using namespace RTT; +using namespace base; +using namespace internal; + +OperationCallerInterface::OperationCallerInterface() + : myengine(0), caller(0), ownerEngine(0), met(OwnThread) +{} + +OperationCallerInterface::~OperationCallerInterface() +{ +} + +void OperationCallerInterface::setOwner(ExecutionEngine* ee) { + ownerEngine = ee; +} + +void OperationCallerInterface::setExecutor(ExecutionEngine* ee) { + if (met == OwnThread) + myengine = ee; + else + myengine = GlobalEngine::Instance(); +} + +void OperationCallerInterface::setCaller(ExecutionEngine* ee) { + if (ee) + caller = ee; + else + caller = GlobalEngine::Instance(); +} + +bool OperationCallerInterface::setThread(ExecutionThread et, ExecutionEngine* executor) { + if ( !myengine && !caller && !ownerEngine ) + return false; // detect uninitialized object. This is actually a hack for RemoteOperationCaller. + met = et; + setExecutor(executor); + return true; +} + +// report an error if an exception was thrown while calling exec() +void OperationCallerInterface::reportError() { + // This localOperation was added to a TaskContext or to a Service owned by a TaskContext + if (this->ownerEngine != 0) + this->ownerEngine->setExceptionTask(); + // This operation is called through OperationCaller directly + else if (this->met == OwnThread) + this->myengine->setExceptionTask(); +} + diff --git a/rtt/base/OperationCallerInterface.hpp b/rtt/base/OperationCallerInterface.hpp index b00366498..169d89862 100644 --- a/rtt/base/OperationCallerInterface.hpp +++ b/rtt/base/OperationCallerInterface.hpp @@ -20,9 +20,9 @@ namespace RTT */ typedef boost::shared_ptr shared_ptr; - virtual ~OperationCallerInterface() - { - } + OperationCallerInterface(); + + virtual ~OperationCallerInterface(); /** * Available such that implementations have a way to @@ -30,6 +30,13 @@ namespace RTT */ virtual bool ready() const = 0; + /** + * Set the ExecutionEngine of the task which owns this method. + * @param ee The ExecutionEngine of the component that + * owns this operation. + */ + void setOwner(ExecutionEngine* ee); + /** * Set an executor which will execute this method * when it is called or sent. If ee is set to 0, @@ -38,7 +45,7 @@ namespace RTT * @param ee The ExecutionEngine of the component that * is executing this operation. */ - virtual void setExecutor(ExecutionEngine* ee) = 0; + void setExecutor(ExecutionEngine* ee); /** * Sets the caller's engine of this operation. @@ -47,7 +54,7 @@ namespace RTT * @param ee The ExecutionEngine of the component that * is calling this operation. */ - virtual void setCaller(ExecutionEngine* ee) = 0; + void setCaller(ExecutionEngine* ee); /** * Sets the Thread execution policy of this object. @@ -57,8 +64,25 @@ namespace RTT * executor may be null. * @return false if it may not be modified. */ - virtual bool setThread(ExecutionThread et, - ExecutionEngine* executor) = 0; + bool setThread(ExecutionThread et, + ExecutionEngine* executor); + + /** + * Executed when the operation execution resulted in a + * C++ exception. Must report the error to the ExecutionEngine + * of the owner of this operation. + */ + void reportError(); + + /** + * Helpful function to tell us if this operations is to be sent or not. + */ + bool isSend() { return met == OwnThread && myengine != caller; } + protected: + ExecutionEngine* myengine; + ExecutionEngine* caller; + ExecutionEngine* ownerEngine; + ExecutionThread met; }; } } diff --git a/rtt/internal/LocalOperationCaller.hpp b/rtt/internal/LocalOperationCaller.hpp index c81a17f0e..b71b02940 100644 --- a/rtt/internal/LocalOperationCaller.hpp +++ b/rtt/internal/LocalOperationCaller.hpp @@ -51,7 +51,6 @@ #include "../SendHandle.hpp" #include "../ExecutionEngine.hpp" #include "OperationCallerBinder.hpp" -#include "GlobalEngine.hpp" #include #include "../os/oro_allocator.hpp" @@ -81,7 +80,7 @@ namespace RTT protected BindStorage { public: - LocalOperationCallerImpl() : myengine(GlobalEngine::Instance()), caller(GlobalEngine::Instance()) {} + LocalOperationCallerImpl() {} typedef FunctionT Signature; typedef typename boost::function_traits::result_type result_type; typedef typename boost::function_traits::result_type result_reference; @@ -97,26 +96,6 @@ namespace RTT return this->retv.isError(); } - virtual void setExecutor(ExecutionEngine* ee) { - if (met == OwnThread) - myengine = ee; - else - myengine = GlobalEngine::Instance(); - } - - virtual void setCaller(ExecutionEngine* ee) { - if (ee) - caller = ee; - else - caller = GlobalEngine::Instance(); - } - - virtual bool setThread(ExecutionThread et, ExecutionEngine* executor) { - met = et; - setExecutor(executor); - return true; - } - void executeAndDispose() { if (!this->retv.isExecuted()) { this->exec(); // calls BindStorage. @@ -124,8 +103,8 @@ namespace RTT if(this->retv.isError()) this->reportError(); bool result = false; - if (caller){ - result = caller->process(this); + if ( this->caller){ + result = this->caller->process(this); } if (!result) dispose(); @@ -151,22 +130,12 @@ namespace RTT } - // report an error if an exception was thrown while calling exec() - virtual void reportError() { - // This localOperation was added to a TaskContext or to a Service owned by a TaskContext - if (this->ownerEngine != NULL) - this->ownerEngine->setExceptionTask(); - // This operation is called through OperationCaller directly - else if (this->met == OwnThread) - this->myengine->setExceptionTask(); - } - - ExecutionEngine* getMessageProcessor() const { return myengine; } + ExecutionEngine* getMessageProcessor() const { return this->myengine; } SendHandle do_send(shared_ptr cl) { - assert(myengine); // myengine must be either the caller's engine or GlobalEngine::Instance(). + assert(this->myengine); // myengine must be either the caller's engine or GlobalEngine::Instance(). //std::cout << "Sending clone..."<process( cl.get() ) ) { + if ( this->myengine->process( cl.get() ) ) { cl->self = cl; return SendHandle( cl ); } else { @@ -319,24 +288,24 @@ namespace RTT } SendStatus collect_impl() { - caller->waitForMessages( boost::bind(&Store::RStoreType::isExecuted,boost::ref(this->retv)) ); + this->caller->waitForMessages( boost::bind(&Store::RStoreType::isExecuted,boost::ref(this->retv)) ); return this->collectIfDone_impl(); } template SendStatus collect_impl( T1& a1 ) { - caller->waitForMessages( boost::bind(&Store::RStoreType::isExecuted,boost::ref(this->retv)) ); + this->caller->waitForMessages( boost::bind(&Store::RStoreType::isExecuted,boost::ref(this->retv)) ); return this->collectIfDone_impl(a1); } template SendStatus collect_impl( T1& a1, T2& a2 ) { - caller->waitForMessages( boost::bind(&Store::RStoreType::isExecuted,boost::ref(this->retv)) ); + this->caller->waitForMessages( boost::bind(&Store::RStoreType::isExecuted,boost::ref(this->retv)) ); return this->collectIfDone_impl(a1,a2); } template SendStatus collect_impl( T1& a1, T2& a2, T3& a3 ) { - caller->waitForMessages( boost::bind(&Store::RStoreType::isExecuted,boost::ref(this->retv)) ); + this->caller->waitForMessages( boost::bind(&Store::RStoreType::isExecuted,boost::ref(this->retv)) ); return this->collectIfDone_impl(a1,a2,a3); } @@ -346,7 +315,7 @@ namespace RTT result_type call_impl() { - if (met == OwnThread && myengine != caller) { + if ( this->isSend() ) { SendHandle h = send_impl(); if ( h.collect() == SendSuccess ) return h.ret(); @@ -371,7 +340,7 @@ namespace RTT result_type call_impl(T1 a1) { SendHandle h; - if (met == OwnThread && myengine != caller) { + if ( this->isSend() ) { h = send_impl(a1); // collect_impl may take diff number of arguments than // call_impl/ret_impl(), so we use generic collect() + ret_impl() @@ -395,7 +364,7 @@ namespace RTT result_type call_impl(T1 a1, T2 a2) { SendHandle h; - if (met == OwnThread && myengine != caller) { + if ( this->isSend() ) { h = send_impl(a1,a2); if ( h.collect() == SendSuccess ) return h.ret(a1,a2); @@ -417,7 +386,7 @@ namespace RTT result_type call_impl(T1 a1, T2 a2, T3 a3) { SendHandle h; - if (met == OwnThread && myengine != caller) { + if ( this->isSend() ) { h = send_impl(a1,a2,a3); if ( h.collect() == SendSuccess ) return h.ret(a1,a2,a3); @@ -439,7 +408,7 @@ namespace RTT result_type call_impl(T1 a1, T2 a2, T3 a3, T4 a4) { SendHandle h; - if (met == OwnThread && myengine != caller) { + if ( this->isSend() ) { h = send_impl(a1,a2,a3,a4); if ( h.collect() == SendSuccess ) return h.ret(a1,a2,a3,a4); @@ -461,7 +430,7 @@ namespace RTT result_type call_impl(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) { SendHandle h; - if (met == OwnThread && myengine != caller) { + if (this->isSend()) { h = send_impl(a1,a2,a3,a4,a5); if ( h.collect() == SendSuccess ) return h.ret(a1,a2,a3,a4,a5); @@ -483,7 +452,7 @@ namespace RTT result_type call_impl(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) { SendHandle h; - if (met == OwnThread && myengine != caller) { + if (this->isSend()) { h = send_impl(a1,a2,a3,a4,a5,a6); if ( h.collect() == SendSuccess ) return h.ret(a1,a2,a3,a4,a5,a6); @@ -505,7 +474,7 @@ namespace RTT result_type call_impl(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) { SendHandle h; - if (met == OwnThread && myengine != caller) { + if (this->isSend()) { h = send_impl(a1,a2,a3,a4,a5,a6,a7); if ( h.collect() == SendSuccess ) return h.ret(a1,a2,a3,a4,a5,a6,a7); @@ -613,11 +582,7 @@ namespace RTT virtual shared_ptr cloneRT() const = 0; protected: - ExecutionEngine* myengine; - ExecutionEngine* caller; - ExecutionEngine* ownerEngine; typedef BindStorage Store; - ExecutionThread met; /** * Used to refcount self as long as dispose() is not called. * This refcount is real-time since both shared_ptr and object @@ -657,38 +622,35 @@ namespace RTT * Construct a LocalOperationCaller from a class member pointer and an * object of that class. * - * @param name The name of this method * @param meth A pointer to a class member function * @param object An object of the class which has \a meth as member function. + * @param ee The executing engine. This is the owner engine or the GlobalEngine. If null, will be the GlobalEngine. + * @param caller The caller engine. From which component we call this Operation. + * @param oe The owner engine. In which component this Operation lives */ template LocalOperationCaller(M meth, ObjectType object, ExecutionEngine* ee, ExecutionEngine* caller, ExecutionThread et = ClientThread, ExecutionEngine* oe = NULL ) { - if (!ee) - ee = GlobalEngine::Instance(); + this->setExecutor( ee ); + this->setCaller( caller ); + this->setOwner(ee); + this->setThread( et, ee ); this->mmeth = OperationCallerBinder()(meth, object); - this->myengine = ee; - this->caller = caller; - this->ownerEngine = oe; - this->met = et; } /** * Construct a LocalOperationCaller from a function pointer or function object. * - * @param name the name of this method * @param meth an pointer to a function or function object. */ template LocalOperationCaller(M meth, ExecutionEngine* ee, ExecutionEngine* caller, ExecutionThread et = ClientThread, ExecutionEngine* oe = NULL ) { - if (!ee) - ee = GlobalEngine::Instance(); + this->setExecutor( ee ); + this->setCaller( caller ); + this->setOwner(ee); + this->setThread( et, ee ); this->mmeth = meth; - this->myengine = ee; - this->caller = caller; - this->ownerEngine = oe; - this->met = et; } boost::function getOperationCallerFunction() const diff --git a/rtt/internal/RemoteOperationCaller.hpp b/rtt/internal/RemoteOperationCaller.hpp index 13d902fbd..edf8be0dd 100644 --- a/rtt/internal/RemoteOperationCaller.hpp +++ b/rtt/internal/RemoteOperationCaller.hpp @@ -99,14 +99,6 @@ namespace RTT virtual bool isError() const { return false; } virtual void dispose() { assert(false); } - virtual void setExecutor(ExecutionEngine* ee) { - } - - virtual void setCaller(ExecutionEngine* ee) { - } - - virtual void reportError() {} - /** * Call this operator if the RemoteOperationCaller takes no arguments. * @@ -437,20 +429,10 @@ namespace RTT this->mhandle.setAutoCollect(false); } - virtual void readArguments() {} - virtual bool ready() const { return this->mmeth.ready(); } - virtual bool execute() { - return this->mmeth.call(); - } - - virtual bool setThread(ExecutionThread, ExecutionEngine* ) { - return false; - } - virtual base::OperationCallerBase* cloneI(ExecutionEngine* caller) const { RemoteOperationCaller* rm = new RemoteOperationCaller( this->mmeth.getOrp(), this->mmeth.getName(), caller); return rm; diff --git a/rtt/scripting/ScriptParser.cpp b/rtt/scripting/ScriptParser.cpp index 3bff0e465..bfd3af198 100644 --- a/rtt/scripting/ScriptParser.cpp +++ b/rtt/scripting/ScriptParser.cpp @@ -17,6 +17,7 @@ #include #include #include "../internal/mystd.hpp" +#include "../internal/GlobalEngine.hpp" #include "ParsedStateMachine.hpp" namespace RTT From 85643b95303163f5c3521725aab7be635c7ca999 Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Thu, 22 Nov 2012 00:53:20 +0100 Subject: [PATCH 09/63] operations: reorganize code such that local operation objects are lighter code-size We save some code duplication by moving some generic functions to template-less base classes. From a memory footprint perspective, it remains the same, or even increases for RemoteOperationCallers, but decreases the virtual function table sizes. Signed-off-by: Peter Soetens --- rtt/ExecutionEngine.cpp | 1 + rtt/base/OperationCallerBase.hpp | 6 -- rtt/base/OperationCallerInterface.cpp | 58 +++++++++++++++ rtt/base/OperationCallerInterface.hpp | 40 +++++++++-- rtt/internal/BindStorage.hpp | 45 ++---------- rtt/internal/FusedFunctorDataSource.hpp | 2 +- rtt/internal/LocalOperationCaller.hpp | 96 ++++++++----------------- rtt/internal/RemoteOperationCaller.hpp | 18 ----- rtt/scripting/ScriptParser.cpp | 1 + 9 files changed, 130 insertions(+), 137 deletions(-) create mode 100644 rtt/base/OperationCallerInterface.cpp diff --git a/rtt/ExecutionEngine.cpp b/rtt/ExecutionEngine.cpp index 58234fb08..4bde246b1 100644 --- a/rtt/ExecutionEngine.cpp +++ b/rtt/ExecutionEngine.cpp @@ -43,6 +43,7 @@ #include "rtt-fwd.hpp" #include "os/MutexLock.hpp" #include "internal/MWSRQueue.hpp" +#include "TaskContext.hpp" #include #include diff --git a/rtt/base/OperationCallerBase.hpp b/rtt/base/OperationCallerBase.hpp index f1578f32f..eb5876048 100644 --- a/rtt/base/OperationCallerBase.hpp +++ b/rtt/base/OperationCallerBase.hpp @@ -69,12 +69,6 @@ namespace RTT */ virtual OperationCallerBase* cloneI(ExecutionEngine* caller) const = 0; - /** - * Executed when the operation execution resulted in a - * C++ exception. Must report the error to the ExecutionEngine - * of the owner of this operation. - */ - virtual void reportError() = 0; }; } } diff --git a/rtt/base/OperationCallerInterface.cpp b/rtt/base/OperationCallerInterface.cpp new file mode 100644 index 000000000..e090ddb4b --- /dev/null +++ b/rtt/base/OperationCallerInterface.cpp @@ -0,0 +1,58 @@ +#include "OperationCallerInterface.hpp" +#include "../internal/GlobalEngine.hpp" + +using namespace RTT; +using namespace base; +using namespace internal; + +OperationCallerInterface::OperationCallerInterface() + : myengine(0), caller(0), ownerEngine(0), met(OwnThread) +{} + +OperationCallerInterface::OperationCallerInterface(OperationCallerInterface const& orig) + : myengine(orig.myengine), caller(orig.caller), ownerEngine(orig.ownerEngine), met(orig.met) +{} + +OperationCallerInterface::~OperationCallerInterface() +{ +} + +void OperationCallerInterface::setOwner(ExecutionEngine* ee) { + ownerEngine = ee; +} + +void OperationCallerInterface::setExecutor(ExecutionEngine* ee) { + if (met == OwnThread) + myengine = ee; + else + myengine = GlobalEngine::Instance(); +} + +void OperationCallerInterface::setCaller(ExecutionEngine* ee) { + if (ee) + caller = ee; + else + caller = GlobalEngine::Instance(); +} + +bool OperationCallerInterface::setThread(ExecutionThread et, ExecutionEngine* executor) { + if ( !myengine && !caller && !ownerEngine ) + return false; // detect uninitialized object. This is actually a hack for RemoteOperationCaller. + met = et; + setExecutor(executor); + return true; +} + +#include "../Logger.hpp" + +// report an error if an exception was thrown while calling exec() +void OperationCallerInterface::reportError() { + // This localOperation was added to a TaskContext or to a Service owned by a TaskContext + log(Error) <<"reportError: owner is" << ownerEngine <ownerEngine != 0) + this->ownerEngine->setExceptionTask(); + // This operation is called through OperationCaller directly + else if (this->met == OwnThread) + this->myengine->setExceptionTask(); +} + diff --git a/rtt/base/OperationCallerInterface.hpp b/rtt/base/OperationCallerInterface.hpp index b00366498..24869c6ad 100644 --- a/rtt/base/OperationCallerInterface.hpp +++ b/rtt/base/OperationCallerInterface.hpp @@ -20,9 +20,11 @@ namespace RTT */ typedef boost::shared_ptr shared_ptr; - virtual ~OperationCallerInterface() - { - } + OperationCallerInterface(); + + OperationCallerInterface(OperationCallerInterface const& orig); + + virtual ~OperationCallerInterface(); /** * Available such that implementations have a way to @@ -30,6 +32,13 @@ namespace RTT */ virtual bool ready() const = 0; + /** + * Set the ExecutionEngine of the task which owns this method. + * @param ee The ExecutionEngine of the component that + * owns this operation. + */ + void setOwner(ExecutionEngine* ee); + /** * Set an executor which will execute this method * when it is called or sent. If ee is set to 0, @@ -38,7 +47,7 @@ namespace RTT * @param ee The ExecutionEngine of the component that * is executing this operation. */ - virtual void setExecutor(ExecutionEngine* ee) = 0; + void setExecutor(ExecutionEngine* ee); /** * Sets the caller's engine of this operation. @@ -47,7 +56,7 @@ namespace RTT * @param ee The ExecutionEngine of the component that * is calling this operation. */ - virtual void setCaller(ExecutionEngine* ee) = 0; + void setCaller(ExecutionEngine* ee); /** * Sets the Thread execution policy of this object. @@ -57,8 +66,25 @@ namespace RTT * executor may be null. * @return false if it may not be modified. */ - virtual bool setThread(ExecutionThread et, - ExecutionEngine* executor) = 0; + bool setThread(ExecutionThread et, + ExecutionEngine* executor); + + /** + * Executed when the operation execution resulted in a + * C++ exception. Must report the error to the ExecutionEngine + * of the owner of this operation. + */ + void reportError(); + + /** + * Helpful function to tell us if this operations is to be sent or not. + */ + bool isSend() { return met == OwnThread && myengine != caller; } + protected: + ExecutionEngine* myengine; + ExecutionEngine* caller; + ExecutionEngine* ownerEngine; + ExecutionThread met; }; } } diff --git a/rtt/internal/BindStorage.hpp b/rtt/internal/BindStorage.hpp index c7608dc96..791d25126 100644 --- a/rtt/internal/BindStorage.hpp +++ b/rtt/internal/BindStorage.hpp @@ -113,11 +113,10 @@ namespace RTT try{ f(); } catch (std::exception& e) { - log(Error) << "Exception raised while executing an operation : " << e.what() << Logger::nl; - exception_what = e.what(); + log(Error) << "Exception raised while executing an operation : " << e.what() << endlog(); error = true; } catch (...) { - exception_what = "Unknown exception raised while executing an operation."; + log(Error) << "Unknown exception raised while executing an operation." << endlog(); error = true; } executed = true; @@ -126,6 +125,7 @@ namespace RTT void result() { checkError(); return; } }; + /** * Store a return value which may be a void, reference, const reference or * any other type. We need these specialisations because the collection @@ -153,9 +153,10 @@ namespace RTT try{ arg = f(); } catch (std::exception& e) { - log(Error) << "Exception raised while executing an operation : " << e.what() << Logger::nl; + log(Error) << "Exception raised while executing an operation : " << e.what() << endlog(); error = true; } catch (...) { + log(Error) << "Unknown exception raised while executing an operation." << endlog(); error = true; } executed = true; @@ -177,6 +178,7 @@ namespace RTT log(Error) << "Exception raised while executing an operation : " << e.what() << endlog(); error = true; } catch (...) { + log(Error) << "Unknown exception raised while executing an operation." << endlog(); error = true; } executed = true; @@ -211,40 +213,7 @@ namespace RTT log(Error) << "Exception raised while executing an operation : " << e.what() << endlog(); error = true; } catch(...) { - error = true; - } - executed = true; - } - - }; - - template<> - struct RStore { - bool executed; - bool error; - RStore() : executed(false), error(false) {} - - void checkError() const { - if(error) throw std::runtime_error("Unable to complete the operation call. The called operation has thrown an exception"); - } - - bool isError() const { - return error; - } - - bool isExecuted() const { - return executed; - } - - template - void exec(F f) { - error = false; - try{ - f(); - } catch (std::exception& e) { - log(Error) << "Exception raised while executing an operation : " << e.what() << endlog(); - error = true; - } catch (...) { + log(Error) << "Unknown exception raised while executing an operation." << endlog(); error = true; } executed = true; diff --git a/rtt/internal/FusedFunctorDataSource.hpp b/rtt/internal/FusedFunctorDataSource.hpp index d9edb1d00..14690d829 100644 --- a/rtt/internal/FusedFunctorDataSource.hpp +++ b/rtt/internal/FusedFunctorDataSource.hpp @@ -306,7 +306,7 @@ namespace RTT value_t get() const { - FusedMCallDataSource::evaluate(); + evaluate(); return ret.result(); } diff --git a/rtt/internal/LocalOperationCaller.hpp b/rtt/internal/LocalOperationCaller.hpp index c81a17f0e..6fd04db76 100644 --- a/rtt/internal/LocalOperationCaller.hpp +++ b/rtt/internal/LocalOperationCaller.hpp @@ -51,7 +51,6 @@ #include "../SendHandle.hpp" #include "../ExecutionEngine.hpp" #include "OperationCallerBinder.hpp" -#include "GlobalEngine.hpp" #include #include "../os/oro_allocator.hpp" @@ -81,7 +80,7 @@ namespace RTT protected BindStorage { public: - LocalOperationCallerImpl() : myengine(GlobalEngine::Instance()), caller(GlobalEngine::Instance()) {} + LocalOperationCallerImpl() {} typedef FunctionT Signature; typedef typename boost::function_traits::result_type result_type; typedef typename boost::function_traits::result_type result_reference; @@ -97,26 +96,6 @@ namespace RTT return this->retv.isError(); } - virtual void setExecutor(ExecutionEngine* ee) { - if (met == OwnThread) - myengine = ee; - else - myengine = GlobalEngine::Instance(); - } - - virtual void setCaller(ExecutionEngine* ee) { - if (ee) - caller = ee; - else - caller = GlobalEngine::Instance(); - } - - virtual bool setThread(ExecutionThread et, ExecutionEngine* executor) { - met = et; - setExecutor(executor); - return true; - } - void executeAndDispose() { if (!this->retv.isExecuted()) { this->exec(); // calls BindStorage. @@ -124,8 +103,8 @@ namespace RTT if(this->retv.isError()) this->reportError(); bool result = false; - if (caller){ - result = caller->process(this); + if ( this->caller){ + result = this->caller->process(this); } if (!result) dispose(); @@ -151,22 +130,12 @@ namespace RTT } - // report an error if an exception was thrown while calling exec() - virtual void reportError() { - // This localOperation was added to a TaskContext or to a Service owned by a TaskContext - if (this->ownerEngine != NULL) - this->ownerEngine->setExceptionTask(); - // This operation is called through OperationCaller directly - else if (this->met == OwnThread) - this->myengine->setExceptionTask(); - } - - ExecutionEngine* getMessageProcessor() const { return myengine; } + ExecutionEngine* getMessageProcessor() const { return this->myengine; } SendHandle do_send(shared_ptr cl) { - assert(myengine); // myengine must be either the caller's engine or GlobalEngine::Instance(). + assert(this->myengine); // myengine must be either the caller's engine or GlobalEngine::Instance(). //std::cout << "Sending clone..."<process( cl.get() ) ) { + if ( this->myengine->process( cl.get() ) ) { cl->self = cl; return SendHandle( cl ); } else { @@ -319,24 +288,24 @@ namespace RTT } SendStatus collect_impl() { - caller->waitForMessages( boost::bind(&Store::RStoreType::isExecuted,boost::ref(this->retv)) ); + this->caller->waitForMessages( boost::bind(&Store::RStoreType::isExecuted,boost::ref(this->retv)) ); return this->collectIfDone_impl(); } template SendStatus collect_impl( T1& a1 ) { - caller->waitForMessages( boost::bind(&Store::RStoreType::isExecuted,boost::ref(this->retv)) ); + this->caller->waitForMessages( boost::bind(&Store::RStoreType::isExecuted,boost::ref(this->retv)) ); return this->collectIfDone_impl(a1); } template SendStatus collect_impl( T1& a1, T2& a2 ) { - caller->waitForMessages( boost::bind(&Store::RStoreType::isExecuted,boost::ref(this->retv)) ); + this->caller->waitForMessages( boost::bind(&Store::RStoreType::isExecuted,boost::ref(this->retv)) ); return this->collectIfDone_impl(a1,a2); } template SendStatus collect_impl( T1& a1, T2& a2, T3& a3 ) { - caller->waitForMessages( boost::bind(&Store::RStoreType::isExecuted,boost::ref(this->retv)) ); + this->caller->waitForMessages( boost::bind(&Store::RStoreType::isExecuted,boost::ref(this->retv)) ); return this->collectIfDone_impl(a1,a2,a3); } @@ -346,7 +315,7 @@ namespace RTT result_type call_impl() { - if (met == OwnThread && myengine != caller) { + if ( this->isSend() ) { SendHandle h = send_impl(); if ( h.collect() == SendSuccess ) return h.ret(); @@ -371,7 +340,7 @@ namespace RTT result_type call_impl(T1 a1) { SendHandle h; - if (met == OwnThread && myengine != caller) { + if ( this->isSend() ) { h = send_impl(a1); // collect_impl may take diff number of arguments than // call_impl/ret_impl(), so we use generic collect() + ret_impl() @@ -395,7 +364,7 @@ namespace RTT result_type call_impl(T1 a1, T2 a2) { SendHandle h; - if (met == OwnThread && myengine != caller) { + if ( this->isSend() ) { h = send_impl(a1,a2); if ( h.collect() == SendSuccess ) return h.ret(a1,a2); @@ -417,7 +386,7 @@ namespace RTT result_type call_impl(T1 a1, T2 a2, T3 a3) { SendHandle h; - if (met == OwnThread && myengine != caller) { + if ( this->isSend() ) { h = send_impl(a1,a2,a3); if ( h.collect() == SendSuccess ) return h.ret(a1,a2,a3); @@ -439,7 +408,7 @@ namespace RTT result_type call_impl(T1 a1, T2 a2, T3 a3, T4 a4) { SendHandle h; - if (met == OwnThread && myengine != caller) { + if ( this->isSend() ) { h = send_impl(a1,a2,a3,a4); if ( h.collect() == SendSuccess ) return h.ret(a1,a2,a3,a4); @@ -461,7 +430,7 @@ namespace RTT result_type call_impl(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) { SendHandle h; - if (met == OwnThread && myengine != caller) { + if (this->isSend()) { h = send_impl(a1,a2,a3,a4,a5); if ( h.collect() == SendSuccess ) return h.ret(a1,a2,a3,a4,a5); @@ -483,7 +452,7 @@ namespace RTT result_type call_impl(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) { SendHandle h; - if (met == OwnThread && myengine != caller) { + if (this->isSend()) { h = send_impl(a1,a2,a3,a4,a5,a6); if ( h.collect() == SendSuccess ) return h.ret(a1,a2,a3,a4,a5,a6); @@ -505,7 +474,7 @@ namespace RTT result_type call_impl(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7) { SendHandle h; - if (met == OwnThread && myengine != caller) { + if (this->isSend()) { h = send_impl(a1,a2,a3,a4,a5,a6,a7); if ( h.collect() == SendSuccess ) return h.ret(a1,a2,a3,a4,a5,a6,a7); @@ -613,11 +582,7 @@ namespace RTT virtual shared_ptr cloneRT() const = 0; protected: - ExecutionEngine* myengine; - ExecutionEngine* caller; - ExecutionEngine* ownerEngine; typedef BindStorage Store; - ExecutionThread met; /** * Used to refcount self as long as dispose() is not called. * This refcount is real-time since both shared_ptr and object @@ -657,38 +622,35 @@ namespace RTT * Construct a LocalOperationCaller from a class member pointer and an * object of that class. * - * @param name The name of this method * @param meth A pointer to a class member function * @param object An object of the class which has \a meth as member function. + * @param ee The executing engine. This is the owner engine or the GlobalEngine. If null, will be the GlobalEngine. + * @param caller The caller engine. From which component we call this Operation. + * @param oe The owner engine. In which component this Operation lives */ template LocalOperationCaller(M meth, ObjectType object, ExecutionEngine* ee, ExecutionEngine* caller, ExecutionThread et = ClientThread, ExecutionEngine* oe = NULL ) { - if (!ee) - ee = GlobalEngine::Instance(); + this->setExecutor( ee ); + this->setCaller( caller ); + this->setOwner(oe); + this->setThread( et, ee ); this->mmeth = OperationCallerBinder()(meth, object); - this->myengine = ee; - this->caller = caller; - this->ownerEngine = oe; - this->met = et; } /** * Construct a LocalOperationCaller from a function pointer or function object. * - * @param name the name of this method * @param meth an pointer to a function or function object. */ template LocalOperationCaller(M meth, ExecutionEngine* ee, ExecutionEngine* caller, ExecutionThread et = ClientThread, ExecutionEngine* oe = NULL ) { - if (!ee) - ee = GlobalEngine::Instance(); + this->setExecutor( ee ); + this->setCaller( caller ); + this->setOwner(oe); + this->setThread( et, ee ); this->mmeth = meth; - this->myengine = ee; - this->caller = caller; - this->ownerEngine = oe; - this->met = et; } boost::function getOperationCallerFunction() const diff --git a/rtt/internal/RemoteOperationCaller.hpp b/rtt/internal/RemoteOperationCaller.hpp index 13d902fbd..edf8be0dd 100644 --- a/rtt/internal/RemoteOperationCaller.hpp +++ b/rtt/internal/RemoteOperationCaller.hpp @@ -99,14 +99,6 @@ namespace RTT virtual bool isError() const { return false; } virtual void dispose() { assert(false); } - virtual void setExecutor(ExecutionEngine* ee) { - } - - virtual void setCaller(ExecutionEngine* ee) { - } - - virtual void reportError() {} - /** * Call this operator if the RemoteOperationCaller takes no arguments. * @@ -437,20 +429,10 @@ namespace RTT this->mhandle.setAutoCollect(false); } - virtual void readArguments() {} - virtual bool ready() const { return this->mmeth.ready(); } - virtual bool execute() { - return this->mmeth.call(); - } - - virtual bool setThread(ExecutionThread, ExecutionEngine* ) { - return false; - } - virtual base::OperationCallerBase* cloneI(ExecutionEngine* caller) const { RemoteOperationCaller* rm = new RemoteOperationCaller( this->mmeth.getOrp(), this->mmeth.getName(), caller); return rm; diff --git a/rtt/scripting/ScriptParser.cpp b/rtt/scripting/ScriptParser.cpp index 3bff0e465..bfd3af198 100644 --- a/rtt/scripting/ScriptParser.cpp +++ b/rtt/scripting/ScriptParser.cpp @@ -17,6 +17,7 @@ #include #include #include "../internal/mystd.hpp" +#include "../internal/GlobalEngine.hpp" #include "ParsedStateMachine.hpp" namespace RTT From 5b8d8dd30b02b961b2c205f46d6b4aaa7f3f7258 Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Fri, 23 Nov 2012 12:09:37 +0100 Subject: [PATCH 10/63] deployment: fixup default component path for ROS debian packages Signed-off-by: Peter Soetens --- rtt/deployment/CMakeLists.txt | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/rtt/deployment/CMakeLists.txt b/rtt/deployment/CMakeLists.txt index e35811e0d..cbdcc5ba7 100644 --- a/rtt/deployment/CMakeLists.txt +++ b/rtt/deployment/CMakeLists.txt @@ -1,20 +1,10 @@ if ( PLUGINS_ENABLE ) - # Do this first. + # See also plugin/CMakeLists.txt if (NOT DEFAULT_PLUGIN_PATH) - IF ( ROSLIB_SUPPORT ) - # Necessary when building Debian packages: - set(ROS_STACK_DIR_FINAL $ENV{ROS_STACK_DIR_FINAL}) - if (ROS_STACK_DIR_FINAL) - set(DEFAULT_COMPONENT_PATH "${ROS_STACK_DIR_FINAL}/orocos_toolchain/install/lib/orocos") - else(ROS_STACK_DIR_FINAL) - set(DEFAULT_COMPONENT_PATH "${PROJECT_SOURCE_DIR}/../install/lib/orocos" CACHE STRING "Default component lookup path when none given. (semi-)colon separated list." FORCE) - endif(ROS_STACK_DIR_FINAL) - ENDIF( ROSLIB_SUPPORT ) - - message("No default component path given, setting it to ${CMAKE_INSTALL_PREFIX}/lib/orocos.") - message("Define the DEFAULT_COMPONENT_PATH cmake variable to override this.") - set(DEFAULT_COMPONENT_PATH "${CMAKE_INSTALL_PREFIX}/lib/orocos") + set(DEFAULT_COMPONENT_PATH "${CMAKE_INSTALL_PREFIX}/lib/orocos") + else() + set(DEFAULT_COMPONENT_PATH "${DEFAULT_PLUGIN_PATH}") endif() configure_file( comppath.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/comppath.cpp @ONLY ) From 04a1564196fd367bbba8d84ee682a84617fd3049 Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Thu, 29 Nov 2012 23:27:22 +0100 Subject: [PATCH 11/63] debian: package version 2.6.0-0 Signed-off-by: Peter Soetens --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index b44fea534..ab60eb704 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +orocos-rtt (2.6.0-0) precise; urgency=low + + * New upstream release + + -- Peter Soetens Thu, 29 Nov 2012 23:27:00 +0100 + orocos-rtt (2.5.0-1) natty; urgency=low * New upstream release From 433ed5f8d26ea857410322e81764c8fa7559bc68 Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Thu, 29 Nov 2012 23:58:58 +0100 Subject: [PATCH 12/63] debian: add ComponentLoader.hpp to install file. Signed-off-by: Peter Soetens --- debian/liborocos-rtt-common-dev.install | 2 ++ 1 file changed, 2 insertions(+) diff --git a/debian/liborocos-rtt-common-dev.install b/debian/liborocos-rtt-common-dev.install index ff14e65dd..5e036ff9f 100644 --- a/debian/liborocos-rtt-common-dev.install +++ b/debian/liborocos-rtt-common-dev.install @@ -51,6 +51,7 @@ usr/include/rtt/transports/mqueue/MQSendRecv.hpp usr/include/rtt/transports/mqueue/MQLib.hpp usr/include/rtt/transports/mqueue/binary_data_archive.hpp usr/include/rtt/transports/mqueue/Dispatcher.hpp +usr/include/rtt/deployment/ComponentLoader.hpp usr/include/rtt/marsh usr/include/rtt/types usr/include/rtt/typekit @@ -58,6 +59,7 @@ usr/include/rtt/extras usr/include/rtt/plugin usr/include/rtt/scripting usr/include/rtt/internal +usr/include/rtt/deployment usr/include/rtt/Activity.hpp usr/include/rtt/ArgumentDescription.hpp usr/include/rtt/Attribute.hpp From 8590ad687bffad4d9490360ddf15b47c403b9e7e Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Fri, 30 Nov 2012 09:59:35 +0100 Subject: [PATCH 13/63] corba: document TaskContextFactory. Signed-off-by: Peter Soetens --- rtt/transports/corba/TaskContextFactory.hpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/rtt/transports/corba/TaskContextFactory.hpp b/rtt/transports/corba/TaskContextFactory.hpp index 31afb0ee7..b0f3428c3 100644 --- a/rtt/transports/corba/TaskContextFactory.hpp +++ b/rtt/transports/corba/TaskContextFactory.hpp @@ -44,14 +44,19 @@ namespace RTT {namespace corba { + /** + * Use this class to create Corba TaskContext proxies, without including any + * CORBA header. This allows you to build applications that don't link with + * a CORBA library. + */ class TaskContextFactory { /** * Invoke this method once to initialise the Orb which will * run the task servers. - * @param orb_timeout timeout value for each remote call, expressed in seconds. - * The resolution is up to 100 nano seconds. Anything smaller will be interpreted - * as a zero. + * @param orb_timeout timeout value for each remote call, expressed in seconds. + * The resolution is up to 100 nano seconds. Anything smaller will be interpreted + * as a zero. */ static bool InitOrb(int argc, char* argv[], Seconds orb_timeout=0 ); From b7ecb1c7854f10a05363da8b9bb2154d45750dd2 Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Fri, 30 Nov 2012 22:35:04 +0100 Subject: [PATCH 14/63] operations: support collecting arguments up to 6 Signed-off-by: Peter Soetens --- rtt/internal/Collect.hpp | 37 ---------------- rtt/internal/CollectBase.hpp | 72 +++++++++++++++++++++++++++++++ rtt/internal/CollectSignature.hpp | 35 --------------- 3 files changed, 72 insertions(+), 72 deletions(-) diff --git a/rtt/internal/Collect.hpp b/rtt/internal/Collect.hpp index 516a54c94..99ed2e7d4 100644 --- a/rtt/internal/Collect.hpp +++ b/rtt/internal/Collect.hpp @@ -248,43 +248,6 @@ namespace RTT } }; - template - struct CollectImpl<7,Ft,BaseImpl> - : public BaseImpl - { - typedef typename boost::function::arg1_type arg1_type; - typedef typename boost::function::arg2_type arg2_type; - typedef typename boost::function::arg3_type arg3_type; - typedef typename boost::function::arg4_type arg4_type; - typedef typename boost::function::arg5_type arg5_type; - typedef typename boost::function::arg6_type arg6_type; - typedef typename boost::function::arg7_type arg7_type; - virtual ~CollectImpl() {} - - /** - * Collect F without returning the results. - * @return - */ - virtual SendStatus collect() - { - return BaseImpl::collect_impl(); - } - /** - * Collect a void(arg1_type) F or - * arg1_type(void) F - * @return - */ - virtual SendStatus collect(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5, arg6_type a6, arg7_type a7) - { - return BaseImpl::collect_impl(a1,a2,a3,a4,a5,a6,a7); - } - virtual SendStatus collectIfDone(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5, arg6_type a6, arg7_type a7) - { - return BaseImpl::collectIfDone_impl(a1,a2,a3,a4,a5,a6,a7); - } - }; - - template struct CollectImpl<5,Ft,BaseImpl> : public BaseImpl diff --git a/rtt/internal/CollectBase.hpp b/rtt/internal/CollectBase.hpp index 7be4dacd1..74ee0226d 100644 --- a/rtt/internal/CollectBase.hpp +++ b/rtt/internal/CollectBase.hpp @@ -152,6 +152,78 @@ namespace RTT virtual SendStatus collect(arg1_type a1, arg2_type a2, arg3_type a3) = 0; virtual SendStatus collectIfDone(arg1_type a1, arg2_type a2, arg3_type a3) = 0; }; + + template + struct CollectBaseImpl<4,Ft> + { + typedef typename boost::function::arg1_type arg1_type; + typedef typename boost::function::arg2_type arg2_type; + typedef typename boost::function::arg3_type arg3_type; + typedef typename boost::function::arg4_type arg4_type; + virtual ~CollectBaseImpl() {} + + /** + * Collect F without returning the results. + * @return + */ + virtual SendStatus collect() = 0; + /** + * Collect a void(arg1_type) F or + * arg1_type(void) F + * @return + */ + virtual SendStatus collect(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4) = 0; + virtual SendStatus collectIfDone(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4) = 0; + }; + + template + struct CollectBaseImpl<5,Ft> + { + typedef typename boost::function::arg1_type arg1_type; + typedef typename boost::function::arg2_type arg2_type; + typedef typename boost::function::arg3_type arg3_type; + typedef typename boost::function::arg4_type arg4_type; + typedef typename boost::function::arg5_type arg5_type; + virtual ~CollectBaseImpl() {} + + /** + * Collect F without returning the results. + * @return + */ + virtual SendStatus collect() = 0; + /** + * Collect a void(arg1_type) F or + * arg1_type(void) F + * @return + */ + virtual SendStatus collect(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5) = 0; + virtual SendStatus collectIfDone(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5) = 0; + }; + + template + struct CollectBaseImpl<6,Ft> + { + typedef typename boost::function::arg1_type arg1_type; + typedef typename boost::function::arg2_type arg2_type; + typedef typename boost::function::arg3_type arg3_type; + typedef typename boost::function::arg4_type arg4_type; + typedef typename boost::function::arg5_type arg5_type; + typedef typename boost::function::arg6_type arg6_type; + virtual ~CollectBaseImpl() {} + + /** + * Collect F without returning the results. + * @return + */ + virtual SendStatus collect() = 0; + /** + * Collect a void(arg1_type) F or + * arg1_type(void) F + * @return + */ + virtual SendStatus collect(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5, arg6_type a6) = 0; + virtual SendStatus collectIfDone(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5, arg6_type a6) = 0; + }; } } #endif diff --git a/rtt/internal/CollectSignature.hpp b/rtt/internal/CollectSignature.hpp index f89aed20b..7ea17b931 100644 --- a/rtt/internal/CollectSignature.hpp +++ b/rtt/internal/CollectSignature.hpp @@ -331,41 +331,6 @@ namespace RTT ToCollect cimpl; }; - template - struct CollectSignature<7,F,ToCollect> - { - typedef typename boost::function_traits::arg1_type arg1_type; - typedef typename boost::function_traits::arg2_type arg2_type; - typedef typename boost::function_traits::arg3_type arg3_type; - typedef typename boost::function_traits::arg4_type arg4_type; - typedef typename boost::function_traits::arg5_type arg5_type; - typedef typename boost::function_traits::arg6_type arg6_type; - typedef typename boost::function_traits::arg7_type arg7_type; - - CollectSignature() : cimpl() {} - CollectSignature(ToCollect implementation) : cimpl(implementation) {} - ~CollectSignature() { } - - /** - * Collect this operator if the method has four arguments. - */ - SendStatus collect(arg1_type t1, arg2_type t2, arg3_type t3, arg4_type t4, arg5_type t5, arg6_type t6, arg7_type t7) - { - if (cimpl) - return cimpl->collect(t1, t2, t3, t4, t5, t6, t7); - return SendFailure; - } - - SendStatus collectIfDone(arg1_type t1, arg2_type t2, arg3_type t3, arg4_type t4, arg5_type t5, arg6_type t6, arg7_type t7) - { - if (cimpl) - return cimpl->collect(t1, t2, t3, t4, t5, t6, t7); - return SendFailure; - } - protected: - ToCollect cimpl; - }; - } } #endif From 8c411199f20894bab858dc3c96bf2a0643e41e35 Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Mon, 3 Dec 2012 23:30:28 +0100 Subject: [PATCH 15/63] doc: release notes and API doc updates. Signed-off-by: Peter Soetens --- doc/xml/orocos-rtt-changes.xml | 35 ++++++++++++++++++++-------------- rtt/ConnPolicy.hpp | 6 +++--- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/doc/xml/orocos-rtt-changes.xml b/doc/xml/orocos-rtt-changes.xml index c9a99c24a..86097b716 100644 --- a/doc/xml/orocos-rtt-changes.xml +++ b/doc/xml/orocos-rtt-changes.xml @@ -75,6 +75,9 @@ We no longer load component libraries with the RTLD_GLOBAL flag. + + + This means you must link with all required libraries at link time, and not rely on symbol resolution during the loading by the deployer. @@ -103,26 +106,22 @@
Building - - - Autoproj updates - This release includes the latest Autoproj version and consequently features in - order to manage your build process and code repository versions. - - ROS_ROOT is no longer influencing your build, unless you're in a ROS_PACKAGE_PATH - The last cornercases of ROS_ROOT influencing our build behavior have been ironed out in this release + The last cornercases of ROS_ROOT influencing our build behavior have been ironed out in this release. - This fixes integration with AutoProj. + This fixes integration issues with AutoProj. RTT and OCL builds with clang++ 3.0 - This allows you to speed up RTT builds significantly. + + + This allows you to speed up RTT builds significantly. When you enabled CORBA, only the OMNIORB transport compiles fine + in clang. @@ -139,15 +138,18 @@ - A new connection type has been introduced, BUFFER_CIRCULAR. + A new connection type has been introduced, CIRCULAR_BUFFER + + This new type can be used in the ConnPolicy.type field in order to have circular buffers instead of the classical non-circular buffer. - Exceptions thrown in operations are now detected and handled. When - an operation threw an exception, this resulted in undefined behavior. The exception is + Exceptions thrown in operations are now detected and handled. + + When an operation threw an exception, this resulted in undefined behavior. The exception is now caught by RTT and the caller side receives an std::runtime_exception exception. Passing exceptions is not supported, so this is a last-resort solution to cope with misbehaving operations. @@ -156,6 +158,8 @@ The ComponentLoader is from now on part of RTT instead of OCL. + + This means you no longer need a DeploymentComponent to import typekits or component packages. @@ -181,7 +185,10 @@ - The internal function getMember is now much more efficient and faster. There's now also + The internal function getMember is now much more efficient and faster. + + + There's now also a real-time version of getMember, if you provide it a ReferenceDataSource such that a reference to the member can be given without allocating a DataSource for it. diff --git a/rtt/ConnPolicy.hpp b/rtt/ConnPolicy.hpp index cab1cbc10..764b997e8 100644 --- a/rtt/ConnPolicy.hpp +++ b/rtt/ConnPolicy.hpp @@ -49,10 +49,10 @@ namespace RTT { * behave. Various parameters are available: * *
    - *
  • the connection type: DATA or BUFFER. On a data connection, the reader will have + *
  • the connection type: DATA, BUFFER or CIRCULAR_BUFFER. On a data connection, the reader will have * only access to the last written value. On a buffered connection, a * \a size number of elements can be stored until the reader reads - * them. + * them. BUFFER drops newer samples on full, CIRCULAR_BUFFER drops older samples on full. *
  • the locking policy: LOCKED, LOCK_FREE or UNSYNC. This defines how locking is done in the * connection. For now, only three policies are available. LOCKED uses * mutexes, LOCK_FREE uses a lock free method and UNSYNC means there's no @@ -137,7 +137,7 @@ namespace RTT { */ explicit ConnPolicy(int type = DATA, int lock_policy = LOCK_FREE); - /** This is the type for the data holding element in the connection */ + /** DATA, BUFFER or CIRCULAR_BUFFER */ int type; /** If true, one should initialize the connection's value with the last * value written on the writer port. This is only possible if the writer From cf0014e2bce8e038881caa6b95bcf059a503d688 Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Mon, 3 Dec 2012 23:48:34 +0100 Subject: [PATCH 16/63] doc: more release note updates. Signed-off-by: Peter Soetens --- doc/xml/orocos-rtt-changes.xml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/doc/xml/orocos-rtt-changes.xml b/doc/xml/orocos-rtt-changes.xml index 86097b716..16b797e9c 100644 --- a/doc/xml/orocos-rtt-changes.xml +++ b/doc/xml/orocos-rtt-changes.xml @@ -212,6 +212,17 @@
    Lua scripting + + + rttlua and tlsf-rttlua now support CORBA and Log4cpp logging as well. + + + + + tlsf-rttlua is now capable of executing RTT operations in hard real-time, as long + as they are assigned to an operation variable in a non-critical-time section. + + Consult the
    +
    + Deployment + + + + A -d or --daemon flag has been added to the deployer to let it + run in the background. You can use the new signal catching functions in the deployer + API to catch shutdown/restart signals. + + + + + Two new operations were added: setFileDescriptorActivity and connectOperations. + + + +
About Orocos From 55a94d0b314f21db96f13ac2fab5eebb81d02306 Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Fri, 7 Dec 2012 22:21:14 +0100 Subject: [PATCH 17/63] scripting: fix bug reported on ML of hanging script operations. executeUntil + execute always returned true, even if the function had run to an end. Signed-off-by: Peter Soetens --- rtt/scripting/FunctionGraph.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rtt/scripting/FunctionGraph.cpp b/rtt/scripting/FunctionGraph.cpp index 2c86ff0bd..f7af24ee3 100644 --- a/rtt/scripting/FunctionGraph.cpp +++ b/rtt/scripting/FunctionGraph.cpp @@ -205,8 +205,7 @@ namespace RTT { } switch (pStatus) { case Status::running: - this->executeUntil(); - return true; + return this->executeUntil(); break; case Status::paused: if (mstep) { @@ -281,8 +280,10 @@ namespace RTT { } while ( previous != current && pStatus == Status::running && !pausing); // keep going if we found a new node // check finished state - if (current == exitv) + if (current == exitv) { this->stop(); + return !munload_on_stop; + } return true; // we need to wait. } From 8486fe6b26acc00dc5d3ae4f027a6e44d5099fbc Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Tue, 11 Dec 2012 11:28:39 +0100 Subject: [PATCH 18/63] fix for bug #979: added missing public keyword. Signed-off-by: Peter Soetens --- rtt/transports/corba/TaskContextFactory.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/rtt/transports/corba/TaskContextFactory.hpp b/rtt/transports/corba/TaskContextFactory.hpp index b0f3428c3..bc1869210 100644 --- a/rtt/transports/corba/TaskContextFactory.hpp +++ b/rtt/transports/corba/TaskContextFactory.hpp @@ -51,6 +51,7 @@ namespace RTT */ class TaskContextFactory { + public: /** * Invoke this method once to initialise the Orb which will * run the task servers. From c512431845022a4cf9de099a5eafa5e1347b6129 Mon Sep 17 00:00:00 2001 From: ressac Date: Tue, 7 Feb 2012 10:43:41 +0100 Subject: [PATCH 19/63] Add propagateNeedsSignal function. Add propagateNeedsSignal function to the ChannelElement interface. This function allow an input port to tell if it needs signaling upon new data availability. --- rtt/base/ChannelElementBase.hpp | 8 ++++ rtt/base/ChannelInterface.cpp | 8 ++++ rtt/base/InputPortInterface.cpp | 6 +++ rtt/transports/corba/DataFlow.idl | 8 ++++ rtt/transports/corba/RemoteChannelElement.hpp | 37 +++++++++++++++++-- 5 files changed, 64 insertions(+), 3 deletions(-) diff --git a/rtt/base/ChannelElementBase.hpp b/rtt/base/ChannelElementBase.hpp index a85776ffe..9de8d605c 100644 --- a/rtt/base/ChannelElementBase.hpp +++ b/rtt/base/ChannelElementBase.hpp @@ -132,6 +132,14 @@ namespace RTT { namespace base { */ void setOutput(shared_ptr output); + /** Tell if the output needs to be signaled when new data are + * available. + * By default, the channel element forwards the call to its input + * + * @param true_false true if need signaling. + */ + virtual void propagateNeedsSignaling(bool); + /** Signals that there is new data available on this channel * By default, the channel element forwards the call to its output * diff --git a/rtt/base/ChannelInterface.cpp b/rtt/base/ChannelInterface.cpp index 253dd8ec3..863bab609 100644 --- a/rtt/base/ChannelInterface.cpp +++ b/rtt/base/ChannelInterface.cpp @@ -120,6 +120,14 @@ void ChannelElementBase::clear() input->clear(); } +void ChannelElementBase::propagateNeedsSignaling(bool true_false) +{ + // we go against the data stream + shared_ptr input = getInput(); + if (input) + input->propagateNeedsSignaling(true_false); +} + bool ChannelElementBase::signal() { shared_ptr output = getOutput(); diff --git a/rtt/base/InputPortInterface.cpp b/rtt/base/InputPortInterface.cpp index f5cc2bb60..22c846a71 100644 --- a/rtt/base/InputPortInterface.cpp +++ b/rtt/base/InputPortInterface.cpp @@ -134,6 +134,12 @@ void InputPortInterface::signal() void InputPortInterface::signalInterface(bool true_false) { msignal_interface = true_false; + // propagate the information to the output end + std::list channels = cmanager.getChannels(); + std::list::iterator it; + for(it = channels.begin(); it != channels.end(); ++it) { + it->get<1>()->propagateNeedsSignaling(true_false); + } } #endif FlowStatus InputPortInterface::read(DataSourceBase::shared_ptr source, bool copy_old_data) diff --git a/rtt/transports/corba/DataFlow.idl b/rtt/transports/corba/DataFlow.idl index 548e2ce40..3413d97d8 100644 --- a/rtt/transports/corba/DataFlow.idl +++ b/rtt/transports/corba/DataFlow.idl @@ -74,6 +74,14 @@ module RTT * side is such that they can relay a signal or disconnect. */ void setRemoteSide(in CRemoteChannelElement other); + + /** + * Used by the 'remote' side to tell that it needs signaling + * when new data is available for reading. + * @param true_false true if the remote side is an "eventPort". + */ + void remotePropagateNeedsSignaling(in boolean true_false); + /** * Used by the 'remote' side to inform this channel element that new data * is available for reading. diff --git a/rtt/transports/corba/RemoteChannelElement.hpp b/rtt/transports/corba/RemoteChannelElement.hpp index 9b830f278..d4071c4a5 100644 --- a/rtt/transports/corba/RemoteChannelElement.hpp +++ b/rtt/transports/corba/RemoteChannelElement.hpp @@ -71,6 +71,10 @@ namespace RTT { * In pull mode, we don't send data, just signal it and remote must read it back. */ bool pull; + /** + * In pull mode, we don't send data neither signal if not needed. + */ + bool need_signal; /** This is used on to read the channel */ typename base::ChannelElement::value_t sample; @@ -95,7 +99,7 @@ namespace RTT { value_data_source(new internal::ValueDataSource), ref_data_source(new internal::LateReferenceDataSource), const_ref_data_source(new internal::LateConstReferenceDataSource), - valid(true), pull(is_pull), + valid(true), pull(is_pull), need_signal(false, msender(sender), write_any(new CORBA::Any) { @@ -123,6 +127,30 @@ namespace RTT { { this->deref(); } + /** + * CORBA IDL function. + * CRemoteChannelElement_i propagateNeedsSignaling implementation. + */ + void remotePropagateNeedsSignaling(CORBA::Boolean true_false) ACE_THROW_SPEC (( + CORBA::SystemException + )) + { + // forward too. + base::ChannelElementBase::propagateNeedsSignaling(true_false); + // update the cache + need_signal = true_false; + } + + /** + * base::ChannelElement propagateNeedsSignaling implementation. + */ + void propagateNeedsSignaling(bool true_false) + { + if ( !CORBA::is_nil(remote_side.in()) ) + // FIXME should we care about the RT here, as in signal ? + remote_side->remotePropagateNeedsSignaling(true_false); + } + /** * CORBA IDL function. */ @@ -138,6 +166,9 @@ namespace RTT { // intercept signal if no remote side set. if ( CORBA::is_nil(remote_side.in()) ) return true; + // intercept signal if no signal needed. + if ( !need_signal ) + return true; // Remember that signal() is called in the context of the one // that wrote the data, so we must decouple here to keep hard-RT happy. // the dispatch thread must read the data and send it over by calling transferSample(). @@ -151,7 +182,7 @@ namespace RTT { return; //log(Debug) <<"transfering..." <remoteSignal(); } #ifdef CORBA_IS_OMNIORB @@ -166,7 +197,7 @@ namespace RTT { log(Error) << "caught CORBA exception while signalling our remote endpoint: " << e._name() << endlog(); valid = false; } - } else { + } else if (!pull) { //log(Debug) <<"...read..."<read(sample, false) == NewData && valid) { //log(Debug) <<"...write..."< Date: Sun, 16 Dec 2012 21:41:28 +0100 Subject: [PATCH 20/63] doc: add caveat about deployer renaming Signed-off-by: Peter Soetens --- doc/xml/orocos-rtt-changes.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/doc/xml/orocos-rtt-changes.xml b/doc/xml/orocos-rtt-changes.xml index 16b797e9c..2ce27cf74 100644 --- a/doc/xml/orocos-rtt-changes.xml +++ b/doc/xml/orocos-rtt-changes.xml @@ -53,6 +53,18 @@ and plugin loaders may get confused if older versions are found.
+ + + The rttlua DeploymentComponent's name has been changed from "deployer" to "Deployer" in + order to be compatible with the existing deployer application. This change only influences + Lua users and requires each occurence of getPeer("deployer") to be changed by getPeer("Deployer"). + + + You can do the renaming in your existing source trees with this Shell command: + find . ! -path "*.git*" -name "*.lua" -print0 | xargs -0 sed -i "s/\"deployer\"/\"Deployer\"/g;s/\'deployer\'/\'Deployer\'/g" + + + There was an API change in the (RTT internal) RTT::types::TypeInfo From 2c830bf159fad608243dba8f0c885d50144640fc Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Mon, 17 Dec 2012 00:42:01 +0100 Subject: [PATCH 21/63] Revert "Add propagateNeedsSignal function." This reverts commit c512431845022a4cf9de099a5eafa5e1347b6129. Accidental push of non-tested patch (contained a type in RemoteChannelElement). --- rtt/base/ChannelElementBase.hpp | 8 ---- rtt/base/ChannelInterface.cpp | 8 ---- rtt/base/InputPortInterface.cpp | 6 --- rtt/transports/corba/DataFlow.idl | 8 ---- rtt/transports/corba/RemoteChannelElement.hpp | 37 ++----------------- 5 files changed, 3 insertions(+), 64 deletions(-) diff --git a/rtt/base/ChannelElementBase.hpp b/rtt/base/ChannelElementBase.hpp index 9de8d605c..a85776ffe 100644 --- a/rtt/base/ChannelElementBase.hpp +++ b/rtt/base/ChannelElementBase.hpp @@ -132,14 +132,6 @@ namespace RTT { namespace base { */ void setOutput(shared_ptr output); - /** Tell if the output needs to be signaled when new data are - * available. - * By default, the channel element forwards the call to its input - * - * @param true_false true if need signaling. - */ - virtual void propagateNeedsSignaling(bool); - /** Signals that there is new data available on this channel * By default, the channel element forwards the call to its output * diff --git a/rtt/base/ChannelInterface.cpp b/rtt/base/ChannelInterface.cpp index 863bab609..253dd8ec3 100644 --- a/rtt/base/ChannelInterface.cpp +++ b/rtt/base/ChannelInterface.cpp @@ -120,14 +120,6 @@ void ChannelElementBase::clear() input->clear(); } -void ChannelElementBase::propagateNeedsSignaling(bool true_false) -{ - // we go against the data stream - shared_ptr input = getInput(); - if (input) - input->propagateNeedsSignaling(true_false); -} - bool ChannelElementBase::signal() { shared_ptr output = getOutput(); diff --git a/rtt/base/InputPortInterface.cpp b/rtt/base/InputPortInterface.cpp index 22c846a71..f5cc2bb60 100644 --- a/rtt/base/InputPortInterface.cpp +++ b/rtt/base/InputPortInterface.cpp @@ -134,12 +134,6 @@ void InputPortInterface::signal() void InputPortInterface::signalInterface(bool true_false) { msignal_interface = true_false; - // propagate the information to the output end - std::list channels = cmanager.getChannels(); - std::list::iterator it; - for(it = channels.begin(); it != channels.end(); ++it) { - it->get<1>()->propagateNeedsSignaling(true_false); - } } #endif FlowStatus InputPortInterface::read(DataSourceBase::shared_ptr source, bool copy_old_data) diff --git a/rtt/transports/corba/DataFlow.idl b/rtt/transports/corba/DataFlow.idl index 3413d97d8..548e2ce40 100644 --- a/rtt/transports/corba/DataFlow.idl +++ b/rtt/transports/corba/DataFlow.idl @@ -74,14 +74,6 @@ module RTT * side is such that they can relay a signal or disconnect. */ void setRemoteSide(in CRemoteChannelElement other); - - /** - * Used by the 'remote' side to tell that it needs signaling - * when new data is available for reading. - * @param true_false true if the remote side is an "eventPort". - */ - void remotePropagateNeedsSignaling(in boolean true_false); - /** * Used by the 'remote' side to inform this channel element that new data * is available for reading. diff --git a/rtt/transports/corba/RemoteChannelElement.hpp b/rtt/transports/corba/RemoteChannelElement.hpp index d4071c4a5..9b830f278 100644 --- a/rtt/transports/corba/RemoteChannelElement.hpp +++ b/rtt/transports/corba/RemoteChannelElement.hpp @@ -71,10 +71,6 @@ namespace RTT { * In pull mode, we don't send data, just signal it and remote must read it back. */ bool pull; - /** - * In pull mode, we don't send data neither signal if not needed. - */ - bool need_signal; /** This is used on to read the channel */ typename base::ChannelElement::value_t sample; @@ -99,7 +95,7 @@ namespace RTT { value_data_source(new internal::ValueDataSource), ref_data_source(new internal::LateReferenceDataSource), const_ref_data_source(new internal::LateConstReferenceDataSource), - valid(true), pull(is_pull), need_signal(false, + valid(true), pull(is_pull), msender(sender), write_any(new CORBA::Any) { @@ -127,30 +123,6 @@ namespace RTT { { this->deref(); } - /** - * CORBA IDL function. - * CRemoteChannelElement_i propagateNeedsSignaling implementation. - */ - void remotePropagateNeedsSignaling(CORBA::Boolean true_false) ACE_THROW_SPEC (( - CORBA::SystemException - )) - { - // forward too. - base::ChannelElementBase::propagateNeedsSignaling(true_false); - // update the cache - need_signal = true_false; - } - - /** - * base::ChannelElement propagateNeedsSignaling implementation. - */ - void propagateNeedsSignaling(bool true_false) - { - if ( !CORBA::is_nil(remote_side.in()) ) - // FIXME should we care about the RT here, as in signal ? - remote_side->remotePropagateNeedsSignaling(true_false); - } - /** * CORBA IDL function. */ @@ -166,9 +138,6 @@ namespace RTT { // intercept signal if no remote side set. if ( CORBA::is_nil(remote_side.in()) ) return true; - // intercept signal if no signal needed. - if ( !need_signal ) - return true; // Remember that signal() is called in the context of the one // that wrote the data, so we must decouple here to keep hard-RT happy. // the dispatch thread must read the data and send it over by calling transferSample(). @@ -182,7 +151,7 @@ namespace RTT { return; //log(Debug) <<"transfering..." <remoteSignal(); } #ifdef CORBA_IS_OMNIORB @@ -197,7 +166,7 @@ namespace RTT { log(Error) << "caught CORBA exception while signalling our remote endpoint: " << e._name() << endlog(); valid = false; } - } else if (!pull) { + } else { //log(Debug) <<"...read..."<read(sample, false) == NewData && valid) { //log(Debug) <<"...write..."< Date: Mon, 17 Dec 2012 23:26:30 +0100 Subject: [PATCH 22/63] cmake: fix bug #1012: CMake issues with newer Xenomai custom installs. Addressed the various issues and ambiguous error reports one could have when selecting the xenomai target. Also fixed linking with the mqueue headers in Xenomai environments by passing the flags from xeno-config directly. Signed-off-by: Peter Soetens --- config/FindXenomai.cmake | 20 ++++++++++++- config/FindXenomaiPosix.cmake | 28 ++++++++++++------- config/LibFindMacros.cmake | 2 +- config/check_depend.cmake | 11 ++++++-- orocos-rtt.default.cmake | 2 +- rtt/orocos-rtt.pc.in | 4 +-- rtt/transports/mqueue/orocos-rtt-mqueue.pc.in | 6 ++-- 7 files changed, 53 insertions(+), 20 deletions(-) diff --git a/config/FindXenomai.cmake b/config/FindXenomai.cmake index 34d7c7ee2..8ea44c951 100644 --- a/config/FindXenomai.cmake +++ b/config/FindXenomai.cmake @@ -1,6 +1,6 @@ ################################################################################ # -# CMake script for finding XENOMAI. +# CMake script for finding the XENOMAI native skin. # If the optional XENOMAI_ROOT_DIR environment variable exists, header files and # libraries will be searched in the XENOMAI_ROOT_DIR/include and XENOMAI_ROOT_DIR/lib # directories, respectively. Otherwise the default CMake search process will be @@ -21,6 +21,14 @@ if(NOT $ENV{XENOMAI_ROOT_DIR} STREQUAL "") mark_as_advanced(XENOMAI_ROOT_DIR) endif() +if ( Xenomai_FIND_QUIETLY ) + set( XENOMAI_FIND_QUIETLY "QUIET") +endif() + +if ( Xenomai_FIND_REQUIRED ) + set( XENOMAI_FIND_REQUIRED "REQUIRED") +endif() + # Header files to find set(header_NAME native/task.h) @@ -31,16 +39,26 @@ set(XENOMAI_NATIVE_NAME native) # Find headers and libraries if(XENOMAI_ROOT_DIR) # Use location specified by environment variable + find_program(XENOMAI_XENO_CONFIG NAMES xeno-config PATHS ${XENOMAI_ROOT_DIR}/bin NO_DEFAULT_PATH) find_path(XENOMAI_INCLUDE_DIR NAMES ${header_NAME} PATHS ${XENOMAI_ROOT_DIR}/include PATH_SUFFIXES xenomai NO_DEFAULT_PATH) find_library(XENOMAI_LIBRARY NAMES ${XENOMAI_NAME} PATHS ${XENOMAI_ROOT_DIR}/lib NO_DEFAULT_PATH) find_library(XENOMAI_NATIVE_LIBRARY NAMES ${XENOMAI_NATIVE_NAME} PATHS ${XENOMAI_ROOT_DIR}/lib NO_DEFAULT_PATH) else() # Use default CMake search process + find_program(XENOMAI_XENO_CONFIG NAMES xeno-config ) find_path(XENOMAI_INCLUDE_DIR NAMES ${header_NAME} PATH_SUFFIXES xenomai ) find_library(XENOMAI_LIBRARY NAMES ${XENOMAI_NAME}) find_library(XENOMAI_NATIVE_LIBRARY NAMES ${XENOMAI_NATIVE_NAME}) endif() +if( XENOMAI_LIBRARY AND XENOMAI_INCLUDE_DIR AND NOT XENOMAI_XENO_CONFIG ) + message(SEND_ERROR "Your Xenomai installation is broken: I can not determine Xenomai Native cflags/ldflags without xeno-config.") +else() + execute_process(COMMAND ${XENOMAI_XENO_CONFIG} --skin=native --ldflags OUTPUT_VARIABLE XENOMAI_LDFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND ${XENOMAI_XENO_CONFIG} --skin=native --cflags OUTPUT_VARIABLE XENOMAI_CFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE) +endif() + + # Set the include dir variables and the libraries and let libfind_process do the rest. # NOTE: Singular variables for this library, plural for libraries this this lib depends on. set(XENOMAI_PROCESS_INCLUDES XENOMAI_INCLUDE_DIR) diff --git a/config/FindXenomaiPosix.cmake b/config/FindXenomaiPosix.cmake index 1b6e49b88..942208584 100644 --- a/config/FindXenomaiPosix.cmake +++ b/config/FindXenomaiPosix.cmake @@ -1,6 +1,6 @@ ################################################################################ # -# CMake script for finding XENOMAI. +# CMake script for finding the XENOMAI Posix skin. # If the optional XENOMAI_ROOT_DIR environment variable exists, header files and # libraries will be searched in the XENOMAI_ROOT_DIR/include and XENOMAI_ROOT_DIR/lib # directories, respectively. Otherwise the default CMake search process will be @@ -16,9 +16,17 @@ include(LibFindMacros) # Get hint from environment variable (if any) -if(NOT $ENV{XENOMAI_POSIX_ROOT_DIR} STREQUAL "") - set(XENOMAI_POSIX_ROOT_DIR $ENV{XENOMAI_POSIX_ROOT_DIR} CACHE PATH "Xenomai Posix base directory location (optional, used for nonstandard installation paths)" FORCE) - mark_as_advanced(XENOMAI_POSIX_ROOT_DIR) +if(NOT $ENV{XENOMAI_ROOT_DIR} STREQUAL "") + set(XENOMAI_ROOT_DIR $ENV{XENOMAI_ROOT_DIR} CACHE PATH "Xenomai Posix base directory location (optional, used for nonstandard installation paths)" FORCE) + mark_as_advanced(XENOMAI_ROOT_DIR) +endif() + +if ( XenomaiPosix_FIND_QUIETLY ) + set( XENOMAI_POSIX_FIND_QUIETLY "QUIET") +endif() + +if ( XenomaiPosix_FIND_REQUIRED ) + set( XENOMAI_POSIX_FIND_REQUIRED "REQUIRED") endif() # Header files to find @@ -28,11 +36,11 @@ set(header_NAME pthread.h) set(XENOMAI_POSIX_NAME pthread_rt) # Find headers and libraries -if(XENOMAI_POSIX_ROOT_DIR) +if(XENOMAI_ROOT_DIR) # Use location specified by environment variable - find_program(XENOMAI_XENO_CONFIG NAMES xeno-config PATHS ${XENOMAI_POSIX_ROOT_DIR}/bin NO_DEFAULT_PATH) - find_path(XENOMAI_POSIX_INCLUDE_DIR NAMES ${header_NAME} PATHS ${XENOMAI_POSIX_ROOT_DIR}/include PATH_SUFFIXES xenomai/posix NO_DEFAULT_PATH) - find_library(XENOMAI_POSIX_LIBRARY NAMES ${XENOMAI_POSIX_NAME} PATHS ${XENOMAI_POSIX_ROOT_DIR}/lib NO_DEFAULT_PATH) + find_program(XENOMAI_XENO_CONFIG NAMES xeno-config PATHS ${XENOMAI_ROOT_DIR}/bin NO_DEFAULT_PATH) + find_path(XENOMAI_POSIX_INCLUDE_DIR NAMES ${header_NAME} PATHS ${XENOMAI_ROOT_DIR}/include PATH_SUFFIXES xenomai/posix NO_DEFAULT_PATH) + find_library(XENOMAI_POSIX_LIBRARY NAMES ${XENOMAI_POSIX_NAME} PATHS ${XENOMAI_ROOT_DIR}/lib NO_DEFAULT_PATH) else() # Use default CMake search process find_program(XENOMAI_XENO_CONFIG NAMES xeno-config ) @@ -43,8 +51,8 @@ endif() if( XENOMAI_POSIX_LIBRARY AND XENOMAI_POSIX_INCLUDE_DIR AND NOT XENOMAI_XENO_CONFIG ) message(SEND_ERROR "Your Xenomai installation is broken: I can not determine Xenomai POSIX cflags/ldflags without xeno-config.") else() - execute_process(COMMAND ${XENOMAI_XENO_CONFIG} --posix-ldflags OUTPUT_VARIABLE XENOMAI_POSIX_LDFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND ${XENOMAI_XENO_CONFIG} --posix-cflags OUTPUT_VARIABLE XENOMAI_POSIX_CFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND ${XENOMAI_XENO_CONFIG} --skin=posix --ldflags OUTPUT_VARIABLE XENOMAI_POSIX_LDFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND ${XENOMAI_XENO_CONFIG} --skin=posix --cflags OUTPUT_VARIABLE XENOMAI_POSIX_CFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE) endif() # Set the include dir variables and the libraries and let libfind_process do the rest. diff --git a/config/LibFindMacros.cmake b/config/LibFindMacros.cmake index db880c19b..5c648ff6e 100644 --- a/config/LibFindMacros.cmake +++ b/config/LibFindMacros.cmake @@ -71,7 +71,7 @@ macro (libfind_process PREFIX) foreach (i ${${PREFIX}_PROCESS_INCLUDES} ${${PREFIX}_PROCESS_LIBS}) message("${i}=${${i}}") endforeach (i) - message (FATAL_ERROR "Required library ${PREFIX} NOT FOUND.\nInstall the library (dev version) and try again. If the library is already installed, use the ${PREFIX}_ROOT_DIR environment variable or ccmake to set the missing variables manually.") + message (FATAL_ERROR "Required library ${PREFIX} NOT FOUND.\nInstall the library (dev version) and try again. If the library is already installed, set the ${PREFIX}_ROOT_DIR environment variable or use cmake to set the missing variables manually.") else (${PREFIX}_FIND_REQUIRED) # NOTE: else case not included in original file message (STATUS "Optional library ${PREFIX} NOT FOUND. If the library is already installed, use the ${PREFIX}_ROOT_DIR environment variable or ccmake to set the missing variables manually.") endif (${PREFIX}_FIND_REQUIRED) diff --git a/config/check_depend.cmake b/config/check_depend.cmake index f3a9a4b0a..c5e75deaa 100644 --- a/config/check_depend.cmake +++ b/config/check_depend.cmake @@ -111,6 +111,10 @@ endif(XERCES_FOUND) message("Orocos target is ${OROCOS_TARGET}") string(TOUPPER ${OROCOS_TARGET} OROCOS_TARGET_CAP) +if ( NOT ";lxrt;gnulinux;xenomai;macosx;win32;" MATCHES ".*;${OROCOS_TARGET};.*") + message( FATAL_ERROR "OROCOS_TARGET=${OROCOS_TARGET} is an unkown target. Please use one of lxrt;gnulinux;xenomai;macosx;win32.") +endif() + # Setup flags for RTAI/LXRT if(OROCOS_TARGET STREQUAL "lxrt") set(OROPKG_OS_LXRT TRUE CACHE INTERNAL "This variable is exported to the rtt-config.h file to expose our target choice to the code." FORCE) @@ -144,10 +148,13 @@ if(OROCOS_TARGET STREQUAL "xenomai") add_definitions( -Wall ) if(XENOMAI_FOUND) - list(APPEND OROCOS-RTT_USER_LINK_LIBS ${XENOMAI_LIBRARIES} ) # For libraries used in inline (fosi/template) code. + # Input for .pc and .cmake generated files: list(APPEND OROCOS-RTT_INCLUDE_DIRS ${XENOMAI_INCLUDE_DIRS} ${PTHREAD_INCLUDE_DIRS}) list(APPEND OROCOS-RTT_LIBRARIES ${XENOMAI_LIBRARIES} ${PTHREAD_LIBRARIES} dl) list(APPEND OROCOS-RTT_DEFINITIONS "OROCOS_TARGET=${OROCOS_TARGET}") + # Direct input only for .pc file: + list(APPEND RTT_USER_LDFLAGS ${XENOMAI_LDFLAGS} ) + list(APPEND RTT_USER_CFLAGS ${XENOMAI_CFLAGS} ) if (XENOMAI_POSIX_FOUND) set(MQ_LDFLAGS ${XENOMAI_POSIX_LDFLAGS} ) set(MQ_CFLAGS ${XENOMAI_POSIX_CFLAGS} ) @@ -261,7 +268,7 @@ else(OROCOS_TARGET STREQUAL "win32") endif(OROCOS_TARGET STREQUAL "win32") if( NOT OROCOS-RTT_DEFINITIONS ) - message(FATAL_ERROR "No suitable OROCOS_TARGET selected. Use one of 'lxrt,xenomai,gnulinux,macosx,win32'") + message(FATAL_ERROR "No suitable OROCOS_TARGET found. Please check your setup or provide additional search paths to cmake.") endif() # The machine type is tested using compiler macros in rtt-config.h.in diff --git a/orocos-rtt.default.cmake b/orocos-rtt.default.cmake index c3a9041cb..1373243d6 100644 --- a/orocos-rtt.default.cmake +++ b/orocos-rtt.default.cmake @@ -69,7 +69,7 @@ else() set(OROCOS_TARGET gnulinux CACHE STRING "${DOC_STRING}") endif() endif() - message( "No OROCOS_TARGET environment variable detected. Using: ${OROCOS_TARGET}") + message( "No OROCOS_TARGET environment variable set. Using: ${OROCOS_TARGET}") endif() # Useful for Windows/MSVC builds, sets all libraries and executables in one place. diff --git a/rtt/orocos-rtt.pc.in b/rtt/orocos-rtt.pc.in index 1cf19f7c3..d071408e2 100644 --- a/rtt/orocos-rtt.pc.in +++ b/rtt/orocos-rtt.pc.in @@ -6,6 +6,6 @@ includedir=${prefix}/include Name: Orocos-RTT # human-readable name Description: Open Robot Control Software: Real-Time Tookit # human-readable description Version: @RTT_VERSION@ -Libs: -L${libdir} -lorocos-rtt-@OROCOS_TARGET@ @RTT_USER_LINK_LIBS@ # If some RTT headers include inline calls to other libraries, we need to specify these here too. +Libs: -L${libdir} -lorocos-rtt-@OROCOS_TARGET@ @RTT_USER_LINK_LIBS@ @RTT_USER_LDFLAGS@ # If some RTT headers include inline calls to other libraries, we need to specify these here too. Libs.private: @RTT_LINKFLAGS@ -Cflags: -I${includedir} @RTT_DEFINES@ @RTT_CFLAGS@ +Cflags: -I${includedir} @RTT_DEFINES@ @RTT_CFLAGS@ @RTT_USER_CFLAGS@ diff --git a/rtt/transports/mqueue/orocos-rtt-mqueue.pc.in b/rtt/transports/mqueue/orocos-rtt-mqueue.pc.in index f4e9a7811..61a6088ff 100644 --- a/rtt/transports/mqueue/orocos-rtt-mqueue.pc.in +++ b/rtt/transports/mqueue/orocos-rtt-mqueue.pc.in @@ -7,6 +7,6 @@ Name: Orocos-RTT-MQUEUE # human-readable nam Description: Open Robot Control Software: Real-Time Tookit # human-readable description Requires: orocos-rtt-@OROCOS_TARGET@ Version: @RTT_VERSION@ -Libs: -L${libdir} -lorocos-rtt-mqueue-@OROCOS_TARGET@ -Libs.private: @RTT_MQUEUE_LINKFLAGS@ -Cflags: -I${includedir}/rtt/mqueue @RTT_MQUEUE_DEFINES@ @RTT_MQUEUE_CFLAGS@ +Libs: -L${libdir} -lorocos-rtt-mqueue-@OROCOS_TARGET@ @MQ_LDFLAGS@ +Libs.private: +Cflags: -I${includedir}/rtt/mqueue @MQ_CFLAGS@ From 260285321a9a4a4161a48276c5fabae1741dc7a1 Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Fri, 21 Dec 2012 09:56:21 +0100 Subject: [PATCH 23/63] cmake: also check for absolute paths coming from .pc file libs. Signed-off-by: Peter Soetens --- UseOROCOS-RTT-helpers.cmake | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/UseOROCOS-RTT-helpers.cmake b/UseOROCOS-RTT-helpers.cmake index 16c9afdcc..43c082e1d 100644 --- a/UseOROCOS-RTT-helpers.cmake +++ b/UseOROCOS-RTT-helpers.cmake @@ -101,7 +101,14 @@ macro( orocos_use_package PACKAGE ) # Use find_libraries to find each library: unset(${PACKAGE}_LIBRARIES CACHE) foreach(COMP_LIB ${${PACKAGE}_COMP_${OROCOS_TARGET}_LIBRARIES}) - find_library(${PACKAGE}_${COMP_LIB}_LIBRARY NAMES ${COMP_LIB} HINTS ${${PACKAGE}_COMP_${OROCOS_TARGET}_LIBRARY_DIRS}) + # Two options: COMP_LIB is an absolute path-to-lib or just a libname: + if ( EXISTS ${COMP_LIB} ) + # absolute path: + set( ${PACKAGE}_${COMP_LIB}_LIBRARY ${COMP_LIB} ) + else() + # libname: + find_library(${PACKAGE}_${COMP_LIB}_LIBRARY NAMES ${COMP_LIB} HINTS ${${PACKAGE}_COMP_${OROCOS_TARGET}_LIBRARY_DIRS}) + endif() if(${PACKAGE}_${COMP_LIB}_LIBRARY) else(${PACKAGE}_${COMP_LIB}_LIBRARY) message(SEND_ERROR "In package >>>${PACKAGE}<<< : could not find library ${COMP_LIB} in directory ${${PACKAGE}_COMP_${OROCOS_TARGET}_LIBRARY_DIRS}, although its .pc file says it should be there.\n\n Try to do 'make clean; rm -rf lib' and then 'make' in the package >>>${PACKAGE}<<<.\n\n") From db5e67260919897b373353fefa1dd7dd80661ae2 Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Fri, 21 Dec 2012 13:17:00 +0100 Subject: [PATCH 24/63] types: fix namespace typos. Signed-off-by: Peter Soetens --- rtt/base/InputPortInterface.cpp | 2 +- rtt/base/OutputPortInterface.cpp | 2 +- rtt/types/CompositionFactory.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rtt/base/InputPortInterface.cpp b/rtt/base/InputPortInterface.cpp index f5cc2bb60..dc11fe4a2 100644 --- a/rtt/base/InputPortInterface.cpp +++ b/rtt/base/InputPortInterface.cpp @@ -45,7 +45,7 @@ #include using namespace RTT; -using namespace detail; +using namespace RTT::detail; using namespace std; diff --git a/rtt/base/OutputPortInterface.cpp b/rtt/base/OutputPortInterface.cpp index 4db576d33..04a2334b2 100644 --- a/rtt/base/OutputPortInterface.cpp +++ b/rtt/base/OutputPortInterface.cpp @@ -43,7 +43,7 @@ #include using namespace RTT; -using namespace detail; +using namespace RTT::detail; using namespace std; diff --git a/rtt/types/CompositionFactory.cpp b/rtt/types/CompositionFactory.cpp index 476c8e786..ef2bae109 100644 --- a/rtt/types/CompositionFactory.cpp +++ b/rtt/types/CompositionFactory.cpp @@ -1,7 +1,7 @@ #include "TemplateCompositionFactory.hpp" using namespace RTT; -using namespace detail; +using namespace RTT::types; base::DataSourceBase::shared_ptr CompositionFactory::convertType(base::DataSourceBase::shared_ptr source) const { From 5b2fa6921fe920eafc8f0c1d6ee875dcc5a53ca5 Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Fri, 21 Dec 2012 14:01:41 +0100 Subject: [PATCH 25/63] win32: fixup missing RTT_API statements. Signed-off-by: Peter Soetens --- rtt/base/OperationCallerInterface.hpp | 2 +- rtt/types/CompositionFactory.hpp | 2 +- rtt/types/TemplateConnFactory.hpp | 2 +- rtt/types/TypeInfoGenerator.hpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rtt/base/OperationCallerInterface.hpp b/rtt/base/OperationCallerInterface.hpp index 24869c6ad..395c6c151 100644 --- a/rtt/base/OperationCallerInterface.hpp +++ b/rtt/base/OperationCallerInterface.hpp @@ -12,7 +12,7 @@ namespace RTT /** * The interface class for operation callers. */ - struct OperationCallerInterface: public DisposableInterface + struct RTT_API OperationCallerInterface: public DisposableInterface { /** * Use this type for shared pointer storage of an diff --git a/rtt/types/CompositionFactory.hpp b/rtt/types/CompositionFactory.hpp index 1cf14ddd6..354807189 100644 --- a/rtt/types/CompositionFactory.hpp +++ b/rtt/types/CompositionFactory.hpp @@ -9,7 +9,7 @@ namespace RTT { /** * A factory for composing/decomposing and converting types to a form suitable for persistent storage, such as an XML file. */ - class CompositionFactory + class RTT_API CompositionFactory { public: diff --git a/rtt/types/TemplateConnFactory.hpp b/rtt/types/TemplateConnFactory.hpp index ba8455e22..fc2fb1811 100644 --- a/rtt/types/TemplateConnFactory.hpp +++ b/rtt/types/TemplateConnFactory.hpp @@ -13,7 +13,7 @@ namespace RTT using internal::ConnFactory; template - class RTT_API TemplateConnFactory : public ConnFactory + class TemplateConnFactory : public ConnFactory { public: base::InputPortInterface* inputPort(std::string const& name) const { return new InputPort(name); } diff --git a/rtt/types/TypeInfoGenerator.hpp b/rtt/types/TypeInfoGenerator.hpp index f7c1f4690..ebd95ef95 100644 --- a/rtt/types/TypeInfoGenerator.hpp +++ b/rtt/types/TypeInfoGenerator.hpp @@ -16,7 +16,7 @@ namespace RTT * class to the type system which has no function * once the type registration is done. */ - class TypeInfoGenerator + class RTT_API TypeInfoGenerator { public: virtual ~TypeInfoGenerator() {} From 059588a294fb01bb0744c3eb74fb0b212539f70d Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Fri, 21 Dec 2012 14:30:21 +0100 Subject: [PATCH 26/63] win32: fixup last missing API decorations. Signed-off-by: Peter Soetens --- rtt/base/DisposableInterface.hpp | 2 +- rtt/plugin/PluginLoader.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rtt/base/DisposableInterface.hpp b/rtt/base/DisposableInterface.hpp index fb8a6a6e3..69fa7d1b4 100644 --- a/rtt/base/DisposableInterface.hpp +++ b/rtt/base/DisposableInterface.hpp @@ -49,7 +49,7 @@ namespace RTT * @brief An object that is executable and * is freed after execution. */ - class DisposableInterface + class RTT_API DisposableInterface { public: /** diff --git a/rtt/plugin/PluginLoader.cpp b/rtt/plugin/PluginLoader.cpp index fc2619772..2720080f4 100644 --- a/rtt/plugin/PluginLoader.cpp +++ b/rtt/plugin/PluginLoader.cpp @@ -100,7 +100,7 @@ static const std::string default_delimiter(":"); returns true for ".1", ".12", ".123" returns false for ".a", "1", "123", ".123 ", "a", "", ".1.a", ".1a2" */ -bool isExtensionVersion(const std::string& ext) +RTT_API bool isExtensionVersion(const std::string& ext) { bool isExtensionVersion = false; @@ -138,7 +138,7 @@ bool isExtensionVersion(const std::string& ext) All the above also apply without the "lib" prefix. */ -bool isLoadableLibrary(const path& filename) +RTT_API bool isLoadableLibrary(const path& filename) { bool isLoadable = false; From b122ce80399d0d2f17c112915164011e9d367ee4 Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Fri, 21 Dec 2012 14:38:09 +0100 Subject: [PATCH 27/63] base: fix missing include file. Signed-off-by: Peter Soetens --- rtt/base/DisposableInterface.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/rtt/base/DisposableInterface.hpp b/rtt/base/DisposableInterface.hpp index 69fa7d1b4..117048dd3 100644 --- a/rtt/base/DisposableInterface.hpp +++ b/rtt/base/DisposableInterface.hpp @@ -40,6 +40,7 @@ #define ORO_DISPOSABLEINTERFACE_HPP #include +#include "../rtt-config.h" namespace RTT { From 7de5c4eb0ccbf7fe2385b962050524255a14aa14 Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Fri, 21 Dec 2012 15:25:42 +0100 Subject: [PATCH 28/63] win32: fix typekit plugin test by setting suffix correctly. Signed-off-by: Peter Soetens --- rtt/plugin/PluginLoader.cpp | 4 ++-- tests/testtypes/types/CMakeLists.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rtt/plugin/PluginLoader.cpp b/rtt/plugin/PluginLoader.cpp index 2720080f4..d5c86cfb9 100644 --- a/rtt/plugin/PluginLoader.cpp +++ b/rtt/plugin/PluginLoader.cpp @@ -757,8 +757,8 @@ bool PluginLoader::isCompatiblePlugin(std::string const& filepath) #ifdef OROCOS_TARGET_WIN32 // On WIN32 target: - // - look if the library name ends with "win32.dll" on release mode - // - look if the library name ends with "win32d.dll" on debug mode + // - look if the library name ends with "-win32.dll" on release mode + // - look if the library name ends with "-win32d.dll" on debug mode if(!hasEnding(libname, FULL_PLUGINS_SUFFIX)) { //log(Debug) << "Plugin file '" + libname + "' is incompatible because it doesn't have the suffix " << FULL_PLUGINS_SUFFIX << endlog(); diff --git a/tests/testtypes/types/CMakeLists.txt b/tests/testtypes/types/CMakeLists.txt index 3a9fc4ba0..4e1132516 100644 --- a/tests/testtypes/types/CMakeLists.txt +++ b/tests/testtypes/types/CMakeLists.txt @@ -9,7 +9,7 @@ SET_TARGET_PROPERTIES( testtypes_plugin PROPERTIES SOVERSION "${RTT_VERSION_MAJOR}.${RTT_VERSION_MINOR}" VERSION "${RTT_VERSION}" - OUTPUT_NAME typekit_plugin + OUTPUT_NAME typekit_plugin-${OROCOS_TARGET} COMPILE_FLAGS "${CMAKE_CXX_FLAGS_ADD}" LINK_FLAGS "${CMAKE_LD_FLAGS_ADD}" COMPILE_DEFINITIONS "${OROCOS-RTT_DEFINITIONS}" From 4006d9a85201b11a162cc66be8b48848ca560af4 Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Thu, 17 Jan 2013 11:31:17 +0100 Subject: [PATCH 29/63] cmake: fixup pkgconfig search logic for -lnamespec case It did not work with -l:/absolute/path and it assumed -l/absolute/path was correct syntax. I removed the old case and only respect the correct case. Signed-off-by: Peter Soetens --- UseOROCOS-RTT-helpers.cmake | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/UseOROCOS-RTT-helpers.cmake b/UseOROCOS-RTT-helpers.cmake index 43c082e1d..27a46a396 100644 --- a/UseOROCOS-RTT-helpers.cmake +++ b/UseOROCOS-RTT-helpers.cmake @@ -101,31 +101,35 @@ macro( orocos_use_package PACKAGE ) # Use find_libraries to find each library: unset(${PACKAGE}_LIBRARIES CACHE) foreach(COMP_LIB ${${PACKAGE}_COMP_${OROCOS_TARGET}_LIBRARIES}) - # Two options: COMP_LIB is an absolute path-to-lib or just a libname: - if ( EXISTS ${COMP_LIB} ) - # absolute path: - set( ${PACKAGE}_${COMP_LIB}_LIBRARY ${COMP_LIB} ) + # Two options: COMP_LIB is an absolute path-to-lib (must start with ':') or just a libname: + if ( ${COMP_LIB} MATCHES "^:(.+)") + if (EXISTS "${CMAKE_MATCH_1}" ) + # absolute path: + set( ${PACKAGE}_${COMP_LIB}_LIBRARY "${CMAKE_MATCH_1}" ) + endif() else() - # libname: + # libname: find_library(${PACKAGE}_${COMP_LIB}_LIBRARY NAMES ${COMP_LIB} HINTS ${${PACKAGE}_COMP_${OROCOS_TARGET}_LIBRARY_DIRS}) endif() if(${PACKAGE}_${COMP_LIB}_LIBRARY) else(${PACKAGE}_${COMP_LIB}_LIBRARY) message(SEND_ERROR "In package >>>${PACKAGE}<<< : could not find library ${COMP_LIB} in directory ${${PACKAGE}_COMP_${OROCOS_TARGET}_LIBRARY_DIRS}, although its .pc file says it should be there.\n\n Try to do 'make clean; rm -rf lib' and then 'make' in the package >>>${PACKAGE}<<<.\n\n") endif(${PACKAGE}_${COMP_LIB}_LIBRARY) - list(APPEND ${PACKAGE}_LIBRARIES ${${PACKAGE}_${COMP_LIB}_LIBRARY}) + list(APPEND ${PACKAGE}_LIBRARIES "${${PACKAGE}_${COMP_LIB}_LIBRARY}") endforeach(COMP_LIB ${${PACKAGE}_COMP_${OROCOS_TARGET}_LIBRARIES}) # Add some output variables to the cache to make them accessible from outside this scope - set(${PACKAGE}_INCLUDE_DIRS ${${PACKAGE}_COMP_${OROCOS_TARGET}_INCLUDE_DIRS} CACHE INTERNAL "") - set(${PACKAGE}_LIBRARY_DIRS ${${PACKAGE}_COMP_${OROCOS_TARGET}_LIBRARY_DIRS} CACHE INTERNAL "") - set(${PACKAGE}_LIBRARIES ${${PACKAGE}_LIBRARIES} CACHE INTERNAL "") + set(${PACKAGE}_INCLUDE_DIRS "${${PACKAGE}_COMP_${OROCOS_TARGET}_INCLUDE_DIRS}" CACHE INTERNAL "") + set(${PACKAGE}_LIBRARY_DIRS "${${PACKAGE}_COMP_${OROCOS_TARGET}_LIBRARY_DIRS}" CACHE INTERNAL "") + set(${PACKAGE}_LIBRARIES "${${PACKAGE}_LIBRARIES}" CACHE INTERNAL "") + # The flags are space separated, so no need to quote here: set(${PACKAGE}_CFLAGS_OTHER ${${PACKAGE}_COMP_${OROCOS_TARGET}_CFLAGS_OTHER} CACHE INTERNAL "") set(${PACKAGE}_LDFLAGS_OTHER ${${PACKAGE}_COMP_${OROCOS_TARGET}_LDFLAGS_OTHER} CACHE INTERNAL "") # Add compiler and linker flags to the USE_OROCOS_XXX_FLAGS variables used in the orocos_add_x macros set(USE_OROCOS_COMPILE_FLAGS ${USE_OROCOS_COMPILE_FLAGS} ${${PACKAGE}_COMP_${OROCOS_TARGET}_CFLAGS_OTHER}) set(USE_OROCOS_LINK_FLAGS ${USE_OROCOS_LINK_FLAGS} ${${PACKAGE}_COMP_${OROCOS_TARGET}_LDFLAGS_OTHER}) + # This probably does not work since lists are ';' separated and not ' ' separated: list(REMOVE_DUPLICATES USE_OROCOS_COMPILE_FLAGS) list(REMOVE_DUPLICATES USE_OROCOS_LINK_FLAGS) From d99f6d2c755e0bdcb720cf93cc8f94b0938cfe42 Mon Sep 17 00:00:00 2001 From: virtual Date: Sat, 19 Jan 2013 00:13:02 +0100 Subject: [PATCH 30/63] cmake: More pkg-config fixing of namespec parsing. Signed-off-by: virtual --- UseOROCOS-RTT-helpers.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/UseOROCOS-RTT-helpers.cmake b/UseOROCOS-RTT-helpers.cmake index 27a46a396..23a6973ac 100644 --- a/UseOROCOS-RTT-helpers.cmake +++ b/UseOROCOS-RTT-helpers.cmake @@ -102,11 +102,15 @@ macro( orocos_use_package PACKAGE ) unset(${PACKAGE}_LIBRARIES CACHE) foreach(COMP_LIB ${${PACKAGE}_COMP_${OROCOS_TARGET}_LIBRARIES}) # Two options: COMP_LIB is an absolute path-to-lib (must start with ':') or just a libname: - if ( ${COMP_LIB} MATCHES "^:(.+)") + if ( ${COMP_LIB} MATCHES "^:(.+)" OR EXISTS ${COMP_LIB}) if (EXISTS "${CMAKE_MATCH_1}" ) - # absolute path: + # absolute path (shared lib): set( ${PACKAGE}_${COMP_LIB}_LIBRARY "${CMAKE_MATCH_1}" ) endif() + if (EXISTS "${COMP_LIB}" ) + # absolute path (static lib): + set( ${PACKAGE}_${COMP_LIB}_LIBRARY "${COMP_LIB}" ) + endif() else() # libname: find_library(${PACKAGE}_${COMP_LIB}_LIBRARY NAMES ${COMP_LIB} HINTS ${${PACKAGE}_COMP_${OROCOS_TARGET}_LIBRARY_DIRS}) From eca45049169ab5924831413b58e74a44a7273ec1 Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Thu, 24 Jan 2013 16:39:48 +0000 Subject: [PATCH 31/63] cmake: update docs on orocos_typegen_headers Signed-off-by: Peter Soetens --- UseOROCOS-RTT.cmake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/UseOROCOS-RTT.cmake b/UseOROCOS-RTT.cmake index 4e38d9466..d0f096efe 100644 --- a/UseOROCOS-RTT.cmake +++ b/UseOROCOS-RTT.cmake @@ -386,9 +386,12 @@ endmacro( orocos_executable ) # Type headers should add themselves by calling 'orocos_typegen_headers()' # They will be processed by typegen to generate a typekit from it, with the -# name of the current project. +# name of the current project. You may also pass additional options to typegen +# before listing your header files. For example -i where +# is the name of a pkg-config package on which your headers +# depend # -# Usage: orocos_typegen_headers( robotdata.hpp sensordata.hpp ) +# Usage: orocos_typegen_headers( -i orocos_kdl robotdata.hpp sensordata.hpp ) # macro( orocos_typegen_headers ) From e8614915eb600b481e3f01767bfc054c1998abb6 Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Thu, 24 Jan 2013 16:40:15 +0000 Subject: [PATCH 32/63] doc: update drawing about deployment. Signed-off-by: Peter Soetens --- doc/xml/images/DeploymentLevels.svg | 71 +++++++++++++++++++++-------- 1 file changed, 51 insertions(+), 20 deletions(-) diff --git a/doc/xml/images/DeploymentLevels.svg b/doc/xml/images/DeploymentLevels.svg index 7c298a2e5..418912402 100644 --- a/doc/xml/images/DeploymentLevels.svg +++ b/doc/xml/images/DeploymentLevels.svg @@ -13,7 +13,7 @@ height="210mm" id="svg3778" sodipodi:version="0.32" - inkscape:version="0.47pre4 r22446" + inkscape:version="0.48.2 r9819" sodipodi:docname="DeploymentLevels.svg" inkscape:export-filename="/home/sspr/Projecten/OpenRTC/vdw-distributie/CoreVsContext.png" inkscape:export-xdpi="200" @@ -116,17 +116,22 @@ inkscape:pageshadow="2" inkscape:zoom="0.70529234" inkscape:cx="546.53442" - inkscape:cy="317.52938" + inkscape:cy="414.65223" inkscape:current-layer="layer1" id="namedview3782" - inkscape:window-width="1680" - inkscape:window-height="1000" - inkscape:window-x="-4" - inkscape:window-y="-3" + inkscape:window-width="1024" + inkscape:window-height="576" + inkscape:window-x="0" + inkscape:window-y="24" showguides="true" inkscape:guide-bbox="true" showgrid="false" - inkscape:window-maximized="1" /> + inkscape:window-maximized="1"> + + @@ -379,7 +384,9 @@ y="619.89178" x="70.517464" id="tspan3320" - sodipodi:role="line">TaskCores are non-distributable,TaskCores are non-distributable,A TaskContext is a distributableA TaskContext is a distributableaddLocalOperation(op) + y="30.512833">addLocalOperation(op) @@ -606,7 +617,9 @@ sodipodi:role="line" id="tspan4370" x="697.54706" - y="30.512833">addOperation(op) + y="30.512833">addOperation(op) Orocos Remoting Library:Orocos Transport: - Automatic proxy generation- User writes Orocos Transport- Automatic proxy generation- Remote interface browsing- Remote interface browsing- Scripting support- Scripting support- User defined types- User defined types- One library for all components- One library for all components and all data types + Operation<R(Arg)> op From 3ebd017c558f44c3b5f1ba5f8c4eeb2edf9d1ede Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Thu, 24 Jan 2013 18:40:04 +0000 Subject: [PATCH 33/63] useorocos: improve non-rosbuild configurations - We skip rosbuild if fuerte or later - Fixup manifest reading in case of non-rosbuild systems (the dependencies were ignored) Signed-off-by: Peter Soetens --- UseOROCOS-RTT-helpers.cmake | 15 ++++------ UseOROCOS-RTT.cmake | 57 +++++++++++++++++++++---------------- 2 files changed, 38 insertions(+), 34 deletions(-) diff --git a/UseOROCOS-RTT-helpers.cmake b/UseOROCOS-RTT-helpers.cmake index 23a6973ac..eb9377c78 100644 --- a/UseOROCOS-RTT-helpers.cmake +++ b/UseOROCOS-RTT-helpers.cmake @@ -28,8 +28,8 @@ function( orocos_get_manifest_deps RESULT) string(REGEX REPLACE "${REGEX_STR}" "\\1;" RR_RESULT ${DEPS}) #message("Deps are: '${DEPS}'") - #message("Dependencies are: '${RR_RESULT}'") - set(${RESULT} ${RR_RESULT}) + set(${RESULT} ${RR_RESULT} PARENT_SCOPE) + #message("Dependencies are: '${${RESULT}}'") endif (NOT XPATH_EXE) endfunction( orocos_get_manifest_deps RESULT) @@ -37,7 +37,7 @@ endfunction( orocos_get_manifest_deps RESULT) # # Find a package, pick up its include dirs and link with its libraries. # It does this by locating and reading the .pc file generated by that package. -# In case no such .pc file exists (or is not found), tt is assumed that no +# In case no such .pc file exists (or is not found), it is assumed that no # flags are necessary. # # This macro is called for you by UseOrocos-RTT.cmake @@ -58,9 +58,8 @@ endfunction( orocos_get_manifest_deps RESULT) # Usage: orocos_use_package( myrobot ) # macro( orocos_use_package PACKAGE ) - if (PACKAGE STREQUAL "rtt") - return() - endif (PACKAGE STREQUAL "rtt") + if ( "${PACKAGE}" STREQUAL "rtt") + else() if (IS_ROS_PACKAGE) if (NOT USE_FOUND_${PACKAGE}_PACKAGE_PATH) # use rospack to find package directories of *all* dependencies. @@ -145,11 +144,9 @@ macro( orocos_use_package PACKAGE ) endif (NOT OROCOS_NO_AUTO_LINKING AND ${PACKAGE}_COMP_${OROCOS_TARGET}_LIBRARIES) else (${PACKAGE}_COMP_${OROCOS_TARGET}_FOUND) - if (VERBOSE) message("[UseOrocos] ${PACKAGE} does not provide a .pc file for exporting its build/link flags (or one of it 'Requires' dependencies was not found).") - endif (VERBOSE) endif (${PACKAGE}_COMP_${OROCOS_TARGET}_FOUND) - + endif() endmacro( orocos_use_package PACKAGE ) macro(_orocos_list_to_string _string _list) diff --git a/UseOROCOS-RTT.cmake b/UseOROCOS-RTT.cmake index d0f096efe..2c840f849 100644 --- a/UseOROCOS-RTT.cmake +++ b/UseOROCOS-RTT.cmake @@ -21,32 +21,39 @@ if(OROCOS-RTT_FOUND) set(ROS_ROOT $ENV{ROS_ROOT}) if (ROS_ROOT AND NOT NO_ROS_PACKAGE ) - set(ROS_PACKAGE_PATH $ENV{ROS_PACKAGE_PATH}) - #In bash: for i in $(echo "$ROS_PACKAGE_PATH" | sed -e's/:/ /g'); do if expr match "`pwd`" "$i"; then is_ros_package=1; fi; done > /dev/null - string(REPLACE ":" ";" ROS_PACKAGE_PATH ${ROS_PACKAGE_PATH}) - foreach( rpath IN LISTS ROS_PACKAGE_PATH ) - # This is a bit tricky since overlapping directory names may give false positives: - file(TO_CMAKE_PATH ${rpath} path) # removes trailing '/' - #message(" ${rpath} -> ${path}") - if ( "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${path}" OR "${CMAKE_CURRENT_SOURCE_DIR}" MATCHES "${path}/" ) - set(IS_ROS_PACKAGE TRUE) - message("This package is in your ROS_PACKAGE_PATH, so I'm using rosbuild-style package building.") - - if (CMAKE_GENERATOR STREQUAL "Eclipse CDT4 - Unix Makefiles") - message("Eclipse Generator detected. I'm setting EXECUTABLE_OUTPUT_PATH and LIBRARY_OUTPUT_PATH") - #set the default path for built executables to the "bin" directory - set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) - #set the default path for built libraries to the "lib" directory - set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) - endif() + # If pre-fuerte, we're using rosbuild + # Otherwise, we skip this whole rosbuild mess. + find_package(ROS QUIET) + if(NOT ROS_FOUND) # pre-Fuerte, use rosbuild + set(ROS_PACKAGE_PATH $ENV{ROS_PACKAGE_PATH}) + #In bash: for i in $(echo "$ROS_PACKAGE_PATH" | sed -e's/:/ /g'); do if expr match "`pwd`" "$i"; then is_ros_package=1; fi; done > /dev/null + string(REPLACE ":" ";" ROS_PACKAGE_PATH ${ROS_PACKAGE_PATH}) + foreach( rpath IN LISTS ROS_PACKAGE_PATH ) + # This is a bit tricky since overlapping directory names may give false positives: + file(TO_CMAKE_PATH ${rpath} path) # removes trailing '/' + #message(" ${rpath} -> ${path}") + if ( "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${path}" OR "${CMAKE_CURRENT_SOURCE_DIR}" MATCHES "${path}/" ) + set(IS_ROS_PACKAGE TRUE) + message("This package is in your ROS_PACKAGE_PATH, so I'm using rosbuild-style package building.") + + if (CMAKE_GENERATOR STREQUAL "Eclipse CDT4 - Unix Makefiles") + message("Eclipse Generator detected. I'm setting EXECUTABLE_OUTPUT_PATH and LIBRARY_OUTPUT_PATH") + #set the default path for built executables to the "bin" directory + set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) + #set the default path for built libraries to the "lib" directory + set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) + endif() + endif() + endforeach() + if(NOT IS_ROS_PACKAGE) + message("ROS_ROOT was detected but this package is NOT in your ROS_PACKAGE_PATH. I'm not using any rosbuild-style building.") + # These were set by roscpp cmake macros: + unset( EXECUTABLE_OUTPUT_PATH ) + unset( LIBRARY_OUTPUT_PATH ) endif() - endforeach() - if(NOT IS_ROS_PACKAGE) - message("ROS_ROOT was detected but this package is NOT in your ROS_PACKAGE_PATH. I'm not using any rosbuild-style building.") - # These were set by roscpp cmake macros: - unset( EXECUTABLE_OUTPUT_PATH ) - unset( LIBRARY_OUTPUT_PATH ) + else() + message("ROS_ROOT was detected, and ROS was found as a package, assuming catkin-style building.") endif() endif() @@ -130,7 +137,7 @@ if(OROCOS-RTT_FOUND) else (IS_ROS_PACKAGE) # Fall back to 'manually' processing the manifest.xml file. orocos_get_manifest_deps( DEPS ) - #message("Dependencies are: ${DEPS}") + #message("orocos_get_manifest_deps are: ${DEPS}") foreach(DEP ${DEPS}) orocos_use_package( ${DEP} ) endforeach(DEP ${DEPS}) From 648112d8400ac650172fbfc9ec5a8f0d6e7160e2 Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Thu, 31 Jan 2013 14:32:26 +0100 Subject: [PATCH 34/63] types: fixup missing includes and forward decls. Signed-off-by: Peter Soetens --- rtt/types/TypeInfoGenerator.hpp | 1 + rtt/types/rtt-types-fwd.hpp | 1 + 2 files changed, 2 insertions(+) diff --git a/rtt/types/TypeInfoGenerator.hpp b/rtt/types/TypeInfoGenerator.hpp index ebd95ef95..6bba7cc5d 100644 --- a/rtt/types/TypeInfoGenerator.hpp +++ b/rtt/types/TypeInfoGenerator.hpp @@ -2,6 +2,7 @@ #define RTT_TYPEINFO_GENERATOR_HPP #include +#include "../rtt-config.h" #include "rtt-types-fwd.hpp" namespace RTT diff --git a/rtt/types/rtt-types-fwd.hpp b/rtt/types/rtt-types-fwd.hpp index f5832cb5a..bb07f3c30 100644 --- a/rtt/types/rtt-types-fwd.hpp +++ b/rtt/types/rtt-types-fwd.hpp @@ -9,6 +9,7 @@ namespace RTT { class OperatorRepository; class TransportPlugin; class TypeInfo; + class TypeInfoGenerator; class TypeInfoRepository; class TypeMarshaller; class TypeTransporter; From e6bce4b910571c90ae7800c42b3d25226aa23631 Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Thu, 31 Jan 2013 16:28:05 +0100 Subject: [PATCH 35/63] cmake: define USE_OROCOS_RTT flag to indicate that UseOrocos-RTT conventions are in use. Signed-off-by: Peter Soetens --- UseOROCOS-RTT.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/UseOROCOS-RTT.cmake b/UseOROCOS-RTT.cmake index 2c840f849..be0ee8ab1 100644 --- a/UseOROCOS-RTT.cmake +++ b/UseOROCOS-RTT.cmake @@ -107,6 +107,8 @@ if(OROCOS-RTT_FOUND) # Infer package name from directory name. get_filename_component(orocos_package ${CMAKE_SOURCE_DIR} NAME) message("[UseOrocos] Building package ${orocos_package}") + # Set to true to indicate that these macros are available. + set(USE_OROCOS_RTT 1) # By default, install libs in /target/ subdir in order to allow # multi-target installs. From 7d725b90937471df663396220090dcfe0795c52f Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Fri, 1 Feb 2013 12:13:31 +0100 Subject: [PATCH 36/63] deployment: fix error reporting when importing packages If your package was not using ros, you always got an error. I upgraded the code to use Rospack directly instead of roslib. Signed-off-by: Peter Soetens --- config/FindRoslib.cmake | 4 ++-- rtt/deployment/ComponentLoader.cpp | 35 +++++++++++++++++++++--------- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/config/FindRoslib.cmake b/config/FindRoslib.cmake index 9ce6145bc..3ba4e36ce 100644 --- a/config/FindRoslib.cmake +++ b/config/FindRoslib.cmake @@ -2,7 +2,7 @@ IF ( ROSLIB_SUPPORT ) # Catkin style of fetching ROS deps - FIND_PACKAGE( ROS QUIET COMPONENTS roslib ) + FIND_PACKAGE( ROS QUIET COMPONENTS rospack) IF(NOT ROS_FOUND) # pre-Fuerte # TODO: This block to get roslib is deprecated as of ROS Fuerte, but is left in for pre-Fuerte compatibility @@ -10,7 +10,7 @@ message("Falling back to roslib in: ${roslib_PACKAGE_PATH}") find_library(ROS_LIBRARIES roslib ${roslib_PACKAGE_PATH}/lib ) if ( NOT ROS_LIBRARIES ) - find_package( ROS COMPONENTS roslib ) # Yells at user (non-QUIET !) + find_package( ROS COMPONENTS rospack ) # Yells at user (non-QUIET !) else() set(ROS_FOUND TRUE) set(ROS_INCLUDE_DIRS ${roslib_PACKAGE_PATH}/include) diff --git a/rtt/deployment/ComponentLoader.cpp b/rtt/deployment/ComponentLoader.cpp index 0171bf418..938da8098 100644 --- a/rtt/deployment/ComponentLoader.cpp +++ b/rtt/deployment/ComponentLoader.cpp @@ -8,7 +8,7 @@ #include #ifdef HAS_ROSLIB -#include +#include #endif #ifndef _WIN32 @@ -395,22 +395,37 @@ bool ComponentLoader::importRosPackage(std::string const& package) { // check for rospack #ifdef HAS_ROSLIB - using namespace ros::package; + using namespace rospack; try { bool found = false; - string ppath = getPath( package ); + Rospack rpack; + rpack.setQuiet(true); + char* rpp = getenv("ROS_PACKAGE_PATH"); + vector paths; + if (rpp) + paths = splitPaths(rpp); + string ppath; + rpack.crawl(paths,false); + rpack.find(package, ppath); if ( !ppath.empty() ) { path rospath = path(ppath) / "lib" / "orocos"; path rospath_target = rospath / OROCOS_TARGET_NAME; // + add all dependencies to paths: - V_string rospackresult; - command("depends " + package, rospackresult); - for(V_string::iterator it = rospackresult.begin(); it != rospackresult.end(); ++it) { + vector rospackresult; + rpack.setQuiet(false); + bool valid = rpack.deps(package, false, rospackresult); // false: also indirect deps. + if (!valid) { + log(Error) <<"The ROS package '"<< package <<"' in '"<< ppath << "' caused trouble. Bailing out."<::iterator it = rospackresult.begin(); it != rospackresult.end(); ++it) { if ( isImported(*it) ) { log(Debug) <<"Package dependency '"<< *it <<"' already imported." < Date: Sat, 2 Feb 2013 01:18:06 +0100 Subject: [PATCH 37/63] cmake: fix finding ros on Groovy Yep, it changed again in Groovy ! Signed-off-by: Peter Soetens --- config/FindRoslib.cmake | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/config/FindRoslib.cmake b/config/FindRoslib.cmake index 3ba4e36ce..c4f5f213e 100644 --- a/config/FindRoslib.cmake +++ b/config/FindRoslib.cmake @@ -4,16 +4,16 @@ # Catkin style of fetching ROS deps FIND_PACKAGE( ROS QUIET COMPONENTS rospack) - IF(NOT ROS_FOUND) # pre-Fuerte - # TODO: This block to get roslib is deprecated as of ROS Fuerte, but is left in for pre-Fuerte compatibility - set(roslib_PACKAGE_PATH ${ROS_ROOT}/core/roslib) ### XXX hardcoded - message("Falling back to roslib in: ${roslib_PACKAGE_PATH}") - find_library(ROS_LIBRARIES roslib ${roslib_PACKAGE_PATH}/lib ) + IF(NOT ROS_FOUND) # pre-Fuerte or Groovy + # TODO: This block to get rospack is deprecated as of ROS Fuerte, but is left in for pre-Fuerte compatibility + set(rospack_PACKAGE_PATH ${ROS_ROOT}/core/rospack) ### XXX hardcoded + message("Falling back to rospack in: ${rospack_PACKAGE_PATH}") + find_library(ROS_LIBRARIES rospack ${rospack_PACKAGE_PATH}/lib ) if ( NOT ROS_LIBRARIES ) find_package( ROS COMPONENTS rospack ) # Yells at user (non-QUIET !) else() set(ROS_FOUND TRUE) - set(ROS_INCLUDE_DIRS ${roslib_PACKAGE_PATH}/include) + set(ROS_INCLUDE_DIRS ${rospack_PACKAGE_PATH}/include) endif() ENDIF(NOT ROS_FOUND) From 6c9c9c51aa1d3c379017f73bf1bc0b74e618253a Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Sat, 2 Feb 2013 01:20:40 +0100 Subject: [PATCH 38/63] useorocos: cleanup/sanitize generation of typekits Added DEPENDS argument to the macro and tested lots of different options. We stick to one typegen project per package, and the headers are best in include/package/... Signed-off-by: Peter Soetens --- UseOROCOS-RTT-helpers.cmake | 52 ++++++++++++++++++++++++++ UseOROCOS-RTT.cmake | 74 +++++++++++++++---------------------- 2 files changed, 82 insertions(+), 44 deletions(-) diff --git a/UseOROCOS-RTT-helpers.cmake b/UseOROCOS-RTT-helpers.cmake index eb9377c78..19307b06b 100644 --- a/UseOROCOS-RTT-helpers.cmake +++ b/UseOROCOS-RTT-helpers.cmake @@ -1,3 +1,55 @@ + +# +# Parses arguments or options +# +# From: http://www.cmake.org/Wiki/CMakeMacroParseArguments +# +# For each item in options, PARSE_ARGUMENTS will create a variable +# with that name, prefixed with prefix_. So, for example, if prefix is +# MY_MACRO and options is OPTION1;OPTION2, then PARSE_ARGUMENTS will +# create the variables MY_MACRO_OPTION1 and MY_MACRO_OPTION2. These +# variables will be set to true if the option exists in the command +# line or false otherwise. +# +# For each item in arg_names, PARSE_ARGUMENTS will create a variable +# with that name, prefixed with prefix_. Each variable will be filled +# with the arguments that occur after the given arg_name is encountered +# up to the next arg_name or the end of the arguments. All options are +# removed from these lists. PARSE_ARGUMENTS also creates a +# prefix_DEFAULT_ARGS variable containing the list of all arguments up +# to the first arg_name encountered. +# +MACRO(ORO_PARSE_ARGUMENTS prefix arg_names option_names) + SET(DEFAULT_ARGS) + FOREACH(arg_name ${arg_names}) + SET(${prefix}_${arg_name}) + ENDFOREACH(arg_name) + FOREACH(option ${option_names}) + SET(${prefix}_${option} FALSE) + ENDFOREACH(option) + + SET(current_arg_name DEFAULT_ARGS) + SET(current_arg_list) + FOREACH(arg ${ARGN}) + SET(larg_names ${arg_names}) + LIST(FIND larg_names "${arg}" is_arg_name) + IF (is_arg_name GREATER -1) + SET(${prefix}_${current_arg_name} ${current_arg_list}) + SET(current_arg_name ${arg}) + SET(current_arg_list) + ELSE (is_arg_name GREATER -1) + SET(loption_names ${option_names}) + LIST(FIND loption_names "${arg}" is_option) + IF (is_option GREATER -1) + SET(${prefix}_${arg} TRUE) + ELSE (is_option GREATER -1) + SET(current_arg_list ${current_arg_list} ${arg}) + ENDIF (is_option GREATER -1) + ENDIF (is_arg_name GREATER -1) + ENDFOREACH(arg) + SET(${prefix}_${current_arg_name} ${current_arg_list}) +ENDMACRO(ORO_PARSE_ARGUMENTS) + # # Parses the manifest.xml file and stores the dependencies in RESULT. # Relies on xpath. If no manifest is found, returns an empty RESULT. diff --git a/UseOROCOS-RTT.cmake b/UseOROCOS-RTT.cmake index be0ee8ab1..f63a5f570 100644 --- a/UseOROCOS-RTT.cmake +++ b/UseOROCOS-RTT.cmake @@ -157,41 +157,6 @@ if(OROCOS-RTT_FOUND) endif(OROCOS_TARGET STREQUAL "win32") -# -# Include and link against required stuff -# -#From: http://www.cmake.org/Wiki/CMakeMacroParseArguments -MACRO(ORO_PARSE_ARGUMENTS prefix arg_names option_names) - SET(DEFAULT_ARGS) - FOREACH(arg_name ${arg_names}) - SET(${prefix}_${arg_name}) - ENDFOREACH(arg_name) - FOREACH(option ${option_names}) - SET(${prefix}_${option} FALSE) - ENDFOREACH(option) - - SET(current_arg_name DEFAULT_ARGS) - SET(current_arg_list) - FOREACH(arg ${ARGN}) - SET(larg_names ${arg_names}) - LIST(FIND larg_names "${arg}" is_arg_name) - IF (is_arg_name GREATER -1) - SET(${prefix}_${current_arg_name} ${current_arg_list}) - SET(current_arg_name ${arg}) - SET(current_arg_list) - ELSE (is_arg_name GREATER -1) - SET(loption_names ${option_names}) - LIST(FIND loption_names "${arg}" is_option) - IF (is_option GREATER -1) - SET(${prefix}_${arg} TRUE) - ELSE (is_option GREATER -1) - SET(current_arg_list ${current_arg_list} ${arg}) - ENDIF (is_option GREATER -1) - ENDIF (is_arg_name GREATER -1) - ENDFOREACH(arg) - SET(${prefix}_${current_arg_name} ${current_arg_list}) -ENDMACRO(ORO_PARSE_ARGUMENTS) - # Components should add themselves by calling 'OROCOS_COMPONENT' # instead of 'ADD_LIBRARY' in CMakeLists.txt. # You can set a variable COMPONENT_VERSION x.y.z to set a version or @@ -396,15 +361,30 @@ endmacro( orocos_executable ) # Type headers should add themselves by calling 'orocos_typegen_headers()' # They will be processed by typegen to generate a typekit from it, with the # name of the current project. You may also pass additional options to typegen -# before listing your header files. For example -i where -# is the name of a pkg-config package on which your headers -# depend +# before listing your header files. +# +# Use 'DEPENDS ...' to add dependencies on other (typegen) packages. +# This macro passes the -x OROCOS_TARGET flag to typegen automatically, so there +# is no need to include the -OROCOS_TARGET suffix in the # -# Usage: orocos_typegen_headers( -i orocos_kdl robotdata.hpp sensordata.hpp ) +# NOTE: if you use a subdir for your headers, e.g. include/robotdata.hpp, it +# will install this header into pkgname/include/robotdata.hpp ! Most likely +# not what you want. So call this macro from the include dir itself. +# +# Usage: orocos_typegen_headers( robotdata.hpp sensordata.hpp DEPENDS orocos_kdl ) # macro( orocos_typegen_headers ) - MESSAGE( "[UseOrocos] Generating typekit for ${PROJECT_NAME}..." ) + ORO_PARSE_ARGUMENTS(ORO_TYPEGEN_HEADERS + "DEPENDS" + "" + ${ARGN} + ) + + if ( ORO_TYPEGEN_HEADERS_DEPENDS ) + set (ORO_TYPEGEN_HEADERS_DEP_INFO_MSG "using: ${ORO_TYPEGEN_HEADERS_DEP_INFO_MSG}") + endif() + MESSAGE( "[UseOrocos] Generating typekit for ${PROJECT_NAME} ${ORO_TYPEGEN_HEADERS_DEP_INFO_MSG}..." ) # Works in top level source dir: find_program(TYPEGEN_EXE typegen) @@ -412,12 +392,18 @@ macro( orocos_typegen_headers ) message(FATAL_ERROR "'typegen' not found in path. Can't build typekit. Did you 'source env.sh' ?") else (NOT TYPEGEN_EXE) - execute_process( COMMAND ${TYPEGEN_EXE} --output typekit ${PROJECT_NAME} ${ARGN} - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + foreach( IMP ${ORO_TYPEGEN_HEADERS_DEPENDS} ) + set(ORO_TYPEGEN_HEADERS_IMPORTS "${ORO_TYPEGEN_HEADERS_IMPORTS} -i ${IMP}" ) + endforeach() + # Working directory is necessary to be able to find the source files. + execute_process( COMMAND ${TYPEGEN_EXE} --output ${CMAKE_SOURCE_DIR}/typekit ${PROJECT_NAME} ${ORO_TYPEGEN_HEADERS_IMPORTS} ${ORO_TYPEGEN_HEADERS_DEFAULT_ARGS} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) + # work around generated manifest.xml file: - execute_process( COMMAND ${CMAKE} remove -f typekit/manifest.xml ) - add_subdirectory( typekit ) + execute_process( COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_SOURCE_DIR}/typekit/manifest.xml ) + add_subdirectory( ${CMAKE_SOURCE_DIR}/typekit ${CMAKE_BINARY_DIR}/typekit) + list(APPEND OROCOS_DEFINED_TYPES " -l${PROJECT_NAME}-typekit-${OROCOS_TARGET}") endif (NOT TYPEGEN_EXE) endmacro( orocos_typegen_headers ) From ef6d749c0e2dd53719046c843796f5e142c43679 Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Sat, 16 Feb 2013 01:21:43 +0100 Subject: [PATCH 39/63] scripting: fix crash in quantal and possibly all other OS'es. Parser rules on stack got cleaned up before they could be used. Signed-off-by: Peter Soetens --- rtt/scripting/CommonParser.cpp | 1 + rtt/scripting/ScriptParser.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/rtt/scripting/CommonParser.cpp b/rtt/scripting/CommonParser.cpp index 95f059bee..a5f27530b 100644 --- a/rtt/scripting/CommonParser.cpp +++ b/rtt/scripting/CommonParser.cpp @@ -106,6 +106,7 @@ namespace RTT { BOOST_SPIRIT_DEBUG_RULE( lexeme_identifier ); BOOST_SPIRIT_DEBUG_RULE( lexeme_notassertingidentifier ); BOOST_SPIRIT_DEBUG_RULE( type_name ); + BOOST_SPIRIT_DEBUG_RULE( skipper ); // an identifier is a word which can be used to identify a // label, or be the name of an object or method. it is required diff --git a/rtt/scripting/ScriptParser.cpp b/rtt/scripting/ScriptParser.cpp index bfd3af198..5fb3d1836 100644 --- a/rtt/scripting/ScriptParser.cpp +++ b/rtt/scripting/ScriptParser.cpp @@ -162,8 +162,12 @@ namespace RTT //skip_parser_t skip_parser = SKIP_PARSER; //iter_pol_t iter_policy( skip_parser ); //#define SKIP_PARSER - iter_pol_t iter_policy((comment_p("#") | comment_p("//") | comment_p( - "/*", "*/") | (space_p - eol_p) | commonparser->skipper)); + skip_parser_t skippers = (comment_p("#") | comment_p("//") + | comment_p("/*", "*/") + | (space_p - eol_p) + | (commonparser->skipper)); + + iter_pol_t iter_policy(skippers); scanner_pol_t policies(iter_policy); scanner_t scanner(begin, end, policies); From 28b91bac111c36d40649f51d429a655526371083 Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Sun, 17 Feb 2013 15:21:12 +0100 Subject: [PATCH 40/63] useorocos: don't eagerly assume catkin-style builds on fuerte We broke fuerte building because of assuming catkin too eagerly. Signed-off-by: Peter Soetens --- UseOROCOS-RTT.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/UseOROCOS-RTT.cmake b/UseOROCOS-RTT.cmake index f63a5f570..a50db9d4a 100644 --- a/UseOROCOS-RTT.cmake +++ b/UseOROCOS-RTT.cmake @@ -21,10 +21,10 @@ if(OROCOS-RTT_FOUND) set(ROS_ROOT $ENV{ROS_ROOT}) if (ROS_ROOT AND NOT NO_ROS_PACKAGE ) - # If pre-fuerte, we're using rosbuild + # If pre-groovy, we're using rosbuild # Otherwise, we skip this whole rosbuild mess. find_package(ROS QUIET) - if(NOT ROS_FOUND) # pre-Fuerte, use rosbuild + if(NOT ROS_FOUND OR NOT catkin_FOUND) # pre-Groovy, use rosbuild set(ROS_PACKAGE_PATH $ENV{ROS_PACKAGE_PATH}) #In bash: for i in $(echo "$ROS_PACKAGE_PATH" | sed -e's/:/ /g'); do if expr match "`pwd`" "$i"; then is_ros_package=1; fi; done > /dev/null string(REPLACE ":" ";" ROS_PACKAGE_PATH ${ROS_PACKAGE_PATH}) @@ -53,7 +53,7 @@ if(OROCOS-RTT_FOUND) unset( LIBRARY_OUTPUT_PATH ) endif() else() - message("ROS_ROOT was detected, and ROS was found as a package, assuming catkin-style building.") + message("ROS_ROOT was detected, and catkin_FOUND was set, assuming catkin-style building.") endif() endif() From 2bd03949394a2e107f9b5c1c5924dfd34d945afa Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Mon, 18 Feb 2013 11:01:32 +0100 Subject: [PATCH 41/63] useorocos: fix eclipse generator detection. Signed-off-by: Peter Soetens --- UseOROCOS-RTT.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/UseOROCOS-RTT.cmake b/UseOROCOS-RTT.cmake index a50db9d4a..9c35f813a 100644 --- a/UseOROCOS-RTT.cmake +++ b/UseOROCOS-RTT.cmake @@ -35,8 +35,7 @@ if(OROCOS-RTT_FOUND) if ( "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${path}" OR "${CMAKE_CURRENT_SOURCE_DIR}" MATCHES "${path}/" ) set(IS_ROS_PACKAGE TRUE) message("This package is in your ROS_PACKAGE_PATH, so I'm using rosbuild-style package building.") - - if (CMAKE_GENERATOR STREQUAL "Eclipse CDT4 - Unix Makefiles") + if (CMAKE_EXTRA_GENERATOR STREQUAL "Eclipse CDT4") message("Eclipse Generator detected. I'm setting EXECUTABLE_OUTPUT_PATH and LIBRARY_OUTPUT_PATH") #set the default path for built executables to the "bin" directory set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) From 9d03f068521d15134b1f67e2b827da620d547c2f Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Tue, 12 Mar 2013 13:03:22 +0100 Subject: [PATCH 42/63] cmake: the n-th fixup of the make eclipse-project target for ROS It seems now that the setting of the OUTPUT_PATHS must be done *after* rosbuild was invoked in cmake. Signed-off-by: Peter Soetens --- UseOROCOS-RTT.cmake | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/UseOROCOS-RTT.cmake b/UseOROCOS-RTT.cmake index 9c35f813a..6c6e7189c 100644 --- a/UseOROCOS-RTT.cmake +++ b/UseOROCOS-RTT.cmake @@ -35,14 +35,6 @@ if(OROCOS-RTT_FOUND) if ( "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${path}" OR "${CMAKE_CURRENT_SOURCE_DIR}" MATCHES "${path}/" ) set(IS_ROS_PACKAGE TRUE) message("This package is in your ROS_PACKAGE_PATH, so I'm using rosbuild-style package building.") - if (CMAKE_EXTRA_GENERATOR STREQUAL "Eclipse CDT4") - message("Eclipse Generator detected. I'm setting EXECUTABLE_OUTPUT_PATH and LIBRARY_OUTPUT_PATH") - #set the default path for built executables to the "bin" directory - set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) - #set the default path for built libraries to the "lib" directory - set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) - endif() - endif() endforeach() if(NOT IS_ROS_PACKAGE) @@ -123,6 +115,14 @@ if(OROCOS-RTT_FOUND) rosbuild_init() endif() + if (CMAKE_EXTRA_GENERATOR STREQUAL "Eclipse CDT4") + message("Eclipse Generator detected. I'm setting EXECUTABLE_OUTPUT_PATH and LIBRARY_OUTPUT_PATH") + #set the default path for built executables to the "bin" directory + set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) + #set the default path for built libraries to the "lib" directory + set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) + endif() + # In ros builds, we need to set the pkg-config path such that RTT is found by # the typekit/typegen/pc files logic: set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${rtt_PACKAGE_PATH}/install/lib/pkgconfig") From d52207a59f3db07520a5088233842429d1037c72 Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Wed, 17 Apr 2013 23:55:54 +0200 Subject: [PATCH 43/63] cmake: don't force install path in cmake code. Signed-off-by: Peter Soetens --- CMakeLists.txt | 12 +++++------- Makefile | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c6cf3ab65..86aa14f87 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,8 +22,6 @@ LIST( GET RTT_VERSIONS 0 RTT_VERSION_MAJOR) LIST( GET RTT_VERSIONS 1 RTT_VERSION_MINOR) LIST( GET RTT_VERSIONS 2 RTT_VERSION_PATCH) -SET(ROS_ROOT $ENV{ROS_ROOT}) - MESSAGE( "Orocos RTT version ${VERSION} (${RTT_VERSION_MAJOR}.${RTT_VERSION_MINOR}.${RTT_VERSION_PATCH})" ) SET( PROJ_SOURCE_DIR ${orocos-rtt_SOURCE_DIR} ) @@ -52,12 +50,12 @@ IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) ENDIF(MSVC) ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) -# We force it in case of ROS builds because the UseOrocos.cmake scripts will always look -# in this path, also during an autoproj/bootstrap build. +# This section checks: +# - if we're in the ROS .deb building step +# - if a symlink is present to the install dir +# - if roslib can be found +SET(ROS_ROOT $ENV{ROS_ROOT}) IF(ROS_ROOT) - SET(CMAKE_INSTALL_PREFIX - ${PROJECT_SOURCE_DIR}/../install CACHE PATH "Orocos install prefix for ROS builds" FORCE - ) # Necessary when building Debian packages: set(ROS_STACK_DIR_FINAL $ENV{ROS_STACK_DIR_FINAL}) if (ROS_STACK_DIR_FINAL) diff --git a/Makefile b/Makefile index d7fb4ee03..3136adbd9 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ ifdef ROS_ROOT -EXTRA_CMAKE_FLAGS=-DENABLE_CORBA=ON -DCORBA_IMPLEMENTATION=OMNIORB +EXTRA_CMAKE_FLAGS=-DENABLE_CORBA=ON -DCORBA_IMPLEMENTATION=OMNIORB -DCMAKE_INSTALL_PREFIX=$(shell rospack find rtt)/../install default: install_rtt include $(shell rospack find mk)/cmake.mk install_rtt: all From 5a10c0a131eb9af4d5ffccbbad4bfe387fe63c03 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 14 Feb 2013 22:32:26 +0100 Subject: [PATCH 44/63] deployment: ComponentLoader::import only interprets a package name as filename if it is an loadable library --- rtt/deployment/ComponentLoader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtt/deployment/ComponentLoader.cpp b/rtt/deployment/ComponentLoader.cpp index 938da8098..1341a1354 100644 --- a/rtt/deployment/ComponentLoader.cpp +++ b/rtt/deployment/ComponentLoader.cpp @@ -353,7 +353,7 @@ bool ComponentLoader::import( std::string const& package, std::string const& pat { // check first for exact match to *file*: path arg( package ); - if (is_regular_file(arg)) { + if (is_regular_file(arg) && isLoadableLibrary(arg)) { #if BOOST_VERSION >= 104600 return loadInProcess(arg.string(), makeShortFilename( arg.filename().string() ), true); #else From ef5da058d490c0ada2298e7fe9fe86cc335dc872 Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Wed, 24 Apr 2013 21:34:09 +0200 Subject: [PATCH 45/63] os: make void specialisation of rt allocators public Signed-off-by: Peter Soetens --- rtt/os/oro_allocator.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rtt/os/oro_allocator.hpp b/rtt/os/oro_allocator.hpp index 5dc5eebae..56faa1c32 100644 --- a/rtt/os/oro_allocator.hpp +++ b/rtt/os/oro_allocator.hpp @@ -239,6 +239,7 @@ namespace RTT { namespace os { template<> class local_allocator { + public: typedef void value_type; typedef void* pointer; typedef const void* const_pointer; @@ -320,6 +321,7 @@ namespace RTT { namespace os { template<> class rt_allocator { + public: typedef void value_type; typedef void* pointer; typedef const void* const_pointer; From 7f33e9e3fdade5f9a381d5c68300ed227490b540 Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Wed, 24 Apr 2013 21:34:26 +0200 Subject: [PATCH 46/63] plugin: updated API docs. Signed-off-by: Peter Soetens --- rtt/plugin/PluginLoader.hpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rtt/plugin/PluginLoader.hpp b/rtt/plugin/PluginLoader.hpp index 744422c4e..494d16bf0 100644 --- a/rtt/plugin/PluginLoader.hpp +++ b/rtt/plugin/PluginLoader.hpp @@ -179,7 +179,7 @@ namespace RTT { * Load any typekit found in the 'types/' subdirectory of each path in path_list in the process. * This is not a 'smart' function. It will only look into that directory and will not try * to guess a target specific subdir or any other means for locating typekits. - * @return false if some typekit caused an error, or some path was not found. + * @return false if some typekit caused an error, or some path was not found or if path_list was empty. * @param path_list A colon or semi-colon seperated list of paths * to look for typekits. No other paths will be searched. * @throw std::runtime_exception if one of the found typekits refused to load. @@ -187,9 +187,11 @@ namespace RTT { bool loadTypekits(std::string const& path_list); /** - * Load a typekit found in the 'types/' subdirectory of each path in path_list in the process. + * Load a typekit found in the 'types/' subdirectory of a package present in path_list. + * @param name The name of the package (a directory name) which contains the typekit you wish to load. * @param path_list A colon or semi-colon seperated list of paths - * to look for typekits. May be empty the empty string. + * to look for the \a name subdirectory. If this list is empty, the current plugin path is searched and + * the current working directory. * @throw std::runtime_exception if the found typekit refused to load. */ bool loadTypekit(std::string const& name, std::string const& path_list); From 4dc99771e6b97557d09c5b2a33d71c37e2f898ab Mon Sep 17 00:00:00 2001 From: Ruben Smits Date: Wed, 13 Feb 2013 20:27:49 +0100 Subject: [PATCH 47/63] cmake: ditch ros specific stuff Signed-off-by: Ruben Smits --- config/FindRoslib.cmake | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/config/FindRoslib.cmake b/config/FindRoslib.cmake index c4f5f213e..f76f87442 100644 --- a/config/FindRoslib.cmake +++ b/config/FindRoslib.cmake @@ -4,19 +4,6 @@ # Catkin style of fetching ROS deps FIND_PACKAGE( ROS QUIET COMPONENTS rospack) - IF(NOT ROS_FOUND) # pre-Fuerte or Groovy - # TODO: This block to get rospack is deprecated as of ROS Fuerte, but is left in for pre-Fuerte compatibility - set(rospack_PACKAGE_PATH ${ROS_ROOT}/core/rospack) ### XXX hardcoded - message("Falling back to rospack in: ${rospack_PACKAGE_PATH}") - find_library(ROS_LIBRARIES rospack ${rospack_PACKAGE_PATH}/lib ) - if ( NOT ROS_LIBRARIES ) - find_package( ROS COMPONENTS rospack ) # Yells at user (non-QUIET !) - else() - set(ROS_FOUND TRUE) - set(ROS_INCLUDE_DIRS ${rospack_PACKAGE_PATH}/include) - endif() - ENDIF(NOT ROS_FOUND) - IF(ROS_FOUND) include_directories( ${ROS_INCLUDE_DIRS} ) add_definitions( -DHAS_ROSLIB ) From 2ca4237e478ad44e8e980ce977fbf9b5fe8774ec Mon Sep 17 00:00:00 2001 From: Ruben Smits Date: Wed, 13 Feb 2013 20:28:47 +0100 Subject: [PATCH 48/63] cmake: make import file optional Signed-off-by: Ruben Smits --- orocos-rtt-config.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/orocos-rtt-config.cmake b/orocos-rtt-config.cmake index 4fd69a500..0b6cbc108 100644 --- a/orocos-rtt-config.cmake +++ b/orocos-rtt-config.cmake @@ -107,10 +107,8 @@ if(NOT OROCOS-RTT_FOUND) # Import targets set(OROCOS-RTT_IMPORT_FILE "${SELF_DIR}/orocos-rtt-${OROCOS_TARGET}-libraries.cmake") -if (NOT EXISTS "${OROCOS-RTT_IMPORT_FILE}") - message(FATAL_ERROR "Could not find an OROCOS-RTT installation for the ${OROCOS_TARGET} target. Missing file: ${OROCOS-RTT_IMPORT_FILE}") -endif() -include("${OROCOS-RTT_IMPORT_FILE}") +if (EXISTS "${OROCOS-RTT_IMPORT_FILE}") + include("${OROCOS-RTT_IMPORT_FILE}") # Core RTT libraries set(OROCOS-RTT_TARGET "${PREFIX}orocos-rtt-${OROCOS_TARGET}_dynamic") @@ -142,6 +140,8 @@ if(TARGET ${OROCOS-RTT-MQUEUE_TARGET}) set(FOUND_TRANSPORTS "${FOUND_TRANSPORTS} mqueue") set(OROCOS-RTT_MQUEUE_LIBRARIES ${OROCOS-RTT-MQUEUE_TARGET}) endif() +endif() + # Definitions set(OROCOS-RTT_DEFINITIONS "-DOROCOS_TARGET=${OROCOS_TARGET}") From 08eaaf2fdb883af492e45b2c5be1fccadf44c6b2 Mon Sep 17 00:00:00 2001 From: Ruben Smits Date: Wed, 13 Feb 2013 20:30:27 +0100 Subject: [PATCH 49/63] catkin: provide catkin compatible package.xml file Signed-off-by: Ruben Smits --- package.xml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 package.xml diff --git a/package.xml b/package.xml new file mode 100644 index 000000000..7532674f2 --- /dev/null +++ b/package.xml @@ -0,0 +1,29 @@ + + rtt + 2.6.0 + + Orocos/RTT component framework + + GPL v2 with linking exception + RTT Developers + RTT Developers + http://www.orocos.org/rtt + + cmake + + boost + omniorb + rospack + + boost + omniorb + rospack + + + + cmake + + + + + From 49cb7bdda98882361be5e4178b9056087ccaa03d Mon Sep 17 00:00:00 2001 From: Ruben Smits Date: Thu, 25 Apr 2013 10:25:31 +0200 Subject: [PATCH 50/63] cleanup CMakeLists from ROS polution Signed-off-by: Ruben Smits --- CMakeLists.txt | 38 +++----------------------------------- 1 file changed, 3 insertions(+), 35 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 86aa14f87..912ae83e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,41 +50,9 @@ IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) ENDIF(MSVC) ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) -# This section checks: -# - if we're in the ROS .deb building step -# - if a symlink is present to the install dir -# - if roslib can be found -SET(ROS_ROOT $ENV{ROS_ROOT}) -IF(ROS_ROOT) - # Necessary when building Debian packages: - set(ROS_STACK_DIR_FINAL $ENV{ROS_STACK_DIR_FINAL}) - if (ROS_STACK_DIR_FINAL) - set(DEFAULT_PLUGIN_PATH "${ROS_STACK_DIR_FINAL}/orocos_toolchain/install/lib/orocos") - endif(ROS_STACK_DIR_FINAL) - # Necessary for backwards compatibility such that packages find RTT's cmake macros: - if (NOT IS_SYMLINK ${CMAKE_CURRENT_SOURCE_DIR}/install ) - # Note: we use WORKING_DIRECTORY - execute_process ( - COMMAND ${CMAKE_COMMAND} -E remove_directory install - COMMAND ${CMAKE_COMMAND} -E create_symlink ../install install - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - OUTPUT_QUIET ERROR_QUIET - ) - endif() - # We had to split the if statement above in two parts because cmake 2.8.0 would choke on a single-liner: - if ( NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/install ) - # Note: we use WORKING_DIRECTORY - execute_process ( - COMMAND ${CMAKE_COMMAND} -E create_symlink ../install install - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - OUTPUT_QUIET ERROR_QUIET - ) - endif() - - # Tell deployer to use ROSlib support. - set(ROSLIB_SUPPORT TRUE) - include(config/FindRoslib.cmake) -ENDIF(ROS_ROOT) +# Tell deployer to use ROSlib support. +set(ROSLIB_SUPPORT TRUE) +include(config/FindRoslib.cmake) #Use these variables to store build-local flags. #They are used when the targets are configured. From 0ba760e6eceb1336a148ddb3bbaed03fe06ea22c Mon Sep 17 00:00:00 2001 From: Ruben Smits Date: Tue, 30 Apr 2013 14:37:35 +0200 Subject: [PATCH 51/63] Fix building with boost 1.53: this header has been deprecated since boost 1.53 Signed-off-by: Ruben Smits --- rtt/Service.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rtt/Service.hpp b/rtt/Service.hpp index 6bcaf7c39..56f95864f 100644 --- a/rtt/Service.hpp +++ b/rtt/Service.hpp @@ -58,7 +58,7 @@ #include #include #include -#if BOOST_VERSION >= 104000 +#if BOOST_VERSION >= 104000 && BOOST_VERSION <= 105030 #include #endif @@ -82,7 +82,7 @@ namespace RTT : public OperationInterface, public ConfigurationInterface, public DataFlowInterface, -#if BOOST_VERSION >= 104000 +#if BOOST_VERSION >= 104000 && BOOST_VERSION <= 105030 public boost::enable_shared_from_this2 #else public boost::enable_shared_from_this From ef4543bfd60d004b7e80d3afbdf9acb9ad43caad Mon Sep 17 00:00:00 2001 From: Ruben Smits Date: Tue, 30 Apr 2013 16:50:46 +0200 Subject: [PATCH 52/63] macosx: fix building with boost > 1.50 and Snow Leopard Signed-off-by: Ruben Smits --- rtt/os/macosx/fosi.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rtt/os/macosx/fosi.h b/rtt/os/macosx/fosi.h index 72e70ba32..a09cbe42b 100644 --- a/rtt/os/macosx/fosi.h +++ b/rtt/os/macosx/fosi.h @@ -19,6 +19,8 @@ #define _XOPEN_SOURCE 600 // use all Posix features. #endif +#define _DARWIN_C_SOURCE + #define HAVE_FOSI_API #ifdef __cplusplus From c80f385ffcf454b26a98aad307b4c88e8964f6a1 Mon Sep 17 00:00:00 2001 From: Ruben Smits Date: Fri, 3 May 2013 12:06:18 +0200 Subject: [PATCH 53/63] os: we should use the Instance API of the StartStopManager instead of keeping a local reference, partially fixes bug # 834: Unit tests fail on macosx Signed-off-by: Ruben Smits --- rtt/os/startstop.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/rtt/os/startstop.cpp b/rtt/os/startstop.cpp index 486f52732..a515e68ae 100644 --- a/rtt/os/startstop.cpp +++ b/rtt/os/startstop.cpp @@ -68,7 +68,6 @@ using namespace std; using namespace RTT; using namespace RTT::os; -static os::StartStopManager* initM; static int os_argc_arg; static char** os_argv_arg; @@ -86,8 +85,7 @@ int __os_init(int argc, char** argv ) Logger::log() << Logger::Debug << "MainThread started." << Logger::endl; Logger::log() << Logger::Debug << "Starting StartStopManager." << Logger::endl; - initM = os::StartStopManager::Instance(); - int ret = initM->start() ? 0 : 1; + int ret = os::StartStopManager::Instance()->start() ? 0 : 1; #ifdef OROPKG_OS_THREAD_SCOPE unsigned int bit = 0; @@ -175,7 +173,7 @@ void __os_exit(void) types::TypekitRepository::Release(); Logger::log() << Logger::Debug << "Stopping StartStopManager." << Logger::endl; - initM->stop(); + os::StartStopManager::Instance()->stop(); os::StartStopManager::Release(); // This should be the (one but) last message to be logged : From c11d6a276db7b1a614e37856a50d0ec10a22d195 Mon Sep 17 00:00:00 2001 From: Ruben Smits Date: Fri, 3 May 2013 12:15:57 +0200 Subject: [PATCH 54/63] tests: do not mix included and linked usage of boost unit test framework Signed-off-by: Ruben Smits --- tests/CMakeLists.txt | 3 ++- tests/test-runner-corba.cpp | 53 ++++++++++++++++++++----------------- tests/test-runner.cpp | 42 ++++++++++++++++------------- tests/unit.hpp | 2 ++ 4 files changed, 56 insertions(+), 44 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index ffafd813e..dd63e8c34 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -46,6 +46,7 @@ IF (BUILD_TESTING) DEFINE_SYMBOL "RTT_UNIT_DLL_EXPORT" SOVERSION "${RTT_VERSION_MAJOR}.${RTT_VERSION_MINOR}" VERSION "${RTT_VERSION}" + LINK_FLAGS "${CMAKE_LD_FLAGS_ADD}" # Set accumulated compilation flags: (.so and .a) COMPILE_DEFINITIONS OROCOS_TARGET=${OROCOS_TARGET} ) @@ -128,7 +129,7 @@ IF (BUILD_TESTING) IF(UNIX AND NOT OROCOS_TARGET STREQUAL "xenomai" ) ADD_EXECUTABLE( specactivities-test test-runner.cpp specialized_activities.cpp) - TARGET_LINK_LIBRARIES( specactivities-test orocos-rtt-${OROCOS_TARGET}_dynamic ) + TARGET_LINK_LIBRARIES( specactivities-test orocos-rtt-${OROCOS_TARGET}_dynamic ${TEST_LIBRARIES}) SET_TARGET_PROPERTIES( specactivities-test PROPERTIES COMPILE_FLAGS "${CMAKE_CXX_FLAGS_ADD}" LINK_FLAGS "${CMAKE_LD_FLAGS_ADD}" diff --git a/tests/test-runner-corba.cpp b/tests/test-runner-corba.cpp index bdd06ef86..627f4e1cb 100644 --- a/tests/test-runner-corba.cpp +++ b/tests/test-runner-corba.cpp @@ -30,8 +30,9 @@ #include #include "test-runner.hpp" +#define BOOST_TEST_MAIN +#define BOOST_TEST_DYN_LINK #include -#include using boost::unit_test::test_suite; @@ -39,30 +40,6 @@ using namespace RTT; using namespace RTT::corba; using namespace std; -struct InitOrocos { -public: - InitOrocos(){ } - ~InitOrocos(){ - corba::CorbaDispatcher::ReleaseAll(); - corba::TaskContextServer::ShutdownOrb(true); - corba::TaskContextServer::DestroyOrb(); - - // If we call __os_exit() in Xenomai, we get an ABORT - // because the main task is cleaned up too early. - // The work around for now is to stop all threads but - // the main thread. To be fixed if boost::test allows it. -#ifndef OROCOS_TARGET_XENOMAI - __os_exit(); -#else - os::StartStopManager::Instance()->stop(); - os::StartStopManager::Release(); -#endif -} - -}; - -BOOST_GLOBAL_FIXTURE( InitOrocos ) - boost::unit_test::test_suite* init_unit_test_suite(int argc, char** const argv) { if ( argc > 1 && strncmp(argv[1],"--help",6) == 0 ) { @@ -117,3 +94,29 @@ boost::unit_test::test_suite* init_unit_test_suite(int argc, char** const argv) return 0; } +using namespace boost::unit_test; +struct InitOrocos { +public: + InitOrocos(){ + init_unit_test_suite(framework::master_test_suite().argc,framework::master_test_suite().argv); + } + ~InitOrocos(){ + corba::CorbaDispatcher::ReleaseAll(); + corba::TaskContextServer::ShutdownOrb(true); + corba::TaskContextServer::DestroyOrb(); + + // If we call __os_exit() in Xenomai, we get an ABORT + // because the main task is cleaned up too early. + // The work around for now is to stop all threads but + // the main thread. To be fixed if boost::test allows it. +#ifndef OROCOS_TARGET_XENOMAI + __os_exit(); +#else + os::StartStopManager::Instance()->stop(); + os::StartStopManager::Release(); +#endif +} + +}; + +BOOST_GLOBAL_FIXTURE( InitOrocos ) diff --git a/tests/test-runner.cpp b/tests/test-runner.cpp index 173e8e578..8c3a406bc 100644 --- a/tests/test-runner.cpp +++ b/tests/test-runner.cpp @@ -29,33 +29,17 @@ #include #include "test-runner.hpp" +#define BOOST_TEST_MAIN +#define BOOST_TEST_DYN_LINK #include -#include using boost::unit_test::test_suite; using namespace RTT; using namespace std; -struct InitOrocos { -public: - InitOrocos(){ } - ~InitOrocos(){ - // If we call __os_exit() in Xenomai, we get an ABORT - // because the main task is cleaned up too early. - // The work around for now is to stop all threads but - // the main thread. To be fixed if boost::test allows it. -#ifndef OROCOS_TARGET_XENOMAI - __os_exit(); -#else - os::StartStopManager::Instance()->stop(); - os::StartStopManager::Release(); -#endif -} -}; -BOOST_GLOBAL_FIXTURE( InitOrocos ) boost::unit_test::test_suite* init_unit_test_suite(int argc, char** const argv) { @@ -110,3 +94,25 @@ boost::unit_test::test_suite* init_unit_test_suite(int argc, char** const argv) return 0; } +using namespace boost::unit_test; +struct InitOrocos { +public: + InitOrocos(){ + init_unit_test_suite(framework::master_test_suite().argc,framework::master_test_suite().argv); + } + ~InitOrocos(){ + // If we call __os_exit() in Xenomai, we get an ABORT + // because the main task is cleaned up too early. + // The work around for now is to stop all threads but + // the main thread. To be fixed if boost::test allows it. +#ifndef OROCOS_TARGET_XENOMAI + __os_exit(); +#else + os::StartStopManager::Instance()->stop(); + os::StartStopManager::Release(); +#endif +} + +}; + +BOOST_GLOBAL_FIXTURE( InitOrocos ) diff --git a/tests/unit.hpp b/tests/unit.hpp index f70d2332c..544fda257 100644 --- a/tests/unit.hpp +++ b/tests/unit.hpp @@ -25,6 +25,8 @@ #include #include +#define BOOST_TEST_MAIN +#define BOOST_TEST_DYN_LINK #ifdef ORO_UNIT_TEST_SUITE_HACK // Modified version that contains checkpointing // We use this in the build farm to get more precise From 14243c47d9409901e4c3081b50839d4dea5dd42e Mon Sep 17 00:00:00 2001 From: Ruben Smits Date: Wed, 15 May 2013 13:50:56 +0200 Subject: [PATCH 55/63] tests: remove duplicate BOOST_TEST_MAIN macro Signed-off-by: Ruben Smits --- tests/unit.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/unit.hpp b/tests/unit.hpp index 544fda257..62c5ed39e 100644 --- a/tests/unit.hpp +++ b/tests/unit.hpp @@ -25,7 +25,6 @@ #include #include -#define BOOST_TEST_MAIN #define BOOST_TEST_DYN_LINK #ifdef ORO_UNIT_TEST_SUITE_HACK // Modified version that contains checkpointing From 7b4327626b0d7c388b7c2086201ca05c39d5c7b2 Mon Sep 17 00:00:00 2001 From: Ruben Smits Date: Wed, 15 May 2013 14:52:48 +0200 Subject: [PATCH 56/63] cmake: add system library to user libs Signed-off-by: Ruben Smits --- config/check_depend.cmake | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/config/check_depend.cmake b/config/check_depend.cmake index c5e75deaa..ee8ea5dc3 100644 --- a/config/check_depend.cmake +++ b/config/check_depend.cmake @@ -69,6 +69,7 @@ if(Boost_INCLUDE_DIR) if(OROCOS_TARGET STREQUAL "win32") add_definitions(-DBOOST_ALL_NO_LIB) endif() + # We don't link with boost here. It depends on the options set by the user. #list(APPEND OROCOS-RTT_LIBRARIES ${Boost_LIBRARIES} ) else(Boost_INCLUDE_DIR) @@ -194,11 +195,14 @@ if(OROCOS_TARGET STREQUAL "macosx") message(SEND_ERROR "Boost thread library not found but required on macosx.") endif () - list(APPEND OROCOS-RTT_INCLUDE_DIRS ${Boost_THREAD_INCLUDE_DIRS} ) + list(APPEND OROCOS-RTT_INCLUDE_DIRS ${Boost_THREAD_INCLUDE_DIRS} ${Boost_SYSTEM_INCLUDE_DIRS} ) SELECT_ONE_LIBRARY("Boost_THREAD_LIBRARY" BOOST_THREAD_LIB) LIST(APPEND OROCOS-RTT_USER_LINK_LIBS ${BOOST_THREAD_LIB}) + SELECT_ONE_LIBRARY("Boost_SYSTEM_LIBRARY" BOOST_SYSTEM_LIB) + LIST(APPEND OROCOS-RTT_USER_LINK_LIBS ${BOOST_SYSTEM_LIB}) + message( "Forcing ORO_OS_USE_BOOST_THREAD to ON") set( ORO_OS_USE_BOOST_THREAD ON CACHE BOOL "Forced enable use of Boost.thread on macosx." FORCE) @@ -209,6 +213,7 @@ if(OROCOS_TARGET STREQUAL "macosx") # see also src/CMakeLists.txt as it adds the boost_thread library to OROCOS_RTT_LIBRARIES list(APPEND OROCOS-RTT_LIBRARIES ${PTHREAD_LIBRARIES} dl) list(APPEND OROCOS-RTT_DEFINITIONS "OROCOS_TARGET=${OROCOS_TARGET}") + else() set(OROPKG_OS_MACOSX FALSE CACHE INTERNAL "" FORCE) endif() From f2628afd713f31c703d148c60adb786bf6a3b7a9 Mon Sep 17 00:00:00 2001 From: Ruben Smits Date: Mon, 27 May 2013 12:42:56 +0200 Subject: [PATCH 57/63] Also append target suffix for macosx to not confuse the OCL utility scripts Signed-off-by: Ruben Smits --- UseOROCOS-RTT.cmake | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/UseOROCOS-RTT.cmake b/UseOROCOS-RTT.cmake index 6c6e7189c..5e5d35482 100644 --- a/UseOROCOS-RTT.cmake +++ b/UseOROCOS-RTT.cmake @@ -183,7 +183,7 @@ macro( orocos_component COMPONENT_NAME ) endif() # Set library name: - if ( ${OROCOS_TARGET} STREQUAL "gnulinux" OR ${OROCOS_TARGET} STREQUAL "lxrt" OR ${OROCOS_TARGET} STREQUAL "xenomai" OR ${OROCOS_TARGET} STREQUAL "win32") + if ( ${OROCOS_TARGET} STREQUAL "gnulinux" OR ${OROCOS_TARGET} STREQUAL "lxrt" OR ${OROCOS_TARGET} STREQUAL "xenomai" OR ${OROCOS_TARGET} STREQUAL "win32" OR ${OROCOS_TARGET} STREQUAL "macosx") set( COMPONENT_LIB_NAME ${COMPONENT_NAME}-${OROCOS_TARGET}) else() set( COMPONENT_LIB_NAME ${COMPONENT_NAME}) @@ -263,7 +263,7 @@ macro( orocos_library LIB_TARGET_NAME ) set(AC_INSTALL_RT_DIR bin) endif() - if ( ${OROCOS_TARGET} STREQUAL "gnulinux" OR ${OROCOS_TARGET} STREQUAL "lxrt" OR ${OROCOS_TARGET} STREQUAL "xenomai" OR ${OROCOS_TARGET} STREQUAL "win32") + if ( ${OROCOS_TARGET} STREQUAL "gnulinux" OR ${OROCOS_TARGET} STREQUAL "lxrt" OR ${OROCOS_TARGET} STREQUAL "xenomai" OR ${OROCOS_TARGET} STREQUAL "win32" OR ${OROCOS_TARGET} STREQUAL "macosx") set( LIB_NAME ${LIB_TARGET_NAME}-${OROCOS_TARGET}) else() set( LIB_NAME ${LIB_TARGET_NAME}) @@ -325,7 +325,7 @@ macro( orocos_executable EXE_TARGET_NAME ) set(AC_INSTALL_RT_DIR bin) endif() - if ( ${OROCOS_TARGET} STREQUAL "gnulinux" OR ${OROCOS_TARGET} STREQUAL "lxrt" OR ${OROCOS_TARGET} STREQUAL "xenomai" OR ${OROCOS_TARGET} STREQUAL "win32") + if ( ${OROCOS_TARGET} STREQUAL "gnulinux" OR ${OROCOS_TARGET} STREQUAL "lxrt" OR ${OROCOS_TARGET} STREQUAL "xenomai" OR ${OROCOS_TARGET} STREQUAL "win32" OR ${OROCOS_TARGET} STREQUAL "macosx") set( EXE_NAME ${EXE_TARGET_NAME}-${OROCOS_TARGET}) else() set( EXE_NAME ${EXE_TARGET_NAME}) @@ -437,7 +437,7 @@ macro( orocos_typekit LIB_TARGET_NAME ) set( LIB_COMPONENT_VERSION VERSION ${ORO_TYPEKIT_VERSION}) endif(ORO_TYPEKIT_VERSION) - if ( ${OROCOS_TARGET} STREQUAL "gnulinux" OR ${OROCOS_TARGET} STREQUAL "lxrt" OR ${OROCOS_TARGET} STREQUAL "xenomai" OR ${OROCOS_TARGET} STREQUAL "win32") + if ( ${OROCOS_TARGET} STREQUAL "gnulinux" OR ${OROCOS_TARGET} STREQUAL "lxrt" OR ${OROCOS_TARGET} STREQUAL "xenomai" OR ${OROCOS_TARGET} STREQUAL "win32" OR ${OROCOS_TARGET} STREQUAL "macosx") set( LIB_NAME ${LIB_TARGET_NAME}-${OROCOS_TARGET}) else() set( LIB_NAME ${LIB_TARGET_NAME}) @@ -506,7 +506,7 @@ macro( orocos_plugin LIB_TARGET_NAME ) set( LIB_COMPONENT_VERSION VERSION ${ORO_PLUGIN_VERSION}) endif(ORO_PLUGIN_VERSION) - if ( ${OROCOS_TARGET} STREQUAL "gnulinux" OR ${OROCOS_TARGET} STREQUAL "lxrt" OR ${OROCOS_TARGET} STREQUAL "xenomai" OR ${OROCOS_TARGET} STREQUAL "win32") + if ( ${OROCOS_TARGET} STREQUAL "gnulinux" OR ${OROCOS_TARGET} STREQUAL "lxrt" OR ${OROCOS_TARGET} STREQUAL "xenomai" OR ${OROCOS_TARGET} STREQUAL "win32" OR ${OROCOS_TARGET} STREQUAL "macosx") set( LIB_NAME ${LIB_TARGET_NAME}-${OROCOS_TARGET}) else() set( LIB_NAME ${LIB_TARGET_NAME}) From 71a33ead86e9bd160da4f8d8a33bac4c5f16b774 Mon Sep 17 00:00:00 2001 From: Ruben Smits Date: Mon, 27 May 2013 16:17:08 +0200 Subject: [PATCH 58/63] cmake: UseOrocos macros should use the correct way of rpath setting on OSX Signed-off-by: Ruben Smits --- UseOROCOS-RTT.cmake | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/UseOROCOS-RTT.cmake b/UseOROCOS-RTT.cmake index 5e5d35482..97e953154 100644 --- a/UseOROCOS-RTT.cmake +++ b/UseOROCOS-RTT.cmake @@ -219,6 +219,12 @@ macro( orocos_component COMPONENT_NAME ) INSTALL_RPATH_USE_LINK_PATH 1 INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib/orocos${OROCOS_SUFFIX};${CMAKE_INSTALL_PREFIX}/lib;${CMAKE_INSTALL_PREFIX}/${AC_INSTALL_DIR}" ) + if(APPLE) + SET_TARGET_PROPERTIES( ${COMPONENT_NAME} PROPERTIES + INSTALL_NAME_DIR "@rpath" + LINK_FLAGS "-Wl,-rpath ${CMAKE_INSTALL_PREFIX}/lib/orocos${OROCOS_SUFFIX} -rpath ${CMAKE_INSTALL_PREFIX}/lib -rpath ${CMAKE_INSTALL_PREFIX}/${AC_INSTALL_DIR}" + ) + endif() orocos_add_compile_flags(${COMPONENT_NAME} ${USE_OROCOS_COMPILE_FLAGS}) orocos_add_link_flags(${COMPONENT_NAME} ${USE_OROCOS_LINK_FLAGS}) TARGET_LINK_LIBRARIES( ${COMPONENT_NAME} ${OROCOS-RTT_LIBRARIES} ) #${OROCOS-RTT_TYPEKIT_LIBRARIES} ) @@ -292,6 +298,12 @@ macro( orocos_library LIB_TARGET_NAME ) INSTALL_RPATH_USE_LINK_PATH 1 INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib;${CMAKE_INSTALL_PREFIX}/${AC_INSTALL_DIR}" ) + if(APPLE) + SET_TARGET_PROPERTIES( ${LIB_TARGET_NAME} PROPERTIES + INSTALL_NAME_DIR "@rpath" + LINK_FLAGS "-Wl,-rpath ${CMAKE_INSTALL_PREFIX}/lib -rpath ${CMAKE_INSTALL_PREFIX}/${AC_INSTALL_DIR}" + ) + endif() orocos_add_compile_flags(${LIB_TARGET_NAME} ${USE_OROCOS_COMPILE_FLAGS}) orocos_add_link_flags(${LIB_TARGET_NAME} ${USE_OROCOS_LINK_FLAGS}) TARGET_LINK_LIBRARIES( ${LIB_TARGET_NAME} ${OROCOS-RTT_LIBRARIES} ) #${OROCOS-RTT_TYPEKIT_LIBRARIES} ) @@ -342,9 +354,16 @@ macro( orocos_executable EXE_TARGET_NAME ) INSTALL_RPATH_USE_LINK_PATH 1 INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/bin;${CMAKE_INSTALL_PREFIX}/${AC_INSTALL_DIR}" ) - if(CMAKE_DEBUG_POSTFIX) - set_target_properties( ${EXE_TARGET_NAME} PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX} ) - endif(CMAKE_DEBUG_POSTFIX) + if(APPLE) + SET_TARGET_PROPERTIES( ${EXE_TARGET_NAME} PROPERTIES + INSTALL_NAME_DIR "@rpath" + LINK_FLAGS "-Wl,-rpath ${CMAKE_INSTALL_PREFIX}/bin -rpath ${CMAKE_INSTALL_PREFIX}/${AC_INSTALL_DIR}" + ) + endif() + + if(CMAKE_DEBUG_POSTFIX) + set_target_properties( ${EXE_TARGET_NAME} PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX} ) + endif(CMAKE_DEBUG_POSTFIX) orocos_add_compile_flags(${EXE_TARGET_NAME} ${USE_OROCOS_COMPILE_FLAGS}) orocos_add_link_flags(${EXE_TARGET_NAME} ${USE_OROCOS_LINK_FLAGS}) @@ -461,6 +480,13 @@ macro( orocos_typekit LIB_TARGET_NAME ) INSTALL_RPATH_USE_LINK_PATH 1 INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib;${CMAKE_INSTALL_PREFIX}/lib/orocos${OROCOS_SUFFIX}/types;${CMAKE_INSTALL_PREFIX}/${AC_INSTALL_DIR}" ) + if(APPLE) + SET_TARGET_PROPERTIES( ${LIB_TARGET_NAME} PROPERTIES + INSTALL_NAME_DIR "@rpath" + LINK_FLAGS "-Wl,-rpath ${CMAKE_INSTALL_PREFIX}/lib -rpath ${CMAKE_INSTALL_PREFIX}/lib/orocos${OROCOS_SUFFIX}/types -rpath ${CMAKE_INSTALL_PREFIX}/${AC_INSTALL_DIR}" + ) + endif() + TARGET_LINK_LIBRARIES( ${LIB_TARGET_NAME} ${OROCOS-RTT_LIBRARIES} ) # On win32, typekit runtime (.dll) should go in orocos/types folder @@ -531,6 +557,12 @@ macro( orocos_plugin LIB_TARGET_NAME ) INSTALL_RPATH_USE_LINK_PATH 1 INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib;${CMAKE_INSTALL_PREFIX}/lib/orocos${OROCOS_SUFFIX}/plugins;${CMAKE_INSTALL_PREFIX}/${AC_INSTALL_DIR}" ) + if(APPLE) + SET_TARGET_PROPERTIES( ${LIB_TARGET_NAME} PROPERTIES + INSTALL_NAME_DIR "@rpath" + LINK_FLAGS "-Wl,-rpath ${CMAKE_INSTALL_PREFIX}/lib -rpath ${CMAKE_INSTALL_PREFIX}/lib/orocos${OROCOS_SUFFIX}/plugins -rpath ${CMAKE_INSTALL_PREFIX}/${AC_INSTALL_DIR}" + ) + endif() orocos_add_compile_flags(${LIB_TARGET_NAME} ${USE_OROCOS_COMPILE_FLAGS}) orocos_add_link_flags(${LIB_TARGET_NAME} ${USE_OROCOS_LINK_FLAGS}) TARGET_LINK_LIBRARIES( ${LIB_TARGET_NAME} ${OROCOS-RTT_LIBRARIES} ) #${OROCOS-RTT_TYPEKIT_LIBRARIES} ) From a5483ac55dacf27c39725237c9baa60ffa8f0906 Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Tue, 11 Jun 2013 17:11:19 +0200 Subject: [PATCH 59/63] useorocos: generate typekits in the project source dir Required in case we use catkin. Signed-off-by: Peter Soetens --- UseOROCOS-RTT.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/UseOROCOS-RTT.cmake b/UseOROCOS-RTT.cmake index 97e953154..e688f4b04 100644 --- a/UseOROCOS-RTT.cmake +++ b/UseOROCOS-RTT.cmake @@ -96,7 +96,7 @@ if(OROCOS-RTT_FOUND) endif(DEFINED ORO_DEFAULT_INSTALL_PREFIX) # Infer package name from directory name. - get_filename_component(orocos_package ${CMAKE_SOURCE_DIR} NAME) + get_filename_component(orocos_package ${PROJECT_SOURCE_DIR} NAME) message("[UseOrocos] Building package ${orocos_package}") # Set to true to indicate that these macros are available. set(USE_OROCOS_RTT 1) @@ -414,13 +414,13 @@ macro( orocos_typegen_headers ) set(ORO_TYPEGEN_HEADERS_IMPORTS "${ORO_TYPEGEN_HEADERS_IMPORTS} -i ${IMP}" ) endforeach() # Working directory is necessary to be able to find the source files. - execute_process( COMMAND ${TYPEGEN_EXE} --output ${CMAKE_SOURCE_DIR}/typekit ${PROJECT_NAME} ${ORO_TYPEGEN_HEADERS_IMPORTS} ${ORO_TYPEGEN_HEADERS_DEFAULT_ARGS} + execute_process( COMMAND ${TYPEGEN_EXE} --output ${PROJECT_SOURCE_DIR}/typekit ${PROJECT_NAME} ${ORO_TYPEGEN_HEADERS_IMPORTS} ${ORO_TYPEGEN_HEADERS_DEFAULT_ARGS} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) # work around generated manifest.xml file: - execute_process( COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_SOURCE_DIR}/typekit/manifest.xml ) - add_subdirectory( ${CMAKE_SOURCE_DIR}/typekit ${CMAKE_BINARY_DIR}/typekit) + execute_process( COMMAND ${CMAKE_COMMAND} -E remove -f ${PROJECT_SOURCE_DIR}/typekit/manifest.xml ) + add_subdirectory( ${PROJECT_SOURCE_DIR}/typekit ${PROJECT_BINARY_DIR}/typekit) list(APPEND OROCOS_DEFINED_TYPES " -l${PROJECT_NAME}-typekit-${OROCOS_TARGET}") endif (NOT TYPEGEN_EXE) From 544e1d5494e8d5a48839afed96444e62cac10edd Mon Sep 17 00:00:00 2001 From: Javier Hidalgo Carrio Date: Wed, 3 Jul 2013 12:20:25 +0200 Subject: [PATCH 60/63] extras: fix ROPtr::reset(ptr) when 'ptr' is the actual pointer that 'this' already manages --- rtt/extras/ReadOnlyPointer.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rtt/extras/ReadOnlyPointer.hpp b/rtt/extras/ReadOnlyPointer.hpp index e0bacfc77..7bdb0b14b 100644 --- a/rtt/extras/ReadOnlyPointer.hpp +++ b/rtt/extras/ReadOnlyPointer.hpp @@ -147,6 +147,8 @@ namespace RTT return; } + if (safe->value == ptr) + return; { os::MutexLock do_lock(safe->lock); if (safe->readers == 2) // we are sole owner From 6addf25a1b7bd01d668a809ba84e9a231f09f69c Mon Sep 17 00:00:00 2001 From: Peter Soetens Date: Thu, 11 Jul 2013 23:14:46 +0200 Subject: [PATCH 61/63] Default to dry setup for Groovy and wet for Hydro or later. Set NO_ROS_BUILD to force wet/catkin. Signed-off-by: Peter Soetens --- UseOROCOS-RTT.cmake | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/UseOROCOS-RTT.cmake b/UseOROCOS-RTT.cmake index e688f4b04..a791727fb 100644 --- a/UseOROCOS-RTT.cmake +++ b/UseOROCOS-RTT.cmake @@ -20,7 +20,7 @@ if(OROCOS-RTT_FOUND) add_definitions(${OROCOS-RTT_DEFINITIONS}) set(ROS_ROOT $ENV{ROS_ROOT}) - if (ROS_ROOT AND NOT NO_ROS_PACKAGE ) + if (ROS_ROOT AND NOT NO_ROS_PACKAGE AND NOT NO_ROS_BUILD) # If pre-groovy, we're using rosbuild # Otherwise, we skip this whole rosbuild mess. find_package(ROS QUIET) @@ -44,7 +44,14 @@ if(OROCOS-RTT_FOUND) unset( LIBRARY_OUTPUT_PATH ) endif() else() - message("ROS_ROOT was detected, and catkin_FOUND was set, assuming catkin-style building.") + set (ROS_DISTRO $ENV{ROS_DISTRO}) + if ( ROS_DISTRO STREQUAL groovy ) + message("ROS_ROOT was detected, and Groovy was detected, assuming rosbuild-style (dry) building (no make install required). Set NO_ROS_BUILD to TRUE to use plain cmake or catkin 'wet' style building.") + set(IS_ROS_PACKAGE TRUE) + else() + #Hydro and later... + message("ROS_ROOT was detected, and catkin_FOUND was set, assuming catkin-style building (you'll need to make install).") + endif() endif() endif() From 12273bcc5a0f7fd091db77835a731339f25c60a4 Mon Sep 17 00:00:00 2001 From: Ruben Smits Date: Tue, 10 Sep 2013 16:04:49 +0200 Subject: [PATCH 62/63] cmake: fix APPLE LINKFLAGS wrt rpath settings Signed-off-by: Ruben Smits --- UseOROCOS-RTT.cmake | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/UseOROCOS-RTT.cmake b/UseOROCOS-RTT.cmake index a791727fb..2a210fe39 100644 --- a/UseOROCOS-RTT.cmake +++ b/UseOROCOS-RTT.cmake @@ -229,7 +229,7 @@ macro( orocos_component COMPONENT_NAME ) if(APPLE) SET_TARGET_PROPERTIES( ${COMPONENT_NAME} PROPERTIES INSTALL_NAME_DIR "@rpath" - LINK_FLAGS "-Wl,-rpath ${CMAKE_INSTALL_PREFIX}/lib/orocos${OROCOS_SUFFIX} -rpath ${CMAKE_INSTALL_PREFIX}/lib -rpath ${CMAKE_INSTALL_PREFIX}/${AC_INSTALL_DIR}" + LINK_FLAGS "-Wl,-rpath,${CMAKE_INSTALL_PREFIX}/lib/orocos${OROCOS_SUFFIX},-rpath,${CMAKE_INSTALL_PREFIX}/lib,-rpath,${CMAKE_INSTALL_PREFIX}/${AC_INSTALL_DIR}" ) endif() orocos_add_compile_flags(${COMPONENT_NAME} ${USE_OROCOS_COMPILE_FLAGS}) @@ -308,7 +308,7 @@ macro( orocos_library LIB_TARGET_NAME ) if(APPLE) SET_TARGET_PROPERTIES( ${LIB_TARGET_NAME} PROPERTIES INSTALL_NAME_DIR "@rpath" - LINK_FLAGS "-Wl,-rpath ${CMAKE_INSTALL_PREFIX}/lib -rpath ${CMAKE_INSTALL_PREFIX}/${AC_INSTALL_DIR}" + LINK_FLAGS "-Wl,-rpath,${CMAKE_INSTALL_PREFIX}/lib,-rpath,${CMAKE_INSTALL_PREFIX}/${AC_INSTALL_DIR}" ) endif() orocos_add_compile_flags(${LIB_TARGET_NAME} ${USE_OROCOS_COMPILE_FLAGS}) @@ -364,7 +364,7 @@ macro( orocos_executable EXE_TARGET_NAME ) if(APPLE) SET_TARGET_PROPERTIES( ${EXE_TARGET_NAME} PROPERTIES INSTALL_NAME_DIR "@rpath" - LINK_FLAGS "-Wl,-rpath ${CMAKE_INSTALL_PREFIX}/bin -rpath ${CMAKE_INSTALL_PREFIX}/${AC_INSTALL_DIR}" + LINK_FLAGS "-Wl,-rpath,${CMAKE_INSTALL_PREFIX}/bin,-rpath,${CMAKE_INSTALL_PREFIX}/${AC_INSTALL_DIR}" ) endif() @@ -490,7 +490,7 @@ macro( orocos_typekit LIB_TARGET_NAME ) if(APPLE) SET_TARGET_PROPERTIES( ${LIB_TARGET_NAME} PROPERTIES INSTALL_NAME_DIR "@rpath" - LINK_FLAGS "-Wl,-rpath ${CMAKE_INSTALL_PREFIX}/lib -rpath ${CMAKE_INSTALL_PREFIX}/lib/orocos${OROCOS_SUFFIX}/types -rpath ${CMAKE_INSTALL_PREFIX}/${AC_INSTALL_DIR}" + LINK_FLAGS "-Wl,-rpath,${CMAKE_INSTALL_PREFIX}/lib,-rpath,${CMAKE_INSTALL_PREFIX}/lib/orocos${OROCOS_SUFFIX}/types,-rpath,${CMAKE_INSTALL_PREFIX}/${AC_INSTALL_DIR}" ) endif() @@ -567,7 +567,7 @@ macro( orocos_plugin LIB_TARGET_NAME ) if(APPLE) SET_TARGET_PROPERTIES( ${LIB_TARGET_NAME} PROPERTIES INSTALL_NAME_DIR "@rpath" - LINK_FLAGS "-Wl,-rpath ${CMAKE_INSTALL_PREFIX}/lib -rpath ${CMAKE_INSTALL_PREFIX}/lib/orocos${OROCOS_SUFFIX}/plugins -rpath ${CMAKE_INSTALL_PREFIX}/${AC_INSTALL_DIR}" + LINK_FLAGS "-Wl,-rpath,${CMAKE_INSTALL_PREFIX}/lib,-rpath,${CMAKE_INSTALL_PREFIX}/lib/orocos${OROCOS_SUFFIX}/plugins,-rpath,${CMAKE_INSTALL_PREFIX}/${AC_INSTALL_DIR}" ) endif() orocos_add_compile_flags(${LIB_TARGET_NAME} ${USE_OROCOS_COMPILE_FLAGS}) From 4359266e3cd13a65cdab8e3ea0af49ca09797430 Mon Sep 17 00:00:00 2001 From: Ruben Smits Date: Tue, 10 Sep 2013 16:06:14 +0200 Subject: [PATCH 63/63] macosx: fix clashing Posix features defines Signed-off-by: Ruben Smits --- rtt/os/macosx/fosi.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/rtt/os/macosx/fosi.h b/rtt/os/macosx/fosi.h index a09cbe42b..935b92165 100644 --- a/rtt/os/macosx/fosi.h +++ b/rtt/os/macosx/fosi.h @@ -15,10 +15,6 @@ #ifndef __FOSI_H #define __FOSI_H -#ifndef _XOPEN_SOURCE -#define _XOPEN_SOURCE 600 // use all Posix features. -#endif - #define _DARWIN_C_SOURCE #define HAVE_FOSI_API