1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #include <3d/ecs/components/animation_output_component.h> 17 18 #include "ComponentTools/base_manager.h" 19 #include "ComponentTools/base_manager.inl" 20 21 #define IMPLEMENT_MANAGER 22 #include <core/property_tools/property_macros.h> 23 24 CORE_BEGIN_NAMESPACE() 25 using BASE_NS::vector; 26 DECLARE_PROPERTY_TYPE(vector<uint8_t>); 27 CORE_END_NAMESPACE() 28 29 CORE3D_BEGIN_NAMESPACE() 30 using BASE_NS::array_view; 31 using BASE_NS::countof; 32 33 using CORE_NS::BaseManager; 34 using CORE_NS::IComponentManager; 35 using CORE_NS::IEcs; 36 using CORE_NS::Property; 37 38 class AnimationOutputComponentManager final 39 : public BaseManager<AnimationOutputComponent, IAnimationOutputComponentManager> { 40 BEGIN_PROPERTY(AnimationOutputComponent, componentMetaData_) 41 #include <3d/ecs/components/animation_output_component.h> 42 END_PROPERTY(); 43 44 public: AnimationOutputComponentManager(IEcs & ecs)45 explicit AnimationOutputComponentManager(IEcs& ecs) 46 : BaseManager<AnimationOutputComponent, IAnimationOutputComponentManager>( 47 ecs, CORE_NS::GetName<AnimationOutputComponent>()) 48 {} 49 50 ~AnimationOutputComponentManager() = default; 51 PropertyCount() const52 size_t PropertyCount() const override 53 { 54 return BASE_NS::countof(componentMetaData_); 55 } 56 MetaData(size_t index) const57 const Property* MetaData(size_t index) const override 58 { 59 if (index < BASE_NS::countof(componentMetaData_)) { 60 return &componentMetaData_[index]; 61 } 62 return nullptr; 63 } 64 MetaData() const65 array_view<const Property> MetaData() const override 66 { 67 return componentMetaData_; 68 } 69 }; 70 IAnimationOutputComponentManagerInstance(IEcs & ecs)71IComponentManager* IAnimationOutputComponentManagerInstance(IEcs& ecs) 72 { 73 return new AnimationOutputComponentManager(ecs); 74 } 75 IAnimationOutputComponentManagerDestroy(IComponentManager * instance)76void IAnimationOutputComponentManagerDestroy(IComponentManager* instance) 77 { 78 delete static_cast<AnimationOutputComponentManager*>(instance); 79 } 80 CORE3D_END_NAMESPACE() 81