File indexing completed on 2024-05-19 05:42:06
0001 // ct_lvtldr_igraphloader.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_LVTSHR_IGRAPHLOADER 0021 #define INCLUDED_CT_LVTSHR_IGRAPHLOADER 0022 0023 #include <lvtldr_export.h> 0024 0025 #include <ct_lvtshr_graphenums.h> 0026 #include <ct_lvtshr_graphstorage.h> 0027 #include <ct_lvtshr_loaderinfo.h> 0028 0029 #include <optional> 0030 #include <vector> 0031 0032 namespace Codethink::lvtqtc { 0033 class LakosEntity; 0034 class LakosRelation; 0035 } // namespace Codethink::lvtqtc 0036 0037 namespace Codethink::lvtldr { 0038 class LakosianNode; 0039 0040 struct NodeLoadFlags { 0041 /* Each visible node loaded has this member, controlling what the loader 0042 will try to load. The default load is just "load yourself", no childrens 0043 and no dependencies. When we want more data from the loader, we flip the bit, 0044 and request the loader to reload this. 0045 It's important to note that this is *only* about *graphical* representation, 0046 so we can't save this on the PhysicalNode *nor* on the NodeStorage. 0047 This should be used *only* on the GraphicsScene or Scene Items. 0048 */ 0049 0050 // For all kinds of packages and logical entities. 0051 bool loadChildren = false; 0052 0053 // for packages 0054 bool traverseProviders = false; 0055 bool traverseProvidersOnlyLocal = false; 0056 bool traverseClients = false; 0057 bool traverseClientsOnlyLocal = false; 0058 0059 // for logical entities 0060 bool loadIsARelationships = false; 0061 bool loadUsesInTheImplementationRelationships = false; 0062 bool loadUsesInTheInterfaceRelationships = false; 0063 }; 0064 0065 class LVTLDR_EXPORT IGraphLoader { 0066 // This class defines what we need to implement on classes that load graphs visually 0067 public: 0068 virtual ~IGraphLoader(); 0069 0070 virtual void clearGraph() = 0; 0071 // removes all nodes and edges from the current representation 0072 0073 virtual lvtqtc::LakosEntity *addUdtVertex(lvtldr::LakosianNode *node, 0074 bool selected = false, 0075 lvtqtc::LakosEntity *parent = nullptr, 0076 lvtshr::LoaderInfo info = {}) = 0; 0077 // Adds a Lakos Logical Entity to the graph 0078 // 0079 // Takes a UserDefinedType instance and adds a LogicalEntity 0080 // for it to the graph if not already present. Returns a 0081 // descriptor to the Vertex in the graph. 0082 0083 virtual lvtqtc::LakosEntity *addRepositoryVertex(lvtldr::LakosianNode *node, 0084 bool selected = false, 0085 lvtqtc::LakosEntity *parent = nullptr, 0086 lvtshr::LoaderInfo info = {}) = 0; 0087 0088 virtual lvtqtc::LakosEntity *addPkgVertex(lvtldr::LakosianNode *node, 0089 bool selected = false, 0090 lvtqtc::LakosEntity *parent = nullptr, 0091 lvtshr::LoaderInfo info = {}) = 0; 0092 // Adds a Lakos Package Entity to the graph 0093 // 0094 // Takes a SourcePackage instance and adds a PackageEntity 0095 // for it to the graph if not already present. Returns a 0096 // descriptor to the Vertex in the graph. 0097 0098 virtual lvtqtc::LakosEntity *addCompVertex(lvtldr::LakosianNode *node, 0099 bool selected = false, 0100 lvtqtc::LakosEntity *parent = nullptr, 0101 lvtshr::LoaderInfo info = {}) = 0; 0102 // Adds a Lakos Compnent Entity to the graph 0103 // 0104 // Takes a SourceComponent instance and adds a ComponentEntity 0105 // for it to the graph if not already present. Returns a 0106 // descriptor to the Vertex in the graph. 0107 0108 virtual lvtqtc::LakosRelation *addIsARelation(lvtqtc::LakosEntity *parentDescriptor, 0109 lvtqtc::LakosEntity *childDescriptor) = 0; 0110 // Adds a IsA Relation to the graph. 0111 // 0112 // If no Edge exists for the start and end vertices and 0113 // new Edge is created. An EdgeDescriptor to the Edge is 0114 // returned 0115 0116 virtual lvtqtc::LakosRelation *addUsesInTheInterfaceRelation(lvtqtc::LakosEntity *source, 0117 lvtqtc::LakosEntity *target) = 0; 0118 // Adds a UsesInTheInterfaceRelation to the graph. 0119 // 0120 // If no Edge exists for the start and end vertices and 0121 // new Edge is created. An EdgeDescriptor to the Edge is 0122 // returned 0123 0124 virtual lvtqtc::LakosRelation *addUsesInTheImplementationRelation(lvtqtc::LakosEntity *source, 0125 lvtqtc::LakosEntity *target) = 0; 0126 // Adds a UsesInTheImplementation relation to the graph. 0127 // 0128 // If no Edge exists for the start and end vertices and 0129 // new Edge is created. An EdgeDescriptor to the Edge is 0130 // returned 0131 0132 virtual lvtqtc::LakosRelation *addPackageDependencyRelation(lvtqtc::LakosEntity *source, 0133 lvtqtc::LakosEntity *target) = 0; 0134 // Adds a PackageDependency Relation to the graph. 0135 // 0136 // If no Edge exists for the start and end vertices and 0137 // new Edge is created. An EdgeDescriptor to the Edge is 0138 // returned 0139 0140 virtual NodeLoadFlags loadFlagsFor(LakosianNode *node) const = 0; 0141 }; 0142 0143 } // end namespace Codethink::lvtldr 0144 0145 #endif