[odb-users] mapping complex, templatized value types
Christian Sell
christian at gsvitec.com
Mon Sep 21 05:30:20 EDT 2015
I have to again correct myself. The problem was that I was mapping long values,
and ODB generates different method signatures for those (no buffer and size but
only a value). The mapping example only contains code for string, so one has to
employ investigative effort to find the solution
christian
> Christian Sell <christian at gsvitec.com> hat am 19. September 2015 um 19:03
> geschrieben:
>
> never mind - I had the value_traits wrongly implemented. Template stuff can
> get quite confusing at times..
>
> So the real problem lay with version 2.3 I presume and was fixed by the
> upgrade
>
> thanks
>
> > Christian Sell <christian at gsvitec.com> hat am 19. September 2015 um 18:39
> > geschrieben:
> >
> >
> > Hello Boris,
> >
> > I have been able to work around the max_align error by adding a #include
> > <cstddef> at the top of the header file containing the mapped classes. This
> > seems to be an issue with gcc versions.
> >
> > I then tried the stuff you gave, and it worked. I have looked into the
> > issues
> > with my classes, and it seems to me that the problem lies with the code
> > generated by odb, which is not compilable for my classes (the set_value
> > method
> > is generated with 4 instead of 3 parameters). I have everything packaged in
> > a
> > small sample app, which I could mail to you.
> >
> > regards,
> > Christian
> >
> >
> > > Boris Kolpackov <boris at codesynthesis.com> hat am 19. September 2015 um
> > > 15:55
> > > geschrieben:
> > >
> > >
> > > Hi Christian,
> > >
> > > Christian Sell <christian at gsvitec.com> writes:
> > >
> > > > template instances do not work, neither directly nor through
> > > > alias or typedef
> > >
> > > Strange, this should work and appear to work for me:
> > >
> > > $ cat test.hxx
> > >
> > > #include <memory>
> > > #include <utility>
> > >
> > > using int_pair = std::pair<int, int>;
> > > #pragma db value(int_pair) type("TEXT")
> > >
> > > using shared_short_pair = std::shared_ptr<std::pair<short, short>>;
> > > #pragma db value(shared_short_pair) type("TEXT")
> > >
> > > #pragma db object
> > > struct object
> > > {
> > > #pragma db id
> > > int id;
> > >
> > > int_pair ip;
> > > std::pair<int, int> ip1;
> > >
> > > std::shared_ptr<int_pair> sip; // Ok, shared_ptr is a wrapper (Section
> > > 7.3).
> > >
> > > shared_short_pair ssp;
> > > std::shared_ptr<std::pair<short, short>> ssp1;
> > > };
> > >
> > > $ odb -d sqlite -s --std c++11 test.hxx
> > >
> > > Can you try to adjust this example to reproduce your problem?
> > >
> > > Boris
> > Christian Sell
> >
> > GS Vitec GmbH
> > Im Ziegelhaus 6-8
> > D-63571 Gelnhausen
> >
> > mail: christian at gsvitec.com
> > mobil: +49 (0) 173 5384289
> >
> > Tel: +49 (0) 6051 601.26-90
> > Fax: +49 (0) 6051 601.26-91
> >
> Christian Sell
>
> GS Vitec GmbH
> Im Ziegelhaus 6-8
> D-63571 Gelnhausen
>
> mail: christian at gsvitec.com
> mobil: +49 (0) 173 5384289
>
> Tel: +49 (0) 6051 601.26-90
> Fax: +49 (0) 6051 601.26-91
>
Christian Sell
GS Vitec GmbH
Im Ziegelhaus 6-8
D-63571 Gelnhausen
mail: christian at gsvitec.com
mobil: +49 (0) 173 5384289
Tel: +49 (0) 6051 601.26-90
Fax: +49 (0) 6051 601.26-91
More information about the odb-users
mailing list