inlib  1.2.0
/Users/barrand/private/dev/softinex/old/inexlib-1.2/inlib/inlib/safe_cast
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_safe_cast
00005 #define inlib_safe_cast
00006 
00007 namespace inlib {
00008 
00009 template <class FROM,class TO>
00010 inline TO* cast(FROM& a_o) {
00011   return (TO*)a_o.cast(TO::s_class());
00012 }
00013 
00014 template <class FROM,class TO>
00015 inline const TO* cast(const FROM& a_o) {
00016   return (const TO*)a_o.cast(TO::s_class());
00017 }
00018 
00019 typedef unsigned short cid; //in typedefs ?
00020 
00021 template <class FROM,class TO>
00022 inline TO* id_cast(FROM& a_o) {
00023   return (TO*)a_o.cast(TO::id_class());
00024 }
00025 
00026 template <class FROM,class TO>
00027 inline const TO* id_cast(const FROM& a_o) {
00028   return (const TO*)a_o.cast(TO::id_class());
00029 }
00030 
00031 }
00032 
00033 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines