From d574d938da036af0a8e79fb73f39a2c49a396aad Mon Sep 17 00:00:00 2001 From: t0xa Date: Tue, 16 Sep 2025 11:37:02 +0300 Subject: [PATCH] Add some schemes --- drawings/cpp/macro_1.puml | 59 ++++++++++++ drawings/cpp/macro_2.puml | 57 ++++++++++++ .../Crowd/notifications/9205_overview.puml | 53 +++++++++++ ivideon/puml/person_sdk/person_sdk_1.puml | 91 +++++++++++++++++++ 4 files changed, 260 insertions(+) create mode 100644 drawings/cpp/macro_1.puml create mode 100644 drawings/cpp/macro_2.puml create mode 100644 ivideon/puml/Crowd/notifications/9205_overview.puml create mode 100644 ivideon/puml/person_sdk/person_sdk_1.puml diff --git a/drawings/cpp/macro_1.puml b/drawings/cpp/macro_1.puml new file mode 100644 index 0000000..cd3ad67 --- /dev/null +++ b/drawings/cpp/macro_1.puml @@ -0,0 +1,59 @@ +@startuml +title Механизм работы STB_IMAGE_IMPLEMENTATION + +!define COMPILATION_COLOR #LightBlue +!define PREPROCESSOR_COLOR #LightGreen +!define LINKER_COLOR #LightCoral + +participant "Препроцессор" as PP <> +participant "Utility.cpp" as UTIL <> +participant "Other.cpp" as OTHER <> +participant "stb_image.h" as STB +participant "Линковщик" as LINK <> + +== Компиляция Utility.cpp == + +UTIL -> UTIL: #define STB_IMAGE_IMPLEMENTATION +UTIL -> PP: #include "stb_image.h" + +PP -> STB: Открывает файл +STB -> PP: Строки 1-545:\nОбъявления функций\n(всегда включаются) + +PP -> PP: Проверка:\n#ifdef STB_IMAGE_IMPLEMENTATION?\nДА! + +STB -> PP: Строки 547-7800+:\nРеализация функций\n(включается!) + +PP -> UTIL: Возвращает:\n- Объявления\n- Реализации + +UTIL -> UTIL: Компиляция:\nОбъектный файл содержит\nкод функций stbi_load и др. + +== Компиляция Other.cpp == + +OTHER -> PP: #include "stb_image.h"\n(БЕЗ define) + +PP -> STB: Открывает файл +STB -> PP: Строки 1-545:\nОбъявления функций\n(всегда включаются) + +PP -> PP: Проверка:\n#ifdef STB_IMAGE_IMPLEMENTATION?\nНЕТ! + +PP -> OTHER: Возвращает:\nТОЛЬКО объявления + +OTHER -> OTHER: Компиляция:\nОбъектный файл НЕ содержит\nкод функций, только ссылки + +== Линковка == + +UTIL -> LINK: Utility.o:\n✓ Реализация stbi_load +OTHER -> LINK: Other.o:\n✗ Только ссылка на stbi_load + +LINK -> LINK: Связывание:\nOther.o использует\nреализацию из Utility.o + +LINK --> UTIL: Исполняемый файл:\nОдна копия реализации + +note right of PP + **Ключевой момент:** + STB_IMAGE_IMPLEMENTATION + определен только в ОДНОМ + .cpp файле +end note + +@enduml diff --git a/drawings/cpp/macro_2.puml b/drawings/cpp/macro_2.puml new file mode 100644 index 0000000..131942c --- /dev/null +++ b/drawings/cpp/macro_2.puml @@ -0,0 +1,57 @@ +@startuml +title Алгоритм работы препроцессора с stb_image.h + +start + +:Препроцессор встречает\n#include "stb_image.h"; + +:Открывает файл stb_image.h; + +:Обрабатывает строки 1-545\n(заголовочная часть); + +note right + Эта часть ВСЕГДА включается: + - typedef структур + - объявления функций + - макросы +end note + +:Включает объявления в код; + +if (Определен макрос\nSTB_IMAGE_IMPLEMENTATION?) then (ДА) + #LightGreen:Обрабатывает строки 547-7800+\n(блок реализации); + + note right + Включается РЕАЛИЗАЦИЯ: + ```cpp + STBIDEF stbi_uc *stbi_load(...) { + FILE *f = stbi__fopen(filename, "rb"); + // ... код функции ... + return result; + } + ``` + end note + + :Включает реализацию в код; + + :Результат:\nФайл получает и объявления\nИ реализацию функций; + +else (НЕТ) + #LightBlue:Пропускает блок\n#ifdef STB_IMAGE_IMPLEMENTATION; + + note right + Реализация НЕ включается, + только объявления: + ```cpp + STBIDEF stbi_uc *stbi_load(...); + ``` + end note + + :Результат:\nФайл получает ТОЛЬКО\nобъявления функций; +endif + +:Передает результат компилятору; + +stop + +@enduml diff --git a/ivideon/puml/Crowd/notifications/9205_overview.puml b/ivideon/puml/Crowd/notifications/9205_overview.puml new file mode 100644 index 0000000..ec6e227 --- /dev/null +++ b/ivideon/puml/Crowd/notifications/9205_overview.puml @@ -0,0 +1,53 @@ +@startuml +!define FILE_ICON <<(F,#e8bd14)>> + +class crowd.frontend.impl.crowd_subscriptionPY.CrowdSubscription{ + + ID_REGEX: str + {field} + COLLECTION: str = db.crowd().crowd_subscription + + FIND_RESULTS_PAGE_LIMIT: int = 100 + + create(email, camera_id, email_enabled=True) + + find(user, emails, cameras, limit, skip) +} + +class crowd.backend.notificationsPY FILE_ICON{ + + send_queue_overflow(zone,\n queue_info,\n queue_size,\n detection_time,\n image_url,\n escalation_level=None\n) +} + + +database mongoDB.crowd.crowd_subscription{ +} +database mongoDB.crowd.telegram_subscriptions{ +} + +json crowd_subscription_entry{ + "owner_id": "owner_id", + "created_at": "timestamp", + "subscriber_id": "user_id", + "subscriber_login": "email", + "telegram_confirmed": "False", + "camera_id": "camera_id", + "email_enabled": "email_enabled" +} + +json telegram_sub_entry{ + "email": "user@email.com", + "chat_id": "telegram_chat_id" +} + + +CrowdSubscription::COLLECTION -- crowd_subscription +telegram_subscriptions .. telegram_sub_entry +crowd_subscription .. crowd_subscription_entry +crowd_subscription_entry -[thickness=2]- telegram_sub_entry : "subscriber_login ::: email" + +note left of notificationsPY +Функция отправки уведомлений +(в том числе и в телегу) +end note + +note right of telegram_subscriptions +Сюда мы сейчас руками добавляем +записи-связки с crowd_subscription +end note + +@enduml diff --git a/ivideon/puml/person_sdk/person_sdk_1.puml b/ivideon/puml/person_sdk/person_sdk_1.puml new file mode 100644 index 0000000..0073aac --- /dev/null +++ b/ivideon/puml/person_sdk/person_sdk_1.puml @@ -0,0 +1,91 @@ +@startuml PersonSDK Architecture + +!theme plain +skinparam backgroundColor white +skinparam componentStyle rectangle + +package "PersonSDK" { + + component "IRuntime" as runtime + component "Configuration" as config + + interface "IBackend" as backend + component "CPU Backend" as cpu_backend + component "GPU Backend" as gpu_backend + component "Other Backends" as other_backends + + interface "IHeadDetector" as head_detector + interface "IBodyDetector" as body_detector + interface "IHeadPosition" as head_position + interface "IBodyPosition" as body_position + interface "IFrameView" as frame_view + + ' Advanced processing components + interface "IBodyExtractor" as body_extractor + interface "IBodyClassifier" as body_classifier + interface "ITracker" as tracker + interface "IUpperBodyExtractor" as upper_extractor + interface "IUpperBodyClassifier" as upper_classifier + interface "IBodyMatcher" as body_matcher + + ' Utility interfaces + interface "ISizeRule" as size_rule + interface "IRoi" as roi + interface "KwArg" as kwarg +} + +' Relationships +runtime --> config : uses +runtime --> backend : creates +backend <|-- cpu_backend +backend <|-- gpu_backend +backend <|-- other_backends + +backend --> head_detector : new_head_detector() +backend --> body_detector : new_body_detector() +backend --> body_extractor : new_body_extractor() +backend --> body_classifier : new_body_classifier() +backend --> tracker : new_tracker() + +head_detector --> head_position : returns vector<> +body_detector --> body_position : returns vector<> + +head_detector --> frame_view : processes +body_detector --> frame_view : processes + +head_detector --> kwarg : uses +body_detector --> kwarg : uses +head_detector --> size_rule : uses +head_detector --> roi : uses + +body_extractor --> body_position : processes +body_classifier --> body_position : processes +tracker --> head_position : tracks +tracker --> body_position : tracks + +upper_extractor --> body_position : processes +upper_classifier --> body_position : processes +body_matcher --> body_position : matches + +note top of runtime +Entry point for SDK +Handles configuration +and backend management +end note + +note right of head_detector +Main detection interface +set_defaults(args) +run(image, args) +Thread-safe with external sync +end note + +note bottom of kwarg +Flexible parameter system: +Type-safe variants +Named parameters +Default value management +end note + +@enduml +