Go to the documentation of this file.00001 #ifndef FWCore_Utilities_ReflexTools_h
00002 #define FWCore_Utilities_ReflexTools_h
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include <ostream>
00012 #include <set>
00013 #include <string>
00014 #include <vector>
00015
00016 #include "Reflex/Type.h"
00017 #include "Reflex/Object.h"
00018
00019 namespace edm
00020 {
00021
00022 typedef std::set<std::string> StringSet;
00023
00024 bool
00025 find_nested_type_named(std::string const& nested_type,
00026 Reflex::Type const& type_to_search,
00027 Reflex::Type& found_type);
00028
00029 inline
00030 bool
00031 value_type_of(Reflex::Type const& t, Reflex::Type& found_type)
00032 {
00033 return find_nested_type_named("value_type", t, found_type);
00034 }
00035
00036
00037 inline
00038 bool
00039 wrapper_type_of(Reflex::Type const& possible_wrapper,
00040 Reflex::Type& found_wrapped_type)
00041 {
00042 return find_nested_type_named("wrapped_type",
00043 possible_wrapper,
00044 found_wrapped_type);
00045 }
00046
00047
00048
00049
00050
00051
00052
00053 bool
00054 is_sequence_wrapper(Reflex::Type const& possible_sequence_wrapper,
00055 Reflex::Type& found_sequence_value_type);
00056
00057 bool
00058 if_edm_ref_get_value_type(Reflex::Type const& possible_ref,
00059 Reflex::Type& value_type);
00060
00061 bool
00062 if_edm_ptr_get_value_type(Reflex::Type const& possible_ref,
00063 Reflex::Type& value_type);
00064
00065 bool
00066 if_edm_refToBase_get_value_type(Reflex::Type const& possible_ref,
00067 Reflex::Type& value_type);
00068
00069 bool
00070 is_RefVector(Reflex::Type const& possible_ref_vector,
00071 Reflex::Type& value_type);
00072
00073 bool
00074 is_PtrVector(Reflex::Type const& possible_ref_vector,
00075 Reflex::Type& value_type);
00076 bool
00077 is_RefToBaseVector(Reflex::Type const& possible_ref_vector,
00078 Reflex::Type& value_type);
00079
00080 void checkDictionaries(std::string const& name, bool noComponents = false);
00081 StringSet& missingTypes();
00082
00083 void public_base_classes(const Reflex::Type& type,
00084 std::vector<Reflex::Type>& baseTypes);
00085
00093
00094
00095
00096
00097 template <class T>
00098 T const*
00099 reflex_cast(void* raw, Reflex::Type const& dynamicType)
00100 {
00101 static const Reflex::Type
00102 toType(Reflex::Type::ByTypeInfo(typeid(T)));
00103
00104 Reflex::Object obj(dynamicType, raw);
00105 return static_cast<T const*>(obj.CastObject(toType).Address());
00106
00107
00108
00109
00110
00111
00112
00113
00114 }
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00133
00134 void const*
00135 reflex_pointer_adjust(void* raw,
00136 Reflex::Type const& dynamicType,
00137 std::type_info const& toType);
00138
00139 }
00140
00141 #endif