onboardapi-sys 9.10.0

Raw FFI to the Rheinmetall onboardapi C++ SDK through a generated extern "C" shim
Documentation
// @generated by onboardapi-codegen from the onboardapi .rmodel data model. Do not edit.
// SPDX-License-Identifier: EPL-2.0
#include "wire_LanguageManager.hpp"
#include "../obapi_runtime.hpp"

#include <type_traits>

static_assert(std::is_same<::M_LanguageManager::LanguageType, std::string>::value, "typedef M_LanguageManager::LanguageType differs from the data model");
static_assert(std::is_same<::M_LanguageManager::LanguageListType, std::vector<std::string>>::value, "typedef M_LanguageManager::LanguageListType differs from the data model");
static_assert(std::is_same<decltype(::M_LanguageManager::TextType::Language), std::string>::value, "M_LanguageManager::TextType field Language differs from the data model");
static_assert(std::is_same<decltype(::M_LanguageManager::TextType::Text), std::string>::value, "M_LanguageManager::TextType field Text differs from the data model");
static_assert(std::is_same<::M_LanguageManager::TextListType, std::vector<::M_LanguageManager::TextType>>::value, "typedef M_LanguageManager::TextListType differs from the data model");
static_assert(std::is_same<decltype(::M_LanguageManager::LanguageManagerSettingsType::DefaultLanguage), std::string>::value, "M_LanguageManager::LanguageManagerSettingsType field DefaultLanguage differs from the data model");
static_assert(std::is_same<decltype(::M_LanguageManager::LanguageManagerSettingsType::SupportedLanguages), std::vector<std::string>>::value, "M_LanguageManager::LanguageManagerSettingsType field SupportedLanguages differs from the data model");
static_assert(std::is_same<decltype(::M_LanguageManager::LanguageManagerStatusType::SelectedLanguage), std::string>::value, "M_LanguageManager::LanguageManagerStatusType field SelectedLanguage differs from the data model");

namespace M_LanguageManager {
    void obapi_put(::obapi::Writer& w, TextType const& v) {
        ::obapi::put(w, v.Language);
        ::obapi::put(w, v.Text);
    }
    void obapi_get(::obapi::Reader& r, TextType& v) {
        ::obapi::get(r, v.Language);
        ::obapi::get(r, v.Text);
    }
    void obapi_put(::obapi::Writer& w, LanguageManagerSettingsType const& v) {
        ::obapi::put(w, v.DefaultLanguage);
        ::obapi::put(w, v.SupportedLanguages);
    }
    void obapi_get(::obapi::Reader& r, LanguageManagerSettingsType& v) {
        ::obapi::get(r, v.DefaultLanguage);
        ::obapi::get(r, v.SupportedLanguages);
    }
    void obapi_put(::obapi::Writer& w, LanguageManagerStatusType const& v) {
        ::obapi::put(w, v.SelectedLanguage);
    }
    void obapi_get(::obapi::Reader& r, LanguageManagerStatusType& v) {
        ::obapi::get(r, v.SelectedLanguage);
    }
} // namespace M_LanguageManager

namespace {
    struct ServiceCallbacks final : ::M_LanguageManager::IService {
        ::obapi::Dispatcher dispatcher;
        void ConfigLanguage(std::string const& KeySubsystem, ::M_LanguageManager::LanguageType const& Language, bool IsRemoved) override {
            ::obapi::Writer w;
            ::obapi::put(w, KeySubsystem);
            ::obapi::put(w, Language);
            ::obapi::put(w, IsRemoved);
            dispatcher.dispatch(0u, w);
        }
    };

    struct ClientCallbacks final : ::M_LanguageManager::IClient {
        ::obapi::Dispatcher dispatcher;
        void ReportLanguageManagerSettings(::M_LanguageManager::LanguageManagerSettingsType const& Settings) override {
            ::obapi::Writer w;
            ::obapi::put(w, Settings);
            dispatcher.dispatch(0u, w);
        }
        void ReportLanguageManagerStatus(::M_LanguageManager::LanguageManagerStatusType const& Status, bool IsRemoved) override {
            ::obapi::Writer w;
            ::obapi::put(w, Status);
            ::obapi::put(w, IsRemoved);
            dispatcher.dispatch(1u, w);
        }
        void ReportTranslations(std::string const& KeyDefaultLanguageText, ::M_LanguageManager::TextListType const& Translations, bool IsRemoved) override {
            ::obapi::Writer w;
            ::obapi::put(w, KeyDefaultLanguageText);
            ::obapi::put(w, Translations);
            ::obapi::put(w, IsRemoved);
            dispatcher.dispatch(2u, w);
        }
    };

    void service_send(::obapi::Holder<::M_LanguageManager::Service, ServiceCallbacks>& h, uint32_t op, ::obapi::Reader& r) {
        switch (op) {
            case 0u: {
                ::M_LanguageManager::LanguageManagerSettingsType Settings{};
                ::obapi::get(r, Settings);
                r.finish();
                h.endpoint->ReportLanguageManagerSettings(Settings);
                return;
            }
            case 1u: {
                ::M_LanguageManager::LanguageManagerStatusType Status{};
                ::obapi::get(r, Status);
                bool IsRemoved{};
                ::obapi::get(r, IsRemoved);
                r.finish();
                h.endpoint->ReportLanguageManagerStatus(Status, IsRemoved);
                return;
            }
            case 2u: {
                std::string KeyDefaultLanguageText{};
                ::obapi::get(r, KeyDefaultLanguageText);
                ::M_LanguageManager::TextListType Translations{};
                ::obapi::get(r, Translations);
                bool IsRemoved{};
                ::obapi::get(r, IsRemoved);
                r.finish();
                h.endpoint->ReportTranslations(KeyDefaultLanguageText, Translations, IsRemoved);
                return;
            }
            default: throw ::obapi::UnknownOp(op);
        }
    }

    void client_send(::obapi::Holder<::M_LanguageManager::Client, ClientCallbacks>& h, uint32_t op, ::obapi::Reader& r) {
        switch (op) {
            case 0u: {
                std::string KeySubsystem{};
                ::obapi::get(r, KeySubsystem);
                ::M_LanguageManager::LanguageType Language{};
                ::obapi::get(r, Language);
                bool IsRemoved{};
                ::obapi::get(r, IsRemoved);
                r.finish();
                h.endpoint->ConfigLanguage(KeySubsystem, Language, IsRemoved);
                return;
            }
            default: throw ::obapi::UnknownOp(op);
        }
    }

} // namespace

extern "C" const obapi_vtable obapi_LanguageManager_service_vtable = ::obapi::Endpoint<::M_LanguageManager::Service, ServiceCallbacks, &service_send, false>::vtable("M_LanguageManager", "Service");
extern "C" const obapi_vtable obapi_LanguageManager_client_vtable = ::obapi::Endpoint<::M_LanguageManager::Client, ClientCallbacks, &client_send, true>::vtable("M_LanguageManager", "Client");