Chaste  Release::2018.1
SerializationExportWrapper.hpp File Reference

gcov doesn't like this file... More...

#include <boost/version.hpp>
#include <boost/serialization/export.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/stringize.hpp>
+ Include dependency graph for SerializationExportWrapper.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  pack< class >
 
struct  pack< void(T)>
 

Macros

#define CHASTE_CLASS_EXPORT_TEMPLATED(T, S)   BOOST_CLASS_EXPORT(T)
 
#define CHASTE_CLASS_EXPORT_INTERNAL(T)   BOOST_CLASS_EXPORT(T)
 
#define CHASTE_EXPORT_KEY_1(CLASS, P1)   BOOST_PP_CAT(CLASS, P1)
 
#define CHASTE_EXPORT_KEY_2(CLASS, P1, P2)   BOOST_PP_CAT(BOOST_PP_CAT(CLASS, P1), P2)
 
#define CHASTE_EXPORT_KEY_3(CLASS, P1, P2, P3)   BOOST_PP_CAT(BOOST_PP_CAT(BOOST_PP_CAT(CLASS, P1), P2), P3)
 
#define CHASTE_PACK_1(CLASS, P1)   pack<void (CLASS< P1 >)>::type
 
#define CHASTE_PACK_2(CLASS, P1, P2)   pack<void (CLASS< P1,P2 >)>::type
 
#define CHASTE_PACK_3(CLASS, P1, P2, P3)   pack<void (CLASS< P1,P2,P3 >)>::type
 
#define EXPORT_TEMPLATE_CLASS3_INTERNAL(CLASS, E, S, P)   CHASTE_CLASS_EXPORT_TEMPLATED( CHASTE_PACK_3(CLASS, E, S, P), CHASTE_EXPORT_KEY_3(CLASS, E, S, P) )
 
#define EXPORT_TEMPLATE_CLASS2_INTERNAL(CLASS, E, S)   CHASTE_CLASS_EXPORT_TEMPLATED( CHASTE_PACK_2(CLASS, E, S), CHASTE_EXPORT_KEY_2(CLASS, E, S) )
 
#define EXPORT_TEMPLATE_CLASS1_INTERNAL(CLASS, D)   CHASTE_CLASS_EXPORT_TEMPLATED( CHASTE_PACK_1(CLASS, D), CHASTE_EXPORT_KEY_1(CLASS, D) )
 
#define EXPORT_TEMPLATE_CLASS_ALL_DIMS_INTERNAL(CLASS)
 
#define EXPORT_TEMPLATE_CLASS_SAME_DIMS_INTERNAL(CLASS)
 
#define CHASTE_CLASS_EXPORT(T)   CHASTE_CLASS_EXPORT_INTERNAL(T)
 
#define EXPORT_TEMPLATE_CLASS_SAME_DIMS(CLASS)   EXPORT_TEMPLATE_CLASS_SAME_DIMS_INTERNAL(CLASS)
 
#define EXPORT_TEMPLATE_CLASS_ALL_DIMS(CLASS)   EXPORT_TEMPLATE_CLASS_ALL_DIMS_INTERNAL(CLASS)
 
#define EXPORT_TEMPLATE_CLASS1(CLASS, D)   EXPORT_TEMPLATE_CLASS1_INTERNAL(CLASS, D)
 
#define EXPORT_TEMPLATE_CLASS2(CLASS, E, S)   EXPORT_TEMPLATE_CLASS2_INTERNAL(CLASS, E, S)
 
#define EXPORT_TEMPLATE_CLASS3(CLASS, E, S, P)   EXPORT_TEMPLATE_CLASS3_INTERNAL(CLASS, E, S, P)
 

Detailed Description

gcov doesn't like this file...

Defines some macros to register versions of templated classes with the serialization library, for all space dimensions. Also contains wrappers around BOOST_CLASS_EXPORT and related functionality, which take care of the differences introduced in new versions of Boost.

In Boost 1.33.1 and 1.34, BOOST_CLASS_EXPORT should be placed in the .hpp file for each class, and archive headers included only in tests, or special 'archiver' class header files (e.g. CardiacSimulationArchiver.hpp).

Serialization is broken in Boost 1.35.

In Boost 1.36 (and up to 1.40) both the archive header includes and the BOOST_CLASS_EXPORT should go in .cpp files.

We also support 1.41 and above, which introduce BOOST_CLASS_EXPORT_KEY and BOOST_CLASS_EXPORT_IMPLEMENT. Note 1.41.1 has bugs in serialization. See https://chaste.cs.ox.ac.uk/trac/wiki/InstallGuides/DependencyVersions for recommended versions.

To handle all situations in Chaste: 1. In .hpp files, include this header after the class definition. 2. In .cpp files, after any other includes, include SerializationExportWrapperForCpp.hpp. In both cases, CHASTE_CLASS_EXPORT should be used instead of BOOST_CLASS_EXPORT.

There are also variant macros for common cases of templated classes:

  • EXPORT_TEMPLATE_CLASS_SAME_DIMS
  • EXPORT_TEMPLATE_CLASS_ALL_DIMS
  • EXPORT_TEMPLATE_CLASS1
  • EXPORT_TEMPLATE_CLASS2
  • EXPORT_TEMPLATE_CLASS3

The latter 3 macros are usable in any situation where a class has up to 3 template parameters, and you know what values will be needed. Unfortunately a fully general template solution seems to be impossible in any Boost version (the library makes use of either explicit instantiation or singleton class instantiation).

Definition in file SerializationExportWrapper.hpp.

Macro Definition Documentation

#define CHASTE_CLASS_EXPORT (   T)    CHASTE_CLASS_EXPORT_INTERNAL(T)

Define the serialization export key for this class.

Parameters
Tthe class

Definition at line 347 of file SerializationExportWrapper.hpp.

#define CHASTE_CLASS_EXPORT_INTERNAL (   T)    BOOST_CLASS_EXPORT(T)

What CHASTE_CLASS_EXPORT expands to when it isn't a no-op.

Parameters
Tthe class to export

Definition at line 182 of file SerializationExportWrapper.hpp.

#define CHASTE_CLASS_EXPORT_TEMPLATED (   T,
 
)    BOOST_CLASS_EXPORT(T)

General export for templated classes.

Parameters
Ta type
Sa unique string for the class + specific template parameter values

Definition at line 175 of file SerializationExportWrapper.hpp.

#define CHASTE_EXPORT_KEY_1 (   CLASS,
  P1 
)    BOOST_PP_CAT(CLASS, P1)

Defines the export key for a class templated over 1 parameter.

Parameters
CLASSthe class
P1the template parameter

Definition at line 203 of file SerializationExportWrapper.hpp.

#define CHASTE_EXPORT_KEY_2 (   CLASS,
  P1,
  P2 
)    BOOST_PP_CAT(BOOST_PP_CAT(CLASS, P1), P2)

Defines the export key for a class templated over 2 parameters.

Parameters
CLASSthe class
P1the first template parameter
P2the second template parameter

Definition at line 212 of file SerializationExportWrapper.hpp.

#define CHASTE_EXPORT_KEY_3 (   CLASS,
  P1,
  P2,
  P3 
)    BOOST_PP_CAT(BOOST_PP_CAT(BOOST_PP_CAT(CLASS, P1), P2), P3)

Defines the export key for a class templated over 3 parameters.

Parameters
CLASSthe class
P1the first template parameter
P2the second template parameter
P3the third template parameter

Definition at line 222 of file SerializationExportWrapper.hpp.

#define CHASTE_PACK_1 (   CLASS,
  P1 
)    pack<void (CLASS< P1 >)>::type

Defines the export type for a class templated over 1 parameter.

Parameters
CLASSthe class
P1the template parameter

Definition at line 230 of file SerializationExportWrapper.hpp.

#define CHASTE_PACK_2 (   CLASS,
  P1,
  P2 
)    pack<void (CLASS< P1,P2 >)>::type

Defines the export type for a class templated over 2 parameters.

Parameters
CLASSthe class
P1the first template parameter
P2the second template parameter

Definition at line 238 of file SerializationExportWrapper.hpp.

#define CHASTE_PACK_3 (   CLASS,
  P1,
  P2,
  P3 
)    pack<void (CLASS< P1,P2,P3 >)>::type

Defines the export type for a class templated over 3 parameters.

Parameters
CLASSthe class
P1the first template parameter
P2the second template parameter
P3the third template parameter

Definition at line 247 of file SerializationExportWrapper.hpp.

#define EXPORT_TEMPLATE_CLASS1 (   CLASS,
 
)    EXPORT_TEMPLATE_CLASS1_INTERNAL(CLASS, D)

Export a templated class with 1 parameter.

Parameters
CLASSthe class (without parameters)
Dtemplate parameter

Definition at line 364 of file SerializationExportWrapper.hpp.

#define EXPORT_TEMPLATE_CLASS1_INTERNAL (   CLASS,
 
)    CHASTE_CLASS_EXPORT_TEMPLATED( CHASTE_PACK_1(CLASS, D), CHASTE_EXPORT_KEY_1(CLASS, D) )

Export a templated class with 1 parameter. This is the definition of EXPORT_TEMPLATE_CLASS1 when it isn't a no-op.

Parameters
CLASSthe class (without parameters)
Dtemplate parameter

Definition at line 294 of file SerializationExportWrapper.hpp.

#define EXPORT_TEMPLATE_CLASS2 (   CLASS,
  E,
 
)    EXPORT_TEMPLATE_CLASS2_INTERNAL(CLASS, E, S)

Export a templated class with 2 parameters.

Parameters
CLASSthe class (without parameters)
Efirst template parameter
Ssecond template parameter

Definition at line 371 of file SerializationExportWrapper.hpp.

#define EXPORT_TEMPLATE_CLASS2_INTERNAL (   CLASS,
  E,
 
)    CHASTE_CLASS_EXPORT_TEMPLATED( CHASTE_PACK_2(CLASS, E, S), CHASTE_EXPORT_KEY_2(CLASS, E, S) )

Export a templated class with 2 parameters. This is the definition of EXPORT_TEMPLATE_CLASS2 when it isn't a no-op.

Parameters
CLASSthe class (without parameters)
Efirst template parameter
Ssecond template parameter

Definition at line 285 of file SerializationExportWrapper.hpp.

#define EXPORT_TEMPLATE_CLASS3 (   CLASS,
  E,
  S,
 
)    EXPORT_TEMPLATE_CLASS3_INTERNAL(CLASS, E, S, P)

Export a templated class with 3 parameters.

Parameters
CLASSthe class (without parameters)
Efirst template parameter
Ssecond template parameter
Pthird template parameter

Definition at line 379 of file SerializationExportWrapper.hpp.

#define EXPORT_TEMPLATE_CLASS3_INTERNAL (   CLASS,
  E,
  S,
 
)    CHASTE_CLASS_EXPORT_TEMPLATED( CHASTE_PACK_3(CLASS, E, S, P), CHASTE_EXPORT_KEY_3(CLASS, E, S, P) )

Export a templated class with 3 parameters. This is the definition of EXPORT_TEMPLATE_CLASS3 when it isn't a no-op.

Parameters
CLASSthe class (without parameters)
Efirst template parameter
Ssecond template parameter
Pthird template parameter

Definition at line 275 of file SerializationExportWrapper.hpp.

#define EXPORT_TEMPLATE_CLASS_ALL_DIMS (   CLASS)    EXPORT_TEMPLATE_CLASS_ALL_DIMS_INTERNAL(CLASS)

Export a class templated over both element and space dimension, for all valid combinations.

Parameters
CLASSthe class (without parameters)

Definition at line 358 of file SerializationExportWrapper.hpp.

#define EXPORT_TEMPLATE_CLASS_ALL_DIMS_INTERNAL (   CLASS)
Value:
#define EXPORT_TEMPLATE_CLASS2(CLASS, E, S)

Export a class templated over both element and space dimension, for all valid combinations. This is the definition of EXPORT_TEMPLATE_CLASS_ALL_DIMS when it isn't a no-op.

Parameters
CLASSthe class (without parameters)

Definition at line 303 of file SerializationExportWrapper.hpp.

#define EXPORT_TEMPLATE_CLASS_SAME_DIMS (   CLASS)    EXPORT_TEMPLATE_CLASS_SAME_DIMS_INTERNAL(CLASS)

Export a class templated over a single dimension, for 1, 2 and 3 dimensions.

Parameters
CLASSthe class (without parameters)

Definition at line 352 of file SerializationExportWrapper.hpp.

#define EXPORT_TEMPLATE_CLASS_SAME_DIMS_INTERNAL (   CLASS)
Value:
#define EXPORT_TEMPLATE_CLASS1(CLASS, D)

Export a class templated over a single dimension, for 1, 2 and 3 dimensions. This is the definition of EXPORT_TEMPLATE_CLASS_SAME_DIMS when it isn't a no-op.

Parameters
CLASSthe class (without parameters)

Definition at line 316 of file SerializationExportWrapper.hpp.