From 1b5f6a891e66f87139b5204953c2296634817f3b Mon Sep 17 00:00:00 2001 From: Tony Xiang Date: Thu, 15 Aug 2024 08:56:12 +0200 Subject: [PATCH 1/7] move trait Signed-off-by: Tony Xiang --- .../include/power_grid_model/auxiliary/meta_data.hpp | 6 ------ .../power_grid_model/auxiliary/meta_gen/gen_getters.hpp | 7 +++++++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/meta_data.hpp b/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/meta_data.hpp index bbb0fe658..4f06e3c44 100644 --- a/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/meta_data.hpp +++ b/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/meta_data.hpp @@ -16,12 +16,6 @@ namespace power_grid_model::meta_data { -// pointer to member -template struct trait_pointer_to_member; -template struct trait_pointer_to_member { - using value_type = ValueType; -}; - // primary template to get the attribute list of a component // the specializations will contain static constexpr "value" field // which is a std::array diff --git a/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/meta_gen/gen_getters.hpp b/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/meta_gen/gen_getters.hpp index b297a4f72..62296dd6f 100644 --- a/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/meta_gen/gen_getters.hpp +++ b/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/meta_gen/gen_getters.hpp @@ -10,6 +10,13 @@ namespace power_grid_model::meta_data::meta_data_gen { +// pointer to member +template struct trait_pointer_to_member; +template struct trait_pointer_to_member { + using value_type = ValueType; + using struct_type = StructType; +}; + // getter for meta attribute template struct get_meta_attribute { using ValueType = typename trait_pointer_to_member::value_type; From 2b1dcf048ae73cea0ae05719cd528b84b84c5647 Mon Sep 17 00:00:00 2001 From: Tony Xiang Date: Thu, 15 Aug 2024 09:40:05 +0200 Subject: [PATCH 2/7] first refactor Signed-off-by: Tony Xiang --- .../meta_gen/attribute_classes.hpp.jinja | 2 +- .../auxiliary/meta_gen/gen_getters.hpp | 10 +- .../auxiliary/meta_gen/input.hpp | 362 +++++++++--------- .../auxiliary/meta_gen/output.hpp | 172 ++++----- .../auxiliary/meta_gen/update.hpp | 116 +++--- tests/cpp_unit_tests/test_dataset.cpp | 46 +-- 6 files changed, 350 insertions(+), 358 deletions(-) diff --git a/code_generation/templates/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/meta_gen/attribute_classes.hpp.jinja b/code_generation/templates/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/meta_gen/attribute_classes.hpp.jinja index 5c8519bc7..9373d55be 100644 --- a/code_generation/templates/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/meta_gen/attribute_classes.hpp.jinja +++ b/code_generation/templates/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/meta_gen/attribute_classes.hpp.jinja @@ -34,7 +34,7 @@ struct get_attributes_list<{{ attribute_class.name }}> { static constexpr std::array value{ // all attributes including base class {% for attribute in attribute_class.full_attributes %} - meta_data_gen::get_meta_attribute<{{ attribute_class.full_name }}, &{{ attribute_class.full_name }}::{{ attribute.names }}, offsetof({{ attribute_class.full_name }}, {{ attribute.names }}), []{ return "{{ attribute.names }}"; }>::value, + meta_data_gen::get_meta_attribute<&{{ attribute_class.full_name }}::{{ attribute.names }}>(offsetof({{ attribute_class.full_name }}, {{ attribute.names }}), "{{ attribute.names }}"), {%- endfor %} }; }; diff --git a/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/meta_gen/gen_getters.hpp b/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/meta_gen/gen_getters.hpp index 62296dd6f..595e60d40 100644 --- a/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/meta_gen/gen_getters.hpp +++ b/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/meta_gen/gen_getters.hpp @@ -18,11 +18,13 @@ template struct trait_pointer_to_member struct get_meta_attribute { - using ValueType = typename trait_pointer_to_member::value_type; +template +constexpr MetaAttribute get_meta_attribute(size_t offset, char const* attribute_name) { + using ValueType = typename trait_pointer_to_member::value_type; + using StructType = typename trait_pointer_to_member::struct_type; - static constexpr MetaAttribute value{ - .name = attribute_name_getter(), + return MetaAttribute{ + .name = attribute_name, .ctype = ctype_v, .offset = offset, .size = sizeof(ValueType), diff --git a/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/meta_gen/input.hpp b/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/meta_gen/input.hpp index a439b49a9..dfc3f2f31 100644 --- a/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/meta_gen/input.hpp +++ b/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/meta_gen/input.hpp @@ -26,7 +26,7 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&BaseInput::id>(offsetof(BaseInput, id), "id"), }; }; @@ -35,8 +35,8 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&NodeInput::id>(offsetof(NodeInput, id), "id"), + meta_data_gen::get_meta_attribute<&NodeInput::u_rated>(offsetof(NodeInput, u_rated), "u_rated"), }; }; @@ -45,11 +45,11 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&BranchInput::id>(offsetof(BranchInput, id), "id"), + meta_data_gen::get_meta_attribute<&BranchInput::from_node>(offsetof(BranchInput, from_node), "from_node"), + meta_data_gen::get_meta_attribute<&BranchInput::to_node>(offsetof(BranchInput, to_node), "to_node"), + meta_data_gen::get_meta_attribute<&BranchInput::from_status>(offsetof(BranchInput, from_status), "from_status"), + meta_data_gen::get_meta_attribute<&BranchInput::to_status>(offsetof(BranchInput, to_status), "to_status"), }; }; @@ -58,13 +58,13 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&Branch3Input::id>(offsetof(Branch3Input, id), "id"), + meta_data_gen::get_meta_attribute<&Branch3Input::node_1>(offsetof(Branch3Input, node_1), "node_1"), + meta_data_gen::get_meta_attribute<&Branch3Input::node_2>(offsetof(Branch3Input, node_2), "node_2"), + meta_data_gen::get_meta_attribute<&Branch3Input::node_3>(offsetof(Branch3Input, node_3), "node_3"), + meta_data_gen::get_meta_attribute<&Branch3Input::status_1>(offsetof(Branch3Input, status_1), "status_1"), + meta_data_gen::get_meta_attribute<&Branch3Input::status_2>(offsetof(Branch3Input, status_2), "status_2"), + meta_data_gen::get_meta_attribute<&Branch3Input::status_3>(offsetof(Branch3Input, status_3), "status_3"), }; }; @@ -73,8 +73,8 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&SensorInput::id>(offsetof(SensorInput, id), "id"), + meta_data_gen::get_meta_attribute<&SensorInput::measured_object>(offsetof(SensorInput, measured_object), "measured_object"), }; }; @@ -83,9 +83,9 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&ApplianceInput::id>(offsetof(ApplianceInput, id), "id"), + meta_data_gen::get_meta_attribute<&ApplianceInput::node>(offsetof(ApplianceInput, node), "node"), + meta_data_gen::get_meta_attribute<&ApplianceInput::status>(offsetof(ApplianceInput, status), "status"), }; }; @@ -94,20 +94,20 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&LineInput::id>(offsetof(LineInput, id), "id"), + meta_data_gen::get_meta_attribute<&LineInput::from_node>(offsetof(LineInput, from_node), "from_node"), + meta_data_gen::get_meta_attribute<&LineInput::to_node>(offsetof(LineInput, to_node), "to_node"), + meta_data_gen::get_meta_attribute<&LineInput::from_status>(offsetof(LineInput, from_status), "from_status"), + meta_data_gen::get_meta_attribute<&LineInput::to_status>(offsetof(LineInput, to_status), "to_status"), + meta_data_gen::get_meta_attribute<&LineInput::r1>(offsetof(LineInput, r1), "r1"), + meta_data_gen::get_meta_attribute<&LineInput::x1>(offsetof(LineInput, x1), "x1"), + meta_data_gen::get_meta_attribute<&LineInput::c1>(offsetof(LineInput, c1), "c1"), + meta_data_gen::get_meta_attribute<&LineInput::tan1>(offsetof(LineInput, tan1), "tan1"), + meta_data_gen::get_meta_attribute<&LineInput::r0>(offsetof(LineInput, r0), "r0"), + meta_data_gen::get_meta_attribute<&LineInput::x0>(offsetof(LineInput, x0), "x0"), + meta_data_gen::get_meta_attribute<&LineInput::c0>(offsetof(LineInput, c0), "c0"), + meta_data_gen::get_meta_attribute<&LineInput::tan0>(offsetof(LineInput, tan0), "tan0"), + meta_data_gen::get_meta_attribute<&LineInput::i_n>(offsetof(LineInput, i_n), "i_n"), }; }; @@ -116,11 +116,11 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&LinkInput::id>(offsetof(LinkInput, id), "id"), + meta_data_gen::get_meta_attribute<&LinkInput::from_node>(offsetof(LinkInput, from_node), "from_node"), + meta_data_gen::get_meta_attribute<&LinkInput::to_node>(offsetof(LinkInput, to_node), "to_node"), + meta_data_gen::get_meta_attribute<&LinkInput::from_status>(offsetof(LinkInput, from_status), "from_status"), + meta_data_gen::get_meta_attribute<&LinkInput::to_status>(offsetof(LinkInput, to_status), "to_status"), }; }; @@ -129,35 +129,35 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&TransformerInput::id>(offsetof(TransformerInput, id), "id"), + meta_data_gen::get_meta_attribute<&TransformerInput::from_node>(offsetof(TransformerInput, from_node), "from_node"), + meta_data_gen::get_meta_attribute<&TransformerInput::to_node>(offsetof(TransformerInput, to_node), "to_node"), + meta_data_gen::get_meta_attribute<&TransformerInput::from_status>(offsetof(TransformerInput, from_status), "from_status"), + meta_data_gen::get_meta_attribute<&TransformerInput::to_status>(offsetof(TransformerInput, to_status), "to_status"), + meta_data_gen::get_meta_attribute<&TransformerInput::u1>(offsetof(TransformerInput, u1), "u1"), + meta_data_gen::get_meta_attribute<&TransformerInput::u2>(offsetof(TransformerInput, u2), "u2"), + meta_data_gen::get_meta_attribute<&TransformerInput::sn>(offsetof(TransformerInput, sn), "sn"), + meta_data_gen::get_meta_attribute<&TransformerInput::uk>(offsetof(TransformerInput, uk), "uk"), + meta_data_gen::get_meta_attribute<&TransformerInput::pk>(offsetof(TransformerInput, pk), "pk"), + meta_data_gen::get_meta_attribute<&TransformerInput::i0>(offsetof(TransformerInput, i0), "i0"), + meta_data_gen::get_meta_attribute<&TransformerInput::p0>(offsetof(TransformerInput, p0), "p0"), + meta_data_gen::get_meta_attribute<&TransformerInput::winding_from>(offsetof(TransformerInput, winding_from), "winding_from"), + meta_data_gen::get_meta_attribute<&TransformerInput::winding_to>(offsetof(TransformerInput, winding_to), "winding_to"), + meta_data_gen::get_meta_attribute<&TransformerInput::clock>(offsetof(TransformerInput, clock), "clock"), + meta_data_gen::get_meta_attribute<&TransformerInput::tap_side>(offsetof(TransformerInput, tap_side), "tap_side"), + meta_data_gen::get_meta_attribute<&TransformerInput::tap_pos>(offsetof(TransformerInput, tap_pos), "tap_pos"), + meta_data_gen::get_meta_attribute<&TransformerInput::tap_min>(offsetof(TransformerInput, tap_min), "tap_min"), + meta_data_gen::get_meta_attribute<&TransformerInput::tap_max>(offsetof(TransformerInput, tap_max), "tap_max"), + meta_data_gen::get_meta_attribute<&TransformerInput::tap_nom>(offsetof(TransformerInput, tap_nom), "tap_nom"), + meta_data_gen::get_meta_attribute<&TransformerInput::tap_size>(offsetof(TransformerInput, tap_size), "tap_size"), + meta_data_gen::get_meta_attribute<&TransformerInput::uk_min>(offsetof(TransformerInput, uk_min), "uk_min"), + meta_data_gen::get_meta_attribute<&TransformerInput::uk_max>(offsetof(TransformerInput, uk_max), "uk_max"), + meta_data_gen::get_meta_attribute<&TransformerInput::pk_min>(offsetof(TransformerInput, pk_min), "pk_min"), + meta_data_gen::get_meta_attribute<&TransformerInput::pk_max>(offsetof(TransformerInput, pk_max), "pk_max"), + meta_data_gen::get_meta_attribute<&TransformerInput::r_grounding_from>(offsetof(TransformerInput, r_grounding_from), "r_grounding_from"), + meta_data_gen::get_meta_attribute<&TransformerInput::x_grounding_from>(offsetof(TransformerInput, x_grounding_from), "x_grounding_from"), + meta_data_gen::get_meta_attribute<&TransformerInput::r_grounding_to>(offsetof(TransformerInput, r_grounding_to), "r_grounding_to"), + meta_data_gen::get_meta_attribute<&TransformerInput::x_grounding_to>(offsetof(TransformerInput, x_grounding_to), "x_grounding_to"), }; }; @@ -166,56 +166,56 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::id>(offsetof(ThreeWindingTransformerInput, id), "id"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::node_1>(offsetof(ThreeWindingTransformerInput, node_1), "node_1"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::node_2>(offsetof(ThreeWindingTransformerInput, node_2), "node_2"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::node_3>(offsetof(ThreeWindingTransformerInput, node_3), "node_3"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::status_1>(offsetof(ThreeWindingTransformerInput, status_1), "status_1"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::status_2>(offsetof(ThreeWindingTransformerInput, status_2), "status_2"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::status_3>(offsetof(ThreeWindingTransformerInput, status_3), "status_3"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::u1>(offsetof(ThreeWindingTransformerInput, u1), "u1"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::u2>(offsetof(ThreeWindingTransformerInput, u2), "u2"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::u3>(offsetof(ThreeWindingTransformerInput, u3), "u3"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::sn_1>(offsetof(ThreeWindingTransformerInput, sn_1), "sn_1"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::sn_2>(offsetof(ThreeWindingTransformerInput, sn_2), "sn_2"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::sn_3>(offsetof(ThreeWindingTransformerInput, sn_3), "sn_3"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::uk_12>(offsetof(ThreeWindingTransformerInput, uk_12), "uk_12"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::uk_13>(offsetof(ThreeWindingTransformerInput, uk_13), "uk_13"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::uk_23>(offsetof(ThreeWindingTransformerInput, uk_23), "uk_23"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::pk_12>(offsetof(ThreeWindingTransformerInput, pk_12), "pk_12"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::pk_13>(offsetof(ThreeWindingTransformerInput, pk_13), "pk_13"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::pk_23>(offsetof(ThreeWindingTransformerInput, pk_23), "pk_23"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::i0>(offsetof(ThreeWindingTransformerInput, i0), "i0"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::p0>(offsetof(ThreeWindingTransformerInput, p0), "p0"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::winding_1>(offsetof(ThreeWindingTransformerInput, winding_1), "winding_1"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::winding_2>(offsetof(ThreeWindingTransformerInput, winding_2), "winding_2"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::winding_3>(offsetof(ThreeWindingTransformerInput, winding_3), "winding_3"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::clock_12>(offsetof(ThreeWindingTransformerInput, clock_12), "clock_12"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::clock_13>(offsetof(ThreeWindingTransformerInput, clock_13), "clock_13"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::tap_side>(offsetof(ThreeWindingTransformerInput, tap_side), "tap_side"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::tap_pos>(offsetof(ThreeWindingTransformerInput, tap_pos), "tap_pos"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::tap_min>(offsetof(ThreeWindingTransformerInput, tap_min), "tap_min"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::tap_max>(offsetof(ThreeWindingTransformerInput, tap_max), "tap_max"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::tap_nom>(offsetof(ThreeWindingTransformerInput, tap_nom), "tap_nom"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::tap_size>(offsetof(ThreeWindingTransformerInput, tap_size), "tap_size"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::uk_12_min>(offsetof(ThreeWindingTransformerInput, uk_12_min), "uk_12_min"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::uk_12_max>(offsetof(ThreeWindingTransformerInput, uk_12_max), "uk_12_max"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::uk_13_min>(offsetof(ThreeWindingTransformerInput, uk_13_min), "uk_13_min"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::uk_13_max>(offsetof(ThreeWindingTransformerInput, uk_13_max), "uk_13_max"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::uk_23_min>(offsetof(ThreeWindingTransformerInput, uk_23_min), "uk_23_min"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::uk_23_max>(offsetof(ThreeWindingTransformerInput, uk_23_max), "uk_23_max"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::pk_12_min>(offsetof(ThreeWindingTransformerInput, pk_12_min), "pk_12_min"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::pk_12_max>(offsetof(ThreeWindingTransformerInput, pk_12_max), "pk_12_max"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::pk_13_min>(offsetof(ThreeWindingTransformerInput, pk_13_min), "pk_13_min"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::pk_13_max>(offsetof(ThreeWindingTransformerInput, pk_13_max), "pk_13_max"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::pk_23_min>(offsetof(ThreeWindingTransformerInput, pk_23_min), "pk_23_min"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::pk_23_max>(offsetof(ThreeWindingTransformerInput, pk_23_max), "pk_23_max"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::r_grounding_1>(offsetof(ThreeWindingTransformerInput, r_grounding_1), "r_grounding_1"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::x_grounding_1>(offsetof(ThreeWindingTransformerInput, x_grounding_1), "x_grounding_1"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::r_grounding_2>(offsetof(ThreeWindingTransformerInput, r_grounding_2), "r_grounding_2"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::x_grounding_2>(offsetof(ThreeWindingTransformerInput, x_grounding_2), "x_grounding_2"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::r_grounding_3>(offsetof(ThreeWindingTransformerInput, r_grounding_3), "r_grounding_3"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerInput::x_grounding_3>(offsetof(ThreeWindingTransformerInput, x_grounding_3), "x_grounding_3"), }; }; @@ -224,10 +224,10 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&GenericLoadGenInput::id>(offsetof(GenericLoadGenInput, id), "id"), + meta_data_gen::get_meta_attribute<&GenericLoadGenInput::node>(offsetof(GenericLoadGenInput, node), "node"), + meta_data_gen::get_meta_attribute<&GenericLoadGenInput::status>(offsetof(GenericLoadGenInput, status), "status"), + meta_data_gen::get_meta_attribute<&GenericLoadGenInput::type>(offsetof(GenericLoadGenInput, type), "type"), }; }; @@ -238,12 +238,12 @@ struct get_attributes_list> { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute, &LoadGenInput::id, offsetof(LoadGenInput, id), []{ return "id"; }>::value, - meta_data_gen::get_meta_attribute, &LoadGenInput::node, offsetof(LoadGenInput, node), []{ return "node"; }>::value, - meta_data_gen::get_meta_attribute, &LoadGenInput::status, offsetof(LoadGenInput, status), []{ return "status"; }>::value, - meta_data_gen::get_meta_attribute, &LoadGenInput::type, offsetof(LoadGenInput, type), []{ return "type"; }>::value, - meta_data_gen::get_meta_attribute, &LoadGenInput::p_specified, offsetof(LoadGenInput, p_specified), []{ return "p_specified"; }>::value, - meta_data_gen::get_meta_attribute, &LoadGenInput::q_specified, offsetof(LoadGenInput, q_specified), []{ return "q_specified"; }>::value, + meta_data_gen::get_meta_attribute<&LoadGenInput::id>(offsetof(LoadGenInput, id), "id"), + meta_data_gen::get_meta_attribute<&LoadGenInput::node>(offsetof(LoadGenInput, node), "node"), + meta_data_gen::get_meta_attribute<&LoadGenInput::status>(offsetof(LoadGenInput, status), "status"), + meta_data_gen::get_meta_attribute<&LoadGenInput::type>(offsetof(LoadGenInput, type), "type"), + meta_data_gen::get_meta_attribute<&LoadGenInput::p_specified>(offsetof(LoadGenInput, p_specified), "p_specified"), + meta_data_gen::get_meta_attribute<&LoadGenInput::q_specified>(offsetof(LoadGenInput, q_specified), "q_specified"), }; }; @@ -252,13 +252,13 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&ShuntInput::id>(offsetof(ShuntInput, id), "id"), + meta_data_gen::get_meta_attribute<&ShuntInput::node>(offsetof(ShuntInput, node), "node"), + meta_data_gen::get_meta_attribute<&ShuntInput::status>(offsetof(ShuntInput, status), "status"), + meta_data_gen::get_meta_attribute<&ShuntInput::g1>(offsetof(ShuntInput, g1), "g1"), + meta_data_gen::get_meta_attribute<&ShuntInput::b1>(offsetof(ShuntInput, b1), "b1"), + meta_data_gen::get_meta_attribute<&ShuntInput::g0>(offsetof(ShuntInput, g0), "g0"), + meta_data_gen::get_meta_attribute<&ShuntInput::b0>(offsetof(ShuntInput, b0), "b0"), }; }; @@ -267,14 +267,14 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&SourceInput::id>(offsetof(SourceInput, id), "id"), + meta_data_gen::get_meta_attribute<&SourceInput::node>(offsetof(SourceInput, node), "node"), + meta_data_gen::get_meta_attribute<&SourceInput::status>(offsetof(SourceInput, status), "status"), + meta_data_gen::get_meta_attribute<&SourceInput::u_ref>(offsetof(SourceInput, u_ref), "u_ref"), + meta_data_gen::get_meta_attribute<&SourceInput::u_ref_angle>(offsetof(SourceInput, u_ref_angle), "u_ref_angle"), + meta_data_gen::get_meta_attribute<&SourceInput::sk>(offsetof(SourceInput, sk), "sk"), + meta_data_gen::get_meta_attribute<&SourceInput::rx_ratio>(offsetof(SourceInput, rx_ratio), "rx_ratio"), + meta_data_gen::get_meta_attribute<&SourceInput::z01_ratio>(offsetof(SourceInput, z01_ratio), "z01_ratio"), }; }; @@ -283,9 +283,9 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&GenericVoltageSensorInput::id>(offsetof(GenericVoltageSensorInput, id), "id"), + meta_data_gen::get_meta_attribute<&GenericVoltageSensorInput::measured_object>(offsetof(GenericVoltageSensorInput, measured_object), "measured_object"), + meta_data_gen::get_meta_attribute<&GenericVoltageSensorInput::u_sigma>(offsetof(GenericVoltageSensorInput, u_sigma), "u_sigma"), }; }; @@ -296,11 +296,11 @@ struct get_attributes_list> { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute, &VoltageSensorInput::id, offsetof(VoltageSensorInput, id), []{ return "id"; }>::value, - meta_data_gen::get_meta_attribute, &VoltageSensorInput::measured_object, offsetof(VoltageSensorInput, measured_object), []{ return "measured_object"; }>::value, - meta_data_gen::get_meta_attribute, &VoltageSensorInput::u_sigma, offsetof(VoltageSensorInput, u_sigma), []{ return "u_sigma"; }>::value, - meta_data_gen::get_meta_attribute, &VoltageSensorInput::u_measured, offsetof(VoltageSensorInput, u_measured), []{ return "u_measured"; }>::value, - meta_data_gen::get_meta_attribute, &VoltageSensorInput::u_angle_measured, offsetof(VoltageSensorInput, u_angle_measured), []{ return "u_angle_measured"; }>::value, + meta_data_gen::get_meta_attribute<&VoltageSensorInput::id>(offsetof(VoltageSensorInput, id), "id"), + meta_data_gen::get_meta_attribute<&VoltageSensorInput::measured_object>(offsetof(VoltageSensorInput, measured_object), "measured_object"), + meta_data_gen::get_meta_attribute<&VoltageSensorInput::u_sigma>(offsetof(VoltageSensorInput, u_sigma), "u_sigma"), + meta_data_gen::get_meta_attribute<&VoltageSensorInput::u_measured>(offsetof(VoltageSensorInput, u_measured), "u_measured"), + meta_data_gen::get_meta_attribute<&VoltageSensorInput::u_angle_measured>(offsetof(VoltageSensorInput, u_angle_measured), "u_angle_measured"), }; }; @@ -309,10 +309,10 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&GenericPowerSensorInput::id>(offsetof(GenericPowerSensorInput, id), "id"), + meta_data_gen::get_meta_attribute<&GenericPowerSensorInput::measured_object>(offsetof(GenericPowerSensorInput, measured_object), "measured_object"), + meta_data_gen::get_meta_attribute<&GenericPowerSensorInput::measured_terminal_type>(offsetof(GenericPowerSensorInput, measured_terminal_type), "measured_terminal_type"), + meta_data_gen::get_meta_attribute<&GenericPowerSensorInput::power_sigma>(offsetof(GenericPowerSensorInput, power_sigma), "power_sigma"), }; }; @@ -323,14 +323,14 @@ struct get_attributes_list> { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute, &PowerSensorInput::id, offsetof(PowerSensorInput, id), []{ return "id"; }>::value, - meta_data_gen::get_meta_attribute, &PowerSensorInput::measured_object, offsetof(PowerSensorInput, measured_object), []{ return "measured_object"; }>::value, - meta_data_gen::get_meta_attribute, &PowerSensorInput::measured_terminal_type, offsetof(PowerSensorInput, measured_terminal_type), []{ return "measured_terminal_type"; }>::value, - meta_data_gen::get_meta_attribute, &PowerSensorInput::power_sigma, offsetof(PowerSensorInput, power_sigma), []{ return "power_sigma"; }>::value, - meta_data_gen::get_meta_attribute, &PowerSensorInput::p_measured, offsetof(PowerSensorInput, p_measured), []{ return "p_measured"; }>::value, - meta_data_gen::get_meta_attribute, &PowerSensorInput::q_measured, offsetof(PowerSensorInput, q_measured), []{ return "q_measured"; }>::value, - meta_data_gen::get_meta_attribute, &PowerSensorInput::p_sigma, offsetof(PowerSensorInput, p_sigma), []{ return "p_sigma"; }>::value, - meta_data_gen::get_meta_attribute, &PowerSensorInput::q_sigma, offsetof(PowerSensorInput, q_sigma), []{ return "q_sigma"; }>::value, + meta_data_gen::get_meta_attribute<&PowerSensorInput::id>(offsetof(PowerSensorInput, id), "id"), + meta_data_gen::get_meta_attribute<&PowerSensorInput::measured_object>(offsetof(PowerSensorInput, measured_object), "measured_object"), + meta_data_gen::get_meta_attribute<&PowerSensorInput::measured_terminal_type>(offsetof(PowerSensorInput, measured_terminal_type), "measured_terminal_type"), + meta_data_gen::get_meta_attribute<&PowerSensorInput::power_sigma>(offsetof(PowerSensorInput, power_sigma), "power_sigma"), + meta_data_gen::get_meta_attribute<&PowerSensorInput::p_measured>(offsetof(PowerSensorInput, p_measured), "p_measured"), + meta_data_gen::get_meta_attribute<&PowerSensorInput::q_measured>(offsetof(PowerSensorInput, q_measured), "q_measured"), + meta_data_gen::get_meta_attribute<&PowerSensorInput::p_sigma>(offsetof(PowerSensorInput, p_sigma), "p_sigma"), + meta_data_gen::get_meta_attribute<&PowerSensorInput::q_sigma>(offsetof(PowerSensorInput, q_sigma), "q_sigma"), }; }; @@ -339,13 +339,13 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&FaultInput::id>(offsetof(FaultInput, id), "id"), + meta_data_gen::get_meta_attribute<&FaultInput::status>(offsetof(FaultInput, status), "status"), + meta_data_gen::get_meta_attribute<&FaultInput::fault_type>(offsetof(FaultInput, fault_type), "fault_type"), + meta_data_gen::get_meta_attribute<&FaultInput::fault_phase>(offsetof(FaultInput, fault_phase), "fault_phase"), + meta_data_gen::get_meta_attribute<&FaultInput::fault_object>(offsetof(FaultInput, fault_object), "fault_object"), + meta_data_gen::get_meta_attribute<&FaultInput::r_f>(offsetof(FaultInput, r_f), "r_f"), + meta_data_gen::get_meta_attribute<&FaultInput::x_f>(offsetof(FaultInput, x_f), "x_f"), }; }; @@ -354,9 +354,9 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&RegulatorInput::id>(offsetof(RegulatorInput, id), "id"), + meta_data_gen::get_meta_attribute<&RegulatorInput::regulated_object>(offsetof(RegulatorInput, regulated_object), "regulated_object"), + meta_data_gen::get_meta_attribute<&RegulatorInput::status>(offsetof(RegulatorInput, status), "status"), }; }; @@ -365,14 +365,14 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&TransformerTapRegulatorInput::id>(offsetof(TransformerTapRegulatorInput, id), "id"), + meta_data_gen::get_meta_attribute<&TransformerTapRegulatorInput::regulated_object>(offsetof(TransformerTapRegulatorInput, regulated_object), "regulated_object"), + meta_data_gen::get_meta_attribute<&TransformerTapRegulatorInput::status>(offsetof(TransformerTapRegulatorInput, status), "status"), + meta_data_gen::get_meta_attribute<&TransformerTapRegulatorInput::control_side>(offsetof(TransformerTapRegulatorInput, control_side), "control_side"), + meta_data_gen::get_meta_attribute<&TransformerTapRegulatorInput::u_set>(offsetof(TransformerTapRegulatorInput, u_set), "u_set"), + meta_data_gen::get_meta_attribute<&TransformerTapRegulatorInput::u_band>(offsetof(TransformerTapRegulatorInput, u_band), "u_band"), + meta_data_gen::get_meta_attribute<&TransformerTapRegulatorInput::line_drop_compensation_r>(offsetof(TransformerTapRegulatorInput, line_drop_compensation_r), "line_drop_compensation_r"), + meta_data_gen::get_meta_attribute<&TransformerTapRegulatorInput::line_drop_compensation_x>(offsetof(TransformerTapRegulatorInput, line_drop_compensation_x), "line_drop_compensation_x"), }; }; diff --git a/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/meta_gen/output.hpp b/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/meta_gen/output.hpp index 1e2686752..3d4b62e96 100644 --- a/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/meta_gen/output.hpp +++ b/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/meta_gen/output.hpp @@ -26,8 +26,8 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&BaseOutput::id>(offsetof(BaseOutput, id), "id"), + meta_data_gen::get_meta_attribute<&BaseOutput::energized>(offsetof(BaseOutput, energized), "energized"), }; }; @@ -38,13 +38,13 @@ struct get_attributes_list> { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute, &NodeOutput::id, offsetof(NodeOutput, id), []{ return "id"; }>::value, - meta_data_gen::get_meta_attribute, &NodeOutput::energized, offsetof(NodeOutput, energized), []{ return "energized"; }>::value, - meta_data_gen::get_meta_attribute, &NodeOutput::u_pu, offsetof(NodeOutput, u_pu), []{ return "u_pu"; }>::value, - meta_data_gen::get_meta_attribute, &NodeOutput::u, offsetof(NodeOutput, u), []{ return "u"; }>::value, - meta_data_gen::get_meta_attribute, &NodeOutput::u_angle, offsetof(NodeOutput, u_angle), []{ return "u_angle"; }>::value, - meta_data_gen::get_meta_attribute, &NodeOutput::p, offsetof(NodeOutput, p), []{ return "p"; }>::value, - meta_data_gen::get_meta_attribute, &NodeOutput::q, offsetof(NodeOutput, q), []{ return "q"; }>::value, + meta_data_gen::get_meta_attribute<&NodeOutput::id>(offsetof(NodeOutput, id), "id"), + meta_data_gen::get_meta_attribute<&NodeOutput::energized>(offsetof(NodeOutput, energized), "energized"), + meta_data_gen::get_meta_attribute<&NodeOutput::u_pu>(offsetof(NodeOutput, u_pu), "u_pu"), + meta_data_gen::get_meta_attribute<&NodeOutput::u>(offsetof(NodeOutput, u), "u"), + meta_data_gen::get_meta_attribute<&NodeOutput::u_angle>(offsetof(NodeOutput, u_angle), "u_angle"), + meta_data_gen::get_meta_attribute<&NodeOutput::p>(offsetof(NodeOutput, p), "p"), + meta_data_gen::get_meta_attribute<&NodeOutput::q>(offsetof(NodeOutput, q), "q"), }; }; @@ -55,17 +55,17 @@ struct get_attributes_list> { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute, &BranchOutput::id, offsetof(BranchOutput, id), []{ return "id"; }>::value, - meta_data_gen::get_meta_attribute, &BranchOutput::energized, offsetof(BranchOutput, energized), []{ return "energized"; }>::value, - meta_data_gen::get_meta_attribute, &BranchOutput::loading, offsetof(BranchOutput, loading), []{ return "loading"; }>::value, - meta_data_gen::get_meta_attribute, &BranchOutput::p_from, offsetof(BranchOutput, p_from), []{ return "p_from"; }>::value, - meta_data_gen::get_meta_attribute, &BranchOutput::q_from, offsetof(BranchOutput, q_from), []{ return "q_from"; }>::value, - meta_data_gen::get_meta_attribute, &BranchOutput::i_from, offsetof(BranchOutput, i_from), []{ return "i_from"; }>::value, - meta_data_gen::get_meta_attribute, &BranchOutput::s_from, offsetof(BranchOutput, s_from), []{ return "s_from"; }>::value, - meta_data_gen::get_meta_attribute, &BranchOutput::p_to, offsetof(BranchOutput, p_to), []{ return "p_to"; }>::value, - meta_data_gen::get_meta_attribute, &BranchOutput::q_to, offsetof(BranchOutput, q_to), []{ return "q_to"; }>::value, - meta_data_gen::get_meta_attribute, &BranchOutput::i_to, offsetof(BranchOutput, i_to), []{ return "i_to"; }>::value, - meta_data_gen::get_meta_attribute, &BranchOutput::s_to, offsetof(BranchOutput, s_to), []{ return "s_to"; }>::value, + meta_data_gen::get_meta_attribute<&BranchOutput::id>(offsetof(BranchOutput, id), "id"), + meta_data_gen::get_meta_attribute<&BranchOutput::energized>(offsetof(BranchOutput, energized), "energized"), + meta_data_gen::get_meta_attribute<&BranchOutput::loading>(offsetof(BranchOutput, loading), "loading"), + meta_data_gen::get_meta_attribute<&BranchOutput::p_from>(offsetof(BranchOutput, p_from), "p_from"), + meta_data_gen::get_meta_attribute<&BranchOutput::q_from>(offsetof(BranchOutput, q_from), "q_from"), + meta_data_gen::get_meta_attribute<&BranchOutput::i_from>(offsetof(BranchOutput, i_from), "i_from"), + meta_data_gen::get_meta_attribute<&BranchOutput::s_from>(offsetof(BranchOutput, s_from), "s_from"), + meta_data_gen::get_meta_attribute<&BranchOutput::p_to>(offsetof(BranchOutput, p_to), "p_to"), + meta_data_gen::get_meta_attribute<&BranchOutput::q_to>(offsetof(BranchOutput, q_to), "q_to"), + meta_data_gen::get_meta_attribute<&BranchOutput::i_to>(offsetof(BranchOutput, i_to), "i_to"), + meta_data_gen::get_meta_attribute<&BranchOutput::s_to>(offsetof(BranchOutput, s_to), "s_to"), }; }; @@ -76,21 +76,21 @@ struct get_attributes_list> { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute, &Branch3Output::id, offsetof(Branch3Output, id), []{ return "id"; }>::value, - meta_data_gen::get_meta_attribute, &Branch3Output::energized, offsetof(Branch3Output, energized), []{ return "energized"; }>::value, - meta_data_gen::get_meta_attribute, &Branch3Output::loading, offsetof(Branch3Output, loading), []{ return "loading"; }>::value, - meta_data_gen::get_meta_attribute, &Branch3Output::p_1, offsetof(Branch3Output, p_1), []{ return "p_1"; }>::value, - meta_data_gen::get_meta_attribute, &Branch3Output::q_1, offsetof(Branch3Output, q_1), []{ return "q_1"; }>::value, - meta_data_gen::get_meta_attribute, &Branch3Output::i_1, offsetof(Branch3Output, i_1), []{ return "i_1"; }>::value, - meta_data_gen::get_meta_attribute, &Branch3Output::s_1, offsetof(Branch3Output, s_1), []{ return "s_1"; }>::value, - meta_data_gen::get_meta_attribute, &Branch3Output::p_2, offsetof(Branch3Output, p_2), []{ return "p_2"; }>::value, - meta_data_gen::get_meta_attribute, &Branch3Output::q_2, offsetof(Branch3Output, q_2), []{ return "q_2"; }>::value, - meta_data_gen::get_meta_attribute, &Branch3Output::i_2, offsetof(Branch3Output, i_2), []{ return "i_2"; }>::value, - meta_data_gen::get_meta_attribute, &Branch3Output::s_2, offsetof(Branch3Output, s_2), []{ return "s_2"; }>::value, - meta_data_gen::get_meta_attribute, &Branch3Output::p_3, offsetof(Branch3Output, p_3), []{ return "p_3"; }>::value, - meta_data_gen::get_meta_attribute, &Branch3Output::q_3, offsetof(Branch3Output, q_3), []{ return "q_3"; }>::value, - meta_data_gen::get_meta_attribute, &Branch3Output::i_3, offsetof(Branch3Output, i_3), []{ return "i_3"; }>::value, - meta_data_gen::get_meta_attribute, &Branch3Output::s_3, offsetof(Branch3Output, s_3), []{ return "s_3"; }>::value, + meta_data_gen::get_meta_attribute<&Branch3Output::id>(offsetof(Branch3Output, id), "id"), + meta_data_gen::get_meta_attribute<&Branch3Output::energized>(offsetof(Branch3Output, energized), "energized"), + meta_data_gen::get_meta_attribute<&Branch3Output::loading>(offsetof(Branch3Output, loading), "loading"), + meta_data_gen::get_meta_attribute<&Branch3Output::p_1>(offsetof(Branch3Output, p_1), "p_1"), + meta_data_gen::get_meta_attribute<&Branch3Output::q_1>(offsetof(Branch3Output, q_1), "q_1"), + meta_data_gen::get_meta_attribute<&Branch3Output::i_1>(offsetof(Branch3Output, i_1), "i_1"), + meta_data_gen::get_meta_attribute<&Branch3Output::s_1>(offsetof(Branch3Output, s_1), "s_1"), + meta_data_gen::get_meta_attribute<&Branch3Output::p_2>(offsetof(Branch3Output, p_2), "p_2"), + meta_data_gen::get_meta_attribute<&Branch3Output::q_2>(offsetof(Branch3Output, q_2), "q_2"), + meta_data_gen::get_meta_attribute<&Branch3Output::i_2>(offsetof(Branch3Output, i_2), "i_2"), + meta_data_gen::get_meta_attribute<&Branch3Output::s_2>(offsetof(Branch3Output, s_2), "s_2"), + meta_data_gen::get_meta_attribute<&Branch3Output::p_3>(offsetof(Branch3Output, p_3), "p_3"), + meta_data_gen::get_meta_attribute<&Branch3Output::q_3>(offsetof(Branch3Output, q_3), "q_3"), + meta_data_gen::get_meta_attribute<&Branch3Output::i_3>(offsetof(Branch3Output, i_3), "i_3"), + meta_data_gen::get_meta_attribute<&Branch3Output::s_3>(offsetof(Branch3Output, s_3), "s_3"), }; }; @@ -101,13 +101,13 @@ struct get_attributes_list> { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute, &ApplianceOutput::id, offsetof(ApplianceOutput, id), []{ return "id"; }>::value, - meta_data_gen::get_meta_attribute, &ApplianceOutput::energized, offsetof(ApplianceOutput, energized), []{ return "energized"; }>::value, - meta_data_gen::get_meta_attribute, &ApplianceOutput::p, offsetof(ApplianceOutput, p), []{ return "p"; }>::value, - meta_data_gen::get_meta_attribute, &ApplianceOutput::q, offsetof(ApplianceOutput, q), []{ return "q"; }>::value, - meta_data_gen::get_meta_attribute, &ApplianceOutput::i, offsetof(ApplianceOutput, i), []{ return "i"; }>::value, - meta_data_gen::get_meta_attribute, &ApplianceOutput::s, offsetof(ApplianceOutput, s), []{ return "s"; }>::value, - meta_data_gen::get_meta_attribute, &ApplianceOutput::pf, offsetof(ApplianceOutput, pf), []{ return "pf"; }>::value, + meta_data_gen::get_meta_attribute<&ApplianceOutput::id>(offsetof(ApplianceOutput, id), "id"), + meta_data_gen::get_meta_attribute<&ApplianceOutput::energized>(offsetof(ApplianceOutput, energized), "energized"), + meta_data_gen::get_meta_attribute<&ApplianceOutput::p>(offsetof(ApplianceOutput, p), "p"), + meta_data_gen::get_meta_attribute<&ApplianceOutput::q>(offsetof(ApplianceOutput, q), "q"), + meta_data_gen::get_meta_attribute<&ApplianceOutput::i>(offsetof(ApplianceOutput, i), "i"), + meta_data_gen::get_meta_attribute<&ApplianceOutput::s>(offsetof(ApplianceOutput, s), "s"), + meta_data_gen::get_meta_attribute<&ApplianceOutput::pf>(offsetof(ApplianceOutput, pf), "pf"), }; }; @@ -118,10 +118,10 @@ struct get_attributes_list> { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute, &VoltageSensorOutput::id, offsetof(VoltageSensorOutput, id), []{ return "id"; }>::value, - meta_data_gen::get_meta_attribute, &VoltageSensorOutput::energized, offsetof(VoltageSensorOutput, energized), []{ return "energized"; }>::value, - meta_data_gen::get_meta_attribute, &VoltageSensorOutput::u_residual, offsetof(VoltageSensorOutput, u_residual), []{ return "u_residual"; }>::value, - meta_data_gen::get_meta_attribute, &VoltageSensorOutput::u_angle_residual, offsetof(VoltageSensorOutput, u_angle_residual), []{ return "u_angle_residual"; }>::value, + meta_data_gen::get_meta_attribute<&VoltageSensorOutput::id>(offsetof(VoltageSensorOutput, id), "id"), + meta_data_gen::get_meta_attribute<&VoltageSensorOutput::energized>(offsetof(VoltageSensorOutput, energized), "energized"), + meta_data_gen::get_meta_attribute<&VoltageSensorOutput::u_residual>(offsetof(VoltageSensorOutput, u_residual), "u_residual"), + meta_data_gen::get_meta_attribute<&VoltageSensorOutput::u_angle_residual>(offsetof(VoltageSensorOutput, u_angle_residual), "u_angle_residual"), }; }; @@ -132,10 +132,10 @@ struct get_attributes_list> { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute, &PowerSensorOutput::id, offsetof(PowerSensorOutput, id), []{ return "id"; }>::value, - meta_data_gen::get_meta_attribute, &PowerSensorOutput::energized, offsetof(PowerSensorOutput, energized), []{ return "energized"; }>::value, - meta_data_gen::get_meta_attribute, &PowerSensorOutput::p_residual, offsetof(PowerSensorOutput, p_residual), []{ return "p_residual"; }>::value, - meta_data_gen::get_meta_attribute, &PowerSensorOutput::q_residual, offsetof(PowerSensorOutput, q_residual), []{ return "q_residual"; }>::value, + meta_data_gen::get_meta_attribute<&PowerSensorOutput::id>(offsetof(PowerSensorOutput, id), "id"), + meta_data_gen::get_meta_attribute<&PowerSensorOutput::energized>(offsetof(PowerSensorOutput, energized), "energized"), + meta_data_gen::get_meta_attribute<&PowerSensorOutput::p_residual>(offsetof(PowerSensorOutput, p_residual), "p_residual"), + meta_data_gen::get_meta_attribute<&PowerSensorOutput::q_residual>(offsetof(PowerSensorOutput, q_residual), "q_residual"), }; }; @@ -144,8 +144,8 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&FaultOutput::id>(offsetof(FaultOutput, id), "id"), + meta_data_gen::get_meta_attribute<&FaultOutput::energized>(offsetof(FaultOutput, energized), "energized"), }; }; @@ -154,10 +154,10 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&FaultShortCircuitOutput::id>(offsetof(FaultShortCircuitOutput, id), "id"), + meta_data_gen::get_meta_attribute<&FaultShortCircuitOutput::energized>(offsetof(FaultShortCircuitOutput, energized), "energized"), + meta_data_gen::get_meta_attribute<&FaultShortCircuitOutput::i_f>(offsetof(FaultShortCircuitOutput, i_f), "i_f"), + meta_data_gen::get_meta_attribute<&FaultShortCircuitOutput::i_f_angle>(offsetof(FaultShortCircuitOutput, i_f_angle), "i_f_angle"), }; }; @@ -166,11 +166,11 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&NodeShortCircuitOutput::id>(offsetof(NodeShortCircuitOutput, id), "id"), + meta_data_gen::get_meta_attribute<&NodeShortCircuitOutput::energized>(offsetof(NodeShortCircuitOutput, energized), "energized"), + meta_data_gen::get_meta_attribute<&NodeShortCircuitOutput::u_pu>(offsetof(NodeShortCircuitOutput, u_pu), "u_pu"), + meta_data_gen::get_meta_attribute<&NodeShortCircuitOutput::u>(offsetof(NodeShortCircuitOutput, u), "u"), + meta_data_gen::get_meta_attribute<&NodeShortCircuitOutput::u_angle>(offsetof(NodeShortCircuitOutput, u_angle), "u_angle"), }; }; @@ -179,12 +179,12 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&BranchShortCircuitOutput::id>(offsetof(BranchShortCircuitOutput, id), "id"), + meta_data_gen::get_meta_attribute<&BranchShortCircuitOutput::energized>(offsetof(BranchShortCircuitOutput, energized), "energized"), + meta_data_gen::get_meta_attribute<&BranchShortCircuitOutput::i_from>(offsetof(BranchShortCircuitOutput, i_from), "i_from"), + meta_data_gen::get_meta_attribute<&BranchShortCircuitOutput::i_from_angle>(offsetof(BranchShortCircuitOutput, i_from_angle), "i_from_angle"), + meta_data_gen::get_meta_attribute<&BranchShortCircuitOutput::i_to>(offsetof(BranchShortCircuitOutput, i_to), "i_to"), + meta_data_gen::get_meta_attribute<&BranchShortCircuitOutput::i_to_angle>(offsetof(BranchShortCircuitOutput, i_to_angle), "i_to_angle"), }; }; @@ -193,14 +193,14 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&Branch3ShortCircuitOutput::id>(offsetof(Branch3ShortCircuitOutput, id), "id"), + meta_data_gen::get_meta_attribute<&Branch3ShortCircuitOutput::energized>(offsetof(Branch3ShortCircuitOutput, energized), "energized"), + meta_data_gen::get_meta_attribute<&Branch3ShortCircuitOutput::i_1>(offsetof(Branch3ShortCircuitOutput, i_1), "i_1"), + meta_data_gen::get_meta_attribute<&Branch3ShortCircuitOutput::i_1_angle>(offsetof(Branch3ShortCircuitOutput, i_1_angle), "i_1_angle"), + meta_data_gen::get_meta_attribute<&Branch3ShortCircuitOutput::i_2>(offsetof(Branch3ShortCircuitOutput, i_2), "i_2"), + meta_data_gen::get_meta_attribute<&Branch3ShortCircuitOutput::i_2_angle>(offsetof(Branch3ShortCircuitOutput, i_2_angle), "i_2_angle"), + meta_data_gen::get_meta_attribute<&Branch3ShortCircuitOutput::i_3>(offsetof(Branch3ShortCircuitOutput, i_3), "i_3"), + meta_data_gen::get_meta_attribute<&Branch3ShortCircuitOutput::i_3_angle>(offsetof(Branch3ShortCircuitOutput, i_3_angle), "i_3_angle"), }; }; @@ -209,10 +209,10 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&ApplianceShortCircuitOutput::id>(offsetof(ApplianceShortCircuitOutput, id), "id"), + meta_data_gen::get_meta_attribute<&ApplianceShortCircuitOutput::energized>(offsetof(ApplianceShortCircuitOutput, energized), "energized"), + meta_data_gen::get_meta_attribute<&ApplianceShortCircuitOutput::i>(offsetof(ApplianceShortCircuitOutput, i), "i"), + meta_data_gen::get_meta_attribute<&ApplianceShortCircuitOutput::i_angle>(offsetof(ApplianceShortCircuitOutput, i_angle), "i_angle"), }; }; @@ -221,8 +221,8 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&SensorShortCircuitOutput::id>(offsetof(SensorShortCircuitOutput, id), "id"), + meta_data_gen::get_meta_attribute<&SensorShortCircuitOutput::energized>(offsetof(SensorShortCircuitOutput, energized), "energized"), }; }; @@ -231,9 +231,9 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&TransformerTapRegulatorOutput::id>(offsetof(TransformerTapRegulatorOutput, id), "id"), + meta_data_gen::get_meta_attribute<&TransformerTapRegulatorOutput::energized>(offsetof(TransformerTapRegulatorOutput, energized), "energized"), + meta_data_gen::get_meta_attribute<&TransformerTapRegulatorOutput::tap_pos>(offsetof(TransformerTapRegulatorOutput, tap_pos), "tap_pos"), }; }; @@ -242,8 +242,8 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&RegulatorShortCircuitOutput::id>(offsetof(RegulatorShortCircuitOutput, id), "id"), + meta_data_gen::get_meta_attribute<&RegulatorShortCircuitOutput::energized>(offsetof(RegulatorShortCircuitOutput, energized), "energized"), }; }; diff --git a/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/meta_gen/update.hpp b/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/meta_gen/update.hpp index 01d5e3641..d4781bfe8 100644 --- a/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/meta_gen/update.hpp +++ b/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/meta_gen/update.hpp @@ -26,7 +26,7 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&BaseUpdate::id>(offsetof(BaseUpdate, id), "id"), }; }; @@ -35,9 +35,9 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&BranchUpdate::id>(offsetof(BranchUpdate, id), "id"), + meta_data_gen::get_meta_attribute<&BranchUpdate::from_status>(offsetof(BranchUpdate, from_status), "from_status"), + meta_data_gen::get_meta_attribute<&BranchUpdate::to_status>(offsetof(BranchUpdate, to_status), "to_status"), }; }; @@ -46,10 +46,10 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&Branch3Update::id>(offsetof(Branch3Update, id), "id"), + meta_data_gen::get_meta_attribute<&Branch3Update::status_1>(offsetof(Branch3Update, status_1), "status_1"), + meta_data_gen::get_meta_attribute<&Branch3Update::status_2>(offsetof(Branch3Update, status_2), "status_2"), + meta_data_gen::get_meta_attribute<&Branch3Update::status_3>(offsetof(Branch3Update, status_3), "status_3"), }; }; @@ -58,8 +58,8 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&ApplianceUpdate::id>(offsetof(ApplianceUpdate, id), "id"), + meta_data_gen::get_meta_attribute<&ApplianceUpdate::status>(offsetof(ApplianceUpdate, status), "status"), }; }; @@ -68,10 +68,10 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&TransformerUpdate::id>(offsetof(TransformerUpdate, id), "id"), + meta_data_gen::get_meta_attribute<&TransformerUpdate::from_status>(offsetof(TransformerUpdate, from_status), "from_status"), + meta_data_gen::get_meta_attribute<&TransformerUpdate::to_status>(offsetof(TransformerUpdate, to_status), "to_status"), + meta_data_gen::get_meta_attribute<&TransformerUpdate::tap_pos>(offsetof(TransformerUpdate, tap_pos), "tap_pos"), }; }; @@ -80,11 +80,11 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerUpdate::id>(offsetof(ThreeWindingTransformerUpdate, id), "id"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerUpdate::status_1>(offsetof(ThreeWindingTransformerUpdate, status_1), "status_1"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerUpdate::status_2>(offsetof(ThreeWindingTransformerUpdate, status_2), "status_2"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerUpdate::status_3>(offsetof(ThreeWindingTransformerUpdate, status_3), "status_3"), + meta_data_gen::get_meta_attribute<&ThreeWindingTransformerUpdate::tap_pos>(offsetof(ThreeWindingTransformerUpdate, tap_pos), "tap_pos"), }; }; @@ -95,10 +95,10 @@ struct get_attributes_list> { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute, &LoadGenUpdate::id, offsetof(LoadGenUpdate, id), []{ return "id"; }>::value, - meta_data_gen::get_meta_attribute, &LoadGenUpdate::status, offsetof(LoadGenUpdate, status), []{ return "status"; }>::value, - meta_data_gen::get_meta_attribute, &LoadGenUpdate::p_specified, offsetof(LoadGenUpdate, p_specified), []{ return "p_specified"; }>::value, - meta_data_gen::get_meta_attribute, &LoadGenUpdate::q_specified, offsetof(LoadGenUpdate, q_specified), []{ return "q_specified"; }>::value, + meta_data_gen::get_meta_attribute<&LoadGenUpdate::id>(offsetof(LoadGenUpdate, id), "id"), + meta_data_gen::get_meta_attribute<&LoadGenUpdate::status>(offsetof(LoadGenUpdate, status), "status"), + meta_data_gen::get_meta_attribute<&LoadGenUpdate::p_specified>(offsetof(LoadGenUpdate, p_specified), "p_specified"), + meta_data_gen::get_meta_attribute<&LoadGenUpdate::q_specified>(offsetof(LoadGenUpdate, q_specified), "q_specified"), }; }; @@ -107,10 +107,10 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&SourceUpdate::id>(offsetof(SourceUpdate, id), "id"), + meta_data_gen::get_meta_attribute<&SourceUpdate::status>(offsetof(SourceUpdate, status), "status"), + meta_data_gen::get_meta_attribute<&SourceUpdate::u_ref>(offsetof(SourceUpdate, u_ref), "u_ref"), + meta_data_gen::get_meta_attribute<&SourceUpdate::u_ref_angle>(offsetof(SourceUpdate, u_ref_angle), "u_ref_angle"), }; }; @@ -119,12 +119,12 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&ShuntUpdate::id>(offsetof(ShuntUpdate, id), "id"), + meta_data_gen::get_meta_attribute<&ShuntUpdate::status>(offsetof(ShuntUpdate, status), "status"), + meta_data_gen::get_meta_attribute<&ShuntUpdate::g1>(offsetof(ShuntUpdate, g1), "g1"), + meta_data_gen::get_meta_attribute<&ShuntUpdate::b1>(offsetof(ShuntUpdate, b1), "b1"), + meta_data_gen::get_meta_attribute<&ShuntUpdate::g0>(offsetof(ShuntUpdate, g0), "g0"), + meta_data_gen::get_meta_attribute<&ShuntUpdate::b0>(offsetof(ShuntUpdate, b0), "b0"), }; }; @@ -135,10 +135,10 @@ struct get_attributes_list> { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute, &VoltageSensorUpdate::id, offsetof(VoltageSensorUpdate, id), []{ return "id"; }>::value, - meta_data_gen::get_meta_attribute, &VoltageSensorUpdate::u_sigma, offsetof(VoltageSensorUpdate, u_sigma), []{ return "u_sigma"; }>::value, - meta_data_gen::get_meta_attribute, &VoltageSensorUpdate::u_measured, offsetof(VoltageSensorUpdate, u_measured), []{ return "u_measured"; }>::value, - meta_data_gen::get_meta_attribute, &VoltageSensorUpdate::u_angle_measured, offsetof(VoltageSensorUpdate, u_angle_measured), []{ return "u_angle_measured"; }>::value, + meta_data_gen::get_meta_attribute<&VoltageSensorUpdate::id>(offsetof(VoltageSensorUpdate, id), "id"), + meta_data_gen::get_meta_attribute<&VoltageSensorUpdate::u_sigma>(offsetof(VoltageSensorUpdate, u_sigma), "u_sigma"), + meta_data_gen::get_meta_attribute<&VoltageSensorUpdate::u_measured>(offsetof(VoltageSensorUpdate, u_measured), "u_measured"), + meta_data_gen::get_meta_attribute<&VoltageSensorUpdate::u_angle_measured>(offsetof(VoltageSensorUpdate, u_angle_measured), "u_angle_measured"), }; }; @@ -149,12 +149,12 @@ struct get_attributes_list> { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute, &PowerSensorUpdate::id, offsetof(PowerSensorUpdate, id), []{ return "id"; }>::value, - meta_data_gen::get_meta_attribute, &PowerSensorUpdate::power_sigma, offsetof(PowerSensorUpdate, power_sigma), []{ return "power_sigma"; }>::value, - meta_data_gen::get_meta_attribute, &PowerSensorUpdate::p_measured, offsetof(PowerSensorUpdate, p_measured), []{ return "p_measured"; }>::value, - meta_data_gen::get_meta_attribute, &PowerSensorUpdate::q_measured, offsetof(PowerSensorUpdate, q_measured), []{ return "q_measured"; }>::value, - meta_data_gen::get_meta_attribute, &PowerSensorUpdate::p_sigma, offsetof(PowerSensorUpdate, p_sigma), []{ return "p_sigma"; }>::value, - meta_data_gen::get_meta_attribute, &PowerSensorUpdate::q_sigma, offsetof(PowerSensorUpdate, q_sigma), []{ return "q_sigma"; }>::value, + meta_data_gen::get_meta_attribute<&PowerSensorUpdate::id>(offsetof(PowerSensorUpdate, id), "id"), + meta_data_gen::get_meta_attribute<&PowerSensorUpdate::power_sigma>(offsetof(PowerSensorUpdate, power_sigma), "power_sigma"), + meta_data_gen::get_meta_attribute<&PowerSensorUpdate::p_measured>(offsetof(PowerSensorUpdate, p_measured), "p_measured"), + meta_data_gen::get_meta_attribute<&PowerSensorUpdate::q_measured>(offsetof(PowerSensorUpdate, q_measured), "q_measured"), + meta_data_gen::get_meta_attribute<&PowerSensorUpdate::p_sigma>(offsetof(PowerSensorUpdate, p_sigma), "p_sigma"), + meta_data_gen::get_meta_attribute<&PowerSensorUpdate::q_sigma>(offsetof(PowerSensorUpdate, q_sigma), "q_sigma"), }; }; @@ -163,13 +163,13 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&FaultUpdate::id>(offsetof(FaultUpdate, id), "id"), + meta_data_gen::get_meta_attribute<&FaultUpdate::status>(offsetof(FaultUpdate, status), "status"), + meta_data_gen::get_meta_attribute<&FaultUpdate::fault_type>(offsetof(FaultUpdate, fault_type), "fault_type"), + meta_data_gen::get_meta_attribute<&FaultUpdate::fault_phase>(offsetof(FaultUpdate, fault_phase), "fault_phase"), + meta_data_gen::get_meta_attribute<&FaultUpdate::fault_object>(offsetof(FaultUpdate, fault_object), "fault_object"), + meta_data_gen::get_meta_attribute<&FaultUpdate::r_f>(offsetof(FaultUpdate, r_f), "r_f"), + meta_data_gen::get_meta_attribute<&FaultUpdate::x_f>(offsetof(FaultUpdate, x_f), "x_f"), }; }; @@ -178,8 +178,8 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&RegulatorUpdate::id>(offsetof(RegulatorUpdate, id), "id"), + meta_data_gen::get_meta_attribute<&RegulatorUpdate::status>(offsetof(RegulatorUpdate, status), "status"), }; }; @@ -188,12 +188,12 @@ struct get_attributes_list { static constexpr std::array value{ // all attributes including base class - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&TransformerTapRegulatorUpdate::id>(offsetof(TransformerTapRegulatorUpdate, id), "id"), + meta_data_gen::get_meta_attribute<&TransformerTapRegulatorUpdate::status>(offsetof(TransformerTapRegulatorUpdate, status), "status"), + meta_data_gen::get_meta_attribute<&TransformerTapRegulatorUpdate::u_set>(offsetof(TransformerTapRegulatorUpdate, u_set), "u_set"), + meta_data_gen::get_meta_attribute<&TransformerTapRegulatorUpdate::u_band>(offsetof(TransformerTapRegulatorUpdate, u_band), "u_band"), + meta_data_gen::get_meta_attribute<&TransformerTapRegulatorUpdate::line_drop_compensation_r>(offsetof(TransformerTapRegulatorUpdate, line_drop_compensation_r), "line_drop_compensation_r"), + meta_data_gen::get_meta_attribute<&TransformerTapRegulatorUpdate::line_drop_compensation_x>(offsetof(TransformerTapRegulatorUpdate, line_drop_compensation_x), "line_drop_compensation_x"), }; }; diff --git a/tests/cpp_unit_tests/test_dataset.cpp b/tests/cpp_unit_tests/test_dataset.cpp index e5d855e8f..e0be018b4 100644 --- a/tests/cpp_unit_tests/test_dataset.cpp +++ b/tests/cpp_unit_tests/test_dataset.cpp @@ -58,50 +58,40 @@ struct BScOutput {}; template <> struct get_attributes_list { static constexpr std::array value{ - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&AInput::id>(offsetof(AInput, id), AInput::id_name), + meta_data_gen::get_meta_attribute<&AInput::a0>(offsetof(AInput, a0), AInput::a0_name), + meta_data_gen::get_meta_attribute<&AInput::a1>(offsetof(AInput, a1), AInput::a1_name), }; }; template <> struct get_attributes_list { static constexpr std::array value{ - meta_data_gen::get_meta_attribute::value, - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&AUpdate::id>(offsetof(AUpdate, id), AUpdate::id_name), + meta_data_gen::get_meta_attribute<&AUpdate::a0>(offsetof(AUpdate, a0), AUpdate::a0_name), }; }; template <> struct get_attributes_list> { static constexpr std::array value{ - meta_data_gen::get_meta_attribute, &AOutput::id, - offsetof(AOutput, id), [] { return AInput::id_name; }>::value, - meta_data_gen::get_meta_attribute, &AOutput::a2, - offsetof(AOutput, a2), - [] { return AOutput::a2_name; }>::value, - meta_data_gen::get_meta_attribute, &AOutput::a3, - offsetof(AOutput, a3), - [] { return AOutput::a3_name; }>::value, + meta_data_gen::get_meta_attribute<&AOutput::id>(offsetof(AOutput, id), + AOutput::id_name), + meta_data_gen::get_meta_attribute<&AOutput::a2>(offsetof(AOutput, a2), + AOutput::a2_name), + meta_data_gen::get_meta_attribute<&AOutput::a3>(offsetof(AOutput, a3), + AOutput::a3_name), }; }; template <> struct get_attributes_list> { static constexpr std::array value{ - meta_data_gen::get_meta_attribute, &AOutput::id, - offsetof(AOutput, id), [] { return AInput::id_name; }>::value, - meta_data_gen::get_meta_attribute, &AOutput::a2, - offsetof(AOutput, a2), - [] { return AOutput::a2_name; }>::value, - meta_data_gen::get_meta_attribute, &AOutput::a3, - offsetof(AOutput, a3), - [] { return AOutput::a3_name; }>::value, + meta_data_gen::get_meta_attribute<&AOutput::id>(offsetof(AOutput, id), + AOutput::id_name), + meta_data_gen::get_meta_attribute<&AOutput::a2>(offsetof(AOutput, a2), + AOutput::a2_name), + meta_data_gen::get_meta_attribute<&AOutput::a3>(offsetof(AOutput, a3), + AOutput::a3_name), }; }; template <> struct get_attributes_list { static constexpr std::array value{ - meta_data_gen::get_meta_attribute::value, + meta_data_gen::get_meta_attribute<&AScOutput::id>(offsetof(AScOutput, id), AScOutput::id_name), }; }; template <> struct get_attributes_list { From bc56a8e4bfcf027d9d42d6f54d118175383cf178 Mon Sep 17 00:00:00 2001 From: Tony Xiang Date: Thu, 15 Aug 2024 09:49:00 +0200 Subject: [PATCH 3/7] refactor component meta Signed-off-by: Tony Xiang --- .../power_grid_model/auxiliary/meta_gen/gen_getters.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/meta_gen/gen_getters.hpp b/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/meta_gen/gen_getters.hpp index 595e60d40..c482c4e8f 100644 --- a/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/meta_gen/gen_getters.hpp +++ b/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/meta_gen/gen_getters.hpp @@ -62,9 +62,9 @@ constexpr MetaAttribute get_meta_attribute(size_t offset, char const* attribute_ }; // getter for meta component -template struct get_meta_component { - static constexpr MetaComponent value{ - .name = component_name_getter(), +template constexpr MetaComponent get_meta_component(char const* component_name) { + return MetaComponent{ + .name = component_name, .size = sizeof(StructType), .alignment = alignof(StructType), .attributes = get_attributes_list::value, @@ -84,7 +84,7 @@ template class struct_getter, class. struct get_meta_dataset> { static constexpr size_t n_components = sizeof...(ComponentType); static constexpr std::array components{ - get_meta_component::type, [] { return ComponentType::name; }>::value...}; + get_meta_component::type>(ComponentType::name)...}; static constexpr MetaDataset value{ .name = dataset_name_getter(), .components = components, From 404c3e11eac8d0fbf77b7666f6db284675e85b4c Mon Sep 17 00:00:00 2001 From: Tony Xiang Date: Thu, 15 Aug 2024 10:00:11 +0200 Subject: [PATCH 4/7] not working yet Signed-off-by: Tony Xiang --- .../power_grid_model/auxiliary/dataset.hpp | 16 ++++++------ .../power_grid_model/auxiliary/meta_data.hpp | 25 +++++++++++-------- .../auxiliary/meta_data_gen.hpp | 13 ++++------ .../auxiliary/meta_gen/gen_getters.hpp | 19 ++++++-------- 4 files changed, 36 insertions(+), 37 deletions(-) diff --git a/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/dataset.hpp b/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/dataset.hpp index 6b2434aee..ef87d5671 100644 --- a/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/dataset.hpp +++ b/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/dataset.hpp @@ -304,8 +304,8 @@ template class Dataset { } // get buffer by component type - template