inlib  1.2.0
/Users/barrand/private/dev/softinex/old/inexlib-1.2/inlib/inlib/scast
Go to the documentation of this file.
00001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
00002 // See the file inlib.license for terms.
00003 
00004 #ifndef inlib_scast
00005 #define inlib_scast
00006 
00007 // For implementations of cast methods.
00008 
00009 #include "safe_cast"
00010 #include "rcmp"
00011 
00012 namespace inlib {
00013 
00014 template <class TO>
00015 inline void* cmp_cast(const TO* a_this,const std::string& a_class) {
00016   if(!inlib::rcmp(a_class,TO::s_class())) return 0;
00017   return (void*)static_cast<const TO*>(a_this);
00018 }
00019 
00020 template <class TO>
00021 inline void* cmp_cast(const TO* a_this,cid a_id) {
00022   if(TO::id_class()!=a_id) return 0;
00023   return (void*)static_cast<const TO*>(a_this);
00024 }
00025 
00026 }
00027 
00028 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines