From c354ad89e3a36af2a8e84ac1f68dbd60dde14ebd Mon Sep 17 00:00:00 2001 From: myun2 Date: Thu, 12 Jul 2012 02:10:48 +0900 Subject: [PATCH] =?utf8?q?method=5Fpointer.hpp:=20=E5=AE=9F=E8=A3=85?= =?utf8?q?=E3=80=82NULL=E3=81=A0=E3=81=A3=E3=81=9F=E3=82=89=E4=BE=8B?= =?utf8?q?=E5=A4=96=E6=8A=95=E3=81=92=E3=82=8B=E3=82=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- roast/include/roast/_common.hpp | 1 + roast/include/roast/tp/method_pointer.hpp | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/roast/include/roast/_common.hpp b/roast/include/roast/_common.hpp index c0ef5b01..4f2f1cc1 100644 --- a/roast/include/roast/_common.hpp +++ b/roast/include/roast/_common.hpp @@ -7,6 +7,7 @@ #define __SFJP_ROAST_roast__common_H__ #include "roast_common.h" +#include "roast/exception.hpp" //#include "roast/std/num_t.hpp" ///////////////////////////////// diff --git a/roast/include/roast/tp/method_pointer.hpp b/roast/include/roast/tp/method_pointer.hpp index 8fc79cb6..2d6378b1 100644 --- a/roast/include/roast/tp/method_pointer.hpp +++ b/roast/include/roast/tp/method_pointer.hpp @@ -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)(); + } }; ///////////////////////////////////////////////////////////// -- 2.11.0