1 #ifndef DataFormats_Common_setPtr_h
2 #define DataFormats_Common_setPtr_h
25 #include "Reflex/Object.h"
26 #include "Reflex/Type.h"
36 template <
typename COLLECTION>
39 std::type_info
const& iToType,
42 typedef COLLECTION product_type;
44 typedef typename product_type::const_iterator iter;
47 if(iToType ==
typeid(element_type)) {
48 iter it = coll.begin();
49 std::advance(it,iIndex);
55 static Type const s_type(Type::ByTypeInfo(
typeid(element_type)));
57 iter it = coll.begin();
58 std::advance(it,iIndex);
65 Object
obj(s_type, const_cast<void*>(static_cast<void const*>(address)));
66 Object cast = obj.CastObject(Type::ByTypeInfo(iToType));
67 if(0 != cast.Address()) {
68 oPtr = cast.Address();
72 "edm::Ptr<> : unable to convert type ",
73 typeid(element_type).
name(),
82 template <
typename T,
typename A>
85 std::type_info
const& iToType,
91 template <
typename T,
typename A>
94 std::type_info
const& iToType,
100 template <
typename T,
typename A>
103 std::type_info
const& iToType,
104 unsigned long iIndex,
109 template <
typename T,
typename A,
typename Comp>
112 std::type_info
const& iToType,
113 unsigned long iIndex,
static const element_type * address(const iter &i)
void setPtr(std::vector< T, A > const &obj, std::type_info const &iToType, unsigned long iIndex, void const *&oPtr)
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
COLLECTION::value_type element_type
void reallySetPtr(COLLECTION const &coll, std::type_info const &iToType, unsigned long iIndex, void const *&oPtr)