boost::statechart visualisation Antons Jelkins Meeting C++ 2019 . - - PowerPoint PPT Presentation

boost statechart visualisation
SMART_READER_LITE
LIVE PREVIEW

boost::statechart visualisation Antons Jelkins Meeting C++ 2019 . - - PowerPoint PPT Presentation

boost::statechart visualisation Antons Jelkins Meeting C++ 2019 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Antons Jelkins boost::statechart visualisation Meeting


slide-1
SLIDE 1

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

boost::statechart visualisation

Antons Jel̦kins Meeting C++ 2019

Antons Jel̦kins boost::statechart visualisation Meeting C++ 2019 1 / 7

slide-2
SLIDE 2

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

About me

Hello! My name is Anton. I work at BMW. I do software which runs in cars. I mostly code in C++. antons.jelkins@bmw.de

Antons Jel̦kins boost::statechart visualisation Meeting C++ 2019 2 / 7

slide-3
SLIDE 3

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

What is boost::statechart?

‘The Boost Statechart library is a framework that allows you to quickly transform a UML statechart into executable C++ code.’

https://www.boost.org/doc/libs/1_71_0/libs/statechart/doc/tutorial.html

Example

struct StopWatch : sc::state_machine< StopWatch, Active > {}; struct EvStartStop : sc::event< EvStartStop > {}; struct Active : sc::simple_state< Active, StopWatch, Stopped > { using reactions = mpl::list< sc::transition< EvReset, Active >, sc::custom_reaction< EvPlayMusic >, sc::deferral< EvTerminate > >; sc::result react(const EvPlayMusic &ev); };

Antons Jel̦kins boost::statechart visualisation Meeting C++ 2019 3 / 7

slide-4
SLIDE 4

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Problem statement

Let’s have a look at these common use cases: New feature. State machine must be modiied. Code review. Someone modiied a state machine. Bug analysis. State machine misbehave.

  • Learning. You are new to the code base.

These tasks require you to have an overview of the state machines. It is relatively hard to get an overview of boost::statecharts by just looking at C++ code: No explicit transition table. Notation is quite verbose. Implementation can span multiple iles.

Antons Jel̦kins boost::statechart visualisation Meeting C++ 2019 4 / 7

slide-5
SLIDE 5

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Problem statement

Let’s have a look at these common use cases: New feature. State machine must be modiied. Code review. Someone modiied a state machine. Bug analysis. State machine misbehave.

  • Learning. You are new to the code base.

These tasks require you to have an overview of the state machines. It is relatively hard to get an overview of boost::statecharts by just looking at C++ code: No explicit transition table. Notation is quite verbose. Implementation can span multiple iles.

Antons Jel̦kins boost::statechart visualisation Meeting C++ 2019 4 / 7

slide-6
SLIDE 6

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Solution

What to do? Look at a picture instead of C++ code! How to get a picture? Bosce, or boost::statechart extractor, is a command line tool to extract information about boost::statecharts from an arbitrary binary with debug symbols and transform it to a user-friendly form, e.g. UML diagrams.

https://github.com/kanje/bosce

Antons Jel̦kins boost::statechart visualisation Meeting C++ 2019 5 / 7

slide-7
SLIDE 7

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Solution

What to do? Look at a picture instead of C++ code! How to get a picture? Bosce, or boost::statechart extractor, is a command line tool to extract information about boost::statecharts from an arbitrary binary with debug symbols and transform it to a user-friendly form, e.g. UML diagrams.

https://github.com/kanje/bosce

Antons Jel̦kins boost::statechart visualisation Meeting C++ 2019 5 / 7

slide-8
SLIDE 8

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Solution

What to do? Look at a picture instead of C++ code! How to get a picture? Bosce, or boost::statechart extractor, is a command line tool to extract information about boost::statecharts from an arbitrary binary with debug symbols and transform it to a user-friendly form, e.g. UML diagrams.

https://github.com/kanje/bosce

Antons Jel̦kins boost::statechart visualisation Meeting C++ 2019 5 / 7

slide-9
SLIDE 9

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Solution

What to do? Look at a picture instead of C++ code! How to get a picture? Bosce, or boost::statechart extractor, is a command line tool to extract information about boost::statecharts from an arbitrary binary with debug symbols and transform it to a user-friendly form, e.g. UML diagrams.

https://github.com/kanje/bosce

Antons Jel̦kins boost::statechart visualisation Meeting C++ 2019 5 / 7

slide-10
SLIDE 10

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Example

Shell

$ g++ demo.cpp -o demo $ bosce demo -l Available state-machines: StopWatch $ bosce demo -s StopWatch > uml.pu $ plantuml uml.pu $ xdg-open uml.png

Antons Jel̦kins boost::statechart visualisation Meeting C++ 2019 6 / 7

slide-11
SLIDE 11

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Example

Shell

$ g++ demo.cpp -o demo $ bosce demo -l Available state-machines: StopWatch $ bosce demo -s StopWatch > uml.pu $ plantuml uml.pu $ xdg-open uml.png

Antons Jel̦kins boost::statechart visualisation Meeting C++ 2019 6 / 7

slide-12
SLIDE 12

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Thank you!

Antons Jel̦kins boost::statechart visualisation Meeting C++ 2019 7 / 7