1 #ifndef DataFormats_Common_fillPtrVector_h
2 #define DataFormats_Common_fillPtrVector_h
26 #include "Reflex/Object.h"
27 #include "Reflex/Type.h"
34 template <
class COLLECTION>
37 const std::type_info& iToType,
38 const std::vector<unsigned long>& iIndicies,
39 std::vector<void const*>& oPtr)
41 typedef COLLECTION product_type;
43 typedef typename product_type::const_iterator iter;
46 oPtr.reserve(iIndicies.size());
47 if(iToType ==
typeid(element_type)) {
48 for(std::vector<unsigned long>::const_iterator itIndex=iIndicies.begin(),
49 itEnd = iIndicies.end();
52 iter it = coll.begin();
53 std::advance(it,*itIndex);
55 oPtr.push_back(address);
60 static const Type s_type(Type::ByTypeInfo(
typeid(element_type)));
61 Type toType=Type::ByTypeInfo(iToType);
63 for(std::vector<unsigned long>::const_iterator itIndex=iIndicies.begin(),
64 itEnd = iIndicies.end();
67 iter it = coll.begin();
68 std::advance(it,*itIndex);
74 Object
obj(s_type, const_cast<void*>(static_cast<const void*>(address)));
75 Object cast = obj.CastObject(toType);
76 if(0 != cast.Address()) {
77 oPtr.push_back(cast.Address());
80 "TypeConversionError "
81 "edm::PtrVector<> : unable to convert type ",
82 typeid(element_type).
name(),
93 template <
class T,
class A>
96 const std::type_info& iToType,
97 const std::vector<unsigned long>& iIndicies,
98 std::vector<void const*>& oPtr) {
102 template <
class T,
class A>
105 const std::type_info& iToType,
106 const std::vector<unsigned long>& iIndicies,
107 std::vector<void const*>& oPtr) {
111 template <
class T,
class A>
114 const std::type_info& iToType,
115 const std::vector<unsigned long>& iIndicies,
116 std::vector<void const*>& oPtr) {
120 template <
class T,
class A,
class Comp>
123 const std::type_info& iToType,
124 const std::vector<unsigned long>& iIndicies,
125 std::vector<void const*>& oPtr) {
static const element_type * address(const iter &i)
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
tuple obj
Example code starts here #.
COLLECTION::value_type element_type
void reallyfillPtrVector(COLLECTION const &coll, const std::type_info &iToType, const std::vector< unsigned long > &iIndicies, std::vector< void const * > &oPtr)
void fillPtrVector(std::vector< T, A > const &obj, const std::type_info &iToType, const std::vector< unsigned long > &iIndicies, std::vector< void const * > &oPtr)