odin odinthe thener nerd
play

@odin odinthe thener nerd not the god Auto-Intern GmbH 1 - PowerPoint PPT Presentation

@odinthenerd @odin odinthe thener nerd not the god Auto-Intern GmbH 1 @odinthenerd Hana Duskov compile time regex Auto-Intern GmbH 2 @odinthenerd Mixins Auto-Intern GmbH 3 @odinthenerd Auto-Intern GmbH 4 @odinthenerd


  1. @odinthenerd @odin odinthe thener nerd – not the god Auto-Intern GmbH 1

  2. @odinthenerd Hana Dusíková compile time regex Auto-Intern GmbH 2

  3. @odinthenerd Mixins Auto-Intern GmbH 3

  4. @odinthenerd Auto-Intern GmbH 4

  5. @odinthenerd Bare metal drivers • • • • • • Auto-Intern GmbH 5

  6. @odinthenerd Bare metal drivers • In assembler • • • • • Auto-Intern GmbH 6

  7. @odinthenerd Bare metal drivers • In assembler • • • • • Auto-Intern GmbH 7

  8. @odinthenerd Bare metal drivers • In assembler • In C with Macros • • • • Auto-Intern GmbH 8

  9. @odinthenerd Bare metal drivers • In assembler • In C with Macros • • • • Auto-Intern GmbH 9

  10. @odinthenerd Bare metal drivers • In assembler • In C with Macros • By hand in C++ • • • Auto-Intern GmbH 10

  11. @odinthenerd Bare metal drivers • In assembler • In C with Macros • By hand in C++ • • • Auto-Intern GmbH 11

  12. @odinthenerd Bare metal drivers • In assembler • In C with Macros • By hand in C++ • Aggregation • • Auto-Intern GmbH 12

  13. @odinthenerd Bare metal drivers • In assembler • In C with Macros • By hand in C++ • Aggregation • • Auto-Intern GmbH 13

  14. @odinthenerd Bare metal drivers • In assembler • In C with Macros • By hand in C++ • Aggregation • Inheritance + virtual functions • Auto-Intern GmbH 14

  15. @odinthenerd Bare metal drivers • In assembler • In C with Macros • By hand in C++ • Aggregation • Inheritance + virtual functions • Auto-Intern GmbH 15

  16. @odinthenerd Bare metal drivers • In assembler • In C with Macros • By hand in C++ • Aggregation • Inheritance + virtual functions • Inheritance + CRTP Auto-Intern GmbH 16

  17. @odinthenerd Inspiration in old book form Auto-Intern GmbH 17

  18. @odinthenerd Bare metal drivers • In assembler • In C with Macros • By hand in C++ • Aggregation • Inheritance + virtual functions • Inheritance + CRTP Auto-Intern GmbH 18

  19. @odinthenerd Even your cat will like you! Auto-Intern GmbH 19

  20. @odinthenerd Implementation details Auto-Intern GmbH 20

  21. @odinthenerd Mixin composition ring() guts blow() more_guts Auto-Intern GmbH 21

  22. @odinthenerd Code example auto thing = mixin::compose( mixin::interface<bells, whistles>, guts, more_guts); Auto-Intern GmbH 22

  23. @odinthenerd Code example auto thing = mixin::compose( mixin::interface<bells, whistles>, guts, more_guts); Auto-Intern GmbH 23

  24. @odinthenerd Code example auto thing = mixin::compose( mixin::interface<bells, whistles>, guts, more_guts); Auto-Intern GmbH 24

  25. @odinthenerd Code example auto thing = mixin::compose( mixin::interface<bells, whistles>, guts{haggis}, more_guts); Auto-Intern GmbH 25

  26. @odinthenerd Code example auto thing = mixin::compose( mixin::interface<bells, whistles>, guts{haggis}, more_guts); thing.ring(); Auto-Intern GmbH 26

  27. @odinthenerd Code example auto thing = mixin::compose( mixin::interface<bells, whistles>, guts{haggis}, more_guts, my_allocator{arena}); Auto-Intern GmbH 27

  28. @odinthenerd Definition of terms • Composition Auto-Intern GmbH 28

  29. @odinthenerd Mixin composition ring() guts blow() more_guts my_allocator Auto-Intern GmbH 29

  30. @odinthenerd Composition auto thing = mixin::compose( mixin::interface<bells, whistles>, guts{haggis}, more_guts, my_allocator{arena}); Auto-Intern GmbH 30

  31. @odinthenerd Definition of terms • Composition • Interface / Implementation Auto-Intern GmbH 31

  32. @odinthenerd Mixin composition ring() guts blow() more_guts my_allocator Auto-Intern GmbH 32

  33. @odinthenerd Interface template < typename T> struct bells : T { void ring(); }; Auto-Intern GmbH 33

  34. @odinthenerd Interface – concept template < typename T> struct bells : T { void ring(); }; Auto-Intern GmbH 34

  35. @odinthenerd Interface – adds to the composition objects interface template < typename T> struct bells : T { void ring(); }; Auto-Intern GmbH 35

  36. @odinthenerd Mixin composition ring() guts blow() more_guts my_allocator Auto-Intern GmbH 36

  37. @odinthenerd Implementation struct guts { }; Auto-Intern GmbH 37

  38. @odinthenerd Definition of terms • Composition • Interface / Implementation • Abilities Auto-Intern GmbH 38

  39. @odinthenerd Mixin composition ring() guts blow() more_guts my_allocator Auto-Intern GmbH 39

  40. @odinthenerd Abilities struct ringable{}; Auto-Intern GmbH 40

  41. @odinthenerd Find mixins by ability template < typename T> struct bells : T{ void ring(){ for_each(this, ability<ringable>, []( auto & a){ a. ring (); }); } }; Auto-Intern GmbH 41

  42. @odinthenerd Associating abilities with a mixin using guts = make_mixin< guts_impl, ringable, magic_frog_power, allocator_use_capable>; Auto-Intern GmbH 42

  43. @odinthenerd Definition of terms • Composition • Interface / Implementation • Abilities • Requirements Auto-Intern GmbH 43

  44. @odinthenerd Find mixins by ability 0-n template < typename T> struct bells : T{ void ring(){ for_each(this, ability<ringable>, []( auto & a){ a. ring (); }); } }; Auto-Intern GmbH 44

  45. @odinthenerd Find mixins by ability exactly 1 template < typename T> struct bells : T{ void ring(){ execute(this, ability<ringable>, []( auto & a){ a. ring (); }); } }; Auto-Intern GmbH 45

  46. @odinthenerd Find mixins that match an arbitrary predicate template < typename T> struct bells : T{ void ring(){ call_on(this, predicate<my_selector>, []( auto & a){ a. ring (); }); } }; Auto-Intern GmbH 46

  47. @odinthenerd Mixin composition ring() guts blow() more_guts my_allocator Auto-Intern GmbH 47

  48. @odinthenerd Return type of compose() template < typename ... Ts> class composition: public call_<detail::make_base<composition<Ts...>>, Ts...> { std::tuple<Ts...> data; //… }; Auto-Intern GmbH 48

  49. @odinthenerd Return type of compose() template < typename ... Ts> class composition: public call_<detail::make_base<composition<Ts...>>, Ts...> { std::tuple<Ts...> data; //… }; protect<access<composition<Ts …>>> Protect Access Auto-Intern GmbH 49

  50. @odinthenerd Protect template < typename T> struct protect : protected T {}; protect<access<composition<Ts …>>> Protect Access Auto-Intern GmbH 50

  51. @odinthenerd Return type of compose() template < typename ... Ts> class composition: public call_<detail::make_base<composition<Ts...>>, Ts...> { std::tuple<Ts...> data; //… }; interface1<protect<access<composition<Ts …>>>> Interface 1 Protect Access Auto-Intern GmbH 51

  52. @odinthenerd Return type of compose() template < typename ... Ts> class composition: public call_<detail::make_base<composition<Ts...>>, Ts...> { std::tuple<Ts...> data; //… }; interface2<interface1<protect<access<composition<Ts …>>>>> Interface 2 Interface 1 Protect Access Auto-Intern GmbH 52

  53. @odinthenerd Return type of compose() template < typename ... Ts> class composition: public call_<detail::make_base<composition<Ts...>>, Ts...> { std::tuple<Ts...> data; //… }; interface3<interface2<interface1<protect<access<composition<Ts …>>>>>> Interface 3 Interface 2 Interface 1 Protect Access Auto-Intern GmbH 53

  54. @odinthenerd Return type of compose() template < typename ... Ts> class composition: public call_<detail::make_base<composition<Ts...>>, Ts...> { std::tuple<Ts...> data; //… }; interface3<interface2<interface1<protect<access<composition<Ts …>>>>>> Composition Interface 3 Interface 2 Interface 1 Protect Access Auto-Intern GmbH 54

  55. @odinthenerd Completing the circle template < typename ... Ts> class composition: public call_<detail::make_base<composition<Ts...>>, Ts...> { std::tuple<Ts...> data; //… }; interface3<interface2<interface1<protect<access<composition<Ts …>>>>>> Composition Interface 3 Interface 2 Interface 1 Protect Access Auto-Intern GmbH 55

  56. @odinthenerd Access template < typename T> struct access { auto & get_data(){ return static_cast <T*>( this )-> data ; } }; Composition Interface 3 Interface 2 Interface 1 Protect Access Auto-Intern GmbH 56

  57. @odinthenerd Encapsulation template < typename ... Ts> class composition: public call_<detail::make_base<composition<Ts...>>, Ts...> { std::tuple<Ts...> data; friend access<composition<Ts...>>; //… }; Composition Interface 3 Interface 2 Interface 1 Protect Access Auto-Intern GmbH 57

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend