1 #ifndef DALI_INTERNAL_SCENEGRAPH_NODE_HELPER_H
2 #define DALI_INTERNAL_SCENEGRAPH_NODE_HELPER_H
5 * Copyright (c) 2023 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
21 * Defines the given value, and adds an enumeration that contains it's
22 * size. The enumeration can be used by the wrapper templated types
23 * below during structure definition. ("offsetof" requires the
24 * structure to be completely defined before use, so cannot be
27 #define BASE(_TYPE, _X) \
31 OFFSET_##_X = sizeof(_TYPE) \
35 * Create a property template instance, passing in the previously
36 * stored element, which utilizes that element's OFFSET enumeration to
37 * compute the offset of the BASE element.
39 * It is expected that _TEMPLATE is a TransformManagerPropertyVector3
40 * which takes a TransformManagerProperty enumeration and an offset
41 * to the BASE TransformManagerData.
43 * It is assumed that successive elements are aligned, and that no padding
44 * is inserted by the compiler.
46 #define PROPERTY_WRAPPER(_BASE_ELEMENT, _TEMPLATE, _PROPERTY, _ELEMENT) \
47 using _TEMPLATE##_ELEMENT = _TEMPLATE<_PROPERTY, OFFSET_##_BASE_ELEMENT>; \
48 _TEMPLATE##_ELEMENT _ELEMENT; \
51 OFFSET_##_ELEMENT = sizeof(_TEMPLATE##_ELEMENT) + OFFSET_##_BASE_ELEMENT \
55 * Create a template instance, passing in the previously stored
56 * element, utilizing that element's OFFSET enumeration to compute the offset
57 * of the BASE element.
59 * It is expected that _TEMPLATE is a TransformManagerPropertyNNNN template
60 * which takes an offset to the BASE TransformManagerData.
62 * It is assumed that successive elements are aligned, and that no padding
63 * is inserted by the compiler.
65 #define TEMPLATE_WRAPPER(_BASE_ELEMENT, _TEMPLATE, _ELEMENT) \
66 using _TEMPLATE##_ELEMENT = _TEMPLATE<OFFSET_##_BASE_ELEMENT>; \
67 _TEMPLATE##_ELEMENT _ELEMENT; \
70 OFFSET_##_ELEMENT = sizeof(_TEMPLATE##_ELEMENT) + OFFSET_##_BASE_ELEMENT \
73 #endif // DALI_INTERNAL_SCENEGRAPH_NODE_HELPER_H