[odb-users] base class, derived, separate headers and derived
references base
MM
finjulhich at gmail.com
Sat Jul 4 20:11:12 EDT 2015
On 3 July 2015 at 18:35, Boris Kolpackov <boris at codesynthesis.com> wrote:
> MM <finjulhich at gmail.com> writes:
>
NS/Base.hpp
=====================
#include <string>
#include <cstdint>
namespace NS
> {
struct Base {
std::string code;
std::uint32_t id;
virtual const std::string& type() const =0;
virtual ~Base() =0;
};
}
NS/A.hpp
> ===================
> namespace NS
> {
>
struct A : public Base {
> const Base* underlying;
> };
> struct selector {
> std::string type;
> std::uint32_t id;
> };
> void set_A_underlying(A&, const selector&);
}
NS_odb/A.hpp
> ====================
> #include <odb/core.hxx>
> namespace NS
> {
> #pragma db value(selector) definition
>
#pragma db object(A) table("A") definition
> #pragma db member(A::underlying) transient
> #pragma db member(A::ulid) virtual(selector) \
> get( selector(this.underlying->type(), this.underlying->id)) \
> set(set_A_underlying (this,(?)))
> }
What is a 'T' in A? Send a complete, compilable test case that
> reproduces the problem.
> Boris
>
Please see corrections, for compilable files, above.
There's just nothing generated by the odb compiler for the type selector,
at all.
Rds,
MM
More information about the odb-users
mailing list