A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[sonar] Remove custom destructors for surf/PropertyHolder.
[simgrid.git]
/
src
/
surf
/
PropertyHolder.cpp
diff --git
a/src/surf/PropertyHolder.cpp
b/src/surf/PropertyHolder.cpp
index
39be42b
..
a5bd802
100644
(file)
--- a/
src/surf/PropertyHolder.cpp
+++ b/
src/surf/PropertyHolder.cpp
@@
-8,14
+8,10
@@
namespace simgrid {
namespace surf {
namespace simgrid {
namespace surf {
-PropertyHolder::~PropertyHolder() {
- delete properties_;
-}
-
/** @brief Return the property associated to the provided key (or nullptr if not existing) */
/** @brief Return the property associated to the provided key (or nullptr if not existing) */
-const char* PropertyHolder::get_property(const std::string& key)
+const char* PropertyHolder::get_property(const std::string& key)
const
{
{
- if (
properties_ == nullptr
)
+ if (
not properties_
)
return nullptr;
auto prop = properties_->find(key);
return prop == properties_->end() ? nullptr : prop->second.c_str();
return nullptr;
auto prop = properties_->find(key);
return prop == properties_->end() ? nullptr : prop->second.c_str();
@@
-25,7
+21,7
@@
const char* PropertyHolder::get_property(const std::string& key)
void PropertyHolder::set_property(const std::string& key, const std::string& value)
{
if (not properties_)
void PropertyHolder::set_property(const std::string& key, const std::string& value)
{
if (not properties_)
- properties_
= new std::unordered_map<std::string, std::string>
;
+ properties_
.reset(new std::unordered_map<std::string, std::string>)
;
(*properties_)[key] = value;
}
(*properties_)[key] = value;
}
@@
-33,8
+29,8
@@
void PropertyHolder::set_property(const std::string& key, const std::string& val
std::unordered_map<std::string, std::string>* PropertyHolder::get_properties()
{
if (not properties_)
std::unordered_map<std::string, std::string>* PropertyHolder::get_properties()
{
if (not properties_)
- properties_
= new std::unordered_map<std::string, std::string>
;
- return properties_;
+ properties_
.reset(new std::unordered_map<std::string, std::string>)
;
+ return properties_
.get()
;
}
} /* namespace surf */
}
} /* namespace surf */