Skip to content

Commit 3d558ef

Browse files
committed
Unnecessary Shared Pointer Copies
1 parent 9b5d73c commit 3d558ef

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

include/dtlmod/Engine.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,16 @@ class Engine {
135135

136136
/// @brief Put a Variable in the DTL using a specific Engine.
137137
/// @param var The variable to put in the DTL
138-
void put(std::shared_ptr<Variable> var) const;
138+
void put(const std::shared_ptr<Variable>& var) const;
139139

140140
/// @brief Put a Variable in the DTL using a specific Engine.
141141
/// @param var The variable to put in the DTL
142142
/// @param simulated_size_in_bytes The simulated size of the Variable (can be different of actual size)
143-
void put(std::shared_ptr<Variable> var, size_t simulated_size_in_bytes) const;
143+
void put(const std::shared_ptr<Variable>& var, size_t simulated_size_in_bytes) const;
144144

145145
/// @brief Get a Variable from the DTL
146146
/// @param var The Variable to get in the DTL (Have to do an Inquire first).
147-
void get(std::shared_ptr<Variable> var) const;
147+
void get(const std::shared_ptr<Variable>& var) const;
148148

149149
/// @brief End a transaction on an Engine.
150150
void end_transaction();

src/Engine.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,18 @@ void Engine::begin_transaction()
3535
}
3636

3737
/// The actual data transport is delegated to the Transport method associated to the Engine.
38-
void Engine::put(std::shared_ptr<Variable> var) const
38+
void Engine::put(const std::shared_ptr<Variable>& var) const
3939
{
4040
transport_->put(var, var->get_local_size());
4141
}
4242

43-
void Engine::put(std::shared_ptr<Variable> var, size_t simulated_size_in_bytes) const
43+
void Engine::put(const std::shared_ptr<Variable>& var, size_t simulated_size_in_bytes) const
4444
{
4545
transport_->put(var, simulated_size_in_bytes);
4646
}
4747

4848
/// The actual data transport is delegated to the Transport method associated to the Engine.
49-
void Engine::get(std::shared_ptr<Variable> var) const
49+
void Engine::get(const std::shared_ptr<Variable>& var) const
5050
{
5151
transport_->get(var);
5252
}

src/bindings/python/dtlmod_python.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,9 @@ PYBIND11_MODULE(dtlmod, m)
170170
engine.def_property_readonly("name", &Engine::get_name, "The name of the Engine (read-only)")
171171
.def("begin_transaction", &Engine::begin_transaction, py::call_guard<py::gil_scoped_release>(),
172172
"Begin a transaction on this Engine")
173-
.def("put", py::overload_cast<std::shared_ptr<Variable>>(&Engine::put, py::const_), py::arg("var"),
173+
.def("put", py::overload_cast<const std::shared_ptr<Variable>&>(&Engine::put, py::const_), py::arg("var"),
174174
py::call_guard<py::gil_scoped_release>(), "Put a Variable in the DTL using this Engine")
175-
.def("put", py::overload_cast<std::shared_ptr<Variable>, size_t>(&Engine::put, py::const_), py::arg("var"),
175+
.def("put", py::overload_cast<const std::shared_ptr<Variable>&, size_t>(&Engine::put, py::const_), py::arg("var"),
176176
py::arg("simulated_size_in_bytes"), py::call_guard<py::gil_scoped_release>(),
177177
"Put a Variable in the DTL using this Engine")
178178
.def("get", &Engine::get, py::arg("var"), py::call_guard<py::gil_scoped_release>(),
@@ -182,7 +182,7 @@ PYBIND11_MODULE(dtlmod, m)
182182
.def_property_readonly("current_transaction", &Engine::get_current_transaction,
183183
"The id of the current transaction on this Engine (read-only)")
184184
.def_property_readonly("metadata_file_name", &Engine::get_metadata_file_name,
185-
"The name of the file in which the engine stored metadata (read-only)")
185+
"The name of the file in which the engine stored metadata (read-only)")
186186
.def("close", &Engine::close, py::call_guard<py::gil_scoped_release>(), "Close this Engine");
187187

188188
py::enum_<Engine::Type>(engine, "Type", "The type of Engine")

0 commit comments

Comments
 (0)