#include "wire_Logging.hpp"
#include "../obapi_runtime.hpp"
#include <type_traits>
static_assert(static_cast<uint32_t>(::M_Logging::LogLevelKind::Off) == 0u, "enum value M_Logging::LogLevelKind::Type::Off differs from the data model");
static_assert(static_cast<uint32_t>(::M_Logging::LogLevelKind::Critical) == 1u, "enum value M_Logging::LogLevelKind::Type::Critical differs from the data model");
static_assert(static_cast<uint32_t>(::M_Logging::LogLevelKind::Error) == 2u, "enum value M_Logging::LogLevelKind::Type::Error differs from the data model");
static_assert(static_cast<uint32_t>(::M_Logging::LogLevelKind::Warn) == 3u, "enum value M_Logging::LogLevelKind::Type::Warn differs from the data model");
static_assert(static_cast<uint32_t>(::M_Logging::LogLevelKind::Info) == 4u, "enum value M_Logging::LogLevelKind::Type::Info differs from the data model");
static_assert(static_cast<uint32_t>(::M_Logging::LogLevelKind::Debug) == 5u, "enum value M_Logging::LogLevelKind::Type::Debug differs from the data model");
static_assert(static_cast<uint32_t>(::M_Logging::LogLevelKind::Trace) == 6u, "enum value M_Logging::LogLevelKind::Type::Trace differs from the data model");
static_assert(std::is_same<decltype(::M_Logging::LogMessageType::Level), ::M_Logging::LogLevelKind::Type>::value, "M_Logging::LogMessageType field Level differs from the data model");
static_assert(std::is_same<decltype(::M_Logging::LogMessageType::Message), std::string>::value, "M_Logging::LogMessageType field Message differs from the data model");
static_assert(std::is_same<decltype(::M_Logging::LogMessageType::UnixTimestamp), ::M_Common::TimeType>::value, "M_Logging::LogMessageType field UnixTimestamp differs from the data model");
static_assert(std::is_same<decltype(::M_Logging::LogMessageType::FunctionName), std::vector<std::string>>::value, "M_Logging::LogMessageType field FunctionName differs from the data model");
static_assert(std::is_same<decltype(::M_Logging::LogMessageType::FileName), std::vector<std::string>>::value, "M_Logging::LogMessageType field FileName differs from the data model");
static_assert(std::is_same<decltype(::M_Logging::LogMessageType::LoggerName), std::vector<std::string>>::value, "M_Logging::LogMessageType field LoggerName differs from the data model");
static_assert(std::is_same<decltype(::M_Logging::LogMessageType::ComponentName), std::vector<std::string>>::value, "M_Logging::LogMessageType field ComponentName differs from the data model");
static_assert(std::is_same<decltype(::M_Logging::LogMessageType::Line), std::vector<uint32_t>>::value, "M_Logging::LogMessageType field Line differs from the data model");
static_assert(std::is_same<decltype(::M_Logging::LogMessageType::Id), std::vector<uint64_t>>::value, "M_Logging::LogMessageType field Id differs from the data model");
static_assert(std::is_same<decltype(::M_Logging::LogMessageType::ProcessId), std::vector<uint32_t>>::value, "M_Logging::LogMessageType field ProcessId differs from the data model");
static_assert(std::is_same<::M_Logging::LogMessageListType, std::vector<::M_Logging::LogMessageType>>::value, "typedef M_Logging::LogMessageListType differs from the data model");
static_assert(std::is_same<decltype(::M_Logging::LogSettingsType::Level), ::M_Logging::LogLevelKind::Type>::value, "M_Logging::LogSettingsType field Level differs from the data model");
static_assert(std::is_same<decltype(::M_Logging::LogMessageRequestType::AfterId), std::vector<uint32_t>>::value, "M_Logging::LogMessageRequestType field AfterId differs from the data model");
static_assert(std::is_same<decltype(::M_Logging::LogMessageRequestType::AfterUnixTimestamp), std::vector<::M_Common::TimeType>>::value, "M_Logging::LogMessageRequestType field AfterUnixTimestamp differs from the data model");
namespace M_Logging {
void obapi_put(::obapi::Writer& w, LogMessageType const& v) {
::obapi::put(w, v.Level);
::obapi::put(w, v.Message);
::obapi::put(w, v.UnixTimestamp);
::obapi::put(w, v.FunctionName);
::obapi::put(w, v.FileName);
::obapi::put(w, v.LoggerName);
::obapi::put(w, v.ComponentName);
::obapi::put(w, v.Line);
::obapi::put(w, v.Id);
::obapi::put(w, v.ProcessId);
}
void obapi_get(::obapi::Reader& r, LogMessageType& v) {
::obapi::get(r, v.Level);
::obapi::get(r, v.Message);
::obapi::get(r, v.UnixTimestamp);
::obapi::get(r, v.FunctionName);
::obapi::get(r, v.FileName);
::obapi::get(r, v.LoggerName);
::obapi::get(r, v.ComponentName);
::obapi::get(r, v.Line);
::obapi::get(r, v.Id);
::obapi::get(r, v.ProcessId);
}
void obapi_put(::obapi::Writer& w, LogSettingsType const& v) {
::obapi::put(w, v.Level);
}
void obapi_get(::obapi::Reader& r, LogSettingsType& v) {
::obapi::get(r, v.Level);
}
void obapi_put(::obapi::Writer& w, LogMessageRequestType const& v) {
::obapi::put(w, v.AfterId);
::obapi::put(w, v.AfterUnixTimestamp);
}
void obapi_get(::obapi::Reader& r, LogMessageRequestType& v) {
::obapi::get(r, v.AfterId);
::obapi::get(r, v.AfterUnixTimestamp);
}
}
namespace {
struct ServiceCallbacks final : ::M_Logging::IService {
::obapi::Dispatcher dispatcher;
void CmdSetLogSettings(::M_Logging::LogSettingsType const& Settings) override {
::obapi::Writer w;
::obapi::put(w, Settings);
dispatcher.dispatch(0u, w);
}
void RequestLogMessages(::M_Logging::LogMessageRequestType const& RequestSpecification) override {
::obapi::Writer w;
::obapi::put(w, RequestSpecification);
dispatcher.dispatch(1u, w);
}
};
struct ClientCallbacks final : ::M_Logging::IClient {
::obapi::Dispatcher dispatcher;
void EventLogMessages(::M_Logging::LogMessageListType const& Messages) override {
::obapi::Writer w;
::obapi::put(w, Messages);
dispatcher.dispatch(0u, w);
}
void ReportLogSettings(::M_Logging::LogSettingsType const& Settings, bool IsRemoved) override {
::obapi::Writer w;
::obapi::put(w, Settings);
::obapi::put(w, IsRemoved);
dispatcher.dispatch(1u, w);
}
void ResponseLogMessages(::M_Logging::LogMessageRequestType const& RequestSpecification, ::M_Logging::LogMessageListType const& Messages) override {
::obapi::Writer w;
::obapi::put(w, RequestSpecification);
::obapi::put(w, Messages);
dispatcher.dispatch(2u, w);
}
};
void service_send(::obapi::Holder<::M_Logging::Service, ServiceCallbacks>& h, uint32_t op, ::obapi::Reader& r) {
switch (op) {
case 0u: {
::M_Logging::LogMessageListType Messages{};
::obapi::get(r, Messages);
r.finish();
h.endpoint->EventLogMessages(Messages);
return;
}
case 1u: {
::M_Logging::LogSettingsType Settings{};
::obapi::get(r, Settings);
bool IsRemoved{};
::obapi::get(r, IsRemoved);
r.finish();
h.endpoint->ReportLogSettings(Settings, IsRemoved);
return;
}
case 2u: {
::M_Logging::LogMessageRequestType RequestSpecification{};
::obapi::get(r, RequestSpecification);
::M_Logging::LogMessageListType Messages{};
::obapi::get(r, Messages);
r.finish();
h.endpoint->ResponseLogMessages(RequestSpecification, Messages);
return;
}
default: throw ::obapi::UnknownOp(op);
}
}
void client_send(::obapi::Holder<::M_Logging::Client, ClientCallbacks>& h, uint32_t op, ::obapi::Reader& r) {
switch (op) {
case 0u: {
::M_Logging::LogSettingsType Settings{};
::obapi::get(r, Settings);
r.finish();
h.endpoint->CmdSetLogSettings(Settings);
return;
}
case 1u: {
::M_Logging::LogMessageRequestType RequestSpecification{};
::obapi::get(r, RequestSpecification);
r.finish();
h.endpoint->RequestLogMessages(RequestSpecification);
return;
}
default: throw ::obapi::UnknownOp(op);
}
}
}
extern "C" const obapi_vtable obapi_Logging_service_vtable = ::obapi::Endpoint<::M_Logging::Service, ServiceCallbacks, &service_send, false>::vtable("M_Logging", "Service");
extern "C" const obapi_vtable obapi_Logging_client_vtable = ::obapi::Endpoint<::M_Logging::Client, ClientCallbacks, &client_send, true>::vtable("M_Logging", "Client");