File indexing completed on 2024-05-19 05:42:29
0001 // ct_lvtgshr_loaderinfo.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 //@PURPOSE: Store information about what the loader did and did not load for 0021 // a particular vertex 0022 // 0023 //@CLASSES: 0024 // lvtshr::LoaderInfo 0025 // 0026 //@SEE_ALSO: lvtldr::PhysicalLoader 0027 0028 #ifndef INCLUDED_CT_LVTSHR_LOADERINFO 0029 #define INCLUDED_CT_LVTSHR_LOADERINFO 0030 0031 #include <lvtshr_export.h> 0032 0033 #include <optional> 0034 0035 namespace Codethink::lvtshr { 0036 0037 class LVTSHR_EXPORT LoaderInfo { 0038 private: 0039 // PRIVATE DATA 0040 bool d_valid = false; 0041 0042 bool d_hasAllChildren = false; 0043 bool d_hasParent = false; 0044 bool d_hasAllEdges = false; 0045 0046 public: 0047 // CREATORS 0048 LoaderInfo(); 0049 // Default constructor for d_valid = false 0050 0051 LoaderInfo(bool hasAllChildren, bool hasParent, bool hasAllEdges); 0052 // Constructor for valid = true 0053 0054 // ACCESSORS 0055 [[nodiscard]] bool isValid() const; 0056 // returns whether we have information for this vertex. If this returns 0057 // true then it is safe to assume all accessors returning std::optional 0058 // can be dereferenced, otherwise none of them can be dereferenced 0059 0060 [[nodiscard]] std::optional<bool> hasAllChildren() const; 0061 // If isValid(), returns if this vertex already has all of its children 0062 0063 [[nodiscard]] std::optional<bool> hasParent() const; 0064 // If isValid(), returns if this vertex already has its direct parent 0065 // loaded 0066 0067 [[nodiscard]] std::optional<bool> hasAllEdges() const; 0068 // If isValid(), returns if this vertex already has all of its edges 0069 // loaded 0070 0071 // MODIFIERS 0072 void setHasParent(bool hasParent); 0073 }; 0074 0075 } // end namespace Codethink::lvtshr 0076 0077 #endif // INCLUDED_CT_LVTSHR_LOADERINFO