blob: 118a85e5cd8ec7eaae175e4312973f9aad072467 [file] [log] [blame]
#include "aidl/android/aidl/versioned/tests/BazUnion.h"
#include <android/binder_parcel_utils.h>
namespace aidl {
namespace android {
namespace aidl {
namespace versioned {
namespace tests {
const char* BazUnion::descriptor = "android.aidl.versioned.tests.BazUnion";
binder_status_t BazUnion::readFromParcel(const AParcel* _parcel) {
binder_status_t _aidl_ret_status;
int32_t _aidl_tag;
if ((_aidl_ret_status = ::ndk::AParcel_readData(_parcel, &_aidl_tag)) != STATUS_OK) return _aidl_ret_status;
switch (static_cast<Tag>(_aidl_tag)) {
case intNum: {
int32_t _aidl_value;
if ((_aidl_ret_status = ::ndk::AParcel_readData(_parcel, &_aidl_value)) != STATUS_OK) return _aidl_ret_status;
if constexpr (std::is_trivially_copyable_v<int32_t>) {
set<intNum>(_aidl_value);
} else {
// NOLINTNEXTLINE(performance-move-const-arg)
set<intNum>(std::move(_aidl_value));
}
return STATUS_OK; }
}
return STATUS_BAD_VALUE;
}
binder_status_t BazUnion::writeToParcel(AParcel* _parcel) const {
binder_status_t _aidl_ret_status = ::ndk::AParcel_writeData(_parcel, static_cast<int32_t>(getTag()));
if (_aidl_ret_status != STATUS_OK) return _aidl_ret_status;
switch (getTag()) {
case intNum: return ::ndk::AParcel_writeData(_parcel, get<intNum>());
}
__assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "can't reach here");
}
} // namespace tests
} // namespace versioned
} // namespace aidl
} // namespace android
} // namespace aidl