OSDN Git Service

method_pointer.hpp: 実装。NULLだったら例外投げるよ
authormyun2 <myun2@nwhite.info>
Wed, 11 Jul 2012 17:10:48 +0000 (02:10 +0900)
committermyun2 <myun2@nwhite.info>
Wed, 11 Jul 2012 17:11:06 +0000 (02:11 +0900)
roast/include/roast/_common.hpp
roast/include/roast/tp/method_pointer.hpp

index c0ef5b0..4f2f1cc 100644 (file)
@@ -7,6 +7,7 @@
 #define __SFJP_ROAST_roast__common_H__
 
 #include "roast_common.h"
+#include "roast/exception.hpp"
 //#include "roast/std/num_t.hpp"
 
 /////////////////////////////////
index 8fc79cb..2d6378b 100644 (file)
@@ -27,7 +27,13 @@ namespace roast
                method_pointer(method_pointer_type p) : class_ptr(0), ptr(p){}
                method_pointer(_Class *p_class, method_pointer_type p_func) : class_ptr(p_class), ptr(p_func){}
 
-               //call()
+               _Ret call(){
+                       if ( p_func == 0 )
+                               throw ::roast::exception("method_pointer::call() Not initialized function pointer.");
+                       if ( class_ptr == 0 )
+                               throw ::roast::exception("method_pointer::call() Not initialized class pointer.");
+                       return (class_ptr->*p_func)();
+               }
        };
        
        /////////////////////////////////////////////////////////////