ModuleChild.h revision 3508c387c3f0c9ecc439d98048fd7694d41bab1b
1//===-- ModuleChild.h -------------------------------------------*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef liblldb_ModuleChild_h_
11#define liblldb_ModuleChild_h_
12
13#include "lldb/lldb-private.h"
14
15namespace lldb_private {
16
17//----------------------------------------------------------------------
18/// @class ModuleChild ModuleChild.h "lldb/Core/ModuleChild.h"
19/// @brief A mix in class that contains a pointer back to the module
20///        that owns the object which inherits from it.
21//----------------------------------------------------------------------
22class ModuleChild
23{
24public:
25    //------------------------------------------------------------------
26    /// Construct with owning module.
27    ///
28    /// @param[in] module
29    ///     The module that owns the object that inherits from this
30    ///     class.
31    //------------------------------------------------------------------
32    ModuleChild (const lldb::ModuleSP &module_sp);
33
34    //------------------------------------------------------------------
35    /// Copy constructor.
36    ///
37    /// @param[in] rhs
38    ///     A const ModuleChild class reference to copy.
39    //------------------------------------------------------------------
40    ModuleChild (const ModuleChild& rhs);
41
42    //------------------------------------------------------------------
43    /// Destructor.
44    ///
45    /// The destructor is virtual since this class is designed to be
46    /// inherited from.
47    //------------------------------------------------------------------
48    virtual
49    ~ModuleChild();
50
51    //------------------------------------------------------------------
52    /// Assignment operator.
53    ///
54    /// @param[in] rhs
55    ///     A const ModuleChild class reference to copy.
56    ///
57    /// @return
58    ///     A const reference to this object.
59    //------------------------------------------------------------------
60    const ModuleChild&
61    operator= (const ModuleChild& rhs);
62
63    //------------------------------------------------------------------
64    /// Get const accessor for the module pointer.
65    ///
66    /// @return
67    ///     A const pointer to the module that owns the object that
68    ///     inherits from this class.
69    //------------------------------------------------------------------
70    lldb::ModuleSP
71    GetModule () const;
72
73    //------------------------------------------------------------------
74    /// Set accessor for the module pointer.
75    ///
76    /// @param[in] module
77    ///     A new module that owns the object that inherits from this
78    ///      class.
79    //------------------------------------------------------------------
80    void
81    SetModule (const lldb::ModuleSP &module_sp);
82
83protected:
84    //------------------------------------------------------------------
85    // Member variables
86    //------------------------------------------------------------------
87    lldb::ModuleWP m_module_wp;   ///< The Module that owns the object that inherits
88                                  ///< from this class.
89};
90
91} // namespace lldb_private
92
93
94#endif  // liblldb_ModuleChild_h_
95