//
// Automatically generated by ipdlc.
// Edit at your own risk
//


#include "mozilla/hwinference/PSpeechRecognitionParent.h"
#include "mozilla/hwinference/PSpeechRecognitionChild.h"
#include "mozilla/hwinference/PHWInference.h"
#include "mozilla/hwinference/PHWInferenceParent.h"
#include "mozilla/hwinference/PHWInferenceChild.h"

#include "ipc/IPCMessageUtils.h"
#include "ipc/IPCMessageUtilsSpecializations.h"
#include "nsIFile.h"
#include "mozilla/ipc/Endpoint.h"
#include "mozilla/ipc/ProtocolMessageUtils.h"
#include "mozilla/ipc/ProtocolUtils.h"
#include "mozilla/ipc/ShmemMessageUtils.h"
#include "mozilla/ipc/TaintingIPCUtils.h"

namespace mozilla {
namespace hwinference {
namespace PHWInference {

nsresult
CreateEndpoints(
        mozilla::ipc::EndpointProcInfo aParentDestInfo,
        mozilla::ipc::EndpointProcInfo aChildDestInfo,
        mozilla::ipc::Endpoint<::mozilla::hwinference::PHWInferenceParent>* aParent,
        mozilla::ipc::Endpoint<::mozilla::hwinference::PHWInferenceChild>* aChild)
{
    return mozilla::ipc::CreateEndpoints(
        mozilla::ipc::PrivateIPDLInterface(),
        aParentDestInfo, aChildDestInfo, aParent, aChild);
}
nsresult
CreateEndpoints(
        mozilla::ipc::Endpoint<::mozilla::hwinference::PHWInferenceParent>* aParent,
        mozilla::ipc::Endpoint<::mozilla::hwinference::PHWInferenceChild>* aChild)
{
    return mozilla::ipc::CreateEndpoints(
        mozilla::ipc::PrivateIPDLInterface(),
        aParent, aChild);
}
mozilla::UniquePtr<IPC::Message>
Msg_IsModelAvailable(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_IsModelAvailable__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_REPLY));
}
mozilla::UniquePtr<IPC::Message>
Reply_IsModelAvailable(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Reply_IsModelAvailable__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::REPLY));
}
mozilla::UniquePtr<IPC::Message>
Msg_IsModelInstalled(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_IsModelInstalled__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_REPLY));
}
mozilla::UniquePtr<IPC::Message>
Reply_IsModelInstalled(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Reply_IsModelInstalled__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::REPLY));
}
mozilla::UniquePtr<IPC::Message>
Msg_InstallModel(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_InstallModel__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_REPLY));
}
mozilla::UniquePtr<IPC::Message>
Reply_InstallModel(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Reply_InstallModel__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::REPLY));
}
mozilla::UniquePtr<IPC::Message>
Msg_GetModelFile(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_GetModelFile__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_REPLY));
}
mozilla::UniquePtr<IPC::Message>
Reply_GetModelFile(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Reply_GetModelFile__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::REPLY));
}
mozilla::UniquePtr<IPC::Message>
Msg_NewContentSpeechRecognition(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_NewContentSpeechRecognition__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_REPLY));
}

} // namespace PHWInference
} // namespace hwinference
} // namespace mozilla

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct GetModelFileSuccess|
//
namespace mozilla {
namespace hwinference {
} // namespace hwinference
} // namespace mozilla

namespace IPC {
auto ParamTraits<::mozilla::hwinference::GetModelFileSuccess>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).fd());
    // Sentinel = 'fd'
    (aWriter)->WriteSentinel(20054219);
}

auto ParamTraits<::mozilla::hwinference::GetModelFileSuccess>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe___fd = IPC::ReadParam<::mozilla::ipc::FileDescriptor>(aReader);
    if (!maybe___fd) {
        aReader->FatalError("Error deserializing 'fd' (FileDescriptor) member of 'GetModelFileSuccess'");
        return {};

    }
    auto& _fd = *maybe___fd;
    // Sentinel = 'fd'
    if ((!((aReader)->ReadSentinel(20054219)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'fd' (FileDescriptor) member of 'GetModelFileSuccess'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_fd)};
    return result__;
}

} // namespace IPC

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct GetModelError|
//
namespace mozilla {
namespace hwinference {
} // namespace hwinference
} // namespace mozilla

namespace IPC {
auto ParamTraits<::mozilla::hwinference::GetModelError>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).errorCode());
    // Sentinel = 'errorCode'
    (aWriter)->WriteSentinel(312345510);
}

auto ParamTraits<::mozilla::hwinference::GetModelError>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe___errorCode = IPC::ReadParam<::nsresult>(aReader);
    if (!maybe___errorCode) {
        aReader->FatalError("Error deserializing 'errorCode' (nsresult) member of 'GetModelError'");
        return {};

    }
    auto& _errorCode = *maybe___errorCode;
    // Sentinel = 'errorCode'
    if ((!((aReader)->ReadSentinel(312345510)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'errorCode' (nsresult) member of 'GetModelError'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_errorCode)};
    return result__;
}

} // namespace IPC

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |union GetModelFileResult|
//
namespace mozilla {
namespace hwinference {
auto GetModelFileResult::MaybeDestroy() -> void
{
    if ((mType) == (T__None)) {
        return;
    }
    switch (mType) {
    case TGetModelFileSuccess:
        {
            (ptr_GetModelFileSuccess())->~GetModelFileSuccess__tdef();
            break;
        }
    case TGetModelError:
        {
            (ptr_GetModelError())->~GetModelError__tdef();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("not reached");
            break;
        }
    }
}

MOZ_IMPLICIT GetModelFileResult::GetModelFileResult(const GetModelFileSuccess& aOther)
{
    new (mozilla::KnownNotNull, ptr_GetModelFileSuccess()) GetModelFileSuccess(aOther);
    mType = TGetModelFileSuccess;
}

MOZ_IMPLICIT GetModelFileResult::GetModelFileResult(GetModelFileSuccess&& aOther)
{
    new (mozilla::KnownNotNull, ptr_GetModelFileSuccess()) GetModelFileSuccess(std::move(aOther));
    mType = TGetModelFileSuccess;
}

MOZ_IMPLICIT GetModelFileResult::GetModelFileResult(const GetModelError& aOther)
{
    new (mozilla::KnownNotNull, ptr_GetModelError()) GetModelError(aOther);
    mType = TGetModelError;
}

MOZ_IMPLICIT GetModelFileResult::GetModelFileResult(GetModelError&& aOther)
{
    new (mozilla::KnownNotNull, ptr_GetModelError()) GetModelError(std::move(aOther));
    mType = TGetModelError;
}

MOZ_IMPLICIT GetModelFileResult::GetModelFileResult(const GetModelFileResult& aOther)
{
    (aOther).AssertSanity();
    switch ((aOther).type()) {
    case TGetModelFileSuccess:
        {
            new (mozilla::KnownNotNull, ptr_GetModelFileSuccess()) GetModelFileSuccess((aOther).get_GetModelFileSuccess());
            break;
        }
    case TGetModelError:
        {
            new (mozilla::KnownNotNull, ptr_GetModelError()) GetModelError((aOther).get_GetModelError());
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    mType = (aOther).type();
}

MOZ_IMPLICIT GetModelFileResult::GetModelFileResult(GetModelFileResult&& aOther)
{
    (aOther).AssertSanity();
    Type t = (aOther).type();
    switch (t) {
    case TGetModelFileSuccess:
        {
            new (mozilla::KnownNotNull, ptr_GetModelFileSuccess()) GetModelFileSuccess(std::move((aOther).get_GetModelFileSuccess()));
            (aOther).MaybeDestroy();
            break;
        }
    case TGetModelError:
        {
            new (mozilla::KnownNotNull, ptr_GetModelError()) GetModelError(std::move((aOther).get_GetModelError()));
            (aOther).MaybeDestroy();
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    (aOther).mType = T__None;
    mType = t;
}

GetModelFileResult::~GetModelFileResult()
{
    MaybeDestroy();
}

auto GetModelFileResult::operator=(const GetModelFileSuccess& aRhs) -> GetModelFileResult&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_GetModelFileSuccess()) GetModelFileSuccess(aRhs);
    mType = TGetModelFileSuccess;
    return (*(this));
}

auto GetModelFileResult::operator=(GetModelFileSuccess&& aRhs) -> GetModelFileResult&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_GetModelFileSuccess()) GetModelFileSuccess(std::move(aRhs));
    mType = TGetModelFileSuccess;
    return (*(this));
}

auto GetModelFileResult::operator=(const GetModelError& aRhs) -> GetModelFileResult&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_GetModelError()) GetModelError(aRhs);
    mType = TGetModelError;
    return (*(this));
}

auto GetModelFileResult::operator=(GetModelError&& aRhs) -> GetModelFileResult&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_GetModelError()) GetModelError(std::move(aRhs));
    mType = TGetModelError;
    return (*(this));
}

auto GetModelFileResult::operator=(const GetModelFileResult& aRhs) -> GetModelFileResult&
{
    (aRhs).AssertSanity();
    Type t = (aRhs).type();
    switch (t) {
    case TGetModelFileSuccess:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_GetModelFileSuccess()) GetModelFileSuccess((aRhs).get_GetModelFileSuccess());
            break;
        }
    case TGetModelError:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_GetModelError()) GetModelError((aRhs).get_GetModelError());
            break;
        }
    case T__None:
        {
            MaybeDestroy();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            break;
        }
    }
    mType = t;
    return (*(this));
}

auto GetModelFileResult::operator=(GetModelFileResult&& aRhs) -> GetModelFileResult&
{
    (aRhs).AssertSanity();
    Type t = (aRhs).type();
    switch (t) {
    case TGetModelFileSuccess:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_GetModelFileSuccess()) GetModelFileSuccess(std::move((aRhs).get_GetModelFileSuccess()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TGetModelError:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_GetModelError()) GetModelError(std::move((aRhs).get_GetModelError()));
            (aRhs).MaybeDestroy();
            break;
        }
    case T__None:
        {
            MaybeDestroy();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            break;
        }
    }
    (aRhs).mType = T__None;
    mType = t;
    return (*(this));
}

} // namespace hwinference
} // namespace mozilla

namespace IPC {
auto ParamTraits<::mozilla::hwinference::GetModelFileResult>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    typedef ::mozilla::hwinference::GetModelFileResult union__;
    int type = (aVar).type();
    IPC::WriteParam(aWriter, type);
    // Sentinel = 'GetModelFileResult'
    (aWriter)->WriteSentinel(1090127633);

    switch (type) {
    case union__::TGetModelFileSuccess:
        {
            IPC::WriteParam(aWriter, (aVar).get_GetModelFileSuccess());
            // Sentinel = 'TGetModelFileSuccess'
            (aWriter)->WriteSentinel(1321666495);
            return;
        }
    case union__::TGetModelError:
        {
            IPC::WriteParam(aWriter, (aVar).get_GetModelError());
            // Sentinel = 'TGetModelError'
            (aWriter)->WriteSentinel(655623536);
            return;
        }
    default:
        {
            aWriter->FatalError("unknown variant of union GetModelFileResult");
            return;
        }
    }
}

auto ParamTraits<::mozilla::hwinference::GetModelFileResult>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    typedef ::mozilla::hwinference::GetModelFileResult union__;
    auto maybe__type = IPC::ReadParam<int>(aReader);
    if (!maybe__type) {
        aReader->FatalError("Error deserializing type of union GetModelFileResult");
        return {};

    }
    auto& type = *maybe__type;
    // Sentinel = 'GetModelFileResult'
    if ((!((aReader)->ReadSentinel(1090127633)))) {
        mozilla::ipc::SentinelReadError("Error deserializing type of union GetModelFileResult");
        return {};
    }

    switch (type) {
    case union__::TGetModelFileSuccess:
        {
            auto maybe__tmp = IPC::ReadParam<::mozilla::hwinference::GetModelFileSuccess>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant TGetModelFileSuccess of union GetModelFileResult");
                return {};

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'TGetModelFileSuccess'
            if ((!((aReader)->ReadSentinel(1321666495)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant TGetModelFileSuccess of union GetModelFileResult");
                return {};
            }
            return std::move(tmp);
        }
    case union__::TGetModelError:
        {
            auto maybe__tmp = IPC::ReadParam<::mozilla::hwinference::GetModelError>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant TGetModelError of union GetModelFileResult");
                return {};

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'TGetModelError'
            if ((!((aReader)->ReadSentinel(655623536)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant TGetModelError of union GetModelFileResult");
                return {};
            }
            return std::move(tmp);
        }
    default:
        {
            aReader->FatalError("unknown variant of union GetModelFileResult");
            return {};
        }
    }
}

} // namespace IPC
