[odb-users] Circular relation problem with external file mapping

Romain Gros grosr.romain at gmail.com
Sat Jul 20 10:13:59 EDT 2013


Hi !

I made some digging and I came to the conclusion that the problem is that
the type of the data member of Quest::steps_ is not a pointer.
Even if the getter of Quest::steps_ returns a std::vector<QuestStep*>, it
seems that ODB only bases itself on the Quest::steps_ type.
I also tried to create a virtual member with a type std::vector<QuestStep*>
(like this: #pragma db member(Quest::steps)
virtual(std::vector<QuestStep*>)), but it seems ODB doesn't allow to create
a virtual container because I got the error : "name std::vector in db
pragma virtual does not refer to a type".

Is there a way to make things work without pointers? Protobuf being
generated, we cannot change the data member type...

Regards,


2013/7/19 Romain Gros <grosr.romain at gmail.com>

> Hi Boris !
>
>
> Boris Kolpackov <boris at codesynthesis.com> writes:
>
> >> #pragma db object(QuestStep) definition
> >> #pragma db member(QuestStep::quest_) get(get_quest)
> >> set(set_allocated_quest) not_null column("idquest")
> >>
> >> #pragma db object(Quest) definition
> >> #pragma db member(Quest::steps_) get(get_steps) set(set_steps)
> >> value_not_null inverse(quest_)
> >>
> >> `get_steps` returns a `::google::protobuf::RepeatedPtrField<
> ::QuestStep >*`.
> >
> >What are the types of the QuestStep::quest_ and Quest::steps_ data
> >members? Based on your mapping, they should be pointers to objects
> >of some sort.
>
> The type of *QuestStep::quest_* is *::Quest**.
> The type of *Quest::steps_* data members is *::QuestStep, *but it's not
> pointer.
>
> >> Now, when I try to compile, I got this error: `unable to map C++ type
> >> '::QuestStep'`.
> >
> >That would normally mean that QuestStep is treated as a value rather
> >than an object. What does the line that this error points to contain?
> >And in the future always show what the error points too -- I have no
> >way of knowing what it is!
>
> This error points too the declaration of the member *Quest::steps_* in
> the class declaration. Sorry for this oversight !
>
> Thanks for the answer !
>


More information about the odb-users mailing list