Skip to content
Snippets Groups Projects
Commit c2a6c16d authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

pass shared ptrs by reference

parent cebe84b6
No related branches found
No related tags found
No related merge requests found
...@@ -46,7 +46,7 @@ SampleBuilderNode& SampleBuilderNode::operator=(const SampleBuilderNode& other) ...@@ -46,7 +46,7 @@ SampleBuilderNode& SampleBuilderNode::operator=(const SampleBuilderNode& other)
//! Sets sample builder and borrows its parameters. //! Sets sample builder and borrows its parameters.
void SampleBuilderNode::setSBN(builder_t sample_builder) void SampleBuilderNode::setSBN(const builder_t& sample_builder)
{ {
if (!sample_builder) if (!sample_builder)
throw std::runtime_error("SampleContainer::setSampleBuilder() -> Error. " throw std::runtime_error("SampleContainer::setSampleBuilder() -> Error. "
......
...@@ -25,14 +25,15 @@ class ISampleBuilder; ...@@ -25,14 +25,15 @@ class ISampleBuilder;
class SampleBuilderNode : public INode class SampleBuilderNode : public INode
{ {
public:
using builder_t = std::shared_ptr<ISampleBuilder>; using builder_t = std::shared_ptr<ISampleBuilder>;
public:
SampleBuilderNode(); SampleBuilderNode();
SampleBuilderNode(const SampleBuilderNode& other); SampleBuilderNode(const SampleBuilderNode& other);
SampleBuilderNode& operator=(const SampleBuilderNode& other); SampleBuilderNode& operator=(const SampleBuilderNode& other);
void setSBN(builder_t sample_builder); void setSBN(const builder_t& sample_builder);
void reset(); void reset();
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
// ************************************************************************** // // ************************************************************************** //
#include "Core/SampleBuilderEngine/SampleProvider.h" #include "Core/SampleBuilderEngine/SampleProvider.h"
#include "Core/Basics/Assert.h"
#include "Core/Multilayer/MultiLayer.h" #include "Core/Multilayer/MultiLayer.h"
SampleProvider::SampleProvider() {} SampleProvider::SampleProvider() {}
...@@ -45,7 +44,7 @@ void SampleProvider::setSample(const MultiLayer& multilayer) ...@@ -45,7 +44,7 @@ void SampleProvider::setSample(const MultiLayer& multilayer)
m_sample_builder.reset(); m_sample_builder.reset();
} }
void SampleProvider::setBuilder(const std::shared_ptr<ISampleBuilder> sample_builder) void SampleProvider::setBuilder(const std::shared_ptr<ISampleBuilder>& sample_builder)
{ {
m_sample_builder.setSBN(sample_builder); m_sample_builder.setSBN(sample_builder);
m_sample_builder.setParent(parent()); m_sample_builder.setParent(parent());
......
...@@ -34,7 +34,7 @@ public: ...@@ -34,7 +34,7 @@ public:
void setSample(const MultiLayer& multilayer); void setSample(const MultiLayer& multilayer);
void setBuilder(const std::shared_ptr<ISampleBuilder> sample_builder); void setBuilder(const std::shared_ptr<ISampleBuilder>& sample_builder);
const MultiLayer* sample() const; const MultiLayer* sample() const;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment