summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-08-05 14:02:39 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2023-08-05 14:02:39 +0100
commitb7b55963d23b661b69b1a2d9e40d51c1f809391f (patch)
tree4926bc42a667b34dce4a9f364aaeb72ac7474bbb
parentRefactor XmlDeserializer::DocumentTreeIterateElement with no pointer copy (diff)
downloadslicer-b7b55963d23b661b69b1a2d9e40d51c1f809391f.tar.bz2
slicer-b7b55963d23b661b69b1a2d9e40d51c1f809391f.tar.xz
slicer-b7b55963d23b661b69b1a2d9e40d51c1f809391f.zip
Constref correctness for shared_ptr parameters
-rw-r--r--slicer/json/serializer.cpp4
-rw-r--r--slicer/json/serializer.h4
-rw-r--r--slicer/slicer/modelPartsTypes.cpp3
-rw-r--r--slicer/slicer/modelPartsTypes.h2
-rw-r--r--slicer/slicer/slicer.cpp2
-rw-r--r--slicer/xml/serializer.cpp5
-rw-r--r--slicer/xml/serializer.h6
7 files changed, 13 insertions, 13 deletions
diff --git a/slicer/json/serializer.cpp b/slicer/json/serializer.cpp
index 728d174..d20efeb 100644
--- a/slicer/json/serializer.cpp
+++ b/slicer/json/serializer.cpp
@@ -249,7 +249,7 @@ namespace Slicer {
}
void
- JsonSerializer::ModelTreeIterate(json::Value * n, const std::string & name, ModelPartPtr mp)
+ JsonSerializer::ModelTreeIterate(json::Value * n, const std::string & name, const ModelPartPtr & mp)
{
if (name.empty() || !n || !mp) {
return;
@@ -314,7 +314,7 @@ namespace Slicer {
}
void
- JsonSerializer::ModelTreeIterateRoot(json::Value * n, ModelPartPtr mp)
+ JsonSerializer::ModelTreeIterateRoot(json::Value * n, const ModelPartPtr & mp)
{
if (mp) {
switch (mp->GetType()) {
diff --git a/slicer/json/serializer.h b/slicer/json/serializer.h
index e2687ce..3d92053 100644
--- a/slicer/json/serializer.h
+++ b/slicer/json/serializer.h
@@ -13,10 +13,10 @@
namespace Slicer {
class JsonSerializer : public Serializer {
protected:
- static void ModelTreeIterate(json::Value *, const std::string &, ModelPartPtr mp);
+ static void ModelTreeIterate(json::Value *, const std::string &, const ModelPartPtr & mp);
static void ModelTreeIterateDictObj(json::Value *, const ModelPartPtr & mp);
static void ModelTreeIterateSeq(json::Value *, const ModelPartPtr & mp);
- static void ModelTreeIterateRoot(json::Value *, ModelPartPtr mp);
+ static void ModelTreeIterateRoot(json::Value *, const ModelPartPtr & mp);
};
class DLL_PUBLIC JsonValueSerializer : public JsonSerializer {
diff --git a/slicer/slicer/modelPartsTypes.cpp b/slicer/slicer/modelPartsTypes.cpp
index aabbf57..cd22c05 100644
--- a/slicer/slicer/modelPartsTypes.cpp
+++ b/slicer/slicer/modelPartsTypes.cpp
@@ -443,9 +443,6 @@ namespace Slicer {
return true;
}
- // Stream Roots
- ModelPartForStreamRootBase::ModelPartForStreamRootBase(const ModelPartPtr & m) : ModelPartForRootBase(m) { }
-
// NOLINTNEXTLINE(hicpp-no-array-decay)
void
ModelPartForStreamRootBase::Write(Ice::OutputStream &) const
diff --git a/slicer/slicer/modelPartsTypes.h b/slicer/slicer/modelPartsTypes.h
index 7e84794..b6e7b3c 100644
--- a/slicer/slicer/modelPartsTypes.h
+++ b/slicer/slicer/modelPartsTypes.h
@@ -354,7 +354,7 @@ namespace Slicer {
class DLL_PUBLIC ModelPartForStreamRootBase : public ModelPartForRootBase {
public:
- explicit ModelPartForStreamRootBase(const ModelPartPtr & mp);
+ using ModelPartForRootBase::ModelPartForRootBase;
void Write(Ice::OutputStream &) const override;
void Read(Ice::InputStream &) override;
diff --git a/slicer/slicer/slicer.cpp b/slicer/slicer/slicer.cpp
index 6f890c3..2eda740 100644
--- a/slicer/slicer/slicer.cpp
+++ b/slicer/slicer/slicer.cpp
@@ -9,7 +9,7 @@ namespace Slicer {
Slicer::ChildRef::ChildRef(ModelPartPtr m) : mpp(std::move(m)), mdr(emptyMetadata) { }
- Slicer::ChildRef::ChildRef(Slicer::ModelPartPtr mp, const Slicer::Metadata & md) : mpp(std::move(mp)), mdr(md) { }
+ Slicer::ChildRef::ChildRef(ModelPartPtr mp, const Slicer::Metadata & md) : mpp(std::move(mp)), mdr(md) { }
ModelPartPtr
Slicer::ChildRef::Child() const
diff --git a/slicer/xml/serializer.cpp b/slicer/xml/serializer.cpp
index 609eac2..27bf10b 100644
--- a/slicer/xml/serializer.cpp
+++ b/slicer/xml/serializer.cpp
@@ -253,7 +253,8 @@ namespace Slicer {
}
void
- XmlDeserializer::DocumentTreeIterateElement(const xmlpp::Element * element, ModelPartPtr smp, const ChildRef & smpr)
+ XmlDeserializer::DocumentTreeIterateElement(
+ const xmlpp::Element * element, const ModelPartPtr & smp, const ChildRef & smpr)
{
auto oec = [&smpr, element](const auto & lmp) {
lmp->Create();
@@ -405,7 +406,7 @@ namespace Slicer {
void
XmlSerializer::ModelTreeProcessElement(
- const CurrentElementCreator & cec, ModelPartPtr mp, const ElementCreator & ec)
+ const CurrentElementCreator & cec, const ModelPartPtr & mp, const ElementCreator & ec)
{
if (mp->GetType() == ModelPartType::Simple) {
mp->GetValue(XmlContentValueTarget(cec));
diff --git a/slicer/xml/serializer.h b/slicer/xml/serializer.h
index 23a6140..9b8fa21 100644
--- a/slicer/xml/serializer.h
+++ b/slicer/xml/serializer.h
@@ -35,7 +35,8 @@ namespace Slicer {
static void ModelTreeIterateRoot(xmlpp::Document *, const std::string &, const ModelPartPtr & mp);
protected:
- static void ModelTreeProcessElement(const CurrentElementCreator &, ModelPartPtr mp, const ElementCreator &);
+ static void ModelTreeProcessElement(
+ const CurrentElementCreator &, const ModelPartPtr & mp, const ElementCreator &);
static void ModelTreeIterateDictAttrs(xmlpp::Element * element, const ModelPartPtr & dict);
static void ModelTreeIterateDictElements(xmlpp::Element * element, const ModelPartPtr & dict);
};
@@ -69,7 +70,8 @@ namespace Slicer {
class DLL_PUBLIC XmlDeserializer : public Deserializer {
protected:
static void DocumentTreeIterate(const xmlpp::Node * node, const ModelPartPtr & mp);
- static void DocumentTreeIterateElement(const xmlpp::Element * element, ModelPartPtr mp, const ChildRef & c);
+ static void DocumentTreeIterateElement(
+ const xmlpp::Element * element, const ModelPartPtr & mp, const ChildRef & c);
static void DocumentTreeIterate(const xmlpp::Document * doc, const ModelPartPtr & mp);
static void DocumentTreeIterateDictAttrs(
const xmlpp::Element::const_AttributeList & attrs, const ModelPartPtr & dict);