6 #include "Reflex/Base.h"
7 #include "Reflex/Member.h"
8 #include "Reflex/TypeTemplate.h"
12 #include "boost/algorithm/string.hpp"
13 #include "boost/thread/tss.hpp"
24 using Reflex::TypeTemplate;
25 using Reflex::Type_Iterator;
33 while(t.IsTypedef()) t = t.ToType();
39 Type const& type_to_search,
43 i = type_to_search.SubType_Begin(),
44 e = type_to_search.SubType_End();
47 if(
i->Name() == nested_type) {
59 static TypeTemplate ref_vector_template_id(TypeTemplate::ByName(
"edm::RefVector", 3));
60 static std::string member_type(
"member_type");
61 TypeTemplate primary_template_id(possible_ref_vector.TemplateFamily());
62 if(primary_template_id == ref_vector_template_id) {
72 static TypeTemplate ref_vector_template_id(TypeTemplate::ByName(
"edm::PtrVector", 1));
73 static std::string member_type(
"member_type");
74 static std::string val_type(
"value_type");
75 TypeTemplate primary_template_id(possible_ref_vector.TemplateFamily());
76 if(primary_template_id == ref_vector_template_id) {
89 static TypeTemplate ref_vector_template_id(TypeTemplate::ByName(
"edm::RefToBaseVector", 1));
90 static std::string member_type(
"member_type");
91 TypeTemplate primary_template_id(possible_ref_vector.TemplateFamily());
92 if(primary_template_id == ref_vector_template_id) {
100 int const oneParamArraySize = 6;
101 std::string
const oneParam[oneParamArraySize] = {
109 int const twoParamArraySize = 3;
110 std::string
const twoParam[twoParamArraySize] = {
118 hasCintDictionary(std::string
const&
name) {
119 std::auto_ptr<G__ClassInfo> ci(
new G__ClassInfo(name.c_str()));
120 return(ci.get() && ci->IsLoaded());
134 for(
Type x = t.ToType();
x != null &&
x !=
t; t =
x,
x = t.ToType()) {}
136 std::string name = t.Name(SCOPED);
144 if(name.empty() || t.IsFundamental() || t.IsEnum()) {
150 if(hasCintDictionary(name)) {
159 if(noComponents)
return;
161 if(name.find(
"std::") == 0) {
162 if(t.IsTemplateInstance()) {
165 if(
std::find(oneParam, oneParam + oneParamArraySize, name.substr(5, n - 5)) != oneParam + oneParamArraySize) {
167 }
else if(
std::find(twoParam, twoParam + twoParamArraySize, name.substr(5, n - 5)) != twoParam + twoParamArraySize) {
170 for(
int i = 0;
i < cnt; ++
i) {
175 int mcnt = t.DataMemberSize();
176 for(
int i = 0;
i < mcnt; ++
i) {
177 Member
m = t.DataMemberAt(
i);
178 if(m.IsTransient() || m.IsStatic())
continue;
181 int cnt = t.BaseSize();
182 for(
int i = 0;
i < cnt; ++
i) {
201 Type t = Type::ByName(name);
206 checkType(Type::ByName(name), noComponents);
211 std::ostringstream ostr;
214 ostr << *it <<
"\n\n";
217 <<
"No REFLEX data dictionary found for the following classes:\n\n"
219 <<
"Most likely each dictionary was never generated,\n"
220 <<
"but it may be that it was generated in the wrong package.\n"
221 <<
"Please add (or move) the specification\n"
222 <<
"<class name=\"whatever\"/>\n"
223 <<
"to the appropriate classes_def.xml file.\n"
224 <<
"If the class is a template instance, you may need\n"
225 <<
"to define a dummy variable of this type in classes.h.\n"
226 <<
"Also, if this class has any transient members,\n"
227 <<
"you need to specify them in classes_def.xml.";
234 for (StringSet::const_iterator it = missing.begin(), itEnd = missing.end();
237 gROOT->GetClass(it->c_str(), kTRUE);
243 for (StringSet::const_iterator it = missing.begin(), itEnd = missing.end();
258 std::vector<Type>& baseTypes) {
260 if(type.IsClass() || type.IsStruct()) {
262 int nBase = type.BaseSize();
263 for(
int i = 0;
i < nBase; ++
i) {
266 if(base.IsPublic()) {
268 Type baseType = type.BaseAt(
i).ToType();
271 while(baseType.IsTypedef() ==
true) {
272 baseType = baseType.ToType();
279 baseTypes.push_back(baseType);
310 Type const& dynamicType,
311 std::type_info
const& toType) {
312 Object
obj(dynamicType, raw);
313 return obj.CastObject(Type::ByTypeInfo(toType)).Address();
bool is_RefToBaseVector(Reflex::Type const &possible_ref_vector, Reflex::Type &value_type)
bool is_PtrVector(Reflex::Type const &possible_ref_vector, Reflex::Type &value_type)
void const * reflex_pointer_adjust(void *raw, Reflex::Type const &dynamicType, std::type_info const &toType)
void public_base_classes(Reflex::Type const &type, std::vector< Reflex::Type > &baseTypes)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
StringSet & missingTypes()
std::set< std::string > StringSet
void checkDictionaries(std::string const &name, bool noComponents=false)
Container::value_type value_type
void throwMissingDictionariesException()
bool find_nested_type_named(std::string const &nested_type, Reflex::Type const &type_to_search, Reflex::Type &found_type)
static StringSet foundTypes_
bool search_all(ForwardSequence const &s, Datum const &d)
void loadMissingDictionaries()
bool is_RefVector(Reflex::Type const &possible_ref_vector, Reflex::Type &value_type)
Type get_final_type(Type t)
static StringSet missingTypes_