1 #ifndef DataFormats_Common_fillPtrVector_h
2 #define DataFormats_Common_fillPtrVector_h
26 #include "Reflex/Object.h"
27 #include "Reflex/Type.h"
37 template <
typename COLLECTION>
40 std::type_info
const& iToType,
41 std::vector<unsigned long>
const& iIndicies,
42 std::vector<void const*>& oPtr)
44 typedef COLLECTION product_type;
46 typedef typename product_type::const_iterator iter;
49 oPtr.reserve(iIndicies.size());
50 if(iToType ==
typeid(element_type)) {
51 for(std::vector<unsigned long>::const_iterator itIndex = iIndicies.begin(),
52 itEnd = iIndicies.end();
55 iter it = coll.begin();
56 std::advance(it, *itIndex);
58 oPtr.push_back(address);
63 static Type const s_type(Type::ByTypeInfo(
typeid(element_type)));
64 Type toType = Type::ByTypeInfo(iToType);
66 for(std::vector<unsigned long>::const_iterator itIndex = iIndicies.begin(),
67 itEnd = iIndicies.end();
70 iter it = coll.begin();
71 std::advance(it, *itIndex);
77 Object
obj(s_type, const_cast<void*>(static_cast<void const*>(address)));
78 Object cast = obj.CastObject(toType);
79 if(0 != cast.Address()) {
80 oPtr.push_back(cast.Address());
83 "TypeConversionError "
84 "edm::PtrVector<> : unable to convert type ",
85 typeid(element_type).
name(),
95 template <
typename T,
typename A>
98 std::type_info
const& iToType,
99 std::vector<unsigned long>
const& iIndicies,
100 std::vector<void const*>& oPtr) {
104 template <
typename T,
typename A>
107 std::type_info
const& iToType,
108 std::vector<unsigned long>
const& iIndicies,
109 std::vector<void const*>& oPtr) {
113 template <
typename T,
typename A>
116 std::type_info
const& iToType,
117 std::vector<unsigned long>
const& iIndicies,
118 std::vector<void const*>& oPtr) {
122 template <
typename T,
typename A,
typename Comp>
125 std::type_info
const& iToType,
126 std::vector<unsigned long>
const& iIndicies,
127 std::vector<void const*>& oPtr) {
static const element_type * address(const iter &i)
void fillPtrVector(std::vector< T, A > const &obj, std::type_info const &iToType, std::vector< unsigned long > const &iIndicies, std::vector< void const * > &oPtr)
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
void reallyfillPtrVector(COLLECTION const &coll, std::type_info const &iToType, std::vector< unsigned long > const &iIndicies, std::vector< void const * > &oPtr)
tuple obj
Example code starts here #.
COLLECTION::value_type element_type