C++: Advanced Topics (2023-12-04 - 2023-12-06)¶
Day 1: Introduction: C++, A New Language¶
Pythonicity¶
Brace Initialization¶
New OO Features¶
Functions: std::function<>
, Lambdas¶
From Functions, Functions:
From Lambda
Day 2: Simply Getting Stuff Done¶
Classic Polymorphism: Interfaces¶
Inheritance And Object Oriented Design
Look over sensor hierachy in our project:
Smart Pointers¶
Move Semantics¶
Day 3: All The Rest¶
Morning Wakeup¶
Interfaces, And OO Design: Kochtopf
And The Cloud¶
Show
switch.h
: convenience methods in interface are possible :-)Show Kochtopf component
Discuss design issues, e.g.
Relationship between controls and component (
this
,friend
)PowerControl::start()
vs.set_state()
TemperatureControl::get_target_temperature()
⟶Hysteresis
Discuss threading
std::unique_ptr<>
as member keeps component from being copyable[this]
_running
⟶std::atomic<>
Shutdown?
Show test fixture
What about sensor temperature? Add
KochtopfTemperatureControl::get_current_temperature()
(⟶override
)This would not be easy without TDD ☝️
Discuss technical debt:
Kochtopf
has hardwired range of 2
Moving, Roundup¶
Discuss L/R-Values, and what compiler generates when (from Lvalues, Rvalues, And Moving)
Hack a
String