Boost logo

Boost :

From: Sören Freudiger (muffmolch_at_[hidden])
Date: 2007-06-27 12:25:26


Hi @all
I have a question to
BOOST_CLASS_EXPORT_GUID(...)

We have a lot of (derived) classes and want to register them by using
BOOST_CLASS_EXPORT_GUID(...).
Right now we do it like this:

*** "main.cpp" ***
        ...
        #include "./../RCFExportForSerializedBasePtr.h"
        ...
        
        int main() { ... }

*** "RCFExportForSerializedBasePtr.h" ***
  #include <boost/serialization/export.hpp>
   BOOST_CLASS_EXPORT_GUID(GbObject2D,"GbObject2D")
   BOOST_CLASS_EXPORT_GUID(GbCircle2D,"GbCircle2D")
   BOOST_CLASS_EXPORT_GUID(GbRectangle2D,"GbRectangle2D")
   BOOST_CLASS_EXPORT_GUID(AMR2DInteractor,"AMR2DInteractor")
   BOOST_CLASS_EXPORT_GUID(D2Q9AMRInteractor,"D2Q9AMRInteractor")
...

But what we want to have the macro BOOST_CLASS_EXPORT_GUID(...) at the end
of the header file of the derived class.
That makes a lot of things much more easy.
We tried that half a year ago and it doesn't work (we got errors, but I
cannot say which one right now).

Is this possible in gernerell? If what do I have to consider?
"...
For this implementaton to function, the header file export.hpp has to come
after all the archive header files
..."
(source:
http://www.cs.brown.edu/~jwicks/boost/libs/serialization/doc/special.html)

Does that mean that I only have to inlcude all archive header, then
export.hpp and then the BOOST_CLASS_EXPORT_GUID can follow?

Like that:

*** inlcudeMe.h ***
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/binary_iarchive.hpp>

#include <boost/serialization/export.hpp>

*** GbCircle2D.h ***
#include " inlcudeMe.h"

... (declaration of GbCircle2D)
BOOST_CLASS_EXPORT_GUID(GbCircle2D,"GbCircle2D")

*** GbRectangle2D.h ***
#include " inlcudeMe.h"

... (declaration of GbRectangle2D)
BOOST_CLASS_EXPORT_GUID(GbRectangle2D," GbRectangle2D ")

*** main.cpp ***

        ...
        #include "./GbCircle2D.h"
        #include "./ GbRectangle2D.h"
        ...
        
        int main() { ... }

Best regards,
SirAnn

______________________________________
iRMB - Institute for Computational Modeling in Civil Engineering
TU Braunschweig
Pockelsstr. 3 (9th Floor)
D-38106, Braunschweig, Germany
 
phone +49 531/391-7595
fax   +49 531/391-7599
email freud_at_[hidden]
web   www.irmb.tu-bs.de


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk