ATLAS Offline Software
|
Metafunction to find the proper DataBucket
class for T
.
More...
#include <DataBucketTraitFwd.h>
Public Types | |
typedef SG::BaseType< typename SG::Bases< T >::bases::Base1 >::type | base1 |
typedef std::is_same< base1, SG::NoBase >::type | has_base |
typedef boost::mpl::identity< SG::DataBucket< U > > | deflt |
typedef DataBucketTrait< base1, U > | recurse |
typedef boost::mpl::eval_if< has_base, deflt, recurse >::type | type |
Static Public Member Functions | |
static void | init () |
Initialization hook. A no-op by default. More... | |
Metafunction to find the proper DataBucket
class for T
.
See in Storable_conversions.h for full documentation.
Here's what we're trying to do.
The default DataBucket
class for T
is SG::DataBucket<T>
.
However, if T
is a DataVector
or DataList
, then we want to use instead SG::DVLDataBucket<T>
.
Further, if T
derives from DataVector
or DataList
(as declared by SG_BASES
), then we also want to use SG::DVLDataBucket<T>
.
Further, we don't want this code to depend on DataVector
or SG::DVLDataBucket
. That behavior is enabled only by including the appropriate DataVector/
.DataList
headers
So, we handle this with the following metafunction. (By saying that this is a ‘metafunction’, it means that the result is given by the nested type type
.) The T
argument is the type we're testing, and U
is the top-level type that was given to the original invocation of DataBucketTrait
. If T
has no bases (according to SG::Bases
), we return SG::DataBucket<U>
. Otherwise, we apply ourselves recursively to the first base class.
Other packages can then specialize this to change the behavior.
We don't really try to handle multiple bases. In principle, we could loop over them. But it seems that that's not really needed, so i don't want to pull in the extra overhead unnecessarily.
This class also defines a real static function init(). This is called from fromStorable
. It can be used to force instantiation of reflection information.
Definition at line 30 of file DataBucketTraitFwd.h.
typedef SG::BaseType<typename SG::Bases<T>::bases::Base1>::type SG::DataBucketTrait< T, U >::base1 |
Definition at line 135 of file StorableConversions.h.
typedef boost::mpl::identity<SG::DataBucket<U> > SG::DataBucketTrait< T, U >::deflt |
Definition at line 141 of file StorableConversions.h.
typedef std::is_same<base1, SG::NoBase>::type SG::DataBucketTrait< T, U >::has_base |
Definition at line 138 of file StorableConversions.h.
typedef DataBucketTrait<base1, U> SG::DataBucketTrait< T, U >::recurse |
Definition at line 144 of file StorableConversions.h.
typedef boost::mpl::eval_if<has_base, deflt, recurse>::type SG::DataBucketTrait< T, U >::type |
Definition at line 149 of file StorableConversions.h.
|
inlinestatic |
Initialization hook. A no-op by default.
Definition at line 152 of file StorableConversions.h.