| // WARNING: This file is machine generated by fidlgen. |
| |
| #include <inheritance_with_recursive_decl.test.json.h> |
| |
| #include "lib/fidl/cpp/internal/implementation.h" |
| namespace fidl { |
| namespace test { |
| namespace json { |
| |
| #ifdef __Fuchsia__ |
| namespace { |
| |
| extern "C" const fidl_type_t v1_fidl_test_json_ParentFirstRequestTable; |
| |
| } // namespace |
| |
| Parent::~Parent() = default; |
| |
| const fidl_type_t* Parent_RequestDecoder::GetType(uint64_t ordinal, |
| bool* out_needs_response) { |
| switch (ordinal) { |
| case internal::kParent_First_Ordinal: |
| case internal::kParent_First_GenOrdinal: |
| *out_needs_response = false; |
| return &v1_fidl_test_json_ParentFirstRequestTable; |
| default: |
| *out_needs_response = false; |
| return nullptr; |
| } |
| } |
| |
| const fidl_type_t* Parent_ResponseDecoder::GetType(uint64_t ordinal) { |
| switch (ordinal) { |
| default: |
| return nullptr; |
| } |
| } |
| |
| Parent_EventSender::~Parent_EventSender() = default; |
| |
| Parent_Sync::~Parent_Sync() = default; |
| |
| Parent_Proxy::Parent_Proxy(::fidl::internal::ProxyController* controller) |
| : controller_(controller) { |
| (void)controller_; |
| } |
| |
| Parent_Proxy::~Parent_Proxy() = default; |
| |
| zx_status_t Parent_Proxy::Dispatch_(::fidl::Message message) { |
| zx_status_t status = ZX_OK; |
| switch (message.ordinal()) { |
| default: { |
| status = ZX_ERR_NOT_SUPPORTED; |
| break; |
| } |
| } |
| return status; |
| } |
| |
| void Parent_Proxy::First(::fidl::InterfaceRequest<Parent> request) { |
| ::fidl::Encoder _encoder(internal::kParent_First_GenOrdinal); |
| controller_->Send(&v1_fidl_test_json_ParentFirstRequestTable, |
| Parent_RequestEncoder::First(&_encoder, &request), nullptr); |
| } |
| |
| Parent_Stub::Parent_Stub(Parent_clazz* impl) : impl_(impl) { (void)impl_; } |
| |
| Parent_Stub::~Parent_Stub() = default; |
| |
| namespace {} // namespace |
| |
| zx_status_t Parent_Stub::Dispatch_(::fidl::Message message, |
| ::fidl::internal::PendingResponse response) { |
| bool needs_response; |
| const fidl_type_t* request_type = |
| Parent_RequestDecoder::GetType(message.ordinal(), &needs_response); |
| if (request_type == nullptr) { |
| return ZX_ERR_NOT_SUPPORTED; |
| } |
| if (response.needs_response() != needs_response) { |
| if (needs_response) { |
| FIDL_REPORT_DECODING_ERROR(message, request_type, |
| "Message needing a response with no txid"); |
| } else { |
| FIDL_REPORT_DECODING_ERROR(message, request_type, |
| "Message not needing a response with a txid"); |
| } |
| return ZX_ERR_INVALID_ARGS; |
| } |
| const char* error_msg = nullptr; |
| zx_status_t status = message.Decode(request_type, &error_msg); |
| if (status != ZX_OK) { |
| FIDL_REPORT_DECODING_ERROR(message, request_type, error_msg); |
| return status; |
| } |
| uint64_t ordinal = message.ordinal(); |
| switch (ordinal) { |
| case internal::kParent_First_Ordinal: |
| case internal::kParent_First_GenOrdinal: { |
| ::fidl::Decoder decoder(std::move(message)); |
| auto arg0 = |
| ::fidl::DecodeAs<::fidl::InterfaceRequest<Parent>>(&decoder, 16); |
| impl_->First(std::move(arg0)); |
| break; |
| } |
| default: { |
| status = ZX_ERR_NOT_SUPPORTED; |
| break; |
| } |
| } |
| return status; |
| } |
| |
| Parent_SyncProxy::Parent_SyncProxy(::zx::channel channel) |
| : proxy_(::std::move(channel)) {} |
| |
| Parent_SyncProxy::~Parent_SyncProxy() = default; |
| |
| zx_status_t Parent_SyncProxy::First(::fidl::InterfaceRequest<Parent> request) { |
| ::fidl::Encoder _encoder(internal::kParent_First_GenOrdinal); |
| return proxy_.Send(&v1_fidl_test_json_ParentFirstRequestTable, |
| Parent_RequestEncoder::First(&_encoder, &request)); |
| } |
| |
| #endif // __Fuchsia__ |
| |
| #ifdef __Fuchsia__ |
| namespace { |
| |
| extern "C" const fidl_type_t v1_fidl_test_json_ChildFirstRequestTable; |
| |
| extern "C" const fidl_type_t v1_fidl_test_json_ChildSecondRequestTable; |
| |
| } // namespace |
| |
| Child::~Child() = default; |
| |
| const fidl_type_t* Child_RequestDecoder::GetType(uint64_t ordinal, |
| bool* out_needs_response) { |
| switch (ordinal) { |
| case internal::kChild_First_Ordinal: |
| case internal::kChild_First_GenOrdinal: |
| *out_needs_response = false; |
| return &v1_fidl_test_json_ChildFirstRequestTable; |
| case internal::kChild_Second_Ordinal: |
| case internal::kChild_Second_GenOrdinal: |
| *out_needs_response = false; |
| return &v1_fidl_test_json_ChildSecondRequestTable; |
| default: |
| *out_needs_response = false; |
| return nullptr; |
| } |
| } |
| |
| const fidl_type_t* Child_ResponseDecoder::GetType(uint64_t ordinal) { |
| switch (ordinal) { |
| default: |
| return nullptr; |
| } |
| } |
| |
| Child_EventSender::~Child_EventSender() = default; |
| |
| Child_Sync::~Child_Sync() = default; |
| |
| Child_Proxy::Child_Proxy(::fidl::internal::ProxyController* controller) |
| : controller_(controller) { |
| (void)controller_; |
| } |
| |
| Child_Proxy::~Child_Proxy() = default; |
| |
| zx_status_t Child_Proxy::Dispatch_(::fidl::Message message) { |
| zx_status_t status = ZX_OK; |
| switch (message.ordinal()) { |
| default: { |
| status = ZX_ERR_NOT_SUPPORTED; |
| break; |
| } |
| } |
| return status; |
| } |
| |
| void Child_Proxy::First(::fidl::InterfaceRequest<Parent> request) { |
| ::fidl::Encoder _encoder(internal::kChild_First_GenOrdinal); |
| controller_->Send(&v1_fidl_test_json_ChildFirstRequestTable, |
| Child_RequestEncoder::First(&_encoder, &request), nullptr); |
| } |
| void Child_Proxy::Second(::fidl::InterfaceRequest<Parent> request) { |
| ::fidl::Encoder _encoder(internal::kChild_Second_GenOrdinal); |
| controller_->Send(&v1_fidl_test_json_ChildSecondRequestTable, |
| Child_RequestEncoder::Second(&_encoder, &request), nullptr); |
| } |
| |
| Child_Stub::Child_Stub(Child_clazz* impl) : impl_(impl) { (void)impl_; } |
| |
| Child_Stub::~Child_Stub() = default; |
| |
| namespace {} // namespace |
| |
| zx_status_t Child_Stub::Dispatch_(::fidl::Message message, |
| ::fidl::internal::PendingResponse response) { |
| bool needs_response; |
| const fidl_type_t* request_type = |
| Child_RequestDecoder::GetType(message.ordinal(), &needs_response); |
| if (request_type == nullptr) { |
| return ZX_ERR_NOT_SUPPORTED; |
| } |
| if (response.needs_response() != needs_response) { |
| if (needs_response) { |
| FIDL_REPORT_DECODING_ERROR(message, request_type, |
| "Message needing a response with no txid"); |
| } else { |
| FIDL_REPORT_DECODING_ERROR(message, request_type, |
| "Message not needing a response with a txid"); |
| } |
| return ZX_ERR_INVALID_ARGS; |
| } |
| const char* error_msg = nullptr; |
| zx_status_t status = message.Decode(request_type, &error_msg); |
| if (status != ZX_OK) { |
| FIDL_REPORT_DECODING_ERROR(message, request_type, error_msg); |
| return status; |
| } |
| uint64_t ordinal = message.ordinal(); |
| switch (ordinal) { |
| case internal::kChild_First_Ordinal: |
| case internal::kChild_First_GenOrdinal: { |
| ::fidl::Decoder decoder(std::move(message)); |
| auto arg0 = |
| ::fidl::DecodeAs<::fidl::InterfaceRequest<Parent>>(&decoder, 16); |
| impl_->First(std::move(arg0)); |
| break; |
| } |
| case internal::kChild_Second_Ordinal: |
| case internal::kChild_Second_GenOrdinal: { |
| ::fidl::Decoder decoder(std::move(message)); |
| auto arg0 = |
| ::fidl::DecodeAs<::fidl::InterfaceRequest<Parent>>(&decoder, 16); |
| impl_->Second(std::move(arg0)); |
| break; |
| } |
| default: { |
| status = ZX_ERR_NOT_SUPPORTED; |
| break; |
| } |
| } |
| return status; |
| } |
| |
| Child_SyncProxy::Child_SyncProxy(::zx::channel channel) |
| : proxy_(::std::move(channel)) {} |
| |
| Child_SyncProxy::~Child_SyncProxy() = default; |
| |
| zx_status_t Child_SyncProxy::First(::fidl::InterfaceRequest<Parent> request) { |
| ::fidl::Encoder _encoder(internal::kChild_First_GenOrdinal); |
| return proxy_.Send(&v1_fidl_test_json_ChildFirstRequestTable, |
| Child_RequestEncoder::First(&_encoder, &request)); |
| } |
| |
| zx_status_t Child_SyncProxy::Second(::fidl::InterfaceRequest<Parent> request) { |
| ::fidl::Encoder _encoder(internal::kChild_Second_GenOrdinal); |
| return proxy_.Send(&v1_fidl_test_json_ChildSecondRequestTable, |
| Child_RequestEncoder::Second(&_encoder, &request)); |
| } |
| |
| #endif // __Fuchsia__ |
| |
| } // namespace json |
| } // namespace test |
| } // namespace fidl |