summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--slicer/db/sqlSelectDeserializer.cpp2
-rw-r--r--slicer/slicer/modelParts.cpp9
-rw-r--r--slicer/slicer/modelParts.h6
-rw-r--r--slicer/slicer/modelPartsTypes.h11
4 files changed, 15 insertions, 13 deletions
diff --git a/slicer/db/sqlSelectDeserializer.cpp b/slicer/db/sqlSelectDeserializer.cpp
index 92c1552..b8e00b1 100644
--- a/slicer/db/sqlSelectDeserializer.cpp
+++ b/slicer/db/sqlSelectDeserializer.cpp
@@ -98,7 +98,7 @@ namespace Slicer {
const DB::Column & c = cmd[col];
if (!c.isNull()) {
auto fmpr = rmp->GetAnonChildRef([&c](Slicer::HookCommonPtr h) {
- return boost::iequals(c.name, h->PartName());
+ return boost::iequals(c.name, h->name);
});
if (fmpr) {
SqlSourcePtr h = new SqlSource(c);
diff --git a/slicer/slicer/modelParts.cpp b/slicer/slicer/modelParts.cpp
index 8dee564..2c1bd86 100644
--- a/slicer/slicer/modelParts.cpp
+++ b/slicer/slicer/modelParts.cpp
@@ -102,10 +102,15 @@ namespace Slicer {
return false;
}
+ HookCommon::HookCommon(const std::string & n) :
+ name(n)
+ {
+ }
+
bool
HookCommon::filter(const HookFilter & flt, const std::string & name)
{
- return (PartName() == name && (!flt || flt(this)));
+ return (this->name == name && (!flt || flt(this)));
}
bool
@@ -117,7 +122,7 @@ namespace Slicer {
void
HookCommon::apply(const ChildHandler & ch, const ModelPartPtr & modelPart)
{
- ch(PartName(), modelPart && modelPart->HasValue() ? modelPart : ModelPartPtr(), this);
+ ch(this->name, modelPart && modelPart->HasValue() ? modelPart : ModelPartPtr(), this);
}
}
diff --git a/slicer/slicer/modelParts.h b/slicer/slicer/modelParts.h
index 4d4e100..8fce1e3 100644
--- a/slicer/slicer/modelParts.h
+++ b/slicer/slicer/modelParts.h
@@ -112,13 +112,15 @@ namespace Slicer {
class DLL_PUBLIC HookCommon : public IceUtil::Shared {
public:
+ HookCommon(const std::string &);
+
bool filter(const HookFilter & flt);
bool filter(const HookFilter & flt, const std::string &);
void apply(const ChildHandler & ch, const ModelPartPtr & modelPart);
- virtual std::string PartName() const = 0;
-
virtual const Metadata & GetMetadata() const = 0;
+
+ const std::string name;
};
class DLL_PUBLIC ImplicitChildRef : public ChildRef {
diff --git a/slicer/slicer/modelPartsTypes.h b/slicer/slicer/modelPartsTypes.h
index ca381af..a4014ee 100644
--- a/slicer/slicer/modelPartsTypes.h
+++ b/slicer/slicer/modelPartsTypes.h
@@ -107,6 +107,7 @@ namespace Slicer {
public:
class DLL_PRIVATE HookBase : public HookCommon {
public:
+ HookBase(const std::string & n) : HookCommon(n) { }
virtual ModelPartPtr Get(T * t) const = 0;
virtual const Metadata & GetMetadata() const override { return emptyMetadata; }
};
@@ -116,8 +117,8 @@ namespace Slicer {
class DLL_PRIVATE Hook : public HookBase {
public:
Hook(MT T::* m, const std::string & n) :
- member(m),
- name(n)
+ HookBase(n),
+ member(m)
{
}
@@ -126,14 +127,8 @@ namespace Slicer {
return t ? new MP(const_cast<typename std::remove_const<MT>::type &>(t->*member)) : NULL;
}
- std::string PartName() const override
- {
- return name;
- }
-
private:
const MT T::* member;
- const std::string name;
};
template <typename MT, typename MP>