60 #include "TClassEdit.h" 61 #include "THashTable.h" 75 missingDictionaries.emplace_back(typeID.
className());
84 return checkDictionary(missingDictionaries, wrappedName, wrappedTypeWithDict);
90 return checkDictionary(missingDictionaries, wrappedName, wrappedTypeWithDict);
97 missingDictionaries.emplace_back(
name);
111 TClass* tClass = TClass::GetClass(typeID.
typeInfo());
115 tClass = TClass::GetClass(typeID.
typeInfo());
118 missingDictionaries.emplace_back(typeID.
className());
122 if (tClass ==
nullptr) {
128 THashTable hashTable;
129 bool recursive =
true;
130 tClass->GetMissingDictionaries(hashTable, recursive);
132 for (
auto const&
item : hashTable) {
133 TClass
const*
cl =
static_cast<TClass
const*
>(
item);
134 missingDictionaries.emplace_back(
cl->GetName());
144 missingDictionaries.emplace_back(
name);
148 TClass* tClass = typeWithDict.
getClass();
149 if (tClass ==
nullptr) {
150 missingDictionaries.emplace_back(
name);
154 THashTable hashTable;
155 bool recursive =
true;
156 tClass->GetMissingDictionaries(hashTable, recursive);
160 for (
auto const&
item : hashTable) {
161 TClass
const*
cl =
static_cast<TClass
const*
>(
item);
162 missingDictionaries.emplace_back(
cl->GetName());
169 std::vector<std::string>& missingDictionaries,
171 std::sort(missingDictionaries.begin(), missingDictionaries.end());
172 missingDictionaries.erase(
std::unique(missingDictionaries.begin(), missingDictionaries.end()),
173 missingDictionaries.end());
175 std::ostringstream ostr;
176 for (
auto const&
item : missingDictionaries) {
177 ostr <<
" " <<
item <<
"\n";
179 exception <<
"No data dictionary found for the following classes:\n\n" 180 << ostr.str() <<
"\n" 181 <<
"Most likely each dictionary was never generated, but it may\n" 182 <<
"be that it was generated in the wrong package. Please add\n" 183 <<
"(or move) the specification \'<class name=\"whatever\"/>\' to\n" 184 <<
"the appropriate classes_def.xml file along with any other\n" 185 <<
"information needed there. For example, if this class has any\n" 186 <<
"transient members, you need to specify them in classes_def.xml.\n" 187 <<
"Also include the class header in classes.h\n";
195 std::vector<std::string>
empty;
201 std::vector<std::string>& producedTypes) {
205 if (!producedTypes.empty()) {
206 std::sort(producedTypes.begin(), producedTypes.end());
207 producedTypes.erase(
std::unique(producedTypes.begin(), producedTypes.end()), producedTypes.end());
209 std::ostringstream ostr;
210 for (
auto const&
item : producedTypes) {
211 ostr <<
" " <<
item <<
"\n";
213 exception <<
"\nA type listed above might or might not be the same as a\n" 214 <<
"type declared by a producer module with the function \'produces\'.\n" 215 <<
"Instead it might be the type of a data member, base class,\n" 216 <<
"wrapped type, or other object needed by a produced type. Below\n" 217 <<
"is some additional information which lists the types declared\n" 218 <<
"to be produced by a producer module that are associated with\n" 219 <<
"the types whose dictionaries were not found:\n\n" 220 << ostr.str() <<
"\n";
227 std::vector<std::string>& producedTypes,
229 bool fromStreamerSource) {
233 if (!producedTypes.empty()) {
234 std::sort(producedTypes.begin(), producedTypes.end());
235 producedTypes.erase(
std::unique(producedTypes.begin(), producedTypes.end()), producedTypes.end());
237 std::ostringstream ostr;
238 for (
auto const&
item : producedTypes) {
239 ostr <<
" " <<
item <<
"\n";
241 if (fromStreamerSource) {
242 exception <<
"\nA type listed above might or might not be the same as a\n" 243 <<
"type stored in the Event. Instead it might be the type of\n" 244 <<
"a data member, base class, wrapped type, or other object\n" 245 <<
"needed by a stored type. Below is some additional information\n" 246 <<
"which lists the stored types associated with the types whose\n" 247 <<
"dictionaries were not found:\n\n" 248 << ostr.str() <<
"\n";
250 exception <<
"\nA type listed above might or might not be the same as a\n" 251 <<
"type stored in the Event (or Lumi or Run). Instead it might\n" 252 <<
"be the type of a data member, base class, wrapped type, or\n" 253 <<
"other object needed by a stored type. Below is some additional\n" 254 <<
"information which lists the stored types associated with the\n" 255 <<
"types whose dictionaries were not found:\n\n" 256 << ostr.str() <<
"\n";
264 std::ostringstream ostr;
266 ostr <<
" " <<
item <<
"\n";
268 if (fromStreamerSource) {
269 exception <<
"Missing dictionaries are associated with these branch names:\n\n" << ostr.str() <<
"\n";
271 exception <<
"Missing dictionaries are associated with these branch names:\n\n" 272 << ostr.str() <<
"\n" 273 <<
"If you do not need these branches and they are not produced\n" 274 <<
"in the current process, an alternate solution to adding\n" 275 <<
"dictionaries is to drop these branches on input using the\n" 276 <<
"inputCommands parameter of the PoolSource.";
284 std::set<std::string>& producedTypes,
285 bool consumedWithView) {
289 if (!producedTypes.empty()) {
290 std::ostringstream ostr;
291 for (
auto const&
item : producedTypes) {
292 ostr <<
" " <<
item <<
"\n";
294 if (consumedWithView) {
295 exception <<
"\nThe list of types above was generated while checking for\n" 296 <<
"dictionaries related to products declared to be consumed\n" 297 <<
"using a View. They will be either the type or a base class\n" 298 <<
"of the type declared in a consumes declaration as the template\n" 299 <<
"parameter of a View. Below is some additional information\n" 300 <<
"which lists the type of the template parameter of the View.\n" 301 <<
"(It will be the same type unless the missing dictionary is\n" 302 <<
"for a base type):\n\n" 303 << ostr.str() <<
"\n";
305 exception <<
"\nThe list of types above was generated while checking for\n" 306 <<
"dictionaries related to products declared to be consumed.\n" 307 <<
"A type listed above might or might not be a type declared\n" 308 <<
"to be consumed. Instead it might be the type of a data member,\n" 309 <<
"base class, wrapped type or other object needed by a consumed\n" 310 <<
"type. Below is some additional information which lists\n" 311 <<
"the types declared to be consumed by a module and which\n" 312 <<
"are associated with the types whose dictionaries were not\n" 314 << ostr.str() <<
"\n";
322 std::vector<TypeID>& baseTypes) {
328 if (!typeWithDict.isClass()) {
334 if (TClassEdit::IsStdClass(typeWithDict.name().c_str())) {
339 bool returnValue =
true;
340 for (
auto const& basex : bases) {
342 if (!
base.isPublic()) {
355 baseTypes.push_back(baseType);
void throwMissingDictionariesException(std::vector< std::string > &missingDictionaries, std::string const &context)
bool public_base_classes(std::vector< std::string > &missingDictionaries, TypeID const &typeID, std::vector< TypeID > &baseTypes)
bool invalidTypeInfo() const
static TypeWithDict byName(std::string const &name)
bool checkDictionary(std::vector< std::string > &missingDictionaries, TypeID const &typeID)
def unique(seq, keepstr=True)
bool checkClassDictionaries(std::vector< std::string > &missingDictionaries, TypeID const &typeID)
std::string const & className() const
std::type_info const & typeInfo() const
std::string wrappedClassName(std::string const &iFullName)
bool search_all(ForwardSequence const &s, Datum const &d)
void addToMissingDictionariesException(edm::Exception &exception, std::vector< std::string > &missingDictionaries, std::string const &context)
TClass * getClass() const
bool hasDictionary(std::type_info const &)
bool checkDictionaryOfWrappedType(std::vector< std::string > &missingDictionaries, TypeID const &unwrappedTypeID)
constexpr const std::type_info & typeInfo() const