Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:49:29

0001 #pragma once
0002 /**
0003 S4.h
0004 =====
0005 
0006 After X4.hh
0007 
0008 **/
0009 #include <string>
0010 #include <cstring>
0011 
0012 struct S4
0013 {
0014     static constexpr const char* IMPLICIT_PREFIX = "Implicit_RINDEX_NoRINDEX_" ; 
0015 
0016     static const char* Name( const std::string& name );
0017     template<typename T> static const char* Name( const T* const obj );
0018 
0019     static std::string Strip( const std::string& name );
0020 
0021     static std::string ImplicitBorderSurfaceName_Debug( 
0022           const std::string& pv1, 
0023           const char* mat1, 
0024           const std::string& pv2,
0025           const char* mat2, 
0026           bool flip=false 
0027        ); 
0028 
0029     static std::string ImplicitBorderSurfaceName( 
0030           const std::string& pv1, 
0031           const std::string& pv2, 
0032           bool flip=false 
0033        );  
0034 };
0035 
0036 
0037 
0038 inline const char* S4::Name( const std::string& name )
0039 {
0040     return strdup( name.c_str() );
0041 }
0042 
0043 template<typename T>
0044 inline const char* S4::Name( const T* const obj )
0045 {    
0046     if(obj == nullptr) return nullptr ; 
0047     const std::string& name = obj->GetName();
0048     return Name(name);
0049 }
0050 
0051 
0052 inline std::string S4::Strip( const std::string& name )
0053 {
0054     std::string sname = name.substr(0, name.find("0x")) ;
0055     return sname ; 
0056 }
0057 
0058 inline std::string S4::ImplicitBorderSurfaceName_Debug( 
0059           const std::string& pv1, 
0060           const char* mat1, 
0061           const std::string& pv2,
0062           const char* mat2, 
0063           bool flip 
0064        )
0065 {
0066     std::string spv1 = Strip(pv1); 
0067     std::string spv2 = Strip(pv2); 
0068     std::stringstream ss ; 
0069     ss << "Implicit" ; 
0070  
0071     if( flip == false )
0072     {
0073         ss 
0074             << "__RINDEX__" << spv1 << "__" << mat1 
0075             << "__NoRINDEX__" << spv2 << "__" << mat2 
0076             ; 
0077     }
0078     else
0079     {
0080         ss 
0081             << "__RINDEX__" << spv2 << "__" << mat2 
0082             << "__NoRINDEX__" << spv1 << "__" << mat1 
0083             ; 
0084     } 
0085     std::string str = ss.str();
0086     return str ; 
0087 }
0088 
0089 
0090 inline std::string S4::ImplicitBorderSurfaceName( 
0091           const std::string& pv1, 
0092           const std::string& pv2,
0093           bool flip 
0094        )
0095 {
0096     std::string spv1 = Strip(pv1); 
0097     std::string spv2 = Strip(pv2); 
0098     std::stringstream ss ; 
0099     ss << IMPLICIT_PREFIX ; 
0100     if( flip == false )
0101     {
0102         ss << spv1 << "_" << spv2 ; 
0103     }
0104     else
0105     {
0106         ss << spv2 << "_" << spv1 ;
0107     } 
0108     std::string str = ss.str();
0109     return str ; 
0110 }