aboutsummaryrefslogtreecommitdiff
path: root/common/polymorphism/test2.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-10-08 14:47:57 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-10-08 14:47:57 +0200
commit6b76715e63d2c265a4c51c73f9019bc578f874cb (patch)
treec0b5f6a944abf6fe015742bbc08e5a393249cf6d /common/polymorphism/test2.hxx
parentdcee8530bb5c58710a22f50bb92ac7c3b19ddf84 (diff)
Fix bug in transient inheritance handling
Also test that we can handle it for objects, composite values, and views.
Diffstat (limited to 'common/polymorphism/test2.hxx')
-rw-r--r--common/polymorphism/test2.hxx106
1 files changed, 0 insertions, 106 deletions
diff --git a/common/polymorphism/test2.hxx b/common/polymorphism/test2.hxx
deleted file mode 100644
index 1b81f41..0000000
--- a/common/polymorphism/test2.hxx
+++ /dev/null
@@ -1,106 +0,0 @@
-// file : common/polymorphism/test2.hxx
-// copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC
-// license : GNU GPL v2; see accompanying LICENSE file
-
-#ifndef TEST2_HXX
-#define TEST2_HXX
-
-#include <string>
-#include <vector>
-
-#include <odb/core.hxx>
-#include <odb/lazy-ptr.hxx>
-
-// Test inverse object pointers in polymorhic bases.
-//
-#pragma db namespace table("t2_")
-namespace test2
-{
- struct root;
-
- #pragma db object
- struct root_pointer
- {
- root_pointer (root* r = 0): p (r) {}
-
- #pragma db id auto
- unsigned long id;
-
- root* p;
- };
-
- #pragma db object polymorphic
- struct root
- {
- virtual ~root () {}
- root () {}
- root (unsigned long i): id (i) {}
-
- #pragma db id
- unsigned long id;
-
- #pragma db inverse(p)
- odb::lazy_ptr<root_pointer> rp;
- };
-
- struct base;
-
- #pragma db object
- struct base_pointer
- {
- base_pointer (base* b = 0) {if (b != 0) vp.push_back (b);}
-
- #pragma db id auto
- unsigned long id;
-
- std::vector<base*> vp;
- };
-
- #pragma db object
- struct base: root
- {
- base () {}
- base (unsigned long i, const std::string& s): root (i), str (s) {}
-
- std::string str;
-
- #pragma db inverse(vp)
- odb::lazy_ptr<base_pointer> bp;
- };
-
- #pragma db object
- struct derived: base
- {
- derived () {}
- derived (unsigned long i, const std::string& s, unsigned long n)
- : base (i, s), num (n) {}
-
- unsigned long num;
- };
-
- // Views.
- //
- #pragma db view object(root_pointer = rp) object(root)
- struct root_view
- {
- #pragma db column(rp::id)
- unsigned long rp_id;
-
- #pragma db column(root::id)
- unsigned long r_id;
- };
-
- #pragma db view object(base_pointer) object(base = b)
- struct base_view
- {
- #pragma db column(base_pointer::id)
- unsigned long bp_id;
-
- #pragma db column(b::id)
- unsigned long b_id;
-
- std::string str;
- };
-}
-
-#endif // TEST2_HXX