aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-04-30 11:43:09 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-04-30 11:43:09 +0200
commit4e9c246d09341a221868750a06905e02d13f67dc (patch)
tree1c6fa430950ce3056986f31da454a944cc112a3b
parent7a9e582ddd3751f3048ef087fe622e61bb368b9e (diff)
Rework polymorphic info and entry static variables
Make entry file-static. Move info further down in class definition. Make both const. This helps VC++.
-rw-r--r--odb/relational/header.cxx28
-rw-r--r--odb/relational/source.cxx11
2 files changed, 20 insertions, 19 deletions
diff --git a/odb/relational/header.cxx b/odb/relational/header.cxx
index 45f58b8..987da38 100644
--- a/odb/relational/header.cxx
+++ b/odb/relational/header.cxx
@@ -100,13 +100,7 @@ traverse_object (type& c)
//
size_t depth (polymorphic_depth (c));
- os << "static const std::size_t depth = " << depth << "UL;"
- << endl;
-
- os << "static " << (abst ? "abstract_" : "") << "info_type info;";
-
- if (!abst)
- os << "static entry_type entry;";
+ os << "static const std::size_t depth = " << depth << "UL;";
}
else
{
@@ -136,14 +130,7 @@ traverse_object (type& c)
else
os << "typedef odb::polymorphic_entry<object_type> entry_type;";
- os << "static const std::size_t depth = 1UL;"
- << endl;
-
- os << "static map_type* map;"
- << "static " << (abst ? "abstract_" : "") << "info_type info;";
-
- if (!abst)
- os << "static entry_type entry;";
+ os << "static const std::size_t depth = 1UL;";
}
}
@@ -221,6 +208,17 @@ traverse_object (type& c)
os << "static const bool abstract = " << (abst ? "true" : "false") << ";"
<< endl;
+ // Polymorphic map.
+ //
+ if (poly)
+ {
+ if (!poly_derived)
+ os << "static map_type* map;";
+
+ os << "static const " << (abst ? "abstract_" : "") << "info_type info;"
+ << endl;
+ }
+
// image_type
//
image_type_->traverse (c);
diff --git a/odb/relational/source.cxx b/odb/relational/source.cxx
index 6e864d7..0a77b74 100644
--- a/odb/relational/source.cxx
+++ b/odb/relational/source.cxx
@@ -437,7 +437,8 @@ traverse_object (type& c)
<< traits << "::map;"
<< endl;
- os << traits << "::" << (abst ? "abstract_" : "") << "info_type" << endl
+ os << "const " << traits << "::" << (abst ? "abstract_" : "") <<
+ "info_type" << endl
<< traits << "::info (" << endl
<< "typeid (" << type << ")," << endl;
@@ -446,9 +447,11 @@ traverse_object (type& c)
else
os << "0";
+ string n;
+
if (!abst)
{
- string n (class_fq_name (c));
+ n = class_fq_name (c);
os << "," << endl
<< strlit (string (n, 2, string::npos)) << "," << endl
@@ -465,8 +468,8 @@ traverse_object (type& c)
<< endl;
if (!abst)
- os << traits << "::entry_type" << endl
- << traits << "::entry;"
+ os << "static const " << traits << "::entry_type" << endl
+ << "polymorphic_entry_for_" << flat_name (n) << ";"
<< endl;
}