[Documentation] [TitleIndex] [WordIndex

(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.


Description: Manipulators for ecl streams.

Keywords: ecl streams manipulators

Tutorial Level: INTERMEDIATE


Ecl manipulators are defined to enable some similar functionality to c++'s cout manipulators for ecl's streams. However they extend the concept to use class instantiations rather than functions. This provides one important advantage over the former, these manipulators can retain state. Given that they're also easy to customise, this opens up many possibilities.

The default manipulators defined in the ecl export a few global instantiations, namely


Using manipulators follows the same pattern as for standard c++ style cout manipulators.

   1 int main() {
   2     ecl::OConsoleStream ostream;
   3     ostream << ecl::clrscr;
   4     ostream << "Dude" << ecl::endl;
   5     return;
   6 }

Creating your own Manipulators

include <ecl/streams/manipulators.hpp>

class MyManipulator : public ecl::Manipulator<MyManipulator> {
    template <typename OutputStream>
    void action (OutputStream& ostream) {
        // ...

2020-01-18 12:37