12 #ifndef SPROCKIT_COMMON_PTR_TYPE_H_INCLUDED 13 #define SPROCKIT_COMMON_PTR_TYPE_H_INCLUDED 17 class simple_ptr_type;
60 to_string()
const = 0;
63 template <
class Out,
class In>
69 const char* error_msg =
"error")
74 "%s: failed to cast to %s at %s:%d - %s",
75 error_msg, objname, file, line,
76 (in ?
"wrong type" :
"null object"));
85 #define ptr_safe_cast(type,...) \ 86 ::sprockit::__safe_ptr_cast__<type>(#type, __FILE__, __LINE__, __VA_ARGS__) 88 #define ptr_interface_cast(type,obj) \ 89 dynamic_cast<type*>(obj.get()) 91 #define ptr_static_cast(type,obj) \ 92 static_cast<type*>(obj.get()) 94 #define ptr_test_cast(type, obj) \ 95 dynamic_cast<type*>(obj.get()) 97 #define ptr_known_cast(type,...) \ 98 ptr_safe_cast(type, __VA_ARGS__)
#define ref_decrement_return(refcount)
sprockit::refcount_ptr< Out > __safe_ptr_cast__(const char *objname, const char *file, int line, const sprockit::refcount_ptr< In > &in, const char *error_msg="error")
#define spkt_throw_printf(exc, template_str,...)
#define ref_increment(refcount)
Error indicating some internal value was unexpected.