Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/Geant4/tools/scast is written in an unsupported language. File is not indexed.

0001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
0002 // See the file tools.license for terms.
0003 
0004 #ifndef tools_scast
0005 #define tools_scast
0006 
0007 // For implementations of cast methods.
0008 
0009 #include "safe_cast"
0010 #include "rcmp"
0011 
0012 namespace tools {
0013 
0014 template <class TO>
0015 inline void* cmp_cast(const TO* a_this,const std::string& a_class) {
0016   if(!rcmp(a_class,TO::s_class())) return 0;
0017   return (void*)static_cast<const TO*>(a_this);
0018 }
0019 
0020 template <class TO>
0021 inline void* cmp_cast(const TO* a_this,cid a_id) {
0022   if(TO::id_class()!=a_id) return 0;
0023   return (void*)static_cast<const TO*>(a_this);
0024 }
0025 
0026 }
0027 
0028 #endif