-
Notifications
You must be signed in to change notification settings - Fork 184
/
Fun4AllBase.cc
52 lines (47 loc) · 1.51 KB
/
Fun4AllBase.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include "Fun4AllBase.h"
#include <phool/phool.h>
#include <cstdlib>
#include <iostream>
#include <string>
Fun4AllBase::Fun4AllBase(const std::string& name)
: m_ThisName(name)
{
if (name.empty())
{
std::cout << "Fun4AllBase::Fun4AllBase: No empty strings as Object Name" << std::endl;
std::cout << "You likely create a module with an empty name in your macro" << std::endl;
std::cout << "Since it does not have a name I cannot tell you what it is, but this message is from its ctor, so it happens when you do a new XXX() in your macro" << std::endl;
exit(1);
}
std::string validChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-";
std::string badChars;
for (char ch : name)
{
// Check if the character is not in the validChars string
if (validChars.find(ch) == std::string::npos)
{
// Character is invalid, print it
badChars += std::string("\"") + ch + std::string("\" ");
}
}
if (!badChars.empty())
{
std::cout << PHWHERE << " Bad characters in modulename: " << badChars << std::endl;
std::cout << "Change them to valid characters from this list: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-" << std::endl;
exit(1);
}
return;
}
Fun4AllBase::~Fun4AllBase()
{
if (m_Verbosity >= VERBOSITY_MORE)
{
std::cout << "Deleting " << m_ThisName << std::endl;
}
return;
}
void Fun4AllBase::Print(const std::string& /*what*/) const
{
std::cout << Name() << " did not implement Print method" << std::endl;
return;
}