File indexing completed on 2024-05-19 05:42:15

0001 // ct_lvtqtc_alg_level_layout.h                                      -*-C++-*-
0002 
0003 /*
0004 // Copyright 2023 Codethink Ltd <codethink@codethink.co.uk>
0005 // SPDX-License-Identifier: Apache-2.0
0006 //
0007 // Licensed under the Apache License, Version 2.0 (the "License");
0008 // you may not use this file except in compliance with the License.
0009 // You may obtain a copy of the License at
0010 //
0011 //     http://www.apache.org/licenses/LICENSE-2.0
0012 //
0013 // Unless required by applicable law or agreed to in writing, software
0014 // distributed under the License is distributed on an "AS IS" BASIS,
0015 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0016 // See the License for the specific language governing permissions and
0017 // limitations under the License.
0018 */
0019 
0020 #ifndef INCLUDED_CT_LVTQTC_LEVEL_LAYOUT
0021 #define INCLUDED_CT_LVTQTC_LEVEL_LAYOUT
0022 
0023 #include <ct_lvtqtc_lakosentity.h>
0024 #include <unordered_map>
0025 
0026 namespace Codethink::lvtqtc {
0027 
0028 struct RunLevelizationLayoutConfig {
0029     LakosEntity::LevelizationLayoutType type;
0030     int direction;
0031 
0032     double spaceBetweenLevels = 40.;
0033     double spaceBetweenSublevels = 10.;
0034     double spaceBetweenEntities = 10.;
0035     int maxEntitiesPerLevel = 8;
0036 };
0037 
0038 std::unordered_map<LakosEntity *, int>
0039 computeLevelForEntities(std::vector<LakosEntity *> const& entities,
0040                         std::optional<const LakosEntity *> commonParentEntity = std::nullopt);
0041 
0042 void runLevelizationLayout(std::unordered_map<LakosEntity *, int> const& entityToLevel,
0043                            RunLevelizationLayoutConfig const& config);
0044 
0045 } // namespace Codethink::lvtqtc
0046 
0047 #endif