00001
00002
00029 #ifndef ATHCONTAINERSINTERFACES_AUXSTORE_TRAITS_H
00030 #define ATHCONTAINERSINTERFACES_AUXSTORE_TRAITS_H
00031
00032
00033 #include "AthContainersInterfaces/IAuxElement.h"
00034 #include "AthContainersInterfaces/IAuxStore.h"
00035 #include "AthContainersInterfaces/IConstAuxStore.h"
00036
00037
00038 #if __cplusplus < 201100
00039 # include <boost/type_traits/is_base_of.hpp>
00040
00041
00042
00043 # include <boost/version.hpp>
00044 # if BOOST_VERSION < 104601
00045 # include <boost/mpl/if.hpp>
00046 namespace boost {
00047 template <bool b, class T, class U>
00048 struct conditional : public mpl::if_c<b, T, U> {};
00049 }
00050 # else
00051 # include <boost/type_traits/conditional.hpp>
00052 # endif // BOOST_VERSION
00053 namespace SG_STD_OR_BOOST = boost;
00054 #else
00055 # include <type_traits>
00056 namespace SG_STD_OR_BOOST = std;
00057 #endif
00058 #include <string>
00059
00060
00061
00062 namespace SG {
00063
00064
00068 class NoAuxStore {};
00069
00070
00072 struct AuxStore_traits_AuxDefault
00073 {
00074 typedef SG_STD_OR_BOOST::true_type flag;
00075
00076 typedef IAuxStore type;
00077 static const std::string& typeName()
00078 {
00079 static const std::string name ("SG::IAuxStore");
00080 return name;
00081 }
00082
00083 typedef IConstAuxStore const_type;
00084 static const std::string& const_typeName()
00085 {
00086 static const std::string name ("SG::IConstAuxStore");
00087 return name;
00088 }
00089 };
00090
00091
00093 struct AuxStore_traits_NoAuxDefault
00094 {
00095 typedef SG_STD_OR_BOOST::false_type flag;
00096
00097 typedef NoAuxStore type;
00098 static const std::string& typeName()
00099 {
00100 static const std::string name ("SG::NoAuxStore");
00101 return name;
00102 }
00103
00104 typedef NoAuxStore const_type;
00105 static const std::string& const_typeName()
00106 {
00107 static const std::string name ("SG::NoAuxStore");
00108 return name;
00109 }
00110 };
00111
00112
00115 template <class DOBJ, class FLAG_>
00116 struct AuxStore_traits1
00117 {
00118 typedef typename SG_STD_OR_BOOST::conditional<
00119 SG_STD_OR_BOOST::is_base_of<IAuxElement, DOBJ>::value,
00120 AuxStore_traits_AuxDefault,
00121 AuxStore_traits_NoAuxDefault>::type
00122 type;
00123 };
00124
00125
00134 template <class DOBJ>
00135 struct AuxStore_traits1<DOBJ,
00136 typename SG_STD_OR_BOOST::is_base_of<
00137 IAuxElement, typename DOBJ::base_value_type>::type>
00138 {
00139 typedef AuxStore_traits_AuxDefault type;
00140 };
00141
00142
00150 template <class DOBJ>
00151 struct AuxStore_traits
00152 : public AuxStore_traits1<DOBJ, SG_STD_OR_BOOST::true_type>::type
00153 {
00160 };
00161
00162
00168 template <class DOBJ>
00169 struct AuxStore_traits<DOBJ*> : public AuxStore_traits<DOBJ> {};
00170
00171
00172
00173 }
00174
00175
00176 #endif // not ATHCONTAINERSINTERFACES_AUXSTORE_TRAITS_H