1 //===-- ModuleChild.h -------------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_CORE_MODULECHILD_H
10 #define LLDB_CORE_MODULECHILD_H
11 
12 #include "lldb/lldb-forward.h"
13 
14 namespace lldb_private {
15 
16 /// \class ModuleChild ModuleChild.h "lldb/Core/ModuleChild.h"
17 /// A mix in class that contains a pointer back to the module
18 ///        that owns the object which inherits from it.
19 class ModuleChild {
20 public:
21   /// Construct with owning module.
22   ///
23   /// \param[in] module_sp
24   ///     The module that owns the object that inherits from this
25   ///     class.
26   ModuleChild(const lldb::ModuleSP &module_sp);
27 
28   /// Destructor.
29   ~ModuleChild();
30 
31   /// Assignment operator.
32   ///
33   /// \param[in] rhs
34   ///     A const ModuleChild class reference to copy.
35   ///
36   /// \return
37   ///     A const reference to this object.
38   const ModuleChild &operator=(const ModuleChild &rhs);
39 
40   /// Get const accessor for the module pointer.
41   ///
42   /// \return
43   ///     A const pointer to the module that owns the object that
44   ///     inherits from this class.
45   lldb::ModuleSP GetModule() const;
46 
47   /// Set accessor for the module pointer.
48   ///
49   /// \param[in] module_sp
50   ///     A new module that owns the object that inherits from this
51   ///     class.
52   void SetModule(const lldb::ModuleSP &module_sp);
53 
54 protected:
55   /// The Module that owns the object that inherits from this class.
56   lldb::ModuleWP m_module_wp;
57 };
58 
59 } // namespace lldb_private
60 
61 #endif // LLDB_CORE_MODULECHILD_H
62