File indexing completed on 2026-04-09 07:49:37
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #include <cstring>
0021 #include <string>
0022 #include <sstream>
0023 #include <algorithm>
0024 #include "SSys.hh"
0025 #include "SGDML.hh"
0026
0027 std::string SGDML::GenerateName(const char* name, const void* const ptr, bool addPointerToName )
0028 {
0029
0030
0031 std::stringstream ss;
0032 ss << name;
0033 if(addPointerToName) ss << ptr ;
0034 std::string nameOut = ss.str();
0035
0036 if(nameOut.find(' ') != std::string::npos)
0037 nameOut.erase(std::remove(nameOut.begin(),nameOut.end(),' '),nameOut.end());
0038
0039
0040
0041
0042
0043
0044 return nameOut;
0045 }
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059 const char* SGDML::PREFIX(const char* ekey)
0060 {
0061 const char* prefix = nullptr ;
0062 if( strcmp(ekey, "OPTICKS_SGDML_PREFIX_G4Material") == 0 )
0063 {
0064 prefix = SSys::getenvvar(ekey, "_dd_Materials_") ;
0065 }
0066 return prefix ;
0067 }
0068
0069
0070
0071 std::string SGDML::Strip(const std::string& name)
0072 {
0073 std::string sname = name.substr(0, name.find("0x")) ;
0074 return sname ;
0075 }
0076
0077
0078 std::string SGDML::Strip(const char* name_)
0079 {
0080 std::string name(name_);
0081 std::string sname = name.substr(0, name.find("0x")) ;
0082 return sname ;
0083 }
0084
0085
0086
0087
0088
0089