-/* Copyright (c) 2010-2019. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2010-2020. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
#define INSTR_PAJE_TYPES_HPP
#include "src/instr/instr_private.hpp"
+#include <memory>
#include <sstream>
#include <string>
#include <vector>
Type* father_;
public:
- std::map<std::string, Type*> children_;
+ std::map<std::string, std::unique_ptr<Type>> children_;
Container* issuer_ = nullptr;
std::stringstream stream_;
Type(const std::string& name, const std::string& alias, const std::string& color, Type* father);
- virtual ~Type();
+ virtual ~Type() = default;
const std::string& get_name() const { return name_; }
const char* get_cname() { return name_.c_str(); }
template <class T> T* by_name_or_create(const std::string& name)
{
auto cont = children_.find(name);
- return cont == children_.end() ? new T(name, this) : static_cast<T*>(cont->second);
+ return cont == children_.end() ? new T(name, this) : static_cast<T*>(cont->second.get());
}
void set_calling_container(Container* container) { issuer_ = container; }