/* * Copyright (c) Contributors to the Open 3D Engine Project. * For complete copyright and license terms please see the LICENSE at the root of this distribution. * * SPDX-License-Identifier: Apache-2.0 OR MIT * */ #include namespace AzFramework { namespace Components { template ComponentAdapter::ComponentAdapter(const TConfiguration& configuration) : m_controller(configuration) { } ////////////////////////////////////////////////////////////////////////// // Serialization and version conversion template void ComponentAdapter::Reflect(AZ::ReflectContext* context) { TController::Reflect(context); if (auto serializeContext = azrtti_cast(context)) { // clang-format off serializeContext->Class() ->Version(1) ->Field("Controller", &ComponentAdapter::m_controller) ; // clang-format on } } ////////////////////////////////////////////////////////////////////////// // Get*Services functions template void ComponentAdapter::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& services) { GetProvidedServicesHelper(services, typename AZ::HasComponentProvidedServices::type()); } template void ComponentAdapter::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& services) { GetRequiredServicesHelper(services, typename AZ::HasComponentRequiredServices::type()); } template void ComponentAdapter::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& services) { GetIncompatibleServicesHelper(services, typename AZ::HasComponentIncompatibleServices::type()); } template void ComponentAdapter::GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& services) { GetDependentServicesHelper(services, typename AZ::HasComponentDependentServices::type()); } template void ComponentAdapter::Init() { ComponentInitHelper::Init(m_controller); } template void ComponentAdapter::Activate() { ComponentActivateHelper::Activate(m_controller, AZ::EntityComponentIdPair(GetEntityId(), GetId())); } template void ComponentAdapter::Deactivate() { m_controller.Deactivate(); } template bool ComponentAdapter::ReadInConfig(const AZ::ComponentConfig* baseConfig) { if (const auto config = azrtti_cast(baseConfig)) { m_controller.SetConfiguration(*config); return true; } return false; } template bool ComponentAdapter::WriteOutConfig(AZ::ComponentConfig* outBaseConfig) const { if (auto config = azrtti_cast(outBaseConfig)) { *config = m_controller.GetConfiguration(); return true; } return false; } } // namespace Components } // namespace AzFramework