RTT 2.0 Renaming table

This page lists the renamings/relocations done on the RTT 2.0 branch (available through gitorious on http://www.gitorious.org/orocos-toolchain/rtt/commits/master) and also offers the conversion scripts to do the renaming.

A note about headers/namespaces: If a header is in rtt/extras, the namespace will be RTT::extras and vice versa. A header in rtt/ has namespace RTT. Note: the OS namespace has been renamed to lowercase os. The Corba namespace has been renamed to lowercase corba.


The script attached to the bottom of this page converts RTT 1.x code according to the renaming table below. They do so in a quasi-intelligent way and catch most cases quite correctly. Some changes require additional manual intervention because the script can not guess the missing content. You will also need to download the rtt2-converter program from here.

Namespace conversions and simple renames

Many other files moved into sub-namespaces. For all these renames and more, a script is attached to this wiki page. You need to download headers.txt, classdump.txt and to-rtt-2.0.pl.txt and rename the to-rtt-2.0.pl.txt script to to-rtt-2.0.pl:
mv to-rtt-2.0.pl.txt to-rtt-2.0.pl
chmod a+x to-rtt-2.0.pl
./to-rtt-2.0.pl $(find . -name "*.cpp" -o -name "*.hpp")
The script will read headers.txt and class-dump.txt to do its renaming work for every changed RTT header and class on the list of files you give as an argument. Feel free to report problems on the orocos-dev mailing list or RTT-dev forum.

Minor manual fixes may be expected after running this script. Be sure to have your sources version controlled, such that you can first test what the script does before permanently changing files.

Flow port and services conversions

A second program is required to convert flow port and method/command -> operation conversions that go further than a simple rename. This is called rtt2-converter. It requires boost 1.41.0 or newer. You can build rtt2-converter from Eclipse or using the Makefile using 'make all'. It also requires a recent installed version of boost with the regex library (It will link with -lregex and includes regex boost headers). See the rtt2-converter README.txt for instructions and download the converter sources from the toolchain/upgrading link.

tar xjf rtt2-converter-1.1.tar.bz2
cd rtt2-converter-1.1
./rtt2-converter Component.hpp Component.cpp

The script takes preferably both header and implementation of your component, but will also accept a single file. It needs both class definition and implementation to make its best guesses on how to convert. If all your code is in a .hpp or .cpp file, you only need to specify that file. If nothing is to be done, the file will remain the same, so you may 'accidentally' feed non-Orocos files, or a file twice.

To run this on a large codebase, you can do something similar to:

# Calls : ./rtt2-converter Component.hpp Component.cpp for each file in orocos-app
for i in $(find /home/user/src/orocos-app -name "*.cpp"); do ./rtt2-converter $(dirname $i)/$(basename $i cpp)hpp $i; done
# Calls : ./rtt2-converter Component.cpp for each .cpp file in orocos-app
for i in $(find /home/user/src/orocos-app -name "*.cpp"); do ./rtt2-converter $i; done
# Calls : ./rtt2-converter Component.hpp for each .hpp file in orocos-app
for i in $(find /home/user/src/orocos-app -name "*.hpp"); do ./rtt2-converter $i; done
This looks up all .cpp files in an orocos-app directory and calls rtt2-converter on each hpp/cpp pair. The dirname/basename construct is for replacing the .cpp extension with .hpp. If you have a mixed hpp+cpp/cpp/hpp repository, you'll have to run the for loop three times as shown above. The script is robust against calling it multiple times on the same file.

Core API

RTT 1.0 RTT 2.0 Comments
RTT::PeriodicActivity RTT::extras::PeriodicActivity Use of RTT::Activity is prefered
RTT::Timer RTT::os::Timer
RTT::SlaveActivity, SequentialActivity, SimulationThread, IRQActivity, FileDescriptorActivity, EventDrivenActivity, SimulationActivity, ConfigurationInterface, Configurator, TimerThread RTT::extras::... EventDrivenActivity has been removed.
RTT::OS::SingleThread, RTT::OS::PeriodicThread RTT::os::Thread Can do periodic and non-periodic and switch at run-time.
RTT::TimeService RTT::os::TimeService
RTT::DataPort,BufferPort RTT::InputPort,RTT::OutputPort Buffered/unbuffered is decided upon connection time. Only input/output is hardcoded.
RTT::types() RTT::types::Types() The function name collided with the namespace name
RTT::Toolkit* RTT::types::Typekit* More logical name
RTT::Command RTT::Operation Create an 'OwnThread' operation type
RTT::Method RTT::Operation Create an 'ClientThread' operation type
RTT::Event RTT::internal::Signal Events are replaced by OutputPort or Operation, the Signal class is a synchonous-only callback manager.
commands()->getCommand<T>() provides()->getOperation() get a provided operation, no template argument required
commands()->addCommand() provides()->addOperation().doc("Description") add a provided operation, document using .doc("doc").doc("a1","a1 doc")...
methods()->getMethod<T>() provides()->getOperation() get a provided operation, no template argument required
methods()->addMethod() provides()->addOperation().doc("Description") add a provided operation, document using .doc("doc").doc("a1","a1 doc")...
attributes()->getAttribute<T>() provides()->getAttribute() get a provided attribute, no template argument required
attributes()->addAttribute(&a) provides()->addAttribute(a) add a provided attribute, passed by reference, can now also add a normal member variable.
properties()->getProperty<T>() provides()->getProperty() get a provided property, no template argument required
properties()->addProperty(&p) provides()->addProperty(p).doc("Description") add a provided property, passed by reference, can now also add a normal member variable.
events()->getEvent<T>() ports()->getPort() OR provides()->getOperation<T>() Event<T> was replaced by OutputPort<T> or Operation<T>
ports()->addPort(&port, "Description") ports()->addPort( port ).doc("Description") Takes argument by reference and documents using .doc("text").


RTT 1.0 RTT 2.0 Comments
scripting() getProvider<Scripting>("scripting") Returns a RTT::Scripting object. Also add #include <rtt/scripting/Scripting.hpp>


RTT 1.0 RTT 2.0 Comments
marshalling() getProvider<Marshalling>("marshalling") Returns a RTT::Marshalling object. Also add #include <rtt/marsh/Marshalling.hpp>
RTT::Marshaller RTT::marsh::MarshallingInterface Normally not needed for normal users.
RTT::Demarshaller RTT::marsh::DemarshallingInterface Normally not needed for normal users.

CORBA Transport

RTT 1.0 RTT 2.0 Comments
RTT::Corba::* RTT::corba::C* Each proxy class or idl interface starts with a 'C' to avoid confusion with the same named RTT C++ classes
RTT::Corba::ControlTaskServer RTT::corba::TaskContextServer renamed for consistency.
RTT::Corba::ControlTaskProxy RTT::corba::TaskContextProxy renamed for consistency.
RTT::Corba::Method,Command RTT::corba::COperationRepository,CSendHandle No need to create these helper objects, call COperationRepository directly
RTT::Corba::AttributeInterface,Expression,AssignableExpression RTT::corba::CAttributeRepository No need to create expression objects, query/use CAttributeRepository directly.
class-dump.txt7.89 KB
headers.txt10.17 KB
to-rtt-2.0.pl.txt4.78 KB