Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:16:10

0001 #include "Fun4AllBase.h"
0002 
0003 #include <phool/phool.h>
0004 
0005 #include <cstdlib>
0006 #include <iostream>
0007 #include <string>
0008 
0009 Fun4AllBase::Fun4AllBase(const std::string& name)
0010   : m_ThisName(name)
0011 {
0012   if (name.empty())
0013   {
0014     std::cout << "Fun4AllBase::Fun4AllBase: No empty strings as Object Name" << std::endl;
0015     std::cout << "You likely create a module with an empty name in your macro" << std::endl;
0016     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;
0017     exit(1);
0018   }
0019   std::string validChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-";
0020   std::string badChars;
0021   for (char ch : name)
0022   {
0023     // Check if the character is not in the validChars string
0024     if (validChars.find(ch) == std::string::npos)
0025     {
0026       // Character is invalid, print it
0027       badChars += std::string("\"") + ch + std::string("\" ");
0028     }
0029   }
0030   if (!badChars.empty())
0031   {
0032     std::cout << PHWHERE << " Bad characters in modulename: " << badChars << std::endl;
0033     std::cout << "Change them to valid characters from this list: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-" << std::endl;
0034     exit(1);
0035   }
0036   return;
0037 }
0038 
0039 Fun4AllBase::~Fun4AllBase()
0040 {
0041   if (m_Verbosity >= VERBOSITY_MORE)
0042   {
0043     std::cout << "Deleting " << m_ThisName << std::endl;
0044   }
0045   return;
0046 }
0047 
0048 void Fun4AllBase::Print(const std::string& /*what*/) const
0049 {
0050   std::cout << Name() << " did not implement Print method" << std::endl;
0051   return;
0052 }