.. _migration: ============= Migration ============= Migrating from |project| 0.3 to |project| 0.4 ============================================= |project| is under continuous development, sometimes resulting in API changes between minor versions, as happened between |project| 0.3 to |project| 0.4. This page helps by pointing to the most prominent API changes. Examples for all of the aspects can be found :ref:`here `. Node / Component base class names --------------------------------- The base classes for :ref:`Nodes and Components ` were renamed consistently (see API documentation): * ``CCANode`` => ``Node`` * ``BaseComponent`` => ``Component`` Initial component state ----------------------- While in |project| 0.3 components were initialized *stopped*, which seemed like an unconvenient default, in |project| 0.4 the initial state of a component can be specified. It is now *executing* by default and can be set via an optional second parameter in the component constructor:: // MyDefaultComponent will be initialized executing class MyDefaultComponent : cca::Component { MyDefaultComponent() // Constructor : cca::Component("Default Component") { ... } // MyStoppedComponent will be initialized stopped class MyStoppedComponent : cca::Component { MyStoppedComponent() // Constructor : cca::Component("Stopped Component", ComponentState::STOPPED()) { ... } see also: :ref:`lifecycle`. Ports are named and typed ------------------------- Component and node :ref:`Ports ` are now typed and provide their own API for sending and receiving data, which was formerly done through the API of the node or component. Ports are meant to be class members now and are registered to the node / component by a name for configuration. Publishing data through a port is now:: OutputPort::Ptr PORT; ... OutputPort::DataPtr data = ... OUT->publish(data); Receiving data now became significantly easier. Since the ports are typed, manual casting is no longer required:: InputPort::Ptr PORT; ... InputPort::DataPtr data = IN->get(); Processing strategy class names and helper methods -------------------------------------------------- The classes of the standard :ref:`Processing Strategies ` were renamed for the sake of brevity (see API documentation): * ``TimedProcessing`` => ``Timed`` * ``ModerateProcessing`` => ``Moderate`` * ... The static helper methods to create shared pointers were renamed to be more specific (see API documentation): * ``TimedProcessing::create(2)`` => ``Timed::samplerate(2)`` * ``ModerateProcessing::create(0)`` => ``Moderate::noTimeout()`` * ``PortTriggeredProcessing::create(0)`` => ``PortTriggered::port("feedback")`` * ... Printing nodes and components ----------------------------- Printing component information is now accessible over the print() method:: std::cout << myNode->print() << std::endl;