summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--slicer/db/sqlInsertSerializer.cpp2
-rw-r--r--slicer/db/sqlInsertSerializer.h2
-rw-r--r--slicer/db/sqlSelectDeserializer.cpp2
-rw-r--r--slicer/db/sqlSelectDeserializer.h2
-rw-r--r--slicer/db/sqlUpdateSerializer.cpp2
-rw-r--r--slicer/db/sqlUpdateSerializer.h2
-rw-r--r--slicer/json/serializer.cpp12
-rw-r--r--slicer/json/serializer.h12
-rw-r--r--slicer/slicer/modelParts.h12
-rw-r--r--slicer/slicer/modelPartsTypes.h1
-rw-r--r--slicer/slicer/modelPartsTypes.impl.h4
-rw-r--r--slicer/slicer/serializer.h4
-rw-r--r--slicer/xml/serializer.cpp12
-rw-r--r--slicer/xml/serializer.h12
14 files changed, 44 insertions, 37 deletions
diff --git a/slicer/db/sqlInsertSerializer.cpp b/slicer/db/sqlInsertSerializer.cpp
index f5c4c4f..6c4cf31 100644
--- a/slicer/db/sqlInsertSerializer.cpp
+++ b/slicer/db/sqlInsertSerializer.cpp
@@ -17,7 +17,7 @@ namespace Slicer {
}
void
- SqlInsertSerializer::Serialize(Slicer::ModelPartPtr mp)
+ SqlInsertSerializer::Serialize(Slicer::ModelPartForRootPtr mp)
{
switch (mp->GetType()) {
case Slicer::mpt_Sequence:
diff --git a/slicer/db/sqlInsertSerializer.h b/slicer/db/sqlInsertSerializer.h
index fe11c36..c4aa29f 100644
--- a/slicer/db/sqlInsertSerializer.h
+++ b/slicer/db/sqlInsertSerializer.h
@@ -13,7 +13,7 @@ namespace Slicer {
SqlInsertSerializer(DB::Connection * const, const std::string & tableName);
- virtual void Serialize(Slicer::ModelPartPtr) override;
+ virtual void Serialize(Slicer::ModelPartForRootPtr) override;
protected:
void SerializeObject(Slicer::ModelPartPtr) const;
diff --git a/slicer/db/sqlSelectDeserializer.cpp b/slicer/db/sqlSelectDeserializer.cpp
index 5e32f75..92c1552 100644
--- a/slicer/db/sqlSelectDeserializer.cpp
+++ b/slicer/db/sqlSelectDeserializer.cpp
@@ -12,7 +12,7 @@ namespace Slicer {
}
void
- SqlSelectDeserializer::Deserialize(Slicer::ModelPartPtr mp)
+ SqlSelectDeserializer::Deserialize(Slicer::ModelPartForRootPtr mp)
{
cmd.execute();
columnCount = cmd.columnCount();
diff --git a/slicer/db/sqlSelectDeserializer.h b/slicer/db/sqlSelectDeserializer.h
index c520090..782283e 100644
--- a/slicer/db/sqlSelectDeserializer.h
+++ b/slicer/db/sqlSelectDeserializer.h
@@ -10,7 +10,7 @@ namespace Slicer {
public:
SqlSelectDeserializer(DB::SelectCommand &, IceUtil::Optional<std::string> typeIdCol = IceUtil::Optional<std::string>());
- virtual void Deserialize(Slicer::ModelPartPtr) override;
+ virtual void Deserialize(Slicer::ModelPartForRootPtr) override;
protected:
void DLL_PRIVATE DeserializeSimple(Slicer::ModelPartPtr);
diff --git a/slicer/db/sqlUpdateSerializer.cpp b/slicer/db/sqlUpdateSerializer.cpp
index 867b9fb..a2a1fc2 100644
--- a/slicer/db/sqlUpdateSerializer.cpp
+++ b/slicer/db/sqlUpdateSerializer.cpp
@@ -16,7 +16,7 @@ namespace Slicer {
}
void
- SqlUpdateSerializer::Serialize(Slicer::ModelPartPtr mp)
+ SqlUpdateSerializer::Serialize(Slicer::ModelPartForRootPtr mp)
{
switch (mp->GetType()) {
case Slicer::mpt_Sequence:
diff --git a/slicer/db/sqlUpdateSerializer.h b/slicer/db/sqlUpdateSerializer.h
index 83a5e04..c31a192 100644
--- a/slicer/db/sqlUpdateSerializer.h
+++ b/slicer/db/sqlUpdateSerializer.h
@@ -12,7 +12,7 @@ namespace Slicer {
SqlUpdateSerializer(DB::Connection * const, const std::string & tableName);
- virtual void Serialize(Slicer::ModelPartPtr) override;
+ virtual void Serialize(Slicer::ModelPartForRootPtr) override;
protected:
void SerializeObject(Slicer::ModelPartPtr) const;
diff --git a/slicer/json/serializer.cpp b/slicer/json/serializer.cpp
index e6ddf81..8101a9b 100644
--- a/slicer/json/serializer.cpp
+++ b/slicer/json/serializer.cpp
@@ -304,7 +304,7 @@ namespace Slicer {
}
void
- JsonStreamDeserializer::Deserialize(ModelPartPtr modelRoot)
+ JsonStreamDeserializer::Deserialize(ModelPartForRootPtr modelRoot)
{
json::Value obj = json::parseValue(strm);
auto mp = modelRoot->GetAnonChild();
@@ -312,7 +312,7 @@ namespace Slicer {
}
void
- JsonStreamSerializer::Serialize(ModelPartPtr modelRoot)
+ JsonStreamSerializer::Serialize(ModelPartForRootPtr modelRoot)
{
json::Value doc;
modelRoot->OnEachChild(boost::bind(&JsonSerializer::ModelTreeIterateRoot, &doc, _2));
@@ -330,7 +330,7 @@ namespace Slicer {
}
void
- JsonFileDeserializer::Deserialize(ModelPartPtr modelRoot)
+ JsonFileDeserializer::Deserialize(ModelPartForRootPtr modelRoot)
{
std::ifstream inFile(path.string());
json::Value obj = json::parseValue(inFile);
@@ -339,7 +339,7 @@ namespace Slicer {
}
void
- JsonFileSerializer::Serialize(ModelPartPtr modelRoot)
+ JsonFileSerializer::Serialize(ModelPartForRootPtr modelRoot)
{
json::Value doc;
modelRoot->OnEachChild(boost::bind(&JsonSerializer::ModelTreeIterateRoot, &doc, _2));
@@ -358,14 +358,14 @@ namespace Slicer {
}
void
- JsonValueDeserializer::Deserialize(ModelPartPtr modelRoot)
+ JsonValueDeserializer::Deserialize(ModelPartForRootPtr modelRoot)
{
auto mp = modelRoot->GetAnonChild();
boost::apply_visitor(DocumentTreeIterate(mp), value);
}
void
- JsonValueSerializer::Serialize(ModelPartPtr modelRoot)
+ JsonValueSerializer::Serialize(ModelPartForRootPtr modelRoot)
{
modelRoot->OnEachChild(boost::bind(&JsonSerializer::ModelTreeIterateRoot, &value, _2));
}
diff --git a/slicer/json/serializer.h b/slicer/json/serializer.h
index cb83d16..c096dca 100644
--- a/slicer/json/serializer.h
+++ b/slicer/json/serializer.h
@@ -18,7 +18,7 @@ namespace Slicer {
public:
JsonStreamSerializer(std::ostream &);
- virtual void Serialize(ModelPartPtr) override;
+ virtual void Serialize(ModelPartForRootPtr) override;
protected:
std::ostream & strm;
@@ -28,7 +28,7 @@ namespace Slicer {
public:
JsonFileSerializer(const boost::filesystem::path &);
- virtual void Serialize(ModelPartPtr) override;
+ virtual void Serialize(ModelPartForRootPtr) override;
protected:
const boost::filesystem::path path;
@@ -38,7 +38,7 @@ namespace Slicer {
public:
JsonValueSerializer(json::Value &);
- virtual void Serialize(ModelPartPtr) override;
+ virtual void Serialize(ModelPartForRootPtr) override;
protected:
json::Value & value;
@@ -48,7 +48,7 @@ namespace Slicer {
public:
JsonStreamDeserializer(std::istream &);
- virtual void Deserialize(ModelPartPtr) override;
+ virtual void Deserialize(ModelPartForRootPtr) override;
protected:
std::istream & strm;
@@ -58,7 +58,7 @@ namespace Slicer {
public:
JsonFileDeserializer(const boost::filesystem::path &);
- virtual void Deserialize(ModelPartPtr) override;
+ virtual void Deserialize(ModelPartForRootPtr) override;
protected:
const boost::filesystem::path path;
@@ -68,7 +68,7 @@ namespace Slicer {
public:
JsonValueDeserializer(const json::Value &);
- virtual void Deserialize(ModelPartPtr) override;
+ virtual void Deserialize(ModelPartForRootPtr) override;
protected:
const json::Value & value;
diff --git a/slicer/slicer/modelParts.h b/slicer/slicer/modelParts.h
index d3e56db..733e441 100644
--- a/slicer/slicer/modelParts.h
+++ b/slicer/slicer/modelParts.h
@@ -75,9 +75,11 @@ namespace Slicer {
typedef IceUtil::Handle<ValueSource> ValueSourcePtr;
class ModelPart;
+ class ModelPartForRootBase;
class HookCommon;
typedef IceUtil::Handle<ModelPart> ModelPartPtr;
+ typedef IceUtil::Handle<ModelPartForRootBase> ModelPartForRootPtr;
typedef IceUtil::Handle<HookCommon> HookCommonPtr;
typedef IceUtil::Optional<std::string> TypeId;
@@ -144,7 +146,7 @@ namespace Slicer {
template<typename T>
static ModelPartPtr CreateFor(T & t);
template<typename T>
- static ModelPartPtr CreateRootFor(T & t);
+ static ModelPartForRootPtr CreateRootFor(T & t);
virtual void OnEachChild(const ChildHandler &) = 0;
ModelPartPtr GetAnonChild(const HookFilter & = HookFilter());
@@ -171,14 +173,18 @@ namespace Slicer {
class DLL_PUBLIC ModelPartModel {
protected:
ModelPartModel(T & m) : Model(m) { }
- T & Model;
+ T & Model;
};
template<typename T> inline ModelPartPtr ModelPartFor(T & t) __attribute__ ((deprecated));
template<typename T> inline ModelPartPtr ModelPartFor(T & t) { return ModelPart::CreateFor(t); }
+ class DLL_PUBLIC ModelPartForRootBase : public ModelPart {
+ public:
+ };
+
template<typename T>
- class ModelPartForRoot : public ModelPart {
+ class ModelPartForRoot : public ModelPartForRootBase {
public:
ModelPartForRoot(T & o);
diff --git a/slicer/slicer/modelPartsTypes.h b/slicer/slicer/modelPartsTypes.h
index d5e687d..ac6ed73 100644
--- a/slicer/slicer/modelPartsTypes.h
+++ b/slicer/slicer/modelPartsTypes.h
@@ -268,3 +268,4 @@ namespace Slicer {
#endif
+
diff --git a/slicer/slicer/modelPartsTypes.impl.h b/slicer/slicer/modelPartsTypes.impl.h
index a7b43bd..071efcf 100644
--- a/slicer/slicer/modelPartsTypes.impl.h
+++ b/slicer/slicer/modelPartsTypes.impl.h
@@ -8,8 +8,8 @@
template class ModelPartType<Type>; \
template<> ModelPartPtr ModelPart::CreateFor(Type & s) { return new ModelPartType<Type>(s); } \
template<> ModelPartPtr ModelPart::CreateFor(IceUtil::Optional<Type> & s) { return new ModelPartForOptional<ModelPartType<Type> >(s); } \
- template<> ModelPartPtr ModelPart::CreateRootFor(Type & s) { return new ModelPartForRoot<Type>(s); } \
- template<> ModelPartPtr ModelPart::CreateRootFor(IceUtil::Optional<Type> & s) { return new ModelPartForRoot<IceUtil::Optional<Type> >(s); } \
+ template<> ModelPartForRootPtr ModelPart::CreateRootFor(Type & s) { return new ModelPartForRoot<Type>(s); } \
+ template<> ModelPartForRootPtr ModelPart::CreateRootFor(IceUtil::Optional<Type> & s) { return new ModelPartForRoot<IceUtil::Optional<Type> >(s); } \
namespace Slicer {
// ModelPartForRoot
diff --git a/slicer/slicer/serializer.h b/slicer/slicer/serializer.h
index 44cce01..fbe0bbf 100644
--- a/slicer/slicer/serializer.h
+++ b/slicer/slicer/serializer.h
@@ -11,13 +11,13 @@
namespace Slicer {
class DLL_PUBLIC Serializer : public IceUtil::Shared {
public:
- virtual void Serialize(ModelPartPtr) = 0;
+ virtual void Serialize(ModelPartForRootPtr) = 0;
};
typedef IceUtil::Handle<Serializer> SerializerPtr;
class DLL_PUBLIC Deserializer : public IceUtil::Shared {
public:
- virtual void Deserialize(ModelPartPtr) = 0;
+ virtual void Deserialize(ModelPartForRootPtr) = 0;
};
typedef IceUtil::Handle<Deserializer> DeserializerPtr;
diff --git a/slicer/xml/serializer.cpp b/slicer/xml/serializer.cpp
index 9df87b8..f83151e 100644
--- a/slicer/xml/serializer.cpp
+++ b/slicer/xml/serializer.cpp
@@ -290,7 +290,7 @@ namespace Slicer {
}
void
- XmlStreamDeserializer::Deserialize(ModelPartPtr modelRoot)
+ XmlStreamDeserializer::Deserialize(ModelPartForRootPtr modelRoot)
{
xmlpp::DomParser dom;
dom.parse_stream(strm);
@@ -299,7 +299,7 @@ namespace Slicer {
}
void
- XmlStreamSerializer::Serialize(ModelPartPtr modelRoot)
+ XmlStreamSerializer::Serialize(ModelPartForRootPtr modelRoot)
{
xmlpp::Document doc;
modelRoot->OnEachChild(boost::bind(&XmlSerializer::ModelTreeIterateRoot, &doc, _1, _2));
@@ -317,7 +317,7 @@ namespace Slicer {
}
void
- XmlFileDeserializer::Deserialize(ModelPartPtr modelRoot)
+ XmlFileDeserializer::Deserialize(ModelPartForRootPtr modelRoot)
{
xmlpp::DomParser dom(path.string());
auto doc = dom.get_document();
@@ -325,7 +325,7 @@ namespace Slicer {
}
void
- XmlFileSerializer::Serialize(ModelPartPtr modelRoot)
+ XmlFileSerializer::Serialize(ModelPartForRootPtr modelRoot)
{
xmlpp::Document doc;
modelRoot->OnEachChild(boost::bind(&XmlSerializer::ModelTreeIterateRoot, &doc, _1, _2));
@@ -343,13 +343,13 @@ namespace Slicer {
}
void
- XmlDocumentDeserializer::Deserialize(ModelPartPtr modelRoot)
+ XmlDocumentDeserializer::Deserialize(ModelPartForRootPtr modelRoot)
{
DocumentTreeIterate(doc, modelRoot);
}
void
- XmlDocumentSerializer::Serialize(ModelPartPtr modelRoot)
+ XmlDocumentSerializer::Serialize(ModelPartForRootPtr modelRoot)
{
doc = new xmlpp::Document();
modelRoot->OnEachChild(boost::bind(&XmlSerializer::ModelTreeIterateRoot, doc, _1, _2));
diff --git a/slicer/xml/serializer.h b/slicer/xml/serializer.h
index cdb20f5..23ba17a 100644
--- a/slicer/xml/serializer.h
+++ b/slicer/xml/serializer.h
@@ -20,7 +20,7 @@ namespace Slicer {
public:
XmlStreamSerializer(std::ostream &);
- virtual void Serialize(ModelPartPtr) override;
+ virtual void Serialize(ModelPartForRootPtr) override;
protected:
std::ostream & strm;
@@ -30,7 +30,7 @@ namespace Slicer {
public:
XmlFileSerializer(const boost::filesystem::path &);
- virtual void Serialize(ModelPartPtr) override;
+ virtual void Serialize(ModelPartForRootPtr) override;
protected:
const boost::filesystem::path path;
@@ -40,7 +40,7 @@ namespace Slicer {
public:
XmlDocumentSerializer(xmlpp::Document * &);
- virtual void Serialize(ModelPartPtr) override;
+ virtual void Serialize(ModelPartForRootPtr) override;
protected:
xmlpp::Document * & doc;
@@ -56,7 +56,7 @@ namespace Slicer {
public:
XmlStreamDeserializer(std::istream &);
- virtual void Deserialize(ModelPartPtr) override;
+ virtual void Deserialize(ModelPartForRootPtr) override;
protected:
std::istream & strm;
@@ -66,7 +66,7 @@ namespace Slicer {
public:
XmlFileDeserializer(const boost::filesystem::path &);
- virtual void Deserialize(ModelPartPtr) override;
+ virtual void Deserialize(ModelPartForRootPtr) override;
protected:
const boost::filesystem::path path;
@@ -76,7 +76,7 @@ namespace Slicer {
public:
XmlDocumentDeserializer(const xmlpp::Document *);
- virtual void Deserialize(ModelPartPtr) override;
+ virtual void Deserialize(ModelPartForRootPtr) override;
protected:
const xmlpp::Document * doc;