commit e35dfb5f1cb33f9b7c9e686de5e8f49e89179f7c Author: M. Pabiszczak <2+mpabi@noreply.zsl-gitea.mpabi.pl> Date: Mon Jul 20 08:11:08 2026 +0200 publish: K03 vector RAII v00.01 diff --git a/json/card_source.json b/json/card_source.json new file mode 100644 index 0000000..91a5069 --- /dev/null +++ b/json/card_source.json @@ -0,0 +1,236 @@ +{ + "$schema": "../../../../tools/card-layouts/schemas/card-source.schema.json", + "schema": "esc-card-source.v1", + "card": { + "id": "mpabi-freertos-cpp-03-vector-raii", + "series": "freertos-cpp", + "series_title": "FreeRTOS C++", + "number": "03", + "count": "16", + "slug": "vector-raii", + "title": "Vector V1: destruktor, move i jeden właściciel", + "topic": "Move-only ownership, RAII i obserwowalny most new/delete do heap_4", + "project": "Freestanding C++ nad FreeRTOS", + "subject": "Informatyka", + "level": "Rok 2 · L02 · RV32I/Hazard3", + "revision_date": "2026-07-19T00:00:00+02:00", + "status": "Gotowa", + "version": "v00.01", + "uuid": "de1a2818-4c30-5760-8b31-255114f82e90", + "author": "M. Pabiszczak", + "year": "2026" + }, + "generated": { + "tex": "doc/generated/main.tex", + "html": "web/index.html", + "html_css": "web/style.css", + "html_tree_inspector": false, + "react_app": true + }, + "template": "templates/karta-klasyczna.json", + "title_block": { + "category": "KARTA PRACY · INFORMATYKA", + "prepared_by": "M. Pabiszczak", + "prepared_on": "2026-07-19T00:00:00+02:00", + "title": "Vector V1: destruktor, move i jeden właściciel", + "repository_url": "https://zsl-gitea.mpabi.pl/edu-freertos-cpp/lab-rv32i-freertos-vector-raii", + "revision": "v00.01", + "issued_on": "2026-07-19T00:00:00+02:00", + "series": "FREERTOS-CPP-03", + "document_type": "karta pracy", + "tool": "card-layouts", + "show_qr": false, + "show_repository_qr": false, + "height_cm": 2.6, + "repeat_on_every_page": true, + "replace_front_matter": true + }, + "front_page_scope": { + "title": "Cel karty", + "content_tex": "Uczeń buduje move-only \\texttt{VectorV1}, formułuje inwariant jednego właściciela i śledzi ten sam adres bufora przez move assignment, move construction i destruktor.", + "scope_title": "Zakres karty", + "scope_content_tex": "Jedno zadanie używa prawdziwego \\texttt{heap\\_4.c} na Hazard3. Kopiowanie jest zabronione, move jest \\texttt{noexcept}, a zwykłe i tablicowe warianty new/delete prowadzą do jednego heapu FreeRTOS. Poza zakresem są wzrost pojemności, bounds checking, allocator selection i uruchamianie tasków." + }, + "side_margin_tree_layout": { + "columns": [ + {"id": "zawodowe", "label": "TECH", "side": "left", "tree": "WE -> EK -> KW", "description": "Dowód z kodu, ELF i Hazard3."}, + {"id": "ogolne", "label": "OG", "side": "right", "tree": "WE -> EN -> KW", "description": "Rozumowanie o własności i czasie życia."} + ] + }, + "learning_effects": { + "K03.EN01": { + "bloom_level": "Analiza", + "label": "Inwariant własności", + "text": "Uczeń wyjaśnia jeden-owner invariant, usunięte kopiowanie, stan moved-from i kolejność release-before-transfer.", + "assessment_criteria": ["K03.KW01"] + }, + "K03.EK01": { + "bloom_level": "Zastosowanie", + "label": "Dowód pamięci", + "text": "Uczeń odtwarza checkpointy 1–7 i koreluje adresy A/B, liczniki new/delete oraz stan heap_4.", + "assessment_criteria": ["K03.KW01"] + } + }, + "assessment_criteria": { + "K03.KW01": { + "text": "Program kończy się PASS; adres A przechodzi do kolejnych właścicieli, B jest zwolniony przed transferem, źródła są puste, allocations=2, frees=2, live=0 i final free equals baseline.", + "learning_effects": ["K03.EN01", "K03.EK01"] + } + }, + "educational_requirements": { + "K03.WE01": { + "text": "Zaprojektowanie i zbadanie move-only właściciela bufora nad heap_4.", + "label": "Vector V1 i RAII", + "learning_effects": ["K03.EN01", "K03.EK01"], + "learning_tree": { + "schema": "we-learning-tree.v1", + "policy": "Każda zmiana właściciela ma dowód adresu i licznika zwolnień.", + "ogolne": [ + { + "effect_ref": "K03.EN01", + "display": "EN LOCAL OOP.OWN.01", + "source": "LOCAL", + "official": "OOP.OWN", + "local": "01", + "kind": "EN", + "tree_id": "K03.WE01.OG.LOCAL.OOP.OWN.01", + "text": "Formułuje inwariant i analizuje cztery błędne kolejności move assignment.", + "kw": [ + { + "criterion_ref": "K03.KW01", + "display": "KW LOCAL OOP.OWN.01", + "source": "LOCAL", + "kind": "KW", + "official": "OOP.OWN", + "local": "01", + "text": "Uzasadnia copy=delete, move noexcept oraz pusty stan źródła." + } + ] + } + ], + "zawodowe": [ + { + "effect_ref": "K03.EK01", + "display": "EK LOCAL DBG.MEM.01", + "source": "LOCAL", + "official": "DBG.MEM", + "local": "01", + "kind": "EK", + "tree_id": "K03.WE01.TECH.LOCAL.DBG.MEM.01", + "text": "Śledzi adresy właścicieli i stan heapu na stabilnych checkpointach.", + "kw": [ + { + "criterion_ref": "K03.KW01", + "display": "KW LOCAL DBG.MEM.01", + "source": "LOCAL", + "kind": "KW", + "official": "DBG.MEM", + "local": "01", + "text": "Pokazuje B jako pierwszy free, A jako drugi free i powrót heapu do baseline." + } + ] + } + ] + } + } + }, + "sections": [ + { + "title": "V0 i inwariant jednego właściciela", + "content_kind": "prose", + "content_tex": "Zdiagnozuj wyciek V0 i ryzyko double free po dodaniu destruktora bez usunięcia kopiowania.", + "educational_requirement_refs": ["K03.WE01"], + "learning_effect_refs": ["K03.EN01"], + "assessment_criterion_refs": ["K03.KW01"], + "area_tree_refs": ["K03.WE01.OG.LOCAL.OOP.OWN.01"], + "steps": [ + { + "id": "S01", + "title": "Nazwij właściciela, zasób i dwa błędy Vector V0.", + "tree_refs": ["K03.WE01.OG.LOCAL.OOP.OWN.01"] + }, + { + "id": "S02", + "title": "Uzasadnij destruktor oraz usunięcie operacji kopiowania.", + "tree_refs": ["K03.WE01.OG.LOCAL.OOP.OWN.01"] + } + ] + }, + { + "title": "Move assignment do zajętego celu", + "content_kind": "prose", + "content_tex": "Dla source->A i destination->B ułóż release, transfer pól i wyzerowanie źródła.", + "educational_requirement_refs": ["K03.WE01"], + "learning_effect_refs": ["K03.EN01"], + "assessment_criterion_refs": ["K03.KW01"], + "area_tree_refs": ["K03.WE01.OG.LOCAL.OOP.OWN.01"], + "steps": [ + { + "id": "S03", + "title": "Zwolnij B przed przejęciem A i wyjaśnij self-move guard.", + "tree_refs": ["K03.WE01.OG.LOCAL.OOP.OWN.01"] + }, + { + "id": "S04", + "title": "Wyzeruj źródło i sprawdź stan moved-from.", + "tree_refs": ["K03.WE01.OG.LOCAL.OOP.OWN.01"] + } + ] + }, + { + "title": "Hazard3: checkpointy 1–7", + "content_kind": "prose", + "content_tex": "Śledź A i B, liczniki allocation/deallocation oraz relacje current free i minimum-ever.", + "educational_requirement_refs": ["K03.WE01"], + "learning_effect_refs": ["K03.EK01"], + "assessment_criterion_refs": ["K03.KW01"], + "area_tree_refs": ["K03.WE01.TECH.LOCAL.DBG.MEM.01"], + "steps": [ + { + "id": "S05", + "title": "Na STOP 3 zapisz dwa różne adresy i stan heapu.", + "tree_refs": ["K03.WE01.TECH.LOCAL.DBG.MEM.01"] + }, + { + "id": "S06", + "title": "Na STOP 4 pokaż B jako pierwszy zwolniony adres i A u celu.", + "tree_refs": ["K03.WE01.TECH.LOCAL.DBG.MEM.01"] + }, + { + "id": "S07", + "title": "Na STOP 7 potwierdź 2/2/0, baseline i PASS.", + "tree_refs": ["K03.WE01.TECH.LOCAL.DBG.MEM.01"] + } + ] + }, + { + "title": "Granica RAII", + "content_kind": "prose", + "content_tex": "RAII wymaga normalnego zakończenia czasu życia C++; arbitralne usunięcie taska bez unwindingu nie uruchamia automatycznie destruktorów jego ramek.", + "educational_requirement_refs": ["K03.WE01"], + "learning_effect_refs": ["K03.EN01"], + "assessment_criterion_refs": ["K03.KW01"], + "area_tree_refs": ["K03.WE01.OG.LOCAL.OOP.OWN.01"], + "steps": [ + { + "id": "S08", + "title": "Odróżnij normalne wyjście z zakresu od wymuszonego zakończenia taska.", + "tree_refs": ["K03.WE01.OG.LOCAL.OOP.OWN.01"] + } + ] + } + ], + "tasks": { + "task01": { + "title": "Vector V1 — transfer własności i powrót heapu", + "uuid": "de1a2818-4c30-5760-8b31-255114f82e90", + "prompt_tex": "Uzupełnij bezpieczną kolejność move assignment, a następnie odtwórz checkpointy i udowodnij transfer A, zwolnienie B oraz powrót heapu do baseline.", + "criterion": "Copy jest zabronione; source i destination po move są puste; freed addresses mają kolejność B,A; allocations=2, frees=2, live=0 i pass=1.", + "educational_requirement_refs": ["K03.WE01"], + "learning_effect_refs": ["K03.EN01", "K03.EK01"], + "assessment_criterion_ref": "K03.KW01", + "links": {"equations": [], "figures": []} + } + }, + "tasks_order": ["task01"] +} diff --git a/pdf/mpabi-inf-freertos-cpp-03-vector-raii-v00.01-de1a2818-4c30-5760-8b31-255114f82e90.pdf b/pdf/mpabi-inf-freertos-cpp-03-vector-raii-v00.01-de1a2818-4c30-5760-8b31-255114f82e90.pdf new file mode 100644 index 0000000..bd06624 Binary files /dev/null and b/pdf/mpabi-inf-freertos-cpp-03-vector-raii-v00.01-de1a2818-4c30-5760-8b31-255114f82e90.pdf differ