http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/CacheableBuiltins.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/include/geode/CacheableBuiltins.hpp b/src/cppcache/include/geode/CacheableBuiltins.hpp index 610225e..3abbab3 100644 --- a/src/cppcache/include/geode/CacheableBuiltins.hpp +++ b/src/cppcache/include/geode/CacheableBuiltins.hpp @@ -139,10 +139,6 @@ class CacheableKeyType : public CacheableKey { virtual uint32_t objectSize() const { return sizeof(CacheableKeyType); } }; -// Forward declaration for SharedArrayPtr -template <typename TObj, int8_t TYPEID> -class SharedArrayPtr; - /** Function to copy an array from source to destination. */ template <typename TObj> inline void copyArray(TObj* dest, const TObj* src, int32_t length) { @@ -201,6 +197,8 @@ class CacheableArrayType : public Cacheable { virtual ~CacheableArrayType() { GF_SAFE_DELETE_ARRAY(m_value); } + FRIEND_STD_SHARED_PTR(CacheableArrayType) + private: // Private to disable copy constructor and assignment operator. CacheableArrayType(const CacheableArrayType& other) @@ -271,52 +269,6 @@ class CacheableArrayType : public Cacheable { } }; -/** - * Template class for CacheableArrayType SharedPtr's that adds [] operator - */ -template <typename TObj, int8_t TYPEID> -class SharedArrayPtr : public SharedPtr<CacheableArrayType<TObj, TYPEID> > { - private: - typedef CacheableArrayType<TObj, TYPEID> TArray; - - public: - /** Default constructor. */ - inline SharedArrayPtr() : SharedPtr<CacheableArrayType<TObj, TYPEID> >() {} - - /** Constructor, given a pointer to array. */ - inline SharedArrayPtr(const TArray* ptr) - : SharedPtr<CacheableArrayType<TObj, TYPEID> >(ptr) {} - - /** Constructor, given a null SharedBase. */ - inline SharedArrayPtr(const NullSharedBase* ptr) - : SharedPtr<CacheableArrayType<TObj, TYPEID> >(ptr) {} - - /** Constructor, given another SharedArrayPtr. */ - inline SharedArrayPtr(const SharedArrayPtr& other) - : SharedPtr<CacheableArrayType<TObj, TYPEID> >(other) {} - - /** Constructor, given another kind of SharedArrayPtr. */ - template <typename TOther, int8_t OTHERID> - inline SharedArrayPtr(const SharedArrayPtr<TOther, OTHERID>& other) - : SharedPtr<CacheableArrayType<TObj, TYPEID> >(other) {} - - /** Constructor, given another SharedPtr. */ - template <typename TOther> - inline SharedArrayPtr(const SharedPtr<TOther>& other) - : SharedPtr<CacheableArrayType<TObj, TYPEID> >(other) {} - - /** Get the element at given index. */ - inline TObj operator[](uint32_t index) const { - return SharedPtr<CacheableArrayType<TObj, TYPEID> >::ptr()->operator[]( - index); - } - - /** Deserialize self */ - inline Serializable* fromData(DataInput& input) { - return SharedPtr<CacheableArrayType<TObj, TYPEID> >::ptr()->fromData(input); - } -}; - /** Template class for container Cacheable types. */ template <typename TBase, int8_t TYPEID> class CacheableContainerType : public Cacheable, public TBase { @@ -368,7 +320,7 @@ class CacheableContainerType : public Cacheable, public TBase { sizeof(CacheableContainerType) + apache::geode::client::serializer::objectSize(*this)); } -}; + }; #ifdef _SOLARIS #define TEMPLATE_EXPORT template class @@ -400,15 +352,16 @@ class CacheableContainerType : public Cacheable, public TBase { protected: \ inline k() : _##k() {} \ inline k(const p value) : _##k(value) {} \ + FRIEND_STD_SHARED_PTR(k) \ \ public: \ /** Factory function registered with serialization registry. */ \ static Serializable* createDeserializable() { return new k(); } \ /** Factory function to create a new default instance. */ \ - inline static k##Ptr create() { return k##Ptr(new k()); } \ + inline static k##Ptr create() { return std::make_shared<k>(); } \ /** Factory function to create an instance with the given value. */ \ inline static k##Ptr create(const p value) { \ - return k##Ptr(new k(value)); \ + return std::make_shared<k>(value); \ } \ }; \ inline CacheableKeyPtr createKey(const p value) { return k::create(value); } \ @@ -435,18 +388,21 @@ class CacheableContainerType : public Cacheable, public TBase { c(const c& other); \ c& operator=(const c& other); \ \ + FRIEND_STD_SHARED_PTR(c) \ + \ public: \ /** Factory function registered with serialization registry. */ \ static Serializable* createDeserializable() { return new c(); } \ /** Factory function to create a new default instance. */ \ - inline static c##Ptr create() { return c##Ptr(new c()); } \ + inline static c##Ptr create() { return std::make_shared<c>(); } \ /** Factory function to create a cacheable array of given size. */ \ inline static c##Ptr create(int32_t length) { \ - return c##Ptr(new c(length)); \ + return std::make_shared<c>(length); \ } \ /** Create a cacheable array copying from the given array. */ \ inline static c##Ptr create(const p* value, int32_t length) { \ - return (value != NULL ? c##Ptr(new c(value, length, true)) : NULLPTR); \ + return nullptr == value ? nullptr \ + : std::make_shared<c>(value, length, true); \ } \ /** \ \ * \ \ @@ -471,7 +427,7 @@ class CacheableContainerType : public Cacheable, public TBase { * \ \ \ */ \ inline static c##Ptr createNoCopy(p* value, int32_t length) { \ - return (value != NULL ? c##Ptr(new c(value, length)) : NULLPTR); \ + return nullptr == value ? nullptr : std::make_shared<c>(value, length); \ } \ }; @@ -482,21 +438,25 @@ class CacheableContainerType : public Cacheable, public TBase { typedef SharedPtr<c> c##Ptr; // use a class instead of typedef for bug #283 -#define _GF_CACHEABLE_CONTAINER_TYPE_(p, c) \ - class CPPCACHE_EXPORT c : public _##c { \ - protected: \ - inline c() : _##c() {} \ - inline c(const int32_t n) : _##c(n) {} \ - \ - public: \ - /** Iterator for this type. */ \ - typedef p::Iterator Iterator; \ - /** Factory function registered with serialization registry. */ \ - static Serializable* createDeserializable() { return new c(); } \ - /** Factory function to create a default instance. */ \ - inline static c##Ptr create() { return c##Ptr(new c()); } \ - /** Factory function to create an instance with the given size. */ \ - inline static c##Ptr create(const int32_t n) { return c##Ptr(new c(n)); } \ +#define _GF_CACHEABLE_CONTAINER_TYPE_(p, c) \ + class CPPCACHE_EXPORT c : public _##c { \ + protected: \ + inline c() : _##c() {} \ + inline c(const int32_t n) : _##c(n) {} \ + \ + FRIEND_STD_SHARED_PTR(c) \ + \ + public: \ + /** Iterator for this type. */ \ + typedef p::Iterator Iterator; \ + /** Factory function registered with serialization registry. */ \ + static Serializable* createDeserializable() { return new c(); } \ + /** Factory function to create a default instance. */ \ + inline static c##Ptr create() { return std::make_shared<c>(); } \ + /** Factory function to create an instance with the given size. */ \ + inline static c##Ptr create(const int32_t n) { \ + return std::make_shared<c>(n); \ + } \ }; // Instantiations for the built-in CacheableKeys
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/CacheableDate.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/include/geode/CacheableDate.hpp b/src/cppcache/include/geode/CacheableDate.hpp index 1eed4dc..3af1884 100644 --- a/src/cppcache/include/geode/CacheableDate.hpp +++ b/src/cppcache/include/geode/CacheableDate.hpp @@ -131,20 +131,18 @@ class CPPCACHE_EXPORT CacheableDate : public CacheableKey { /** * Factory method for creating an instance of CacheableDate */ - static CacheableDatePtr create() { - return CacheableDatePtr(new CacheableDate()); - } + static CacheableDatePtr create() { return std::make_shared<CacheableDate>(); } static CacheableDatePtr create(const time_t& value) { - return CacheableDatePtr(new CacheableDate(value)); + return std::make_shared<CacheableDate>(value); } static CacheableDatePtr create(const time_point& value) { - return CacheableDatePtr(new CacheableDate(value)); + return std::make_shared<CacheableDate>(value); } static CacheableDatePtr create(const duration& value) { - return CacheableDatePtr(new CacheableDate(value)); + return std::make_shared<CacheableDate>(value); } virtual CacheableStringPtr toString() const; @@ -173,14 +171,16 @@ class CPPCACHE_EXPORT CacheableDate : public CacheableKey { // never implemented. void operator=(const CacheableDate& other); CacheableDate(const CacheableDate& other); + + FRIEND_STD_SHARED_PTR(CacheableDate) }; inline CacheableKeyPtr createKey(const CacheableDate::time_point& value) { - return CacheableKeyPtr(CacheableDate::create(value)); + return CacheableDate::create(value); } inline CacheablePtr createValue(const CacheableDate::time_point& value) { - return CacheablePtr(CacheableDate::create(value)); + return CacheableDate::create(value); } } // namespace client http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/CacheableEnum.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/include/geode/CacheableEnum.hpp b/src/cppcache/include/geode/CacheableEnum.hpp index 50817f4..1967fe9 100644 --- a/src/cppcache/include/geode/CacheableEnum.hpp +++ b/src/cppcache/include/geode/CacheableEnum.hpp @@ -110,8 +110,7 @@ class CPPCACHE_EXPORT CacheableEnum : public CacheableKey { */ static CacheableEnumPtr create(const char* enumClassName, const char* enumName, int32_t ordinal) { - CacheableEnumPtr str(new CacheableEnum(enumClassName, enumName, ordinal)); - return str; + return std::make_shared<CacheableEnum>(enumClassName, enumName, ordinal); } /**@return enum class name. */ @@ -138,6 +137,8 @@ class CPPCACHE_EXPORT CacheableEnum : public CacheableKey { // never implemented. void operator=(const CacheableEnum& other); CacheableEnum(const CacheableEnum& other); + + FRIEND_STD_SHARED_PTR(CacheableEnum) }; } // namespace client } // namespace geode http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/CacheableFileName.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/include/geode/CacheableFileName.hpp b/src/cppcache/include/geode/CacheableFileName.hpp index e17bd23..70ae217 100644 --- a/src/cppcache/include/geode/CacheableFileName.hpp +++ b/src/cppcache/include/geode/CacheableFileName.hpp @@ -75,9 +75,9 @@ class CPPCACHE_EXPORT CacheableFileName : public CacheableString { * C string optionally given the length. */ static CacheableFileNamePtr create(const char* value, int32_t len = 0) { - CacheableFileNamePtr str = NULLPTR; + CacheableFileNamePtr str = nullptr; if (value != NULL) { - str = new CacheableFileName(); + str = std::make_shared<CacheableFileName>(); str->initString(value, len); } return str; @@ -88,9 +88,9 @@ class CPPCACHE_EXPORT CacheableFileName : public CacheableString { * wide-character C string optionally given the length. */ static CacheableFileNamePtr create(const wchar_t* value, int32_t len = 0) { - CacheableFileNamePtr str = NULLPTR; + CacheableFileNamePtr str = nullptr; if (value != NULL) { - str = new CacheableFileName(); + str = std::make_shared<CacheableFileName>(); str->initString(value, len); } return str; @@ -103,6 +103,8 @@ class CPPCACHE_EXPORT CacheableFileName : public CacheableString { virtual int32_t hashcode() const; protected: + FRIEND_STD_SHARED_PTR(CacheableFileName) + /** Default constructor. */ inline CacheableFileName() : CacheableString(), m_hashcode(0) {} http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/CacheableKey.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/include/geode/CacheableKey.hpp b/src/cppcache/include/geode/CacheableKey.hpp index e8cfc36..ae5e1e3 100644 --- a/src/cppcache/include/geode/CacheableKey.hpp +++ b/src/cppcache/include/geode/CacheableKey.hpp @@ -41,6 +41,8 @@ class CPPCACHE_EXPORT CacheableKey : public Cacheable { /** Destructor */ virtual ~CacheableKey() {} + FRIEND_STD_SHARED_PTR(CacheableKey) + public: /** return true if this key matches other. */ virtual bool operator==(const CacheableKey& other) const = 0; http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/CacheableObjectArray.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/include/geode/CacheableObjectArray.hpp b/src/cppcache/include/geode/CacheableObjectArray.hpp index 50a161b..b97ac25 100644 --- a/src/cppcache/include/geode/CacheableObjectArray.hpp +++ b/src/cppcache/include/geode/CacheableObjectArray.hpp @@ -75,7 +75,7 @@ class CPPCACHE_EXPORT CacheableObjectArray : public Cacheable, * Factory method for creating the default instance of CacheableObjectArray. */ inline static CacheableObjectArrayPtr create() { - return CacheableObjectArrayPtr(new CacheableObjectArray()); + return std::make_shared<CacheableObjectArray>(); } /** @@ -83,7 +83,7 @@ class CPPCACHE_EXPORT CacheableObjectArray : public Cacheable, * given size. */ inline static CacheableObjectArrayPtr create(int32_t n) { - return CacheableObjectArrayPtr(new CacheableObjectArray(n)); + return std::make_shared<CacheableObjectArray>(n); } virtual uint32_t objectSize() const; @@ -98,6 +98,8 @@ class CPPCACHE_EXPORT CacheableObjectArray : public Cacheable, // never implemented. CacheableObjectArray& operator=(const CacheableObjectArray& other); CacheableObjectArray(const CacheableObjectArray& other); + + FRIEND_STD_SHARED_PTR(CacheableObjectArray) }; } // namespace client } // namespace geode http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/CacheableString.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/include/geode/CacheableString.hpp b/src/cppcache/include/geode/CacheableString.hpp index dc1a926..9a754b9 100644 --- a/src/cppcache/include/geode/CacheableString.hpp +++ b/src/cppcache/include/geode/CacheableString.hpp @@ -49,6 +49,8 @@ class CPPCACHE_EXPORT CacheableString : public CacheableKey { uint32_t m_len; mutable int m_hashcode; + FRIEND_STD_SHARED_PTR(CacheableString) + public: /** *@brief serialize this object @@ -111,11 +113,12 @@ class CPPCACHE_EXPORT CacheableString : public CacheableKey { * This should be used only for ASCII strings. */ static CacheableStringPtr create(const char* value, int32_t len = 0) { - CacheableStringPtr str = NULLPTR; - if (value != NULL) { - str = new CacheableString(); - str->initString(value, len); + if (nullptr == value) { + return nullptr; } + + CacheableStringPtr str = std::make_shared<CacheableString>(); + str->initString(value, len); return str; } @@ -130,11 +133,12 @@ class CPPCACHE_EXPORT CacheableString : public CacheableKey { * CAUTION: use this only when you really know what you are doing. */ static CacheableStringPtr createNoCopy(char* value, int32_t len = 0) { - CacheableStringPtr str = NULLPTR; - if (value != NULL) { - str = new CacheableString(); - str->initStringNoCopy(value, len); + if (nullptr == value) { + return nullptr; } + + CacheableStringPtr str = std::make_shared<CacheableString>(); + str->initStringNoCopy(value, len); return str; } @@ -145,11 +149,12 @@ class CPPCACHE_EXPORT CacheableString : public CacheableKey { * This should be used for non-ASCII strings. */ static CacheableStringPtr create(const wchar_t* value, int32_t len = 0) { - CacheableStringPtr str = NULLPTR; - if (value != NULL) { - str = new CacheableString(); - str->initString(value, len); + if (nullptr == value) { + return nullptr; } + + CacheableStringPtr str = std::make_shared<CacheableString>(); + str->initString(value, len); return str; } @@ -164,11 +169,12 @@ class CPPCACHE_EXPORT CacheableString : public CacheableKey { * CAUTION: use this only when you really know what you are doing. */ static CacheableStringPtr createNoCopy(wchar_t* value, int32_t len = 0) { - CacheableStringPtr str = NULLPTR; - if (value != NULL) { - str = new CacheableString(); - str->initStringNoCopy(value, len); + if (nullptr == value) { + return nullptr; } + + CacheableStringPtr str = std::make_shared<CacheableString>(); + str->initStringNoCopy(value, len); return str; } @@ -235,7 +241,9 @@ class CPPCACHE_EXPORT CacheableString : public CacheableKey { const char* toString() { return reinterpret_cast<const char*>(m_str); } virtual CacheableStringPtr toString() const { - return CacheableStringPtr(this); + // TODO this cast seems odd + return std::const_pointer_cast<CacheableString>( + std::static_pointer_cast<const CacheableString>(shared_from_this())); } /** get the name of the class of this object for logging purpose */ @@ -282,26 +290,22 @@ class CPPCACHE_EXPORT CacheableString : public CacheableKey { /** overload of apache::geode::client::createKeyArr to pass char* */ inline CacheableKeyPtr createKeyArr(const char* value) { - return (value != NULL ? CacheableKeyPtr(CacheableString::create(value).ptr()) - : NULLPTR); + return CacheableString::create(value); } /** overload of apache::geode::client::createKeyArr to pass wchar_t* */ inline CacheableKeyPtr createKeyArr(const wchar_t* value) { - return (value != NULL ? CacheableKeyPtr(CacheableString::create(value).ptr()) - : NULLPTR); + return CacheableString::create(value); } /** overload of apache::geode::client::createValueArr to pass char* */ inline CacheablePtr createValueArr(const char* value) { - return (value != NULL ? CacheablePtr(CacheableString::create(value).ptr()) - : NULLPTR); + return CacheableString::create(value); } /** overload of apache::geode::client::createValueArr to pass wchar_t* */ inline CacheablePtr createValueArr(const wchar_t* value) { - return (value != NULL ? CacheablePtr(CacheableString::create(value).ptr()) - : NULLPTR); + return CacheableString::create(value); } } // namespace client } // namespace geode http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/CacheableUndefined.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/include/geode/CacheableUndefined.hpp b/src/cppcache/include/geode/CacheableUndefined.hpp index 706c9b4..40b5d5a 100644 --- a/src/cppcache/include/geode/CacheableUndefined.hpp +++ b/src/cppcache/include/geode/CacheableUndefined.hpp @@ -77,7 +77,7 @@ class CPPCACHE_EXPORT CacheableUndefined : public Cacheable { * Factory method for creating the default instance of CacheableUndefined. */ inline static CacheableUndefinedPtr create() { - return CacheableUndefinedPtr(new CacheableUndefined()); + return std::make_shared<CacheableUndefined>(); } virtual uint32_t objectSize() const; @@ -90,6 +90,8 @@ class CPPCACHE_EXPORT CacheableUndefined : public Cacheable { // never implemented. CacheableUndefined& operator=(const CacheableUndefined& other); CacheableUndefined(const CacheableUndefined& other); + + FRIEND_STD_SHARED_PTR(CacheableUndefined) }; } // namespace client } // namespace geode http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/CqAttributes.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/include/geode/CqAttributes.hpp b/src/cppcache/include/geode/CqAttributes.hpp index d63af8a..97bf72c 100644 --- a/src/cppcache/include/geode/CqAttributes.hpp +++ b/src/cppcache/include/geode/CqAttributes.hpp @@ -22,7 +22,7 @@ #include "geode_globals.hpp" #include "geode_types.hpp" -#include "VectorT.hpp" +#include <vector> #include "CqListener.hpp" /** @@ -49,13 +49,15 @@ namespace client { */ class CPPCACHE_EXPORT CqAttributes : virtual public SharedBase { public: + typedef std::vector<std::shared_ptr<CqListener>> listener_container_type; + /** * Get the CqListeners set with the CQ. * Returns all the Listeners associated with this CQ. * @see CqListener - * @return VectorOfCqListener of CqListnerPtr + * @param[out] std::vector<CqListenerPtr> of CqListnerPtr */ - virtual void getCqListeners(VectorOfCqListener& vl) = 0; + virtual void getCqListeners(listener_container_type& vl) = 0; }; } // namespace client } // namespace geode http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/CqAttributesFactory.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/include/geode/CqAttributesFactory.hpp b/src/cppcache/include/geode/CqAttributesFactory.hpp index 5594135..e0d51d6 100644 --- a/src/cppcache/include/geode/CqAttributesFactory.hpp +++ b/src/cppcache/include/geode/CqAttributesFactory.hpp @@ -70,12 +70,12 @@ class CPPCACHE_EXPORT CqAttributesFactory : public SharedBase { * the <code>CqAttributes</code> used to initialize this * AttributesFactory */ - CqAttributesFactory(CqAttributesPtr& cqAttributes); + CqAttributesFactory(const CqAttributesPtr& cqAttributes); /** * Adds a CQ listener to the end of the list of cq listeners on this factory. * @param cqListener the CqListener to add to the factory. - * @throws IllegalArgumentException if <code>cqListener</code> is NULLPTR + * @throws IllegalArgumentException if <code>cqListener</code> is nullptr */ void addCqListener(const CqListenerPtr& cqListener); @@ -86,9 +86,9 @@ class CPPCACHE_EXPORT CqAttributesFactory : public SharedBase { * factory. * @throws IllegalArgumentException if the <code>cqListeners</code> array has * a - * NULLPTR element + * nullptr element */ - void initCqListeners(VectorOfCqListener& cqListeners); + void initCqListeners(const std::vector<CqListenerPtr>& cqListeners); /** * Creates a <code>CqAttributes</code> with the current settings. http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/CqAttributesMutator.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/include/geode/CqAttributesMutator.hpp b/src/cppcache/include/geode/CqAttributesMutator.hpp index 2157760..97cec1a 100644 --- a/src/cppcache/include/geode/CqAttributesMutator.hpp +++ b/src/cppcache/include/geode/CqAttributesMutator.hpp @@ -45,7 +45,7 @@ class CPPCACHE_EXPORT CqAttributesMutator : virtual public SharedBase { /** * Adds a CQ listener to the end of the list of CQ listeners on this CqQuery. * @param aListener the user defined CQ listener to add to the CqQuery. - * @throws IllegalArgumentException if <code>aListener</code> is NULLPTR + * @throws IllegalArgumentException if <code>aListener</code> is nullptr */ virtual void addCqListener(const CqListenerPtr& aListener) = 0; @@ -55,7 +55,7 @@ class CPPCACHE_EXPORT CqAttributesMutator : virtual public SharedBase { * If the specified listener has been added then will * be called on it; otherwise does nothing. * @param aListener the CQ listener to remove from the CqQuery. - * @throws IllegalArgumentException if <code>aListener</code> is NULLPTR + * @throws IllegalArgumentException if <code>aListener</code> is nullptr */ virtual void removeCqListener(const CqListenerPtr& aListener) = 0; @@ -66,9 +66,10 @@ class CPPCACHE_EXPORT CqAttributesMutator : virtual public SharedBase { * @param newListeners a possibly empty array of listeners to add * to this CqQuery. * @throws IllegalArgumentException if the <code>newListeners</code> array - * has a NULLPTR element + * has a nullptr element */ - virtual void setCqListeners(VectorOfCqListener& newListeners) = 0; + virtual void setCqListeners( + const std::vector<CqListenerPtr>& newListeners) = 0; }; } // namespace client } // namespace geode http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/CqEvent.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/include/geode/CqEvent.hpp b/src/cppcache/include/geode/CqEvent.hpp index 8577cbd..283e0f3 100644 --- a/src/cppcache/include/geode/CqEvent.hpp +++ b/src/cppcache/include/geode/CqEvent.hpp @@ -79,14 +79,14 @@ class CPPCACHE_EXPORT CqEvent { /** * Get the key relating to the event. * In case of REGION_CLEAR and REGION_INVALIDATE operation, the key will be - * NULLPTR. + * nullptr. * @return Object key. */ virtual CacheableKeyPtr getKey() const = 0; /** * Get the new value of the modification. - * If there is no new value returns NULLPTR, this will happen during delete + * If there is no new value returns nullptr, this will happen during delete * operation. * @return Object new/modified value. */ http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/CqListener.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/include/geode/CqListener.hpp b/src/cppcache/include/geode/CqListener.hpp index c4304dd..8396a36 100644 --- a/src/cppcache/include/geode/CqListener.hpp +++ b/src/cppcache/include/geode/CqListener.hpp @@ -57,7 +57,7 @@ class CPPCACHE_EXPORT CqListener : public SharedBase { * The error can appear while applying query condition on the event. * e.g if the event doesn't has attributes as specified in the CQ query. * This event does contain an error. The newValue may or may not be - * available, and will be NULLPTR if not available. + * available, and will be nullptr if not available. */ virtual void onError(const CqEvent& aCqEvent); http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/DataInput.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/include/geode/DataInput.hpp b/src/cppcache/include/geode/DataInput.hpp index b9e6919..8886539 100644 --- a/src/cppcache/include/geode/DataInput.hpp +++ b/src/cppcache/include/geode/DataInput.hpp @@ -600,9 +600,9 @@ class CPPCACHE_EXPORT DataInput { SerializablePtr sPtr; readObjectInternal(sPtr); if (throwOnError) { - ptr = dynCast<SharedPtr<PTR> >(sPtr); + ptr = std::dynamic_pointer_cast<PTR>(sPtr); } else { - ptr = staticCast<SharedPtr<PTR> >(sPtr); + ptr = std::static_pointer_cast<PTR>(sPtr); } } @@ -629,7 +629,7 @@ class CPPCACHE_EXPORT DataInput { read(&typeId); int64_t compId = typeId; if (compId == GeodeTypeIds::NullObj) { - csPtr = NULLPTR; + csPtr = nullptr; } else if (compId == GeodeTypeIds::CacheableNullString) { csPtr = CacheableStringPtr(dynamic_cast<CacheableString*>( CacheableString::createDeserializable())); @@ -637,25 +637,25 @@ class CPPCACHE_EXPORT DataInput { apache::geode::client::GeodeTypeIds::CacheableASCIIString) { csPtr = CacheableStringPtr(dynamic_cast<CacheableString*>( CacheableString::createDeserializable())); - csPtr.ptr()->fromData(*this); + csPtr->fromData(*this); } else if (compId == apache::geode::client::GeodeTypeIds::CacheableASCIIStringHuge) { csPtr = CacheableStringPtr(dynamic_cast<CacheableString*>( CacheableString::createDeserializableHuge())); - csPtr.ptr()->fromData(*this); + csPtr->fromData(*this); } else if (compId == apache::geode::client::GeodeTypeIds::CacheableString) { csPtr = CacheableStringPtr(dynamic_cast<CacheableString*>( CacheableString::createUTFDeserializable())); - csPtr.ptr()->fromData(*this); + csPtr->fromData(*this); } else if (compId == apache::geode::client::GeodeTypeIds::CacheableStringHuge) { csPtr = CacheableStringPtr(dynamic_cast<CacheableString*>( CacheableString::createUTFDeserializableHuge())); - csPtr.ptr()->fromData(*this); + csPtr->fromData(*this); } else { LOGDEBUG("In readNativeString something is wrong while expecting string"); rewindCursor(1); - csPtr = NULLPTR; + csPtr = nullptr; return false; } return true; http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/DataOutput.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/include/geode/DataOutput.hpp b/src/cppcache/include/geode/DataOutput.hpp index dee5a1d..0e4f55d 100644 --- a/src/cppcache/include/geode/DataOutput.hpp +++ b/src/cppcache/include/geode/DataOutput.hpp @@ -580,7 +580,7 @@ class CPPCACHE_EXPORT DataOutput { */ template <class PTR> void writeObject(const SharedPtr<PTR>& objptr, bool isDelta = false) { - writeObjectInternal(objptr.ptr(), isDelta); + writeObjectInternal(objptr.get(), isDelta); } /** http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/DistributedSystem.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/include/geode/DistributedSystem.hpp b/src/cppcache/include/geode/DistributedSystem.hpp index c6d46af..1f02c76 100644 --- a/src/cppcache/include/geode/DistributedSystem.hpp +++ b/src/cppcache/include/geode/DistributedSystem.hpp @@ -64,7 +64,7 @@ class CPPCACHE_EXPORT DistributedSystem : public SharedBase { *for this process **/ static DistributedSystemPtr connect(const char* name, - const PropertiesPtr& configPtr = NULLPTR); + const PropertiesPtr& configPtr = nullptr); /** *@brief disconnect from the distributed system http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/EntryEvent.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/include/geode/EntryEvent.hpp b/src/cppcache/include/geode/EntryEvent.hpp index 724494d..bd7192c 100644 --- a/src/cppcache/include/geode/EntryEvent.hpp +++ b/src/cppcache/include/geode/EntryEvent.hpp @@ -63,13 +63,13 @@ class CPPCACHE_EXPORT EntryEvent : public apache::geode::client::SharedBase { inline CacheableKeyPtr getKey() const { return m_key; } /** If the prior state of the entry was invalid, or non-existent/destroyed, - * then the old value will be NULLPTR. + * then the old value will be nullptr. * @return the old value in the cache. */ inline CacheablePtr getOldValue() const { return m_oldValue; } /** If the event is a destroy or invalidate operation, then the new value - * will be NULLPTR. + * will be nullptr. * @return the updated value from this event */ inline CacheablePtr getNewValue() const { return m_newValue; } http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/Exception.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/include/geode/Exception.hpp b/src/cppcache/include/geode/Exception.hpp index 7d6bab8..508bd8e 100644 --- a/src/cppcache/include/geode/Exception.hpp +++ b/src/cppcache/include/geode/Exception.hpp @@ -56,7 +56,7 @@ class CPPCACHE_EXPORT Exception : public SharedBase { * retrieved using <code>getCause</code> **/ Exception(const char* msg1, const char* msg2 = NULL, bool forceTrace = false, - const ExceptionPtr& cause = NULLPTR); + const ExceptionPtr& cause = nullptr); /** Creates an exception as a copy of the given other exception. * @param other the original exception. http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/ExceptionTypes.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/include/geode/ExceptionTypes.hpp b/src/cppcache/include/geode/ExceptionTypes.hpp index a4ad190..18a2d69 100644 --- a/src/cppcache/include/geode/ExceptionTypes.hpp +++ b/src/cppcache/include/geode/ExceptionTypes.hpp @@ -38,7 +38,7 @@ namespace client { class CPPCACHE_EXPORT x : public apache::geode::client::Exception { \ public: \ x(const char* msg1, const char* msg2 = NULL, bool forceStack = false, \ - const ExceptionPtr& cause = NULLPTR) \ + const ExceptionPtr& cause = nullptr) \ : Exception(msg1, msg2, forceStack, cause) {} \ x(const x& other) : Exception(other) {} \ virtual Exception* clone() const { \ http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/Execution.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/include/geode/Execution.hpp b/src/cppcache/include/geode/Execution.hpp index d303bd2..5b6ab97 100644 --- a/src/cppcache/include/geode/Execution.hpp +++ b/src/cppcache/include/geode/Execution.hpp @@ -57,7 +57,7 @@ class CPPCACHE_EXPORT Execution : public SharedBase { * @param routingObj Set defining the data filter to be used for executing the * function * @return an Execution with the filter - * @throws IllegalArgumentException if filter passed is NULLPTR. + * @throws IllegalArgumentException if filter passed is nullptr. * @throws UnsupportedOperationException if not called after * FunctionService::onRegion(Region). */ @@ -66,7 +66,7 @@ class CPPCACHE_EXPORT Execution : public SharedBase { * Specifies the user data passed to the function when it is executed. * @param args user data passed to the function execution * @return an Execution with args - * @throws IllegalArgumentException if the input parameter is NULLPTR + * @throws IllegalArgumentException if the input parameter is nullptr * */ virtual ExecutionPtr withArgs(CacheablePtr args) = 0; @@ -74,7 +74,7 @@ class CPPCACHE_EXPORT Execution : public SharedBase { * Specifies the {@link ResultCollector} that will receive the results after * the function has been executed. * @return an Execution with a collector - * @throws IllegalArgumentException if {@link ResultCollector} is NULLPTR + * @throws IllegalArgumentException if {@link ResultCollector} is nullptr * @see ResultCollector */ virtual ExecutionPtr withCollector(ResultCollectorPtr rs) = 0; http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/FunctionService.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/include/geode/FunctionService.hpp b/src/cppcache/include/geode/FunctionService.hpp index 72afe56..9000935 100644 --- a/src/cppcache/include/geode/FunctionService.hpp +++ b/src/cppcache/include/geode/FunctionService.hpp @@ -67,7 +67,7 @@ class CPPCACHE_EXPORT FunctionService : public SharedBase { * * @return Execution * @throws NullPointerException - * if the region passed in is NULLPTR + * if the region passed in is nullptr */ static ExecutionPtr onRegion(RegionPtr region); @@ -80,7 +80,7 @@ class CPPCACHE_EXPORT FunctionService : public SharedBase { * @param pool from which to chose a server for execution * @return Execution * @throws NullPointerException - * if Pool instance passed in is NULLPTR + * if Pool instance passed in is nullptr * @throws UnsupportedOperationException * if Pool is in multiusersecure Mode */ @@ -98,7 +98,7 @@ class CPPCACHE_EXPORT FunctionService : public SharedBase { * cache from which to chose a server for execution * @return Execution * @throws NullPointerException - * if Pool instance passed in is NULLPTR + * if Pool instance passed in is nullptr * @throws UnsupportedOperationException * if Pool is in multiusersecure Mode */ @@ -120,7 +120,7 @@ class CPPCACHE_EXPORT FunctionService : public SharedBase { * @param pool the set of servers to execute the function * @return Execution * @throws NullPointerException - * if Pool instance passed in is NULLPTR + * if Pool instance passed in is nullptr * @throws UnsupportedOperationException * if Pool is in multiusersecure Mode */ @@ -138,7 +138,7 @@ class CPPCACHE_EXPORT FunctionService : public SharedBase { * the {@link Cache} where function need to execute. * @return Execution * @throws NullPointerException - * if Pool instance passed in is NULLPTR + * if Pool instance passed in is nullptr * @throws UnsupportedOperationException * if Pool is in multiusersecure Mode */ http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/HashFunction.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/include/geode/HashFunction.hpp b/src/cppcache/include/geode/HashFunction.hpp index 2cff44a..d7c85b7 100644 --- a/src/cppcache/include/geode/HashFunction.hpp +++ b/src/cppcache/include/geode/HashFunction.hpp @@ -72,7 +72,7 @@ inline int32_t hashFunction(const TKEY& k) { template <typename TKEY> inline bool equalToFunction(const TKEY& x, const TKEY& y) { - return (*x.ptr() == *y.ptr()); + return (*x.get() == *y.get()); } } // namespace client } // namespace geode http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/HashMapOfSharedBase.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/include/geode/HashMapOfSharedBase.hpp b/src/cppcache/include/geode/HashMapOfSharedBase.hpp index 1329d95..cef8b0f 100644 --- a/src/cppcache/include/geode/HashMapOfSharedBase.hpp +++ b/src/cppcache/include/geode/HashMapOfSharedBase.hpp @@ -151,7 +151,7 @@ class CPPCACHE_EXPORT HashMapOfSharedBase { /** Copy constructor. */ HashMapOfSharedBase(const HashMapOfSharedBase& other); - /** Destructor, sets all SharedPtr elements to NULLPTR. */ + /** Destructor, sets all SharedPtr elements to nullptr. */ ~HashMapOfSharedBase(); }; } // namespace client http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/HashMapT.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/include/geode/HashMapT.hpp b/src/cppcache/include/geode/HashMapT.hpp index 2a3c645..e39086f 100644 --- a/src/cppcache/include/geode/HashMapT.hpp +++ b/src/cppcache/include/geode/HashMapT.hpp @@ -50,10 +50,12 @@ class HashMapT { Iterator(); public: - inline const TKEY first() const { return staticCast<TKEY>(m_iter.first()); } + inline const TKEY first() const { + return std::static_pointer_cast<GF_UNWRAP_SP(TKEY)>(m_iter.first()); + } inline const TVAL second() const { - return staticCast<TVAL>(m_iter.second()); + return std::static_pointer_cast<GF_UNWRAP_SP(TVAL)>(m_iter.second()); } inline Iterator& operator++() { @@ -75,12 +77,14 @@ class HashMapT { }; static int32_t hasher(const SharedBasePtr& p) { - return apache::geode::client::hashFunction<TKEY>(staticCast<TKEY>(p)); + return apache::geode::client::hashFunction<TKEY>( + std::static_pointer_cast<GF_UNWRAP_SP(TKEY)>(p)); } static bool equal_to(const SharedBasePtr& x, const SharedBasePtr& y) { - return apache::geode::client::equalToFunction<TKEY>(staticCast<TKEY>(x), - staticCast<TKEY>(y)); + return apache::geode::client::equalToFunction<TKEY>( + std::static_pointer_cast<GF_UNWRAP_SP(TKEY)>(x), + std::static_pointer_cast<GF_UNWRAP_SP(TKEY)>(y)); } /** Returns the size of the hash map. */ @@ -133,7 +137,9 @@ class HashMapT { /** Returns a copy of the object that is associated * with a particular key. */ - inline TVAL operator[](const TKEY& k) { return staticCast<TVAL>(m_map[k]); } + inline TVAL operator[](const TKEY& k) { + return std::static_pointer_cast<GF_UNWRAP_SP(TVAL)>(m_map[k]); + } /** Get an iterator pointing to the start of hash_map. */ inline Iterator begin() const { return Iterator(m_map.begin()); } http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/HashSetOfSharedBase.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/include/geode/HashSetOfSharedBase.hpp b/src/cppcache/include/geode/HashSetOfSharedBase.hpp index a8675af..127fb86 100644 --- a/src/cppcache/include/geode/HashSetOfSharedBase.hpp +++ b/src/cppcache/include/geode/HashSetOfSharedBase.hpp @@ -143,7 +143,7 @@ class CPPCACHE_EXPORT HashSetOfSharedBase { /** Copy constructor. */ HashSetOfSharedBase(const HashSetOfSharedBase& other); - /** Destructor, sets all SharedPtr elements to NULLPTR. */ + /** Destructor, sets all SharedPtr elements to nullptr. */ ~HashSetOfSharedBase(); }; } // namespace client http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/HashSetT.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/include/geode/HashSetT.hpp b/src/cppcache/include/geode/HashSetT.hpp index fa7e75c..7abcbfe 100644 --- a/src/cppcache/include/geode/HashSetT.hpp +++ b/src/cppcache/include/geode/HashSetT.hpp @@ -49,7 +49,7 @@ class HashSetT { Iterator(); public: - inline const TKEY operator*() const { return staticCast<TKEY>(*m_iter); } + inline const TKEY operator*() const { return std::static_pointer_cast<GF_UNWRAP_SP(TKEY)>(*m_iter); } inline bool isEnd() const { return m_iter.isEnd(); } @@ -74,12 +74,12 @@ class HashSetT { }; inline static int32_t hasher(const SharedBasePtr& p) { - return apache::geode::client::hashFunction<TKEY>(staticCast<TKEY>(p)); + return apache::geode::client::hashFunction<TKEY>(std::static_pointer_cast<GF_UNWRAP_SP(TKEY)>(p)); } inline static bool equal_to(const SharedBasePtr& x, const SharedBasePtr& y) { - return apache::geode::client::equalToFunction<TKEY>(staticCast<TKEY>(x), - staticCast<TKEY>(y)); + return apache::geode::client::equalToFunction<TKEY>(std::static_pointer_cast<GF_UNWRAP_SP(TKEY)>(x), + std::static_pointer_cast<GF_UNWRAP_SP(TKEY)>(y)); } /** Returns the size of the hash set. */ http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/PdxInstanceFactory.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/include/geode/PdxInstanceFactory.hpp b/src/cppcache/include/geode/PdxInstanceFactory.hpp index c8a66cc..348e53b 100644 --- a/src/cppcache/include/geode/PdxInstanceFactory.hpp +++ b/src/cppcache/include/geode/PdxInstanceFactory.hpp @@ -68,7 +68,7 @@ class CPPCACHE_EXPORT PdxInstanceFactory : public SharedBase { * @return the created Pdxinstance * @throws IllegalStateException if called more than once */ - virtual PdxInstancePtr create() = 0; + virtual std::unique_ptr<PdxInstance> create() = 0; /** * Writes the named field with the given value to the serialized form. http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/PdxWrapper.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/include/geode/PdxWrapper.hpp b/src/cppcache/include/geode/PdxWrapper.hpp index 16a98c3..5028016 100644 --- a/src/cppcache/include/geode/PdxWrapper.hpp +++ b/src/cppcache/include/geode/PdxWrapper.hpp @@ -31,8 +31,7 @@ class CPPCACHE_EXPORT PdxWrapper : public PdxSerializable { /** * The PdxWrapper class allows domain classes to be used in Region operations. * A user domain object should be wrapped in an instance of a PdxWrapper with -* a -* PdxSerializer registered that can handle the user domain class. + * a PdxSerializer registered that can handle the user domain class. */ public: @@ -119,6 +118,8 @@ class CPPCACHE_EXPORT PdxWrapper : public PdxSerializable { PdxWrapper(); PdxWrapper(const char* className); + FRIEND_STD_SHARED_PTR(PdxWrapper) + void* m_userObject; PdxSerializerPtr m_serializer; UserDeallocator m_deallocator; http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/Pool.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/include/geode/Pool.hpp b/src/cppcache/include/geode/Pool.hpp index 9cb1336..3e4342c 100644 --- a/src/cppcache/include/geode/Pool.hpp +++ b/src/cppcache/include/geode/Pool.hpp @@ -49,7 +49,8 @@ class PoolAttributes; * * */ -class CPPCACHE_EXPORT Pool : public SharedBase { +class CPPCACHE_EXPORT Pool : public SharedBase, + public std::enable_shared_from_this<Pool> { public: /** * Gets the name of the connection pool http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/PoolManager.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/include/geode/PoolManager.hpp b/src/cppcache/include/geode/PoolManager.hpp index 127436d..968f9dd 100644 --- a/src/cppcache/include/geode/PoolManager.hpp +++ b/src/cppcache/include/geode/PoolManager.hpp @@ -65,9 +65,9 @@ class CPPCACHE_EXPORT PoolManager { /** * Find by name an existing connection pool returning - * the existing pool or <code>NULLPTR</code> if it does not exist. + * the existing pool or <code>nullptr</code> if it does not exist. * @param name is the name of the connection pool - * @return the existing connection pool or <code>NULLPTR</code> if it does not + * @return the existing connection pool or <code>nullptr</code> if it does not * exist. */ static PoolPtr find(const char* name); @@ -75,7 +75,7 @@ class CPPCACHE_EXPORT PoolManager { /** * Find the pool used by the given region. * @param region is the region that is using the pool. - * @return the pool used by that region or <code> NULLPTR </code> if the + * @return the pool used by that region or <code> nullptr </code> if the * region does * not have a pool. */ http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/Properties.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/include/geode/Properties.hpp b/src/cppcache/include/geode/Properties.hpp index 7ddd703..e0f7861 100644 --- a/src/cppcache/include/geode/Properties.hpp +++ b/src/cppcache/include/geode/Properties.hpp @@ -52,16 +52,16 @@ class CPPCACHE_EXPORT Properties : public Serializable { }; /** - * Return the value for the given key, or NULLPTR if not found. + * Return the value for the given key, or nullptr if not found. * * @throws NullPointerException if the key is null */ CacheableStringPtr find(const char* key); /** * Return the value for the given <code>CacheableKey</code>, - * or NULLPTR if not found. + * or nullptr if not found. * - * @throws NullPointerException if the key is NULLPTR + * @throws NullPointerException if the key is nullptr */ CacheablePtr find(const CacheableKeyPtr& key); @@ -82,7 +82,7 @@ class CPPCACHE_EXPORT Properties : public Serializable { /** * Add or update Cacheable value for CacheableKey * - * @throws NullPointerException if the key is NULLPTR + * @throws NullPointerException if the key is nullptr */ void insert(const CacheableKeyPtr& key, const CacheablePtr& value); @@ -96,7 +96,7 @@ class CPPCACHE_EXPORT Properties : public Serializable { /** * Remove the <code>CacheableKey</code> from the collection. * - * @throws NullPointerException if the key is NULLPTR + * @throws NullPointerException if the key is nullptr */ void remove(const CacheableKeyPtr& key); http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/QueryService.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/include/geode/QueryService.hpp b/src/cppcache/include/geode/QueryService.hpp index d47f065..5065c9f 100644 --- a/src/cppcache/include/geode/QueryService.hpp +++ b/src/cppcache/include/geode/QueryService.hpp @@ -45,6 +45,8 @@ namespace client { */ class CPPCACHE_EXPORT QueryService : public SharedBase { public: + typedef std::vector<CqQueryPtr> query_container_type; + /** * Get a new Query with the specified query string. * @@ -68,7 +70,7 @@ class CPPCACHE_EXPORT QueryService : public SharedBase { * @throws CqExistsException if a CQ by this name already exists on this * client * @throws IllegalArgumentException if queryString is null, or cqAttr is - * NULLPTR + * nullptr * @throws IllegalStateException if this method is called from a cache * server * @throws QueryInvalidException if there is a syntax error in the query @@ -102,7 +104,7 @@ class CPPCACHE_EXPORT QueryService : public SharedBase { * @throws CqExistsException if a CQ by this name already exists on this * client * @throws IllegalArgumentException if queryString is null, or cqAttr is - * NULLPTR + * nullptr * @throws IllegalStateException if this method is called from a cache * server * @throws QueryInvalidException if there is a syntax error in the query @@ -134,11 +136,11 @@ class CPPCACHE_EXPORT QueryService : public SharedBase { * Retrieve all registered CQs * @endnativeclient */ - virtual void getCqs(VectorOfCqQuery& vec) = 0; + virtual void getCqs(query_container_type& vec) = 0; /** * @nativeclient * Retrieve a CqQuery by name. - * @return the CqQuery or NULLPTR if not found + * @return the CqQuery or nullptr if not found * @endnativeclient */ virtual CqQueryPtr getCq(const char* name) = 0; http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/Region.hpp ---------------------------------------------------------------------- diff --git a/src/cppcache/include/geode/Region.hpp b/src/cppcache/include/geode/Region.hpp index 827a9c1..5f8a31d 100644 --- a/src/cppcache/include/geode/Region.hpp +++ b/src/cppcache/include/geode/Region.hpp @@ -84,7 +84,8 @@ namespace client { * * @see RegionAttributes */ -class CPPCACHE_EXPORT Region : public SharedBase { +class CPPCACHE_EXPORT Region : public std::enable_shared_from_this<Region>, + public SharedBase { /** @brief Public Methods */ public: @@ -97,7 +98,7 @@ class CPPCACHE_EXPORT Region : public SharedBase { */ virtual const char* getFullPath() const = 0; - /** Returns the parent region, or NULLPTR if a root region. + /** Returns the parent region, or nullptr if a root region. * @throws RegionDestroyedException */ virtual RegionPtr getParentRegion() const = 0; @@ -124,7 +125,7 @@ class CPPCACHE_EXPORT Region : public SharedBase { * * @param aCallbackArgument a user-defined parameter to pass to callback events * triggered by this method. - * Can be NULLPTR. If it is sent on the wire, it has to be Serializable. + * Can be nullptr. If it is sent on the wire, it has to be Serializable. * @throws CacheListenerException if CacheListener throws an exception; if this * occurs some subregions may have already been successfully * invalidated @@ -134,7 +135,7 @@ class CPPCACHE_EXPORT Region : public SharedBase { * This operation is not distributed. */ virtual void invalidateRegion( - const UserDataPtr& aCallbackArgument = NULLPTR) = 0; + const UserDataPtr& aCallbackArgument = nullptr) = 0; /** Invalidates this region. The invalidation will cascade to * all the subregions and cached entries. After @@ -146,7 +147,7 @@ class CPPCACHE_EXPORT Region : public SharedBase { * * @param aCallbackArgument a user-defined parameter to pass to callback events * triggered by this method. - * Can be NULLPTR. If it is sent on the wire, it has to be Serializable. + * Can be nullptr. If it is sent on the wire, it has to be Serializable. * @throws CacheListenerException if CacheListener throws an exception; if this * occurs some subregions may have already been successfully invalidated @@ -156,7 +157,7 @@ class CPPCACHE_EXPORT Region : public SharedBase { */ virtual void localInvalidateRegion( - const UserDataPtr& aCallbackArgument = NULLPTR) = 0; + const UserDataPtr& aCallbackArgument = nullptr) = 0; /** Destroys the whole region and provides a user-defined parameter * object to any <code>CacheWriter</code> invoked in the process. @@ -172,7 +173,7 @@ class CPPCACHE_EXPORT Region : public SharedBase { * * @param aCallbackArgument a user-defined parameter to pass to callback events * triggered by this call. - * Can be NULLPTR. If it is sent on the wire, it has to be Serializable. + * Can be nullptr. If it is sent on the wire, it has to be Serializable. * @throws CacheWriterException if CacheWriter aborts the operation; if this * occurs some subregions may have already been successfully destroyed. * @throws CacheListenerException if CacheListener throws an exception; if this @@ -196,7 +197,7 @@ class CPPCACHE_EXPORT Region : public SharedBase { * @see invalidateRegion */ virtual void destroyRegion( - const UserDataPtr& aCallbackArgument = NULLPTR) = 0; + const UserDataPtr& aCallbackArgument = nullptr) = 0; /** * Removes all entries from this region and provides a user-defined parameter * object to any <code>CacheWriter</code> or <code>CacheListener</code> @@ -204,7 +205,7 @@ class CPPCACHE_EXPORT Region : public SharedBase { * @see CacheListener#afterRegionClear * @see CacheWriter#beforeRegionClear */ - virtual void clear(const UserDataPtr& aCallbackArgument = NULLPTR) = 0; + virtual void clear(const UserDataPtr& aCallbackArgument = nullptr) = 0; /** * Removes all entries from this region and provides a user-defined parameter * object to any <code>CacheWriter</code> or <code>CacheListener</code> @@ -212,7 +213,7 @@ class CPPCACHE_EXPORT Region : public SharedBase { * @see CacheListener#afterRegionClear * @see CacheWriter#beforeRegionClear */ - virtual void localClear(const UserDataPtr& aCallbackArgument = NULLPTR) = 0; + virtual void localClear(const UserDataPtr& aCallbackArgument = nullptr) = 0; /** Destroys the whole region and provides a user-defined parameter * object to any <code>CacheWriter</code> invoked in the process. @@ -224,7 +225,7 @@ class CPPCACHE_EXPORT Region : public SharedBase { * * @param aCallbackArgument a user-defined parameter to pass to callback events * triggered by this call. - * Can be NULLPTR. If it is sent on the wire, it has to be Serializable. + * Can be nullptr. If it is sent on the wire, it has to be Serializable. * @throws CacheWriterException if CacheWriter aborts the operation; if this * occurs some subregions may have already been successfully destroyed. * @throws CacheListenerException if CacheListener throws an exception; if this @@ -234,9 +235,9 @@ class CPPCACHE_EXPORT Region : public SharedBase { * @see localInvalidateRegion */ virtual void localDestroyRegion( - const UserDataPtr& aCallbackArgument = NULLPTR) = 0; + const UserDataPtr& aCallbackArgument = nullptr) = 0; - /** Returns the subregion identified by the path, NULLPTR if no such subregion + /** Returns the subregion identified by the path, nullptr if no such subregion */ virtual RegionPtr getSubregion(const char* path) = 0; @@ -285,7 +286,7 @@ class CPPCACHE_EXPORT Region : public SharedBase { * @param aCallbackArgument an argument passed into the CacheLoader if * loader is used. If it is sent on the wire, it has to be Serializable. * - * @throws IllegalArgumentException if key is NULLPTR or aCallbackArgument is + * @throws IllegalArgumentException if key is nullptr or aCallbackArgument is * not serializable and a remote CacheLoader needs to be invoked * @throws CacheLoaderException if CacheLoader throws an exception * @throws CacheServerException If an exception is received from the Java cache @@ -307,12 +308,12 @@ class CPPCACHE_EXPORT Region : public SharedBase { *region **/ virtual CacheablePtr get(const CacheableKeyPtr& key, - const UserDataPtr& aCallbackArgument = NULLPTR) = 0; + const UserDataPtr& aCallbackArgument = nullptr) = 0; /** Convenience method allowing key to be a const char* */ template <class KEYTYPE> inline CacheablePtr get(const KEYTYPE& key, - const UserDataPtr& callbackArg = NULLPTR) { + const UserDataPtr& callbackArg = nullptr) { return get(createKey(key), callbackArg); } @@ -339,7 +340,7 @@ class CPPCACHE_EXPORT Region : public SharedBase { * @param value the value to be put into the cache * @param aCallbackArgument an argument that is passed to the callback function * - * @throws IllegalArgumentException if key or value is NULLPTR + * @throws IllegalArgumentException if key or value is nullptr * @throws CacheWriterException if CacheWriter aborts the operation * @throws CacheListenerException if CacheListener throws an exception * @throws RegionDestroyedException if region no longer valid @@ -360,26 +361,26 @@ class CPPCACHE_EXPORT Region : public SharedBase { * @throws OutOfMemoryException if not enoough memory for the value */ virtual void put(const CacheableKeyPtr& key, const CacheablePtr& value, - const UserDataPtr& aCallbackArgument = NULLPTR) = 0; + const UserDataPtr& aCallbackArgument = nullptr) = 0; /** Convenience method allowing both key and value to be a const char* */ template <class KEYTYPE, class VALUETYPE> inline void put(const KEYTYPE& key, const VALUETYPE& value, - const UserDataPtr& arg = NULLPTR) { + const UserDataPtr& arg = nullptr) { put(createKey(key), createValue(value), arg); } /** Convenience method allowing key to be a const char* */ template <class KEYTYPE> inline void put(const KEYTYPE& key, const CacheablePtr& value, - const UserDataPtr& arg = NULLPTR) { + const UserDataPtr& arg = nullptr) { put(createKey(key), value, arg); } /** Convenience method allowing value to be a const char* */ template <class VALUETYPE> inline void put(const CacheableKeyPtr& key, const VALUETYPE& value, - const UserDataPtr& arg = NULLPTR) { + const UserDataPtr& arg = nullptr) { put(key, createValue(value), arg); } @@ -399,14 +400,14 @@ class CPPCACHE_EXPORT Region : public SharedBase { * @since 8.1 * @param aCallbackArgument an argument that is passed to the callback * functions. - * It is ignored if NULLPTR. It must be serializable if this operation is + * It is ignored if nullptr. It must be serializable if this operation is * distributed. * @throws IllegalArgumentException If timeout * parameter is greater than 2^31/1000, ie 2147483. */ virtual void putAll(const HashMapOfCacheable& map, uint32_t timeout = DEFAULT_RESPONSE_TIMEOUT, - const UserDataPtr& aCallbackArgument = NULLPTR) = 0; + const UserDataPtr& aCallbackArgument = nullptr) = 0; /** * Places a new value into an entry in this region with the specified key @@ -426,33 +427,33 @@ class CPPCACHE_EXPORT Region : public SharedBase { * @param aCallbackArgument an argument that is passed to the callback * functions * - * @throws IllegalArgumentException if key or value is NULLPTR + * @throws IllegalArgumentException if key or value is nullptr * @throws CacheWriterException if CacheWriter aborts the operation * @throws CacheListenerException if CacheListener throws an exception * @throws RegionDestroyedException if region no longer valid * @throws OutOfMemoryException if not enoough memory for the value */ virtual void localPut(const CacheableKeyPtr& key, const CacheablePtr& value, - const UserDataPtr& aCallbackArgument = NULLPTR) = 0; + const UserDataPtr& aCallbackArgument = nullptr) = 0; /** Convenience method allowing both key and value to be a const char* */ template <class KEYTYPE, class VALUETYPE> inline void localPut(const KEYTYPE& key, const VALUETYPE& value, - const UserDataPtr& arg = NULLPTR) { + const UserDataPtr& arg = nullptr) { localPut(createKey(key), createValue(value), arg); } /** Convenience method allowing key to be a const char* */ template <class KEYTYPE> inline void localPut(const KEYTYPE& key, const CacheablePtr& value, - const UserDataPtr& arg = NULLPTR) { + const UserDataPtr& arg = nullptr) { localPut(createKey(key), value, arg); } /** Convenience method allowing value to be a const char* */ template <class VALUETYPE> inline void localPut(const CacheableKeyPtr& key, const VALUETYPE& value, - const UserDataPtr& arg = NULLPTR) { + const UserDataPtr& arg = nullptr) { localPut(key, createValue(value), arg); } @@ -474,12 +475,12 @@ class CPPCACHE_EXPORT Region : public SharedBase { * * @param key the key smart pointer for which to create the entry in this * region. - * @param value the value for the new entry, which may be NULLPTR meaning + * @param value the value for the new entry, which may be nullptr meaning * the new entry starts as if it had been locally invalidated. * @param aCallbackArgument a user-defined parameter to pass to callback events - * triggered by this method. Can be NULLPTR. Should be serializable if + * triggered by this method. Can be nullptr. Should be serializable if * passed to remote callback events - * @throws IllegalArgumentException if key is NULLPTR or if the key, value, or + * @throws IllegalArgumentException if key is nullptr or if the key, value, or * aCallbackArgument do not meet serializability requirements * @throws CacheWriterException if CacheWriter aborts the operation * @throws CacheListenerException if CacheListener throws an exception @@ -503,26 +504,26 @@ class CPPCACHE_EXPORT Region : public SharedBase { * @throws EntryExistsException if an entry with this key already exists */ virtual void create(const CacheableKeyPtr& key, const CacheablePtr& value, - const UserDataPtr& aCallbackArgument = NULLPTR) = 0; + const UserDataPtr& aCallbackArgument = nullptr) = 0; /** Convenience method allowing both key and value to be a const char* */ template <class KEYTYPE, class VALUETYPE> inline void create(const KEYTYPE& key, const VALUETYPE& value, - const UserDataPtr& arg = NULLPTR) { + const UserDataPtr& arg = nullptr) { create(createKey(key), createValue(value), arg); } /** Convenience method allowing key to be a const char* */ template <class KEYTYPE> inline void create(const KEYTYPE& key, const CacheablePtr& value, - const UserDataPtr& arg = NULLPTR) { + const UserDataPtr& arg = nullptr) { create(createKey(key), value, arg); } /** Convenience method allowing value to be a const char* */ template <class VALUETYPE> inline void create(const CacheableKeyPtr& key, const VALUETYPE& value, - const UserDataPtr& arg = NULLPTR) { + const UserDataPtr& arg = nullptr) { create(key, createValue(value), arg); } @@ -537,14 +538,14 @@ class CPPCACHE_EXPORT Region : public SharedBase { * * @param key the key smart pointer for which to create the entry in this * region. - * @param value the value for the new entry, which may be NULLPTR meaning + * @param value the value for the new entry, which may be nullptr meaning * the new entry starts as if it had been locally invalidated. * @param aCallbackArgument a user-defined parameter to pass to callback * events - * triggered by this method. Can be NULLPTR. Should be serializable if + * triggered by this method. Can be nullptr. Should be serializable if * passed to remote callback events * - * @throws IllegalArgumentException if key or value is NULLPTR + * @throws IllegalArgumentException if key or value is nullptr * @throws CacheWriterException if CacheWriter aborts the operation * @throws CacheListenerException if CacheListener throws an exception * @throws RegionDestroyedException if region is no longer valid @@ -553,26 +554,26 @@ class CPPCACHE_EXPORT Region : public SharedBase { */ virtual void localCreate(const CacheableKeyPtr& key, const CacheablePtr& value, - const UserDataPtr& aCallbackArgument = NULLPTR) = 0; + const UserDataPtr& aCallbackArgument = nullptr) = 0; /** Convenience method allowing both key and value to be a const char* */ template <class KEYTYPE, class VALUETYPE> inline void localCreate(const KEYTYPE& key, const VALUETYPE& value, - const UserDataPtr& arg = NULLPTR) { + const UserDataPtr& arg = nullptr) { localCreate(createKey(key), createValue(value), arg); } /** Convenience method allowing key to be a const char* */ template <class KEYTYPE> inline void localCreate(const KEYTYPE& key, const CacheablePtr& value, - const UserDataPtr& arg = NULLPTR) { + const UserDataPtr& arg = nullptr) { localCreate(createKey(key), value, arg); } /** Convenience method allowing value to be a const char* */ template <class VALUETYPE> inline void localCreate(const CacheableKeyPtr& key, const VALUETYPE& value, - const UserDataPtr& arg = NULLPTR) { + const UserDataPtr& arg = nullptr) { localCreate(key, createValue(value), arg); } @@ -588,9 +589,9 @@ class CPPCACHE_EXPORT Region : public SharedBase { * * @param key the key of the value to be invalidated * @param aCallbackArgument a user-defined parameter to pass to callback events - * triggered by this method. Can be NULLPTR. Should be serializable if + * triggered by this method. Can be nullptr. Should be serializable if * passed to remote callback events - * @throws IllegalArgumentException if key is NULLPTR + * @throws IllegalArgumentException if key is nullptr * @throws CacheListenerException if CacheListener throws an exception * @throws EntryNotFoundException if this entry does not exist in this region * locally @@ -599,11 +600,11 @@ class CPPCACHE_EXPORT Region : public SharedBase { * @see CacheListener::afterInvalidate */ virtual void invalidate(const CacheableKeyPtr& key, - const UserDataPtr& aCallbackArgument = NULLPTR) = 0; + const UserDataPtr& aCallbackArgument = nullptr) = 0; /** Convenience method allowing key to be a const char* */ template <class KEYTYPE> - inline void invalidate(const KEYTYPE& key, const UserDataPtr& arg = NULLPTR) { + inline void invalidate(const KEYTYPE& key, const UserDataPtr& arg = nullptr) { invalidate(createKey(key), arg); } @@ -617,9 +618,9 @@ class CPPCACHE_EXPORT Region : public SharedBase { * * @param key the key of the value to be invalidated * @param aCallbackArgument a user-defined parameter to pass to callback events - * triggered by this method. Can be NULLPTR. Should be serializable if + * triggered by this method. Can be nullptr. Should be serializable if * passed to remote callback events - * @throws IllegalArgumentException if key is NULLPTR + * @throws IllegalArgumentException if key is nullptr * @throws CacheListenerException if CacheListener throws an exception * @throws EntryNotFoundException if this entry does not exist in this region * locally @@ -629,12 +630,12 @@ class CPPCACHE_EXPORT Region : public SharedBase { */ virtual void localInvalidate( const CacheableKeyPtr& key, - const UserDataPtr& aCallbackArgument = NULLPTR) = 0; + const UserDataPtr& aCallbackArgument = nullptr) = 0; /** Convenience method allowing key to be a const char* */ template <class KEYTYPE> inline void localInvalidate(const KEYTYPE& key, - const UserDataPtr& arg = NULLPTR) { + const UserDataPtr& arg = nullptr) { localInvalidate(createKey(key), arg); } @@ -657,8 +658,8 @@ class CPPCACHE_EXPORT Region : public SharedBase { * @param key the key of the entry to destroy * @param aCallbackArgument a user-defined parameter to pass to callback events * triggered by this method. - * Can be NULLPTR. If it is sent on the wire, it has to be Serializable. - * @throws IllegalArgumentException if key is NULLPTR + * Can be nullptr. If it is sent on the wire, it has to be Serializable. + * @throws IllegalArgumentException if key is nullptr * @throws CacheWriterException if CacheWriter aborts the operation * @throws CacheListenerException if CacheListener throws an exception * @throws CacheServerException If an exception is received from the Geode @@ -683,11 +684,11 @@ class CPPCACHE_EXPORT Region : public SharedBase { * @see CacheWriter::beforeDestroy */ virtual void destroy(const CacheableKeyPtr& key, - const UserDataPtr& aCallbackArgument = NULLPTR) = 0; + const UserDataPtr& aCallbackArgument = nullptr) = 0; /** Convenience method allowing key to be a const char* */ template <class KEYTYPE> - inline void destroy(const KEYTYPE& key, const UserDataPtr& arg = NULLPTR) { + inline void destroy(const KEYTYPE& key, const UserDataPtr& arg = nullptr) { destroy(createKey(key), arg); } @@ -705,8 +706,8 @@ class CPPCACHE_EXPORT Region : public SharedBase { * * @param key the key of the entry to destroy. * @param aCallbackArgument the callback for user to pass in, default is - * NULLPTR. - * @throws IllegalArgumentException if key is NULLPTR + * nullptr. + * @throws IllegalArgumentException if key is nullptr * @throws CacheWriterException if CacheWriter aborts the operation * @throws CacheListenerException if CacheListener throws an exception * @throws EntryNotFoundException if the entry does not exist in this region @@ -716,12 +717,12 @@ class CPPCACHE_EXPORT Region : public SharedBase { * @see CacheWriter::beforeDestroy */ virtual void localDestroy(const CacheableKeyPtr& key, - const UserDataPtr& aCallbackArgument = NULLPTR) = 0; + const UserDataPtr& aCallbackArgument = nullptr) = 0; /** Convenience method allowing key to be a const char* */ template <class KEYTYPE> inline void localDestroy(const KEYTYPE& key, - const UserDataPtr& arg = NULLPTR) { + const UserDataPtr& arg = nullptr) { localDestroy(createKey(key), arg); } @@ -744,11 +745,11 @@ class CPPCACHE_EXPORT Region : public SharedBase { * <p> * * @param key the key of the entry to remove - * @param value the value of the key to remove, it can be NULLPTR. + * @param value the value of the key to remove, it can be nullptr. * @param aCallbackArgument a user-defined parameter to pass to callback events * triggered by this method. - * Can be NULLPTR. If it is sent on the wire, it has to be Serializable. - * @throws IllegalArgumentException if key is NULLPTR + * Can be nullptr. If it is sent on the wire, it has to be Serializable. + * @throws IllegalArgumentException if key is nullptr * @throws CacheWriterException if CacheWriter aborts the operation * @throws CacheListenerException if CacheListener throws an exception * @throws CacheServerException If an exception is received from the Geode @@ -774,26 +775,26 @@ class CPPCACHE_EXPORT Region : public SharedBase { * @see CacheWriter::beforeDestroy */ virtual bool remove(const CacheableKeyPtr& key, const CacheablePtr& value, - const UserDataPtr& aCallbackArgument = NULLPTR) = 0; + const UserDataPtr& aCallbackArgument = nullptr) = 0; /** Convenience method allowing both key and value to be a const char* */ template <class KEYTYPE, class VALUETYPE> inline bool remove(const KEYTYPE& key, const VALUETYPE& value, - const UserDataPtr& arg = NULLPTR) { + const UserDataPtr& arg = nullptr) { return remove(createKey(key), createValue(value), arg); } /** Convenience method allowing key to be a const char* */ template <class KEYTYPE> inline bool remove(const KEYTYPE& key, const CacheablePtr& value, - const UserDataPtr& arg = NULLPTR) { + const UserDataPtr& arg = nullptr) { return remove(createKey(key), value, arg); } /** Convenience method allowing value to be a const char* */ template <class VALUETYPE> inline bool remove(const CacheableKeyPtr& key, const VALUETYPE& value, - const UserDataPtr& arg = NULLPTR) { + const UserDataPtr& arg = nullptr) { return remove(key, createValue(value), arg); } @@ -825,8 +826,8 @@ class CPPCACHE_EXPORT Region : public SharedBase { * @param key the key of the entry to remove * @param aCallbackArgument a user-defined parameter to pass to callback events * triggered by this method. - * Can be NULLPTR. If it is sent on the wire, it has to be Serializable. - * @throws IllegalArgumentException if key is NULLPTR + * Can be nullptr. If it is sent on the wire, it has to be Serializable. + * @throws IllegalArgumentException if key is nullptr * @throws CacheWriterException if CacheWriter aborts the operation * @throws CacheListenerException if CacheListener throws an exception * @throws CacheServerException If an exception is received from the Geode @@ -852,11 +853,11 @@ class CPPCACHE_EXPORT Region : public SharedBase { * @see CacheWriter::beforeDestroy */ virtual bool removeEx(const CacheableKeyPtr& key, - const UserDataPtr& aCallbackArgument = NULLPTR) = 0; + const UserDataPtr& aCallbackArgument = nullptr) = 0; /** Convenience method allowing key to be a const char* */ template <class KEYTYPE> - inline bool removeEx(const KEYTYPE& key, const UserDataPtr& arg = NULLPTR) { + inline bool removeEx(const KEYTYPE& key, const UserDataPtr& arg = nullptr) { return removeEx(createKey(key), arg); } @@ -877,8 +878,8 @@ class CPPCACHE_EXPORT Region : public SharedBase { * @param key the key of the entry to remove. * @param value the value of the entry to remove. * @param aCallbackArgument the callback for user to pass in, default is - * NULLPTR. - * @throws IllegalArgumentException if key is NULLPTR + * nullptr. + * @throws IllegalArgumentException if key is nullptr * @throws CacheWriterException if CacheWriter aborts the operation * @throws CacheListenerException if CacheListener throws an exception * @return the boolean true if an entry(key, value)has been removed or @@ -889,26 +890,26 @@ class CPPCACHE_EXPORT Region : public SharedBase { */ virtual bool localRemove(const CacheableKeyPtr& key, const CacheablePtr& value, - const UserDataPtr& aCallbackArgument = NULLPTR) = 0; + const UserDataPtr& aCallbackArgument = nullptr) = 0; /** Convenience method allowing both key and value to be a const char* */ template <class KEYTYPE, class VALUETYPE> inline bool localRemove(const KEYTYPE& key, const VALUETYPE& value, - const UserDataPtr& arg = NULLPTR) { + const UserDataPtr& arg = nullptr) { return localRemove(createKey(key), createValue(value), arg); } /** Convenience method allowing key to be a const char* */ template <class KEYTYPE> inline bool localRemove(const KEYTYPE& key, const CacheablePtr& value, - const UserDataPtr& arg = NULLPTR) { + const UserDataPtr& arg = nullptr) { return localRemove(createKey(key), value, arg); } /** Convenience method allowing value to be a const char* */ template <class VALUETYPE> inline bool localRemove(const CacheableKeyPtr& key, const VALUETYPE& value, - const UserDataPtr& arg = NULLPTR) { + const UserDataPtr& arg = nullptr) { return localRemove(key, createValue(value), arg); } @@ -927,8 +928,8 @@ class CPPCACHE_EXPORT Region : public SharedBase { * * @param key the key of the entry to remove. * @param aCallbackArgument the callback for user to pass in, default is - * NULLPTR. - * @throws IllegalArgumentException if key is NULLPTR + * nullptr. + * @throws IllegalArgumentException if key is nullptr * @throws CacheWriterException if CacheWriter aborts the operation * @throws CacheListenerException if CacheListener throws an exception * @return the boolean true if an entry(key, value)has been removed or @@ -940,12 +941,12 @@ class CPPCACHE_EXPORT Region : public SharedBase { virtual bool localRemoveEx( const CacheableKeyPtr& key, - const UserDataPtr& aCallbackArgument = NULLPTR) = 0; + const UserDataPtr& aCallbackArgument = nullptr) = 0; /** Convenience method allowing key to be a const char* */ template <class KEYTYPE> inline bool localRemoveEx(const KEYTYPE& key, - const UserDataPtr& arg = NULLPTR) { + const UserDataPtr& arg = nullptr) { return localRemoveEx(createKey(key), arg); } @@ -1127,7 +1128,7 @@ class CPPCACHE_EXPORT Region : public SharedBase { * ( {@link AttributesFactory::setClientNotification} ) is true. * * @param isDurable flag to indicate whether this is a durable registration - * @param resultKeys If non-NULLPTR then all the keys on the server that got + * @param resultKeys If non-nullptr then all the keys on the server that got * registered are returned. The vector is cleared at the start to discard * any existing keys in the vector. * @param getInitialValues true to populate the cache with values of all keys @@ -1157,7 +1158,7 @@ class CPPCACHE_EXPORT Region : public SharedBase { * @throws TimeoutException if operation timed out */ virtual void registerAllKeys(bool isDurable = false, - VectorOfCacheableKeyPtr resultKeys = NULLPTR, + VectorOfCacheableKeyPtr resultKeys = nullptr, bool getInitialValues = false, bool receiveValues = true) = 0; @@ -1193,7 +1194,7 @@ class CPPCACHE_EXPORT Region : public SharedBase { * * @param regex The regular expression string. * @param isDurable flag to indicate whether this is a durable registration - * @param resultKeys If non-NULLPTR then the keys that match the regular + * @param resultKeys If non-nullptr then the keys that match the regular * expression on the server are returned. The vector is cleared at the * start to discard any existing keys in the vector. * @param getInitialValues true to populate the cache with values of the keys @@ -1229,7 +1230,7 @@ class CPPCACHE_EXPORT Region : public SharedBase { * @throws TimeoutException if operation timed out */ virtual void registerRegex(const char* regex, bool isDurable = false, - VectorOfCacheableKeyPtr resultKeys = NULLPTR, + VectorOfCacheableKeyPtr resultKeys = nullptr, bool getInitialValues = false, bool receiveValues = true) = 0; @@ -1276,21 +1277,21 @@ class CPPCACHE_EXPORT Region : public SharedBase { * * @param keys the array of keys * @param values Output parameter that provides the map of keys to - * respective values. It is ignored if NULLPTR, and when NULLPTR then at + * respective values. It is ignored if nullptr, and when nullptr then at *least * the <code>addToLocalCache</code> parameter should be true and caching * should be enabled for the region to get values into the region * otherwise an <code>IllegalArgumentException</code> is thrown. * @param exceptions Output parameter that provides the map of keys - * to any exceptions while obtaining the key. It is ignored if NULLPTR. + * to any exceptions while obtaining the key. It is ignored if nullptr. * @param addToLocalCache true if the obtained values have also to be added * to the local cache * @since 8.1 * @param aCallbackArgument an argument that is passed to the callback *functions. - * It may be NULLPTR. Must be serializable if this operation is distributed. + * It may be nullptr. Must be serializable if this operation is distributed. * @throws IllegalArgumentException If the array of keys is empty. Other - * invalid case is when the <code>values</code> parameter is NULLPTR, and + * invalid case is when the <code>values</code> parameter is nullptr, and * either <code>addToLocalCache</code> is false or caching is disabled * for this region. * @throws CacheServerException If an exception is received from the Java @@ -1310,7 +1311,7 @@ class CPPCACHE_EXPORT Region : public SharedBase { HashMapOfCacheablePtr values, HashMapOfExceptionPtr exceptions, bool addToLocalCache = false, - const UserDataPtr& aCallbackArgument = NULLPTR) = 0; + const UserDataPtr& aCallbackArgument = nullptr) = 0; /** * Executes the query on the server based on the predicate. @@ -1394,7 +1395,7 @@ class CPPCACHE_EXPORT Region : public SharedBase { * @throws TimeoutException if operation timed out * @throws CacheClosedException if the cache has been closed * @returns A smart pointer to the single ResultSet or StructSet item, or - * NULLPTR of no results are available. + * nullptr of no results are available. */ virtual SerializablePtr selectValue( const char* predicate, @@ -1413,7 +1414,7 @@ class CPPCACHE_EXPORT Region : public SharedBase { * @param keys the keys to remove from this region. * @param aCallbackArgument an argument that is passed to the callback * functions. - * It is ignored if NULLPTR. It must be serializable if this operation is + * It is ignored if nullptr. It must be serializable if this operation is * distributed. * @throws IllegalArgumentException If the array of keys is empty. * @throws CacheServerException If an exception is received from the Java @@ -1429,7 +1430,7 @@ class CPPCACHE_EXPORT Region : public SharedBase { * @see destroy */ virtual void removeAll(const VectorOfCacheableKey& keys, - const UserDataPtr& aCallbackArgument = NULLPTR) = 0; + const UserDataPtr& aCallbackArgument = nullptr) = 0; /** * Get the size of region. For native client regions, this will give the @@ -1443,6 +1444,8 @@ class CPPCACHE_EXPORT Region : public SharedBase { Region(); virtual ~Region(); + FRIEND_STD_SHARED_PTR(Region) + private: // Disallow copy constructor and assignment operator. Region(const Region&);