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 "ComponentTools/base_manager.h"
17 #include "ComponentTools/base_manager.inl"
18 #include "ecs/components/previous_joint_matrices_component.h"
19
20 #define IMPLEMENT_MANAGER
21 #include <core/property_tools/property_macros.h>
22
23 CORE3D_BEGIN_NAMESPACE()
24 using BASE_NS::array_view;
25 using BASE_NS::countof;
26
27 using CORE_NS::BaseManager;
28 using CORE_NS::IComponentManager;
29 using CORE_NS::IEcs;
30 using CORE_NS::Property;
31
32 class PreviousJointMatricesComponentManager final
33 : public BaseManager<PreviousJointMatricesComponent, IPreviousJointMatricesComponentManager> {
34 BEGIN_PROPERTY(PreviousJointMatricesComponent, properties_)
35 #include "ecs/components/previous_joint_matrices_component.h"
36 END_PROPERTY();
37
38 public:
PreviousJointMatricesComponentManager(IEcs & ecs)39 explicit PreviousJointMatricesComponentManager(IEcs& ecs)
40 : BaseManager<PreviousJointMatricesComponent, IPreviousJointMatricesComponentManager>(
41 ecs, CORE_NS::GetName<PreviousJointMatricesComponent>(), 0U)
42 {}
43
44 ~PreviousJointMatricesComponentManager() = default;
45
PropertyCount() const46 size_t PropertyCount() const override
47 {
48 return BASE_NS::countof(properties_);
49 }
50
MetaData(size_t index) const51 const Property* MetaData(size_t index) const override
52 {
53 if (index < BASE_NS::countof(properties_)) {
54 return &properties_[index];
55 }
56 return nullptr;
57 }
58
MetaData() const59 array_view<const Property> MetaData() const override
60 {
61 return properties_;
62 }
63 };
64
IPreviousJointMatricesComponentManagerInstance(IEcs & ecs)65 IComponentManager* IPreviousJointMatricesComponentManagerInstance(IEcs& ecs)
66 {
67 return new PreviousJointMatricesComponentManager(ecs);
68 }
69
IPreviousJointMatricesComponentManagerDestroy(IComponentManager * instance)70 void IPreviousJointMatricesComponentManagerDestroy(IComponentManager* instance)
71 {
72 delete static_cast<PreviousJointMatricesComponentManager*>(instance);
73 }
74 CORE3D_END_NAMESPACE()
75