aboutsummaryrefslogtreecommitdiff
path: root/xsde/cxx/serializer/serializer-inline.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'xsde/cxx/serializer/serializer-inline.cxx')
-rw-r--r--xsde/cxx/serializer/serializer-inline.cxx82
1 files changed, 72 insertions, 10 deletions
diff --git a/xsde/cxx/serializer/serializer-inline.cxx b/xsde/cxx/serializer/serializer-inline.cxx
index 621f8b2..bfc16e2 100644
--- a/xsde/cxx/serializer/serializer-inline.cxx
+++ b/xsde/cxx/serializer/serializer-inline.cxx
@@ -365,16 +365,22 @@ namespace CXX
//
struct ParticleMemberSet: Traversal::Element, Context
{
- ParticleMemberSet (Context& c)
- : Context (c)
+ ParticleMemberSet (Context& c, Boolean poly)
+ : Context (c), poly_ (poly)
{
}
virtual Void
traverse (SemanticGraph::Element& e)
{
- os << "this->" << emember (e) << " = &" << ename (e) << ";";
+ if (poly_)
+ os << "this->" << emember_map (e) << " = &" << ename (e) << ";";
+ else
+ os << "this->" << emember (e) << " = &" << ename (e) << ";";
}
+
+ private:
+ Boolean poly_;
};
struct AttributeMemberSet: Traversal::Attribute, Context
@@ -395,8 +401,8 @@ namespace CXX
Traversal::List,
Context
{
- BaseMemberSet (Context& c)
- : Context (c)
+ BaseMemberSet (Context& c, Boolean poly)
+ : Context (c), poly_ (poly)
{
inherits_ >> *this;
}
@@ -416,6 +422,9 @@ namespace CXX
virtual Void
traverse (SemanticGraph::List& l)
{
+ if (poly_)
+ return;
+
String const& name (ename (l));
String item (unclash (name, "item"));
@@ -424,6 +433,7 @@ namespace CXX
private:
Traversal::Inherits inherits_;
+ Boolean poly_;
};
//
@@ -493,9 +503,11 @@ namespace CXX
: Context (c),
particle_accessor_ (c),
attribute_accessor_ (c),
- base_set_ (c),
- particle_set_ (c),
- attribute_set_ (c)
+ base_set_ (c, false),
+ particle_set_ (c, false),
+ attribute_set_ (c),
+ base_set_poly_ (c, true),
+ particle_set_poly_ (c, true)
{
// Accessor.
//
@@ -518,6 +530,16 @@ namespace CXX
contains_particle_set_ >> particle_set_;
names_attribute_set_ >> attribute_set_;
+
+ // Member set polymorphic.
+ //
+ inherits_base_set_poly_ >> base_set_poly_;
+ base_set_poly_ >> contains_compositor_set_poly_;
+
+ contains_compositor_set_poly_ >> compositor_set_poly_;
+ compositor_set_poly_ >> contains_particle_set_poly_;
+ contains_particle_set_poly_ >> compositor_set_poly_;
+ contains_particle_set_poly_ >> particle_set_poly_;
}
virtual Void
@@ -550,13 +572,12 @@ namespace CXX
// serializer ()
//
-
os << inl
<< "void " << name << "::" << endl
<< "serializers (";
{
- SerializerParamDecl decl (*this, true);
+ SerializerParamDecl decl (*this, true, false);
decl.traverse (c);
}
@@ -572,6 +593,37 @@ namespace CXX
contains_compositor (c, contains_compositor_set_);
os << "}";
+
+ // serializer_maps ()
+ //
+ if (poly_code && he)
+ {
+ Boolean r (false);
+ SerializerParamTest test (*this, r, true);
+ test.traverse (c);
+
+ // Have potentially polymorphic elements.
+ //
+ if (r)
+ {
+ os << inl
+ << "void " << name << "::" << endl
+ << "serializer_maps (";
+
+ {
+ SerializerParamDecl decl (*this, true, true);
+ decl.traverse (c);
+ }
+
+ os << ")"
+ << "{";
+
+ inherits (c, inherits_base_set_poly_);
+ contains_compositor (c, contains_compositor_set_poly_);
+
+ os << "}";
+ }
+ }
}
String fq_base;
@@ -726,6 +778,16 @@ namespace CXX
AttributeMemberSet attribute_set_;
Traversal::Names names_attribute_set_;
+
+ //
+ //
+ BaseMemberSet base_set_poly_;
+ Traversal::Inherits inherits_base_set_poly_;
+
+ Traversal::Compositor compositor_set_poly_;
+ ParticleMemberSet particle_set_poly_;
+ Traversal::ContainsCompositor contains_compositor_set_poly_;
+ Traversal::ContainsParticle contains_particle_set_poly_;
};
}