summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <daniel.goodliffe@pressassociation.com>2017-10-17 16:27:32 +0100
committerDan Goodliffe <daniel.goodliffe@pressassociation.com>2017-10-17 16:27:32 +0100
commitc1ea85842dd472cc57f451bbf7e1332501dd788f (patch)
tree79eb3e3560b28853a132517e3763f681f9aedf99
parentValueSource and Target should not pointlessly extend IceUtil::Shared (diff)
downloadslicer-c1ea85842dd472cc57f451bbf7e1332501dd788f.tar.bz2
slicer-c1ea85842dd472cc57f451bbf7e1332501dd788f.tar.xz
slicer-c1ea85842dd472cc57f451bbf7e1332501dd788f.zip
Remove unnecessary subclassing of ChildRef
-rw-r--r--slicer/slicer/modelParts.h37
-rw-r--r--slicer/slicer/modelPartsTypes.cpp2
-rw-r--r--slicer/slicer/modelPartsTypes.impl.h10
-rw-r--r--slicer/slicer/slicer.cpp25
4 files changed, 24 insertions, 50 deletions
diff --git a/slicer/slicer/modelParts.h b/slicer/slicer/modelParts.h
index ae1aa85..d65ec7c 100644
--- a/slicer/slicer/modelParts.h
+++ b/slicer/slicer/modelParts.h
@@ -107,11 +107,19 @@ namespace Slicer {
tcr_Value,
};
- class ChildRef : virtual public IceUtil::Shared {
+ class DLL_PUBLIC ChildRef : virtual public IceUtil::Shared {
public:
- virtual ModelPartPtr Child() const = 0;
- virtual const Metadata & ChildMetaData() const = 0;
+ ChildRef(ModelPartPtr);
+ ChildRef(ModelPartPtr, const Metadata &);
+
+ ModelPartPtr Child() const;
+ const Metadata & ChildMetaData() const;
+
+ private:
+ ModelPartPtr mpp;
+ const Metadata & mdr;
};
+
typedef IceUtil::Handle<ChildRef> ChildRefPtr;
class DLL_PUBLIC HookCommon : virtual public IceUtil::Shared {
@@ -127,29 +135,6 @@ namespace Slicer {
const std::string name;
};
- class DLL_PUBLIC ImplicitChildRef : public ChildRef {
- public:
- ImplicitChildRef(ModelPartPtr);
-
- ModelPartPtr Child() const;
- const Metadata & ChildMetaData() const;
-
- private:
- ModelPartPtr mpp;
- };
-
- class DLL_PUBLIC MemberChildRef : public ChildRef {
- public:
- MemberChildRef(ModelPartPtr, const Metadata &);
-
- ModelPartPtr Child() const;
- const Metadata & ChildMetaData() const;
-
- private:
- ModelPartPtr mpp;
- const Metadata & mdr;
- };
-
class DLL_PUBLIC ModelPart : virtual public IceUtil::Shared {
public:
virtual ~ModelPart() = default;
diff --git a/slicer/slicer/modelPartsTypes.cpp b/slicer/slicer/modelPartsTypes.cpp
index f2b6b67..1bf7939 100644
--- a/slicer/slicer/modelPartsTypes.cpp
+++ b/slicer/slicer/modelPartsTypes.cpp
@@ -38,7 +38,7 @@ namespace Slicer {
ModelPartForRootBase::GetAnonChildRef(const HookFilter &)
{
mp->Create();
- return new ImplicitChildRef(mp);
+ return new ChildRef(mp);
}
ChildRefPtr
diff --git a/slicer/slicer/modelPartsTypes.impl.h b/slicer/slicer/modelPartsTypes.impl.h
index 6a45618..fc8718e 100644
--- a/slicer/slicer/modelPartsTypes.impl.h
+++ b/slicer/slicer/modelPartsTypes.impl.h
@@ -339,7 +339,7 @@ namespace Slicer {
{
for (const auto & h : hooks) {
if (h->filter(flt)) {
- return new MemberChildRef(h->Get(GetModel()), h->GetMetadata());
+ return new ChildRef(h->Get(GetModel()), h->GetMetadata());
}
}
return NULL;
@@ -350,7 +350,7 @@ namespace Slicer {
{
for (const auto & h : hooks) {
if (h->filter(flt, name)) {
- return new MemberChildRef(h->Get(GetModel()), h->GetMetadata());
+ return new ChildRef(h->Get(GetModel()), h->GetMetadata());
}
}
return NULL;
@@ -583,7 +583,7 @@ namespace Slicer {
{
BOOST_ASSERT(this->Model);
this->Model->push_back(typename element_type::value_type());
- return new ImplicitChildRef(ModelPart::CreateFor(this->Model->back()));
+ return new ChildRef(ModelPart::CreateFor(this->Model->back()));
}
template<typename T>
@@ -638,7 +638,7 @@ namespace Slicer {
ChildRefPtr ModelPartForDictionary<T>::GetAnonChildRef(const HookFilter &)
{
BOOST_ASSERT(this->Model);
- return new ImplicitChildRef(new ModelPartForDictionaryElementInserter<T>(this->Model));
+ return new ChildRef(new ModelPartForDictionaryElementInserter<T>(this->Model));
}
template<typename T>
@@ -648,7 +648,7 @@ namespace Slicer {
if (name != pairName) {
throw IncorrectElementName(name);
}
- return new ImplicitChildRef(new ModelPartForDictionaryElementInserter<T>(this->Model));
+ return new ChildRef(new ModelPartForDictionaryElementInserter<T>(this->Model));
}
template<typename T>
diff --git a/slicer/slicer/slicer.cpp b/slicer/slicer/slicer.cpp
index ba4db3f..e55a8ab 100644
--- a/slicer/slicer/slicer.cpp
+++ b/slicer/slicer/slicer.cpp
@@ -3,39 +3,28 @@
#include <compileTimeFormatter.h>
namespace Slicer {
- Slicer::MemberChildRef::MemberChildRef(Slicer::ModelPartPtr mp, const Slicer::Metadata & md) :
+ Slicer::ChildRef::ChildRef(Slicer::ModelPartPtr mp, const Slicer::Metadata & md) :
mpp(mp),
mdr(md)
{
}
- ModelPartPtr
- Slicer::MemberChildRef::Child() const
- {
- return mpp;
- }
-
- const Metadata &
- Slicer::MemberChildRef::ChildMetaData() const
- {
- return mdr;
- }
-
- Slicer::ImplicitChildRef::ImplicitChildRef(ModelPartPtr m) :
- mpp(m)
+ Slicer::ChildRef::ChildRef(ModelPartPtr m) :
+ mpp(m),
+ mdr(emptyMetadata)
{
}
ModelPartPtr
- Slicer::ImplicitChildRef::Child() const
+ Slicer::ChildRef::Child() const
{
return mpp;
}
const Metadata &
- Slicer::ImplicitChildRef::ChildMetaData() const
+ Slicer::ChildRef::ChildMetaData() const
{
- return emptyMetadata;
+ return mdr;
}
AdHocFormatter(InvalidEnumerationSymbolMsg, "Invalid enumeration symbol [%?] for type [%?]");