File indexing completed on 2024-05-19 05:42:10
0001 // ct_lvtmdb_fieldobject.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_LVTMDB_FIELDOBJECT 0021 #define INCLUDED_CT_LVTMDB_FIELDOBJECT 0022 0023 #include <lvtmdb_export.h> 0024 0025 #include <ct_lvtmdb_databaseobject.h> 0026 #include <ct_lvtmdb_util.h> 0027 0028 #include <ct_lvtshr_graphenums.h> 0029 0030 #include <string> 0031 #include <vector> 0032 0033 namespace Codethink::lvtmdb { 0034 0035 // Forward Declarations 0036 class TypeObject; 0037 0038 // =================== 0039 // class FieldObject 0040 // =================== 0041 0042 class LVTMDB_EXPORT FieldObject : public DatabaseObject { 0043 // See locking discipline in superclass. That applies here. 0044 0045 private: 0046 std::string d_signature; 0047 // Type signature of this field 0048 0049 lvtshr::AccessSpecifier d_access; 0050 // Access mode of the field 0051 0052 bool d_isStatic; 0053 // True if the field is static 0054 0055 TypeObject *d_parent_p; 0056 // The UDT containing this field 0057 0058 std::vector<TypeObject *> d_variableTypes; 0059 // A list of classes which are used in this field's type and used in 0060 // any templates that might make up this field's type 0061 0062 public: 0063 // CREATORS 0064 FieldObject(std::string qualifiedName, 0065 std::string name, 0066 std::string signature, 0067 lvtshr::AccessSpecifier access, 0068 bool isStatic, 0069 TypeObject *parent); 0070 0071 ~FieldObject() noexcept override; 0072 0073 FieldObject(FieldObject&& other) noexcept; 0074 0075 FieldObject& operator=(FieldObject&& other) noexcept; 0076 0077 // ACCESSORS 0078 [[nodiscard]] const std::string& signature() const; 0079 0080 [[nodiscard]] lvtshr::AccessSpecifier access() const; 0081 0082 [[nodiscard]] bool isStatic() const; 0083 0084 [[nodiscard]] TypeObject *parent() const; 0085 0086 [[nodiscard]] const std::vector<TypeObject *>& variableTypes() const; 0087 0088 // MODIFIERS 0089 void addType(TypeObject *type); 0090 // an exclusive lock on this is required before calling this method 0091 }; 0092 0093 } // namespace Codethink::lvtmdb 0094 0095 #endif // INCLUDED_CT_LVTMDB_FIELDOBJECT