[odb-users] ODB Named pragmas

Boris Kolpackov boris at codesynthesis.com
Tue May 11 08:53:37 EDT 2021


Emilio Garcia <emilio.garcia at ieec.cat> writes:

> And I would like to have:
> 
>    // person.hxx
>    class person
>    {
>    ...
>    };
> 
>    // person-pragmas.hxx
> 
>    #include "person.hxx"
> 
>    #pragma db object(person)
>    #pragma db member(person::id_) id
>
> I must admit that I did not tried yet, I just wanted to confirm with you if
> it is possible and If it would have any side-effect before going into this
> approach.

There are two ways you can achieve this. The first is described in
the introduction of Chapter 14, "ODB Pragma Language"[1] and
involves using the --odb-epilogue option to non-invasively include
the person-pragmas.hxx header when compiling person.hxx with the ODB
compiler.

The alternative solution is to use the definition pragma[2] and
compile person-pragmas.hxx. One side-effect of this approach is
that the generated person-odb.hxx file will include person-pragmas.hxx
and not person.hxx directly.

[1] https://codesynthesis.com/products/odb/doc/manual.xhtml#14
[2] https://codesynthesis.com/products/odb/doc/manual.xhtml#14.3.7



More information about the odb-users mailing list