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 "Reflex/Object.h"
00012 #include "Reflex/Type.h"
00013
00014 #include <ostream>
00015 #include <set>
00016 #include <string>
00017 #include <typeinfo>
00018 #include <vector>
00019
00020 namespace edm {
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 return find_nested_type_named("value_type", t, found_type);
00033 }
00034
00035
00036 inline
00037 bool
00038 wrapper_type_of(Reflex::Type const& possible_wrapper,
00039 Reflex::Type& found_wrapped_type) {
00040 return find_nested_type_named("wrapped_type",
00041 possible_wrapper,
00042 found_wrapped_type);
00043 }
00044
00045 bool
00046 is_RefVector(Reflex::Type const& possible_ref_vector,
00047 Reflex::Type& value_type);
00048
00049 bool
00050 is_PtrVector(Reflex::Type const& possible_ref_vector,
00051 Reflex::Type& value_type);
00052 bool
00053 is_RefToBaseVector(Reflex::Type const& possible_ref_vector,
00054 Reflex::Type& value_type);
00055
00056 void checkDictionaries(std::string const& name, bool noComponents = false);
00057 StringSet& missingTypes();
00058
00059 void public_base_classes(Reflex::Type const& type,
00060 std::vector<Reflex::Type>& baseTypes);
00061
00069
00070
00071
00072
00073 template <class T>
00074 T const*
00075 reflex_cast(void* raw, Reflex::Type const& dynamicType) {
00076 static Reflex::Type const
00077 toType(Reflex::Type::ByTypeInfo(typeid(T)));
00078
00079 Reflex::Object obj(dynamicType, raw);
00080 return static_cast<T const*>(obj.CastObject(toType).Address());
00081
00082
00083
00084
00085
00086
00087
00088
00089 }
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00108
00109 void const*
00110 reflex_pointer_adjust(void* raw,
00111 Reflex::Type const& dynamicType,
00112 std::type_info const& toType);
00113 }
00114
00115 #endif