diff options
author | Sven Gothel <[email protected]> | 2022-05-09 01:15:15 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2022-05-09 01:15:15 +0200 |
commit | 236d681664f2309a99c72dc8598c516adf5189ff (patch) | |
tree | 8507c180cb1eecaffe2d988bba6a11cb5f116706 /include/jau/java_uplink.hpp | |
parent | 2e2b863b6f354b649f8dac181fa44ffe79b80afa (diff) |
Use JavaUplinkRef typedef of share_ptr<JavaUplink> and pass 'const JavaUplinkRef&' if possible
Diffstat (limited to 'include/jau/java_uplink.hpp')
-rw-r--r-- | include/jau/java_uplink.hpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/include/jau/java_uplink.hpp b/include/jau/java_uplink.hpp index df90b6d..e84577c 100644 --- a/include/jau/java_uplink.hpp +++ b/include/jau/java_uplink.hpp @@ -52,6 +52,7 @@ namespace jau { virtual ~JavaAnon() noexcept { } virtual std::string toString() const noexcept { return "JavaAnon[???]"; } }; + typedef std::shared_ptr<JavaAnon> JavaAnonRef; /** * Sharing the anonymous Java object (JavaAnon), @@ -59,7 +60,7 @@ namespace jau { */ class JavaUplink { private: - std::shared_ptr<JavaAnon> javaObjectRef; + JavaAnonRef javaObjectRef; public: virtual std::string toString() const noexcept { return "JavaUplink["+jau::to_hexstring(this)+"]"; } @@ -75,10 +76,10 @@ namespace jau { return javaObjectRef->toString(); } - std::shared_ptr<JavaAnon> getJavaObject() noexcept { return javaObjectRef; } + const JavaAnonRef& getJavaObject() noexcept { return javaObjectRef; } /** Assigns a new shared JavaAnon reference, replaced item might be deleted via JNI from dtor */ - void setJavaObject(std::shared_ptr<JavaAnon> objRef) noexcept { javaObjectRef = objRef; } + void setJavaObject(const JavaAnonRef& objRef) noexcept { javaObjectRef = objRef; } /** Resets the shared JavaAnon reference, the replaced item might be deleted via JNI from dtor */ void setJavaObject() noexcept { javaObjectRef.reset(); } @@ -94,6 +95,7 @@ namespace jau { javaObjectRef = nullptr; } }; + typedef std::shared_ptr<JavaUplink> JavaUplinkRef; /**@}*/ |