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


#include "mozilla/dom/MIDITypes.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"


//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct MIDIPortInfo|
//
namespace mozilla {
namespace dom {
auto MIDIPortInfo::operator==(const MIDIPortInfo& _o) const -> bool
{
    if ((!((id()) == ((_o).id())))) {
        return false;
    }
    if ((!((name()) == ((_o).name())))) {
        return false;
    }
    if ((!((manufacturer()) == ((_o).manufacturer())))) {
        return false;
    }
    if ((!((version()) == ((_o).version())))) {
        return false;
    }
    if ((!((type()) == ((_o).type())))) {
        return false;
    }
    return true;
}

auto MIDIPortInfo::operator!=(const MIDIPortInfo& _o) const -> bool
{
    return (!(operator==(_o)));
}

} // namespace dom
} // namespace mozilla

namespace IPC {
auto ParamTraits<::mozilla::dom::MIDIPortInfo>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).id());
    // Sentinel = 'id'
    (aWriter)->WriteSentinel(20447438);
    IPC::WriteParam(aWriter, (aVar).name());
    // Sentinel = 'name'
    (aWriter)->WriteSentinel(69075362);
    IPC::WriteParam(aWriter, (aVar).manufacturer());
    // Sentinel = 'manufacturer'
    (aWriter)->WriteSentinel(546243854);
    IPC::WriteParam(aWriter, (aVar).version());
    // Sentinel = 'version'
    (aWriter)->WriteSentinel(204210951);
    (aWriter)->WriteBytes((&((aVar).type())), 4);
    // Sentinel = 'type'
    (aWriter)->WriteSentinel(75760067);
}

auto ParamTraits<::mozilla::dom::MIDIPortInfo>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe___id = IPC::ReadParam<::nsString>(aReader);
    if (!maybe___id) {
        aReader->FatalError("Error deserializing 'id' (nsString) member of 'MIDIPortInfo'");
        return {};

    }
    auto& _id = *maybe___id;
    // Sentinel = 'id'
    if ((!((aReader)->ReadSentinel(20447438)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'id' (nsString) member of 'MIDIPortInfo'");
        return {};
    }
    auto maybe___name = IPC::ReadParam<::nsString>(aReader);
    if (!maybe___name) {
        aReader->FatalError("Error deserializing 'name' (nsString) member of 'MIDIPortInfo'");
        return {};

    }
    auto& _name = *maybe___name;
    // Sentinel = 'name'
    if ((!((aReader)->ReadSentinel(69075362)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'name' (nsString) member of 'MIDIPortInfo'");
        return {};
    }
    auto maybe___manufacturer = IPC::ReadParam<::nsString>(aReader);
    if (!maybe___manufacturer) {
        aReader->FatalError("Error deserializing 'manufacturer' (nsString) member of 'MIDIPortInfo'");
        return {};

    }
    auto& _manufacturer = *maybe___manufacturer;
    // Sentinel = 'manufacturer'
    if ((!((aReader)->ReadSentinel(546243854)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'manufacturer' (nsString) member of 'MIDIPortInfo'");
        return {};
    }
    auto maybe___version = IPC::ReadParam<::nsString>(aReader);
    if (!maybe___version) {
        aReader->FatalError("Error deserializing 'version' (nsString) member of 'MIDIPortInfo'");
        return {};

    }
    auto& _version = *maybe___version;
    // Sentinel = 'version'
    if ((!((aReader)->ReadSentinel(204210951)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'version' (nsString) member of 'MIDIPortInfo'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_id),
            std::move(_name),
            std::move(_manufacturer),
            std::move(_version),
            ::uint32_t{0}};
    if ((!((aReader)->ReadBytesInto((&((result__)->type())), 4)))) {
        aReader->FatalError("Error bulk reading fields from uint32_t");
        return {};
    }
    // Sentinel = 'type'
    if ((!((aReader)->ReadSentinel(75760067)))) {
        mozilla::ipc::SentinelReadError("Error bulk reading fields from uint32_t");
        return {};
    }
    return result__;
}

} // namespace IPC

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct MIDIMessage|
//
namespace mozilla {
namespace dom {
} // namespace dom
} // namespace mozilla

namespace IPC {
auto ParamTraits<::mozilla::dom::MIDIMessage>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).data());
    // Sentinel = 'data'
    (aWriter)->WriteSentinel(67109275);
    IPC::WriteParam(aWriter, (aVar).timestamp());
    // Sentinel = 'timestamp'
    (aWriter)->WriteSentinel(322569173);
}

auto ParamTraits<::mozilla::dom::MIDIMessage>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe___data = IPC::ReadParam<nsTArray<::uint8_t>>(aReader);
    if (!maybe___data) {
        aReader->FatalError("Error deserializing 'data' (uint8_t[]) member of 'MIDIMessage'");
        return {};

    }
    auto& _data = *maybe___data;
    // Sentinel = 'data'
    if ((!((aReader)->ReadSentinel(67109275)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'data' (uint8_t[]) member of 'MIDIMessage'");
        return {};
    }
    auto maybe___timestamp = IPC::ReadParam<::mozilla::TimeStamp>(aReader);
    if (!maybe___timestamp) {
        aReader->FatalError("Error deserializing 'timestamp' (TimeStamp) member of 'MIDIMessage'");
        return {};

    }
    auto& _timestamp = *maybe___timestamp;
    // Sentinel = 'timestamp'
    if ((!((aReader)->ReadSentinel(322569173)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'timestamp' (TimeStamp) member of 'MIDIMessage'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_data),
            std::move(_timestamp)};
    return result__;
}

} // namespace IPC

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct MIDIPortList|
//
namespace mozilla {
namespace dom {
} // namespace dom
} // namespace mozilla

namespace IPC {
auto ParamTraits<::mozilla::dom::MIDIPortList>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).ports());
    // Sentinel = 'ports'
    (aWriter)->WriteSentinel(111280697);
}

auto ParamTraits<::mozilla::dom::MIDIPortList>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe___ports = IPC::ReadParam<nsTArray<::mozilla::dom::MIDIPortInfo>>(aReader);
    if (!maybe___ports) {
        aReader->FatalError("Error deserializing 'ports' (MIDIPortInfo[]) member of 'MIDIPortList'");
        return {};

    }
    auto& _ports = *maybe___ports;
    // Sentinel = 'ports'
    if ((!((aReader)->ReadSentinel(111280697)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'ports' (MIDIPortInfo[]) member of 'MIDIPortList'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_ports)};
    return result__;
}

} // namespace IPC
