3 #ifndef GEODE_SHAREDPTRHELPER_H_
4 #define GEODE_SHAREDPTRHELPER_H_
23 #include "geode_globals.hpp"
24 #include "TypeHelper.hpp"
37 static void throwNullPointerException(
const char* ename);
39 static void throwClassCastException(
const char* msg,
const char* fromType,
45 template <
class Target,
class Src>
46 Target* getTargetHelper(Src* ptr,
47 apache::geode::client::TypeHelper::yes_type yes) {
53 template <
class Target,
class Src>
54 Target* getTargetHelper(Src* ptr,
55 apache::geode::client::TypeHelper::no_type no) {
56 Target* tptr = dynamic_cast<Target*>(ptr);
60 SPEHelper::throwClassCastException(
"getTargetHelper: cast failed",
61 typeid(ptr).name(),
typeid(tptr).name());
68 template <
class Target,
class Src>
69 Target* getTarget(Src* ptr) {
70 return getTargetHelper<Target>(ptr, GF_SRC_IS_TARGET_TYPE(Target, Src));
76 SharedBase* getSB(Src* ptr) {
77 return getTarget<SharedBase>(ptr);
83 #endif // GEODE_SHAREDPTRHELPER_H_