use smart pointer when creating an object with an instance of the creator
This commit is contained in:
parent
a0060c8fa8
commit
f1ee437f04
6 changed files with 12 additions and 10 deletions
|
@ -15,9 +15,9 @@ class GnsServer;
|
|||
/**
|
||||
* Represent a GNS3 project.
|
||||
*/
|
||||
class GnsProject {
|
||||
class GnsProject : std::enable_shared_from_this<GnsProject> {
|
||||
public:
|
||||
GnsProject(const GnsServer* server, const std::string& uuid);
|
||||
GnsProject(const std::shared_ptr<const GnsServer>& server, const std::string& uuid);
|
||||
|
||||
/**
|
||||
* Get the base prefix for an API request
|
||||
|
@ -38,7 +38,7 @@ public:
|
|||
[[nodiscard]] std::vector<std::shared_ptr<GnsNode>> getNodes() const;
|
||||
|
||||
private:
|
||||
const GnsServer* server;
|
||||
std::shared_ptr<const GnsServer> server;
|
||||
std::string uuid;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue