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

0001 // ct_lvtmdb_functionobject.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_FUNCTIONOBJECT
0021 #define INCLUDED_CT_LVTMDB_FUNCTIONOBJECT
0022 
0023 #include <lvtmdb_export.h>
0024 
0025 #include <ct_lvtmdb_functionbase.h>
0026 
0027 #include <string>
0028 #include <vector>
0029 
0030 namespace Codethink::lvtmdb {
0031 
0032 // Forward Declarations
0033 class NamespaceObject;
0034 
0035 // =====================
0036 // class FunctionObject
0037 // =====================
0038 
0039 class LVTMDB_EXPORT FunctionObject : public FunctionBase {
0040     // See locking discipline in superclass. That applies here.
0041 
0042   private:
0043     // See lvtmdb::FunctionBase for qualified name etc
0044 
0045     NamespaceObject *d_parent_p;
0046     // Immediate parent namespace
0047 
0048     std::vector<FunctionObject *> d_callees;
0049     std::vector<FunctionObject *> d_callers;
0050 
0051   public:
0052     // CREATORS
0053     FunctionObject(std::string qualifiedName,
0054                    std::string name,
0055                    std::string signature,
0056                    std::string returnType,
0057                    std::string templateParameters,
0058                    NamespaceObject *parent);
0059 
0060     ~FunctionObject() noexcept override;
0061 
0062     FunctionObject(FunctionObject&& other) noexcept;
0063 
0064     FunctionObject& operator=(FunctionObject&& other) noexcept;
0065 
0066     // ACCESSORS
0067     [[nodiscard]] NamespaceObject *parent() const;
0068     [[nodiscard]] const std::vector<FunctionObject *>& callers() const;
0069     [[nodiscard]] const std::vector<FunctionObject *>& callees() const;
0070 
0071     // CLASS METHODS
0072     static void addDependency(FunctionObject *source, FunctionObject *target);
0073 };
0074 
0075 } // namespace Codethink::lvtmdb
0076 
0077 #endif // INCLUDED_CT_LVTMDB_FUNCTIONOBJECT