[odb-users] Is this possible?
Miguel Revilla Rodríguez
yo at miguelrevilla.com
Wed Jun 27 07:49:19 EDT 2012
Now, it's probably not possible or, at least, my C++ skills don't get
that far. Imagine the situation:
I have a polymorphic class called 'node':
#pragma db object polymorphic
class node { ... } ;
Now, node is inherited by several other classes (user, group, etc).
And one of those classes (group) is a node that defines a group of
nodes. I want to set a many-to-many relationship where a group
contains a number of nodes and a node belongs to a number of groups.
This one is obvious in the group definition:
#pragma db value_not_null
std::vector<odb::lazy_shared_ptr<node> > nodes_ ;
But this one is tricky in the node definition:
#pragma db value_not_null inverse(nodes_)
std::vector<odb::lazy_weak_ptr<group> > groups_ ;
Because, if I include "group.h" (that inherits from node, remember
that) it obviously crashes as node is not yet defined. I could, of
course, just declare an empty class group and implement later, but the
odb compiler wants their kids to be defined and
#pragma db object
class group {} ;
instead of
#include "group.h"
is, obviously, not working.
Any chances of solving this?
Thanks guys
More information about the odb-users
mailing list