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 void throwMissingDictionariesException();
00058 void loadMissingDictionaries();
00059 StringSet& missingTypes();
00060 StringSet& foundTypes();
00061
00062 void public_base_classes(Reflex::Type const& type,
00063 std::vector<Reflex::Type>& baseTypes);
00064
00072
00073
00074
00075
00076 template <class T>
00077 T const*
00078 reflex_cast(void* raw, Reflex::Type const& dynamicType) {
00079 static Reflex::Type const
00080 toType(Reflex::Type::ByTypeInfo(typeid(T)));
00081
00082 Reflex::Object obj(dynamicType, raw);
00083 return static_cast<T const*>(obj.CastObject(toType).Address());
00084
00085
00086
00087
00088
00089
00090
00091
00092 }
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00111
00112 void const*
00113 reflex_pointer_adjust(void* raw,
00114 Reflex::Type const& dynamicType,
00115 std::type_info const& toType);
00116 }
00117
00118 #endif