You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by jb...@apache.org on 2017/05/17 17:49:43 UTC
[01/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from cppcache
Repository: geode-native
Updated Branches:
refs/heads/develop e2630b160 -> 767033e5c
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/BatchObject.hpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/BatchObject.hpp b/src/tests/cpp/testobject/BatchObject.hpp
index 3a46669..fb65401 100644
--- a/src/tests/cpp/testobject/BatchObject.hpp
+++ b/src/tests/cpp/testobject/BatchObject.hpp
@@ -54,11 +54,11 @@ class TESTOBJECT_EXPORT BatchObject : public TimestampedObject {
CacheableBytesPtr byteArray;
inline uint32_t getObjectSize(const SerializablePtr& obj) const {
- return (obj == NULLPTR ? 0 : obj->objectSize());
+ return (obj == nullptr ? 0 : obj->objectSize());
}
public:
- BatchObject() : index(0), timestamp(0), batch(0), byteArray(NULLPTR) {}
+ BatchObject() : index(0), timestamp(0), batch(0), byteArray(nullptr) {}
BatchObject(int32_t anIndex, int32_t batchSize, int32_t size);
virtual ~BatchObject();
virtual void toData(apache::geode::client::DataOutput& output) const;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/DeltaFastAssetAccount.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/DeltaFastAssetAccount.cpp b/src/tests/cpp/testobject/DeltaFastAssetAccount.cpp
index 67d136e..0401537 100644
--- a/src/tests/cpp/testobject/DeltaFastAssetAccount.cpp
+++ b/src/tests/cpp/testobject/DeltaFastAssetAccount.cpp
@@ -28,7 +28,7 @@ DeltaFastAssetAccount::DeltaFastAssetAccount(int index, bool encodeTimestp,
netWorth = 0.0;
assets = CacheableHashMap::create();
for (int i = 0; i < asstSize; i++) {
- FastAssetPtr asset(new FastAsset(i, maxVal));
+ auto asset = std::make_shared<FastAsset>(i, maxVal);
assets->insert(CacheableInt32::create(i), asset);
netWorth += asset->getValue();
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/DeltaFastAssetAccount.hpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/DeltaFastAssetAccount.hpp b/src/tests/cpp/testobject/DeltaFastAssetAccount.hpp
index b8c420c..2037530 100644
--- a/src/tests/cpp/testobject/DeltaFastAssetAccount.hpp
+++ b/src/tests/cpp/testobject/DeltaFastAssetAccount.hpp
@@ -59,16 +59,16 @@ class TESTOBJECT_EXPORT DeltaFastAssetAccount : public Cacheable, public Delta {
bool getBeforeUpdate;
inline uint32_t getObjectSize(const SerializablePtr& obj) const {
- return (obj == NULLPTR ? 0 : obj->objectSize());
+ return (obj == nullptr ? 0 : obj->objectSize());
}
public:
DeltaFastAssetAccount()
: encodeTimestamp(0),
acctId(0),
- customerName(NULLPTR),
+ customerName(nullptr),
netWorth(0.0),
- assets(NULLPTR),
+ assets(nullptr),
timestamp(0),
getBeforeUpdate(false) {}
DeltaFastAssetAccount(int index, bool encodeTimestp, int maxVal,
@@ -134,12 +134,12 @@ class TESTOBJECT_EXPORT DeltaFastAssetAccount : public Cacheable, public Delta {
}
virtual DeltaPtr clone() {
- DeltaFastAssetAccountPtr clonePtr(new DeltaFastAssetAccount());
+ auto clonePtr = std::make_shared<DeltaFastAssetAccount>();
clonePtr->assets = CacheableHashMap::create();
for (HashMapOfCacheable::Iterator item = this->assets->begin();
item != this->assets->end(); item++) {
- CacheableInt32Ptr key = dynCast<CacheableInt32Ptr>(item.first());
- FastAssetPtr asset = dynCast<FastAssetPtr>(item.second());
+ auto key = std::dynamic_pointer_cast<CacheableInt32>(item.first());
+ auto asset = std::dynamic_pointer_cast<FastAsset>(item.second());
clonePtr->assets->insert(key, asset->copy());
}
return clonePtr;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/DeltaPSTObject.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/DeltaPSTObject.cpp b/src/tests/cpp/testobject/DeltaPSTObject.cpp
index 2b4b42a..4f3dfdc 100644
--- a/src/tests/cpp/testobject/DeltaPSTObject.cpp
+++ b/src/tests/cpp/testobject/DeltaPSTObject.cpp
@@ -31,7 +31,7 @@ DeltaPSTObject::DeltaPSTObject(int size, bool encodeKey, bool encodeTimestamp) {
field1 = 1234;
field2 = '*';
if (size == 0) {
- valueData = NULLPTR;
+ valueData = nullptr;
} else {
encodeKey = true;
valueData = ArrayOfByte::init(size, encodeKey, false);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/DeltaPSTObject.hpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/DeltaPSTObject.hpp b/src/tests/cpp/testobject/DeltaPSTObject.hpp
index e19b791..1e742ee 100644
--- a/src/tests/cpp/testobject/DeltaPSTObject.hpp
+++ b/src/tests/cpp/testobject/DeltaPSTObject.hpp
@@ -53,9 +53,13 @@ class TESTOBJECT_EXPORT DeltaPSTObject : public Cacheable, public Delta {
int32_t field1;
int8_t field2;
CacheableBytesPtr valueData;
+ std::shared_ptr<DeltaPSTObject> shared_from_this() {
+ return std::static_pointer_cast<DeltaPSTObject>(
+ Serializable::shared_from_this());
+ }
public:
- DeltaPSTObject() : timestamp(0), valueData(NULLPTR) {}
+ DeltaPSTObject() : timestamp(0), valueData(nullptr) {}
DeltaPSTObject(int size, bool encodeKey, bool encodeTimestamp);
virtual ~DeltaPSTObject() {}
void toData(apache::geode::client::DataOutput& output) const;
@@ -86,8 +90,8 @@ class TESTOBJECT_EXPORT DeltaPSTObject : public Cacheable, public Delta {
timestamp = tusec * 1000;
}
DeltaPtr clone() {
- DeltaPtr clonePtr(this);
- return clonePtr;
+ // TODO shared_ptr - this isn't actually cloning.
+ return shared_from_this();
}
static Serializable* createDeserializable() { return new DeltaPSTObject(); }
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/DeltaTestImpl.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/DeltaTestImpl.cpp b/src/tests/cpp/testobject/DeltaTestImpl.cpp
index a9d2f9d..43ddd7c 100644
--- a/src/tests/cpp/testobject/DeltaTestImpl.cpp
+++ b/src/tests/cpp/testobject/DeltaTestImpl.cpp
@@ -37,7 +37,7 @@ DeltaTestImpl::DeltaTestImpl() {
doubleVar = 1.1;
uint8_t byte = 'A';
byteArr = CacheableBytes::create(&byte, 1);
- testObj = NULLPTR;
+ testObj = nullptr;
m_hasDelta = false;
deltaBits = 0;
toDeltaCounter = 0;
@@ -53,12 +53,12 @@ DeltaTestImpl::DeltaTestImpl(DeltaTestImplPtr rhs) {
intVar = rhs->intVar;
str = CacheableString::create(rhs->str->asChar());
doubleVar = rhs->doubleVar;
- byteArr = (rhs->byteArr == NULLPTR ? NULLPTR : CacheableBytes::create(
+ byteArr = (rhs->byteArr == nullptr ? nullptr : CacheableBytes::create(
rhs->byteArr->value(),
rhs->byteArr->length()));
- testObj = (rhs->testObj == NULLPTR
- ? NULLPTR
- : TestObject1Ptr(new TestObject1(*(rhs->testObj.ptr()))));
+ testObj = (rhs->testObj == nullptr
+ ? nullptr
+ : TestObject1Ptr(new TestObject1(*(rhs->testObj.get()))));
toDeltaCounter = rhs->getToDeltaCounter();
fromDeltaCounter = rhs->getFromDeltaCounter();
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/DeltaTestImpl.hpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/DeltaTestImpl.hpp b/src/tests/cpp/testobject/DeltaTestImpl.hpp
index b71a00c..a8b4f29 100644
--- a/src/tests/cpp/testobject/DeltaTestImpl.hpp
+++ b/src/tests/cpp/testobject/DeltaTestImpl.hpp
@@ -86,9 +86,8 @@ class TESTOBJECT_EXPORT DeltaTestImpl : public Cacheable, public Delta {
uint32_t objectSize() const { return 0; }
DeltaPtr clone() {
- DeltaPtr clonePtr(this);
- return clonePtr;
- // return DeltaPtr( this );
+ return DeltaPtr(
+ std::dynamic_pointer_cast<DeltaTestImpl>(shared_from_this()));
}
static Serializable* create() { return new DeltaTestImpl(); }
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/EqStruct.hpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/EqStruct.hpp b/src/tests/cpp/testobject/EqStruct.hpp
index 999f4c4..c7ef273 100644
--- a/src/tests/cpp/testobject/EqStruct.hpp
+++ b/src/tests/cpp/testobject/EqStruct.hpp
@@ -100,7 +100,7 @@ class TESTOBJECT_EXPORT EqStruct : public TimestampedObject {
char* var9;
inline uint32_t getObjectSize(const SerializablePtr& obj) const {
- return (obj == NULLPTR ? 0 : obj->objectSize());
+ return (obj == nullptr ? 0 : obj->objectSize());
}
public:
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/FastAsset.hpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/FastAsset.hpp b/src/tests/cpp/testobject/FastAsset.hpp
index e20737c..0b929b4 100644
--- a/src/tests/cpp/testobject/FastAsset.hpp
+++ b/src/tests/cpp/testobject/FastAsset.hpp
@@ -55,7 +55,7 @@ class TESTOBJECT_EXPORT FastAsset : public TimestampedObject {
double value;
inline uint32_t getObjectSize(const SerializablePtr& obj) const {
- return (obj == NULLPTR ? 0 : obj->objectSize());
+ return (obj == nullptr ? 0 : obj->objectSize());
}
public:
@@ -92,7 +92,7 @@ class TESTOBJECT_EXPORT FastAsset : public TimestampedObject {
* Makes a copy of this asset.
*/
FastAssetPtr copy() {
- FastAssetPtr asset(new FastAsset());
+ auto asset = std::make_shared<FastAsset>();
asset->setAssetId(getAssetId());
asset->setValue(getValue());
return asset;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/FastAssetAccount.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/FastAssetAccount.cpp b/src/tests/cpp/testobject/FastAssetAccount.cpp
index 8d1040e..58b7d40 100644
--- a/src/tests/cpp/testobject/FastAssetAccount.cpp
+++ b/src/tests/cpp/testobject/FastAssetAccount.cpp
@@ -30,7 +30,7 @@ FastAssetAccount::FastAssetAccount(int idx, bool encodeTimestp, int maxVal,
netWorth = 0.0;
assets = CacheableHashMap::create();
for (int i = 0; i < asstSize; i++) {
- FastAssetPtr asset(new FastAsset(i, maxVal));
+ auto asset = std::make_shared<FastAsset>(i, maxVal);
assets->insert(CacheableInt32::create(i), asset);
netWorth += asset->getValue();
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/FastAssetAccount.hpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/FastAssetAccount.hpp b/src/tests/cpp/testobject/FastAssetAccount.hpp
index 6fe7982..1127341 100644
--- a/src/tests/cpp/testobject/FastAssetAccount.hpp
+++ b/src/tests/cpp/testobject/FastAssetAccount.hpp
@@ -56,16 +56,16 @@ class TESTOBJECT_EXPORT FastAssetAccount : public TimestampedObject {
uint64_t timestamp;
inline uint32_t getObjectSize(const SerializablePtr& obj) const {
- return (obj == NULLPTR ? 0 : obj->objectSize());
+ return (obj == nullptr ? 0 : obj->objectSize());
}
public:
FastAssetAccount()
: encodeTimestamp(0),
acctId(0),
- customerName(NULLPTR),
+ customerName(nullptr),
netWorth(0.0),
- assets(NULLPTR),
+ assets(nullptr),
timestamp(0) {}
FastAssetAccount(int index, bool encodeTimestp, int maxVal, int asstSize = 0);
virtual ~FastAssetAccount();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/InvalidPdxUsage.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/InvalidPdxUsage.cpp b/src/tests/cpp/testobject/InvalidPdxUsage.cpp
index a8e4a84..7ebf332 100644
--- a/src/tests/cpp/testobject/InvalidPdxUsage.cpp
+++ b/src/tests/cpp/testobject/InvalidPdxUsage.cpp
@@ -523,42 +523,45 @@ void InvalidPdxUsage::fromData(PdxReaderPtr pr) {
}
try {
- m_arraylist = pr->readObject("");
+ m_arraylist =
+ std::dynamic_pointer_cast<CacheableArrayList>(pr->readObject(""));
} catch (IllegalStateException& excpt) {
exceptionCounter++;
LOGINFO("readObject():: Got expected Exception :: %s ", excpt.getMessage());
}
try {
- m_map = dynCast<CacheableHashMapPtr>(pr->readObject(""));
+ m_map = std::dynamic_pointer_cast<CacheableHashMap>(pr->readObject(""));
} catch (IllegalStateException& excpt) {
exceptionCounter++;
LOGINFO("readObject():: Got expected Exception :: %s ", excpt.getMessage());
}
try {
- m_hashtable = pr->readObject("");
+ m_hashtable =
+ std::dynamic_pointer_cast<CacheableHashTable>(pr->readObject(""));
} catch (IllegalStateException& excpt) {
exceptionCounter++;
LOGINFO("readObject():: Got expected Exception :: %s ", excpt.getMessage());
}
try {
- m_vector = pr->readObject("");
+ m_vector = std::dynamic_pointer_cast<CacheableVector>(pr->readObject(""));
} catch (IllegalStateException& excpt) {
exceptionCounter++;
LOGINFO("readObject():: Got expected Exception :: %s ", excpt.getMessage());
}
try {
- m_chs = pr->readObject("");
+ m_chs = std::dynamic_pointer_cast<CacheableHashSet>(pr->readObject(""));
} catch (IllegalStateException& excpt) {
exceptionCounter++;
LOGINFO("readObject():: Got expected Exception :: %s ", excpt.getMessage());
}
try {
- m_clhs = pr->readObject("");
+ m_clhs =
+ std::dynamic_pointer_cast<CacheableLinkedHashSet>(pr->readObject(""));
} catch (IllegalStateException& excpt) {
exceptionCounter++;
LOGINFO("readObject():: Got expected Exception :: %s ", excpt.getMessage());
@@ -572,7 +575,7 @@ void InvalidPdxUsage::fromData(PdxReaderPtr pr) {
}
try {
- m_date = pr->readDate("");
+ m_date = std::dynamic_pointer_cast<CacheableDate>(pr->readDate(""));
} catch (IllegalStateException& excpt) {
exceptionCounter++;
LOGINFO("readDate():: Got expected Exception :: %s ", excpt.getMessage());
@@ -752,7 +755,7 @@ void InvalidPdxUsage::fromData(PdxReaderPtr pr) {
}
try {
- m_pdxEnum = pr->readObject("");
+ m_pdxEnum = std::static_pointer_cast<CacheableEnum>(pr->readObject(""));
} catch (IllegalStateException& excpt) {
exceptionCounter++;
LOGINFO("readObject():: Got expected Exception :: %s ", excpt.getMessage());
@@ -841,16 +844,16 @@ bool InvalidPdxUsage::equals(PdxTests::InvalidPdxUsage& other,
for (int i = 0; i < m_objectArray->size(); i++) {
AddressWithInvalidAPIUsage* otherAddr1 =
dynamic_cast<AddressWithInvalidAPIUsage*>(
- ot->m_objectArray->at(i).ptr());
+ ot->m_objectArray->at(i).get());
AddressWithInvalidAPIUsage* myAddr1 =
- dynamic_cast<AddressWithInvalidAPIUsage*>(m_objectArray->at(i).ptr());
+ dynamic_cast<AddressWithInvalidAPIUsage*>(m_objectArray->at(i).get());
if (!otherAddr1->equals(*myAddr1)) return false;
}
LOGINFO("PdxObject::equals isPdxReadSerialized = %d", isPdxReadSerialized);
}
- CacheableEnumPtr myenum = dynCast<CacheableEnumPtr>(m_pdxEnum);
- CacheableEnumPtr otenum = dynCast<CacheableEnumPtr>(ot->m_pdxEnum);
+ auto myenum = m_pdxEnum;
+ auto otenum = ot->m_pdxEnum;
if (myenum->getEnumOrdinal() != otenum->getEnumOrdinal()) return false;
if (strcmp(myenum->getEnumClassName(), otenum->getEnumClassName()) != 0) {
return false;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/InvalidPdxUsage.hpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/InvalidPdxUsage.hpp b/src/tests/cpp/testobject/InvalidPdxUsage.hpp
index d5a613b..f4301a6 100644
--- a/src/tests/cpp/testobject/InvalidPdxUsage.hpp
+++ b/src/tests/cpp/testobject/InvalidPdxUsage.hpp
@@ -280,7 +280,7 @@ class TESTOBJECT_EXPORT InvalidPdxUsage : public PdxSerializable {
int8_t* m_byte253;
int8_t* m_byte65535;
int8_t* m_byte65536;
- CacheablePtr m_pdxEnum;
+ CacheableEnumPtr m_pdxEnum;
CacheableObjectArrayPtr m_objectArray;
int32_t boolArrayLen;
@@ -454,19 +454,19 @@ class TESTOBJECT_EXPORT InvalidPdxUsage : public PdxSerializable {
keys.push_back(CacheableKey::create(key));
}*/
- m_objectArray = NULLPTR;
+ m_objectArray = nullptr;
/*AddressWithInvalidAPIUsagePtr objectArray[3];
objectArray[0] = new AddressWithInvalidAPIUsage(1, "strt-1", "city-1");
objectArray[1] = new AddressWithInvalidAPIUsage(2, "strt-2", "city-2");
objectArray[2] = new AddressWithInvalidAPIUsage(3, "strt-3", "city-3");*/
/*
- AddressWithInvalidAPIUsagePtr addObj1(new AddressWithInvalidAPIUsage(1,
- "abc", "ABC"));
- AddressWithInvalidAPIUsagePtr addObj2(new AddressWithInvalidAPIUsage(2,
- "def", "DEF"));
- AddressWithInvalidAPIUsagePtr addObj3(new AddressWithInvalidAPIUsage(3,
- "ghi", "GHI"));*/
+ auto addObj1 = std::make_shared<AddressWithInvalidAPIUsage>(1,
+ "abc", "ABC");
+ auto addObj2 = std::make_shared<AddressWithInvalidAPIUsage>(2,
+ "def", "DEF");
+ auto addObj3 = std::make_shared<AddressWithInvalidAPIUsage>(3,
+ "ghi", "GHI");*/
m_objectArray = CacheableObjectArray::create();
m_objectArray->push_back(AddressWithInvalidAPIUsagePtr(
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/NestedPdxObject.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/NestedPdxObject.cpp b/src/tests/cpp/testobject/NestedPdxObject.cpp
index 17a6356..660f13e 100644
--- a/src/tests/cpp/testobject/NestedPdxObject.cpp
+++ b/src/tests/cpp/testobject/NestedPdxObject.cpp
@@ -42,7 +42,7 @@ void ChildPdx::fromData(PdxReaderPtr pr) {
m_childId = pr->readInt("m_childId");
LOGINFO("ChildPdx::fromData() m_childId = %d ", m_childId);
- m_enum = pr->readObject("m_enum");
+ m_enum = std::static_pointer_cast<CacheableEnum>(pr->readObject("m_enum"));
m_childName = pr->readString("m_childName");
LOGINFO("ChildPdx::fromData() end...");
@@ -91,7 +91,7 @@ void ParentPdx::toData(PdxWriterPtr pw) {
LOGDEBUG("ParentPdx::toData() m_wideparentName......");
pw->writeWideStringArray("m_wideparentArrayName", m_wideparentArrayName, 3);
LOGDEBUG("ParentPdx::toData() m_wideparentArrayName......");
- pw->writeObject("m_childPdx", (ChildPdxPtr)m_childPdx);
+ pw->writeObject("m_childPdx", m_childPdx);
LOGDEBUG("ParentPdx::toData() m_childPdx......");
pw->markIdentityField("m_childPdx");
@@ -108,7 +108,7 @@ void ParentPdx::fromData(PdxReaderPtr pr) {
m_parentId = pr->readInt("m_parentId");
LOGINFO("ParentPdx::fromData() m_parentId = %d ", m_parentId);
- m_enum = pr->readObject("m_enum");
+ m_enum = std::static_pointer_cast<CacheableEnum>(pr->readObject("m_enum"));
LOGINFO("ParentPdx::fromData() read gender ");
m_parentName = pr->readString("m_parentName");
LOGINFO("ParentPdx::fromData() m_parentName = %s ", m_parentName);
@@ -121,7 +121,7 @@ void ParentPdx::fromData(PdxReaderPtr pr) {
m_wideparentArrayName[i]);
}
LOGINFO("ParentPdx::fromData() m_wideparentArrayName done ");
- m_childPdx = /*dynCast<SerializablePtr>*/ (pr->readObject("m_childPdx"));
+ m_childPdx = /*std::dynamic_pointer_cast<Serializable>*/ (pr->readObject("m_childPdx"));
LOGINFO("ParentPdx::fromData() start3...");
m_char = pr->readChar("m_char");
@@ -185,8 +185,8 @@ bool ParentPdx::equals(ParentPdx& other, bool isPdxReadSerialized) const {
}
if (!isPdxReadSerialized) {
- ChildPdx* ch1 = dynamic_cast<ChildPdx*>(m_childPdx.ptr());
- ChildPdx* ch2 = dynamic_cast<ChildPdx*>(other.m_childPdx.ptr());
+ ChildPdx* ch1 = dynamic_cast<ChildPdx*>(m_childPdx.get());
+ ChildPdx* ch2 = dynamic_cast<ChildPdx*>(other.m_childPdx.get());
if (ch1->equals(*ch2)) {
LOGINFO("ParentPdx::equals3");
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/NestedPdxObject.hpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/NestedPdxObject.hpp b/src/tests/cpp/testobject/NestedPdxObject.hpp
index 2e792c1..2ab02ca 100644
--- a/src/tests/cpp/testobject/NestedPdxObject.hpp
+++ b/src/tests/cpp/testobject/NestedPdxObject.hpp
@@ -120,7 +120,7 @@ class TESTOBJECT_EXPORT ParentPdx : public PdxSerializable {
size_t strSize = strlen(buf) + 1;
m_parentName = new char[strSize];
memcpy(m_parentName, buf, strSize);
- m_childPdx = new ChildPdx(id /** 1393*/);
+ m_childPdx = std::make_shared<ChildPdx>(id /** 1393*/);
LOGDEBUG("parentPdx buf is %s ", buf);
m_enum = CacheableEnum::create("Gender", "male", 6);
m_wideparentName = L"Wide Parent name";
@@ -168,7 +168,9 @@ class TESTOBJECT_EXPORT ParentPdx : public PdxSerializable {
wchar_t** getWideParentArrayName() { return m_wideparentArrayName; }
- ChildPdxPtr getChildPdx() { return m_childPdx; }
+ ChildPdxPtr getChildPdx() {
+ return std::static_pointer_cast<ChildPdx>(m_childPdx);
+ }
CacheableEnumPtr getEnum() { return m_enum; }
@@ -251,7 +253,8 @@ class TESTOBJECT_EXPORT PdxEnumTestClass : public PdxSerializable {
void fromData(PdxReaderPtr pr) {
m_id = pr->readInt("m_id");
- m_enumid = pr->readObject("m_enumid");
+ m_enumid =
+ std::static_pointer_cast<CacheableEnum>(pr->readObject("m_enumid"));
}
CacheableStringPtr toString() const {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/NonPdxType.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/NonPdxType.cpp b/src/tests/cpp/testobject/NonPdxType.cpp
index ed124ab..b77bdd2 100644
--- a/src/tests/cpp/testobject/NonPdxType.cpp
+++ b/src/tests/cpp/testobject/NonPdxType.cpp
@@ -112,18 +112,20 @@ bool PdxTests::NonPdxType::equals(PdxTests::NonPdxType& other,
if (!isPdxReadSerialized) {
for (int i = 0; i < m_objectArray->size(); i++) {
- PdxWrapperPtr wrapper1 = dynCast<PdxWrapperPtr>(ot->m_objectArray->at(i));
+ auto wrapper1 =
+ std::dynamic_pointer_cast<PdxWrapper>(ot->m_objectArray->at(i));
NonPdxAddress* otherAddr1 =
reinterpret_cast<NonPdxAddress*>(wrapper1->getObject());
- PdxWrapperPtr wrapper2 = dynCast<PdxWrapperPtr>(m_objectArray->at(i));
+ auto wrapper2 =
+ std::dynamic_pointer_cast<PdxWrapper>(m_objectArray->at(i));
NonPdxAddress* myAddr1 =
reinterpret_cast<NonPdxAddress*>(wrapper2->getObject());
if (!otherAddr1->equals(*myAddr1)) return false;
}
}
- CacheableEnumPtr myenum = dynCast<CacheableEnumPtr>(m_pdxEnum);
- CacheableEnumPtr otenum = dynCast<CacheableEnumPtr>(ot->m_pdxEnum);
+ auto myenum = std::dynamic_pointer_cast<CacheableEnum>(m_pdxEnum);
+ auto otenum = std::dynamic_pointer_cast<CacheableEnum>(ot->m_pdxEnum);
if (myenum->getEnumOrdinal() != otenum->getEnumOrdinal()) return false;
if (strcmp(myenum->getEnumClassName(), otenum->getEnumClassName()) != 0) {
return false;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/NonPdxType.hpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/NonPdxType.hpp b/src/tests/cpp/testobject/NonPdxType.hpp
index 2ee0791..7b43ea5 100644
--- a/src/tests/cpp/testobject/NonPdxType.hpp
+++ b/src/tests/cpp/testobject/NonPdxType.hpp
@@ -446,7 +446,9 @@ class TESTOBJECT_EXPORT NonPdxType {
CacheableObjectArrayPtr getCacheableObjectArray() { return m_objectArray; }
- CacheableEnumPtr getEnum() { return m_pdxEnum; }
+ CacheableEnumPtr getEnum() {
+ return std::static_pointer_cast<CacheableEnum>(m_pdxEnum);
+ }
int32_t getByteArrayLength() { return byteArrayLen; }
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/PSTObject.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/PSTObject.cpp b/src/tests/cpp/testobject/PSTObject.cpp
index 76189c5..a9299cc 100644
--- a/src/tests/cpp/testobject/PSTObject.cpp
+++ b/src/tests/cpp/testobject/PSTObject.cpp
@@ -31,7 +31,7 @@ PSTObject::PSTObject(int size, bool encodeKey, bool encodeTimestamp) {
field1 = 1234;
field2 = '*';
if (size == 0) {
- valueData = NULLPTR;
+ valueData = nullptr;
} else {
encodeKey = true;
valueData = ArrayOfByte::init(size, encodeKey, false);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/PSTObject.hpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/PSTObject.hpp b/src/tests/cpp/testobject/PSTObject.hpp
index 147e4d7..cdeac83 100644
--- a/src/tests/cpp/testobject/PSTObject.hpp
+++ b/src/tests/cpp/testobject/PSTObject.hpp
@@ -54,11 +54,11 @@ class TESTOBJECT_EXPORT PSTObject : public TimestampedObject {
CacheableBytesPtr valueData;
inline uint32_t getObjectSize(const SerializablePtr& obj) const {
- return (obj == NULLPTR ? 0 : obj->objectSize());
+ return (obj == nullptr ? 0 : obj->objectSize());
}
public:
- PSTObject() : timestamp(0), valueData(NULLPTR) {}
+ PSTObject() : timestamp(0), valueData(nullptr) {}
PSTObject(int size, bool encodeKey, bool encodeTimestamp);
virtual ~PSTObject();
virtual void toData(apache::geode::client::DataOutput& output) const;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/PdxClassV1.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/PdxClassV1.cpp b/src/tests/cpp/testobject/PdxClassV1.cpp
index b4a7163..9237243 100644
--- a/src/tests/cpp/testobject/PdxClassV1.cpp
+++ b/src/tests/cpp/testobject/PdxClassV1.cpp
@@ -54,12 +54,12 @@ int PdxType1V1::getHashCode() {
}
bool PdxType1V1::equals(PdxSerializablePtr obj) {
- if (obj == NULLPTR) return false;
+ if (obj == nullptr) return false;
- PdxType1V1Ptr pap = dynCast<PdxType1V1Ptr>(obj);
- if (pap == NULLPTR) return false;
+ auto pap = std::dynamic_pointer_cast<PdxType1V1>(obj);
+ if (pap == nullptr) return false;
- if (pap == this) return true;
+ if (pap.get() == this) return true;
if (m_i1 + m_diffInSameFields <= pap->m_i1 &&
m_i2 + m_diffInSameFields <= pap->m_i2 &&
@@ -195,12 +195,12 @@ int PdxType2V1::getHashCode() {
}
bool PdxType2V1::equals(PdxSerializablePtr obj) {
- if (obj == NULLPTR) return false;
+ if (obj == nullptr) return false;
- PdxType2V1Ptr pap = dynCast<PdxType2V1Ptr>(obj);
- if (pap == NULLPTR) return false;
+ auto pap = std::dynamic_pointer_cast<PdxType2V1>(obj);
+ if (pap == nullptr) return false;
- if (pap == this) return true;
+ if (pap.get() == this) return true;
if (m_i1 + m_diffInSameFields <= pap->m_i1 &&
m_i2 + m_diffInSameFields <= pap->m_i2 &&
@@ -273,12 +273,12 @@ int PdxType3V1::getHashCode() {
}
bool PdxType3V1::equals(PdxSerializablePtr obj) {
- if (obj == NULLPTR) return false;
+ if (obj == nullptr) return false;
- PdxType3V1Ptr pap = dynCast<PdxType3V1Ptr>(obj);
- if (pap == NULLPTR) return false;
+ auto pap = std::dynamic_pointer_cast<PdxType3V1>(obj);
+ if (pap == nullptr) return false;
- if (pap == this) return true;
+ if (pap.get() == this) return true;
if (m_i1 + m_diffInSameFields <= pap->m_i1 &&
m_i2 + m_diffInSameFields <= pap->m_i2 &&
@@ -374,12 +374,12 @@ int PdxTypesV1R1::getHashCode() {
}
bool PdxTypesV1R1::equals(PdxSerializablePtr obj) {
- if (obj == NULLPTR) return false;
+ if (obj == nullptr) return false;
- PdxTypesV1R1Ptr pap = dynCast<PdxTypesV1R1Ptr>(obj);
- if (pap == NULLPTR) return false;
+ auto pap = std::dynamic_pointer_cast<PdxTypesV1R1>(obj);
+ if (pap == nullptr) return false;
- if (pap == this) return true;
+ if (pap.get() == this) return true;
if (m_i1 + m_diffInSameFields <= pap->m_i1 &&
m_i2 + m_diffInSameFields <= pap->m_i2 &&
@@ -445,12 +445,12 @@ int PdxTypesV1R2::getHashCode() {
}
bool PdxTypesV1R2::equals(PdxSerializablePtr obj) {
- if (obj == NULLPTR) return false;
+ if (obj == nullptr) return false;
- PdxTypesV1R2Ptr pap = dynCast<PdxTypesV1R2Ptr>(obj);
- if (pap == NULLPTR) return false;
+ auto pap = std::dynamic_pointer_cast<PdxTypesV1R2>(obj);
+ if (pap == nullptr) return false;
- if (pap == this) return true;
+ if (pap.get() == this) return true;
if (m_i1 + m_diffInSameFields <= pap->m_i1 &&
m_i2 + m_diffInSameFields <= pap->m_i2 &&
@@ -515,13 +515,12 @@ int PdxTypesIgnoreUnreadFieldsV1::getHashCode() {
}
bool PdxTypesIgnoreUnreadFieldsV1::equals(PdxSerializablePtr obj) {
- if (obj == NULLPTR) return false;
+ if (obj == nullptr) return false;
- PdxTypesIgnoreUnreadFieldsV1Ptr pap =
- dynCast<PdxTypesIgnoreUnreadFieldsV1Ptr>(obj);
- if (pap == NULLPTR) return false;
+ auto pap = std::dynamic_pointer_cast<PdxTypesIgnoreUnreadFieldsV1>(obj);
+ if (pap == nullptr) return false;
- if (pap == this) return true;
+ if (pap.get() == this) return true;
if (m_i1 + m_diffInSameFields <= pap->m_i1 &&
m_i2 + m_diffInSameFields <= pap->m_i2 &&
@@ -595,7 +594,7 @@ void PdxVersionedV1::init(int32_t size) {
m_charArray[0] = 'c';
m_charArray[1] = 'v';
- m_dateTime = NULLPTR;
+ m_dateTime = nullptr;
m_int16Array = new int16_t[size];
m_int32Array = new int32_t[size];
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/PdxClassV2.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/PdxClassV2.cpp b/src/tests/cpp/testobject/PdxClassV2.cpp
index 7e12986..cf70f6a 100644
--- a/src/tests/cpp/testobject/PdxClassV2.cpp
+++ b/src/tests/cpp/testobject/PdxClassV2.cpp
@@ -58,12 +58,12 @@ int PdxTypes1V2::getHashCode() {
}
bool PdxTypes1V2::equals(PdxSerializablePtr obj) {
- if (obj == NULLPTR) return false;
+ if (obj == nullptr) return false;
- PdxTypes1V2Ptr pap = dynCast<PdxTypes1V2Ptr>(obj);
- if (pap == NULLPTR) return false;
+ auto pap = std::dynamic_pointer_cast<PdxTypes1V2>(obj);
+ if (pap == nullptr) return false;
- if (pap == this) return true;
+ if (pap.get() == this) return true;
if (m_i1 + m_diffInSameFields <= pap->m_i1 &&
m_i2 + m_diffInSameFields <= pap->m_i2 &&
@@ -153,12 +153,12 @@ int PdxTypes2V2::getHashCode() {
}
bool PdxTypes2V2::equals(PdxSerializablePtr obj) {
- if (obj == NULLPTR) return false;
+ if (obj == nullptr) return false;
- PdxTypes2V2Ptr pap = dynCast<PdxTypes2V2Ptr>(obj);
- if (pap == NULLPTR) return false;
+ auto pap = std::dynamic_pointer_cast<PdxTypes2V2>(obj);
+ if (pap == nullptr) return false;
- if (pap == this) return true;
+ if (pap.get() == this) return true;
if (m_i1 + m_diffInSameFields <= pap->m_i1 &&
m_i2 + m_diffInSameFields <= pap->m_i2 &&
@@ -242,12 +242,12 @@ int PdxTypes3V2::getHashCode() {
}
bool PdxTypes3V2::equals(PdxSerializablePtr obj) {
- if (obj == NULLPTR) return false;
+ if (obj == nullptr) return false;
- PdxTypes3V2Ptr pap = dynCast<PdxTypes3V2Ptr>(obj);
- if (pap == NULLPTR) return false;
+ auto pap = std::dynamic_pointer_cast<PdxTypes3V2>(obj);
+ if (pap == nullptr) return false;
- if (pap == this) return true;
+ if (pap.get() == this) return true;
if (m_i1 + m_diffInSameFields <= pap->m_i1 &&
m_i2 + m_diffInSameFields <= pap->m_i2 &&
@@ -350,12 +350,12 @@ int PdxTypesR1V2::getHashCode() {
}
bool PdxTypesR1V2::equals(PdxSerializablePtr obj) {
- if (obj == NULLPTR) return false;
+ if (obj == nullptr) return false;
- PdxTypesR1V2Ptr pap = dynCast<PdxTypesR1V2Ptr>(obj);
- if (pap == NULLPTR) return false;
+ auto pap = std::dynamic_pointer_cast<PdxTypesR1V2>(obj);
+ if (pap == nullptr) return false;
- if (pap == this) return true;
+ if (pap.get() == this) return true;
if (m_i1 + m_diffInSameFields <= pap->m_i1 &&
m_i2 + m_diffInSameFields <= pap->m_i2 &&
@@ -442,12 +442,12 @@ int PdxTypesR2V2::getHashCode() {
}
bool PdxTypesR2V2::equals(PdxSerializablePtr obj) {
- if (obj == NULLPTR) return false;
+ if (obj == nullptr) return false;
- PdxTypesR2V2Ptr pap = dynCast<PdxTypesR2V2Ptr>(obj);
- if (pap == NULLPTR) return false;
+ auto pap = std::dynamic_pointer_cast<PdxTypesR2V2>(obj);
+ if (pap == nullptr) return false;
- if (pap == this) return true;
+ if (pap.get() == this) return true;
if (m_i1 + m_diffInSameFields <= pap->m_i1 &&
m_i2 + m_diffInSameFields <= pap->m_i2 &&
@@ -539,13 +539,12 @@ int PdxTypesIgnoreUnreadFieldsV2::getHashCode() {
}
bool PdxTypesIgnoreUnreadFieldsV2::equals(PdxSerializablePtr obj) {
- if (obj == NULLPTR) return false;
+ if (obj == nullptr) return false;
- PdxTypesIgnoreUnreadFieldsV2Ptr pap =
- dynCast<PdxTypesIgnoreUnreadFieldsV2Ptr>(obj);
- if (pap == NULLPTR) return false;
+ auto pap = std::dynamic_pointer_cast<PdxTypesIgnoreUnreadFieldsV2>(obj);
+ if (pap == nullptr) return false;
- if (pap == this) return true;
+ if (pap.get() == this) return true;
LOGINFO("PdxTypesIgnoreUnreadFieldsV2::equals");
LOGINFO("m_i1 =%d m_diffInSameFields=%d pap->m_i1=%d", m_i1,
@@ -645,7 +644,7 @@ void PdxVersionedV2::init(int32_t size) {
m_charArray[0] = 'c';
m_charArray[1] = 'v';
- m_dateTime = NULLPTR;
+ m_dateTime = nullptr;
m_int16Array = new int16_t[size];
m_int32Array = new int32_t[size];
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/PdxType.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/PdxType.cpp b/src/tests/cpp/testobject/PdxType.cpp
index b284e2f..025a072 100644
--- a/src/tests/cpp/testobject/PdxType.cpp
+++ b/src/tests/cpp/testobject/PdxType.cpp
@@ -196,22 +196,26 @@ void PdxTests::PdxType::fromData(PdxReaderPtr pr) {
m_byteArray = pr->readByteArray("m_byteArray", byteArrayLen);
m_charArray = pr->readWideCharArray("m_charArray", charArrayLen);
- m_arraylist = pr->readObject("m_arraylist");
- m_linkedlist =
- dynCast<CacheableLinkedListPtr>(pr->readObject("m_linkedlist"));
- m_map = dynCast<CacheableHashMapPtr>(pr->readObject("m_map"));
+ m_arraylist = std::static_pointer_cast<CacheableArrayList>(
+ pr->readObject("m_arraylist"));
+ m_linkedlist = std::static_pointer_cast<CacheableLinkedList>(
+ pr->readObject("m_linkedlist"));
+ m_map = std::static_pointer_cast<CacheableHashMap>(pr->readObject("m_map"));
// TODO:Check for the size
- m_hashtable = pr->readObject("m_hashtable");
+ m_hashtable = std::static_pointer_cast<CacheableHashTable>(
+ pr->readObject("m_hashtable"));
// TODO:Check for the size
- m_vector = pr->readObject("m_vector");
+ m_vector =
+ std::static_pointer_cast<CacheableVector>(pr->readObject("m_vector"));
// TODO::Check for size
- m_chs = pr->readObject("m_chs");
+ m_chs = std::static_pointer_cast<CacheableHashSet>(pr->readObject("m_chs"));
// TODO::Size check
- m_clhs = pr->readObject("m_clhs");
+ m_clhs = std::static_pointer_cast<CacheableLinkedHashSet>(
+ pr->readObject("m_clhs"));
// TODO:Size check
m_string = pr->readString("m_string"); // GenericValCompare
@@ -310,8 +314,8 @@ bool PdxTests::PdxType::equals(PdxTests::PdxType& other,
if (!isPdxReadSerialized) {
for (int i = 0; i < m_objectArray->size(); i++) {
Address* otherAddr1 =
- dynamic_cast<Address*>(ot->m_objectArray->at(i).ptr());
- Address* myAddr1 = dynamic_cast<Address*>(m_objectArray->at(i).ptr());
+ dynamic_cast<Address*>(ot->m_objectArray->at(i).get());
+ Address* myAddr1 = dynamic_cast<Address*>(m_objectArray->at(i).get());
if (!otherAddr1->equals(*myAddr1)) return false;
}
LOGINFO("PdxObject::equals isPdxReadSerialized = %d", isPdxReadSerialized);
@@ -321,16 +325,16 @@ bool PdxTests::PdxType::equals(PdxTests::PdxType& other,
if (!isPdxReadSerialized) {
for (int i = 0; i < m_objectArrayEmptyPdxFieldName->size(); i++) {
Address* otherAddr1 =
- dynamic_cast<Address*>(ot->m_objectArray->at(i).ptr());
- Address* myAddr1 = dynamic_cast<Address*>(m_objectArray->at(i).ptr());
+ dynamic_cast<Address*>(ot->m_objectArray->at(i).get());
+ Address* myAddr1 = dynamic_cast<Address*>(m_objectArray->at(i).get());
if (!otherAddr1->equals(*myAddr1)) return false;
}
LOGINFO("PdxObject::equals Empty Field Name isPdxReadSerialized = %d",
isPdxReadSerialized);
}
- CacheableEnumPtr myenum = dynCast<CacheableEnumPtr>(m_pdxEnum);
- CacheableEnumPtr otenum = dynCast<CacheableEnumPtr>(ot->m_pdxEnum);
+ auto myenum = std::dynamic_pointer_cast<CacheableEnum>(m_pdxEnum);
+ auto otenum = std::dynamic_pointer_cast<CacheableEnum>(ot->m_pdxEnum);
if (myenum->getEnumOrdinal() != otenum->getEnumOrdinal()) return false;
if (strcmp(myenum->getEnumClassName(), otenum->getEnumClassName()) != 0) {
return false;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/PdxType.hpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/PdxType.hpp b/src/tests/cpp/testobject/PdxType.hpp
index 2908373..3a3ab61 100644
--- a/src/tests/cpp/testobject/PdxType.hpp
+++ b/src/tests/cpp/testobject/PdxType.hpp
@@ -131,12 +131,12 @@ class TESTOBJECT_EXPORT Child : public Parent, public PdxSerializable {
static PdxSerializable* createDeserializable() { return new Child(); }
bool equals(PdxSerializablePtr obj) {
- if (obj == NULLPTR) return false;
+ if (obj == nullptr) return false;
- ChildPtr pap = dynCast<ChildPtr>(obj);
- if (pap == NULLPTR) return false;
+ auto pap = std::dynamic_pointer_cast<Child>(obj);
+ if (pap == nullptr) return false;
- if (pap == this) return true;
+ if (pap.get() == this) return true;
if (m_a == pap->m_a && m_b == pap->m_b && m_c == pap->m_c &&
m_d == pap->m_d && m_e == pap->m_e && m_f == pap->m_f) {
@@ -315,7 +315,7 @@ class TESTOBJECT_EXPORT Address : public PdxSerializable {
/*static AddressPtr create(int32_t aptN, char* street, char* city)
{
- AddressPtr str = NULLPTR;
+ AddressPtr str = nullptr;
if (value != NULL) {
str = new Address();
}
@@ -556,17 +556,17 @@ class TESTOBJECT_EXPORT PdxType : public PdxSerializable {
keys.push_back(CacheableKey::create(key));
}*/
- m_objectArray = NULLPTR;
- m_objectArrayEmptyPdxFieldName = NULLPTR;
+ m_objectArray = nullptr;
+ m_objectArrayEmptyPdxFieldName = nullptr;
/*AddressPtr objectArray[3];
objectArray[0] = new Address(1, "strt-1", "city-1");
objectArray[1] = new Address(2, "strt-2", "city-2");
objectArray[2] = new Address(3, "strt-3", "city-3");*/
/*
- AddressPtr addObj1(new Address(1, "abc", "ABC"));
- AddressPtr addObj2(new Address(2, "def", "DEF"));
- AddressPtr addObj3(new Address(3, "ghi", "GHI"));*/
+ auto addObj1 = std::make_shared<Address>(1, "abc", "ABC");
+ auto addObj2 = std::make_shared<Address>(2, "def", "DEF");
+ auto addObj3 = std::make_shared<Address>(3, "ghi", "GHI");*/
m_objectArray = CacheableObjectArray::create();
m_objectArray->push_back(AddressPtr(new Address(1, "street0", "city0")));
@@ -748,7 +748,9 @@ class TESTOBJECT_EXPORT PdxType : public PdxSerializable {
return m_objectArrayEmptyPdxFieldName;
}
- CacheableEnumPtr getEnum() { return m_pdxEnum; }
+ CacheableEnumPtr getEnum() {
+ return std::static_pointer_cast<CacheableEnum>(m_pdxEnum);
+ }
int32_t getByteArrayLength() { return byteArrayLen; }
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/PdxVersioned1.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/PdxVersioned1.cpp b/src/tests/cpp/testobject/PdxVersioned1.cpp
index 8b418a4..02a0317 100644
--- a/src/tests/cpp/testobject/PdxVersioned1.cpp
+++ b/src/tests/cpp/testobject/PdxVersioned1.cpp
@@ -337,8 +337,9 @@ void PdxTests::PdxVersioned1::fromData(PdxReaderPtr pr) {
m_byte = pr->readByte("m_byte");
m_byteArray = pr->readByteArray("m_byteArray", byteArrayLen);
m_charArray = pr->readWideCharArray("m_charArray", charArrayLen);
- m_arraylist = dynCast<CacheableArrayListPtr>(pr->readObject("m_arraylist"));
- m_map = dynCast<CacheableHashMapPtr>(pr->readObject("m_map"));
+ m_arraylist = std::static_pointer_cast<CacheableArrayList>(
+ pr->readObject("m_arraylist"));
+ m_map = std::static_pointer_cast<CacheableHashMap>(pr->readObject("m_map"));
// TODO:Check for the size
m_string = pr->readString("m_string"); // GenericValCompare
m_date = pr->readDate("m_dateTime"); // compareData
@@ -420,8 +421,8 @@ bool PdxTests::PdxVersioned1::equals(PdxTests::PdxVersioned1& other,
// generic2DCompare(ot->m_byteByteArray, m_byteByteArray, byteByteArrayLen,
// lengthArr);
- // CacheableEnumPtr myenum = dynCast<CacheableEnumPtr>(m_pdxEnum);
- // CacheableEnumPtr otenum = dynCast<CacheableEnumPtr>(ot->m_pdxEnum);
+ // auto myenum = std::dynamic_pointer_cast<CacheableEnum>(m_pdxEnum);
+ // auto otenum = std::dynamic_pointer_cast<CacheableEnum>(ot->m_pdxEnum);
// if (myenum->getEnumOrdinal() != otenum->getEnumOrdinal()) return false;
// if (strcmp(myenum->getEnumClassName(), otenum->getEnumClassName()) != 0)
// return false;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/PdxVersioned1.hpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/PdxVersioned1.hpp b/src/tests/cpp/testobject/PdxVersioned1.hpp
index b03b843..cbbb3b6 100644
--- a/src/tests/cpp/testobject/PdxVersioned1.hpp
+++ b/src/tests/cpp/testobject/PdxVersioned1.hpp
@@ -205,7 +205,9 @@ class TESTOBJECT_EXPORT PdxVersioned1 : public PdxSerializable {
CacheableDatePtr getDate() { return m_date; }
- CacheableEnumPtr getEnum() { return m_pdxEnum; }
+ CacheableEnumPtr getEnum() {
+ return std::static_pointer_cast<CacheableEnum>(m_pdxEnum);
+ }
int32_t getByteArrayLength() { return byteArrayLen; }
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/PdxVersioned2.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/PdxVersioned2.cpp b/src/tests/cpp/testobject/PdxVersioned2.cpp
index 6422846..ffe4d7d 100644
--- a/src/tests/cpp/testobject/PdxVersioned2.cpp
+++ b/src/tests/cpp/testobject/PdxVersioned2.cpp
@@ -344,8 +344,9 @@ void PdxTests::PdxVersioned2::fromData(PdxReaderPtr pr) {
m_byte = pr->readByte("m_byte");
m_byteArray = pr->readByteArray("m_byteArray", byteArrayLen);
m_charArray = pr->readWideCharArray("m_charArray", charArrayLen);
- m_arraylist = dynCast<CacheableArrayListPtr>(pr->readObject("m_arraylist"));
- m_map = dynCast<CacheableHashMapPtr>(pr->readObject("m_map"));
+ m_arraylist = std::static_pointer_cast<CacheableArrayList>(
+ pr->readObject("m_arraylist"));
+ m_map = std::static_pointer_cast<CacheableHashMap>(pr->readObject("m_map"));
// TODO:Check for the size
m_string = pr->readString("m_string"); // GenericValCompare
m_date = pr->readDate("m_dateTime"); // compareData
@@ -427,8 +428,8 @@ bool PdxTests::PdxVersioned2::equals(PdxTests::PdxVersioned2& other,
// generic2DCompare(ot->m_byteByteArray, m_byteByteArray, byteByteArrayLen,
// lengthArr);
- // CacheableEnumPtr myenum = dynCast<CacheableEnumPtr>(m_pdxEnum);
- // CacheableEnumPtr otenum = dynCast<CacheableEnumPtr>(ot->m_pdxEnum);
+ // auto myenum = std::dynamic_pointer_cast<CacheableEnum>(m_pdxEnum);
+ // auto otenum = std::dynamic_pointer_cast<CacheableEnum>(ot->m_pdxEnum);
// if (myenum->getEnumOrdinal() != otenum->getEnumOrdinal()) return false;
// if (strcmp(myenum->getEnumClassName(), otenum->getEnumClassName()) != 0)
// return false;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/PdxVersioned2.hpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/PdxVersioned2.hpp b/src/tests/cpp/testobject/PdxVersioned2.hpp
index bc8ccbd..f53cd52 100644
--- a/src/tests/cpp/testobject/PdxVersioned2.hpp
+++ b/src/tests/cpp/testobject/PdxVersioned2.hpp
@@ -205,7 +205,9 @@ class TESTOBJECT_EXPORT PdxVersioned2 : public PdxSerializable {
CacheableDatePtr getDate() { return m_date; }
- CacheableEnumPtr getEnum() { return m_pdxEnum; }
+ CacheableEnumPtr getEnum() {
+ return std::static_pointer_cast<CacheableEnum>(m_pdxEnum);
+ }
int32_t getByteArrayLength() { return byteArrayLen; }
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/Portfolio.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/Portfolio.cpp b/src/tests/cpp/testobject/Portfolio.cpp
index 7deedf1..50773a8 100644
--- a/src/tests/cpp/testobject/Portfolio.cpp
+++ b/src/tests/cpp/testobject/Portfolio.cpp
@@ -36,13 +36,13 @@ Portfolio::Portfolio(int32_t i, uint32_t size, CacheableStringArrayPtr nm)
sprintf(buf, "type%d", (i % 3));
type = CacheableString::create(buf);
int numSecIds = sizeof(secIds) / sizeof(char*);
- position1 =
- new Position(secIds[Position::cnt % numSecIds], Position::cnt * 1000);
+ position1 = std::make_shared<Position>(secIds[Position::cnt % numSecIds],
+ Position::cnt * 1000);
if (i % 2 != 0) {
- position2 =
- new Position(secIds[Position::cnt % numSecIds], Position::cnt * 1000);
+ position2 = std::make_shared<Position>(secIds[Position::cnt % numSecIds],
+ Position::cnt * 1000);
} else {
- position2 = NULLPTR;
+ position2 = nullptr;
}
positions = CacheableHashMap::create();
positions->insert(CacheableString::create(secIds[Position::cnt % numSecIds]),
@@ -103,7 +103,7 @@ CacheableStringPtr Portfolio::toString() const {
char idbuf[1024];
sprintf(idbuf, "PortfolioObject: [ ID=%d", ID);
char pkidbuf[1024];
- if (pkid != NULLPTR) {
+ if (pkid != nullptr) {
sprintf(pkidbuf, " status=%s type=%s pkid=%s\n", this->status,
this->type->toString(), this->pkid->asChar());
} else {
@@ -111,19 +111,19 @@ CacheableStringPtr Portfolio::toString() const {
this->type->toString(), this->pkid->asChar());
}
char position1buf[2048];
- if (position1 != NULLPTR) {
+ if (position1 != nullptr) {
sprintf(position1buf, "\t\t\t P1: %s", position1->toString()->asChar());
} else {
sprintf(position1buf, "\t\t\t P1: %s", "NULL");
}
char position2buf[2048];
- if (position2 != NULLPTR) {
+ if (position2 != nullptr) {
sprintf(position2buf, " P2: %s", position2->toString()->asChar());
} else {
sprintf(position2buf, " P2: %s ]", "NULL");
}
char creationdatebuf[2048];
- if (creationDate != NULLPTR) {
+ if (creationDate != nullptr) {
sprintf(creationdatebuf, "creation Date %s",
creationDate->toString()->asChar());
} else {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/Portfolio.hpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/Portfolio.hpp b/src/tests/cpp/testobject/Portfolio.hpp
index 0ca668e..92cdaba 100644
--- a/src/tests/cpp/testobject/Portfolio.hpp
+++ b/src/tests/cpp/testobject/Portfolio.hpp
@@ -49,21 +49,21 @@ class TESTOBJECT_EXPORT Portfolio : public Serializable {
uint8_t* arrayZeroSize;
inline uint32_t getObjectSize(const SerializablePtr& obj) const {
- return (obj == NULLPTR ? 0 : obj->objectSize());
+ return (obj == nullptr ? 0 : obj->objectSize());
}
public:
Portfolio()
: ID(0),
- pkid(NULLPTR),
- type(NULLPTR),
+ pkid(nullptr),
+ type(nullptr),
status(NULL),
newVal(NULL),
- creationDate(NULLPTR),
+ creationDate(nullptr),
arrayNull(NULL),
arrayZeroSize(NULL) {}
Portfolio(int32_t id, uint32_t size = 0,
- CacheableStringArrayPtr nm = NULLPTR);
+ CacheableStringArrayPtr nm = nullptr);
virtual ~Portfolio();
virtual uint32_t objectSize() const {
@@ -85,7 +85,7 @@ class TESTOBJECT_EXPORT Portfolio : public Serializable {
int32_t getID() { return ID; }
void showNames(const char* label) {
LOGINFO(label);
- if (names == NULLPTR) {
+ if (names == nullptr) {
LOGINFO("names is NULL");
return;
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/PortfolioPdx.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/PortfolioPdx.cpp b/src/tests/cpp/testobject/PortfolioPdx.cpp
index 923d998..1328f82 100644
--- a/src/tests/cpp/testobject/PortfolioPdx.cpp
+++ b/src/tests/cpp/testobject/PortfolioPdx.cpp
@@ -43,13 +43,13 @@ PortfolioPdx::PortfolioPdx(int32_t i, int32_t size, char** nm) : names(nm) {
memcpy(type, buf, strSize2);
int numSecIds = sizeof(secIds) / sizeof(char*);
- position1 = new PositionPdx(secIds[PositionPdx::cnt % numSecIds],
- PositionPdx::cnt * 1000);
+ position1 = std::make_shared<PositionPdx>(
+ secIds[PositionPdx::cnt % numSecIds], PositionPdx::cnt * 1000);
if (i % 2 != 0) {
- position2 = new PositionPdx(secIds[PositionPdx::cnt % numSecIds],
- PositionPdx::cnt * 1000);
+ position2 = std::make_shared<PositionPdx>(
+ secIds[PositionPdx::cnt % numSecIds], PositionPdx::cnt * 1000);
} else {
- position2 = NULLPTR;
+ position2 = nullptr;
}
positions = CacheableHashMap::create();
positions->insert(
@@ -133,9 +133,12 @@ void PortfolioPdx::fromData(PdxReaderPtr pr) {
id = pr->readInt("ID");
pkid = pr->readString("pkid");
- position1 = dynCast<PositionPdxPtr>(pr->readObject("position1"));
- position2 = dynCast<PositionPdxPtr>(pr->readObject("position2"));
- positions = dynCast<CacheableHashMapPtr>(pr->readObject("positions"));
+ position1 =
+ std::static_pointer_cast<PositionPdx>(pr->readObject("position1"));
+ position2 =
+ std::static_pointer_cast<PositionPdx>(pr->readObject("position2"));
+ positions =
+ std::static_pointer_cast<CacheableHashMap>(pr->readObject("positions"));
type = pr->readString("type");
status = pr->readString("status");
@@ -164,19 +167,19 @@ CacheableStringPtr PortfolioPdx::toString() const {
this->pkid);
}
char position1buf[2048];
- if (position1 != NULLPTR) {
+ if (position1 != nullptr) {
sprintf(position1buf, "\t\t\t P1: %s", position1->toString()->asChar());
} else {
sprintf(position1buf, "\t\t\t P1: %s", "NULL");
}
char position2buf[2048];
- if (position2 != NULLPTR) {
+ if (position2 != nullptr) {
sprintf(position2buf, " P2: %s", position2->toString()->asChar());
} else {
sprintf(position2buf, " P2: %s ]", "NULL");
}
char creationdatebuf[2048];
- if (creationDate != NULLPTR) {
+ if (creationDate != nullptr) {
sprintf(creationdatebuf, "creation Date %s",
creationDate->toString()->asChar());
} else {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/PortfolioPdx.hpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/PortfolioPdx.hpp b/src/tests/cpp/testobject/PortfolioPdx.hpp
index a400e44..a4cc600 100644
--- a/src/tests/cpp/testobject/PortfolioPdx.hpp
+++ b/src/tests/cpp/testobject/PortfolioPdx.hpp
@@ -56,7 +56,7 @@ class TESTOBJECT_EXPORT PortfolioPdx : public PdxSerializable {
type(NULL),
status(NULL),
newVal(NULL),
- creationDate(NULLPTR),
+ creationDate(nullptr),
arrayNull(NULL),
arrayZeroSize(NULL) {}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/Position.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/Position.cpp b/src/tests/cpp/testobject/Position.cpp
index 374499f..04a11f2 100644
--- a/src/tests/cpp/testobject/Position.cpp
+++ b/src/tests/cpp/testobject/Position.cpp
@@ -63,19 +63,19 @@ Position::~Position() {
void Position::init() {
avg20DaysVol = 0;
- bondRating = NULLPTR;
+ bondRating = nullptr;
convRatio = 0.0;
- country = NULLPTR;
+ country = nullptr;
delta = 0.0;
industry = 0;
issuer = 0;
mktValue = 0.0;
qty = 0.0;
- secId = NULLPTR;
- secLinks = NULLPTR;
+ secId = nullptr;
+ secLinks = nullptr;
secType = NULL;
sharesOutstanding = 0;
- underlyer = NULLPTR;
+ underlyer = nullptr;
volatility = 0;
pid = 0;
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/Position.hpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/Position.hpp b/src/tests/cpp/testobject/Position.hpp
index a185e71..f9071c5 100644
--- a/src/tests/cpp/testobject/Position.hpp
+++ b/src/tests/cpp/testobject/Position.hpp
@@ -62,7 +62,7 @@ class TESTOBJECT_EXPORT Position : public apache::geode::client::Serializable {
int32_t pid;
inline uint32_t getObjectSize(const SerializablePtr& obj) const {
- return (obj == NULLPTR ? 0 : obj->objectSize());
+ return (obj == nullptr ? 0 : obj->objectSize());
}
public:
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/TestObject1.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/TestObject1.cpp b/src/tests/cpp/testobject/TestObject1.cpp
index 2aaa48a..fab0ee5 100644
--- a/src/tests/cpp/testobject/TestObject1.cpp
+++ b/src/tests/cpp/testobject/TestObject1.cpp
@@ -25,7 +25,7 @@
using namespace testobject;
TestObject1::TestObject1()
- : name(NULLPTR), arr(CacheableBytes::create(4 * 1024)), identifier(1) {}
+ : name(nullptr), arr(CacheableBytes::create(4 * 1024)), identifier(1) {}
TestObject1::TestObject1(std::string& str, int32_t id) {
name = CacheableString::create(str.c_str());
@@ -41,7 +41,7 @@ TestObject1::TestObject1(std::string& str, int32_t id) {
}
TestObject1::TestObject1(TestObject1& rhs) {
- name = rhs.name == NULLPTR ? NULLPTR
+ name = rhs.name == nullptr ? nullptr
: CacheableString::create(rhs.name->asChar());
identifier = rhs.identifier;
arr = CacheableBytes::create(rhs.arr->value(), rhs.arr->length());
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/TestObject1.hpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/TestObject1.hpp b/src/tests/cpp/testobject/TestObject1.hpp
index 62ce31d..ed2bc46 100644
--- a/src/tests/cpp/testobject/TestObject1.hpp
+++ b/src/tests/cpp/testobject/TestObject1.hpp
@@ -50,7 +50,7 @@ class TESTOBJECT_EXPORT TestObject1 : public Cacheable {
public:
TestObject1();
TestObject1(int32_t id)
- : name(NULLPTR), arr(CacheableBytes::create(4 * 1024)), identifier(id) {}
+ : name(nullptr), arr(CacheableBytes::create(4 * 1024)), identifier(id) {}
TestObject1(std::string& str, int32_t id);
TestObject1(TestObject1& rhs);
void toData(DataOutput& output) const;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/VariousPdxTypes.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/VariousPdxTypes.cpp b/src/tests/cpp/testobject/VariousPdxTypes.cpp
index 5415927..52d7f7b 100644
--- a/src/tests/cpp/testobject/VariousPdxTypes.cpp
+++ b/src/tests/cpp/testobject/VariousPdxTypes.cpp
@@ -44,16 +44,16 @@ int32_t PdxTypes1::getHashCode() { return 1; }
bool PdxTypes1::equals(PdxSerializablePtr obj) {
// LOGDEBUG("NIL:PdxTypes1::==::33");
- if (obj == NULLPTR) {
+ if (obj == nullptr) {
// LOGDEBUG("NIL:PdxTypes1::==::35");
return false;
}
- PdxTypes1Ptr pap = dynCast<PdxTypes1Ptr>(obj);
- if (pap == NULLPTR) {
+ auto pap = std::dynamic_pointer_cast<PdxTypes1>(obj);
+ if (pap == nullptr) {
// LOGDEBUG("NIL:PdxTypes1::==::40");
return false;
}
- if (pap == this) {
+ if (pap.get() == this) {
// LOGDEBUG("NIL:PdxTypes1::==::44");
return true;
}
@@ -109,13 +109,13 @@ int32_t PdxTypes2::getHashCode() { return 1; }
bool PdxTypes2::equals(PdxSerializablePtr obj) {
// LOGDEBUG("NIL:96:this::PdxType2 = %s", this->toString());
- if (obj == NULLPTR) return false;
+ if (obj == nullptr) return false;
- PdxTypes2Ptr pap = dynCast<PdxTypes2Ptr>(obj);
+ auto pap = std::dynamic_pointer_cast<PdxTypes2>(obj);
// LOGDEBUG("NIl:102:pap::PdxType2 = %s", pap->toString());
- if (pap == NULLPTR) return false;
+ if (pap == nullptr) return false;
- // if (pap == this)
+ // if (pap.get() == this)
// return true;
if (m_i1 == pap->m_i1 && m_i2 == pap->m_i2 && m_i3 == pap->m_i3 &&
@@ -167,12 +167,12 @@ PdxTypes3::~PdxTypes3() {
int32_t PdxTypes3::getHashCode() { return 1; }
bool PdxTypes3::equals(PdxSerializablePtr obj) {
- if (obj == NULLPTR) return false;
+ if (obj == nullptr) return false;
- PdxTypes3Ptr pap = dynCast<PdxTypes3Ptr>(obj);
- if (pap == NULLPTR) return false;
+ auto pap = std::dynamic_pointer_cast<PdxTypes3>(obj);
+ if (pap == nullptr) return false;
- // if (pap == this)
+ // if (pap.get() == this)
// return true;
if (m_i1 == pap->m_i1 && m_i2 == pap->m_i2 && m_i3 == pap->m_i3 &&
@@ -224,12 +224,12 @@ PdxTypes4::~PdxTypes4() {
int32_t PdxTypes4::getHashCode() { return 1; }
bool PdxTypes4::equals(PdxSerializablePtr obj) {
- if (obj == NULLPTR) return false;
+ if (obj == nullptr) return false;
- PdxTypes4Ptr pap = dynCast<PdxTypes4Ptr>(obj);
- if (pap == NULLPTR) return false;
+ auto pap = std::dynamic_pointer_cast<PdxTypes4>(obj);
+ if (pap == nullptr) return false;
- // if (pap == this)
+ // if (pap.get() == this)
// return true;
if (m_i1 == pap->m_i1 && m_i2 == pap->m_i2 && m_i3 == pap->m_i3 &&
@@ -282,12 +282,12 @@ PdxTypes5::~PdxTypes5() {
int32_t PdxTypes5::getHashCode() { return 1; }
bool PdxTypes5::equals(PdxSerializablePtr obj) {
- if (obj == NULLPTR) return false;
+ if (obj == nullptr) return false;
- PdxTypes5Ptr pap = dynCast<PdxTypes5Ptr>(obj);
- if (pap == NULLPTR) return false;
+ auto pap = std::dynamic_pointer_cast<PdxTypes5>(obj);
+ if (pap == nullptr) return false;
- // if (pap == this)
+ // if (pap.get() == this)
// return true;
if (m_i1 == pap->m_i1 && m_i2 == pap->m_i2 && m_i3 == pap->m_i3 &&
@@ -350,11 +350,11 @@ int32_t PdxTypes6::getHashCode() { return 1; }
bool PdxTypes6::equals(PdxSerializablePtr obj) {
LOGDEBUG("PdxTypes6::equals -1");
- if (obj == NULLPTR) return false;
+ if (obj == nullptr) return false;
LOGDEBUG("PdxTypes6::equals -2");
- PdxTypes6Ptr pap = dynCast<PdxTypes6Ptr>(obj);
- if (pap == NULLPTR) return false;
+ auto pap = std::dynamic_pointer_cast<PdxTypes6>(obj);
+ if (pap == nullptr) return false;
LOGDEBUG("PdxTypes6::equals -3 m_i1 = %d", m_i1);
LOGDEBUG("PdxTypes6::equals -4 m_i2 = %d", m_i2);
@@ -369,7 +369,7 @@ bool PdxTypes6::equals(PdxSerializablePtr obj) {
LOGDEBUG("PdxTypes6::equals -12 pap->m_i4 = %d", pap->m_i4);
LOGDEBUG("PdxTypes6::equals -13 pap->m_s1 = %s", pap->m_s1);
LOGDEBUG("PdxTypes6::equals -14 pap->m_s2 = %s", pap->m_s2);
- // if (pap == this)
+ // if (pap.get() == this)
// return true;
if (m_i1 == pap->m_i1 && m_i2 == pap->m_i2 && m_i3 == pap->m_i3 &&
@@ -443,12 +443,12 @@ PdxTypes7::~PdxTypes7() {
int32_t PdxTypes7::getHashCode() { return 1; }
bool PdxTypes7::equals(PdxSerializablePtr obj) {
- if (obj == NULLPTR) return false;
+ if (obj == nullptr) return false;
- PdxTypes7Ptr pap = dynCast<PdxTypes7Ptr>(obj);
- if (pap == NULLPTR) return false;
+ auto pap = std::dynamic_pointer_cast<PdxTypes7>(obj);
+ if (pap == nullptr) return false;
- // if (pap == this)
+ // if (pap.get() == this)
// return true;
if (m_i1 == pap->m_i1 && m_i2 == pap->m_i2 && m_i3 == pap->m_i3 &&
@@ -512,12 +512,12 @@ PdxTypes8::~PdxTypes8() { delete[] bytes300; }
int32_t PdxTypes8::getHashCode() { return 1; }
bool PdxTypes8::equals(PdxSerializablePtr obj) {
- if (obj == NULLPTR) return false;
+ if (obj == nullptr) return false;
- PdxTypes8Ptr pap = dynCast<PdxTypes8Ptr>(obj);
- if (pap == NULLPTR) return false;
+ auto pap = std::dynamic_pointer_cast<PdxTypes8>(obj);
+ if (pap == nullptr) return false;
- // if (pap == this)
+ // if (pap.get() == this)
// return true;
if (m_i1 == pap->m_i1 && m_i2 == pap->m_i2 && m_i3 == pap->m_i3 &&
@@ -580,12 +580,12 @@ PdxTypes9::~PdxTypes9() { delete[] m_bytes66000; }
int32_t PdxTypes9::getHashCode() { return 1; }
bool PdxTypes9::equals(PdxSerializablePtr obj) {
- if (obj == NULLPTR) return false;
+ if (obj == nullptr) return false;
- PdxTypes9Ptr pap = dynCast<PdxTypes9Ptr>(obj);
- if (pap == NULLPTR) return false;
+ auto pap = std::dynamic_pointer_cast<PdxTypes9>(obj);
+ if (pap == nullptr) return false;
- // if (pap == this)
+ // if (pap.get() == this)
// return true;
if ((strcmp(m_s1, pap->m_s1) == 0) && (strcmp(m_s2, pap->m_s2) == 0) &&
@@ -642,12 +642,12 @@ PdxTypes10::~PdxTypes10() { delete[] m_bytes66000; }
int32_t PdxTypes10::getHashCode() { return 1; }
bool PdxTypes10::equals(PdxSerializablePtr obj) {
- if (obj == NULLPTR) return false;
+ if (obj == nullptr) return false;
- PdxTypes10Ptr pap = dynCast<PdxTypes10Ptr>(obj);
- if (pap == NULLPTR) return false;
+ auto pap = std::dynamic_pointer_cast<PdxTypes10>(obj);
+ if (pap == nullptr) return false;
- // if (pap == this)
+ // if (pap.get() == this)
// return true;
if ((strcmp(m_s1, pap->m_s1) == 0) && (strcmp(m_s2, pap->m_s2) == 0) &&
@@ -692,8 +692,8 @@ void PdxTypes10::fromData(PdxReaderPtr pr) {
* *********************************************************/
NestedPdx::NestedPdx() {
- m_pd1 = new PdxTypes1();
- m_pd2 = new PdxTypes2();
+ m_pd1 = std::make_shared<PdxTypes1>();
+ m_pd2 = std::make_shared<PdxTypes2>();
m_s1 = (char *)"one";
m_s2 = (char *)"two";
m_i1 = 34324;
@@ -703,8 +703,8 @@ NestedPdx::NestedPdx() {
}
NestedPdx::NestedPdx(char *key) {
- m_pd1 = new PdxTypes1();
- m_pd2 = new PdxTypes2();
+ m_pd1 = std::make_shared<PdxTypes1>();
+ m_pd2 = std::make_shared<PdxTypes2>();
size_t len = strlen("NestedPdx ") + strlen(key) + 1;
m_s1 = new char[len];
strcpy(m_s1, "NestedPdx ");
@@ -722,12 +722,12 @@ NestedPdx::~NestedPdx() {
int32_t NestedPdx::getHashCode() { return 1; }
bool NestedPdx::equals(PdxSerializablePtr obj) {
- if (obj == NULLPTR) return false;
+ if (obj == nullptr) return false;
- NestedPdxPtr pap = dynCast<NestedPdxPtr>(obj);
- if (pap == NULLPTR) return false;
+ auto pap = std::dynamic_pointer_cast<NestedPdx>(obj);
+ if (pap == nullptr) return false;
- // if (pap == this)
+ // if (pap.get() == this)
// return true;
if (m_i1 == pap->m_i1 && m_i2 == pap->m_i2 && m_i3 == pap->m_i3 &&
@@ -762,11 +762,11 @@ void NestedPdx::toData(PdxWriterPtr pw) {
void NestedPdx::fromData(PdxReaderPtr pr) {
m_i1 = pr->readInt("i1");
- m_pd1 = pr->readObject("pd1");
+ m_pd1 = std::static_pointer_cast<PdxTypes1>(pr->readObject("pd1"));
m_i2 = pr->readInt("i2");
m_s1 = pr->readString("s1");
m_s2 = pr->readString("s2");
- m_pd2 = pr->readObject("pd2");
+ m_pd2 = std::static_pointer_cast<PdxTypes2>(pr->readObject("pd2"));
m_i3 = pr->readInt("i3");
m_i4 = pr->readInt("i4");
}
@@ -776,8 +776,8 @@ void NestedPdx::fromData(PdxReaderPtr pr) {
* *********************************************************/
MixedVersionNestedPdx::MixedVersionNestedPdx() {
- m_pd1 = new PdxTypes1();
- m_pd2 = new PdxTypes2();
+ m_pd1 = std::make_shared<PdxTypes1>();
+ m_pd2 = std::make_shared<PdxTypes2>();
m_s1 = (char *)"one";
m_s2 = (char *)"two";
m_s3 = (char *)"three";
@@ -788,8 +788,8 @@ MixedVersionNestedPdx::MixedVersionNestedPdx() {
}
MixedVersionNestedPdx::MixedVersionNestedPdx(char *key) {
- m_pd1 = new PdxTypes1();
- m_pd2 = new PdxTypes2();
+ m_pd1 = std::make_shared<PdxTypes1>();
+ m_pd2 = std::make_shared<PdxTypes2>();
size_t len = strlen("MixedVersionNestedPdx ") + strlen(key) + 1;
m_s1 = new char[len];
strcpy(m_s1, "MixedVersionNestedPdx ");
@@ -808,12 +808,12 @@ MixedVersionNestedPdx::~MixedVersionNestedPdx() {
int32_t MixedVersionNestedPdx::getHashCode() { return 1; }
bool MixedVersionNestedPdx::equals(PdxSerializablePtr obj) {
- if (obj == NULLPTR) return false;
+ if (obj == nullptr) return false;
- MixedVersionNestedPdxPtr pap = dynCast<MixedVersionNestedPdxPtr>(obj);
- if (pap == NULLPTR) return false;
+ auto pap = std::dynamic_pointer_cast<MixedVersionNestedPdx>(obj);
+ if (pap == nullptr) return false;
- // if (pap == this)
+ // if (pap.get() == this)
// return true;
if (m_i1 == pap->m_i1 && m_i2 == pap->m_i2 && m_i3 == pap->m_i3 &&
@@ -849,12 +849,12 @@ void MixedVersionNestedPdx::toData(PdxWriterPtr pw) {
void MixedVersionNestedPdx::fromData(PdxReaderPtr pr) {
m_i1 = pr->readInt("i1");
- m_pd1 = pr->readObject("pd1");
+ m_pd1 = std::static_pointer_cast<PdxTypes1>(pr->readObject("pd1"));
m_i2 = pr->readInt("i2");
m_s1 = pr->readString("s1");
m_s2 = pr->readString("s2");
// Mixed version missing: m_s3=pr->readString("m_s3")
- m_pd2 = pr->readObject("pd2");
+ m_pd2 = std::static_pointer_cast<PdxTypes2>(pr->readObject("pd2"));
m_i3 = pr->readInt("i3");
m_i4 = pr->readInt("i4");
}
@@ -863,8 +863,8 @@ void MixedVersionNestedPdx::fromData(PdxReaderPtr pr) {
* PdxInsideIGeodeSerializable
* *********************************************************/
PdxInsideIGeodeSerializable::PdxInsideIGeodeSerializable() {
- m_npdx = new NestedPdx();
- m_pdx3 = new PdxTypes3();
+ m_npdx = std::make_shared<NestedPdx>();
+ m_pdx3 = std::make_shared<PdxTypes3>();
m_s1 = (char *)"one";
m_s2 = (char *)"two";
m_i1 = 34324;
@@ -880,13 +880,12 @@ PdxInsideIGeodeSerializable::~PdxInsideIGeodeSerializable() {
int32_t PdxInsideIGeodeSerializable::getHashCode() { return 1; }
bool PdxInsideIGeodeSerializable::equals(SerializablePtr obj) {
- if (obj == NULLPTR) return false;
+ if (obj == nullptr) return false;
- PdxInsideIGeodeSerializablePtr pap =
- dynCast<PdxInsideIGeodeSerializablePtr>(obj);
- if (pap == NULLPTR) return false;
+ auto pap = std::dynamic_pointer_cast<PdxInsideIGeodeSerializable>(obj);
+ if (pap == nullptr) return false;
- // if (pap == this)
+ // if (pap.get() == this)
// return true;
if (m_i1 == pap->m_i1 && m_i2 == pap->m_i2 && m_i3 == pap->m_i3 &&
[16/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from cppcache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientPoolExecuteFunction.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientPoolExecuteFunction.cpp b/src/cppcache/integration-test/testThinClientPoolExecuteFunction.cpp
index 91bb285..a049e30 100644
--- a/src/cppcache/integration-test/testThinClientPoolExecuteFunction.cpp
+++ b/src/cppcache/integration-test/testThinClientPoolExecuteFunction.cpp
@@ -53,42 +53,48 @@ char* exFuncNameSendException = (char*)"executeFunction_SendException";
char* exFuncNamePdxType = (char*)"PdxFunctionTest";
char* FETimeOut = (char*)"FunctionExecutionTimeOut";
-#define verifyGetResults() \
- bool found = false; \
- for (int j = 0; j < 34; j++) { \
- if (j % 2 == 0) continue; \
- sprintf(buf, "VALUE--%d", j); \
- if (strcmp(buf, dynCast<CacheableStringPtr>(resultList->operator[](i)) \
- ->asChar()) == 0) { \
- LOGINFO( \
- "buf = %s " \
- "dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar() " \
- "= %s ", \
- buf, \
- dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar()); \
- found = true; \
- break; \
- } \
- } \
+#define verifyGetResults() \
+ bool found = false; \
+ for (int j = 0; j < 34; j++) { \
+ if (j % 2 == 0) continue; \
+ sprintf(buf, "VALUE--%d", j); \
+ if (strcmp(buf, std::dynamic_pointer_cast<CacheableString>( \
+ resultList->operator[](i)) \
+ ->asChar()) == 0) { \
+ LOGINFO( \
+ "buf = %s " \
+ "std::dynamic_pointer_cast<CacheableString>(resultList->operator[](" \
+ "i))->asChar() " \
+ "= %s ", \
+ buf, std::dynamic_pointer_cast<CacheableString>( \
+ resultList->operator[](i)) \
+ ->asChar()); \
+ found = true; \
+ break; \
+ } \
+ } \
ASSERT(found, "this returned value is invalid");
-#define verifyGetKeyResults() \
- bool found = false; \
- for (int j = 0; j < 34; j++) { \
- if (j % 2 == 0) continue; \
- sprintf(buf, "KEY--%d", j); \
- if (strcmp(buf, dynCast<CacheableStringPtr>(resultList->operator[](i)) \
- ->asChar()) == 0) { \
- LOGINFO( \
- "buf = %s " \
- "dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar() " \
- "= %s ", \
- buf, \
- dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar()); \
- found = true; \
- break; \
- } \
- } \
+#define verifyGetKeyResults() \
+ bool found = false; \
+ for (int j = 0; j < 34; j++) { \
+ if (j % 2 == 0) continue; \
+ sprintf(buf, "KEY--%d", j); \
+ if (strcmp(buf, std::dynamic_pointer_cast<CacheableString>( \
+ resultList->operator[](i)) \
+ ->asChar()) == 0) { \
+ LOGINFO( \
+ "buf = %s " \
+ "std::dynamic_pointer_cast<CacheableString>(resultList->operator[](" \
+ "i))->asChar() " \
+ "= %s ", \
+ buf, std::dynamic_pointer_cast<CacheableString>( \
+ resultList->operator[](i)) \
+ ->asChar()); \
+ found = true; \
+ break; \
+ } \
+ } \
ASSERT(found, "this returned KEY is invalid");
#define verifyPutResults() \
@@ -128,18 +134,18 @@ class MyResultCollector : public ResultCollector {
void addResult(CacheablePtr& resultItem) {
m_addResultCount++;
- if (resultItem == NULLPTR) {
+ if (resultItem == nullptr) {
return;
}
- try {
- CacheableArrayListPtr result = dynCast<CacheableArrayListPtr>(resultItem);
+ if (auto result =
+ std::dynamic_pointer_cast<CacheableArrayList>(resultItem)) {
for (int32_t i = 0; i < result->size(); i++) {
m_resultList->push_back(result->operator[](i));
}
- } catch (ClassCastException) {
- UserFunctionExecutionExceptionPtr result =
- dynCast<UserFunctionExecutionExceptionPtr>(resultItem);
- m_resultList->push_back(result);
+ } else {
+ auto ex =
+ std::dynamic_pointer_cast<UserFunctionExecutionException>(resultItem);
+ m_resultList->push_back(ex);
}
}
void endResults() {
@@ -159,6 +165,49 @@ class MyResultCollector : public ResultCollector {
};
_GF_PTR_DEF_(MyResultCollector, MyResultCollectorPtr)
+template <class _T>
+bool validateResultTypeAndAllowUserFunctionExecutionException(
+ const int32_t index, const CacheablePtr& result) {
+ if (auto intValue = std::dynamic_pointer_cast<_T>(result)) {
+ LOGINFO("%s is %d ", typeid(_T).name(), intValue->value());
+ return true;
+ } else {
+ if (auto uFEPtr =
+ std::dynamic_pointer_cast<UserFunctionExecutionException>(result)) {
+ LOGINFO("Done casting to uFEPtr");
+ LOGINFO("Read expected uFEPtr exception %s ",
+ uFEPtr->getMessage()->asChar());
+ return true;
+ } else {
+ LOGINFO("Unexpected result type %s for index %d.",
+ result->toString()->asChar(), index);
+ }
+ }
+
+ return false;
+}
+
+bool validateResultTypeIsUserFunctionExecutionException(
+ const int32_t index, const CacheablePtr& result) {
+ if (auto uFEPtr =
+ std::dynamic_pointer_cast<UserFunctionExecutionException>(result)) {
+ LOGINFO("Done casting to uFEPtr");
+ LOGINFO("Read expected uFEPtr exception %s ",
+ uFEPtr->getMessage()->asChar());
+ return true;
+ } else {
+ LOGINFO("Unexpected result type %s for index %d.",
+ result->toString()->asChar(), index);
+ }
+
+ return false;
+}
+
+template <class _T>
+bool validateResultType(const int32_t index, const CacheablePtr& result) {
+ return false;
+}
+
DUNIT_TASK_DEFINITION(LOCATOR1, StartLocator1)
{
// starting locator
@@ -194,14 +243,9 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, StartC1)
{
- // initClient(true);
- initClientWithPool(true, NULL, locHostPort, serverGroup, NULLPTR, 0, true);
- // createPool(poolName, locHostPort,serverGroup, NULL, 0, true );
- // createRegionAndAttachPool(poolRegNames[0],USE_ACK, poolName);
-
- RegionPtr regPtr0 =
- createRegionAndAttachPool(poolRegNames[0], USE_ACK, NULL);
- ; // getHelper()->createRegion( poolRegNames[0], USE_ACK);
+ initClientWithPool(true, NULL, locHostPort, serverGroup, nullptr, 0, true);
+
+ auto regPtr0 = createRegionAndAttachPool(poolRegNames[0], USE_ACK, NULL);
regPtr0->registerAllKeys();
LOG("Clnt1Init complete.");
@@ -210,65 +254,53 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
{
- RegionPtr regPtr0 = getHelper()->getRegion(poolRegNames[0]);
+ auto regPtr0 = getHelper()->getRegion(poolRegNames[0]);
char buf[128];
for (int i = 0; i < 34; i++) {
sprintf(buf, "VALUE--%d", i);
- CacheablePtr value(CacheableString::create(buf));
+ auto value = CacheableString::create(buf);
sprintf(buf, "KEY--%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
+ auto key = CacheableKey::create(buf);
regPtr0->put(key, value);
}
SLEEP(10000); // let the put finish
try {
CacheablePtr args = CacheableBoolean::create(1);
bool getResult = true;
- CacheableVectorPtr routingObj = CacheableVector::create();
+ auto routingObj = CacheableVector::create();
for (int i = 0; i < 34; i++) {
if (i % 2 == 0) continue;
sprintf(buf, "KEY--%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
+ auto key = CacheableKey::create(buf);
routingObj->push_back(key);
}
// test data dependant function
// test get function with result
- ExecutionPtr exc = FunctionService::onRegion(regPtr0);
- ASSERT(exc != NULLPTR, "onRegion Returned NULL");
+ auto exc = FunctionService::onRegion(regPtr0);
+ ASSERT(exc != nullptr, "onRegion Returned NULL");
args = CacheableKey::create("echoString");
CacheablePtr args1 = CacheableKey::create("echoBoolean");
- ExecutionPtr exe1 = exc->withArgs(args);
- ExecutionPtr exe2 = exe1->withArgs(args1);
+ auto exe1 = exc->withArgs(args);
+ auto exe2 = exe1->withArgs(args1);
- CacheableVectorPtr resultList = CacheableVector::create();
- CacheableVectorPtr executeFunctionResult =
- exe1->execute(rjFuncName, 15)->getResult();
- if (executeFunctionResult == NULLPTR) {
+ auto resultList = CacheableVector::create();
+ auto executeFunctionResult = exe1->execute(rjFuncName, 15)->getResult();
+ if (executeFunctionResult == nullptr) {
ASSERT(false, "echo String : executeFunctionResult is NULL");
} else {
sprintf(buf, "echo String : result count = %d",
executeFunctionResult->size());
LOG(buf);
- try {
- CacheableStringPtr csp =
- dynCast<CacheableStringPtr>(executeFunctionResult->operator[](0));
+ if (auto csp = std::dynamic_pointer_cast<CacheableString>(
+ executeFunctionResult->operator[](0))) {
sprintf(buf, "echo String : cast successful, echoed string= %s",
csp->asChar());
LOG(buf);
- } catch (ClassCastException& ex) {
- std::string logmsg = "";
- logmsg += ex.getName();
- logmsg += ": ";
- logmsg += ex.getMessage();
- LOG(logmsg.c_str());
- ex.printStackTrace();
- LOG("cast to string failed, now cast to boolean:");
- bool b ATTR_UNUSED =
- dynCast<CacheableBooleanPtr>(executeFunctionResult->operator[](0))
- ->value();
- ASSERT(false, "echo String : wrong argument type");
+ } else {
+ FAIL("echo String : wrong argument type");
}
}
executeFunctionResult = exc->withFilter(routingObj)
@@ -280,15 +312,15 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
->withArgs(args)
->execute(rjFuncName, 15)
->getResult();
- if (executeFunctionResult == NULLPTR) {
+ if (executeFunctionResult == nullptr) {
ASSERT(false, "echo String : executeFunctionResult is NULL");
} else {
sprintf(buf, "echo String : result count = %d",
executeFunctionResult->size());
LOG(buf);
- const char* str =
- dynCast<CacheableStringPtr>(executeFunctionResult->operator[](0))
- ->asChar();
+ const char* str = std::dynamic_pointer_cast<CacheableString>(
+ executeFunctionResult->operator[](0))
+ ->asChar();
LOG(str);
ASSERT(strcmp("echoString", str) == 0, "echoString is not eched back");
}
@@ -297,15 +329,15 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
->withArgs(args)
->execute(rjFuncName, 15)
->getResult();
- if (executeFunctionResult == NULLPTR) {
+ if (executeFunctionResult == nullptr) {
ASSERT(false, "echo Boolean: executeFunctionResult is NULL");
} else {
sprintf(buf, "echo Boolean: result count = %d",
executeFunctionResult->size());
LOG(buf);
- bool b =
- dynCast<CacheableBooleanPtr>(executeFunctionResult->operator[](0))
- ->value();
+ bool b = std::dynamic_pointer_cast<CacheableBoolean>(
+ executeFunctionResult->operator[](0))
+ ->value();
LOG(b == true ? "true" : "false");
ASSERT(b == true, "true is not eched back");
}
@@ -317,20 +349,20 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
/****
**decomposed from above long expression:
exc = exc->withFilter(routingObj);
- ASSERT(exc!=NULLPTR, "withFilter Returned NULL");
+ ASSERT(exc!=nullptr, "withFilter Returned NULL");
exc = exc->withArgs(args);
- ASSERT(exc!=NULLPTR, "withArgs Returned NULL");
+ ASSERT(exc!=nullptr, "withArgs Returned NULL");
ResultCollectorPtr rc = exc->execute(getFuncName, getResult);
- ASSERT(rc!=NULLPTR, "execute Returned NULL");
+ ASSERT(rc!=nullptr, "execute Returned NULL");
CacheableVectorPtr executeFunctionResult = rc->getResult();
*/
- if (executeFunctionResult == NULLPTR) {
+ if (executeFunctionResult == nullptr) {
ASSERT(false, "region get: executeFunctionResult is NULL");
} else {
for (unsigned item = 0;
item < static_cast<uint32_t>(executeFunctionResult->size());
item++) {
- CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>(
+ auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>(
executeFunctionResult->operator[](item));
for (unsigned pos = 0; pos < static_cast<uint32_t>(arrayList->size());
pos++) {
@@ -342,18 +374,19 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
ASSERT(resultList->size() == 34,
"region get: resultList count is not 34");
for (int32_t i = 0; i < resultList->size(); i++) {
- CacheableStringPtr csPtr =
- dynCast<CacheableStringPtr>(resultList->operator[](i));
+ auto csPtr = std::dynamic_pointer_cast<CacheableString>(
+ resultList->operator[](i));
// printf(" in csPtr = %u \n",csPtr);
- if (csPtr != NULLPTR) {
+ if (csPtr != nullptr) {
sprintf(buf, "Region get: result[%d]=%s", i,
- dynCast<CacheableStringPtr>(resultList->operator[](i))
+ std::dynamic_pointer_cast<CacheableString>(
+ resultList->operator[](i))
->asChar());
LOG(buf);
verifyGetResults()
} else {
CacheablePtr tmp = resultList->operator[](i);
- if (tmp != NULLPTR) {
+ if (tmp != nullptr) {
printf(" in typeid = %d \n", tmp->typeId());
} else {
@@ -363,7 +396,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
}
}
// test get function with customer collector
- MyResultCollectorPtr myRC(new MyResultCollector());
+ auto myRC = std::make_shared<MyResultCollector>();
executeFunctionResult = exc->withFilter(routingObj)
->withArgs(args)
->withCollector(myRC)
@@ -375,7 +408,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
LOG(buf);
sprintf(buf, "get result count = %d", myRC->getGetResultCount());
LOG(buf);
- if (executeFunctionResult == NULLPTR) {
+ if (executeFunctionResult == nullptr) {
ASSERT(false,
"region get new collector: executeFunctionResult is NULL");
} else {
@@ -395,9 +428,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
executeFunctionResult->size() == resultList->size(),
"region get new collector: executeFunctionResult count is not 34");
for (int32_t i = 0; i < executeFunctionResult->size(); i++) {
- sprintf(
- buf, "Region get new collector: result[%d]=%s", i,
- dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar());
+ sprintf(buf, "Region get new collector: result[%d]=%s", i,
+ std::dynamic_pointer_cast<CacheableString>(
+ resultList->operator[](i))
+ ->asChar());
LOG(buf);
verifyGetResults()
}
@@ -410,8 +444,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
if (i % 2 == 0) continue;
sprintf(buf, "KEY--%d", i);
CacheableKeyPtr key = CacheableKey::create(buf);
- CacheableStringPtr value =
- dynCast<CacheableStringPtr>(regPtr0->get(key));
+ auto value =
+ std::dynamic_pointer_cast<CacheableString>(regPtr0->get(key));
sprintf(buf, "Region put: result[%d]=%s", i, value->asChar());
LOG(buf);
verifyPutResults()
@@ -424,7 +458,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
->execute(getFuncName, 15)
->getResult();
- if (executeFunctionResult == NULLPTR) {
+ if (executeFunctionResult == nullptr) {
ASSERT(false, "get executeFunctionResult is NULL");
} else {
sprintf(buf, "echo String : result count = %d",
@@ -435,7 +469,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
for (unsigned item = 0;
item < static_cast<uint32_t>(executeFunctionResult->size());
item++) {
- CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>(
+ auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>(
executeFunctionResult->operator[](item));
for (unsigned pos = 0; pos < static_cast<uint32_t>(arrayList->size());
pos++) {
@@ -448,10 +482,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
"get executeFunctionResult count is not 34");
for (int32_t i = 0; i < resultList->size(); i++) {
sprintf(buf, "result[%d] is null\n", i);
- ASSERT(resultList->operator[](i) != NULLPTR, buf);
- sprintf(
- buf, "get result[%d]=%s", i,
- dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar());
+ ASSERT(resultList->operator[](i) != nullptr, buf);
+ sprintf(buf, "get result[%d]=%s", i,
+ std::dynamic_pointer_cast<CacheableString>(
+ resultList->operator[](i))
+ ->asChar());
LOGINFO(buf);
verifyGetKeyResults()
}
@@ -460,26 +495,26 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
//-----------------------Test with sendException
// onRegion-------------------------------//
for (int i = 1; i <= 200; i++) {
- CacheablePtr value(CacheableInt32::create(i));
+ auto value = CacheableInt32::create(i);
sprintf(buf, "execKey-%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
+ auto key = CacheableKey::create(buf);
regPtr0->put(key, value);
}
LOG("Put for execKey's on region complete.");
LOG("Adding filter");
- CacheableArrayListPtr arrList = CacheableArrayList::create();
+ auto arrList = CacheableArrayList::create();
for (int i = 100; i < 120; i++) {
sprintf(buf, "execKey-%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
+ auto key = CacheableKey::create(buf);
arrList->push_back(key);
}
- CacheableVectorPtr filter = CacheableVector::create();
+ auto filter = CacheableVector::create();
for (int i = 100; i < 120; i++) {
sprintf(buf, "execKey-%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
+ auto key = CacheableKey::create(buf);
filter->push_back(key);
}
LOG("Adding filter done.");
@@ -487,88 +522,42 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
args = CacheableBoolean::create(1);
getResult = true;
- ExecutionPtr funcExec = FunctionService::onRegion(regPtr0);
- ASSERT(funcExec != NULLPTR, "onRegion Returned NULL");
+ auto funcExec = FunctionService::onRegion(regPtr0);
+ ASSERT(funcExec != nullptr, "onRegion Returned NULL");
- ResultCollectorPtr collector =
- funcExec->withArgs(args)->withFilter(filter)->execute(
- exFuncNameSendException, 15);
- ASSERT(collector != NULLPTR, "onRegion collector NULL");
+ auto collector = funcExec->withArgs(args)->withFilter(filter)->execute(
+ exFuncNameSendException, 15);
+ ASSERT(collector != nullptr, "onRegion collector NULL");
- CacheableVectorPtr result = collector->getResult();
+ auto result = collector->getResult();
- if (result == NULLPTR) {
+ if (result == nullptr) {
ASSERT(false, "echo String : result is NULL");
} else {
- try {
- for (int i = 0; i < result->size(); i++) {
- UserFunctionExecutionExceptionPtr uFEPtr =
- dynCast<UserFunctionExecutionExceptionPtr>(
- result->operator[](i));
- ASSERT(uFEPtr != NULLPTR, "uFEPtr exception is NULL");
- LOGINFO("Done casting to uFEPtr");
- LOGINFO("Read expected uFEPtr exception %s ",
- uFEPtr->getMessage()->asChar());
- }
- } catch (ClassCastException& ex) {
- std::string logmsg = "";
- logmsg += ex.getName();
- logmsg += ": ";
- logmsg += ex.getMessage();
- LOG(logmsg.c_str());
- ex.printStackTrace();
- FAIL(
- "exFuncNameSendException casting to string for bool arguement "
- "exception.");
- } catch (...) {
- FAIL(
- "exFuncNameSendException casting to string for bool arguement "
- "Unknown exception.");
+ for (int i = 0; i < result->size(); i++) {
+ ASSERT(validateResultTypeIsUserFunctionExecutionException(
+ i, result->operator[](i)),
+ "exFuncNameSendException casting to string for bool "
+ "arguement exception.");
}
}
-
LOG("exFuncNameSendException done for bool arguement.");
collector = funcExec->withArgs(arrList)->withFilter(filter)->execute(
exFuncNameSendException, 15);
- ASSERT(collector != NULLPTR, "onRegion collector for arrList NULL");
+ ASSERT(collector != nullptr, "onRegion collector for arrList NULL");
result = collector->getResult();
LOGINFO("result->size() = %d & arrList->size() = %d ", result->size(),
arrList->size() + 1);
ASSERT(
- (result->size() == arrList->size() + 1),
+ result->size() == arrList->size() + 1,
"region get: resultList count is not as arrayList count + exception");
for (int i = 0; i < result->size(); i++) {
- try {
- CacheableInt32Ptr intValue =
- dynCast<CacheableInt32Ptr>(result->operator[](i));
- ASSERT(intValue != NULLPTR, "int value is NULL");
- LOGINFO("intValue is %d ", intValue->value());
- } catch (ClassCastException& ex) {
- LOG("exFuncNameSendException casting to int for arrayList arguement "
- "exception.");
- std::string logmsg = "";
- logmsg += ex.getName();
- logmsg += ": ";
- logmsg += ex.getMessage();
- LOG(logmsg.c_str());
- ex.printStackTrace();
- LOG("exFuncNameSendException now casting to "
- "UserFunctionExecutionExceptionPtr for arrayList arguement "
- "exception.");
- UserFunctionExecutionExceptionPtr uFEPtr =
- dynCast<UserFunctionExecutionExceptionPtr>(result->operator[](i));
- ASSERT(uFEPtr != NULLPTR, "uFEPtr exception is NULL");
- LOGINFO("Done casting to uFEPtr");
- LOGINFO("Read expected uFEPtr exception %s ",
- uFEPtr->getMessage()->asChar());
- } catch (...) {
- FAIL(
- "exFuncNameSendException casting to string for bool arguement "
- "Unknown exception.");
- }
+ ASSERT(validateResultTypeAndAllowUserFunctionExecutionException<
+ CacheableInt32>(i, result->operator[](i)),
+ "Unexpected result type.");
}
LOG("exFuncNameSendException done for arrayList arguement.");
@@ -578,38 +567,20 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
args = CacheableString::create("Multiple");
collector = funcExec->withArgs(args)->withFilter(filter)->execute(
exFuncNameSendException, 15);
- ASSERT(collector != NULLPTR, "onRegion collector for string NULL");
+ ASSERT(collector != nullptr, "onRegion collector for string NULL");
result = collector->getResult();
LOGINFO("result->size() for Multiple String = %d ", result->size());
ASSERT(result->size() == 1,
"region get: resultList count is not as string exception");
- try {
- for (int i = 0; i < result->size(); i++) {
- LOG("exFuncNameSendException now casting to "
- "UserFunctionExecutionExceptionPtr for arrayList arguement "
- "exception.");
- UserFunctionExecutionExceptionPtr uFEPtr =
- dynCast<UserFunctionExecutionExceptionPtr>(result->operator[](i));
- ASSERT(uFEPtr != NULLPTR, "uFEPtr exception is NULL");
- LOGINFO("Done casting to uFEPtr");
- LOGINFO("Read expected uFEPtr exception %s ",
- uFEPtr->getMessage()->asChar());
- }
- } catch (ClassCastException& ex) {
- std::string logmsg = "";
- logmsg += ex.getName();
- logmsg += ": ";
- logmsg += ex.getMessage();
- LOG(logmsg.c_str());
- ex.printStackTrace();
- FAIL(
- "exFuncNameSendException casting to string for string arguement "
+ for (int i = 0; i < result->size(); i++) {
+ LOG("exFuncNameSendException now casting to "
+ "UserFunctionExecutionExceptionPtr for arrayList arguement "
"exception.");
- } catch (...) {
- FAIL(
- "exFuncNameSendException casting to string for string arguement "
- "Unknown exception.");
+ ASSERT(validateResultTypeIsUserFunctionExecutionException(
+ i, result->operator[](i)),
+ "exFuncNameSendException casting to string for string "
+ "arguement exception.");
}
LOG("exFuncNameSendException for string arguement done.");
@@ -618,7 +589,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
"test exFuncNameSendException function with customer collector with "
"bool as arguement using onRegion.");
- MyResultCollectorPtr myRC1(new MyResultCollector());
+ auto myRC1 = std::make_shared<MyResultCollector>();
result = funcExec->withArgs(args)
->withFilter(filter)
->withCollector(myRC1)
@@ -630,7 +601,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
ASSERT(1 == myRC1->getAddResultCount(), "add result count is not 1");
ASSERT(1 == myRC1->getEndResultCount(), "end result count is not 1");
ASSERT(1 == myRC1->getGetResultCount(), "get result count is not 1");
- if (result == NULLPTR) {
+ if (result == nullptr) {
ASSERT(false, "region get new collector: result is NULL");
} else {
LOGINFO("Region get new collector: result count = %d", result->size());
@@ -648,10 +619,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
// restore the data set
for (int i = 0; i < 34; i++) {
sprintf(buf, "VALUE--%d", i);
- CacheablePtr value(CacheableString::create(buf));
+ auto value = CacheableString::create(buf);
sprintf(buf, "KEY--%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
+ auto key = CacheableKey::create(buf);
regPtr0->put(key, value);
}
@@ -660,21 +631,21 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
getResult = true;
// PoolPtr pptr = PoolManager::find(poolName);
args = routingObj;
- // ExecutionPtr exc=NULLPTR;
- // CacheableVectorPtr executeFunctionResult = NULLPTR;
+ // ExecutionPtr exc=nullptr;
+ // CacheableVectorPtr executeFunctionResult = nullptr;
// test data independant function on one server
LOG("test data independant get function on one server");
exc = FunctionService::onServer(getHelper()->cachePtr);
executeFunctionResult =
exc->withArgs(args)->execute(getFuncIName, getResult)->getResult();
- if (executeFunctionResult == NULLPTR) {
+ if (executeFunctionResult == nullptr) {
ASSERT(false, "get executeFunctionResult is NULL");
} else {
resultList->clear();
for (unsigned item = 0;
item < static_cast<uint32_t>(executeFunctionResult->size());
item++) {
- CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>(
+ auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>(
executeFunctionResult->operator[](item));
for (unsigned pos = 0; pos < static_cast<uint32_t>(arrayList->size());
pos++) {
@@ -687,10 +658,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
"get executeFunctionResult count is not 17");
for (int32_t i = 0; i < resultList->size(); i++) {
sprintf(buf, "result[%d] is null\n", i);
- ASSERT(resultList->operator[](i) != NULLPTR, buf);
- sprintf(
- buf, "get result[%d]=%s", i,
- dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar());
+ ASSERT(resultList->operator[](i) != nullptr, buf);
+ sprintf(buf, "get result[%d]=%s", i,
+ std::dynamic_pointer_cast<CacheableString>(
+ resultList->operator[](i))
+ ->asChar());
LOG(buf);
verifyGetResults()
}
@@ -703,9 +675,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
for (int i = 0; i < 34; i++) {
if (i % 2 == 0) continue;
sprintf(buf, "KEY--%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
- CacheableStringPtr value =
- dynCast<CacheableStringPtr>(regPtr0->get(key));
+ auto key = CacheableKey::create(buf);
+ auto value =
+ std::dynamic_pointer_cast<CacheableString>(regPtr0->get(key));
sprintf(buf, "put: result[%d]=%s", i, value->asChar());
LOG(buf);
verifyPutResults()
@@ -725,40 +697,40 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
// ignore exception
}
- PdxTypes8Ptr pdxobj(new PdxTests::PdxTypes8());
+ auto pdxobj = std::make_shared<PdxTests::PdxTypes8>();
for (int i = 0; i < 34; i++) {
sprintf(buf, "KEY--pdx%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
+ auto key = CacheableKey::create(buf);
regPtr0->put(key, pdxobj);
}
LOGINFO("put on pdxObject done");
- CacheableVectorPtr pdxRoutingObj = CacheableVector::create();
+ auto pdxRoutingObj = CacheableVector::create();
for (int i = 0; i < 34; i++) {
if (i % 2 == 0) continue;
sprintf(buf, "KEY--pdx%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
+ auto key = CacheableKey::create(buf);
pdxRoutingObj->push_back(key);
}
- ExecutionPtr pdxExc = FunctionService::onServers(getHelper()->cachePtr);
- CacheableVectorPtr executeFunctionResultPdx =
+ auto pdxExc = FunctionService::onServers(getHelper()->cachePtr);
+ auto executeFunctionResultPdx =
pdxExc->withArgs(pdxRoutingObj)
->execute(exFuncNamePdxType, getResult)
->getResult();
LOGINFO("FE on pdxObject done");
- if (executeFunctionResultPdx == NULLPTR) {
+ if (executeFunctionResultPdx == nullptr) {
ASSERT(false, "get executeFunctionResultPdx is NULL");
} else {
LOGINFO("executeFunctionResultPdx size for PdxObject = %d ",
executeFunctionResultPdx->size());
ASSERT(2 == executeFunctionResultPdx->size(),
"executeFunctionResultPdx->size() is not 2");
- CacheableVectorPtr resultListPdx = CacheableVector::create();
+ auto resultListPdx = CacheableVector::create();
for (unsigned item = 0;
item < static_cast<uint32_t>(executeFunctionResultPdx->size());
item++) {
- CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>(
+ auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>(
executeFunctionResultPdx->operator[](item));
for (unsigned pos = 0; pos < static_cast<uint32_t>(arrayList->size());
pos++) {
@@ -768,23 +740,22 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
LOGINFO("resultlistPdx size: %d", resultListPdx->size());
for (int32_t i = 0; i < resultListPdx->size(); i++) {
sprintf(buf, "result[%d] is null\n", i);
- ASSERT(resultListPdx->operator[](i) != NULLPTR, buf);
+ ASSERT(resultListPdx->operator[](i) != nullptr, buf);
LOG("resultPdx item is not null");
- LOGINFO("get result[%d]=%s", i,
- dynCast<PdxTypes8Ptr>(resultListPdx->operator[](i))
- ->toString()
- ->asChar());
- PdxTypes8Ptr pdxObj2 =
- dynCast<PdxTypes8Ptr>(resultListPdx->operator[](i));
+ LOGINFO("get result[%d]=%s", i, std::dynamic_pointer_cast<PdxTypes8>(
+ resultListPdx->operator[](i))
+ ->toString()
+ ->asChar());
+ auto pdxObj2 = std::dynamic_pointer_cast<PdxTypes8>(
+ resultListPdx->operator[](i));
ASSERT(pdxobj->equals(pdxObj2) == true,
"Pdx Object not equals original object.");
}
}
LOG("test pdx data function on all servers done");
- PdxInstanceFactoryPtr pifPtr =
- cacheHelper->getCache()->createPdxInstanceFactory(
- "PdxTests.PdxTypes8");
+ auto pifPtr = cacheHelper->getCache()->createPdxInstanceFactory(
+ "PdxTests.PdxTypes8");
LOG("PdxInstanceFactoryPtr created....");
pifPtr->writeInt("i1", 1);
@@ -794,7 +765,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
pifPtr->writeInt("i3", 3);
pifPtr->writeInt("i4", 4);
- PdxInstancePtr ret = pifPtr->create();
+ auto ret = pifPtr->create();
LOG("PdxInstancePtr created");
for (int i = 0; i < 34; i++) {
@@ -804,7 +775,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
}
LOGINFO("put on pdxObject done");
- CacheableVectorPtr pdxInstanceRoutingObj = CacheableVector::create();
+ auto pdxInstanceRoutingObj = CacheableVector::create();
for (int i = 0; i < 34; i++) {
if (i % 2 == 0) continue;
sprintf(buf, "KEY--pdx%d", i);
@@ -812,26 +783,25 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
pdxInstanceRoutingObj->push_back(key);
}
- ExecutionPtr pdxInstanceExc =
- FunctionService::onServers(getHelper()->cachePtr);
- CacheableVectorPtr executeFunctionResultPdxInstance =
+ auto pdxInstanceExc = FunctionService::onServers(getHelper()->cachePtr);
+ auto executeFunctionResultPdxInstance =
pdxInstanceExc->withArgs(pdxInstanceRoutingObj)
->execute(exFuncNamePdxType, getResult)
->getResult();
LOGINFO("FE on pdxObject done");
- if (executeFunctionResultPdxInstance == NULLPTR) {
+ if (executeFunctionResultPdxInstance == nullptr) {
ASSERT(false, "get executeFunctionResultPdxInstance is NULL");
} else {
LOGINFO("executeFunctionResultPdxInstance size for PdxObject = %d ",
executeFunctionResultPdxInstance->size());
ASSERT(2 == executeFunctionResultPdx->size(),
"executeFunctionResultPdxInstance->size() is not 2");
- CacheableVectorPtr resultListPdxInstance = CacheableVector::create();
+ auto resultListPdxInstance = CacheableVector::create();
for (unsigned item = 0;
item <
static_cast<uint32_t>(executeFunctionResultPdxInstance->size());
item++) {
- CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>(
+ auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>(
executeFunctionResultPdxInstance->operator[](item));
for (unsigned pos = 0; pos < static_cast<uint32_t>(arrayList->size());
pos++) {
@@ -842,14 +812,15 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
resultListPdxInstance->size());
for (int32_t i = 0; i < resultListPdxInstance->size(); i++) {
sprintf(buf, "result[%d] is null\n", i);
- ASSERT(resultListPdxInstance->operator[](i) != NULLPTR, buf);
+ ASSERT(resultListPdxInstance->operator[](i) != nullptr, buf);
LOG("resultPdx item is not null");
LOGINFO("get result[%d]=%s", i,
- dynCast<PdxTypes8Ptr>(resultListPdxInstance->operator[](i))
+ std::dynamic_pointer_cast<PdxTypes8>(
+ resultListPdxInstance->operator[](i))
->toString()
->asChar());
- PdxTypes8Ptr pdxObj2 =
- dynCast<PdxTypes8Ptr>(resultListPdxInstance->operator[](i));
+ auto pdxObj2 = std::dynamic_pointer_cast<PdxTypes8>(
+ resultListPdxInstance->operator[](i));
ASSERT(pdxobj->equals(pdxObj2) == true,
"Pdx Object not equals original object.");
@@ -863,10 +834,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
// repopulate with the original values
for (int i = 0; i < 34; i++) {
sprintf(buf, "VALUE--%d", i);
- CacheablePtr value(CacheableString::create(buf));
+ auto value = CacheableString::create(buf);
sprintf(buf, "KEY--%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
+ auto key = CacheableKey::create(buf);
regPtr0->put(key, value);
}
SLEEP(10000); // let the put finish
@@ -880,6 +851,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
if (isLocalServer) {
CacheHelper::initServer(3, "func_cacheserver3_pool.xml", lhp);
}
+ LOGINFO("Sleeping for 60s...");
SLEEP(60000); // let this servers gets all the data
//---------------------------------------------------------------------
@@ -887,14 +859,14 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
exc = FunctionService::onServers(getHelper()->cachePtr);
executeFunctionResult =
exc->withArgs(args)->execute(getFuncIName, getResult)->getResult();
- if (executeFunctionResult == NULLPTR) {
+ if (executeFunctionResult == nullptr) {
ASSERT(false, "get executeFunctionResult is NULL");
} else {
resultList->clear();
for (unsigned item = 0;
item < static_cast<uint32_t>(executeFunctionResult->size());
item++) {
- CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>(
+ auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>(
executeFunctionResult->operator[](item));
for (unsigned pos = 0; pos < static_cast<uint32_t>(arrayList->size());
pos++) {
@@ -908,10 +880,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
"get executeFunctionResult on all servers count is not 51");
for (int32_t i = 0; i < resultList->size(); i++) {
sprintf(buf, "result[%d] is null\n", i);
- ASSERT(resultList->operator[](i) != NULLPTR, buf);
- sprintf(
- buf, "get result[%d]=%s", i,
- dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar());
+ ASSERT(resultList->operator[](i) != nullptr, buf);
+ sprintf(buf, "get result[%d]=%s", i,
+ std::dynamic_pointer_cast<CacheableString>(
+ resultList->operator[](i))
+ ->asChar());
LOG(buf);
verifyGetResults()
}
@@ -925,9 +898,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
for (int i = 0; i < 34; i++) {
if (i % 2 == 0) continue;
sprintf(buf, "KEY--%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
- CacheableStringPtr value =
- dynCast<CacheableStringPtr>(regPtr0->get(key));
+ auto key = CacheableKey::create(buf);
+ auto value =
+ std::dynamic_pointer_cast<CacheableString>(regPtr0->get(key));
sprintf(buf, "put: result[%d]=%s", i, value->asChar());
LOG(buf);
verifyPutResults()
@@ -941,44 +914,25 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
collector =
funcExec->withArgs(args)->execute(exFuncNameSendException, 15);
- ASSERT(collector != NULLPTR, "onServers collector for bool NULL");
+ ASSERT(collector != nullptr, "onServers collector for bool NULL");
result = collector->getResult();
ASSERT(result->size() == 3,
"Should have got 3 exception strings for sendException.");
- if (result == NULLPTR) {
+ if (result == nullptr) {
ASSERT(false, "echo String : result is NULL");
} else {
- try {
- for (int i = 0; i < result->size(); i++) {
- UserFunctionExecutionExceptionPtr uFEPtr =
- dynCast<UserFunctionExecutionExceptionPtr>(
- result->operator[](i));
- ASSERT(uFEPtr != NULLPTR, "uFEPtr exception is NULL");
- LOGINFO("Done casting to uFEPtr");
- LOGINFO("Read expected uFEPtr exception %s ",
- uFEPtr->getMessage()->asChar());
- }
- } catch (ClassCastException& ex) {
- std::string logmsg = "";
- logmsg += ex.getName();
- logmsg += ": ";
- logmsg += ex.getMessage();
- LOG(logmsg.c_str());
- ex.printStackTrace();
- FAIL(
- "exFuncNameSendException casting to string for bool arguement "
- "exception.");
- } catch (...) {
- FAIL(
- "exFuncNameSendException casting to string for bool arguement "
- "Unknown exception.");
+ for (int i = 0; i < result->size(); i++) {
+ ASSERT(validateResultTypeIsUserFunctionExecutionException(
+ i, result->operator[](i)),
+ "exFuncNameSendException casting to string for bool arguement "
+ "Unknown exception.");
}
}
collector =
funcExec->withArgs(arrList)->execute(exFuncNameSendException, 15);
- ASSERT(collector != NULLPTR, "onServers collector for arrList NULL");
+ ASSERT(collector != nullptr, "onServers collector for arrList NULL");
result = collector->getResult();
ASSERT(result->size() == (arrList->size() + 1) * 3,
@@ -988,60 +942,16 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
LOG("Printing only string exception results for onServers with "
"sendException");
for (int i = 0; i < result->size(); i++) {
- try {
- CacheableInt32Ptr intValue =
- dynCast<CacheableInt32Ptr>(result->operator[](i));
- ASSERT(intValue != NULLPTR, "int value is NULL");
- LOGINFO("intValue is %d ", intValue->value());
- } catch (ClassCastException& ex) {
- std::string logmsg = "";
- logmsg += ex.getName();
- logmsg += ": ";
- logmsg += ex.getMessage();
- LOG(logmsg.c_str());
- ex.printStackTrace();
- UserFunctionExecutionExceptionPtr uFEPtr =
- dynCast<UserFunctionExecutionExceptionPtr>(result->operator[](i));
- ASSERT(uFEPtr != NULLPTR, "uFEPtr exception is NULL");
- LOGINFO("Done casting to uFEPtr");
- LOGINFO("Read expected uFEPtr exception %s ",
- uFEPtr->getMessage()->asChar());
- } catch (...) {
- FAIL(
- "exFuncNameSendException casting to string for arrList arguement "
- "for onServers Unknown exception.");
- }
+ ASSERT(validateResultTypeAndAllowUserFunctionExecutionException<
+ CacheableInt32>(i, result->operator[](i)),
+ "Unexpected result type.");
}
LOG("Printing all results for onServers with sendException");
for (int i = 0; i < result->size(); i++) {
- try {
- CacheableInt32Ptr intValue =
- dynCast<CacheableInt32Ptr>(result->operator[](i));
- ASSERT(intValue != NULLPTR, "int value is NULL");
- LOGINFO("intValue is %d ", intValue->value());
- } catch (ClassCastException& ex) {
- LOG("exFuncNameSendException casting to int for arrayList arguement "
- "exception.");
- std::string logmsg = "";
- logmsg += ex.getName();
- logmsg += ": ";
- logmsg += ex.getMessage();
- LOG(logmsg.c_str());
- ex.printStackTrace();
- LOG("exFuncNameSendException now casting to string for arrayList "
- "arguement exception.");
- UserFunctionExecutionExceptionPtr uFEPtr =
- dynCast<UserFunctionExecutionExceptionPtr>(result->operator[](i));
- ASSERT(uFEPtr != NULLPTR, "uFEPtr exception is NULL");
- LOGINFO("Done casting to uFEPtr");
- LOGINFO("Read expected uFEPtr exception %s ",
- uFEPtr->getMessage()->asChar());
- } catch (...) {
- FAIL(
- "exFuncNameSendException casting to string for bool arguement "
- "Unknown exception.");
- }
+ ASSERT(validateResultTypeAndAllowUserFunctionExecutionException<
+ CacheableInt32>(i, result->operator[](i)),
+ "Unexpected result type.");
}
LOG("exFuncNameSendException for string arguement.");
@@ -1049,35 +959,17 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
args = CacheableString::create("Multiple");
collector =
funcExec->withArgs(args)->execute(exFuncNameSendException, 15);
- ASSERT(collector != NULLPTR, "onServers collector for string NULL");
+ ASSERT(collector != nullptr, "onServers collector for string NULL");
result = collector->getResult();
ASSERT(result->size() == 3,
"region get: resultList count is not as string exception");
- try {
- for (int i = 0; i < result->size(); i++) {
- UserFunctionExecutionExceptionPtr uFEPtr =
- dynCast<UserFunctionExecutionExceptionPtr>(result->operator[](i));
- ASSERT(uFEPtr != NULLPTR, "uFEPtr exception is NULL");
- LOGINFO("Done casting to uFEPtr");
- LOGINFO("Read expected uFEPtr exception %s ",
- uFEPtr->getMessage()->asChar());
- }
- } catch (ClassCastException& ex) {
- std::string logmsg = "";
- logmsg += ex.getName();
- logmsg += ": ";
- logmsg += ex.getMessage();
- LOG(logmsg.c_str());
- ex.printStackTrace();
- FAIL(
- "exFuncNameSendException casting to string for string arguement "
- "exception.");
- } catch (...) {
- FAIL(
- "exFuncNameSendException casting to string for string arguement "
- "Unknown exception.");
+ for (int i = 0; i < result->size(); i++) {
+ ASSERT(validateResultTypeIsUserFunctionExecutionException(
+ i, result->operator[](i)),
+ "exFuncNameSendException casting to string for string arguement "
+ "exception.");
}
LOG("exFuncNameSendException for string arguement done.");
@@ -1086,7 +978,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
"test exFuncNameSendException function with customer collector with "
"bool as arguement using onServers.");
- MyResultCollectorPtr myRC2(new MyResultCollector());
+ auto myRC2 = std::make_shared<MyResultCollector>();
result = funcExec->withArgs(args)
->withCollector(myRC2)
->execute(exFuncNameSendException, getResult)
@@ -1097,7 +989,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
LOGINFO("add result count = %d", myRC2->getAddResultCount());
LOGINFO("end result count = %d", myRC2->getEndResultCount());
LOGINFO("get result count = %d", myRC2->getGetResultCount());
- if (result == NULLPTR) {
+ if (result == nullptr) {
ASSERT(false, "region get new collector: result is NULL");
} else {
LOGINFO("Region get new collector: result count = %d", result->size());
@@ -1135,23 +1027,24 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, Client2OpTest)
{
- RegionPtr regPtr0 = getHelper()->getRegion(poolRegNames[0]);
+ auto regPtr0 = getHelper()->getRegion(poolRegNames[0]);
char buf[128];
SLEEP(10000);
try {
LOGINFO("FETimeOut begin onRegion");
- ExecutionPtr RexecutionPtr = FunctionService::onRegion(regPtr0);
- CacheableVectorPtr fe =
- RexecutionPtr->withArgs(CacheableInt32::create(5000 * 1000))
- ->execute(FETimeOut, 5000)
- ->getResult();
- if (fe == NULLPTR) {
+ auto RexecutionPtr = FunctionService::onRegion(regPtr0);
+ auto fe = RexecutionPtr->withArgs(CacheableInt32::create(5000 * 1000))
+ ->execute(FETimeOut, 5000)
+ ->getResult();
+ if (fe == nullptr) {
ASSERT(false, "functionResult is NULL");
} else {
sprintf(buf, "result count = %d", fe->size());
LOG(buf);
for (int i = 0; i < fe->size(); i++) {
- bool b = dynCast<CacheableBooleanPtr>(fe->operator[](i))->value();
+ bool b =
+ std::dynamic_pointer_cast<CacheableBoolean>(fe->operator[](i))
+ ->value();
LOG(b == true ? "true" : "false");
ASSERT(b == true, "true is not eched back");
}
@@ -1159,18 +1052,19 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client2OpTest)
LOGINFO("FETimeOut done onRegion");
LOGINFO("FETimeOut begin onServer");
- ExecutionPtr serverExc = FunctionService::onServer(getHelper()->cachePtr);
- CacheableVectorPtr vec =
- serverExc->withArgs(CacheableInt32::create(5000 * 1000))
- ->execute(FETimeOut, 5000)
- ->getResult();
- if (vec == NULLPTR) {
+ auto serverExc = FunctionService::onServer(getHelper()->cachePtr);
+ auto vec = serverExc->withArgs(CacheableInt32::create(5000 * 1000))
+ ->execute(FETimeOut, 5000)
+ ->getResult();
+ if (vec == nullptr) {
ASSERT(false, "functionResult is NULL");
} else {
sprintf(buf, "result count = %d", vec->size());
LOG(buf);
for (int i = 0; i < vec->size(); i++) {
- bool b = dynCast<CacheableBooleanPtr>(vec->operator[](i))->value();
+ bool b =
+ std::dynamic_pointer_cast<CacheableBoolean>(vec->operator[](i))
+ ->value();
LOG(b == true ? "true" : "false");
ASSERT(b == true, "true is not eched back");
}
@@ -1178,19 +1072,19 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client2OpTest)
LOGINFO("FETimeOut done onServer");
LOGINFO("FETimeOut begin onServers");
- ExecutionPtr serversExc =
- FunctionService::onServers(getHelper()->cachePtr);
- CacheableVectorPtr vecs =
- serversExc->withArgs(CacheableInt32::create(5000 * 1000))
- ->execute(FETimeOut, 5000)
- ->getResult();
- if (vecs == NULLPTR) {
+ auto serversExc = FunctionService::onServers(getHelper()->cachePtr);
+ auto vecs = serversExc->withArgs(CacheableInt32::create(5000 * 1000))
+ ->execute(FETimeOut, 5000)
+ ->getResult();
+ if (vecs == nullptr) {
ASSERT(false, "functionResult is NULL");
} else {
sprintf(buf, "result count = %d", vecs->size());
LOG(buf);
for (int i = 0; i < vecs->size(); i++) {
- bool b = dynCast<CacheableBooleanPtr>(vecs->operator[](i))->value();
+ bool b =
+ std::dynamic_pointer_cast<CacheableBoolean>(vecs->operator[](i))
+ ->value();
LOG(b == true ? "true" : "false");
ASSERT(b == true, "true is not eched back");
}
@@ -1262,19 +1156,18 @@ class putThread : public ACE_Task_Base {
int svc(void) {
bool networkhop ATTR_UNUSED = false;
- CacheableKeyPtr keyPtr;
- CacheablePtr args = NULLPTR;
- ResultCollectorPtr rPtr = NULLPTR;
- RegionPtr regPtr0 = getHelper()->getRegion(poolRegNames[0]);
+ CacheablePtr args = nullptr;
+ ResultCollectorPtr rPtr = nullptr;
+ auto regPtr0 = getHelper()->getRegion(poolRegNames[0]);
while (!m_stop) {
for (int i = m_min; i < m_max; i++) {
try {
char buf[128];
sprintf(buf, "am-%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
- CacheableVectorPtr routingObj = CacheableVector::create();
+ auto key = CacheableKey::create(buf);
+ auto routingObj = CacheableVector::create();
routingObj->push_back(key);
- ExecutionPtr exc = FunctionService::onRegion(regPtr0);
+ auto exc = FunctionService::onRegion(regPtr0);
exc->execute(routingObj, args, rPtr, getFuncName2, 300 /*in millis*/)
->getResult();
} catch (const TimeoutException& te) {
@@ -1298,10 +1191,10 @@ class putThread : public ACE_Task_Base {
};
void executeFunction() {
- RegionPtr regPtr0 = getHelper()->getRegion(poolRegNames[0]);
+ auto regPtr0 = getHelper()->getRegion(poolRegNames[0]);
TestUtils::getCacheImpl(getHelper()->cachePtr)->getAndResetNetworkHopFlag();
- CacheablePtr args = NULLPTR;
- ResultCollectorPtr rPtr = NULLPTR;
+ CacheablePtr args = nullptr;
+ ResultCollectorPtr rPtr = nullptr;
int failureCount = 0;
LOGINFO("executeFunction started");
for (int i = 0; i < 300; i++) {
@@ -1313,10 +1206,10 @@ void executeFunction() {
}
char buf[128];
sprintf(buf, "am-%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
- CacheableVectorPtr routingObj = CacheableVector::create();
+ auto key = CacheableKey::create(buf);
+ auto routingObj = CacheableVector::create();
routingObj->push_back(key);
- ExecutionPtr exc = FunctionService::onRegion(regPtr0);
+ auto exc = FunctionService::onRegion(regPtr0);
exc->execute(routingObj, args, rPtr, getFuncName2, 300 /*in millis*/)
->getResult();
}
@@ -1356,7 +1249,5 @@ void runFunctionExecution() {
}
DUNIT_MAIN
- {
- runFunctionExecution();
- }
+ { runFunctionExecution(); }
END_MAIN
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientPoolExecuteFunctionDisableChunkHandlerThread.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientPoolExecuteFunctionDisableChunkHandlerThread.cpp b/src/cppcache/integration-test/testThinClientPoolExecuteFunctionDisableChunkHandlerThread.cpp
index cba7bad..9d57d27 100644
--- a/src/cppcache/integration-test/testThinClientPoolExecuteFunctionDisableChunkHandlerThread.cpp
+++ b/src/cppcache/integration-test/testThinClientPoolExecuteFunctionDisableChunkHandlerThread.cpp
@@ -80,7 +80,7 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, StartC1)
{
// initClient(true);
- initClientWithPool(true, NULL, locHostPort, serverGroup, NULLPTR, 0, true);
+ initClientWithPool(true, NULL, locHostPort, serverGroup, nullptr, 0, true);
// createPool(poolName, locHostPort,serverGroup, NULL, 0, true );
// createRegionAndAttachPool(poolRegNames[0],USE_ACK, poolName);
@@ -213,8 +213,8 @@ class putThread : public ACE_Task_Base {
int svc(void) {
bool networkhop ATTR_UNUSED = false;
CacheableKeyPtr keyPtr;
- CacheablePtr args = NULLPTR;
- ResultCollectorPtr rPtr = NULLPTR;
+ CacheablePtr args = nullptr;
+ ResultCollectorPtr rPtr = nullptr;
RegionPtr regPtr0 = getHelper()->getRegion(poolRegNames[0]);
while (!m_stop) {
for (int i = m_min; i < m_max; i++) {
@@ -250,8 +250,8 @@ class putThread : public ACE_Task_Base {
void executeFunction() {
RegionPtr regPtr0 = getHelper()->getRegion(poolRegNames[0]);
TestUtils::getCacheImpl(getHelper()->cachePtr)->getAndResetNetworkHopFlag();
- CacheablePtr args = NULLPTR;
- ResultCollectorPtr rPtr = NULLPTR;
+ CacheablePtr args = nullptr;
+ ResultCollectorPtr rPtr = nullptr;
int failureCount = 0;
LOGINFO("executeFunction started");
for (int i = 0; i < 300; i++) {
[09/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from cppcache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/LRUEntriesMap.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/LRUEntriesMap.cpp b/src/cppcache/src/LRUEntriesMap.cpp
index 4b30513..29a0aff 100644
--- a/src/cppcache/src/LRUEntriesMap.cpp
+++ b/src/cppcache/src/LRUEntriesMap.cpp
@@ -63,16 +63,14 @@ LRUEntriesMap::LRUEntriesMap(EntryFactory* entryFactory, RegionInternal* region,
concurrency),
m_lruList(),
m_limit(limit),
- m_pmPtr(NULLPTR),
+ m_pmPtr(nullptr),
m_validEntries(0),
m_heapLRUEnabled(heapLRUEnabled) {
m_currentMapSize = 0;
m_action = NULL;
m_evictionControllerPtr = NULL;
// translate action type to an instance.
- if (region == NULL) {
- m_action = new TestMapAction(this);
- } else {
+ if (region) {
m_action = LRUAction::newLRUAction(lruAction, region, this);
m_name = region->getName();
CacheImpl* cImpl = region->getCacheImpl();
@@ -84,6 +82,8 @@ LRUEntriesMap::LRUEntriesMap(EntryFactory* entryFactory, RegionInternal* region,
m_name.c_str());
}
}
+ } else {
+ m_action = new TestMapAction(this);
}
}
@@ -131,7 +131,7 @@ GfErrType LRUEntriesMap::create(const CacheableKeyPtr& key,
}
CacheablePtr tmpValue;
segmentRPtr->getEntry(key, mePtr, tmpValue);
- if (mePtr == NULLPTR) {
+ if (mePtr == nullptr) {
return err;
}
m_lruList.appendEntry(mePtr);
@@ -141,7 +141,7 @@ GfErrType LRUEntriesMap::create(const CacheableKeyPtr& key,
int64_t newSize =
static_cast<int64_t>(Utils::checkAndGetObjectSize(newValue));
newSize += static_cast<int64_t>(Utils::checkAndGetObjectSize(key));
- if (oldValue != NULLPTR) {
+ if (oldValue != nullptr) {
newSize -= static_cast<int64_t>(oldValue->objectSize());
} else {
newSize -= static_cast<int64_t>(sizeof(void*));
@@ -165,7 +165,7 @@ GfErrType LRUEntriesMap::evictionHelper() {
// ACE_Guard< ACE_Recursive_Thread_Mutex > guard( m_mutex );
MapEntryImplPtr lruEntryPtr;
m_lruList.getLRUEntry(lruEntryPtr);
- if (lruEntryPtr == NULLPTR) {
+ if (lruEntryPtr == nullptr) {
err = GF_ENOENT;
return err;
}
@@ -225,7 +225,7 @@ GfErrType LRUEntriesMap::invalidate(const CacheableKeyPtr& key,
// need to assess the effect of this; also assess the affect of above
// mentioned race
oldValue = m_pmPtr->read(key, persistenceInfo);
- if (oldValue != NULLPTR) {
+ if (oldValue != nullptr) {
m_pmPtr->destroy(key, persistenceInfo);
}
}
@@ -233,7 +233,7 @@ GfErrType LRUEntriesMap::invalidate(const CacheableKeyPtr& key,
--m_validEntries;
me->getLRUProperties().setEvicted();
newSize = CacheableToken::invalid()->objectSize();
- if (oldValue != NULLPTR) {
+ if (oldValue != nullptr) {
newSize -= oldValue->objectSize();
} else {
newSize -= sizeof(void*);
@@ -292,7 +292,7 @@ GfErrType LRUEntriesMap::put(const CacheableKeyPtr& key,
}
void* persistenceInfo = me->getLRUProperties().getPersistenceInfo();
oldValue = m_pmPtr->read(key, persistenceInfo);
- if (oldValue != NULLPTR) {
+ if (oldValue != nullptr) {
m_pmPtr->destroy(key, persistenceInfo);
}
}
@@ -315,7 +315,7 @@ GfErrType LRUEntriesMap::put(const CacheableKeyPtr& key,
segmentRPtr->getEntry(key, mePtr, tmpValue);
// mePtr cannot be null, we just put it...
// must convert to an LRUMapEntryImplPtr...
- GF_D_ASSERT(mePtr != NULLPTR);
+ GF_D_ASSERT(mePtr != nullptr);
m_lruList.appendEntry(mePtr);
me = mePtr;
} else {
@@ -342,7 +342,7 @@ GfErrType LRUEntriesMap::put(const CacheableKeyPtr& key,
if (isUpdate == false) {
newSize += static_cast<int64_t>(Utils::checkAndGetObjectSize(key));
} else {
- if (oldValue != NULLPTR) {
+ if (oldValue != nullptr) {
newSize -= static_cast<int64_t>(oldValue->objectSize());
} else {
newSize -= static_cast<int64_t>(sizeof(void*));
@@ -377,7 +377,7 @@ bool LRUEntriesMap::get(const CacheableKeyPtr& key, CacheablePtr& returnPtr,
segmentLocked = true;
}
{
- returnPtr = NULLPTR;
+ returnPtr = nullptr;
MapEntryImplPtr mePtr;
if (false == segmentRPtr->getEntry(key, mePtr, returnPtr)) {
if (segmentLocked == true) segmentRPtr->release();
@@ -386,7 +386,7 @@ bool LRUEntriesMap::get(const CacheableKeyPtr& key, CacheablePtr& returnPtr,
// segmentRPtr->get(key, returnPtr, mePtr);
MapEntryImplPtr nodeToMark = mePtr;
LRUEntryProperties& lruProps = nodeToMark->getLRUProperties();
- if (returnPtr != NULLPTR && CacheableToken::isOverflowed(returnPtr)) {
+ if (returnPtr != nullptr && CacheableToken::isOverflowed(returnPtr)) {
void* persistenceInfo = lruProps.getPersistenceInfo();
CacheablePtr tmpObj;
try {
@@ -396,8 +396,8 @@ bool LRUEntriesMap::get(const CacheableKeyPtr& key, CacheablePtr& returnPtr,
if (segmentLocked == true) segmentRPtr->release();
return false;
}
- (m_region->getRegionStats())->incRetrieves();
- (m_region->getCacheImpl())->m_cacheStats->incRetrieves();
+ m_region->getRegionStats()->incRetrieves();
+ m_region->getCacheImpl()->m_cacheStats->incRetrieves();
returnPtr = tmpObj;
@@ -415,7 +415,7 @@ bool LRUEntriesMap::get(const CacheableKeyPtr& key, CacheablePtr& returnPtr,
doProcessLRU = true;
if (m_evictionControllerPtr != NULL) {
int64_t newSize = 0;
- if (tmpObj != NULLPTR) {
+ if (tmpObj != nullptr) {
newSize += static_cast<int64_t>(
tmpObj->objectSize() - CacheableToken::invalid()->objectSize());
} else {
@@ -453,7 +453,7 @@ GfErrType LRUEntriesMap::remove(const CacheableKeyPtr& key,
if ((err = segmentRPtr->remove(key, result, me, updateCount, versionTag,
afterRemote, isEntryFound)) == GF_NOERR) {
// ACE_Guard<MapSegment> _guard(*segmentRPtr);
- if (result != NULLPTR && me != NULLPTR) {
+ if (result != nullptr && me != nullptr) {
LRUEntryProperties& lruProps = me->getLRUProperties();
lruProps.setEvicted();
if (isEntryFound) --m_size;
@@ -471,7 +471,7 @@ GfErrType LRUEntriesMap::remove(const CacheableKeyPtr& key,
// need to assess the effect of this; also assess the affect of above
// mentioned race
result = m_pmPtr->read(key, persistenceInfo);
- if (result != NULLPTR) {
+ if (result != nullptr) {
m_pmPtr->destroy(key, persistenceInfo);
}
}
@@ -498,7 +498,7 @@ void LRUEntriesMap::updateMapSize(int64_t size) {
}
CacheablePtr LRUEntriesMap::getFromDisk(const CacheableKeyPtr& key,
- MapEntryImpl* me) const {
+ MapEntryImplPtr& me) const {
void* persistenceInfo = me->getLRUProperties().getPersistenceInfo();
CacheablePtr tmpObj;
try {
@@ -507,7 +507,7 @@ CacheablePtr LRUEntriesMap::getFromDisk(const CacheableKeyPtr& key,
tmpObj = m_pmPtr->read(key, persistenceInfo);
} catch (Exception& ex) {
LOGERROR("read on the persistence layer failed - %s", ex.getMessage());
- return NULLPTR;
+ return nullptr;
}
return tmpObj;
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/LRUEntriesMap.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/LRUEntriesMap.hpp b/src/cppcache/src/LRUEntriesMap.hpp
index 3efcbeb..a50658f 100644
--- a/src/cppcache/src/LRUEntriesMap.hpp
+++ b/src/cppcache/src/LRUEntriesMap.hpp
@@ -94,7 +94,7 @@ class CPPCACHE_EXPORT LRUEntriesMap : public ConcurrentEntriesMap,
virtual bool get(const CacheableKeyPtr& key, CacheablePtr& returnPtr,
MapEntryImplPtr& me);
virtual CacheablePtr getFromDisk(const CacheableKeyPtr& key,
- MapEntryImpl* me) const;
+ MapEntryImplPtr& me) const;
GfErrType processLRU();
void processLRU(int32_t numEntriesToEvict);
GfErrType evictionHelper();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/LRUList.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/LRUList.cpp b/src/cppcache/src/LRUList.cpp
index c752faa..c8d9fbd 100644
--- a/src/cppcache/src/LRUList.cpp
+++ b/src/cppcache/src/LRUList.cpp
@@ -24,7 +24,7 @@ using namespace apache::geode::client;
template <typename TEntry, typename TCreateEntry>
LRUList<TEntry, TCreateEntry>::LRUList() : m_headLock(), m_tailLock() {
- LRUListEntryPtr headEntry(TCreateEntry::create(NULLPTR));
+ LRUListEntryPtr headEntry(TCreateEntry::create(nullptr));
headEntry->getLRUProperties().setEvicted(); // create empty evicted entry.
m_headNode = new LRUListNode(headEntry);
m_tailNode = m_headNode;
@@ -68,7 +68,7 @@ void LRUList<TEntry, TCreateEntry>::getLRUEntry(LRUListEntryPtr& result) {
while (true) {
aNode = getHeadNode(isLast);
if (aNode == NULL) {
- result = NULLPTR;
+ result = nullptr;
break;
}
aNode->getEntry(result);
@@ -88,7 +88,7 @@ void LRUList<TEntry, TCreateEntry>::getLRUEntry(LRUListEntryPtr& result) {
break; // found unused entry
}
} else {
- result = NULLPTR; // remove the reference to entry
+ result = nullptr; // remove the reference to entry
delete aNode; // drop the entry to the floor ...
}
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/LRULocalDestroyAction.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/LRULocalDestroyAction.cpp b/src/cppcache/src/LRULocalDestroyAction.cpp
index 633c5cc..e0cc06d 100644
--- a/src/cppcache/src/LRULocalDestroyAction.cpp
+++ b/src/cppcache/src/LRULocalDestroyAction.cpp
@@ -30,7 +30,7 @@ bool LRULocalDestroyAction::evict(const MapEntryImplPtr& mePtr) {
LOGDEBUG("LRULocalDestroy: evicting entry with key [%s]",
Utils::getCacheableKeyString(keyPtr)->asChar());
GfErrType err = m_regionPtr->destroyNoThrow(
- keyPtr, NULLPTR, -1, CacheEventFlags::EVICTION | CacheEventFlags::LOCAL,
+ keyPtr, nullptr, -1, CacheEventFlags::EVICTION | CacheEventFlags::LOCAL,
versionTag);
return (err == GF_NOERR);
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/LocalRegion.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/LocalRegion.cpp b/src/cppcache/src/LocalRegion.cpp
index 5e61580..6de7774 100644
--- a/src/cppcache/src/LocalRegion.cpp
+++ b/src/cppcache/src/LocalRegion.cpp
@@ -37,7 +37,7 @@
using namespace apache::geode::client;
LocalRegion::LocalRegion(const std::string& name, CacheImpl* cache,
- RegionInternal* rPtr,
+ const RegionInternalPtr& rPtr,
const RegionAttributesPtr& attributes,
const CacheStatisticsPtr& stats, bool shared)
: RegionInternal(attributes),
@@ -45,17 +45,17 @@ LocalRegion::LocalRegion(const std::string& name, CacheImpl* cache,
m_parentRegion(rPtr),
m_cacheImpl(cache),
m_destroyPending(false),
- m_listener(NULLPTR),
- m_writer(NULLPTR),
- m_loader(NULLPTR),
+ m_listener(nullptr),
+ m_writer(nullptr),
+ m_loader(nullptr),
m_released(false),
m_entries(NULL),
m_cacheStatistics(stats),
m_transactionEnabled(false),
m_isPRSingleHopEnabled(false),
- m_attachedPool(NULLPTR),
- m_persistenceManager(NULLPTR) {
- if (m_parentRegion != NULLPTR) {
+ m_attachedPool(nullptr),
+ m_persistenceManager(nullptr) {
+ if (m_parentRegion != nullptr) {
((m_fullPath = m_parentRegion->getFullPath()) += "/") += m_name;
} else {
(m_fullPath = "/") += m_name;
@@ -76,7 +76,7 @@ LocalRegion::LocalRegion(const std::string& name, CacheImpl* cache,
cldptr = m_regionAttributes->getCacheLoader();
m_loader = cldptr;
- if (m_parentRegion != NULLPTR) {
+ if (m_parentRegion != nullptr) {
((m_fullPath = m_parentRegion->getFullPath()) += "/") += m_name;
} else {
(m_fullPath = "/") += m_name;
@@ -110,7 +110,7 @@ void LocalRegion::updateAccessAndModifiedTime(bool modified) {
m_cacheStatistics->setLastModifiedTime(static_cast<uint32_t>(currTime));
}
// TODO: should we really touch the parent region??
- RegionInternal* ri = dynamic_cast<RegionInternal*>(m_parentRegion.ptr());
+ RegionInternal* ri = dynamic_cast<RegionInternal*>(m_parentRegion.get());
if (ri != NULL) {
ri->updateAccessAndModifiedTime(modified);
}
@@ -164,17 +164,18 @@ void LocalRegion::tombstoneOperationNoThrow(
if (!cachingEnabled) return;
- if (tombstoneVersions.ptr() != NULL) {
+ if (tombstoneVersions.get() != NULL) {
std::map<uint16_t, int64_t> gcVersions;
for (HashMapT<CacheableKeyPtr, CacheablePtr>::Iterator itr =
tombstoneVersions->begin();
itr != tombstoneVersions->end(); ++itr) {
try {
- DSMemberForVersionStampPtr member =
- dynCast<DSMemberForVersionStampPtr>(itr.first());
+ auto member =
+ std::dynamic_pointer_cast<DSMemberForVersionStamp>(itr.first());
uint16_t memberId =
getCacheImpl()->getMemberListForVersionStamp()->add(member);
- int64_t version = (dynCast<CacheableInt64Ptr>(itr.second()))->value();
+ int64_t version =
+ (std::dynamic_pointer_cast<CacheableInt64>(itr.second()))->value();
gcVersions[memberId] = version;
} catch (const ClassCastException&) {
LOGERROR(
@@ -240,9 +241,11 @@ RegionPtr LocalRegion::createSubregion(
"LocalRegion::createSubregion: named region exists in the region");
}
- CacheStatisticsPtr csptr(new CacheStatistics);
- RegionInternal* rPtr = m_cacheImpl->createRegion_internal(
- subregionName, this, aRegionAttributes, csptr, false);
+ auto csptr = std::make_shared<CacheStatistics>();
+ RegionInternalPtr rPtr = m_cacheImpl->createRegion_internal(
+ subregionName,
+ std::static_pointer_cast<RegionInternal>(shared_from_this()),
+ aRegionAttributes, csptr, false);
region_ptr = rPtr;
if (!rPtr) {
throw OutOfMemoryException("createSubregion: failed to create region");
@@ -251,7 +254,7 @@ RegionPtr LocalRegion::createSubregion(
// Instantiate a PersistenceManager object if DiskPolicy is overflow
if (aRegionAttributes->getDiskPolicy() == DiskPolicyType::OVERFLOWS) {
PersistenceManagerPtr pmPtr = aRegionAttributes->getPersistenceManager();
- if (pmPtr == NULLPTR) {
+ if (pmPtr == nullptr) {
throw NullPointerException(
"PersistenceManager could not be instantiated");
}
@@ -285,14 +288,14 @@ RegionEntryPtr LocalRegion::getEntry(const CacheableKeyPtr& key) {
RegionEntryPtr rptr;
CacheablePtr valuePtr;
getEntry(key, valuePtr);
- if (valuePtr != NULLPTR) {
+ if (valuePtr != nullptr) {
rptr = createRegionEntry(key, valuePtr);
}
return rptr;
}
void LocalRegion::getEntry(const CacheableKeyPtr& key, CacheablePtr& valuePtr) {
- if (key == NULLPTR) {
+ if (key == nullptr) {
throw IllegalArgumentException("LocalRegion::getEntry: null key");
}
@@ -329,7 +332,7 @@ void LocalRegion::put(const CacheableKeyPtr& key, const CacheablePtr& value,
Utils::updateStatOpTime(m_regionStats->getStat(),
RegionStatType::getInstance()->getPutTimeId(),
sampleStartNanos);
- // handleReplay(err, NULLPTR);
+ // handleReplay(err, nullptr);
GfErrTypeToException("Region::put", err);
}
@@ -355,7 +358,7 @@ void LocalRegion::putAll(const HashMapOfCacheable& map, uint32_t timeout,
Utils::updateStatOpTime(m_regionStats->getStat(),
RegionStatType::getInstance()->getPutAllTimeId(),
sampleStartNanos);
- // handleReplay(err, NULLPTR);
+ // handleReplay(err, nullptr);
GfErrTypeToException("Region::putAll", err);
}
@@ -377,7 +380,7 @@ void LocalRegion::create(const CacheableKeyPtr& key, const CacheablePtr& value,
VersionTagPtr versionTag;
GfErrType err = createNoThrow(key, value, aCallbackArgument, -1,
CacheEventFlags::NORMAL, versionTag);
- // handleReplay(err, NULLPTR);
+ // handleReplay(err, nullptr);
GfErrTypeToException("Region::create", err);
}
@@ -395,7 +398,7 @@ void LocalRegion::invalidate(const CacheableKeyPtr& key,
VersionTagPtr versionTag;
GfErrType err = invalidateNoThrow(key, aCallbackArgument, -1,
CacheEventFlags::NORMAL, versionTag);
- // handleReplay(err, NULLPTR);
+ // handleReplay(err, nullptr);
GfErrTypeToException("Region::invalidate", err);
}
@@ -413,7 +416,7 @@ void LocalRegion::destroy(const CacheableKeyPtr& key,
GfErrType err = destroyNoThrow(key, aCallbackArgument, -1,
CacheEventFlags::NORMAL, versionTag);
- // handleReplay(err, NULLPTR);
+ // handleReplay(err, nullptr);
GfErrTypeToException("Region::destroy", err);
}
@@ -532,7 +535,7 @@ void LocalRegion::getAll(const VectorOfCacheableKey& keys,
throw IllegalArgumentException("Region::getAll: zero keys provided");
}
// check for the combination which will result in no action
- if (values == NULLPTR &&
+ if (values == nullptr &&
!(addToLocalCache && m_regionAttributes->getCachingEnabled())) {
throw IllegalArgumentException(
"Region::getAll: either output \"values\""
@@ -547,7 +550,7 @@ void LocalRegion::getAll(const VectorOfCacheableKey& keys,
Utils::updateStatOpTime(m_regionStats->getStat(),
RegionStatType::getInstance()->getGetAllTimeId(),
sampleStartNanos);
- // handleReplay(err, NULLPTR);
+ // handleReplay(err, nullptr);
GfErrTypeToException("Region::getAll", err);
}
uint32_t LocalRegion::size_remote() {
@@ -572,10 +575,10 @@ uint32_t LocalRegion::size() {
RegionServicePtr LocalRegion::getRegionService() const {
CHECK_DESTROY_PENDING(TryReadGuard, LocalRegion::getRegionService);
- return RegionServicePtr(m_cacheImpl->getCache());
+ return m_cacheImpl->getCache()->shared_from_this();
}
-CacheImpl* LocalRegion::getCacheImpl() {
+CacheImpl* LocalRegion::getCacheImpl() const {
CHECK_DESTROY_PENDING(TryReadGuard, LocalRegion::getCache);
return m_cacheImpl;
}
@@ -589,14 +592,14 @@ bool LocalRegion::containsValueForKey_remote(
CacheablePtr valuePtr;
MapEntryImplPtr mePtr;
m_entries->getEntry(keyPtr, mePtr, valuePtr);
- if (mePtr == NULLPTR) {
+ if (mePtr == nullptr) {
return false;
}
- return (valuePtr != NULLPTR && !CacheableToken::isInvalid(valuePtr));
+ return (valuePtr != nullptr && !CacheableToken::isInvalid(valuePtr));
}
bool LocalRegion::containsValueForKey(const CacheableKeyPtr& keyPtr) const {
- if (keyPtr == NULLPTR) {
+ if (keyPtr == nullptr) {
throw IllegalArgumentException(
"LocalRegion::containsValueForKey: "
"key is null");
@@ -624,7 +627,7 @@ void LocalRegion::getInterestListRegex(VectorOfCacheableString& vregex) const {
}
bool LocalRegion::containsKey(const CacheableKeyPtr& keyPtr) const {
- if (keyPtr == NULLPTR) {
+ if (keyPtr == nullptr) {
throw IllegalArgumentException(
"LocalRegion::containsKey: "
"key is null");
@@ -644,7 +647,8 @@ void LocalRegion::setPersistenceManager(PersistenceManagerPtr& pmPtr) {
void LocalRegion::setRegionExpiryTask() {
if (regionExpiryEnabled()) {
- RegionInternalPtr rptr(this);
+ RegionInternalPtr rptr =
+ std::static_pointer_cast<RegionInternal>(shared_from_this());
uint32_t duration = getRegionExpiryDuration();
RegionExpiryHandler* handler =
new RegionExpiryHandler(rptr, getRegionExpiryAction(), duration);
@@ -663,7 +667,8 @@ void LocalRegion::registerEntryExpiryTask(MapEntryImplPtr& entry) {
// the entry will register the expiry task for that entry
ExpEntryProperties& expProps = entry->getExpProperties();
expProps.initStartTime();
- RegionInternalPtr rptr(this);
+ RegionInternalPtr rptr =
+ std::static_pointer_cast<RegionInternal>(shared_from_this());
uint32_t duration = getEntryExpiryDuration();
EntryExpiryHandler* handler =
new EntryExpiryHandler(rptr, entry, getEntryExpirationAction(), duration);
@@ -686,9 +691,9 @@ LocalRegion::~LocalRegion() {
if (!m_destroyPending) {
release(false);
}
- m_listener = NULLPTR;
- m_writer = NULLPTR;
- m_loader = NULLPTR;
+ m_listener = nullptr;
+ m_writer = nullptr;
+ m_loader = nullptr;
GF_SAFE_DELETE(m_entries);
GF_SAFE_DELETE(m_regionStats);
@@ -709,11 +714,11 @@ void LocalRegion::release(bool invokeCallbacks) {
}
if (invokeCallbacks) {
try {
- if (m_loader != NULLPTR) {
- m_loader->close(RegionPtr(this));
+ if (m_loader != nullptr) {
+ m_loader->close(shared_from_this());
}
- if (m_writer != NULLPTR) {
- m_writer->close(RegionPtr(this));
+ if (m_writer != nullptr) {
+ m_writer->close(shared_from_this());
}
// TODO: shouldn't listener also be here instead of
// during CacheImpl.close()
@@ -724,9 +729,9 @@ void LocalRegion::release(bool invokeCallbacks) {
}
}
- if (m_persistenceManager != NULLPTR) {
+ if (m_persistenceManager != nullptr) {
m_persistenceManager->close();
- m_persistenceManager = NULLPTR;
+ m_persistenceManager = nullptr;
}
if (m_entries != NULL && m_regionAttributes->getCachingEnabled()) {
m_entries->close();
@@ -745,7 +750,7 @@ void LocalRegion::release(bool invokeCallbacks) {
*@throw NotConnectedException, if not connected to geode system.
*/
bool LocalRegion::containsKey_internal(const CacheableKeyPtr& keyPtr) const {
- if (keyPtr == NULLPTR) {
+ if (keyPtr == nullptr) {
throw IllegalArgumentException("Region::containsKey: key is null");
}
if (!m_regionAttributes->getCachingEnabled()) {
@@ -774,7 +779,7 @@ void LocalRegion::subregions_internal(const bool recursive,
if (recursive == true) {
// decend...
for (int32_t i = 0; i < subRegions.size(); i++) {
- dynamic_cast<LocalRegion*>(subRegions.at(i).ptr())
+ dynamic_cast<LocalRegion*>(subRegions.at(i).get())
->subregions_internal(true, sr);
}
}
@@ -785,7 +790,7 @@ GfErrType LocalRegion::getNoThrow(const CacheableKeyPtr& keyPtr,
const UserDataPtr& aCallbackArgument) {
CHECK_DESTROY_PENDING_NOTHROW(TryReadGuard);
GfErrType err = GF_NOERR;
- if (keyPtr == NULLPTR) {
+ if (keyPtr == nullptr) {
return GF_CACHE_ILLEGAL_ARGUMENT_EXCEPTION;
}
TXState* txState = getTXState();
@@ -800,7 +805,7 @@ GfErrType LocalRegion::getNoThrow(const CacheableKeyPtr& keyPtr,
}
if (CacheableToken::isInvalid(value) ||
CacheableToken::isTombstone(value)) {
- value = NULLPTR;
+ value = nullptr;
}
return err;
}
@@ -816,10 +821,10 @@ GfErrType LocalRegion::getNoThrow(const CacheableKeyPtr& keyPtr,
bool isLoaderInvoked = false;
bool isLocal = false;
bool cachingEnabled = m_regionAttributes->getCachingEnabled();
- CacheablePtr localValue = NULLPTR;
+ CacheablePtr localValue = nullptr;
if (cachingEnabled) {
isLocal = m_entries->get(keyPtr, value, me);
- if (isLocal && (value != NULLPTR && !CacheableToken::isInvalid(value))) {
+ if (isLocal && (value != nullptr && !CacheableToken::isInvalid(value))) {
m_regionStats->incHits();
m_cacheImpl->m_cacheStats->incHits();
updateAccessAndModifiedTimeForEntry(me, false);
@@ -827,7 +832,7 @@ GfErrType LocalRegion::getNoThrow(const CacheableKeyPtr& keyPtr,
return err; // found it in local cache...
}
localValue = value;
- value = NULLPTR;
+ value = nullptr;
// start tracking the entry
if (!m_regionAttributes->getConcurrencyChecksEnabled()) {
updateCount =
@@ -871,14 +876,14 @@ GfErrType LocalRegion::getNoThrow(const CacheableKeyPtr& keyPtr,
// Its a cache missor it is invalid token then Check if we have a local
// loader.
- if ((value == NULLPTR || CacheableToken::isInvalid(value) ||
+ if ((value == nullptr || CacheableToken::isInvalid(value) ||
CacheableToken::isTombstone(value)) &&
- m_loader != NULLPTR) {
+ m_loader != nullptr) {
try {
isLoaderInvoked = true;
/*Update the statistics*/
int64_t sampleStartNanos = Utils::startStatOpTime();
- value = m_loader->load(RegionPtr(this), keyPtr, aCallbackArgument);
+ value = m_loader->load(shared_from_this(), keyPtr, aCallbackArgument);
Utils::updateStatOpTime(
m_regionStats->getStat(),
RegionStatType::getInstance()->getLoaderCallTimeId(),
@@ -899,10 +904,10 @@ GfErrType LocalRegion::getNoThrow(const CacheableKeyPtr& keyPtr,
CacheablePtr oldValue;
// Found it somehow, so store it.
- if (value != NULLPTR /*&& value != CacheableToken::invalid( )*/ &&
+ if (value != nullptr /*&& value != CacheableToken::invalid( )*/ &&
cachingEnabled &&
!(CacheableToken::isTombstone(value) &&
- (localValue == NULLPTR || CacheableToken::isInvalid(localValue)))) {
+ (localValue == nullptr || CacheableToken::isInvalid(localValue)))) {
// try to create the entry and if that returns an existing value
// (e.g. from another thread or notification) then return that
LOGDEBUG(
@@ -919,7 +924,7 @@ GfErrType LocalRegion::getNoThrow(const CacheableKeyPtr& keyPtr,
Utils::getCacheableKeyString(keyPtr)->asChar());
if (CacheableToken::isInvalid(value) ||
CacheableToken::isTombstone(value)) {
- value = NULLPTR;
+ value = nullptr;
}
// don't do anything and exit
return GF_NOERR;
@@ -928,7 +933,7 @@ GfErrType LocalRegion::getNoThrow(const CacheableKeyPtr& keyPtr,
LOGDEBUG("Region::get: putLocal for key [%s] failed with error %d",
Utils::getCacheableKeyString(keyPtr)->asChar(), err);
err = GF_NOERR;
- if (oldValue != NULLPTR && !CacheableToken::isInvalid(oldValue)) {
+ if (oldValue != nullptr && !CacheableToken::isInvalid(oldValue)) {
LOGDEBUG("Region::get: returning updated value [%s] for key [%s]",
Utils::getCacheableString(oldValue)->asChar(),
Utils::getCacheableKeyString(keyPtr)->asChar());
@@ -940,14 +945,14 @@ GfErrType LocalRegion::getNoThrow(const CacheableKeyPtr& keyPtr,
}
if (CacheableToken::isInvalid(value) || CacheableToken::isTombstone(value)) {
- value = NULLPTR;
+ value = nullptr;
}
// invokeCacheListenerForEntryEvent method has the check that if oldValue
// is a CacheableToken then it sets it to NULL; also determines if it
// should be AFTER_UPDATE or AFTER_CREATE depending on oldValue, so don't
// check here.
- if (isLoaderInvoked == false && err == GF_NOERR && value != NULLPTR) {
+ if (isLoaderInvoked == false && err == GF_NOERR && value != nullptr) {
err = invokeCacheListenerForEntryEvent(
keyPtr, oldValue, value, aCallbackArgument, CacheEventFlags::NORMAL,
AFTER_UPDATE, isLocal);
@@ -972,17 +977,17 @@ GfErrType LocalRegion::getAllNoThrow(const VectorOfCacheableKey& keys,
}
// if(!txState->isReplay())
// {
- // VectorOfCacheablePtr args(new VectorOfCacheable());
+ // auto args = std::make_shared<VectorOfCacheable>();
// args->push_back(VectorOfCacheableKeyPtr(new
// VectorOfCacheableKey(keys)));
// args->push_back(values);
// args->push_back(exceptions);
// args->push_back(CacheableBoolean::create(addToLocalCache));
// txState->recordTXOperation(GF_GET_ALL, getFullPath(),
- // NULLPTR,
+ // nullptr,
// args);
// }
- err = getAllNoThrow_remote(&keys, values, exceptions, NULLPTR, false,
+ err = getAllNoThrow_remote(&keys, values, exceptions, nullptr, false,
aCallbackArgument);
if (err == GF_NOERR) {
txState->setDirty();
@@ -999,11 +1004,11 @@ GfErrType LocalRegion::getAllNoThrow(const VectorOfCacheableKey& keys,
for (int32_t index = 0; index < keys.size(); ++index) {
const CacheableKeyPtr& key = keys[index];
MapEntryImplPtr me;
- value = NULLPTR;
+ value = nullptr;
m_regionStats->incGets();
m_cacheImpl->m_cacheStats->incGets();
- if (values != NULLPTR && cachingEnabled) {
- if (m_entries->get(key, value, me) && value != NULLPTR &&
+ if (values != nullptr && cachingEnabled) {
+ if (m_entries->get(key, value, me) && value != nullptr &&
!CacheableToken::isInvalid(value)) {
m_regionStats->incHits();
m_cacheImpl->m_cacheStats->incHits();
@@ -1011,10 +1016,10 @@ GfErrType LocalRegion::getAllNoThrow(const VectorOfCacheableKey& keys,
regionAccessed = true;
values->insert(key, value);
} else {
- value = NULLPTR;
+ value = nullptr;
}
}
- if (value == NULLPTR) {
+ if (value == nullptr) {
// Add to missed keys list.
serverKeys.push_back(key);
@@ -1027,7 +1032,7 @@ GfErrType LocalRegion::getAllNoThrow(const VectorOfCacheableKey& keys,
updateAccessAndModifiedTime(false);
}
if (serverKeys.size() > 0) {
- err = getAllNoThrow_remote(&serverKeys, values, exceptions, NULLPTR,
+ err = getAllNoThrow_remote(&serverKeys, values, exceptions, nullptr,
addToLocalCache, aCallbackArgument);
}
m_regionStats->incGetAll();
@@ -1055,7 +1060,7 @@ class PutActions {
inline static GfErrType checkArgs(const CacheableKeyPtr& key,
const CacheablePtr& value,
DataInput* delta = NULL) {
- if (key == NULLPTR || (value == NULLPTR && delta == NULL)) {
+ if (key == nullptr || (value == nullptr && delta == NULL)) {
return GF_CACHE_ILLEGAL_ARGUMENT_EXCEPTION;
}
return GF_NOERR;
@@ -1072,7 +1077,7 @@ class PutActions {
inline static void logCacheWriterFailure(const CacheableKeyPtr& key,
const CacheablePtr& oldValue) {
- bool isUpdate = (oldValue != NULLPTR);
+ bool isUpdate = (oldValue != nullptr);
LOGFINER("Cache writer vetoed %s for key %s",
(isUpdate ? "update" : "create"),
Utils::getCacheableKeyString(key)->asChar());
@@ -1084,7 +1089,7 @@ class PutActions {
VersionTagPtr& versionTag) {
// if(m_txState != NULL && !m_txState->isReplay())
// {
- // VectorOfCacheablePtr args(new VectorOfCacheable());
+ // auto args = std::make_shared<VectorOfCacheable>();
// args->push_back(value);
// args->push_back(aCallbackArgument);
// m_txState->recordTXOperation(GF_PUT,
@@ -1101,7 +1106,7 @@ class PutActions {
const CacheEventFlags eventFlags,
int updateCount, VersionTagPtr versionTag,
DataInput* delta = NULL,
- EventIdPtr eventId = NULLPTR,
+ EventIdPtr eventId = nullptr,
bool afterRemote = false) {
return m_region.putLocal(name(), false, key, value, oldValue,
cachingEnabled, updateCount, 0, versionTag, delta,
@@ -1121,7 +1126,7 @@ class PutActionsTx : public PutActions {
inline static GfErrType checkArgs(const CacheableKeyPtr& key,
const CacheablePtr& value,
DataInput* delta = NULL) {
- if (key == NULLPTR) {
+ if (key == nullptr) {
return GF_CACHE_ILLEGAL_ARGUMENT_EXCEPTION;
}
return GF_NOERR;
@@ -1146,7 +1151,7 @@ class CreateActions {
inline static GfErrType checkArgs(const CacheableKeyPtr& key,
const CacheablePtr& value,
DataInput* delta) {
- if (key == NULLPTR) {
+ if (key == nullptr) {
return GF_CACHE_ILLEGAL_ARGUMENT_EXCEPTION;
}
return GF_NOERR;
@@ -1170,7 +1175,7 @@ class CreateActions {
// propagate the create to remote server, if any
// if(m_txState != NULL && !m_txState->isReplay())
// {
- // VectorOfCacheablePtr args(new VectorOfCacheable());
+ // auto args = std::make_shared<VectorOfCacheable>();
// args->push_back(value);
// args->push_back(aCallbackArgument);
// m_txState->recordTXOperation(GF_CREATE,
@@ -1186,7 +1191,7 @@ class CreateActions {
const CacheEventFlags eventFlags,
int updateCount, VersionTagPtr versionTag,
DataInput* delta = NULL,
- EventIdPtr eventId = NULLPTR,
+ EventIdPtr eventId = nullptr,
bool afterRemote = false) {
return m_region.putLocal(name(), true, key, value, oldValue, cachingEnabled,
updateCount, 0, versionTag);
@@ -1214,7 +1219,7 @@ class DestroyActions {
inline static GfErrType checkArgs(const CacheableKeyPtr& key,
const CacheablePtr& value,
DataInput* delta) {
- if (key == NULLPTR) {
+ if (key == nullptr) {
return GF_CACHE_ILLEGAL_ARGUMENT_EXCEPTION;
}
return GF_NOERR;
@@ -1242,7 +1247,7 @@ class DestroyActions {
// propagate the destroy to remote server, if any
// if(m_txState != NULL && !m_txState->isReplay())
// {
- // VectorOfCacheablePtr args(new VectorOfCacheable());
+ // auto args = std::make_shared<VectorOfCacheable>();
// args->push_back(aCallbackArgument);
// m_txState->recordTXOperation(GF_DESTROY,
// m_region.getFullPath(), key, args);
@@ -1257,7 +1262,7 @@ class DestroyActions {
const CacheEventFlags eventFlags,
int updateCount, VersionTagPtr versionTag,
DataInput* delta = NULL,
- EventIdPtr eventId = NULLPTR,
+ EventIdPtr eventId = nullptr,
bool afterRemote = false) {
if (cachingEnabled) {
MapEntryImplPtr entry;
@@ -1281,14 +1286,14 @@ class DestroyActions {
}
return err;
}
- if (oldValue != NULLPTR) {
+ if (oldValue != nullptr) {
LOGDEBUG(
"Region::destroy: region [%s] destroyed key [%s] having "
"value [%s]",
m_region.getFullPath(), Utils::getCacheableKeyString(key)->asChar(),
Utils::getCacheableString(oldValue)->asChar());
// any cleanup required for the entry (e.g. removing from LRU list)
- if (entry != NULLPTR) {
+ if (entry != nullptr) {
entry->cleanup(eventFlags);
}
// entry/region expiration
@@ -1331,7 +1336,7 @@ class RemoveActions {
inline static GfErrType checkArgs(const CacheableKeyPtr& key,
const CacheablePtr& value,
DataInput* delta) {
- if (key == NULLPTR) {
+ if (key == nullptr) {
return GF_CACHE_ILLEGAL_ARGUMENT_EXCEPTION;
}
return GF_NOERR;
@@ -1364,7 +1369,7 @@ class RemoveActions {
DataOutput out1;
DataOutput out2;
- if (valuePtr != NULLPTR && value != NULLPTR) {
+ if (valuePtr != nullptr && value != nullptr) {
if (valuePtr->classId() != value->classId() ||
valuePtr->typeId() != value->typeId()) {
err = GF_ENOENT;
@@ -1381,7 +1386,7 @@ class RemoveActions {
err = GF_ENOENT;
return err;
}
- } else if ((valuePtr == NULLPTR || CacheableToken::isInvalid(valuePtr))) {
+ } else if ((valuePtr == nullptr || CacheableToken::isInvalid(valuePtr))) {
// if(m_txState != NULL && !m_txState->isReplay())
// {
// VectorOfCacheablePtr args(new
@@ -1396,14 +1401,14 @@ class RemoveActions {
key, value, aCallbackArgument, versionTag);
return m_ServerResponse;
- } else if (valuePtr != NULLPTR && value == NULLPTR) {
+ } else if (valuePtr != nullptr && value == nullptr) {
err = GF_ENOENT;
return err;
}
}
// if(m_txState != NULL && !m_txState->isReplay())
// {
- // VectorOfCacheablePtr args(new VectorOfCacheable());
+ // auto args = std::make_shared<VectorOfCacheable>();
// args->push_back(value);
// args->push_back(aCallbackArgument);
// m_txState->recordTXOperation(GF_REMOVE,
@@ -1426,7 +1431,7 @@ class RemoveActions {
const CacheEventFlags eventFlags,
int updateCount, VersionTagPtr versionTag,
DataInput* delta = NULL,
- EventIdPtr eventId = NULLPTR,
+ EventIdPtr eventId = nullptr,
bool afterRemote = false) {
CacheablePtr valuePtr;
GfErrType err = GF_NOERR;
@@ -1434,7 +1439,7 @@ class RemoveActions {
m_region.getEntry(key, valuePtr);
DataOutput out1;
DataOutput out2;
- if (valuePtr != NULLPTR && value != NULLPTR) {
+ if (valuePtr != nullptr && value != nullptr) {
if (valuePtr->classId() != value->classId() ||
valuePtr->typeId() != value->typeId()) {
err = GF_ENOENT;
@@ -1451,9 +1456,9 @@ class RemoveActions {
err = GF_ENOENT;
return err;
}
- } else if (value == NULLPTR && (!CacheableToken::isInvalid(valuePtr) ||
- valuePtr == NULLPTR)) {
- err = (m_ServerResponse == 0 && valuePtr == NULLPTR) ? GF_NOERR
+ } else if (value == nullptr && (!CacheableToken::isInvalid(valuePtr) ||
+ valuePtr == nullptr)) {
+ err = (m_ServerResponse == 0 && valuePtr == nullptr) ? GF_NOERR
: GF_ENOENT;
if (updateCount >= 0 &&
!m_region.getAttributes()
@@ -1466,7 +1471,7 @@ class RemoveActions {
m_region.m_entries->removeTrackerForEntry(key);
}
return err;
- } else if (valuePtr == NULLPTR && value != NULLPTR &&
+ } else if (valuePtr == nullptr && value != nullptr &&
m_ServerResponse != 0) {
err = GF_ENOENT;
return err;
@@ -1495,14 +1500,14 @@ class RemoveActions {
}
return err;
}
- if (oldValue != NULLPTR) {
+ if (oldValue != nullptr) {
LOGDEBUG(
"Region::remove: region [%s] removed key [%s] having "
"value [%s]",
m_region.getFullPath(), Utils::getCacheableKeyString(key)->asChar(),
Utils::getCacheableString(oldValue)->asChar());
// any cleanup required for the entry (e.g. removing from LRU list)
- if (entry != NULLPTR) {
+ if (entry != nullptr) {
entry->cleanup(eventFlags);
}
// entry/region expiration
@@ -1550,7 +1555,7 @@ class InvalidateActions {
inline static GfErrType checkArgs(const CacheableKeyPtr& key,
const CacheablePtr& value,
DataInput* delta = NULL) {
- if (key == NULLPTR) {
+ if (key == nullptr) {
return GF_CACHE_ILLEGAL_ARGUMENT_EXCEPTION;
}
return GF_NOERR;
@@ -1567,7 +1572,7 @@ class InvalidateActions {
inline static void logCacheWriterFailure(const CacheableKeyPtr& key,
const CacheablePtr& oldValue) {
- bool isUpdate = (oldValue != NULLPTR);
+ bool isUpdate = (oldValue != nullptr);
LOGFINER("Cache writer vetoed %s for key %s",
(isUpdate ? "update" : "invalidate"),
Utils::getCacheableKeyString(key)->asChar());
@@ -1579,7 +1584,7 @@ class InvalidateActions {
VersionTagPtr& versionTag) {
// if(m_txState != NULL && !m_txState->isReplay())
// {
- // VectorOfCacheablePtr args(new VectorOfCacheable());
+ // auto args = std::make_shared<VectorOfCacheable>();
// args->push_back(aCallbackArgument);
// m_txState->recordTXOperation(GF_INVALIDATE,
// m_region.getFullPath(), key, args);
@@ -1595,7 +1600,7 @@ class InvalidateActions {
const CacheEventFlags eventFlags,
int updateCount, VersionTagPtr versionTag,
DataInput* delta = NULL,
- EventIdPtr eventId = NULLPTR,
+ EventIdPtr eventId = nullptr,
bool afterRemote = false) {
return m_region.invalidateLocal(name(), key, value, eventFlags, versionTag);
}
@@ -1645,7 +1650,7 @@ GfErrType LocalRegion::updateNoThrow(const CacheableKeyPtr& key,
// do not invoke the writer in case of notification/eviction
// or expiration
- if (m_writer != NULLPTR && eventFlags.invokeCacheWriter()) {
+ if (m_writer != nullptr && eventFlags.invokeCacheWriter()) {
action.getCallbackOldValue(cachingEnabled, key, entry, oldValue);
// invokeCacheWriterForEntryEvent method has the check that if oldValue
// is a CacheableToken then it sets it to NULL; also determines if it
@@ -1671,7 +1676,7 @@ GfErrType LocalRegion::updateNoThrow(const CacheableKeyPtr& key,
if ((updateCount = m_entries->addTrackerForEntry(
key, oldValue, TAction::s_addIfAbsent, TAction::s_failIfPresent,
true)) < 0) {
- if (oldValue != NULLPTR) {
+ if (oldValue != nullptr) {
// fail for "create" when entry exists
return GF_CACHE_ENTRY_EXISTS;
}
@@ -1715,9 +1720,9 @@ GfErrType LocalRegion::updateNoThrow(const CacheableKeyPtr& key,
CacheablePtr& newValue1 = const_cast<CacheablePtr&>(value);
VersionTagPtr versionTag1;
err = getNoThrow_FullObject(eventId, newValue1, versionTag1);
- if (err == GF_NOERR && newValue1 != NULLPTR) {
+ if (err == GF_NOERR && newValue1 != nullptr) {
err = m_entries->put(key, newValue1, entry, oldValue, updateCount, 0,
- versionTag1 != NULLPTR ? versionTag1 : versionTag);
+ versionTag1 != nullptr ? versionTag1 : versionTag);
if (err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION) {
LOGDEBUG(
"Region::localUpdate: updateNoThrow<%s> for key [%s] failed because the cache already contains \
@@ -1846,7 +1851,7 @@ GfErrType LocalRegion::destroyNoThrow(const CacheableKeyPtr& key,
const CacheEventFlags eventFlags,
VersionTagPtr versionTag) {
CacheablePtr oldValue;
- return updateNoThrow<DestroyActions>(key, NULLPTR, aCallbackArgument,
+ return updateNoThrow<DestroyActions>(key, nullptr, aCallbackArgument,
oldValue, updateCount, eventFlags,
versionTag);
}
@@ -1857,7 +1862,7 @@ GfErrType LocalRegion::destroyNoThrowTX(const CacheableKeyPtr& key,
const CacheEventFlags eventFlags,
VersionTagPtr versionTag) {
CacheablePtr oldValue;
- return updateNoThrowTX<DestroyActions>(key, NULLPTR, aCallbackArgument,
+ return updateNoThrowTX<DestroyActions>(key, nullptr, aCallbackArgument,
oldValue, updateCount, eventFlags,
versionTag);
}
@@ -1879,7 +1884,7 @@ GfErrType LocalRegion::removeNoThrowEx(const CacheableKeyPtr& key,
const CacheEventFlags eventFlags,
VersionTagPtr versionTag) {
CacheablePtr oldValue;
- return updateNoThrow<RemoveActionsEx>(key, NULLPTR, aCallbackArgument,
+ return updateNoThrow<RemoveActionsEx>(key, nullptr, aCallbackArgument,
oldValue, updateCount, eventFlags,
versionTag);
}
@@ -1890,7 +1895,7 @@ GfErrType LocalRegion::invalidateNoThrow(const CacheableKeyPtr& key,
const CacheEventFlags eventFlags,
VersionTagPtr versionTag) {
CacheablePtr oldValue;
- return updateNoThrow<InvalidateActions>(key, NULLPTR, aCallbackArgument,
+ return updateNoThrow<InvalidateActions>(key, nullptr, aCallbackArgument,
oldValue, updateCount, eventFlags,
versionTag);
}
@@ -1901,7 +1906,7 @@ GfErrType LocalRegion::invalidateNoThrowTX(const CacheableKeyPtr& key,
const CacheEventFlags eventFlags,
VersionTagPtr versionTag) {
CacheablePtr oldValue;
- return updateNoThrowTX<InvalidateActions>(key, NULLPTR, aCallbackArgument,
+ return updateNoThrowTX<InvalidateActions>(key, nullptr, aCallbackArgument,
oldValue, updateCount, eventFlags,
versionTag);
}
@@ -1921,10 +1926,10 @@ GfErrType LocalRegion::putAllNoThrow(const HashMapOfCacheable& map,
}
// if(!txState->isReplay())
//{
- // VectorOfCacheablePtr args(new VectorOfCacheable());
+ // auto args = std::make_shared<VectorOfCacheable>();
// args->push_back(HashMapOfCacheablePtr(new HashMapOfCacheable(map)));
// args->push_back(CacheableInt32::create(timeout));
- // txState->recordTXOperation(GF_PUT_ALL, getFullPath(), NULLPTR, args);
+ // txState->recordTXOperation(GF_PUT_ALL, getFullPath(), nullptr, args);
//}
err = putAllNoThrow_remote(map, /*versionTag*/ versionedObjPartListPtr,
timeout, aCallbackArgument);
@@ -1960,7 +1965,7 @@ GfErrType LocalRegion::putAllNoThrow(const HashMapOfCacheable& map,
}
} _removeTracking(oldValueMap, *this);
- if (cachingEnabled || m_writer != NULLPTR) {
+ if (cachingEnabled || m_writer != nullptr) {
CacheablePtr oldValue;
for (HashMapOfCacheable::Iterator iter = map.begin(); iter != map.end();
++iter) {
@@ -1972,7 +1977,7 @@ GfErrType LocalRegion::putAllNoThrow(const HashMapOfCacheable& map,
oldValueMap.insert(
std::make_pair(key, std::make_pair(oldValue, updateCount)));
}
- if (m_writer != NULLPTR) {
+ if (m_writer != nullptr) {
// invokeCacheWriterForEntryEvent method has the check that if oldValue
// is a CacheableToken then it sets it to NULL; also determines if it
// should be BEFORE_UPDATE or BEFORE_CREATE depending on oldValue
@@ -2000,11 +2005,11 @@ GfErrType LocalRegion::putAllNoThrow(const HashMapOfCacheable& map,
for (int keyIndex = 0;
keyIndex < versionedObjPartListPtr->getSucceededKeys()->size();
keyIndex++) {
- const CacheablePtr valPtr =
+ const CacheableKeyPtr valPtr =
versionedObjPartListPtr->getSucceededKeys()->at(keyIndex);
HashMapOfCacheable::Iterator mapIter = map.find(valPtr);
- CacheableKeyPtr key = NULLPTR;
- CacheablePtr value = NULLPTR;
+ CacheableKeyPtr key = nullptr;
+ CacheablePtr value = nullptr;
if (mapIter != map.end()) {
key = mapIter.first();
@@ -2016,8 +2021,8 @@ GfErrType LocalRegion::putAllNoThrow(const HashMapOfCacheable& map,
"usermap");
}
- if (versionedObjPartListPtr != NULLPTR &&
- versionedObjPartListPtr.ptr() != NULL) {
+ if (versionedObjPartListPtr != nullptr &&
+ versionedObjPartListPtr.get() != NULL) {
LOGDEBUG("versionedObjPartListPtr->getVersionedTagptr().size() = %d ",
versionedObjPartListPtr->getVersionedTagptr().size());
if (versionedObjPartListPtr->getVersionedTagptr().size() > 0) {
@@ -2055,8 +2060,8 @@ GfErrType LocalRegion::putAllNoThrow(const HashMapOfCacheable& map,
const CacheablePtr& value = iter.second();
std::pair<CacheablePtr, int>& p = oldValueMap[key];
- if (versionedObjPartListPtr != NULLPTR &&
- versionedObjPartListPtr.ptr() != NULL) {
+ if (versionedObjPartListPtr != nullptr &&
+ versionedObjPartListPtr.get() != NULL) {
LOGDEBUG("versionedObjPartListPtr->getVersionedTagptr().size() = %d ",
versionedObjPartListPtr->getVersionedTagptr().size());
if (versionedObjPartListPtr->getVersionedTagptr().size() > 0) {
@@ -2120,21 +2125,21 @@ GfErrType LocalRegion::removeAllNoThrow(const VectorOfCacheableKey& keys,
if (cachingEnabled) {
VectorOfCacheableKey* keysPtr;
if (m_isPRSingleHopEnabled) {
- keysPtr = versionedObjPartListPtr->getSucceededKeys().ptr();
+ keysPtr = versionedObjPartListPtr->getSucceededKeys().get();
} else {
keysPtr = const_cast<VectorOfCacheableKey*>(&keys);
}
for (int keyIndex = 0; keyIndex < keysPtr->size(); keyIndex++) {
CacheableKeyPtr key = keysPtr->at(keyIndex);
- if (versionedObjPartListPtr != NULLPTR &&
- versionedObjPartListPtr.ptr() != NULL) {
+ if (versionedObjPartListPtr != nullptr &&
+ versionedObjPartListPtr.get() != NULL) {
LOGDEBUG("versionedObjPartListPtr->getVersionedTagptr().size() = %d ",
versionedObjPartListPtr->getVersionedTagptr().size());
if (versionedObjPartListPtr->getVersionedTagptr().size() > 0) {
versionTag = versionedObjPartListPtr->getVersionedTagptr()[keyIndex];
}
- if (versionTag == NULLPTR) {
+ if (versionTag == nullptr) {
LOGDEBUG(
"RemoveAll hits EntryNotFoundException at server side for key "
"[%s], not to destroy it from local cache.",
@@ -2208,7 +2213,7 @@ GfErrType LocalRegion::invalidateLocal(const char* name,
const CacheablePtr& value,
const CacheEventFlags eventFlags,
VersionTagPtr versionTag) {
- if (keyPtr == NULLPTR) {
+ if (keyPtr == nullptr) {
return GF_CACHE_ILLEGAL_ARGUMENT_EXCEPTION;
}
CHECK_DESTROY_PENDING_NOTHROW(TryReadGuard);
@@ -2306,7 +2311,7 @@ GfErrType LocalRegion::invalidateRegionNoThrow(
for (MapOfRegionWithLock::iterator p = m_subRegions.begin();
p != m_subRegions.end(); ++p) {
RegionInternal* subRegion =
- dynamic_cast<RegionInternal*>((*p).int_id_.ptr());
+ dynamic_cast<RegionInternal*>((*p).int_id_.get());
if (subRegion != NULL) {
err = subRegion->invalidateRegionNoThrow(aCallbackArgument, eventFlags);
if (err != GF_NOERR) {
@@ -2385,7 +2390,7 @@ GfErrType LocalRegion::destroyRegionNoThrow(
// TODO: remove unnecessary dynamic_cast by having m_subRegions hold
// RegionInternal and invoke the destroy method in that
RegionInternal* subRegion =
- dynamic_cast<RegionInternal*>((*p).int_id_.ptr());
+ dynamic_cast<RegionInternal*>((*p).int_id_.get());
if (subRegion != NULL) {
// for subregions never remove from parent since that will cause
// the region to be destroyed and SEGV; unbind_all takes care of that
@@ -2423,10 +2428,10 @@ GfErrType LocalRegion::destroyRegionNoThrow(
GF_D_ASSERT(m_destroyPending);
if (removeFromParent) {
- if (m_parentRegion == NULLPTR) {
+ if (m_parentRegion == nullptr) {
m_cacheImpl->removeRegion(m_name.c_str());
} else {
- LocalRegion* parent = dynamic_cast<LocalRegion*>(m_parentRegion.ptr());
+ LocalRegion* parent = dynamic_cast<LocalRegion*>(m_parentRegion.get());
if (parent != NULL) {
parent->removeRegion(m_name);
if (!eventFlags.isEvictOrExpire()) {
@@ -2464,10 +2469,10 @@ GfErrType LocalRegion::putLocal(const char* name, bool isCreate,
CacheablePtr& newValue1 = const_cast<CacheablePtr&>(value);
VersionTagPtr versionTag1;
err = getNoThrow_FullObject(eventId, newValue1, versionTag1);
- if (err == GF_NOERR && newValue1 != NULLPTR) {
+ if (err == GF_NOERR && newValue1 != nullptr) {
err = m_entries->put(
key, newValue1, entry, oldValue, updateCount, destroyTracker,
- versionTag1 != NULLPTR ? versionTag1 : versionTag, isUpdate);
+ versionTag1 != nullptr ? versionTag1 : versionTag, isUpdate);
}
}
if (delta != NULL &&
@@ -2527,7 +2532,7 @@ void LocalRegion::entries_internal(VectorOfRegionEntry& me,
MapOfRegionGuard guard(m_subRegions.mutex());
for (MapOfRegionWithLock::iterator p = m_subRegions.begin();
p != m_subRegions.end(); ++p) {
- dynamic_cast<LocalRegion*>((*p).int_id_.ptr())
+ dynamic_cast<LocalRegion*>((*p).int_id_.get())
->entries_internal(me, true);
}
}
@@ -2546,11 +2551,11 @@ bool LocalRegion::invokeCacheWriterForEntryEvent(
CacheEventFlags eventFlags, EntryEventType type) {
// Check if we have a local cache writer. If so, invoke and return.
bool bCacheWriterReturn = true;
- if (m_writer != NULLPTR) {
- if (oldValue != NULLPTR && CacheableToken::isInvalid(oldValue)) {
- oldValue = NULLPTR;
+ if (m_writer != nullptr) {
+ if (oldValue != nullptr && CacheableToken::isInvalid(oldValue)) {
+ oldValue = nullptr;
}
- EntryEvent event(RegionPtr(this), key, oldValue, newValue,
+ EntryEvent event(shared_from_this(), key, oldValue, newValue,
aCallbackArgument, eventFlags.isNotification());
const char* eventStr = "unknown";
try {
@@ -2559,7 +2564,7 @@ bool LocalRegion::invokeCacheWriterForEntryEvent(
int64_t sampleStartNanos = Utils::startStatOpTime();
switch (type) {
case BEFORE_UPDATE: {
- if (oldValue != NULLPTR) {
+ if (oldValue != nullptr) {
eventStr = "beforeUpdate";
bCacheWriterReturn = m_writer->beforeUpdate(event);
break;
@@ -2607,8 +2612,8 @@ bool LocalRegion::invokeCacheWriterForRegionEvent(
RegionEventType type) {
// Check if we have a local cache writer. If so, invoke and return.
bool bCacheWriterReturn = true;
- if (m_writer != NULLPTR) {
- RegionEvent event(RegionPtr(this), aCallbackArgument,
+ if (m_writer != nullptr) {
+ RegionEvent event(shared_from_this(), aCallbackArgument,
eventFlags.isNotification());
const char* eventStr = "unknown";
try {
@@ -2657,11 +2662,11 @@ GfErrType LocalRegion::invokeCacheListenerForEntryEvent(
GfErrType err = GF_NOERR;
// Check if we have a local cache listener. If so, invoke and return.
- if (m_listener != NULLPTR) {
- if (oldValue != NULLPTR && CacheableToken::isInvalid(oldValue)) {
- oldValue = NULLPTR;
+ if (m_listener != nullptr) {
+ if (oldValue != nullptr && CacheableToken::isInvalid(oldValue)) {
+ oldValue = nullptr;
}
- EntryEvent event(RegionPtr(this), key, oldValue, newValue,
+ EntryEvent event(shared_from_this(), key, oldValue, newValue,
aCallbackArgument, eventFlags.isNotification());
const char* eventStr = "unknown";
try {
@@ -2672,7 +2677,7 @@ GfErrType LocalRegion::invokeCacheListenerForEntryEvent(
case AFTER_UPDATE: {
// when CREATE is received from server for notification
// then force an afterUpdate even if key is not present in cache.
- if (oldValue != NULLPTR || eventFlags.isNotificationUpdate() ||
+ if (oldValue != nullptr || eventFlags.isNotificationUpdate() ||
isLocal) {
eventStr = "afterUpdate";
m_listener->afterUpdate(event);
@@ -2728,8 +2733,8 @@ GfErrType LocalRegion::invokeCacheListenerForRegionEvent(
GfErrType err = GF_NOERR;
// Check if we have a local cache listener. If so, invoke and return.
- if (m_listener != NULLPTR) {
- RegionEvent event(RegionPtr(this), aCallbackArgument,
+ if (m_listener != nullptr) {
+ RegionEvent event(shared_from_this(), aCallbackArgument,
eventFlags.isNotification());
const char* eventStr = "unknown";
try {
@@ -2743,7 +2748,7 @@ GfErrType LocalRegion::invokeCacheListenerForRegionEvent(
m_cacheImpl->m_cacheStats->incListenerCalls();
if (eventFlags.isCacheClose()) {
eventStr = "close";
- m_listener->close(RegionPtr(this));
+ m_listener->close(shared_from_this());
m_cacheImpl->m_cacheStats->incListenerCalls();
}
break;
@@ -2788,7 +2793,7 @@ GfErrType LocalRegion::invokeCacheListenerForRegionEvent(
void LocalRegion::updateAccessAndModifiedTimeForEntry(MapEntryImplPtr& ptr,
bool modified) {
// locking is not required since setters use atomic operations
- if (ptr != NULLPTR && entryExpiryEnabled()) {
+ if (ptr != nullptr && entryExpiryEnabled()) {
ExpEntryProperties& expProps = ptr->getExpProperties();
uint32_t currTime = static_cast<uint32_t>(ACE_OS::gettimeofday().sec());
CacheableStringPtr keyStr;
@@ -3116,10 +3121,10 @@ void LocalRegion::evict(int32_t percentage) {
}
}
void LocalRegion::invokeAfterAllEndPointDisconnected() {
- if (m_listener != NULLPTR) {
+ if (m_listener != nullptr) {
int64_t sampleStartNanos = Utils::startStatOpTime();
try {
- m_listener->afterRegionDisconnected(RegionPtr(this));
+ m_listener->afterRegionDisconnected(shared_from_this());
} catch (const Exception& ex) {
LOGERROR("Exception in CacheListener::afterRegionDisconnected: %s: %s",
ex.getName(), ex.getMessage());
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/LocalRegion.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/LocalRegion.hpp b/src/cppcache/src/LocalRegion.hpp
index 0d0fa58..c3c6b05 100644
--- a/src/cppcache/src/LocalRegion.hpp
+++ b/src/cppcache/src/LocalRegion.hpp
@@ -119,6 +119,8 @@ typedef std::unordered_map<CacheableKeyPtr, std::pair<CacheablePtr, int> >
* is used to concatenate all the region names together from the root, starting
* with the root's subregions.
*/
+typedef SharedPtr<LocalRegion> LocalRegionPtr;
+
class CPPCACHE_EXPORT LocalRegion : public RegionInternal {
/**
* @brief Public Methods for Region
@@ -127,7 +129,8 @@ class CPPCACHE_EXPORT LocalRegion : public RegionInternal {
/**
* @brief constructor/destructor
*/
- LocalRegion(const std::string& name, CacheImpl* cache, RegionInternal* rPtr,
+ LocalRegion(const std::string& name, CacheImpl* cache,
+ const RegionInternalPtr& rPtr,
const RegionAttributesPtr& attributes,
const CacheStatisticsPtr& stats, bool shared = false);
virtual ~LocalRegion();
@@ -137,19 +140,21 @@ class CPPCACHE_EXPORT LocalRegion : public RegionInternal {
RegionPtr getParentRegion() const;
RegionAttributesPtr getAttributes() const { return m_regionAttributes; }
AttributesMutatorPtr getAttributesMutator() const {
- return AttributesMutatorPtr(new AttributesMutator(RegionPtr(this)));
+ return std::make_shared<AttributesMutator>(
+ std::const_pointer_cast<LocalRegion>(
+ std::static_pointer_cast<const LocalRegion>(shared_from_this())));
}
void updateAccessAndModifiedTime(bool modified);
CacheStatisticsPtr getStatistics() const;
- virtual void clear(const UserDataPtr& aCallbackArgument = NULLPTR);
- virtual void localClear(const UserDataPtr& aCallbackArgument = NULLPTR);
+ virtual void clear(const UserDataPtr& aCallbackArgument = nullptr);
+ virtual void localClear(const UserDataPtr& aCallbackArgument = nullptr);
GfErrType localClearNoThrow(
- const UserDataPtr& aCallbackArgument = NULLPTR,
+ const UserDataPtr& aCallbackArgument = nullptr,
const CacheEventFlags eventFlags = CacheEventFlags::NORMAL);
- void invalidateRegion(const UserDataPtr& aCallbackArgument = NULLPTR);
- void localInvalidateRegion(const UserDataPtr& aCallbackArgument = NULLPTR);
- void destroyRegion(const UserDataPtr& aCallbackArgument = NULLPTR);
- void localDestroyRegion(const UserDataPtr& aCallbackArgument = NULLPTR);
+ void invalidateRegion(const UserDataPtr& aCallbackArgument = nullptr);
+ void localInvalidateRegion(const UserDataPtr& aCallbackArgument = nullptr);
+ void destroyRegion(const UserDataPtr& aCallbackArgument = nullptr);
+ void localDestroyRegion(const UserDataPtr& aCallbackArgument = nullptr);
RegionPtr getSubregion(const char* path);
RegionPtr createSubregion(const char* subregionName,
const RegionAttributesPtr& aRegionAttributes);
@@ -159,41 +164,41 @@ class CPPCACHE_EXPORT LocalRegion : public RegionInternal {
CacheablePtr get(const CacheableKeyPtr& key,
const UserDataPtr& aCallbackArgument);
void put(const CacheableKeyPtr& key, const CacheablePtr& value,
- const UserDataPtr& aCallbackArgument = NULLPTR);
+ const UserDataPtr& aCallbackArgument = nullptr);
void localPut(const CacheableKeyPtr& key, const CacheablePtr& value,
- const UserDataPtr& aCallbackArgument = NULLPTR);
+ const UserDataPtr& aCallbackArgument = nullptr);
void create(const CacheableKeyPtr& key, const CacheablePtr& value,
- const UserDataPtr& aCallbackArgument = NULLPTR);
+ const UserDataPtr& aCallbackArgument = nullptr);
void localCreate(const CacheableKeyPtr& key, const CacheablePtr& value,
- const UserDataPtr& aCallbackArgument = NULLPTR);
+ const UserDataPtr& aCallbackArgument = nullptr);
void invalidate(const CacheableKeyPtr& key,
- const UserDataPtr& aCallbackArgument = NULLPTR);
+ const UserDataPtr& aCallbackArgument = nullptr);
void localInvalidate(const CacheableKeyPtr& key,
- const UserDataPtr& aCallbackArgument = NULLPTR);
+ const UserDataPtr& aCallbackArgument = nullptr);
void destroy(const CacheableKeyPtr& key,
- const UserDataPtr& aCallbackArgument = NULLPTR);
+ const UserDataPtr& aCallbackArgument = nullptr);
void localDestroy(const CacheableKeyPtr& key,
- const UserDataPtr& aCallbackArgument = NULLPTR);
+ const UserDataPtr& aCallbackArgument = nullptr);
bool remove(const CacheableKeyPtr& key, const CacheablePtr& value,
- const UserDataPtr& aCallbackArgument = NULLPTR);
+ const UserDataPtr& aCallbackArgument = nullptr);
bool removeEx(const CacheableKeyPtr& key,
- const UserDataPtr& aCallbackArgument = NULLPTR);
+ const UserDataPtr& aCallbackArgument = nullptr);
bool localRemove(const CacheableKeyPtr& key, const CacheablePtr& value,
- const UserDataPtr& aCallbackArgument = NULLPTR);
+ const UserDataPtr& aCallbackArgument = nullptr);
bool localRemoveEx(const CacheableKeyPtr& key,
- const UserDataPtr& aCallbackArgument = NULLPTR);
+ const UserDataPtr& aCallbackArgument = nullptr);
void keys(VectorOfCacheableKey& v);
void serverKeys(VectorOfCacheableKey& v);
void values(VectorOfCacheable& vc);
void entries(VectorOfRegionEntry& me, bool recursive);
void getAll(const VectorOfCacheableKey& keys, HashMapOfCacheablePtr values,
HashMapOfExceptionPtr exceptions, bool addToLocalCache,
- const UserDataPtr& aCallbackArgument = NULLPTR);
+ const UserDataPtr& aCallbackArgument = nullptr);
void putAll(const HashMapOfCacheable& map,
uint32_t timeout = DEFAULT_RESPONSE_TIMEOUT,
- const UserDataPtr& aCallbackArgument = NULLPTR);
+ const UserDataPtr& aCallbackArgument = nullptr);
void removeAll(const VectorOfCacheableKey& keys,
- const UserDataPtr& aCallbackArgument = NULLPTR);
+ const UserDataPtr& aCallbackArgument = nullptr);
uint32_t size();
virtual uint32_t size_remote();
RegionServicePtr getRegionService() const;
@@ -215,7 +220,7 @@ class CPPCACHE_EXPORT LocalRegion : public RegionInternal {
virtual GfErrType getAllNoThrow(
const VectorOfCacheableKey& keys, const HashMapOfCacheablePtr& values,
const HashMapOfExceptionPtr& exceptions, bool addToLocalCache,
- const UserDataPtr& aCallbackArgument = NULLPTR);
+ const UserDataPtr& aCallbackArgument = nullptr);
virtual GfErrType putNoThrow(const CacheableKeyPtr& key,
const CacheablePtr& value,
const UserDataPtr& aCallbackArgument,
@@ -223,7 +228,7 @@ class CPPCACHE_EXPORT LocalRegion : public RegionInternal {
const CacheEventFlags eventFlags,
VersionTagPtr versionTag,
DataInput* delta = NULL,
- EventIdPtr eventId = NULLPTR);
+ EventIdPtr eventId = nullptr);
virtual GfErrType putNoThrowTX(const CacheableKeyPtr& key,
const CacheablePtr& value,
const UserDataPtr& aCallbackArgument,
@@ -231,7 +236,7 @@ class CPPCACHE_EXPORT LocalRegion : public RegionInternal {
const CacheEventFlags eventFlags,
VersionTagPtr versionTag,
DataInput* delta = NULL,
- EventIdPtr eventId = NULLPTR);
+ EventIdPtr eventId = nullptr);
virtual GfErrType createNoThrow(const CacheableKeyPtr& key,
const CacheablePtr& value,
const UserDataPtr& aCallbackArgument,
@@ -262,10 +267,10 @@ class CPPCACHE_EXPORT LocalRegion : public RegionInternal {
virtual GfErrType putAllNoThrow(
const HashMapOfCacheable& map,
uint32_t timeout = DEFAULT_RESPONSE_TIMEOUT,
- const UserDataPtr& aCallbackArgument = NULLPTR);
+ const UserDataPtr& aCallbackArgument = nullptr);
virtual GfErrType removeAllNoThrow(
const VectorOfCacheableKey& keys,
- const UserDataPtr& aCallbackArgument = NULLPTR);
+ const UserDataPtr& aCallbackArgument = nullptr);
virtual GfErrType invalidateNoThrow(const CacheableKeyPtr& keyPtr,
const UserDataPtr& aCallbackArgument,
int updateCount,
@@ -292,7 +297,7 @@ class CPPCACHE_EXPORT LocalRegion : public RegionInternal {
const CacheablePtr& valuePtr, CacheablePtr& oldValue,
bool cachingEnabled, int updateCount, int destroyTracker,
VersionTagPtr versionTag, DataInput* delta = NULL,
- EventIdPtr eventId = NULLPTR);
+ EventIdPtr eventId = nullptr);
GfErrType invalidateLocal(const char* name, const CacheableKeyPtr& keyPtr,
const CacheablePtr& value,
const CacheEventFlags eventFlags,
@@ -315,7 +320,7 @@ class CPPCACHE_EXPORT LocalRegion : public RegionInternal {
RegionStats* getRegionStats() { return m_regionStats; }
inline bool cacheEnabled() { return m_regionAttributes->getCachingEnabled(); }
inline bool cachelessWithListener() {
- return !m_regionAttributes->getCachingEnabled() && (m_listener != NULLPTR);
+ return !m_regionAttributes->getCachingEnabled() && (m_listener != nullptr);
}
virtual bool isDestroyed() const { return m_destroyPending; }
/* above public methods are inherited from RegionInternal */
@@ -329,7 +334,7 @@ class CPPCACHE_EXPORT LocalRegion : public RegionInternal {
virtual void adjustCacheWriter(const CacheWriterPtr& aWriter);
virtual void adjustCacheWriter(const char* libpath,
const char* factoryFuncName);
- virtual CacheImpl* getCacheImpl();
+ virtual CacheImpl* getCacheImpl() const;
virtual void evict(int32_t percentage);
virtual void acquireGlobals(bool isFailover){};
@@ -408,7 +413,7 @@ class CPPCACHE_EXPORT LocalRegion : public RegionInternal {
CacheablePtr& oldValue, int updateCount,
const CacheEventFlags eventFlags,
VersionTagPtr versionTag, DataInput* delta = NULL,
- EventIdPtr eventId = NULLPTR);
+ EventIdPtr eventId = nullptr);
template <typename TAction>
GfErrType updateNoThrowTX(const CacheableKeyPtr& key,
@@ -417,7 +422,7 @@ class CPPCACHE_EXPORT LocalRegion : public RegionInternal {
CacheablePtr& oldValue, int updateCount,
const CacheEventFlags eventFlags,
VersionTagPtr versionTag, DataInput* delta = NULL,
- EventIdPtr eventId = NULLPTR);
+ EventIdPtr eventId = nullptr);
/* protected attributes */
std::string m_name;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/MapEntry.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/MapEntry.cpp b/src/cppcache/src/MapEntry.cpp
index 98e5ba0..4222c80 100644
--- a/src/cppcache/src/MapEntry.cpp
+++ b/src/cppcache/src/MapEntry.cpp
@@ -20,7 +20,7 @@
using namespace apache::geode::client;
EntryFactory* EntryFactory::singleton = NULL;
-MapEntryPtr MapEntry::MapEntry_NullPointer(NULLPTR);
+MapEntryPtr MapEntry::MapEntry_NullPointer(nullptr);
/**
* @brief called when library is initialized... see CppCacheLibrary.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/MapEntry.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/MapEntry.hpp b/src/cppcache/src/MapEntry.hpp
index 4e05652..e177298 100644
--- a/src/cppcache/src/MapEntry.hpp
+++ b/src/cppcache/src/MapEntry.hpp
@@ -112,7 +112,7 @@ class CPPCACHE_EXPORT MapEntry : public SharedBase {
virtual void getKey(CacheableKeyPtr& result) const = 0;
virtual void getValue(CacheablePtr& result) const = 0;
virtual void setValue(const CacheablePtr& value) = 0;
- virtual MapEntryImpl* getImplPtr() = 0;
+ virtual MapEntryImplPtr getImplPtr() = 0;
virtual LRUEntryProperties& getLRUProperties() = 0;
virtual ExpEntryProperties& getExpProperties() = 0;
@@ -185,16 +185,17 @@ class CPPCACHE_EXPORT MapEntry : public SharedBase {
* @brief Hold region mapped entry value. subclass will hold lru flags.
* Another holds expiration timestamps.
*/
-class MapEntryImpl : public MapEntry {
+class MapEntryImpl : public MapEntry,
+ public std::enable_shared_from_this<MapEntryImpl> {
public:
virtual ~MapEntryImpl() {}
inline void getKeyI(CacheableKeyPtr& result) const { result = m_key; }
inline void getValueI(CacheablePtr& result) const {
- // If value is destroyed, then this returns NULLPTR
+ // If value is destroyed, then this returns nullptr
if (CacheableToken::isDestroyed(m_value)) {
- result = NULLPTR;
+ result = nullptr;
} else {
result = m_value;
}
@@ -208,7 +209,7 @@ class MapEntryImpl : public MapEntry {
virtual void setValue(const CacheablePtr& value) { setValueI(value); }
- virtual MapEntryImpl* getImplPtr() { return this; }
+ virtual MapEntryImplPtr getImplPtr() { return shared_from_this(); }
virtual LRUEntryProperties& getLRUProperties() {
throw FatalInternalException(
@@ -231,7 +232,7 @@ class MapEntryImpl : public MapEntry {
protected:
inline explicit MapEntryImpl(bool noInit)
- : MapEntry(true), m_value(true), m_key(true) {}
+ : MapEntry(true), m_value(nullptr), m_key(nullptr) {}
inline MapEntryImpl(const CacheableKeyPtr& key) : MapEntry(), m_key(key) {}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/MapEntryT.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/MapEntryT.hpp b/src/cppcache/src/MapEntryT.hpp
index 474abdc..86db403 100644
--- a/src/cppcache/src/MapEntryT.hpp
+++ b/src/cppcache/src/MapEntryT.hpp
@@ -112,10 +112,8 @@ class MapEntryT : public TBase {
virtual int getUpdateCount() const { return UPDATE_COUNT; }
- inline static MapEntryT* create(const CacheableKeyPtr& key) {
- MapEntryT* entry;
- GF_NEW(entry, MapEntryT(key));
- return entry;
+ inline static std::shared_ptr<MapEntryT> create(const CacheableKeyPtr& key) {
+ return std::make_shared<MapEntryT>(key);
}
protected:
@@ -125,6 +123,8 @@ class MapEntryT : public TBase {
// disabled
MapEntryT(const MapEntryT&);
MapEntryT& operator=(const MapEntryT&);
+
+ FRIEND_STD_SHARED_PTR(MapEntryT)
};
// specialization of MapEntryT to terminate the recursive template definition
@@ -148,7 +148,8 @@ class MapEntryT<TBase, NUM_TRACKERS, GF_UPDATE_MAX> : public TBase {
virtual int incrementUpdateCount(MapEntryPtr& newEntry) {
// fallback to TrackedMapEntry
- GF_NEW(newEntry, TrackedMapEntry(this, NUM_TRACKERS, GF_UPDATE_MAX + 1));
+ newEntry = std::make_shared<TrackedMapEntry>(
+ this->shared_from_this(), NUM_TRACKERS, GF_UPDATE_MAX + 1);
return (GF_UPDATE_MAX + 1);
}
@@ -173,7 +174,8 @@ class MapEntryT<TBase, GF_TRACK_MAX, UPDATE_COUNT> : public TBase {
virtual int addTracker(MapEntryPtr& newEntry) {
// fallback to TrackedMapEntry
- GF_NEW(newEntry, TrackedMapEntry(this, GF_TRACK_MAX + 1, UPDATE_COUNT));
+ newEntry = std::make_shared<TrackedMapEntry>(
+ this->shared_from_this(), GF_TRACK_MAX + 1, UPDATE_COUNT);
return UPDATE_COUNT;
}
@@ -208,7 +210,8 @@ class MapEntryT<TBase, GF_TRACK_MAX, GF_UPDATE_MAX> : public TBase {
virtual int addTracker(MapEntryPtr& newEntry) {
// fallback to TrackedMapEntry
- GF_NEW(newEntry, TrackedMapEntry(this, GF_TRACK_MAX + 1, GF_UPDATE_MAX));
+ newEntry = std::make_shared<TrackedMapEntry>(
+ this->shared_from_this(), GF_TRACK_MAX + 1, GF_UPDATE_MAX);
return GF_UPDATE_MAX;
}
@@ -220,7 +223,8 @@ class MapEntryT<TBase, GF_TRACK_MAX, GF_UPDATE_MAX> : public TBase {
virtual int incrementUpdateCount(MapEntryPtr& newEntry) {
// fallback to TrackedMapEntry
- GF_NEW(newEntry, TrackedMapEntry(this, GF_TRACK_MAX, GF_UPDATE_MAX + 1));
+ newEntry = std::make_shared<TrackedMapEntry>(
+ this->shared_from_this(), GF_TRACK_MAX, GF_UPDATE_MAX + 1);
return (GF_UPDATE_MAX + 1);
}
[45/46] geode-native git commit: GEODE-2741: Fixes inclusion of
unmanaged headers.
Posted by jb...@apache.org.
GEODE-2741: Fixes inclusion of unmanaged headers.
Project: http://git-wip-us.apache.org/repos/asf/geode-native/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode-native/commit/d58a5e30
Tree: http://git-wip-us.apache.org/repos/asf/geode-native/tree/d58a5e30
Diff: http://git-wip-us.apache.org/repos/asf/geode-native/diff/d58a5e30
Branch: refs/heads/develop
Commit: d58a5e30d42ae38fd9a439fe875bb9096cdde386
Parents: 3cb20df
Author: Jacob Barrett <jb...@pivotal.io>
Authored: Wed May 17 03:26:35 2017 +0000
Committer: Jacob Barrett <jb...@pivotal.io>
Committed: Wed May 17 03:26:35 2017 +0000
----------------------------------------------------------------------
src/clicache/src/AttributesFactory.cpp | 2 ++
src/clicache/src/CqAttributesMutator.cpp | 3 +--
src/clicache/src/begin_native.hpp | 19 +++++++++++++++
src/clicache/src/end_native.hpp | 23 +++++++++++++++++--
.../src/native_conditional_unique_ptr.hpp | 19 +++++++++++++++
src/clicache/src/native_shared_ptr.hpp | 2 ++
src/clicache/src/native_unique_ptr.hpp | 19 +++++++++++++++
.../test/native_conditional_unqiue_ptrTests.cpp | 19 +++++++++++++++
src/clicache/test/native_shared_ptrTests.cpp | Bin 5153 -> 12434 bytes
src/clicache/test/native_unique_ptrTests.cpp | 19 +++++++++++++++
src/tests/cli/QueryHelper/QueryStringsM.cpp | 8 +++++--
11 files changed, 127 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode-native/blob/d58a5e30/src/clicache/src/AttributesFactory.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/AttributesFactory.cpp b/src/clicache/src/AttributesFactory.cpp
index 90a34b6..33f84ea 100644
--- a/src/clicache/src/AttributesFactory.cpp
+++ b/src/clicache/src/AttributesFactory.cpp
@@ -37,7 +37,9 @@
#include "impl/SafeConvert.hpp"
#include "ExceptionTypes.hpp"
+#include "begin_native.hpp"
#include <memory>
+#include "end_native.hpp"
namespace Apache
{
http://git-wip-us.apache.org/repos/asf/geode-native/blob/d58a5e30/src/clicache/src/CqAttributesMutator.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CqAttributesMutator.cpp b/src/clicache/src/CqAttributesMutator.cpp
index 5184903..e1d9e32 100644
--- a/src/clicache/src/CqAttributesMutator.cpp
+++ b/src/clicache/src/CqAttributesMutator.cpp
@@ -15,9 +15,8 @@
* limitations under the License.
*/
-#include <memory>
-
#include "begin_native.hpp"
+#include <memory>
#include <geode/QueryService.hpp>
#include "end_native.hpp"
http://git-wip-us.apache.org/repos/asf/geode-native/blob/d58a5e30/src/clicache/src/begin_native.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/begin_native.hpp b/src/clicache/src/begin_native.hpp
index 14d9d47..5ee5877 100644
--- a/src/clicache/src/begin_native.hpp
+++ b/src/clicache/src/begin_native.hpp
@@ -1,3 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#if defined(__begin_native__hpp__)
#error Including begin_native.hpp mulitple times without end_native.hpp
#endif
@@ -20,3 +37,5 @@
// Disable native code generation warning
#pragma warning(disable: 4793)
+
+#pragma managed(push, off)
http://git-wip-us.apache.org/repos/asf/geode-native/blob/d58a5e30/src/clicache/src/end_native.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/end_native.hpp b/src/clicache/src/end_native.hpp
index 1af8380..8a8a4ae 100644
--- a/src/clicache/src/end_native.hpp
+++ b/src/clicache/src/end_native.hpp
@@ -1,6 +1,25 @@
-#pragma pop_macro("nullptr")
-#pragma pop_macro("_ALLOW_KEYWORD_MACROS")
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma managed(pop)
#pragma warning(pop)
+#pragma pop_macro("nullptr")
+#pragma pop_macro("_ALLOW_KEYWORD_MACROS")
+
#undef __begin_native__hpp__
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/geode-native/blob/d58a5e30/src/clicache/src/native_conditional_unique_ptr.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/native_conditional_unique_ptr.hpp b/src/clicache/src/native_conditional_unique_ptr.hpp
index aff0b47..395fb29 100644
--- a/src/clicache/src/native_conditional_unique_ptr.hpp
+++ b/src/clicache/src/native_conditional_unique_ptr.hpp
@@ -1,6 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#pragma once
+#include "begin_native.hpp"
#include <memory>
+#include "end_native.hpp"
namespace Apache
{
http://git-wip-us.apache.org/repos/asf/geode-native/blob/d58a5e30/src/clicache/src/native_shared_ptr.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/native_shared_ptr.hpp b/src/clicache/src/native_shared_ptr.hpp
index 0e40ff9..ebb0f21 100644
--- a/src/clicache/src/native_shared_ptr.hpp
+++ b/src/clicache/src/native_shared_ptr.hpp
@@ -1,6 +1,8 @@
#pragma once
+#include "begin_native.hpp"
#include <memory>
+#include "end_native.hpp"
namespace Apache
{
http://git-wip-us.apache.org/repos/asf/geode-native/blob/d58a5e30/src/clicache/src/native_unique_ptr.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/native_unique_ptr.hpp b/src/clicache/src/native_unique_ptr.hpp
index bd8ff5f..a14f698 100644
--- a/src/clicache/src/native_unique_ptr.hpp
+++ b/src/clicache/src/native_unique_ptr.hpp
@@ -1,6 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#pragma once
+#include "begin_native.hpp"
#include <memory>
+#include "end_native.hpp"
namespace Apache
{
http://git-wip-us.apache.org/repos/asf/geode-native/blob/d58a5e30/src/clicache/test/native_conditional_unqiue_ptrTests.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/test/native_conditional_unqiue_ptrTests.cpp b/src/clicache/test/native_conditional_unqiue_ptrTests.cpp
index 74cdf34..59fea8d 100644
--- a/src/clicache/test/native_conditional_unqiue_ptrTests.cpp
+++ b/src/clicache/test/native_conditional_unqiue_ptrTests.cpp
@@ -1,5 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "begin_native.hpp"
#include <memory>
#include <functional>
+#include "end_native.hpp"
#include <native_conditional_unique_ptr.hpp>
#include "Utils.hpp"
http://git-wip-us.apache.org/repos/asf/geode-native/blob/d58a5e30/src/clicache/test/native_shared_ptrTests.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/test/native_shared_ptrTests.cpp b/src/clicache/test/native_shared_ptrTests.cpp
index 6cddd97..46bb70d 100644
Binary files a/src/clicache/test/native_shared_ptrTests.cpp and b/src/clicache/test/native_shared_ptrTests.cpp differ
http://git-wip-us.apache.org/repos/asf/geode-native/blob/d58a5e30/src/clicache/test/native_unique_ptrTests.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/test/native_unique_ptrTests.cpp b/src/clicache/test/native_unique_ptrTests.cpp
index 393aed5..5ed9e81 100644
--- a/src/clicache/test/native_unique_ptrTests.cpp
+++ b/src/clicache/test/native_unique_ptrTests.cpp
@@ -1,5 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "begin_native.hpp"
#include <memory>
#include <functional>
+#include "end_native.hpp"
#include <native_unique_ptr.hpp>
#include "Utils.hpp"
http://git-wip-us.apache.org/repos/asf/geode-native/blob/d58a5e30/src/tests/cli/QueryHelper/QueryStringsM.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cli/QueryHelper/QueryStringsM.cpp b/src/tests/cli/QueryHelper/QueryStringsM.cpp
index da40374..aab1745 100644
--- a/src/tests/cli/QueryHelper/QueryStringsM.cpp
+++ b/src/tests/cli/QueryHelper/QueryStringsM.cpp
@@ -15,6 +15,10 @@
* limitations under the License.
*/
+#include "begin_native.hpp"
+#include <memory>
+#include "end_native.hpp"
+
#include "QueryStringsM.hpp"
#include "impl/ManagedString.hpp"
@@ -35,9 +39,9 @@ namespace Apache
{
Apache::Geode::Client::ManagedString mg_pquery( pquery );
- auto nativeptr = std::make_unique<testData::QueryStrings>(
+ auto nativeptr = std::unique_ptr<testData::QueryStrings>(new testData::QueryStrings(
static_cast<testData::queryCategory>( pcategory ),
- mg_pquery.CharPtr, pisLargeResultset );
+ mg_pquery.CharPtr, pisLargeResultset ));
m_nativeptr = gcnew native_conditional_unique_ptr<testData::QueryStrings>(std::move(nativeptr));
}
[18/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from cppcache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientPdxInstance.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientPdxInstance.cpp b/src/cppcache/integration-test/testThinClientPdxInstance.cpp
index 4183614..692033d 100644
--- a/src/cppcache/integration-test/testThinClientPdxInstance.cpp
+++ b/src/cppcache/integration-test/testThinClientPdxInstance.cpp
@@ -131,7 +131,7 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators,
RegionPtr regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
DUNIT_TASK_DEFINITION(SERVER1, CreateLocator1)
@@ -236,7 +236,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, putPdxWithIdentityField)
RegionPtr rptr = getHelper()->getRegion(regionNames[0]);
// Creating object of type PdxObject
- /*SerializePdxPtr*/ CacheablePtr sp(new SerializePdx(true));
+ /*SerializePdxPtr*/ auto sp = std::make_shared<SerializePdx>(true);
// PUT Operation
rptr->put(CacheableInt32::create(1), sp);
@@ -293,12 +293,11 @@ DUNIT_TASK_DEFINITION(CLIENT2, verifyPdxIdentityField)
RegionPtr rptr = getHelper()->getRegion(regionNames[0]);
- PdxInstancePtr pi =
- dynCast<PdxInstancePtr>(rptr->get(CacheableInt32::create(1)));
+ auto pi = std::dynamic_pointer_cast<PdxInstance>(rptr->get(CacheableInt32::create(1)));
LOG("PdxInstancePtr get complete");
LOG("Statistics for for (PdxTests.PdxType) PdxInstance");
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(rptr.ptr()));
+ LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(rptr.get()));
LOGINFO(
"pdxInstanceDeserializations for (PdxTests.PdxType) PdxInstance = %d ",
@@ -338,9 +337,9 @@ DUNIT_TASK_DEFINITION(CLIENT2, verifyPdxIdentityField)
"There is no field i3 in SerializePdx1's PdxInstance stream");
CacheableKeyPtr javaPdxHCKey = CacheableKey::create("javaPdxHC");
- CacheablePtr pIPtr2 = dynCast<CacheablePtr>(rptr->get(javaPdxHCKey));
+ auto pIPtr2 = std::dynamic_pointer_cast<Cacheable>(rptr->get(javaPdxHCKey));
LOG("javaPdxHCKey get done");
- CacheableInt32* val = dynamic_cast<CacheableInt32*>(pIPtr2.ptr());
+ CacheableInt32* val = dynamic_cast<CacheableInt32*>(pIPtr2.get());
LOG("javaPdxHCKey cast done");
int javaPdxHC = val->value();
LOGINFO("javaPdxHC hash code = %d ", javaPdxHC);
@@ -352,8 +351,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, verifyPdxIdentityField)
"Pdxhashcode for identity field object SerializePdx1 not matched with "
"java pdx hash code.");
- PdxInstancePtr pi2 =
- dynCast<PdxInstancePtr>(rptr->get(CacheableInt32::create(1)));
+ auto pi2 = std::dynamic_pointer_cast<PdxInstance>(rptr->get(CacheableInt32::create(1)));
LOGINFO(
"pdxInstanceDeserializations for (PdxTests.PdxType) PdxInstance = %d ",
@@ -378,7 +376,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, verifyPdxIdentityField)
"pdxInstanceDeserializationTime should be greater than 0.");
bool ret = false;
- ret = (*pi.ptr() == *pi2.ptr());
+ ret = (*pi.get() == *pi2.get());
LOGINFO("PdxObject ret = %d ", ret);
ASSERT(ret == true, "Both PdxInstances should be equal.");
@@ -399,12 +397,12 @@ DUNIT_TASK_DEFINITION(CLIENT2, verifyCacheableObjectArrayWithPdxField)
RegionPtr rptr = getHelper()->getRegion(regionNames[0]);
- CacheableObjectArrayPtr objectArrayPtr =
- rptr->get(CacheableInt32::create(100));
+ auto objectArrayPtr = std::dynamic_pointer_cast<CacheableObjectArray>(
+ rptr->get(CacheableInt32::create(100)));
LOG("PdxInstancePtr get on key 100 complete");
for (int i = 0; i < objectArrayPtr->size(); i++) {
- PdxInstancePtr pi = objectArrayPtr->at(i);
+ auto pi = std::dynamic_pointer_cast<PdxInstance>(objectArrayPtr->at(i));
LOG("PdxInstancePtr obtained from CacheableObjectArray");
PdxInstanceFactoryPtr pifPtr =
@@ -419,18 +417,18 @@ DUNIT_TASK_DEFINITION(CLIENT2, verifyCacheableObjectArrayWithPdxField)
sprintf(cityStr, "city%d", i);
pifPtr->writeString("_city", cityStr);
- AddressPtr addrPtr = dynCast<AddressPtr>(pi->getObject());
+ auto addrPtr = std::dynamic_pointer_cast<Address>(pi->getObject());
LOG("AddressPtr created using PdxInstance getObject()....");
- AddressPtr newAddrPtr(new Address(i + 1, streetStr, cityStr));
+ auto newAddrPtr = std::make_shared<Address>(i + 1, streetStr, cityStr);
LOG("AddressPtr created using new....");
- ASSERT(addrPtr.ptr()->equals(*(newAddrPtr.ptr())) == true,
+ ASSERT(addrPtr.get()->equals(*(newAddrPtr.get())) == true,
"Both PdxInstances should be equal.");
PdxInstancePtr retPtr = pifPtr->create();
LOG("PdxInstancePtr created....");
bool ret = false;
- ret = (*pi.ptr() == *retPtr.ptr());
+ ret = (*pi.get() == *retPtr.get());
LOGINFO("PdxObject ret = %d ", ret);
ASSERT(ret == true, "Both PdxInstances should be equal.");
}
@@ -445,7 +443,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, putPdxWithNullIdentityFields)
RegionPtr rptr = getHelper()->getRegion(regionNames[0]);
// Creating object of type PdxObject
- SerializePdxPtr sp(new SerializePdx(false));
+ auto sp = std::make_shared<SerializePdx>(false);
// PUT Operation
rptr->put(CacheableInt32::create(2), sp);
@@ -461,14 +459,13 @@ DUNIT_TASK_DEFINITION(CLIENT2, verifyPdxNullIdentityFieldHC)
RegionPtr rptr = getHelper()->getRegion(regionNames[0]);
- PdxInstancePtr pi =
- dynCast<PdxInstancePtr>(rptr->get(CacheableInt32::create(2)));
+ auto pi = std::dynamic_pointer_cast<PdxInstance>(rptr->get(CacheableInt32::create(2)));
LOG("PdxInstancePtr get complete");
CacheableKeyPtr javaPdxHCKey = CacheableKey::create("javaPdxHC");
- CacheablePtr pIPtr2 = dynCast<CacheablePtr>(rptr->get(javaPdxHCKey));
+ auto pIPtr2 = std::dynamic_pointer_cast<Cacheable>(rptr->get(javaPdxHCKey));
LOG("javaPdxHCKey get done");
- CacheableInt32* val = dynamic_cast<CacheableInt32*>(pIPtr2.ptr());
+ CacheableInt32* val = dynamic_cast<CacheableInt32*>(pIPtr2.get());
LOG("javaPdxHCKey cast done");
int javaPdxHC = val->value();
LOGINFO("javaPdxHC hash code = %d ", javaPdxHC);
@@ -480,20 +477,19 @@ DUNIT_TASK_DEFINITION(CLIENT2, verifyPdxNullIdentityFieldHC)
"Pdxhashcode for identity field object SerializePdx1 not matched with "
"java pdx hash code.");
- PdxInstancePtr pi2 =
- dynCast<PdxInstancePtr>(rptr->get(CacheableInt32::create(2)));
+ auto pi2 = std::dynamic_pointer_cast<PdxInstance>(rptr->get(CacheableInt32::create(2)));
bool ret = false;
- ret = (*pi.ptr() == *pi2.ptr());
+ ret = (*pi.get() == *pi2.get());
LOGINFO("PdxObject ret = %d ", ret);
ASSERT(ret == true, "Both PdxInstances should be equal.");
VectorOfCacheableKey keys1;
keys1.push_back(CacheableInt32::create(1));
keys1.push_back(CacheableInt32::create(2));
- HashMapOfCacheablePtr valuesMap(new HashMapOfCacheable());
+ auto valuesMap = std::make_shared<HashMapOfCacheable>();
valuesMap->clear();
- rptr->getAll(keys1, valuesMap, NULLPTR, true);
+ rptr->getAll(keys1, valuesMap, nullptr, true);
LOG("getAll on Pdx objects completed.");
ASSERT(valuesMap->size() == keys1.size(), "getAll size did not match");
@@ -514,7 +510,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, pdxPut)
}
// Creating object of type PdxObject
- CacheablePtr pdxobj(new PdxTests::PdxType());
+ auto pdxobj = std::make_shared<PdxTests::PdxType>();
CacheableKeyPtr keyport = CacheableKey::create("pdxput");
CacheableKeyPtr keyport1 = CacheableKey::create("pdxput2");
@@ -524,10 +520,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, pdxPut)
rptr->put(keyport, pdxobj);
LOG("pdxPut 1 completed ");
- PdxInstancePtr pIPtr1 = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ auto pIPtr1 = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
LOG("Statistics for for (PdxTests.PdxType) PdxInstance");
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(rptr.ptr()));
+ LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(rptr.get()));
LOGINFO(
"pdxInstanceDeserializations for (PdxTests.PdxType) PdxInstance = %d ",
@@ -557,9 +553,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, pdxPut)
LOGINFO("pdxinstance hash code = %d ", pdxInstHashcode);
CacheableKeyPtr javaPdxHCKey = CacheableKey::create("javaPdxHC");
- CacheablePtr pIPtr2 = dynCast<CacheablePtr>(rptr->get(javaPdxHCKey));
+ auto pIPtr2 = std::dynamic_pointer_cast<Cacheable>(rptr->get(javaPdxHCKey));
LOG("In verifyPdxInstanceHashcode get done");
- CacheableInt32* val = dynamic_cast<CacheableInt32*>(pIPtr2.ptr());
+ CacheableInt32* val = dynamic_cast<CacheableInt32*>(pIPtr2.get());
LOG("In verifyPdxInstanceHashcode cast done");
int javaPdxHC = val->value();
LOGINFO("javaPdxHC hash code = %d ", javaPdxHC);
@@ -568,7 +564,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, pdxPut)
"Pdxhashcode hashcode not matched with java pdx hash code.");
// Creating object of type ParentPdx
- CacheablePtr parentPdxObj(new ParentPdx(1));
+ auto parentPdxObj = std::make_shared<ParentPdx>(1);
LOG("pdxPut parentPdxObj created ");
rptr->put(keyport1, parentPdxObj);
@@ -608,7 +604,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, getObject)
CacheableKeyPtr keyport1 = CacheableKey::create("pdxput2");
RegionPtr rptr = getHelper()->getRegion(regionNames[0]);
- PdxInstancePtr pIPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ auto pIPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
LOG("PdxObject get Successful....");
LOGINFO("pdxinstance classname = %s ", pIPtr->getClassName());
@@ -620,7 +616,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, getObject)
LOG("PdxObject getObject Successful....");
LOG("Statistics for for (PdxTests.PdxType) PdxInstance ");
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(rptr.ptr()));
+ LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(rptr.get()));
LOGINFO(
"pdxInstanceDeserializations for (PdxTests.PdxType) PdxInstance = %d ",
@@ -643,21 +639,21 @@ DUNIT_TASK_DEFINITION(CLIENT2, getObject)
->m_cacheStats->getPdxInstanceDeserializationTime() > 0,
"pdxInstanceDeserializationTime should be greater than 0.");
- PdxTests::PdxTypePtr ptorig(new PdxTests::PdxType());
+ auto ptorig = std::make_shared<PdxTests::PdxType>();
LOG("PdxObject ptorig Successful....");
- PdxTests::PdxType* obj1 = ptorig.ptr();
+ PdxTests::PdxType* obj1 = ptorig.get();
LOG("obj1 Successful....");
- PdxTests::PdxType* obj2 = dynamic_cast<PdxTests::PdxType*>(pt.ptr());
+ PdxTests::PdxType* obj2 = dynamic_cast<PdxTests::PdxType*>(pt.get());
LOG("obj2 Successful....");
ASSERT(obj1->equals(*obj2, true) == true,
"PdxInstance.getObject not equals original object.");
- PdxInstancePtr pIPtr1 = dynCast<PdxInstancePtr>(rptr->get(keyport1));
+ auto pIPtr1 = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport1));
LOG("ParentPdxObject get Successful....");
CacheableStringPtr toString = pIPtr1->toString();
LOGINFO("ParentPdxObject toString = %s ", toString->asChar());
- ParentPdxPtr pt1 = dynCast<ParentPdxPtr>(pIPtr1->getObject());
+ auto pt1 = std::dynamic_pointer_cast<ParentPdx>(pIPtr1->getObject());
LOG("ParentPdxObject getObject Successful....");
LOGINFO(
@@ -681,11 +677,11 @@ DUNIT_TASK_DEFINITION(CLIENT2, getObject)
->m_cacheStats->getPdxInstanceDeserializationTime() > 0,
"pdxInstanceDeserializationTime should be greater than 0.");
- ParentPdxPtr parentPdxObj(new ParentPdx(1));
+ auto parentPdxObj = std::make_shared<ParentPdx>(1);
LOG("ParentPdxObject parentPdxObj Successful....");
- ParentPdx* parentObj1 = parentPdxObj.ptr();
+ ParentPdx* parentObj1 = parentPdxObj.get();
LOG("parentObj1 Successful....");
- ParentPdx* parentObj2 = dynamic_cast<ParentPdx*>(pt1.ptr());
+ ParentPdx* parentObj2 = dynamic_cast<ParentPdx*>(pt1.get());
LOG("parentObj2 Successful....");
ASSERT(parentObj1->equals(*parentObj2, true) == true,
@@ -710,23 +706,23 @@ DUNIT_TASK_DEFINITION(CLIENT2, verifyPdxInstanceEquals)
CacheableKeyPtr keyport1 = CacheableKey::create("pdxput2");
RegionPtr rptr = getHelper()->getRegion(regionNames[0]);
- PdxInstancePtr pIPtr1 = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ auto pIPtr1 = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
LOG("get1 Successfully....");
- PdxInstancePtr pIPtr2 = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ auto pIPtr2 = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
LOG("get2 Successfully....");
bool ret = false;
- ret = (*pIPtr1.ptr() == *pIPtr2.ptr());
+ ret = (*pIPtr1.get() == *pIPtr2.get());
LOGINFO("PdxObject ret = %d ", ret);
ASSERT(ret == true, "Both PdxInstances should be equal.");
- pIPtr1 = dynCast<PdxInstancePtr>(rptr->get(keyport1));
+ pIPtr1 = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport1));
LOG("parentPdx get1 Successfully....");
- pIPtr2 = dynCast<PdxInstancePtr>(rptr->get(keyport1));
+ pIPtr2 = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport1));
LOG("parentPdx get2 Successfully....");
ret = false;
- ret = (*pIPtr1.ptr() == *pIPtr2.ptr());
+ ret = (*pIPtr1.get() == *pIPtr2.get());
LOGINFO("parentPdx ret = %d ", ret);
ASSERT(ret == true, "Both PdxInstances should be equal.");
@@ -741,13 +737,13 @@ DUNIT_TASK_DEFINITION(CLIENT2, verifyPdxInstanceHashcode)
RegionPtr rptr = getHelper()->getRegion(regionNames[0]);
CacheableKeyPtr keyport1 = CacheableKey::create("javaPdxHC");
CacheableKeyPtr keyport2 = CacheableKey::create("pdxput2");
- PdxInstancePtr pIPtr1 = dynCast<PdxInstancePtr>(rptr->get(keyport2));
+ auto pIPtr1 = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport2));
int pdxInstHashcode = pIPtr1->hashcode();
LOGINFO("pdxinstance hash code = %d ", pdxInstHashcode);
- CacheablePtr pIPtr2 = dynCast<CacheablePtr>(rptr->get(keyport1));
+ auto pIPtr2 = std::dynamic_pointer_cast<Cacheable>(rptr->get(keyport1));
LOG("In verifyPdxInstanceHashcode get done");
- CacheableInt32* val1 = dynamic_cast<CacheableInt32*>(pIPtr2.ptr());
+ CacheableInt32* val1 = dynamic_cast<CacheableInt32*>(pIPtr2.get());
LOG("In verifyPdxInstanceHashcode cast done");
int javaPdxHC = val1->value();
LOGINFO("javaPdxHC hash code again = %d ", javaPdxHC);
@@ -781,10 +777,10 @@ DUNIT_TASK_DEFINITION(CLIENT2, accessPdxInstance)
CacheableKeyPtr keyport1 = CacheableKey::create("pdxput2");
RegionPtr rptr = getHelper()->getRegion(regionNames[0]);
- PdxInstancePtr pIPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ auto pIPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
LOGINFO("PdxInstancePtr created ");
- PdxTests::PdxTypePtr pdxobjPtr(new PdxTests::PdxType());
+ auto pdxobjPtr = std::make_shared<PdxTests::PdxType>();
bool bval = 0;
pIPtr->getField("m_bool", bval);
@@ -1011,10 +1007,10 @@ DUNIT_TASK_DEFINITION(CLIENT2, accessPdxInstance)
ASSERT(pIPtr->getFieldType("m_floatArray") == PdxFieldTypes::FLOAT_ARRAY,
"Type Value FLOAT_ARRAY Mismatch");
- CacheablePtr object = NULLPTR;
+ CacheablePtr object = nullptr;
pIPtr->getField("m_pdxEnum", object);
- ASSERT(object != NULLPTR, "enumObject should not be NULL");
- CacheableEnumPtr enumObject = dynCast<CacheableEnumPtr>(object);
+ ASSERT(object != nullptr, "enumObject should not be NULL");
+ auto enumObject = std::dynamic_pointer_cast<CacheableEnum>(object);
ASSERT(
enumObject->getEnumOrdinal() == pdxobjPtr->getEnum()->getEnumOrdinal(),
"enumObject ordinal should be equal");
@@ -1027,18 +1023,18 @@ DUNIT_TASK_DEFINITION(CLIENT2, accessPdxInstance)
ASSERT(pIPtr->getFieldType("m_pdxEnum") == PdxFieldTypes::OBJECT,
"Type Value OBJECT Mismatch");
- CacheableDatePtr dateObject = NULLPTR;
+ CacheableDatePtr dateObject = nullptr;
pIPtr->getField("m_dateTime", dateObject);
- ASSERT(dateObject != NULLPTR, "date should not be NULL");
- ASSERT((*(dateObject.ptr()) == *(pdxobjPtr->getDate().ptr())) == true,
+ ASSERT(dateObject != nullptr, "date should not be NULL");
+ ASSERT((*(dateObject.get()) == *(pdxobjPtr->getDate().get())) == true,
"dateObject should be equal");
ASSERT(pIPtr->getFieldType("m_dateTime") == PdxFieldTypes::DATE,
"Type Value DATE Mismatch");
- CacheablePtr object2 = NULLPTR;
+ CacheablePtr object2 = nullptr;
pIPtr->getField("m_map", object2);
- ASSERT(object2 != NULLPTR, "object2 should not be NULL");
- CacheableHashMapPtr mapObject = dynCast<CacheableHashMapPtr>(object2);
+ ASSERT(object2 != nullptr, "object2 should not be NULL");
+ auto mapObject = std::dynamic_pointer_cast<CacheableHashMap>(object2);
ASSERT(genericValCompare(pdxobjPtr->getHashMap()->size(),
mapObject->size()) == true,
"mapobject size should be equal");
@@ -1046,8 +1042,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, accessPdxInstance)
"Type Value OBJECT Mismatch");
pIPtr->getField("m_vector", object2);
- ASSERT(object2 != NULLPTR, "object2 should not be NULL");
- CacheableVectorPtr vec = dynCast<CacheableVectorPtr>(object2);
+ ASSERT(object2 != nullptr, "object2 should not be NULL");
+ auto vec = std::dynamic_pointer_cast<CacheableVector>(object2);
ASSERT(
genericValCompare(pdxobjPtr->getVector()->size(), vec->size()) == true,
"vec size should be equal");
@@ -1055,8 +1051,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, accessPdxInstance)
"Type Value OBJECT Mismatch");
pIPtr->getField("m_arraylist", object2);
- ASSERT(object2 != NULLPTR, "object2 should not be NULL");
- CacheableArrayListPtr arrList = dynCast<CacheableArrayListPtr>(object2);
+ ASSERT(object2 != nullptr, "object2 should not be NULL");
+ auto arrList = std::dynamic_pointer_cast<CacheableArrayList>(object2);
ASSERT(genericValCompare(pdxobjPtr->getArrayList()->size(),
arrList->size()) == true,
"arrList size should be equal");
@@ -1064,8 +1060,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, accessPdxInstance)
"Type Value OBJECT Mismatch");
pIPtr->getField("m_chs", object2);
- ASSERT(object2 != NULLPTR, "object2 should not be NULL");
- CacheableHashSetPtr hashSet = dynCast<CacheableHashSetPtr>(object2);
+ ASSERT(object2 != nullptr, "object2 should not be NULL");
+ auto hashSet = std::dynamic_pointer_cast<CacheableHashSet>(object2);
ASSERT(genericValCompare(pdxobjPtr->getHashSet()->size(),
hashSet->size()) == true,
"hashSet size should be equal");
@@ -1073,9 +1069,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, accessPdxInstance)
"Type Value OBJECT Mismatch");
pIPtr->getField("m_clhs", object2);
- ASSERT(object2 != NULLPTR, "object2 should not be NULL");
- CacheableLinkedHashSetPtr linkedHashSet =
- dynCast<CacheableLinkedHashSetPtr>(object2);
+ ASSERT(object2 != nullptr, "object2 should not be NULL");
+ auto linkedHashSet = std::dynamic_pointer_cast<CacheableLinkedHashSet>(object2);
ASSERT(genericValCompare(pdxobjPtr->getLinkedHashSet()->size(),
linkedHashSet->size()) == true,
"linkedHashSet size should be equal");
@@ -1098,18 +1093,18 @@ DUNIT_TASK_DEFINITION(CLIENT2, accessPdxInstance)
PdxFieldTypes::ARRAY_OF_BYTE_ARRAYS,
"Type Value ARRAY_OF_BYTE_ARRAYS Mismatch");
- CacheableObjectArrayPtr objectArray = NULLPTR;
+ CacheableObjectArrayPtr objectArray = nullptr;
pIPtr->getField("m_objectArray", objectArray);
- ASSERT(objectArray != NULLPTR, "objectArray should not be NULL");
+ ASSERT(objectArray != nullptr, "objectArray should not be NULL");
ASSERT(genericValCompare(pdxobjPtr->getCacheableObjectArray()->size(),
objectArray->size()) == true,
"objectArray size should be equal");
ASSERT(pIPtr->getFieldType("m_objectArray") == PdxFieldTypes::OBJECT_ARRAY,
"Type Value OBJECT_ARRAY Mismatch");
- CacheableObjectArrayPtr objectArrayEmptyFieldName = NULLPTR;
+ CacheableObjectArrayPtr objectArrayEmptyFieldName = nullptr;
pIPtr->getField("", objectArrayEmptyFieldName);
- ASSERT(objectArrayEmptyFieldName != NULLPTR,
+ ASSERT(objectArrayEmptyFieldName != nullptr,
"objectArrayEmptyFieldName should not be NULL");
ASSERT(genericValCompare(
pdxobjPtr->getCacheableObjectArrayEmptyPdxFieldName()->size(),
@@ -1117,7 +1112,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, accessPdxInstance)
"objectArrayEmptyFieldName size should be equal");
for (int i = 0; i < objectArray->size(); i++) {
- PdxInstancePtr pi = objectArray->at(i);
+ auto pi = std::dynamic_pointer_cast<PdxInstance>(objectArray->at(i));
LOG("PdxInstancePtr obtained from CacheableObjectArray");
PdxInstanceFactoryPtr pifPtr =
@@ -1132,36 +1127,36 @@ DUNIT_TASK_DEFINITION(CLIENT2, accessPdxInstance)
sprintf(cityStr, "city%d", i);
pifPtr->writeString("_city", cityStr);
- AddressPtr addrPtr = dynCast<AddressPtr>(pi->getObject());
+ auto addrPtr = std::dynamic_pointer_cast<Address>(pi->getObject());
LOG("AddressPtr created using PdxInstance getObject()....");
- AddressPtr newAddrPtr(new Address(i + 1, streetStr, cityStr));
+ auto newAddrPtr = std::make_shared<Address>(i + 1, streetStr, cityStr);
LOG("AddressPtr created using new....");
- ASSERT(addrPtr.ptr()->equals(*(newAddrPtr.ptr())) == true,
+ ASSERT(addrPtr.get()->equals(*(newAddrPtr.get())) == true,
"Both PdxInstances should be equal.");
PdxInstancePtr retPtr = pifPtr->create();
LOG("PdxInstancePtr created....");
bool ret = false;
- ret = (*pi.ptr() == *retPtr.ptr());
+ ret = (*pi.get() == *retPtr.get());
LOGINFO("PdxObject ret = %d ", ret);
ASSERT(ret == true, "Both PdxInstances should be equal.");
}
LOGINFO("PdxInstancePtr for ParentPdx accessPdxInstance ");
- pIPtr = dynCast<PdxInstancePtr>(rptr->get(keyport1));
+ pIPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport1));
LOGINFO("PdxInstancePtr for ParentPdx object got ");
CacheablePtr childObjPtr;
pIPtr->getField("m_childPdx", childObjPtr);
- ASSERT(childObjPtr != NULLPTR, "childObjPtr should not be NULL");
+ ASSERT(childObjPtr != nullptr, "childObjPtr should not be NULL");
LOGINFO("got childPdx field ");
- PdxInstancePtr cpi = dynCast<PdxInstancePtr>(childObjPtr);
+ auto cpi = std::dynamic_pointer_cast<PdxInstance>(childObjPtr);
LOGINFO("cast to pdxinstance done ");
- ChildPdxPtr cpo = dynCast<ChildPdxPtr>(cpi->getObject());
+ auto cpo = std::dynamic_pointer_cast<ChildPdx>(cpi->getObject());
LOGINFO("got childPdx getObject ");
- ChildPdxPtr childpdxobjPtr(new ChildPdx(1));
+ auto childpdxobjPtr = std::make_shared<ChildPdx>(1);
LOGINFO("created new childPdx");
- ASSERT((cpo.ptr()->equals(*childpdxobjPtr.ptr())) == true,
+ ASSERT((cpo.get()->equals(*childpdxobjPtr.get())) == true,
"child pdx should be equal");
LOG("accessPdxInstance complete");
}
@@ -1175,23 +1170,23 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance)
CacheableKeyPtr keyport = CacheableKey::create("pdxput");
CacheableKeyPtr keyport1 = CacheableKey::create("pdxput2");
- PdxInstancePtr pIPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ auto pIPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
LOG("modifyPdxInstance get complete.");
WritablePdxInstancePtr wpiPtr(pIPtr->createWriter());
- ASSERT(pIPtr != NULLPTR, "pIPtr != NULLPTR expected");
+ ASSERT(pIPtr != nullptr, "pIPtr != nullptr expected");
int val = 0;
int newVal = 0;
ASSERT(pIPtr->hasField("m_int32") == true, "m_id1 = true expected");
pIPtr->getField("m_int32", val);
wpiPtr->setField("m_int32", val + 1);
rptr->put(keyport, wpiPtr);
- PdxInstancePtr newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ auto newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(newPiPtr->hasField("m_int32") == true, "m_int32 = true expected");
newPiPtr->getField("m_int32", newVal);
ASSERT(val + 1 == newVal, "val + 1 == newVal expected");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
wpiPtr = pIPtr->createWriter();
@@ -1209,11 +1204,11 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance)
wpiPtr = pIPtr->createWriter();
wpiPtr->setField("m_bool", false);
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(newPiPtr->hasField("m_bool") == true, "m_bool = true expected");
newPiPtr->getField("m_bool", boolVal);
ASSERT(boolVal == false, "bool is not equal");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
wpiPtr = pIPtr->createWriter();
@@ -1232,11 +1227,11 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance)
wpiPtr = pIPtr->createWriter();
wpiPtr->setField("m_char", setVal);
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(newPiPtr->hasField("m_char") == true, "m_char = true expected");
newPiPtr->getField("m_char", charVal);
ASSERT(charVal == setVal, "char is not equal");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
wpiPtr = pIPtr->createWriter();
@@ -1255,22 +1250,22 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance)
wpiPtr = pIPtr->createWriter();
wpiPtr->setField("m_byte", setByteVal);
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(newPiPtr->hasField("m_byte") == true, "m_byte = true expected");
newPiPtr->getField("m_byte", byteVal);
ASSERT(byteVal == setByteVal, "byte is not equal");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
signed char setSByteVal = 0x57;
wpiPtr = pIPtr->createWriter();
wpiPtr->setField("m_sbyte", setSByteVal);
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(newPiPtr->hasField("m_sbyte") == true, "m_sbyte = true expected");
newPiPtr->getField("m_sbyte", byteVal);
ASSERT(byteVal == setSByteVal, "m_sbyte is not equal");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
wpiPtr = pIPtr->createWriter();
@@ -1288,11 +1283,11 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance)
wpiPtr = pIPtr->createWriter();
wpiPtr->setField("m_int16", static_cast<int16_t>(0x5678));
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(newPiPtr->hasField("m_int16") == true, "m_int16 = true expected");
newPiPtr->getField("m_int16", shortVal);
ASSERT(shortVal == 0x5678, "short is not equal");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
wpiPtr = pIPtr->createWriter();
@@ -1310,11 +1305,11 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance)
wpiPtr = pIPtr->createWriter();
wpiPtr->setField("m_long", static_cast<int64_t>(0x56787878));
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(newPiPtr->hasField("m_long") == true, "m_long = true expected");
newPiPtr->getField("m_long", longVal);
ASSERT(longVal == 0x56787878, "long is not equal");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
wpiPtr = pIPtr->createWriter();
@@ -1332,11 +1327,11 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance)
wpiPtr = pIPtr->createWriter();
wpiPtr->setField("m_float", 18389.34f);
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(newPiPtr->hasField("m_float") == true, "m_float = true expected");
newPiPtr->getField("m_float", fVal);
ASSERT(fVal == 18389.34f, "fval is not equal");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
wpiPtr = pIPtr->createWriter();
@@ -1354,11 +1349,11 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance)
wpiPtr = pIPtr->createWriter();
wpiPtr->setField("m_double", 18389.34);
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(newPiPtr->hasField("m_double") == true, "m_double = true expected");
newPiPtr->getField("m_double", dVal);
ASSERT(dVal == 18389.34, "dval is not equal");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
wpiPtr = pIPtr->createWriter();
@@ -1378,14 +1373,14 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance)
bool* getBoolArray = NULL;
wpiPtr->setField("m_boolArray", setBoolArray, 8);
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(newPiPtr->hasField("m_boolArray") == true,
"m_boolArray = true expected");
newPiPtr->getField("m_boolArray", &getBoolArray, arrayLen);
ASSERT(arrayLen == 8, "Arraylength == 8 expected");
ASSERT(genericCompare(setBoolArray, getBoolArray, arrayLen) == true,
"boolArray should be equal");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
wpiPtr = pIPtr->createWriter();
@@ -1403,14 +1398,14 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance)
signed char* getByteArray = NULL;
wpiPtr->setField("m_byteArray", setByteArray, 4);
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(newPiPtr->hasField("m_byteArray") == true,
"m_byteArray = true expected");
newPiPtr->getField("m_byteArray", &getByteArray, arrayLen);
ASSERT(arrayLen == 4, "Arraylength == 4 expected");
ASSERT(genericCompare(setByteArray, getByteArray, arrayLen) == true,
"byteArray should be equal");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
wpiPtr = pIPtr->createWriter();
@@ -1428,14 +1423,14 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance)
wchar_t* getCharArray = NULL;
wpiPtr->setField("m_charArray", setCharArray, 4);
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(newPiPtr->hasField("m_charArray") == true,
"m_charArray = true expected");
newPiPtr->getField("m_charArray", &getCharArray, arrayLen);
ASSERT(arrayLen == 4, "Arraylength == 4 expected");
ASSERT(genericCompare(setCharArray, getCharArray, arrayLen) == true,
"charArray should be equal");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
wpiPtr = pIPtr->createWriter();
@@ -1453,14 +1448,14 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance)
int16_t* getShortArray = NULL;
wpiPtr->setField("m_int16Array", setShortArray, 4);
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(newPiPtr->hasField("m_int16Array") == true,
"m_int16Array = true expected");
newPiPtr->getField("m_int16Array", &getShortArray, arrayLen);
ASSERT(arrayLen == 4, "Arraylength == 4 expected");
ASSERT(genericCompare(setShortArray, getShortArray, arrayLen) == true,
"shortArray should be equal");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
wpiPtr = pIPtr->createWriter();
@@ -1478,14 +1473,14 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance)
int32_t* newValArray = NULL;
wpiPtr->setField("m_int32Array", setIntArray, 3);
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(newPiPtr->hasField("m_int32Array") == true,
"m_int32Array = true expected");
newPiPtr->getField("m_int32Array", &newValArray, arrayLen);
ASSERT(arrayLen == 3, "Arraylength == 3 expected");
ASSERT(genericCompare(setIntArray, newValArray, arrayLen) == true,
"intArray should be equal");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
wpiPtr = pIPtr->createWriter();
@@ -1503,14 +1498,14 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance)
int64_t* getLongArray = NULL;
wpiPtr->setField("m_longArray", setLongArray, 2);
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(newPiPtr->hasField("m_longArray") == true,
"m_longArray = true expected");
newPiPtr->getField("m_longArray", &getLongArray, arrayLen);
ASSERT(arrayLen == 2, "Arraylength == 2 expected");
ASSERT(genericCompare(setLongArray, getLongArray, arrayLen) == true,
"longArray should be equal");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
wpiPtr = pIPtr->createWriter();
@@ -1529,14 +1524,14 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance)
float* getFloatArray = NULL;
wpiPtr->setField("m_floatArray", setFloatArray, 2);
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(newPiPtr->hasField("m_floatArray") == true,
"m_floatArray = true expected");
newPiPtr->getField("m_floatArray", &getFloatArray, arrayLen);
ASSERT(arrayLen == 2, "Arraylength == 2 expected");
ASSERT(genericCompare(setFloatArray, getFloatArray, arrayLen) == true,
"floatArray should be equal");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
wpiPtr = pIPtr->createWriter();
@@ -1554,14 +1549,14 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance)
double* getDoubleArray = NULL;
wpiPtr->setField("m_doubleArray", setDoubleArray, 2);
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(newPiPtr->hasField("m_doubleArray") == true,
"m_doubleArray = true expected");
newPiPtr->getField("m_doubleArray", &getDoubleArray, arrayLen);
ASSERT(arrayLen == 2, "Arraylength == 2 expected");
ASSERT(genericCompare(setDoubleArray, getDoubleArray, arrayLen) == true,
"doubleArray should be equal");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
wpiPtr = pIPtr->createWriter();
@@ -1578,14 +1573,14 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance)
const wchar_t* setWideString = L"change the string";
wpiPtr->setField("m_string", setWideString);
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(pIPtr->hasField("m_string") == true, "m_string = true expected");
wchar_t* wideStringVal = NULL;
ASSERT(newPiPtr->hasField("m_string") == true, "m_string = true expected");
newPiPtr->getField("m_string", &wideStringVal);
ASSERT(wcscmp(wideStringVal, setWideString) == 0,
"wide stringVal should be equal");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
wpiPtr = pIPtr->createWriter();
@@ -1602,13 +1597,13 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance)
const char* setString = "change the string";
wpiPtr->setField("m_string", setString);
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(pIPtr->hasField("m_string") == true, "m_string = true expected");
char* stringVal = NULL;
ASSERT(newPiPtr->hasField("m_string") == true, "m_string = true expected");
newPiPtr->getField("m_string", &stringVal);
ASSERT(strcmp(stringVal, setString) == 0, "stringVal should be equal");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
CacheableDatePtr dateVal;
@@ -1619,14 +1614,14 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance)
CacheableDatePtr datePtr = CacheableDate::create(timeofday);
wpiPtr->setField("m_dateTime", datePtr);
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(newPiPtr->hasField("m_dateTime") == true,
"m_dateTime = true expected");
ASSERT(pIPtr->hasField("m_dateTime") == true, "m_date = true expected");
newPiPtr->getField("m_dateTime", dateVal);
- ASSERT((*(dateVal.ptr()) == *(datePtr.ptr())) == true,
+ ASSERT((*(dateVal.get()) == *(datePtr.get())) == true,
"dateObject should be equal");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
wpiPtr = pIPtr->createWriter();
@@ -1647,11 +1642,11 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance)
setVec->push_back(CacheableInt32::create(4));
wpiPtr->setField("m_vector", (CacheablePtr)setVec);
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(newPiPtr->hasField("m_vector") == true, "m_vector = true expected");
ASSERT(pIPtr->hasField("m_vector") == true, "m_vector = true expected");
newPiPtr->getField("m_vector", object);
- CacheableVectorPtr vecVal = dynCast<CacheableVectorPtr>(object);
+ auto vecVal = std::dynamic_pointer_cast<CacheableVector>(object);
ASSERT(genericValCompare(setVec->size(), vecVal->size()) == true,
"vec size should be equal");
for (int j = 0; j < vecVal->size(); j++) {
@@ -1676,13 +1671,13 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance)
setarr->push_back(CacheableInt32::create(5));
wpiPtr->setField("m_arraylist", (CacheablePtr)setarr);
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(newPiPtr->hasField("m_arraylist") == true,
"m_arraylist = true expected");
ASSERT(pIPtr->hasField("m_arraylist") == true,
"m_arraylist = true expected");
newPiPtr->getField("m_arraylist", object);
- CacheableArrayListPtr arrVal = dynCast<CacheableArrayListPtr>(object);
+ auto arrVal = std::dynamic_pointer_cast<CacheableArrayList>(object);
ASSERT(genericValCompare(setarr->size(), arrVal->size()) == true,
"arrList size should be equal");
for (int j = 0; j < arrVal->size(); j++) {
@@ -1707,11 +1702,11 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance)
hashset->insert(CacheableInt32::create(5));
wpiPtr->setField("m_chs", (CacheablePtr)hashset);
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(newPiPtr->hasField("m_chs") == true, "m_chs = true expected");
ASSERT(pIPtr->hasField("m_chs") == true, "m_chs = true expected");
newPiPtr->getField("m_chs", object);
- CacheableHashSetPtr hashsetVal = dynCast<CacheableHashSetPtr>(object);
+ auto hashsetVal = std::dynamic_pointer_cast<CacheableHashSet>(object);
ASSERT(genericValCompare(hashset->size(), hashsetVal->size()) == true,
"m_chs size should be equal");
@@ -1733,11 +1728,11 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance)
hashmap->insert(CacheableInt32::create(5), CacheableInt32::create(5));
wpiPtr->setField("m_map", (CacheablePtr)hashmap);
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(newPiPtr->hasField("m_map") == true, "m_map = true expected");
ASSERT(pIPtr->hasField("m_map") == true, "m_map = true expected");
newPiPtr->getField("m_map", object);
- CacheableHashMapPtr hashmapVal = dynCast<CacheableHashMapPtr>(object);
+ auto hashmapVal = std::dynamic_pointer_cast<CacheableHashMap>(object);
ASSERT(genericValCompare(hashmap->size(), hashmapVal->size()) == true,
"m_map size should be equal");
@@ -1759,12 +1754,11 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance)
linkedhashset->insert(CacheableInt32::create(5));
wpiPtr->setField("m_clhs", (CacheablePtr)linkedhashset);
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(newPiPtr->hasField("m_clhs") == true, "m_clhs = true expected");
ASSERT(pIPtr->hasField("m_clhs") == true, "m_clhs = true expected");
newPiPtr->getField("m_clhs", object);
- CacheableLinkedHashSetPtr linkedhashsetVal =
- dynCast<CacheableLinkedHashSetPtr>(object);
+ auto linkedhashsetVal = std::dynamic_pointer_cast<CacheableLinkedHashSet>(object);
ASSERT(genericValCompare(linkedhashsetVal->size(), linkedhashset->size()) ==
true,
"m_clhs size should be equal");
@@ -1805,7 +1799,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance)
LOGINFO("Testing byteByteArray setField");
rptr->put(keyport, wpiPtr);
LOGINFO("Testing byteByteArray put");
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
LOGINFO("Testing byteByteArray get");
ASSERT(newPiPtr->hasField("m_byteByteArray") == true,
"m_byteByteArray = true expected");
@@ -1847,7 +1841,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance)
wchar_t** getWideStringArray = NULL;
wpiPtr->setField("m_stringArray", setWideStringArray, 3);
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(pIPtr->hasField("m_stringArray") == true,
"m_stringArray = true expected");
newPiPtr->getField("m_stringArray", &getWideStringArray, arrayLen);
@@ -1858,7 +1852,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance)
ASSERT(wcscmp(setWideStringArray[i], getWideStringArray[i]) == 0,
"All stringVals should be equal");
}
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
wpiPtr = pIPtr->createWriter();
@@ -1887,7 +1881,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance)
char** getStringArray = NULL;
wpiPtr->setField("m_stringArray", setStringArray, 3);
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
newPiPtr->getField("m_stringArray", &getStringArray, arrayLen);
ASSERT(arrayLen == 3, "Arraylength == 3 expected");
for (int i = 0; i < arrayLen; i++) {
@@ -1896,39 +1890,39 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance)
ASSERT(strcmp(setStringArray[i], getStringArray[i]) == 0,
"All stringVals should be equal");
}
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
LOGINFO("PdxInstancePtr for ParentPdx modifyPdxInstance ");
- pIPtr = dynCast<PdxInstancePtr>(rptr->get(keyport1));
+ pIPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport1));
LOGINFO("PdxInstancePtr for ParentPdx object got ");
CacheablePtr childObjPtr;
pIPtr->getField("m_childPdx", childObjPtr);
- ASSERT(childObjPtr != NULLPTR, "childObjPtr should not be NULL");
+ ASSERT(childObjPtr != nullptr, "childObjPtr should not be NULL");
LOGINFO("got childPdx field ");
- PdxInstancePtr cpi = dynCast<PdxInstancePtr>(childObjPtr);
+ auto cpi = std::dynamic_pointer_cast<PdxInstance>(childObjPtr);
LOGINFO("cast to pdxinstance done ");
wpiPtr = pIPtr->createWriter();
- ChildPdxPtr childpdxobjPtr(new ChildPdx(2));
+ auto childpdxobjPtr = std::make_shared<ChildPdx>(2);
LOGINFO("created new childPdx");
wpiPtr->setField("m_childPdx", (CacheablePtr)childpdxobjPtr);
LOGINFO("childPdx seField done");
rptr->put(keyport1, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport1));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport1));
LOGINFO("ChildPdx object put get done");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
newPiPtr->getField("m_childPdx", childObjPtr);
- ASSERT(childObjPtr != NULLPTR, "childObjPtr should not be NULL");
+ ASSERT(childObjPtr != nullptr, "childObjPtr should not be NULL");
LOGINFO("got childPdx field ");
- PdxInstancePtr cpi1 = dynCast<PdxInstancePtr>(childObjPtr);
- ASSERT((*cpi.ptr() == *cpi1.ptr()) == false,
+ auto cpi1 = std::dynamic_pointer_cast<PdxInstance>(childObjPtr);
+ ASSERT((*cpi.get() == *cpi1.get()) == false,
"PdxInstance should not be equal");
- ChildPdxPtr cpo = dynCast<ChildPdxPtr>(cpi1->getObject());
+ auto cpo = std::dynamic_pointer_cast<ChildPdx>(cpi1->getObject());
LOGINFO("got childPdx getObject ");
- ASSERT((cpo.ptr()->equals(*childpdxobjPtr.ptr())) == true,
+ ASSERT((cpo.get()->equals(*childpdxobjPtr.get())) == true,
"child pdx should be equal");
char parentCharVal = ' ';
@@ -1936,7 +1930,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance)
wpiPtr = pIPtr->createWriter();
wpiPtr->setField("m_char", parentCharSetVal);
rptr->put(keyport1, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport1));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport1));
ASSERT(newPiPtr->hasField("m_char") == true, "m_char = true expected");
newPiPtr->getField("m_char", parentCharVal);
ASSERT(parentCharVal == parentCharSetVal, "char is not equal");
@@ -1946,7 +1940,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance)
wpiPtr = pIPtr->createWriter();
wpiPtr->setField("m_wideChar", parentWideCharSetVal);
rptr->put(keyport1, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport1));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport1));
ASSERT(newPiPtr->hasField("m_wideChar") == true,
"m_wideChar = true expected");
newPiPtr->getField("m_wideChar", parentWideCharVal);
@@ -1957,7 +1951,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance)
wchar_t* getParentWideCharArray = NULL;
wpiPtr->setField("m_wideCharArray", setParentWideCharArray, 4);
rptr->put(keyport1, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport1));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport1));
ASSERT(newPiPtr->hasField("m_wideCharArray") == true,
"m_wideCharArray = true expected");
newPiPtr->getField("m_wideCharArray", &getParentWideCharArray, arrayLen);
@@ -1970,7 +1964,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstance)
wchar_t* getParentCharArray = NULL;
wpiPtr->setField("m_charArray", setParentCharArray, 4);
rptr->put(keyport1, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport1));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport1));
ASSERT(newPiPtr->hasField("m_charArray") == true,
"m_charArray = true expected");
newPiPtr->getField("m_charArray", &getParentCharArray, arrayLen);
@@ -1989,11 +1983,11 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstanceAndCheckLocally)
RegionPtr rptr = getHelper()->getRegion(regionNames[0]);
CacheableKeyPtr keyport = CacheableKey::create("pdxput");
- PdxInstancePtr pIPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ auto pIPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
LOG("modifyPdxInstanceAndCheckLocally get complete.");
LOG("Statistics for for (PdxTests.PdxType) PdxInstance ");
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(rptr.ptr()));
+ LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(rptr.get()));
LOGINFO(
"pdxInstanceDeserializations for (PdxTests.PdxType) PdxInstance = %d ",
@@ -2019,7 +2013,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstanceAndCheckLocally)
WritablePdxInstancePtr wpiPtr(pIPtr->createWriter());
- ASSERT(pIPtr != NULLPTR, "pIPtr != NULLPTR expected");
+ ASSERT(pIPtr != nullptr, "pIPtr != nullptr expected");
int val = 0;
int newVal = 0;
ASSERT(pIPtr->hasField("m_int32") == true, "m_int32 = true expected");
@@ -2030,13 +2024,13 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstanceAndCheckLocally)
wpiPtr->setField("m_int32", val + 1);
rptr->put(keyport, wpiPtr);
LOG("modifyPdxInstanceAndCheckLocally put complete.");
- PdxInstancePtr newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ auto newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
LOG("modifyPdxInstanceAndCheckLocally get complete.");
ASSERT(newPiPtr->hasField("m_int32") == true, "m_id1 = true expected");
newPiPtr->getField("m_int32", newVal);
LOGINFO("PdxInstance newVal is %d ", newVal);
ASSERT(val + 1 == newVal, "val + 1 == newVal expected");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
int arrayLen = 0;
@@ -2044,98 +2038,98 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstanceAndCheckLocally)
bool* getBoolArray = NULL;
wpiPtr->setField("m_boolArray", setBoolArray, 8);
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(pIPtr->hasField("m_boolArray") == true,
"m_boolArray = true expected");
newPiPtr->getField("m_boolArray", &getBoolArray, arrayLen);
ASSERT(arrayLen == 8, "Arraylength == 8 expected");
ASSERT(genericCompare(setBoolArray, getBoolArray, arrayLen) == true,
"boolArray should be equal");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
signed char setByteArray[] = {0x34, 0x64, 0x34, 0x64};
signed char* getByteArray = NULL;
wpiPtr->setField("m_byteArray", setByteArray, 4);
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(pIPtr->hasField("m_byteArray") == true,
"m_byteArray = true expected");
newPiPtr->getField("m_byteArray", &getByteArray, arrayLen);
ASSERT(arrayLen == 4, "Arraylength == 4 expected");
ASSERT(genericCompare(setByteArray, getByteArray, arrayLen) == true,
"byteArray should be equal");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
int16_t setShortArray[] = {0x2332, 0x4545, 0x88, 0x898};
int16_t* getShortArray = NULL;
wpiPtr->setField("m_int16Array", setShortArray, 4);
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(pIPtr->hasField("m_int16Array") == true,
"m_int16Array = true expected");
newPiPtr->getField("m_int16Array", &getShortArray, arrayLen);
ASSERT(arrayLen == 4, "Arraylength == 4 expected");
ASSERT(genericCompare(setShortArray, getShortArray, arrayLen) == true,
"shortArray should be equal");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
int32_t setIntArray[3] = {23, 676868, 34343};
int32_t* newValArray = NULL;
wpiPtr->setField("m_int32Array", setIntArray, 3);
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(pIPtr->hasField("m_int32Array") == true,
"m_int32Array = true expected");
newPiPtr->getField("m_int32Array", &newValArray, arrayLen);
ASSERT(arrayLen == 3, "Arraylength == 3 expected");
ASSERT(genericCompare(setIntArray, newValArray, arrayLen) == true,
"intArray should be equal");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
int64_t setLongArray[] = {3245435, 3425435};
int64_t* getLongArray = NULL;
wpiPtr->setField("m_longArray", setLongArray, 2);
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(pIPtr->hasField("m_longArray") == true,
"m_longArray = true expected");
newPiPtr->getField("m_longArray", &getLongArray, arrayLen);
ASSERT(arrayLen == 2, "Arraylength == 2 expected");
ASSERT(genericCompare(setLongArray, getLongArray, arrayLen) == true,
"longArray should be equal");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
float setFloatArray[] = {232.565f, 234323354.67f};
float* getFloatArray = NULL;
wpiPtr->setField("m_floatArray", setFloatArray, 2);
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(pIPtr->hasField("m_floatArray") == true,
"m_floatArray = true expected");
newPiPtr->getField("m_floatArray", &getFloatArray, arrayLen);
ASSERT(arrayLen == 2, "Arraylength == 2 expected");
ASSERT(genericCompare(setFloatArray, getFloatArray, arrayLen) == true,
"floatArray should be equal");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
double setDoubleArray[] = {23423432.00, 43242354315.00};
double* getDoubleArray = NULL;
wpiPtr->setField("m_doubleArray", setDoubleArray, 2);
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(pIPtr->hasField("m_doubleArray") == true,
"m_doubleArray = true expected");
newPiPtr->getField("m_doubleArray", &getDoubleArray, arrayLen);
ASSERT(arrayLen == 2, "Arraylength == 2 expected");
ASSERT(genericCompare(setDoubleArray, getDoubleArray, arrayLen) == true,
"doubleArray should be equal");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
bool boolVal = true;
@@ -2144,13 +2138,13 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstanceAndCheckLocally)
LOG("modifyPdxInstanceAndCheckLocally setField bool done.");
rptr->put(keyport, wpiPtr);
LOG("modifyPdxInstanceAndCheckLocally put again complete.");
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(pIPtr->hasField("m_bool") == true, "m_bool = true expected");
LOG("modifyPdxInstanceAndCheckLocally get again complete.");
newPiPtr->getField("m_bool", boolVal);
LOG("modifyPdxInstanceAndCheckLocally getField complete.");
ASSERT(boolVal == false, "bool is not equal");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
wpiPtr = pIPtr->createWriter();
@@ -2158,13 +2152,13 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstanceAndCheckLocally)
LOG("modifyPdxInstanceAndCheckLocally setField bool done.");
rptr->put(keyport, wpiPtr);
LOG("modifyPdxInstanceAndCheckLocally put again complete.");
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(pIPtr->hasField("m_bool") == true, "m_bool = true expected");
LOG("modifyPdxInstanceAndCheckLocally get again complete.");
newPiPtr->getField("m_bool", boolVal);
LOG("modifyPdxInstanceAndCheckLocally getField complete.");
ASSERT(boolVal == true, "bool is not equal");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == true,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == true,
"PdxInstance should be equal");
float fVal = 0.0f;
@@ -2173,14 +2167,14 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstanceAndCheckLocally)
LOG("modifyPdxInstanceAndCheckLocally setField float done.");
rptr->put(keyport, wpiPtr);
LOG("modifyPdxInstanceAndCheckLocally put again complete.");
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(pIPtr->hasField("m_float") == true, "m_float = true expected");
LOG("modifyPdxInstanceAndCheckLocally get again complete.");
newPiPtr->getField("m_float", fVal);
LOGINFO("modifyPdxInstanceAndCheckLocally getField complete. fval = %f",
fVal);
ASSERT(fVal == 18389.34f, "fval is not equal");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
double dVal = 0.0;
@@ -2189,14 +2183,14 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstanceAndCheckLocally)
LOG("modifyPdxInstanceAndCheckLocally setField float done.");
rptr->put(keyport, wpiPtr);
LOG("modifyPdxInstanceAndCheckLocally put again complete.");
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(pIPtr->hasField("m_double") == true, "m_double = true expected");
LOG("modifyPdxInstanceAndCheckLocally get again complete.");
newPiPtr->getField("m_double", dVal);
LOGINFO("modifyPdxInstanceAndCheckLocally getField complete. fval = %lf",
dVal);
ASSERT(dVal == 18389.34, "fval is not equal");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
signed char byteVal = 0;
@@ -2206,14 +2200,14 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstanceAndCheckLocally)
LOG("modifyPdxInstanceAndCheckLocally setField byte done.");
rptr->put(keyport, wpiPtr);
LOG("modifyPdxInstanceAndCheckLocally put again complete.");
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(pIPtr->hasField("m_byte") == true, "m_byte = true expected");
LOG("modifyPdxInstanceAndCheckLocally get again complete.");
newPiPtr->getField("m_byte", byteVal);
LOGINFO("modifyPdxInstanceAndCheckLocally getField complete byteVal = %d ",
byteVal);
ASSERT(byteVal == setSByteVal, "byte is not equal");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == true,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == true,
"PdxInstance should be equal");
int16_t shortVal = 0;
@@ -2222,14 +2216,14 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstanceAndCheckLocally)
LOG("modifyPdxInstanceAndCheckLocally setField short done.");
rptr->put(keyport, wpiPtr);
LOG("modifyPdxInstanceAndCheckLocally put again complete.");
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(pIPtr->hasField("m_int16") == true, "m_int16 = true expected");
LOG("modifyPdxInstanceAndCheckLocally get again complete.");
newPiPtr->getField("m_int16", shortVal);
LOGINFO("modifyPdxInstanceAndCheckLocally getField complete shortVal = %d ",
shortVal);
ASSERT(shortVal == 0x5678, "short is not equal");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
int64_t longVal = 0;
@@ -2238,20 +2232,20 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstanceAndCheckLocally)
LOG("modifyPdxInstanceAndCheckLocally setField short done.");
rptr->put(keyport, wpiPtr);
LOG("modifyPdxInstanceAndCheckLocally put again complete.");
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(pIPtr->hasField("m_long") == true, "m_long = true expected");
LOG("modifyPdxInstanceAndCheckLocally get again complete.");
newPiPtr->getField("m_long", longVal);
LOGINFO("modifyPdxInstanceAndCheckLocally getField complete longVal = %ld ",
longVal);
ASSERT(longVal == 0x56787878, "long is not equal");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
const wchar_t* str = L"change the string";
wpiPtr->setField("m_string", str);
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(pIPtr->hasField("m_string") == true, "m_string = true expected");
wchar_t* stringVal = NULL;
LOG("modifyPdxInstanceAndCheckLocally get string complete.");
@@ -2259,13 +2253,13 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstanceAndCheckLocally)
LOGINFO("modifyPdxInstanceAndCheckLocally stringVal = %ls , str = %ls ",
stringVal, str);
ASSERT(wcscmp(stringVal, str) == 0, "stringVal should be equal");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
const char* str1 = "change the string";
wpiPtr->setField("m_string", str1);
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(pIPtr->hasField("m_string") == true, "m_string = true expected");
char* getstringVal = NULL;
LOG("modifyPdxInstanceAndCheckLocally get string complete.");
@@ -2273,7 +2267,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstanceAndCheckLocally)
LOGINFO("modifyPdxInstanceAndCheckLocally getstringVal = %s , str1 = %s ",
getstringVal, str1);
ASSERT(strcmp(getstringVal, str1) == 0, "getstringVal should be equal");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
CacheableDatePtr dateVal;
@@ -2284,12 +2278,12 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstanceAndCheckLocally)
CacheableDatePtr datePtr = CacheableDate::create(timeofday);
wpiPtr->setField("m_dateTime", datePtr);
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(pIPtr->hasField("m_dateTime") == true, "m_date = true expected");
newPiPtr->getField("m_dateTime", dateVal);
- ASSERT((*(dateVal.ptr()) == *(datePtr.ptr())) == true,
+ ASSERT((*(dateVal.get()) == *(datePtr.get())) == true,
"dateObject should be equal");
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
// wchar_t* setStringArray[] = {L"one", L"two", L"eeeee"};
@@ -2307,7 +2301,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstanceAndCheckLocally)
wchar_t** getWideStringArray = NULL;
wpiPtr->setField("m_stringArray", setWideStringArray, 3);
rptr->put(keyport, wpiPtr);
- newPiPtr = dynCast<PdxInstancePtr>(rptr->get(keyport));
+ newPiPtr = std::dynamic_pointer_cast<PdxInstance>(rptr->get(keyport));
ASSERT(pIPtr->hasField("m_stringArray") == true,
"m_stringArray = true expected");
newPiPtr->getField("m_stringArray", &getWideStringArray, arrayLen);
@@ -2318,7 +2312,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, modifyPdxInstanceAndCheckLocally)
ASSERT(wcscmp(setWideStringArray[i], getWideStringArray[i]) == 0,
"All stringVals should be equal");
}
- ASSERT((*pIPtr.ptr() == *newPiPtr.ptr()) == false,
+ ASSERT((*pIPtr.get() == *newPiPtr.get()) == false,
"PdxInstance should not be equal");
LOG("modifyPdxInstanceAndCheckLocally complete.");
@@ -2359,7 +2353,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, pdxIFPutGetTest)
RegionPtr rptr = getHelper()->getRegion(regionNames[0]);
- PdxTests::PdxTypePtr pdxobj(new PdxTests::PdxType());
+ auto pdxobj = std::make_shared<PdxTests::PdxType>();
PdxInstanceFactoryPtr pifPtr =
cacheHelper->getCache()->createPdxInstanceFactory("PdxTests.PdxType");
@@ -2478,7 +2472,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, pdxIFPutGetTest)
LOG("getObject created....");
LOG("Statistics for for (PdxTests.PdxType) PdxInstance ");
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(rptr.ptr()));
+ LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(rptr.get()));
LOGINFO(
"pdxInstanceDeserializations for (PdxTests.PdxType) PdxInstance = %d ",
@@ -2502,8 +2496,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, pdxIFPutGetTest)
->m_cacheStats->getPdxInstanceDeserializationTime() == 0,
"pdxInstanceDeserializationTime should be equal to 0.");
- PdxTests::PdxType* obj2 = pdxobj.ptr();
- PdxTests::PdxType* obj1 = dynamic_cast<PdxTests::PdxType*>(psPtr.ptr());
+ PdxTests::PdxType* obj2 = pdxobj.get();
+ PdxTests::PdxType* obj1 = dynamic_cast<PdxTests::PdxType*>(psPtr.get());
LOGINFO("Avinash Equal Starts");
ASSERT(obj1->equals(*obj2, false) == true, "PdxObjects should be equal.");
@@ -2513,7 +2507,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, pdxIFPutGetTest)
rptr->put(key, ret);
LOG("put done....");
- PdxSerializablePtr newPiPtr = rptr->get(key);
+ auto newPiPtr = std::dynamic_pointer_cast<PdxSerializable>(rptr->get(key));
LOG("get done....");
LOGINFO(
@@ -2538,7 +2532,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, pdxIFPutGetTest)
->m_cacheStats->getPdxInstanceDeserializationTime() > 0,
"pdxInstanceDeserializationTime should be greater than 0.");
- PdxTests::PdxType* obj3 = dynamic_cast<PdxTests::PdxType*>(newPiPtr.ptr());
+ PdxTests::PdxType* obj3 = dynamic_cast<PdxTests::PdxType*>(newPiPtr.get());
ASSERT(obj2->equals(*obj3, false) == true, "PdxObjects should be equal.");
@@ -2546,9 +2540,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, pdxIFPutGetTest)
LOGINFO("pdxinstance hash code = %d ", pdxInstHashcode);
CacheableKeyPtr javaPdxHCKey = CacheableKey::create("javaPdxHC");
- CacheablePtr pIPtr2 = dynCast<CacheablePtr>(rptr->get(javaPdxHCKey));
+ auto pIPtr2 = std::dynamic_pointer_cast<Cacheable>(rptr->get(javaPdxHCKey));
LOG("In pdxIFPutGetTest get done");
- CacheableInt32* val = dynamic_cast<CacheableInt32*>(pIPtr2.ptr());
+ CacheableInt32* val = dynamic_cast<CacheableInt32*>(pIPtr2.get());
LOG("In pdxIFPutGetTest cast done");
int javaPdxHC = val->value();
LOGINFO("javaPdxHC hash code = %d ", javaPdxHC);
@@ -2556,7 +2550,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, pdxIFPutGetTest)
ASSERT(javaPdxHC == pdxInstHashcode,
"Pdxhashcode hashcode not matched with java pdx hash code.");
- ParentPdxPtr pp(new ParentPdx(10));
+ auto pp = std::make_shared<ParentPdx>(10);
PdxInstanceFactoryPtr if2 =
cacheHelper->getCache()->createPdxInstanceFactory(
"testobject::ParentPdx");
@@ -2584,7 +2578,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, pdxIFPutGetTest)
rptr->put(keyport, ip2);
LOG("put done....");
- newPiPtr = rptr->get(keyport);
+ newPiPtr = std::dynamic_pointer_cast<PdxSerializable>(rptr->get(keyport));
LOG("get done....");
LOGINFO(
@@ -2613,13 +2607,13 @@ DUNIT_TASK_DEFINITION(CLIENT1, pdxIFPutGetTest)
->m_cacheStats->getPdxInstanceDeserializationTime() > 0,
"pdxInstanceDeserializationTime should be greater than 0.");
- ParentPdxPtr pp1 = dynCast<ParentPdxPtr>(newPiPtr);
+ auto pp1 = std::dynamic_pointer_cast<ParentPdx>(newPiPtr);
LOG("got ParentPdxPtr....");
- ParentPdx* rawPP1 = dynamic_cast<ParentPdx*>(pp1.ptr());
+ ParentPdx* rawPP1 = dynamic_cast<ParentPdx*>(pp1.get());
LOG("got rawPP1....");
- ParentPdx* rawPP2 = dynamic_cast<ParentPdx*>(pp.ptr());
+ ParentPdx* rawPP2 = dynamic_cast<ParentPdx*>(pp.get());
LOG("got rawpp2....");
ASSERT(rawPP1->equals(*rawPP2, false) == true,
@@ -2645,10 +2639,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, pdxInstanceWithEmptyKeys)
rptr->put(key, putValue);
LOG("put done with boolean Value and Empty Key....");
- PdxInstancePtr getValue = dynCast<PdxInstancePtr>(rptr->get(key));
+ auto getValue = std::dynamic_pointer_cast<PdxInstance>(rptr->get(key));
LOG("get done with boolean Value and Empty Key....");
- ASSERT(*putValue.ptr() == *getValue.ptr(),
+ ASSERT(*putValue.get() == *getValue.get(),
"Boolean Value Did not match in case of Empty PdxField Key");
bool fieldValue;
getValue->getField("", fieldValue);
[46/46] geode-native git commit: GEODE-2741: Workaround for static
de-init issues with CLR.
Posted by jb...@apache.org.
GEODE-2741: Workaround for static de-init issues with CLR.
Project: http://git-wip-us.apache.org/repos/asf/geode-native/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode-native/commit/767033e5
Tree: http://git-wip-us.apache.org/repos/asf/geode-native/tree/767033e5
Diff: http://git-wip-us.apache.org/repos/asf/geode-native/diff/767033e5
Branch: refs/heads/develop
Commit: 767033e5cfd70b3ad41cac67d63db464b3697a85
Parents: d58a5e3
Author: Jacob Barrett <jb...@pivotal.io>
Authored: Wed May 17 04:09:22 2017 +0000
Committer: Jacob Barrett <jb...@pivotal.io>
Committed: Wed May 17 05:05:51 2017 +0000
----------------------------------------------------------------------
src/cppcache/include/geode/CacheFactory.hpp | 3 +-
src/cppcache/src/CacheFactory.cpp | 14 ++++----
.../src/CacheTransactionManagerImpl.cpp | 4 +--
src/cppcache/src/TXState.cpp | 2 +-
src/cppcache/src/ThinClientStickyManager.cpp | 34 ++++++++++----------
src/cppcache/src/TssConnectionWrapper.cpp | 2 +-
src/cppcache/src/TssConnectionWrapper.hpp | 3 +-
7 files changed, 33 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode-native/blob/767033e5/src/cppcache/include/geode/CacheFactory.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/CacheFactory.hpp b/src/cppcache/include/geode/CacheFactory.hpp
index 5d519bb..b9c149d 100644
--- a/src/cppcache/include/geode/CacheFactory.hpp
+++ b/src/cppcache/include/geode/CacheFactory.hpp
@@ -494,7 +494,8 @@ class CPPCACHE_EXPORT CacheFactory
bool closeOk, CachePtr& cptr);
// Set very first time some creates cache
- static CacheFactoryPtr default_CacheFactory;
+ // TODO shared_ptr - remove or refactor with global work
+ static CacheFactoryPtr* default_CacheFactory;
static PoolPtr createOrGetDefaultPool();
static void* m_cacheMap;
static void init();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/767033e5/src/cppcache/src/CacheFactory.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CacheFactory.cpp b/src/cppcache/src/CacheFactory.cpp
index ec332e5..97a2adf 100644
--- a/src/cppcache/src/CacheFactory.cpp
+++ b/src/cppcache/src/CacheFactory.cpp
@@ -55,7 +55,7 @@ typedef std::map<std::string, CachePtr> StringToCachePtrMap;
void* CacheFactory::m_cacheMap = (void*)NULL;
-CacheFactoryPtr CacheFactory::default_CacheFactory = nullptr;
+CacheFactoryPtr* CacheFactory::default_CacheFactory = nullptr;
PoolPtr CacheFactory::createOrGetDefaultPool() {
ACE_Guard<ACE_Recursive_Thread_Mutex> connectGuard(*g_disconnectLock);
@@ -71,9 +71,10 @@ PoolPtr CacheFactory::createOrGetDefaultPool() {
// if default_poolFactory is null then we are not using latest API....
if (pool == nullptr && Cache_CreatedFromCacheFactory) {
- if (default_CacheFactory != nullptr) {
- pool = default_CacheFactory->determineDefaultPool(cache);
+ if (default_CacheFactory && (*default_CacheFactory)) {
+ pool = (*default_CacheFactory)->determineDefaultPool(cache);
}
+ (*default_CacheFactory) = nullptr;
default_CacheFactory = nullptr;
}
@@ -225,7 +226,7 @@ CachePtr CacheFactory::create() {
cache = getAnyInstance(false);
if (cache == nullptr) {
- default_CacheFactory = shared_from_this();
+ default_CacheFactory = new CacheFactoryPtr(shared_from_this());
Cache_CreatedFromCacheFactory = true;
cache = create(DEFAULT_CACHE_NAME, dsPtr,
dsPtr->getSystemProperties()->cacheXMLFile(), nullptr);
@@ -237,8 +238,9 @@ CachePtr CacheFactory::create() {
determineDefaultPool(cache);
} else {
// not yet created, create from first cacheFactory instance
- if (default_CacheFactory != nullptr) {
- default_CacheFactory->determineDefaultPool(cache);
+ if (default_CacheFactory && (*default_CacheFactory)) {
+ (*default_CacheFactory)->determineDefaultPool(cache);
+ (*default_CacheFactory) = nullptr;
default_CacheFactory = nullptr;
}
determineDefaultPool(cache);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/767033e5/src/cppcache/src/CacheTransactionManagerImpl.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CacheTransactionManagerImpl.cpp b/src/cppcache/src/CacheTransactionManagerImpl.cpp
index bdea6db..58e5a02 100644
--- a/src/cppcache/src/CacheTransactionManagerImpl.cpp
+++ b/src/cppcache/src/CacheTransactionManagerImpl.cpp
@@ -313,7 +313,7 @@ GfErrType CacheTransactionManagerImpl::rollback(TXState* txState,
}
ThinClientPoolDM* CacheTransactionManagerImpl::getDM() {
- TcrConnection* conn = TssConnectionWrapper::s_geodeTSSConn->getConnection();
+ TcrConnection* conn = (*TssConnectionWrapper::s_geodeTSSConn)->getConnection();
if (conn != NULL) {
ThinClientPoolDM* dm = conn->getEndpointObject()->getPoolHADM();
if (dm != NULL) {
@@ -334,7 +334,7 @@ TransactionIdPtr CacheTransactionManagerImpl::suspend() {
}
// get the current connection that this transaction is using
- TcrConnection* conn = TssConnectionWrapper::s_geodeTSSConn->getConnection();
+ TcrConnection* conn = (*TssConnectionWrapper::s_geodeTSSConn)->getConnection();
if (conn == NULL) {
LOGFINE("Thread local connection is null. Returning NULL transaction Id.");
return nullptr;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/767033e5/src/cppcache/src/TXState.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/TXState.cpp b/src/cppcache/src/TXState.cpp
index 89f327a..ad81186 100644
--- a/src/cppcache/src/TXState.cpp
+++ b/src/cppcache/src/TXState.cpp
@@ -110,7 +110,7 @@ void TXState::releaseStickyConnection() {
// Since this is called during cleanup or through destructor, we should not
// throw exception from here,
// which can cause undefined cleanup.
- TcrConnection* conn = TssConnectionWrapper::s_geodeTSSConn->getConnection();
+ TcrConnection* conn = (*TssConnectionWrapper::s_geodeTSSConn)->getConnection();
if (conn != NULL) {
ThinClientPoolDM* dm = conn->getEndpointObject()->getPoolHADM();
if (dm != NULL) {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/767033e5/src/cppcache/src/ThinClientStickyManager.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ThinClientStickyManager.cpp b/src/cppcache/src/ThinClientStickyManager.cpp
index cfac1db..af6ce46 100644
--- a/src/cppcache/src/ThinClientStickyManager.cpp
+++ b/src/cppcache/src/ThinClientStickyManager.cpp
@@ -23,7 +23,7 @@ bool ThinClientStickyManager::getStickyConnection(
bool maxConnLimit = false;
bool connFound = false;
// ACE_Guard<ACE_Recursive_Thread_Mutex> guard( m_stickyLock );
- conn = TssConnectionWrapper::s_geodeTSSConn->getConnection();
+ conn = (*TssConnectionWrapper::s_geodeTSSConn)->getConnection();
if (!conn) {
conn =
@@ -50,34 +50,34 @@ bool ThinClientStickyManager::getStickyConnection(
void ThinClientStickyManager::getSingleHopStickyConnection(
TcrEndpoint* theEP, TcrConnection*& conn) {
- conn = TssConnectionWrapper::s_geodeTSSConn->getSHConnection(theEP,
+ conn = (*TssConnectionWrapper::s_geodeTSSConn)->getSHConnection(theEP,
m_dm->getName());
}
void ThinClientStickyManager::addStickyConnection(TcrConnection* conn) {
ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_stickyLock);
TcrConnection* oldConn =
- TssConnectionWrapper::s_geodeTSSConn->getConnection();
+ (*TssConnectionWrapper::s_geodeTSSConn)->getConnection();
if (oldConn) {
std::set<TcrConnection**>::iterator it = m_stickyConnList.find(
- TssConnectionWrapper::s_geodeTSSConn->getConnDoublePtr());
+ (*TssConnectionWrapper::s_geodeTSSConn)->getConnDoublePtr());
if (it != m_stickyConnList.end()) {
oldConn->setAndGetBeingUsed(false, false);
m_stickyConnList.erase(it);
PoolPtr p = nullptr;
- TssConnectionWrapper::s_geodeTSSConn->setConnection(NULL, p);
+ (*TssConnectionWrapper::s_geodeTSSConn)->setConnection(NULL, p);
m_dm->put(oldConn, false);
}
}
if (conn) {
- TssConnectionWrapper::s_geodeTSSConn->setConnection(
+ (*TssConnectionWrapper::s_geodeTSSConn)->setConnection(
conn, m_dm->shared_from_this());
conn->setAndGetBeingUsed(true, true); // this is done for transaction
// thread when some one resume
// transaction
m_stickyConnList.insert(
- TssConnectionWrapper::s_geodeTSSConn->getConnDoublePtr());
+ (*TssConnectionWrapper::s_geodeTSSConn)->getConnDoublePtr());
}
}
@@ -86,21 +86,21 @@ void ThinClientStickyManager::setStickyConnection(TcrConnection* conn,
// ACE_Guard<ACE_Recursive_Thread_Mutex> guard( m_stickyLock );
if (!conn) {
ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_stickyLock);
- TssConnectionWrapper::s_geodeTSSConn->setConnection(
+ (*TssConnectionWrapper::s_geodeTSSConn)->setConnection(
NULL, m_dm->shared_from_this());
} else {
TcrConnection* currentConn =
- TssConnectionWrapper::s_geodeTSSConn->getConnection();
+ (*TssConnectionWrapper::s_geodeTSSConn)->getConnection();
if (currentConn != conn) // otherwsie no need to set it again
{
ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_stickyLock);
- TssConnectionWrapper::s_geodeTSSConn->setConnection(
+ (*TssConnectionWrapper::s_geodeTSSConn)->setConnection(
conn, m_dm->shared_from_this());
conn->setAndGetBeingUsed(
false,
forTransaction); // if transaction then it will keep this as used
m_stickyConnList.insert(
- TssConnectionWrapper::s_geodeTSSConn->getConnDoublePtr());
+ (*TssConnectionWrapper::s_geodeTSSConn)->getConnDoublePtr());
} else {
currentConn->setAndGetBeingUsed(
false,
@@ -111,7 +111,7 @@ void ThinClientStickyManager::setStickyConnection(TcrConnection* conn,
void ThinClientStickyManager::setSingleHopStickyConnection(
TcrEndpoint* ep, TcrConnection*& conn) {
- TssConnectionWrapper::s_geodeTSSConn->setSHConnection(ep, conn);
+ (*TssConnectionWrapper::s_geodeTSSConn)->setSHConnection(ep, conn);
}
void ThinClientStickyManager::cleanStaleStickyConnection() {
@@ -188,11 +188,11 @@ bool ThinClientStickyManager::canThisConnBeDeleted(TcrConnection* conn) {
return canBeDeleted;
}
void ThinClientStickyManager::releaseThreadLocalConnection() {
- TcrConnection* conn = TssConnectionWrapper::s_geodeTSSConn->getConnection();
+ TcrConnection* conn = (*TssConnectionWrapper::s_geodeTSSConn)->getConnection();
if (conn) {
ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_stickyLock);
std::set<TcrConnection**>::iterator it = m_stickyConnList.find(
- TssConnectionWrapper::s_geodeTSSConn->getConnDoublePtr());
+ (*TssConnectionWrapper::s_geodeTSSConn)->getConnDoublePtr());
LOGDEBUG("ThinClientStickyManager::releaseThreadLocalConnection()");
if (it != m_stickyConnList.end()) {
m_stickyConnList.erase(it);
@@ -200,10 +200,10 @@ void ThinClientStickyManager::releaseThreadLocalConnection() {
false); // now this can be used by next one
m_dm->put(conn, false);
}
- TssConnectionWrapper::s_geodeTSSConn->setConnection(
+ (*TssConnectionWrapper::s_geodeTSSConn)->setConnection(
NULL, m_dm->shared_from_this());
}
- TssConnectionWrapper::s_geodeTSSConn->releaseSHConnections(
+ (*TssConnectionWrapper::s_geodeTSSConn)->releaseSHConnections(
m_dm->shared_from_this());
}
bool ThinClientStickyManager::isNULL(TcrConnection** conn) {
@@ -213,5 +213,5 @@ bool ThinClientStickyManager::isNULL(TcrConnection** conn) {
void ThinClientStickyManager::getAnyConnection(TcrConnection*& conn) {
conn =
- TssConnectionWrapper::s_geodeTSSConn->getAnyConnection(m_dm->getName());
+ (*TssConnectionWrapper::s_geodeTSSConn)->getAnyConnection(m_dm->getName());
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/767033e5/src/cppcache/src/TssConnectionWrapper.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/TssConnectionWrapper.cpp b/src/cppcache/src/TssConnectionWrapper.cpp
index a30cc3d..edf510e 100644
--- a/src/cppcache/src/TssConnectionWrapper.cpp
+++ b/src/cppcache/src/TssConnectionWrapper.cpp
@@ -18,7 +18,7 @@
#include "TcrConnection.hpp"
#include "ThinClientPoolDM.hpp"
using namespace apache::geode::client;
-ACE_TSS<TssConnectionWrapper> TssConnectionWrapper::s_geodeTSSConn;
+ACE_TSS<TssConnectionWrapper>* TssConnectionWrapper::s_geodeTSSConn = new ACE_TSS<TssConnectionWrapper>();
TssConnectionWrapper::TssConnectionWrapper() {
PoolPtr p = nullptr;
m_pool = p;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/767033e5/src/cppcache/src/TssConnectionWrapper.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/TssConnectionWrapper.hpp b/src/cppcache/src/TssConnectionWrapper.hpp
index e37d062..e808bde 100644
--- a/src/cppcache/src/TssConnectionWrapper.hpp
+++ b/src/cppcache/src/TssConnectionWrapper.hpp
@@ -58,7 +58,8 @@ class TssConnectionWrapper {
TssConnectionWrapper(const TssConnectionWrapper&);
public:
- static ACE_TSS<TssConnectionWrapper> s_geodeTSSConn;
+ // TODO shared_ptr - remove or refactor with global work
+ static ACE_TSS<TssConnectionWrapper>* s_geodeTSSConn;
TcrConnection* getConnection() { return m_tcrConn; }
TcrConnection* getSHConnection(TcrEndpoint* ep, const char* poolname);
void setConnection(TcrConnection* conn, const PoolPtr& pool) {
[25/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from cppcache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientCQ.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientCQ.hpp b/src/cppcache/integration-test/ThinClientCQ.hpp
index 4067e6d..b0533f0 100644
--- a/src/cppcache/integration-test/ThinClientCQ.hpp
+++ b/src/cppcache/integration-test/ThinClientCQ.hpp
@@ -40,7 +40,7 @@ const char* locatorsG =
void createRegionForCQ(const char* name, bool ackMode,
bool clientNotificationEnabled = false,
int redundancyLevel = 0,
- const CacheListenerPtr& listener = NULLPTR,
+ const CacheListenerPtr& listener = nullptr,
bool caching = true) {
// Use region name as pool name to avoid recreating pools with the same name.
getHelper()->createPoolWithLocators(
@@ -51,7 +51,7 @@ void createRegionForCQ(const char* name, bool ackMode,
void createRegionForCQMU(const char* name, bool ackMode,
bool clientNotificationEnabled = false,
int redundancyLevel = 0,
- const CacheListenerPtr& listener = NULLPTR,
+ const CacheListenerPtr& listener = nullptr,
bool caching = true,
bool poolIsInMultiuserMode = false) {
// Use region name as pool name to avoid recreating pools with the same name.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientCallbackArg.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientCallbackArg.hpp b/src/cppcache/integration-test/ThinClientCallbackArg.hpp
index 0eb79b6..f1f3823 100644
--- a/src/cppcache/integration-test/ThinClientCallbackArg.hpp
+++ b/src/cppcache/integration-test/ThinClientCallbackArg.hpp
@@ -67,9 +67,9 @@ void createClientPooledLocatorRegion() {
"writer");
createPooledRegion(regionNames[0], false, locatorsG, poolName, true,
regListener, true);
- regWriter = new TallyWriter();
+ regWriter = std::make_shared<TallyWriter>();
setCacheWriter(regionNames[0], regWriter);
- regListener = new TallyListener();
+ regListener = std::make_shared<TallyListener>();
setCacheListener(regionNames[0], regListener);
regWriter->setCallBackArg(key0);
regListener->setCallBackArg(key0);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientDistOps.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientDistOps.hpp b/src/cppcache/integration-test/ThinClientDistOps.hpp
index 028b463..eb3c0e0 100644
--- a/src/cppcache/integration-test/ThinClientDistOps.hpp
+++ b/src/cppcache/integration-test/ThinClientDistOps.hpp
@@ -110,7 +110,7 @@ void _verifyEntry(const char* name, const char* key, const char* val,
free(buf);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
CacheableKeyPtr keyPtr = createKey(key);
@@ -148,10 +148,9 @@ void _verifyEntry(const char* name, const char* key, const char* val,
}
if (val != NULL) {
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
- ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null.");
+ ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
sprintf(buf, "In verify loop, get returned %s for key %s",
checkPtr->asChar(), key);
@@ -205,9 +204,9 @@ void createRegion(const char* name, bool ackMode, const char* endpoints,
fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
fflush(stdout);
RegionPtr regPtr =
- getHelper()->createRegion(name, ackMode, cachingEnable, NULLPTR,
+ getHelper()->createRegion(name, ackMode, cachingEnable, nullptr,
endpoints, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
void createPooledRegion(const char* name, bool ackMode, const char* locators,
@@ -220,7 +219,7 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators,
RegionPtr regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
@@ -234,7 +233,7 @@ void createPooledRegionSticky(const char* name, bool ackMode,
RegionPtr regPtr = getHelper()->createPooledRegionSticky(
name, ackMode, locators, poolname, cachingEnable,
clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
@@ -248,7 +247,7 @@ void createEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
@@ -265,31 +264,30 @@ void createEntry(const char* name, const char* key, const char* value) {
void createAndVerifyEntry(const char* name) {
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
/*1. create new entry with long key and long value */
int64_t int64Key = 9223372036854775807LL; // INT64_MAX
int64_t in64Value = 9223372036854775807LL; // INT64_MAX
regPtr->create(int64Key, in64Value);
- CacheableInt64Ptr longRetValue =
- dynCast<CacheableInt64Ptr>(regPtr->get(int64Key));
+ auto longRetValue = std::dynamic_pointer_cast<CacheableInt64>(regPtr->get(int64Key));
ASSERT(in64Value == longRetValue->value(),
"longRetValue and longvalue should match");
int64_t int64Key1 = 9223372036854775807LL;
try {
regPtr->create(int64Key1, in64Value);
- CacheableInt64Ptr longRetValue =
- dynCast<CacheableInt64Ptr>(regPtr->get(int64Key));
+ auto longRetValue = std::dynamic_pointer_cast<CacheableInt64>(regPtr->get(int64Key));
FAIL("Expected EntryExistException here");
- } catch (EntryExistsException e) {
+ } catch (EntryExistsException& e) {
LOG(" Expected EntryExistsException exception thrown by localCreate");
}
/*2.create new entry with long key and string value*/
int64_t int64KeyMin = -9223372036854775807LL - 1LL; // INT64_MIN
regPtr->create(int64KeyMin, "testvalue");
- CacheableStringPtr strRetValue = regPtr->get(int64KeyMin);
+ auto strRetValue =
+ std::dynamic_pointer_cast<CacheableString>(regPtr->get(int64KeyMin));
ASSERT(strcmp(strRetValue->asChar(), "testvalue") == 0,
"strRetValue and 'testvalue' should match");
@@ -300,7 +298,7 @@ void createAndVerifyEntry(const char* name) {
regPtr->create(x, 1);
LOG("Entry with null key and value created successfully");
FAIL("Expected IllegalArgumentException here");
- } catch (IllegalArgumentException ex) {
+ } catch (IllegalArgumentException& ex) {
LOGINFO("Expected IllegalArgumentException : %s", ex.getMessage());
}
@@ -308,7 +306,7 @@ void createAndVerifyEntry(const char* name) {
try {
regPtr->create(x, "testvalue");
FAIL("Expected IllegalArgumentException here");
- } catch (IllegalArgumentException ex) {
+ } catch (IllegalArgumentException& ex) {
LOGINFO("Expected IllegalArgumentException : %s", ex.getMessage());
}
@@ -316,7 +314,7 @@ void createAndVerifyEntry(const char* name) {
* cacheableInt,CacheableDouble, CacheableString,CacheableHashMap etc) key and
* null value*/
// Serializable::registerPdxType(PdxTests::PdxType::createDeserializable);
- CacheableKeyPtr keyObject1(new PdxTests::PdxType());
+ auto keyObject1 = std::make_shared<PdxTests::PdxType>();
regPtr->create(keyObject1, x);
CacheablePtr retVal = regPtr->get(keyObject1);
ASSERT(retVal == x, "retVal and x should match.");
@@ -324,27 +322,28 @@ void createAndVerifyEntry(const char* name) {
/*6.create new with entry userobject cantain all cacheable type ( like
* cacheableInt,CacheableDouble, CacheableString,CacheableHashMap etc) key and
* int value*/
- CacheableKeyPtr keyObject2(new PdxTests::PdxType());
+ auto keyObject2 = std::make_shared<PdxTests::PdxType>();
regPtr->create(keyObject2, 1);
- CacheableInt32Ptr intVal = regPtr->get(keyObject2);
+ auto intVal =
+ std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(keyObject2));
ASSERT(intVal->value() == 1, "intVal should be 1.");
regPtr->invalidate(keyObject2);
- intVal = dynCast<CacheableInt32Ptr>(regPtr->get(keyObject2));
- ASSERT(intVal == NULLPTR, "intVal should be null.");
+ intVal = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(keyObject2));
+ ASSERT(intVal == nullptr, "intVal should be null.");
try {
if (regPtr->containsKey(keyObject2)) {
regPtr->create(keyObject2, in64Value);
FAIL("Expected EntryExistException here");
}
- } catch (EntryExistsException e) {
+ } catch (EntryExistsException& e) {
LOG(" Expected EntryExistsException exception thrown by localCreate");
}
/*7.create new with entry userobject cantain all cacheable type ( like
* cacheableInt,CacheableDouble, CacheableString,CacheableHashMap etc) key and
* string value*/
- CacheableKeyPtr keyObject3(new PdxTests::PdxType());
+ auto keyObject3 = std::make_shared<PdxTests::PdxType>();
regPtr->create(keyObject3, "testString");
CacheablePtr strVal = regPtr->get(keyObject3);
ASSERT(strcmp(strVal->toString()->asChar(), "testString") == 0,
@@ -355,11 +354,11 @@ void createAndVerifyEntry(const char* name) {
* userobject
* cantain all cacheable type ( like cacheableInt,CacheableDouble,
* CacheableString,CacheableHashMap etc) value*/
- CacheableKeyPtr keyObject4(new PdxTests::PdxType());
- PdxTests::PdxTypePtr valObject(new PdxTests::PdxType());
+ auto keyObject4 = std::make_shared<PdxTests::PdxType>();
+ auto valObject = std::make_shared<PdxTests::PdxType>();
regPtr->create(keyObject4, valObject);
PdxTests::PdxTypePtr objVal =
- dynCast<PdxTests::PdxTypePtr>(regPtr->get(keyObject4));
+ std::dynamic_pointer_cast<PdxTests::PdxType>(regPtr->get(keyObject4));
ASSERT(valObject == objVal, "valObject and objVal should match.");
/*9.create new entry witn non serialize object. IllegalArgumentException
@@ -424,7 +423,7 @@ void updateEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
ASSERT(regPtr->containsValueForKey(keyPtr),
@@ -449,12 +448,11 @@ void doGetAgain(const char* name, const char* key, const char* value) {
RegionPtr regPtr = getHelper()->getRegion(name);
fprintf(stdout, "get region name%s\n", regPtr->getName());
fflush(stdout);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); // force a netsearch
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr)); // force a netsearch
- if (checkPtr != NULLPTR) {
+ if (checkPtr != nullptr) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In doGetAgain, get returned %s for key %s",
@@ -481,7 +479,7 @@ void doNetsearch(const char* name, const char* key, const char* value) {
RegionPtr regPtr = getHelper()->getRegion(name);
fprintf(stdout, "netsearch region %s\n", regPtr->getName());
fflush(stdout);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
if (count == 0) {
ASSERT(!regPtr->containsKey(keyPtr),
@@ -490,10 +488,9 @@ void doNetsearch(const char* name, const char* key, const char* value) {
"Value should not have been found in region.");
count++;
}
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); // force a netsearch
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr)); // force a netsearch
- if (checkPtr != NULLPTR) {
+ if (checkPtr != nullptr) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
@@ -783,7 +780,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepEight_Pool_Sticky)
reg0->localInvalidate(createKey(keys[1]));
reg1->localInvalidate(createKey(keys[3]));
PoolPtr pool = PoolManager::find("__TESTPOOL1_");
- ASSERT(pool != NULLPTR, "Pool Should have been found");
+ ASSERT(pool != nullptr, "Pool Should have been found");
doNetsearch(regionNames[0], keys[1], nvals[1]);
doNetsearch(regionNames[1], keys[3], nvals[3]);
pool->releaseThreadLocalConnection();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientDistOps2.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientDistOps2.hpp b/src/cppcache/integration-test/ThinClientDistOps2.hpp
index f8dfbf1..6e1f851 100644
--- a/src/cppcache/integration-test/ThinClientDistOps2.hpp
+++ b/src/cppcache/integration-test/ThinClientDistOps2.hpp
@@ -94,7 +94,7 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, CreateClient1Regions_Pooled_Locator)
{
initClientWithPool(true, "__TEST_POOL1__", locatorsG, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
createPooledRegion(_regionNames[0], USE_ACK, locatorsG, poolName);
createPooledRegion(_regionNames[1], NO_ACK, locatorsG, poolName);
LOG("CreateClient1Regions complete.");
@@ -104,7 +104,7 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT2, CreateClient2Regions_Pooled_Locator)
{
initClientWithPool(true, "__TEST_POOL1__", locatorsG, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
createPooledRegion(_regionNames[0], USE_ACK, locatorsG, poolName);
createPooledRegion(_regionNames[1], NO_ACK, locatorsG, poolName);
LOG("CreateClient1Regions complete.");
@@ -160,27 +160,27 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1GetAll)
// test invalid combination with caching disabled for getAll
reg0->localDestroyRegion();
- reg0 = NULLPTR;
+ reg0 = nullptr;
getHelper()->createPooledRegion(regionNames[0], USE_ACK, 0,
"__TEST_POOL1__", false, false);
reg0 = getHelper()->getRegion(_regionNames[0]);
keys0.push_back(key0);
keys0.push_back(key1);
try {
- reg0->getAll(keys0, NULLPTR, NULLPTR, true);
+ reg0->getAll(keys0, nullptr, nullptr, true);
FAIL("Expected IllegalArgumentException");
} catch (const IllegalArgumentException&) {
LOG("Got expected IllegalArgumentException");
}
// re-create region with caching enabled
reg0->localDestroyRegion();
- reg0 = NULLPTR;
+ reg0 = nullptr;
getHelper()->createPooledRegion(regionNames[0], USE_ACK, 0,
"__TEST_POOL1__", true, true);
reg0 = getHelper()->getRegion(_regionNames[0]);
// check for IllegalArgumentException for empty key list
- HashMapOfCacheablePtr values(new HashMapOfCacheable());
- HashMapOfExceptionPtr exceptions(new HashMapOfException());
+ auto values = std::make_shared<HashMapOfCacheable>();
+ auto exceptions = std::make_shared<HashMapOfException>();
keys0.clear();
try {
reg0->getAll(keys0, values, exceptions);
@@ -191,7 +191,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1GetAll)
keys0.push_back(key0);
keys0.push_back(key1);
try {
- reg0->getAll(keys0, NULLPTR, NULLPTR, false);
+ reg0->getAll(keys0, nullptr, nullptr, false);
FAIL("Expected IllegalArgumentException");
} catch (const IllegalArgumentException&) {
LOG("Got expected IllegalArgumentException");
@@ -200,10 +200,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1GetAll)
reg0->getAll(keys0, values, exceptions);
ASSERT(values->size() == 2, "Expected 2 values");
ASSERT(exceptions->size() == 0, "Expected no exceptions");
- CacheableStringPtr val0 =
- dynCast<CacheableStringPtr>(values->operator[](key0));
- CacheableStringPtr val1 =
- dynCast<CacheableStringPtr>(values->operator[](key1));
+ auto val0 = std::dynamic_pointer_cast<CacheableString>(values->operator[](key0));
+ auto val1 = std::dynamic_pointer_cast<CacheableString>(values->operator[](key1));
ASSERT(strcmp(_nvals[0], val0->asChar()) == 0, "Got unexpected value");
ASSERT(strcmp(_nvals[1], val1->asChar()) == 0, "Got unexpected value");
@@ -222,10 +220,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1GetAll)
reg1->getAll(keys1, values, exceptions, true);
ASSERT(values->size() == 2, "Expected 2 values");
ASSERT(exceptions->size() == 0, "Expected no exceptions");
- CacheableStringPtr val2 =
- dynCast<CacheableStringPtr>(values->operator[](key2));
- CacheableStringPtr val3 =
- dynCast<CacheableStringPtr>(values->operator[](key3));
+ auto val2 = std::dynamic_pointer_cast<CacheableString>(values->operator[](key2));
+ auto val3 = std::dynamic_pointer_cast<CacheableString>(values->operator[](key3));
ASSERT(strcmp(_nvals[2], val2->asChar()) == 0, "Got unexpected value");
ASSERT(strcmp(_vals[3], val3->asChar()) == 0, "Got unexpected value");
@@ -239,7 +235,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1GetAll)
// also check with NULL values that region is properly populated
reg1->localInvalidate(key3);
- values = NULLPTR;
+ values = nullptr;
exceptions->clear();
reg1->getAll(keys1, values, exceptions, true);
// now check that the region is properly populated
@@ -262,26 +258,26 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1GetAll_Pool)
// test invalid combination with caching disabled for getAll
reg0->localDestroyRegion();
- reg0 = NULLPTR;
+ reg0 = nullptr;
getHelper()->createRegionAndAttachPool(_regionNames[0], USE_ACK, poolName,
false);
reg0 = getHelper()->getRegion(_regionNames[0]);
keys0.push_back(key0);
keys0.push_back(key1);
try {
- reg0->getAll(keys0, NULLPTR, NULLPTR, true);
+ reg0->getAll(keys0, nullptr, nullptr, true);
FAIL("Expected IllegalArgumentException");
} catch (const IllegalArgumentException&) {
LOG("Got expected IllegalArgumentException");
}
// re-create region with caching enabled
reg0->localDestroyRegion();
- reg0 = NULLPTR;
+ reg0 = nullptr;
getHelper()->createRegionAndAttachPool(_regionNames[0], USE_ACK, poolName);
reg0 = getHelper()->getRegion(_regionNames[0]);
// check for IllegalArgumentException for empty key list
- HashMapOfCacheablePtr values(new HashMapOfCacheable());
- HashMapOfExceptionPtr exceptions(new HashMapOfException());
+ auto values = std::make_shared<HashMapOfCacheable>();
+ auto exceptions = std::make_shared<HashMapOfException>();
keys0.clear();
try {
reg0->getAll(keys0, values, exceptions);
@@ -292,7 +288,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1GetAll_Pool)
keys0.push_back(key0);
keys0.push_back(key1);
try {
- reg0->getAll(keys0, NULLPTR, NULLPTR, false);
+ reg0->getAll(keys0, nullptr, nullptr, false);
FAIL("Expected IllegalArgumentException");
} catch (const IllegalArgumentException&) {
LOG("Got expected IllegalArgumentException");
@@ -301,10 +297,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1GetAll_Pool)
reg0->getAll(keys0, values, exceptions);
ASSERT(values->size() == 2, "Expected 2 values");
ASSERT(exceptions->size() == 0, "Expected no exceptions");
- CacheableStringPtr val0 =
- dynCast<CacheableStringPtr>(values->operator[](key0));
- CacheableStringPtr val1 =
- dynCast<CacheableStringPtr>(values->operator[](key1));
+ auto val0 = std::dynamic_pointer_cast<CacheableString>(values->operator[](key0));
+ auto val1 = std::dynamic_pointer_cast<CacheableString>(values->operator[](key1));
ASSERT(strcmp(_nvals[0], val0->asChar()) == 0, "Got unexpected value");
ASSERT(strcmp(_nvals[1], val1->asChar()) == 0, "Got unexpected value");
@@ -323,10 +317,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1GetAll_Pool)
reg1->getAll(keys1, values, exceptions, true);
ASSERT(values->size() == 2, "Expected 2 values");
ASSERT(exceptions->size() == 0, "Expected no exceptions");
- CacheableStringPtr val2 =
- dynCast<CacheableStringPtr>(values->operator[](key2));
- CacheableStringPtr val3 =
- dynCast<CacheableStringPtr>(values->operator[](key3));
+ auto val2 = std::dynamic_pointer_cast<CacheableString>(values->operator[](key2));
+ auto val3 = std::dynamic_pointer_cast<CacheableString>(values->operator[](key3));
ASSERT(strcmp(_nvals[2], val2->asChar()) == 0, "Got unexpected value");
ASSERT(strcmp(_vals[3], val3->asChar()) == 0, "Got unexpected value");
@@ -340,7 +332,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1GetAll_Pool)
// also check with NULL values that region is properly populated
reg1->localInvalidate(key3);
- values = NULLPTR;
+ values = nullptr;
exceptions->clear();
reg1->getAll(keys1, values, exceptions, true);
// now check that the region is properly populated
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientDurable.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientDurable.hpp b/src/cppcache/integration-test/ThinClientDurable.hpp
index 4b08cbc..06f154a 100644
--- a/src/cppcache/integration-test/ThinClientDurable.hpp
+++ b/src/cppcache/integration-test/ThinClientDurable.hpp
@@ -58,16 +58,16 @@ class OperMonitor : public CacheListener {
m_ops++;
CacheableKeyPtr key = event.getKey();
- CacheableInt32Ptr value = NULLPTR;
+ CacheableInt32Ptr value = nullptr;
try {
- value = dynCast<CacheableInt32Ptr>(event.getNewValue());
+ value = std::dynamic_pointer_cast<CacheableInt32>(event.getNewValue());
} catch (Exception) {
// do nothing.
}
char buff[128] = {'\0'};
- CacheableStringPtr keyPtr = dynCast<CacheableStringPtr>(key);
- if (value != NULLPTR) {
+ auto keyPtr = std::dynamic_pointer_cast<CacheableString>(key);
+ if (value != nullptr) {
sprintf(buff, "Event [%s, %d] called for %s:%s", keyPtr->toString(),
value->value(), m_clientName.c_str(), m_regionName.c_str());
@@ -105,8 +105,8 @@ class OperMonitor : public CacheListener {
for (HashMapOfCacheable::Iterator item = m_map.begin(); item != m_map.end();
item++) {
- CacheableStringPtr keyPtr = dynCast<CacheableStringPtr>(item.first());
- CacheableInt32Ptr valuePtr = dynCast<CacheableInt32Ptr>(item.second());
+ auto keyPtr = std::dynamic_pointer_cast<CacheableString>(item.first());
+ auto valuePtr = std::dynamic_pointer_cast<CacheableInt32>(item.second());
if (strchr(keyPtr->toString(), 'D') == NULL) { /*Non Durable Key */
sprintf(buf,
@@ -147,11 +147,11 @@ void setCacheListener(const char* regName, OperMonitorPtr monitor) {
attrMutator->setCacheListener(monitor);
}
-OperMonitorPtr mon1C1 = NULLPTR;
-OperMonitorPtr mon2C1 = NULLPTR;
+OperMonitorPtr mon1C1 = nullptr;
+OperMonitorPtr mon2C1 = nullptr;
-OperMonitorPtr mon1C2 = NULLPTR;
-OperMonitorPtr mon2C2 = NULLPTR;
+OperMonitorPtr mon1C2 = nullptr;
+OperMonitorPtr mon2C2 = nullptr;
/* Total 10 Keys , alternate durable and non-durable */
const char* mixKeys[] = {"Key-1", "D-Key-1", "L-Key", "LD-Key"};
@@ -225,7 +225,7 @@ void feederUpdate(int value, int ignoreR2 = false) {
DUNIT_TASK_DEFINITION(FEEDER, FeederInit)
{
initClientWithPool(true, "__TEST_POOL1__", locatorsG, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
getHelper()->createPooledRegion(regionNames[0], USE_ACK, locatorsG,
"__TEST_POOL1__", true, true);
getHelper()->createPooledRegion(regionNames[1], USE_ACK, locatorsG,
@@ -236,11 +236,11 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, InitClient1Timeout300)
{
- if (mon1C1 == NULLPTR) {
- mon1C1 = new OperMonitor(durableIds[0], regionNames[0]);
+ if (mon1C1 == nullptr) {
+ mon1C1 = std::make_shared<OperMonitor>(durableIds[0], regionNames[0]);
}
- if (mon2C1 == NULLPTR) {
- mon2C1 = new OperMonitor(durableIds[0], regionNames[1]);
+ if (mon2C1 == nullptr) {
+ mon2C1 = std::make_shared<OperMonitor>(durableIds[0], regionNames[1]);
}
initClientCache(0, 0 /* Redundancy */, 300 /* D Timeout */, mon1C1, mon2C1);
}
@@ -248,11 +248,11 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, InitClient1Timeout30)
{
- if (mon1C1 == NULLPTR) {
- mon1C1 = new OperMonitor(durableIds[0], regionNames[0]);
+ if (mon1C1 == nullptr) {
+ mon1C1 = std::make_shared<OperMonitor>(durableIds[0], regionNames[0]);
}
- if (mon2C1 == NULLPTR) {
- mon2C1 = new OperMonitor(durableIds[0], regionNames[1]);
+ if (mon2C1 == nullptr) {
+ mon2C1 = std::make_shared<OperMonitor>(durableIds[0], regionNames[1]);
}
initClientCache(0, 0 /* Redundancy */, 30 /* D Timeout */, mon1C1, mon2C1);
}
@@ -260,11 +260,11 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, InitClient1DelayedStart)
{
- if (mon1C1 == NULLPTR) {
- mon1C1 = new OperMonitor(durableIds[0], regionNames[0]);
+ if (mon1C1 == nullptr) {
+ mon1C1 = std::make_shared<OperMonitor>(durableIds[0], regionNames[0]);
}
- if (mon2C1 == NULLPTR) {
- mon2C1 = new OperMonitor(durableIds[0], regionNames[1]);
+ if (mon2C1 == nullptr) {
+ mon2C1 = std::make_shared<OperMonitor>(durableIds[0], regionNames[1]);
}
initClientCache(0, 0 /* Redundancy */, 30 /* D Timeout */, mon1C1, mon2C1,
35000 /* Sleep before starting */);
@@ -273,11 +273,11 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT2, InitClient2Timeout300)
{
- if (mon1C2 == NULLPTR) {
- mon1C2 = new OperMonitor(durableIds[1], regionNames[0]);
+ if (mon1C2 == nullptr) {
+ mon1C2 = std::make_shared<OperMonitor>(durableIds[1], regionNames[0]);
}
- if (mon2C2 == NULLPTR) {
- mon2C2 = new OperMonitor(durableIds[1], regionNames[1]);
+ if (mon2C2 == nullptr) {
+ mon2C2 = std::make_shared<OperMonitor>(durableIds[1], regionNames[1]);
}
initClientCache(1, 1 /* Redundancy */, 300 /* D Timeout */, mon1C2, mon2C2);
}
@@ -286,11 +286,11 @@ END_TASK_DEFINITION
// Client 2 don't need to sleep for timeout as C1 does before it
DUNIT_TASK_DEFINITION(CLIENT2, InitClient2Timeout30)
{
- if (mon1C2 == NULLPTR) {
- mon1C2 = new OperMonitor(durableIds[1], regionNames[0]);
+ if (mon1C2 == nullptr) {
+ mon1C2 = std::make_shared<OperMonitor>(durableIds[1], regionNames[0]);
}
- if (mon2C2 == NULLPTR) {
- mon2C2 = new OperMonitor(durableIds[1], regionNames[1]);
+ if (mon2C2 == nullptr) {
+ mon2C2 = std::make_shared<OperMonitor>(durableIds[1], regionNames[1]);
}
initClientCache(1, 1 /* Redundancy */, 30 /* D Timeout */, mon1C2, mon2C2);
}
@@ -469,8 +469,8 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, CloseClient1)
{
- mon1C1 = NULLPTR;
- mon2C1 = NULLPTR;
+ mon1C1 = nullptr;
+ mon2C1 = nullptr;
cleanProc();
LOG("CLIENT1 closed");
}
@@ -478,8 +478,8 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT2, CloseClient2)
{
- mon1C2 = NULLPTR;
- mon2C2 = NULLPTR;
+ mon1C2 = nullptr;
+ mon2C2 = nullptr;
cleanProc();
LOG("CLIENT2 closed");
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientDurableFailover.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientDurableFailover.hpp b/src/cppcache/integration-test/ThinClientDurableFailover.hpp
index f06510e..3085c6b 100644
--- a/src/cppcache/integration-test/ThinClientDurableFailover.hpp
+++ b/src/cppcache/integration-test/ThinClientDurableFailover.hpp
@@ -56,22 +56,22 @@ class OperMonitor : public CacheListener {
m_ops++;
CacheableKeyPtr key = event.getKey();
- CacheableInt32Ptr value = NULLPTR;
+ CacheableInt32Ptr value = nullptr;
try {
- value = dynCast<CacheableInt32Ptr>(event.getNewValue());
+ value = std::dynamic_pointer_cast<CacheableInt32>(event.getNewValue());
} catch (Exception) {
// do nothing.
}
- CacheableStringPtr keyPtr = dynCast<CacheableStringPtr>(key);
- if (keyPtr != NULLPTR && value != NULLPTR) {
+ auto keyPtr = std::dynamic_pointer_cast<CacheableString>(key);
+ if (keyPtr != nullptr && value != nullptr) {
char buf[256] = {'\0'};
sprintf(buf, " Got Key: %s, Value: %d", keyPtr->toString(),
value->value());
LOG(buf);
}
- if (value != NULLPTR) {
+ if (value != nullptr) {
HashMapOfCacheable::Iterator item = m_map.find(key);
if (item != m_map.end()) {
@@ -102,8 +102,8 @@ class OperMonitor : public CacheListener {
for (HashMapOfCacheable::Iterator item = m_map.begin(); item != m_map.end();
item++) {
- CacheableStringPtr keyPtr = dynCast<CacheableStringPtr>(item.first());
- CacheableInt32Ptr valuePtr = dynCast<CacheableInt32Ptr>(item.second());
+ auto keyPtr = std::dynamic_pointer_cast<CacheableString>(item.first());
+ auto valuePtr = std::dynamic_pointer_cast<CacheableInt32>(item.second());
if (strchr(keyPtr->toString(), 'D') == NULL) { /*Non Durable Key */
sprintf(buf,
@@ -144,8 +144,8 @@ void setCacheListener(const char* regName, OperMonitorPtr monitor) {
attrMutator->setCacheListener(monitor);
}
-OperMonitorPtr mon1 = NULLPTR;
-OperMonitorPtr mon2 = NULLPTR;
+OperMonitorPtr mon1 = nullptr;
+OperMonitorPtr mon2 = nullptr;
#include "ThinClientDurableInit.hpp"
#include "ThinClientTasks_C2S2.hpp"
@@ -158,8 +158,8 @@ void initClientCache(int redundancy, int durableTimeout, OperMonitorPtr& mon,
int sleepDuration = 0, int durableIdx = 0) {
if (sleepDuration) SLEEP(sleepDuration);
- if (mon == NULLPTR) {
- mon = new OperMonitor();
+ if (mon == nullptr) {
+ mon = std::make_shared<OperMonitor>();
}
// 35 sec ack interval to ensure primary clears its Q only
@@ -177,12 +177,12 @@ void initClientCache(int redundancy, int durableTimeout, OperMonitorPtr& mon,
// for R =1 it will get a redundancy error
try {
regPtr0->registerRegex(testRegex[0], true);
- } catch (Exception) {
+ } catch (Exception&) {
// do nothing.
}
try {
regPtr0->registerRegex(testRegex[1], false);
- } catch (Exception) {
+ } catch (Exception&) {
// do nothing.
}
}
@@ -234,7 +234,7 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(FEEDER, FeederInit)
{
initClientWithPool(true, "__TEST_POOL1__", locatorsG, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
getHelper()->createPooledRegion(regionNames[0], USE_ACK, locatorsG,
"__TEST_POOL1__", true, true);
LOG("FeederInit complete.");
@@ -304,7 +304,7 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, CloseClient1)
{
- mon1 = NULLPTR;
+ mon1 = nullptr;
cleanProc();
LOG("CLIENT1 closed");
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientDurableInterest.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientDurableInterest.hpp b/src/cppcache/integration-test/ThinClientDurableInterest.hpp
index 24c75e4..b137013 100644
--- a/src/cppcache/integration-test/ThinClientDurableInterest.hpp
+++ b/src/cppcache/integration-test/ThinClientDurableInterest.hpp
@@ -50,7 +50,7 @@ class OperMonitor : public CacheListener {
m_ops++;
CacheableKeyPtr key = event.getKey();
- CacheableInt32Ptr value = dynCast<CacheableInt32Ptr>(event.getNewValue());
+ auto value = std::dynamic_pointer_cast<CacheableInt32>(event.getNewValue());
char buf[256];
sprintf(buf,
@@ -91,8 +91,8 @@ class OperMonitor : public CacheListener {
for (HashMapOfCacheable::Iterator item = m_map.begin(); item != m_map.end();
item++) {
- CacheableStringPtr keyPtr = dynCast<CacheableStringPtr>(item.first());
- CacheableInt32Ptr valuePtr = dynCast<CacheableInt32Ptr>(item.second());
+ auto keyPtr = std::dynamic_pointer_cast<CacheableString>(item.first());
+ auto valuePtr = std::dynamic_pointer_cast<CacheableInt32>(item.second());
if (strchr(keyPtr->toString(), 'D') == NULL) { /*Non Durable Key */
sprintf(buf,
@@ -133,8 +133,8 @@ void setCacheListener(const char* regName, OperMonitorPtr monitor) {
}
void initClientWithIntrest(int ClientIdx, OperMonitorPtr& mon) {
- if (mon == NULLPTR) {
- mon = new OperMonitor;
+ if (mon == nullptr) {
+ mon = std::make_shared<OperMonitor>();
}
initClientAndRegion(0, ClientIdx);
@@ -155,11 +155,11 @@ void initClientWithIntrest(int ClientIdx, OperMonitorPtr& mon) {
void initClientWithIntrest2(int ClientIdx, OperMonitorPtr& monitor1,
OperMonitorPtr& monitor2) {
initClientAndTwoRegionsAndTwoPools(0, ClientIdx, 60);
- if (monitor1 == NULLPTR) {
- monitor1 = new OperMonitor(1);
+ if (monitor1 == nullptr) {
+ monitor1 = std::make_shared<OperMonitor>(1);
}
- if (monitor2 == NULLPTR) {
- monitor2 = new OperMonitor(2);
+ if (monitor2 == nullptr) {
+ monitor2 = std::make_shared<OperMonitor>(2);
}
setCacheListener(regionNames[0], monitor1);
setCacheListener(regionNames[1], monitor2);
@@ -206,7 +206,7 @@ void feederUpdate1(int value) {
DUNIT_TASK_DEFINITION(FEEDER, FeederInit)
{
initClientWithPool(true, "__TEST_POOL1__", locatorsG, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
getHelper()->createPooledRegion(regionNames[0], USE_ACK, locatorsG,
"__TEST_POOL1__", true, true);
getHelper()->createPooledRegion(regionNames[1], NO_ACK, locatorsG,
@@ -324,7 +324,7 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, CloseClient1)
{
- mon1 = NULLPTR;
+ mon1 = nullptr;
cleanProc();
LOG("CLIENT1 closed");
}
@@ -332,8 +332,8 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, CloseClient12)
{
- mon1 = NULLPTR;
- mon2 = NULLPTR;
+ mon1 = nullptr;
+ mon2 = nullptr;
cleanProc();
LOG("CLIENT12 closed");
}
@@ -341,7 +341,7 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT2, CloseClient2)
{
- mon2 = NULLPTR;
+ mon2 = nullptr;
cleanProc();
LOG("CLIENT2 closed");
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientDurableReconnect.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientDurableReconnect.hpp b/src/cppcache/integration-test/ThinClientDurableReconnect.hpp
index f68474e..935dfaa 100644
--- a/src/cppcache/integration-test/ThinClientDurableReconnect.hpp
+++ b/src/cppcache/integration-test/ThinClientDurableReconnect.hpp
@@ -72,7 +72,7 @@ void setCacheListener(const char* regName, OperMonitorPtr monitor) {
attrMutator->setCacheListener(monitor);
}
-OperMonitorPtr mon1 = NULLPTR;
+OperMonitorPtr mon1 = nullptr;
const char* mixKeys[] = {"D-Key-1"};
@@ -82,8 +82,8 @@ const char* mixKeys[] = {"D-Key-1"};
void initClientCache(int redundancy, OperMonitorPtr& mon) {
initClientAndRegion(redundancy, 0, 60000, 1, 300);
- if (mon == NULLPTR) {
- mon = new OperMonitor();
+ if (mon == nullptr) {
+ mon = std::make_shared<OperMonitor>();
}
setCacheListener(regionNames[0], mon);
@@ -138,7 +138,7 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, CloseClient)
{
- mon1 = NULLPTR;
+ mon1 = nullptr;
cleanProc();
LOG("CLIENT1 closed");
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientFailover.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientFailover.hpp b/src/cppcache/integration-test/ThinClientFailover.hpp
index ddc2a72..22d0639 100644
--- a/src/cppcache/integration-test/ThinClientFailover.hpp
+++ b/src/cppcache/integration-test/ThinClientFailover.hpp
@@ -86,7 +86,7 @@ void _verifyEntry(const char* name, const char* key, const char* val,
RegionPtr regPtr = getHelper()->getRegion(name);
LOG("_verifyEntry =================");
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
CacheableKeyPtr keyPtr = createKey(key);
@@ -120,10 +120,9 @@ void _verifyEntry(const char* name, const char* key, const char* val,
}
if (val != NULL) {
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
- ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null.");
+ ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
sprintf(buf, "In verify loop, get returned %s for key %s",
checkPtr->asChar(), key);
@@ -157,8 +156,8 @@ void createRegion(const char* name, bool ackMode, const char* endpoints,
fflush(stdout);
// ack, caching
RegionPtr regPtr = getHelper()->createRegion(
- name, ackMode, true, NULLPTR, endpoints, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ name, ackMode, true, nullptr, endpoints, clientNotificationEnabled);
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
void createPooledRegion(const char* name, bool ackMode, const char* locators,
@@ -171,7 +170,7 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators,
RegionPtr regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
@@ -185,7 +184,7 @@ void createPooledRegionSticky(const char* name, bool ackMode,
RegionPtr regPtr = getHelper()->createPooledRegionSticky(
name, ackMode, locators, poolname, cachingEnable,
clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
@@ -199,7 +198,7 @@ void createEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
@@ -224,7 +223,7 @@ void updateEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
// ASSERT( regPtr->containsValueForKey( keyPtr ), "Value should have been
@@ -250,17 +249,16 @@ void doNetsearch(const char* name, const char* key, const char* value) {
RegionPtr regPtr = getHelper()->getRegion(name);
fprintf(stdout, "netsearch region %s\n", regPtr->getName());
fflush(stdout);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
// ASSERT( !regPtr->containsKey( keyPtr ), "Key should not have been found in
// region." );
// ASSERT( !regPtr->containsValueForKey( keyPtr ), "Value should not have been
// found in region." );
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); // force a netsearch
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr)); // force a netsearch
- if (checkPtr != NULLPTR) {
+ if (checkPtr != nullptr) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientFailover2.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientFailover2.hpp b/src/cppcache/integration-test/ThinClientFailover2.hpp
index e973542..6bffa38 100644
--- a/src/cppcache/integration-test/ThinClientFailover2.hpp
+++ b/src/cppcache/integration-test/ThinClientFailover2.hpp
@@ -88,7 +88,7 @@ void _verifyEntry(const char* name, const char* key, const char* val,
free(buf);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
CacheableKeyPtr keyPtr = createKey(key);
@@ -122,10 +122,9 @@ void _verifyEntry(const char* name, const char* key, const char* val,
}
if (val != NULL) {
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
- ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null.");
+ ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
sprintf(buf, "In verify loop, get returned %s for key %s",
checkPtr->asChar(), key);
@@ -179,8 +178,8 @@ void createRegion(const char* name, bool ackMode, const char* endpoints,
fflush(stdout);
// ack, caching
RegionPtr regPtr = getHelper()->createRegion(
- name, ackMode, true, NULLPTR, endpoints, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ name, ackMode, true, nullptr, endpoints, clientNotificationEnabled);
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
void createPooledRegion(const char* name, bool ackMode, const char* locators,
@@ -193,7 +192,7 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators,
RegionPtr regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
void createEntry(const char* name, const char* key, const char* value) {
@@ -206,7 +205,7 @@ void createEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
@@ -231,7 +230,7 @@ void updateEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
// ASSERT( regPtr->containsValueForKey( keyPtr ), "Value should have been
@@ -257,7 +256,7 @@ void doNetsearch(const char* name, const char* key, const char* value) {
RegionPtr regPtr = getHelper()->getRegion(name);
fprintf(stdout, "netsearch region %s\n", regPtr->getName());
fflush(stdout);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
/*NIL: Changed the asserion due to the change in invalidate.
Now we create new entery for every invalidate event received or
@@ -267,10 +266,9 @@ void doNetsearch(const char* name, const char* key, const char* value) {
ASSERT(!regPtr->containsValueForKey(keyPtr),
"Value should not have been found in region.");
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); // force a netsearch
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr)); // force a netsearch
- if (checkPtr != NULLPTR) {
+ if (checkPtr != nullptr) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
@@ -291,7 +289,7 @@ void invalidateEntry(const char* name, const char* key) {
CacheableKeyPtr keyPtr = CacheableKey::create(key);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
// ASSERT( regPtr->containsValueForKey( keyPtr ), "Value should have been
@@ -312,7 +310,7 @@ void destroyEntry(const char* name, const char* key) {
CacheableKeyPtr keyPtr = CacheableKey::create(key);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
@@ -358,9 +356,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepOne_Pool_Locator)
createPooledRegion(regionNames[1], NO_ACK, locatorsG, "__TEST_POOL1__",
true);
RegionPtr regPtr = getHelper()->getRegion(regionNames[0]);
- regPtr->registerAllKeys(false, NULLPTR, false, false);
+ regPtr->registerAllKeys(false, nullptr, false, false);
regPtr = getHelper()->getRegion(regionNames[1]);
- regPtr->registerAllKeys(false, NULLPTR, false, false);
+ regPtr->registerAllKeys(false, nullptr, false, false);
LOG("StepOne complete.");
}
END_TASK_DEFINITION
@@ -376,9 +374,9 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepTwo_Pool_Locator)
createPooledRegion(regionNames[1], NO_ACK, locatorsG, "__TEST_POOL1__",
true);
RegionPtr regPtr = getHelper()->getRegion(regionNames[0]);
- regPtr->registerAllKeys(false, NULLPTR, false, false);
+ regPtr->registerAllKeys(false, nullptr, false, false);
regPtr = getHelper()->getRegion(regionNames[1]);
- regPtr->registerAllKeys(false, NULLPTR, false, false);
+ regPtr->registerAllKeys(false, nullptr, false, false);
LOG("StepTwo complete.");
}
END_TASK_DEFINITION
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientFailover3.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientFailover3.hpp b/src/cppcache/integration-test/ThinClientFailover3.hpp
index c117f0c..140bf65 100644
--- a/src/cppcache/integration-test/ThinClientFailover3.hpp
+++ b/src/cppcache/integration-test/ThinClientFailover3.hpp
@@ -86,7 +86,7 @@ void _verifyEntry(const char *name, const char *key, const char *val,
free(buf);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
CacheableKeyPtr keyPtr = createKey(key);
@@ -120,10 +120,9 @@ void _verifyEntry(const char *name, const char *key, const char *val,
}
if (val != NULL) {
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
- ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null.");
+ ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
sprintf(buf, "In verify loop, get returned %s for key %s",
checkPtr->asChar(), key);
@@ -160,7 +159,7 @@ void createPooledRegion(const char *name, bool ackMode, const char *locators,
RegionPtr regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
void createEntry(const char *name, const char *key, const char *value) {
@@ -173,7 +172,7 @@ void createEntry(const char *name, const char *key, const char *value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
@@ -198,7 +197,7 @@ void updateEntry(const char *name, const char *key, const char *value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
@@ -222,12 +221,11 @@ void doNetsearch(const char *name, const char *key, const char *value) {
RegionPtr regPtr = getHelper()->getRegion(name);
fprintf(stdout, "netsearch region %s\n", regPtr->getName());
fflush(stdout);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); // force a netsearch
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr)); // force a netsearch
- if (checkPtr != NULLPTR) {
+ if (checkPtr != nullptr) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientFailoverInterest.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientFailoverInterest.hpp b/src/cppcache/integration-test/ThinClientFailoverInterest.hpp
index 687467f..479079f 100644
--- a/src/cppcache/integration-test/ThinClientFailoverInterest.hpp
+++ b/src/cppcache/integration-test/ThinClientFailoverInterest.hpp
@@ -87,7 +87,7 @@ void _verifyEntry(const char* name, const char* key, const char* val,
free(buf);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
CacheableKeyPtr keyPtr = createKey(key);
@@ -137,10 +137,9 @@ void _verifyEntry(const char* name, const char* key, const char* val,
}
if (val != NULL) {
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
- ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null.");
+ ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
sprintf(buf, "In verify loop, get returned %s for key %s",
checkPtr->asChar(), key);
@@ -185,8 +184,8 @@ void createRegion(const char* name, bool ackMode, const char* endpoints,
fflush(stdout);
// ack, not a mirror, caching
RegionPtr regPtr = getHelper()->createRegion(
- name, ackMode, true, NULLPTR, endpoints, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ name, ackMode, true, nullptr, endpoints, clientNotificationEnabled);
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
void createPooledRegion(const char* name, bool ackMode, const char* locators,
@@ -199,7 +198,7 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators,
RegionPtr regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
void createEntry(const char* name, const char* key, const char* value) {
@@ -212,7 +211,7 @@ void createEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
@@ -237,7 +236,7 @@ void updateEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
// ASSERT( regPtr->containsValueForKey( keyPtr ), "Value should have been
@@ -263,17 +262,16 @@ void doNetsearch(const char* name, const char* key, const char* value) {
RegionPtr regPtr = getHelper()->getRegion(name);
fprintf(stdout, "netsearch region %s\n", regPtr->getName());
fflush(stdout);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
// ASSERT( !regPtr->containsKey( keyPtr ), "Key should not have been found in
// region." );
// ASSERT( !regPtr->containsValueForKey( keyPtr ), "Value should not have been
// found in region." );
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); // force a netsearch
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr)); // force a netsearch
- if (checkPtr != NULLPTR) {
+ if (checkPtr != nullptr) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
@@ -333,8 +331,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepTwo_Pool_Locator)
VectorOfCacheableKey keys0, keys1;
keys0.push_back(keyPtr0);
keys1.push_back(keyPtr2);
- regPtr0->registerKeys(keys0, NULLPTR);
- regPtr1->registerKeys(keys1, NULLPTR);
+ regPtr0->registerKeys(keys0);
+ regPtr1->registerKeys(keys1);
LOG("StepTwo complete.");
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientFailoverInterest2.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientFailoverInterest2.hpp b/src/cppcache/integration-test/ThinClientFailoverInterest2.hpp
index d84de3e..4e50c5f 100644
--- a/src/cppcache/integration-test/ThinClientFailoverInterest2.hpp
+++ b/src/cppcache/integration-test/ThinClientFailoverInterest2.hpp
@@ -86,7 +86,7 @@ void _verifyEntry(const char* name, const char* key, const char* val,
free(buf);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
CacheableKeyPtr keyPtr = createKey(key);
@@ -136,10 +136,9 @@ void _verifyEntry(const char* name, const char* key, const char* val,
}
if (val != NULL) {
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
- ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null.");
+ ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
sprintf(buf, "In verify loop, get returned %s for key %s",
checkPtr->asChar(), key);
@@ -184,8 +183,8 @@ void createRegion(const char* name, bool ackMode, const char* endpoints,
fflush(stdout);
// ack, caching
RegionPtr regPtr = getHelper()->createRegion(
- name, ackMode, true, NULLPTR, endpoints, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ name, ackMode, true, nullptr, endpoints, clientNotificationEnabled);
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
void createPooledRegion(const char* name, bool ackMode, const char* locators,
@@ -198,7 +197,7 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators,
RegionPtr regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
void createEntry(const char* name, const char* key, const char* value) {
@@ -211,7 +210,7 @@ void createEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
@@ -236,7 +235,7 @@ void updateEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
// ASSERT( regPtr->containsValueForKey( keyPtr ), "Value should have been
@@ -262,17 +261,16 @@ void doNetsearch(const char* name, const char* key, const char* value) {
RegionPtr regPtr = getHelper()->getRegion(name);
fprintf(stdout, "netsearch region %s\n", regPtr->getName());
fflush(stdout);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
// ASSERT( !regPtr->containsKey( keyPtr ), "Key should not have been found in
// region." );
// ASSERT( !regPtr->containsValueForKey( keyPtr ), "Value should not have been
// found in region." );
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); // force a netsearch
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr)); // force a netsearch
- if (checkPtr != NULLPTR) {
+ if (checkPtr != nullptr) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientFailoverInterestAllWithCache.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientFailoverInterestAllWithCache.hpp b/src/cppcache/integration-test/ThinClientFailoverInterestAllWithCache.hpp
index a479dc3..4b70787 100644
--- a/src/cppcache/integration-test/ThinClientFailoverInterestAllWithCache.hpp
+++ b/src/cppcache/integration-test/ThinClientFailoverInterestAllWithCache.hpp
@@ -52,7 +52,7 @@ const char* locatorsG =
void initClient(const bool isthinClient) {
if (cacheHelper == NULL) {
cacheHelper = new CacheHelper(isthinClient, "__TEST_POOL1__", NULL,
- "ServerGroup1", NULLPTR, 0, true);
+ "ServerGroup1", nullptr, 0, true);
}
ASSERT(cacheHelper, "Failed to create a CacheHelper client instance.");
}
@@ -91,7 +91,7 @@ void _verifyEntry(const char* name, const char* key, const char* val,
free(buf);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
CacheableKeyPtr keyPtr = createKey(key);
@@ -141,10 +141,9 @@ void _verifyEntry(const char* name, const char* key, const char* val,
}
if (val != NULL) {
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
- ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null.");
+ ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
sprintf(buf, "In verify loop, get returned %s for key %s",
checkPtr->asChar(), key);
@@ -188,8 +187,8 @@ void createRegion(const char* name, bool ackMode, const char* endpoints,
LOGINFO("Creating region -- %s ackMode is %d", name, ackMode);
// ack, caching
RegionPtr regPtr = getHelper()->createRegion(
- name, ackMode, true, NULLPTR, endpoints, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ name, ackMode, true, nullptr, endpoints, clientNotificationEnabled);
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
@@ -202,7 +201,7 @@ void createEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
@@ -226,7 +225,7 @@ void updateEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
// ASSERT(regPtr->containsValueForKey(keyPtr),
@@ -248,17 +247,16 @@ void doNetsearch(const char* name, const char* key, const char* value) {
RegionPtr regPtr = getHelper()->getRegion(name);
LOGINFO("netsearch region %s", regPtr->getName());
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
// ASSERT(!regPtr->containsKey(keyPtr),
// "Key should not have been found in region.");
// ASSERT(!regPtr->containsValueForKey(keyPtr),
// "Value should not have been found in region.");
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); // force a netsearch
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr)); // force a netsearch
- if (checkPtr != NULLPTR) {
+ if (checkPtr != nullptr) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
@@ -317,18 +315,18 @@ DUNIT_TASK_DEFINITION(CLIENT2, InitializeClient2)
RegionPtr regPtr0 = getHelper()->getRegion(regionNames[0]);
RegionPtr regPtr1 = getHelper()->getRegion(regionNames[1]);
- VectorOfCacheableKeyPtr resultKeys(new VectorOfCacheableKey());
+ auto resultKeys = std::make_shared<VectorOfCacheableKey>();
// create a local entry to check for no change after register interest
createEntry(regionNames[0], keys[1], nvals[1]);
regPtr0->registerAllKeys(false, resultKeys, true);
- regPtr1->registerAllKeys(false, NULLPTR, true);
+ regPtr1->registerAllKeys(false, nullptr, true);
// check that initial entries are created properly
ASSERT(regPtr0->size() == 1, "Expected one entry in region");
ASSERT(regPtr1->size() == 1, "Expected one entry in region");
ASSERT(resultKeys->size() == 1, "Expected one key from registerAllKeys");
ASSERT(
- strcmp(dynCast<CacheableStringPtr>(resultKeys->operator[](0))->asChar(),
+ strcmp(std::dynamic_pointer_cast<CacheableString>(resultKeys->operator[](0))->asChar(),
keys[1]) == 0,
"Unexpected key from registerAllKeys");
@@ -345,18 +343,18 @@ DUNIT_TASK_DEFINITION(CLIENT2, InitializeClient2Regex)
RegionPtr regPtr0 = getHelper()->getRegion(regionNames[0]);
RegionPtr regPtr1 = getHelper()->getRegion(regionNames[1]);
- VectorOfCacheableKeyPtr resultKeys(new VectorOfCacheableKey());
+ auto resultKeys = std::make_shared<VectorOfCacheableKey>();
// create a local entry to check for no change after register interest
createEntry(regionNames[0], keys[1], nvals[1]);
regPtr0->registerRegex(".*", false, resultKeys, true);
- regPtr1->registerRegex(".*", false, NULLPTR, true);
+ regPtr1->registerRegex(".*", false, nullptr, true);
// check that initial entries are created properly
ASSERT(regPtr0->size() == 1, "Expected one entry in region");
ASSERT(regPtr1->size() == 1, "Expected one entry in region");
ASSERT(resultKeys->size() == 1, "Expected one key from registerAllKeys");
ASSERT(
- strcmp(dynCast<CacheableStringPtr>(resultKeys->operator[](0))->asChar(),
+ strcmp(std::dynamic_pointer_cast<CacheableString>(resultKeys->operator[](0))->asChar(),
keys[1]) == 0,
"Unexpected key from registerAllKeys");
@@ -373,7 +371,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, VerifyClient1)
{
// check the combination of (resultKeys != NULL) and
// (getValues == false) in registerAllKeys
- VectorOfCacheableKeyPtr resultKeys(new VectorOfCacheableKey());
+ auto resultKeys = std::make_shared<VectorOfCacheableKey>();
RegionPtr regPtr0 = getHelper()->getRegion(regionNames[0]);
regPtr0->registerAllKeys(false, resultKeys, false);
@@ -383,7 +381,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, VerifyClient1)
"Expected region to not contain the value");
ASSERT(resultKeys->size() == 1, "Expected one key from registerAllKeys");
ASSERT(
- strcmp(dynCast<CacheableStringPtr>(resultKeys->operator[](0))->asChar(),
+ strcmp(std::dynamic_pointer_cast<CacheableString>(resultKeys->operator[](0))->asChar(),
keys[1]) == 0,
"Unexpected key from registerAllKeys");
@@ -398,7 +396,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, VerifyClient1)
"Expected region to not contain the value");
ASSERT(resultKeys->size() == 1, "Expected one key from registerRegex");
ASSERT(
- strcmp(dynCast<CacheableStringPtr>(resultKeys->operator[](0))->asChar(),
+ strcmp(std::dynamic_pointer_cast<CacheableString>(resultKeys->operator[](0))->asChar(),
keys[3]) == 0,
"Unexpected key from registerRegex");
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientFailoverRegex.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientFailoverRegex.hpp b/src/cppcache/integration-test/ThinClientFailoverRegex.hpp
index a281bf7..37d8149 100644
--- a/src/cppcache/integration-test/ThinClientFailoverRegex.hpp
+++ b/src/cppcache/integration-test/ThinClientFailoverRegex.hpp
@@ -87,7 +87,7 @@ void _verifyEntry(const char* name, const char* key, const char* val,
free(buf);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
CacheableKeyPtr keyPtr = createKey(key);
@@ -137,10 +137,9 @@ void _verifyEntry(const char* name, const char* key, const char* val,
}
if (val != NULL) {
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
- ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null.");
+ ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
sprintf(buf, "In verify loop, get returned %s for key %s",
checkPtr->asChar(), key);
@@ -185,8 +184,8 @@ void createRegion(const char* name, bool ackMode, const char* endpoints,
fflush(stdout);
// ack, caching
RegionPtr regPtr = getHelper()->createRegion(
- name, ackMode, true, NULLPTR, endpoints, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ name, ackMode, true, nullptr, endpoints, clientNotificationEnabled);
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
void createPooledRegion(const char* name, bool ackMode, const char* locators,
@@ -199,7 +198,7 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators,
RegionPtr regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
void createEntry(const char* name, const char* key, const char* value) {
@@ -212,7 +211,7 @@ void createEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
@@ -237,7 +236,7 @@ void updateEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
// ASSERT( regPtr->containsValueForKey( keyPtr ), "Value should have been
@@ -263,17 +262,16 @@ void doNetsearch(const char* name, const char* key, const char* value) {
RegionPtr regPtr = getHelper()->getRegion(name);
fprintf(stdout, "netsearch region %s\n", regPtr->getName());
fflush(stdout);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
// ASSERT( !regPtr->containsKey( keyPtr ), "Key should not have been found in
// region." );
// ASSERT( !regPtr->containsValueForKey( keyPtr ), "Value should not have been
// found in region." );
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); // force a netsearch
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr)); // force a netsearch
- if (checkPtr != NULLPTR) {
+ if (checkPtr != nullptr) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
@@ -340,8 +338,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepTwo_Pool_Locator)
VectorOfCacheableKey keys0,keys1;
keys0.push_back(keyPtr0);
keys1.push_back(keyPtr2);
- regPtr0->registerKeys(keys0, NULLPTR);
- regPtr1->registerKeys(keys1, NULLPTR);
+ regPtr0->registerKeys(keys0, nullptr);
+ regPtr1->registerKeys(keys1, nullptr);
*/
regPtr0->registerRegex(regkeys[0]);
@@ -356,12 +354,12 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
createEntry(regionNames[0], keys[0], vals[0]);
createEntry(regionNames[1], keys[2], vals[2]);
- VectorOfCacheableKeyPtr vec(new VectorOfCacheableKey());
+ auto vec = std::make_shared<VectorOfCacheableKey>();
RegionPtr regPtr1 = getHelper()->getRegion(regionNames[1]);
regPtr1->registerRegex(regkeys[1], false, vec);
ASSERT(vec->size() == 1, "Expected one key after registerRegex");
- CacheableStringPtr key1 = dynCast<CacheableStringPtr>(vec->operator[](0));
+ auto key1 = std::dynamic_pointer_cast<CacheableString>(vec->operator[](0));
ASSERT(strcmp(keys[1], key1->asChar()) == 0,
"Expected key to match in registerRegex");
@@ -392,7 +390,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepFour)
CacheableKeyPtr keyPtr2 = CacheableKey::create(keys[2]);
VectorOfCacheableKey keys2;
keys2.push_back(keyPtr2);
- regPtr1->unregisterKeys(keys2, NULLPTR);
+ regPtr1->unregisterKeys(keys2, nullptr);
*/
LOG("StepFour complete.");
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientGatewayTest.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientGatewayTest.hpp b/src/cppcache/integration-test/ThinClientGatewayTest.hpp
index 7ecd39c..5b8c7c4 100644
--- a/src/cppcache/integration-test/ThinClientGatewayTest.hpp
+++ b/src/cppcache/integration-test/ThinClientGatewayTest.hpp
@@ -102,12 +102,12 @@ DUNIT_TASK_DEFINITION(SERVER2, StartServer2)
}
END_TASK_DEFINITION
-MyListenerPtr reg1Listener1 = NULLPTR;
+MyListenerPtr reg1Listener1 = nullptr;
DUNIT_TASK_DEFINITION(SERVER2, SetupClient2)
{
// CacheHelper ch = getHelper();
- reg1Listener1 = new MyListener();
+ reg1Listener1 = std::make_shared<MyListener>();
RegionPtr regPtr = createPooledRegion("exampleRegion", false, locHostPort2,
"poolName", true, reg1Listener1);
regPtr->registerAllKeys();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientHeapLRU.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientHeapLRU.hpp b/src/cppcache/integration-test/ThinClientHeapLRU.hpp
index ce4ec99..946ccb7 100644
--- a/src/cppcache/integration-test/ThinClientHeapLRU.hpp
+++ b/src/cppcache/integration-test/ThinClientHeapLRU.hpp
@@ -96,8 +96,8 @@ void createRegion(const char* name, bool ackMode, const char* endpoints,
fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
fflush(stdout);
RegionPtr regPtr = getHelper()->createRegion(
- name, ackMode, true, NULLPTR, endpoints, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ name, ackMode, true, nullptr, endpoints, clientNotificationEnabled);
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
@@ -111,7 +111,7 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators,
RegionPtr regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
@@ -125,9 +125,9 @@ void createOnekEntries() {
CacheableWrapperFactory::createInstance(GeodeTypeIds::CacheableBytes);
tmpkey->initKey(i, 32);
tmpval->initRandomValue(1024);
- ASSERT(tmpkey->getCacheable() != NULLPTR, "tmpkey->getCacheable() is NULL");
- ASSERT(tmpval->getCacheable() != NULLPTR, "tmpval->getCacheable() is NULL");
- dataReg->put(dynCast<CacheableKeyPtr>(tmpkey->getCacheable()),
+ ASSERT(tmpkey->getCacheable() != nullptr, "tmpkey->getCacheable() is NULL");
+ ASSERT(tmpval->getCacheable() != nullptr, "tmpval->getCacheable() is NULL");
+ dataReg->put(std::dynamic_pointer_cast<CacheableKey>(tmpkey->getCacheable()),
tmpval->getCacheable());
// delete tmpkey;
// delete tmpval;
[20/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from cppcache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientCq.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientCq.cpp b/src/cppcache/integration-test/testThinClientCq.cpp
index 4ac6da0..8b06484 100644
--- a/src/cppcache/integration-test/testThinClientCq.cpp
+++ b/src/cppcache/integration-test/testThinClientCq.cpp
@@ -381,7 +381,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
PoolPtr pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
// Using region name as pool name as in ThinClientCq.hpp
qs = pool->getQueryService();
} else {
@@ -389,7 +389,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
}
CqAttributesFactory cqFac;
for (i = 0; i < MAX_LISTNER; i++) {
- CqListenerPtr cqLstner(new MyCqListener(i));
+ auto cqLstner = std::make_shared<MyCqListener>(i);
cqFac.addCqListener(cqLstner);
CqAttributesPtr cqAttr = cqFac.create();
CqQueryPtr qry = qs->newCq(cqNames[i], queryStrings[i], cqAttr);
@@ -459,7 +459,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepTwo2)
qh->populatePositionPdxData(subregPtr0, 3, 2);
}
- CacheablePtr port = NULLPTR;
+ CacheablePtr port = nullptr;
for (int i = 1; i < 3; i++) {
if (!m_isPdx) {
port = CacheablePtr(new Portfolio(i, 2));
@@ -483,7 +483,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
PoolPtr pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
// Using region name as pool name as in ThinClientCq.hpp
qs = pool->getQueryService();
} else {
@@ -524,16 +524,16 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
events[j] += cqStats->numEvents();
}
CqAttributesPtr cqAttr = cqy->getCqAttributes();
- VectorOfCqListener vl;
+ std::vector<CqListenerPtr> vl;
cqAttr->getCqListeners(vl);
- sprintf(buf, "number of listeners for cq[%s] is %d", cqNames[i],
+ sprintf(buf, "number of listeners for cq[%s] is %zd", cqNames[i],
vl.size());
LOG(buf);
ASSERT(vl.size() == i + 1, "incorrect number of listeners");
if (i == (MAX_LISTNER - 1)) {
MyCqListener* myLl[MAX_LISTNER];
for (int k = 0; k < MAX_LISTNER; k++) {
- MyCqListener* ml = dynamic_cast<MyCqListener*>(vl[k].ptr());
+ MyCqListener* ml = dynamic_cast<MyCqListener*>(vl[k].get());
myLl[ml->getId()] = ml;
}
for (j = 0; j < MAX_LISTNER; j++) {
@@ -563,7 +563,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
CqListenerPtr ptr = vl[0];
cqAttrMtor->removeCqListener(ptr);
cqAttr->getCqListeners(vl);
- sprintf(buf, "number of listeners for cq[%s] is %d", cqNames[i],
+ sprintf(buf, "number of listeners for cq[%s] is %zd", cqNames[i],
vl.size());
LOG(buf);
ASSERT(vl.size() == i, "incorrect number of listeners");
@@ -604,7 +604,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
cqy = qs->getCq(cqNames[2]);
sprintf(buf, "cq[%s] should have been removed after close!", cqNames[2]);
- ASSERT(cqy == NULLPTR, buf);
+ ASSERT(cqy == nullptr, buf);
} catch (Exception& excp) {
std::string failmsg = "";
failmsg += excp.getName();
@@ -615,7 +615,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
excp.printStackTrace();
}
CqServiceStatisticsPtr serviceStats = qs->getCqServiceStatistics();
- ASSERT(serviceStats != NULLPTR, "serviceStats is NULL");
+ ASSERT(serviceStats != nullptr, "serviceStats is NULL");
sprintf(buf,
"numCqsActive=%d, numCqsCreated=%d, "
"numCqsClosed=%d,numCqsStopped=%d, numCqsOnClient=%d",
@@ -689,7 +689,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
ASSERT(serviceStats->numCqsOnClient() == 0, "cq count incorrect!");
i = 0;
- CqListenerPtr cqLstner(new MyCqListener(i));
+ auto cqLstner = std::make_shared<MyCqListener>(i);
cqFac.addCqListener(cqLstner);
CqAttributesPtr cqAttr = cqFac.create();
try {
@@ -794,7 +794,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, createCQ)
PoolPtr pool = PoolManager::find(regionName);
QueryServicePtr qs = pool->getQueryService();
CqAttributesFactory cqFac;
- CqStatusListenerPtr cqLstner(new MyCqStatusListener(100));
+ auto cqLstner = std::make_shared<MyCqStatusListener>(100);
cqFac.addCqListener(cqLstner);
CqAttributesPtr cqAttr = cqFac.create();
CqQueryPtr cq =
@@ -804,10 +804,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, createCQ)
SLEEP(20000);
cqAttr = cq->getCqAttributes();
- VectorOfCqListener vl;
+ std::vector<CqListenerPtr> vl;
cqAttr->getCqListeners(vl);
MyCqStatusListener* myStatusCq =
- dynamic_cast<MyCqStatusListener*>(vl[0].ptr());
+ dynamic_cast<MyCqStatusListener*>(vl[0].get());
LOGINFO("checkCQStatusOnConnect = %d ", myStatusCq->getCqsConnectedCount());
ASSERT(myStatusCq->getCqsConnectedCount() == 1,
"incorrect number of CqStatus Connected count.");
@@ -820,7 +820,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, createCQ_Pool)
PoolPtr pool = PoolManager::find("__TEST_POOL1__");
QueryServicePtr qs = pool->getQueryService();
CqAttributesFactory cqFac;
- CqStatusListenerPtr cqLstner(new MyCqStatusListener(100));
+ auto cqLstner = std::make_shared<MyCqStatusListener>(100);
cqFac.addCqListener(cqLstner);
CqAttributesPtr cqAttr = cqFac.create();
@@ -830,10 +830,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, createCQ_Pool)
SLEEP(20000);
cqAttr = cq->getCqAttributes();
- VectorOfCqListener vl;
+ std::vector<CqListenerPtr> vl;
cqAttr->getCqListeners(vl);
MyCqStatusListener* myStatusCq =
- dynamic_cast<MyCqStatusListener*>(vl[0].ptr());
+ dynamic_cast<MyCqStatusListener*>(vl[0].get());
LOGINFO("checkCQStatusOnConnect = %d ", myStatusCq->getCqsConnectedCount());
ASSERT(myStatusCq->getCqsConnectedCount() == 1,
"incorrect number of CqStatus Connected count.");
@@ -841,7 +841,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, createCQ_Pool)
PoolPtr pool2 = PoolManager::find("__TEST_POOL2__");
QueryServicePtr qs2 = pool2->getQueryService();
CqAttributesFactory cqFac1;
- CqStatusListenerPtr cqLstner1(new MyCqStatusListener(101));
+ auto cqLstner1 = std::make_shared<MyCqStatusListener>(101);
cqFac1.addCqListener(cqLstner1);
CqAttributesPtr cqAttr1 = cqFac1.create();
CqQueryPtr cq2 =
@@ -850,10 +850,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, createCQ_Pool)
SLEEP(20000);
cqAttr1 = cq2->getCqAttributes();
- VectorOfCqListener vl2;
+ std::vector<CqListenerPtr> vl2;
cqAttr1->getCqListeners(vl2);
MyCqStatusListener* myStatusCq2 =
- dynamic_cast<MyCqStatusListener*>(vl2[0].ptr());
+ dynamic_cast<MyCqStatusListener*>(vl2[0].get());
LOGINFO("checkCQStatusOnConnect = %d ",
myStatusCq2->getCqsConnectedCount());
ASSERT(myStatusCq2->getCqsConnectedCount() == 1,
@@ -861,7 +861,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, createCQ_Pool)
RegionPtr regPtr0 = getHelper()->getRegion(regionName);
RegionPtr regPtr1 = getHelper()->getRegion(regionName1);
- CacheablePtr val = NULLPTR;
+ CacheablePtr val = nullptr;
char KeyStr[256] = {0};
char valStr[256] = {0};
for (int i = 1; i <= 5; i++) {
@@ -890,7 +890,7 @@ END_TASK_DEFINITION
void executeCq(const char* poolName, const char* name) {
PoolPtr pool = PoolManager::find(poolName);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
}
CqQueryPtr cq = qs->getCq(const_cast<char*>(name));
@@ -910,15 +910,15 @@ void checkCQStatusOnConnect(const char* poolName, const char* name,
int connect) {
PoolPtr pool = PoolManager::find(poolName);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
}
CqQueryPtr cq = qs->getCq(const_cast<char*>(name));
CqAttributesPtr cqAttr = cq->getCqAttributes();
- VectorOfCqListener vl;
+ std::vector<CqListenerPtr> vl;
cqAttr->getCqListeners(vl);
MyCqStatusListener* myStatusCq =
- dynamic_cast<MyCqStatusListener*>(vl[0].ptr());
+ dynamic_cast<MyCqStatusListener*>(vl[0].get());
LOGINFO("checkCQStatusOnConnect = %d ", myStatusCq->getCqsConnectedCount());
ASSERT(myStatusCq->getCqsConnectedCount() == connect,
"incorrect number of CqStatus Connected count.");
@@ -954,15 +954,15 @@ void checkCQStatusOnDisConnect(const char* poolName, const char* cqName,
int disconnect) {
PoolPtr pool = PoolManager::find(poolName);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
}
CqQueryPtr cq = qs->getCq(const_cast<char*>(cqName));
CqAttributesPtr cqAttr = cq->getCqAttributes();
- VectorOfCqListener vl;
+ std::vector<CqListenerPtr> vl;
cqAttr->getCqListeners(vl);
MyCqStatusListener* myStatusCq =
- dynamic_cast<MyCqStatusListener*>(vl[0].ptr());
+ dynamic_cast<MyCqStatusListener*>(vl[0].get());
LOGINFO("checkCQStatusOnDisConnect = %d ",
myStatusCq->getCqsDisConnectedCount());
ASSERT(myStatusCq->getCqsDisConnectedCount() == disconnect,
@@ -1006,7 +1006,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, putEntries)
{
RegionPtr regPtr0 = getHelper()->getRegion(regionName);
RegionPtr regPtr1 = getHelper()->getRegion(regionName1);
- CacheablePtr val = NULLPTR;
+ CacheablePtr val = nullptr;
char KeyStr[256] = {0};
char valStr[256] = {0};
for (int i = 1; i <= 5; i++) {
@@ -1026,15 +1026,15 @@ void checkCQStatusOnPutEvent(const char* poolName, const char* cqName,
int count) {
PoolPtr pool = PoolManager::find(poolName);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
}
CqQueryPtr cq = qs->getCq(const_cast<char*>(cqName));
CqAttributesPtr cqAttr = cq->getCqAttributes();
- VectorOfCqListener vl;
+ std::vector<CqListenerPtr> vl;
cqAttr->getCqListeners(vl);
MyCqStatusListener* myStatusCq =
- dynamic_cast<MyCqStatusListener*>(vl[0].ptr());
+ dynamic_cast<MyCqStatusListener*>(vl[0].get());
LOGINFO("checkCQStatusOnPutEvent = %d ", myStatusCq->getNumInserts());
ASSERT(myStatusCq->getNumInserts() == count,
"incorrect number of CqStatus Updates count.");
@@ -1062,8 +1062,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, ProcessCQ)
PoolPtr pool = PoolManager::find(regionName);
QueryServicePtr qs = pool->getQueryService();
CqAttributesFactory cqFac;
- CqListenerPtr cqLstner(new MyCqListener(1));
- CqStatusListenerPtr cqStatusLstner(new MyCqStatusListener(100));
+ auto cqLstner = std::make_shared<MyCqListener>(1);
+ auto cqStatusLstner = std::make_shared<MyCqStatusListener>(100);
cqFac.addCqListener(cqLstner);
cqFac.addCqListener(cqStatusLstner);
CqAttributesPtr cqAttr = cqFac.create();
@@ -1075,7 +1075,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, ProcessCQ)
LOG("ProcessCQ Query executed.");
RegionPtr regPtr0 = getHelper()->getRegion(regionName);
- CacheablePtr val = NULLPTR;
+ CacheablePtr val = nullptr;
char KeyStr[256] = {0};
char valStr[256] = {0};
for (int i = 1; i <= 5; i++) {
@@ -1089,11 +1089,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, ProcessCQ)
LOGINFO("putEntries complete");
cqAttr = cq->getCqAttributes();
- VectorOfCqListener vl;
+ std::vector<CqListenerPtr> vl;
cqAttr->getCqListeners(vl);
ASSERT(vl.size() == 2, "incorrect number of CqListeners count.");
MyCqStatusListener* myStatusCq =
- dynamic_cast<MyCqStatusListener*>(vl[1].ptr());
+ dynamic_cast<MyCqStatusListener*>(vl[1].get());
LOGINFO("No of insert events = %d ", myStatusCq->getNumInserts());
LOGINFO("No of OnCqConnected events = %d ",
myStatusCq->getCqsConnectedCount());
@@ -1102,7 +1102,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, ProcessCQ)
ASSERT(myStatusCq->getCqsConnectedCount() == 1,
"incorrect number of CqStatus Connected count.");
- MyCqListener* myCq = dynamic_cast<MyCqListener*>(vl[0].ptr());
+ MyCqListener* myCq = dynamic_cast<MyCqListener*>(vl[0].get());
LOGINFO("No of insert events = %d ", myCq->getNumInserts());
ASSERT(myCq->getNumInserts() == 5,
"incorrect number of CqStatus Updates count.");
@@ -1122,19 +1122,19 @@ DUNIT_TASK_DEFINITION(CLIENT1, ProcessCQ)
ASSERT(vl.size() == 0, "incorrect number of listeners");
- VectorOfCqListener v2;
+ std::vector<CqListenerPtr> v2;
v2.push_back(cqStatusLstner);
v2.push_back(cqLstner);
cqAttrMtor->setCqListeners(v2);
LOG("ProcessCQ setCqListeneres done.");
cqAttr = cq->getCqAttributes();
- VectorOfCqListener vl3;
+ std::vector<CqListenerPtr> vl3;
cqAttr->getCqListeners(vl3);
ASSERT(vl3.size() == 2, "incorrect number of CqListeners count.");
MyCqStatusListener* myStatusCq2 =
- dynamic_cast<MyCqStatusListener*>(vl3[0].ptr());
+ dynamic_cast<MyCqStatusListener*>(vl3[0].get());
myStatusCq2->clear();
for (int i = 1; i <= 5; i++) {
@@ -1147,17 +1147,17 @@ DUNIT_TASK_DEFINITION(CLIENT1, ProcessCQ)
}
LOGINFO("putEntries complete again");
- VectorOfCqListener vl21;
+ std::vector<CqListenerPtr> vl21;
vl21.push_back(cqStatusLstner);
vl21.push_back(cqLstner);
cqFac.initCqListeners(vl21);
LOGINFO("initCqListeners complete.");
cqAttr = cq->getCqAttributes();
- VectorOfCqListener vl2;
+ std::vector<CqListenerPtr> vl2;
cqAttr->getCqListeners(vl2);
ASSERT(vl2.size() == 2, "incorrect number of CqListeners count.");
- myStatusCq2 = dynamic_cast<MyCqStatusListener*>(vl2[0].ptr());
+ myStatusCq2 = dynamic_cast<MyCqStatusListener*>(vl2[0].get());
LOGINFO("No of insert events = %d ", myStatusCq2->getNumUpdates());
LOGINFO("No of OnCqConnected events = %d ",
myStatusCq2->getCqsConnectedCount());
@@ -1166,7 +1166,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, ProcessCQ)
ASSERT(myStatusCq2->getCqsConnectedCount() == 0,
"incorrect number of CqStatus Connected count.");
- MyCqListener* myCq2 = dynamic_cast<MyCqListener*>(vl2[1].ptr());
+ MyCqListener* myCq2 = dynamic_cast<MyCqListener*>(vl2[1].get());
LOGINFO("No of insert events = %d ", myCq2->getNumInserts());
ASSERT(myCq2->getNumUpdates() == 5,
"incorrect number of CqStatus Updates count.");
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientCqDelta.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientCqDelta.cpp b/src/cppcache/integration-test/testThinClientCqDelta.cpp
index 2d91fc7..c591fd0 100644
--- a/src/cppcache/integration-test/testThinClientCqDelta.cpp
+++ b/src/cppcache/integration-test/testThinClientCqDelta.cpp
@@ -57,7 +57,7 @@ class CqDeltaListener : public CqListener {
m_deltaCount++;
}
DeltaTestImplPtr dptr =
- staticCast<DeltaTestImplPtr>(aCqEvent.getNewValue());
+ std::static_pointer_cast<GF_UNWRAP_SP(DeltaTestImplPtr)>(aCqEvent.getNewValue());
if (dptr->getIntVar() == 5) {
m_valueCount++;
}
@@ -107,7 +107,7 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators,
RegionPtr regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
@@ -128,9 +128,9 @@ void createRegion(const char* name, bool ackMode,
fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
fflush(stdout);
// ack, caching
- RegionPtr regPtr = getHelper()->createRegion(name, ackMode, true, NULLPTR,
+ RegionPtr regPtr = getHelper()->createRegion(name, ackMode, true, nullptr,
clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
const char* keys[] = {"Key-1", "Key-2", "Key-3", "Key-4"};
@@ -169,7 +169,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, CreateClient2)
QueryServicePtr qs;
qs = pool->getQueryService();
CqAttributesFactory cqFac;
- g_CqListener = new CqDeltaListener();
+ g_CqListener = std::make_shared<CqDeltaListener>();
CqListenerPtr cqListener = g_CqListener;
cqFac.addCqListener(cqListener);
CqAttributesPtr cqAttr = cqFac.create();
@@ -206,7 +206,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, CreateClient2_NoPools)
QueryServicePtr qs;
qs = getHelper()->getQueryService();
CqAttributesFactory cqFac;
- g_CqListener = new CqDeltaListener();
+ g_CqListener = std::make_shared<CqDeltaListener>();
CqListenerPtr cqListener = g_CqListener;
cqFac.addCqListener(cqListener);
CqAttributesPtr cqAttr = cqFac.create();
@@ -220,7 +220,7 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, Client1_Put)
{
CacheableKeyPtr keyPtr = createKey(keys[0]);
- DeltaTestImplPtr dptr(new DeltaTestImpl());
+ auto dptr = std::make_shared<DeltaTestImpl>();
CacheablePtr valPtr(dptr);
RegionPtr regPtr = getHelper()->getRegion(regionNames[0]);
regPtr->put(keyPtr, valPtr);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientCqDurable.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientCqDurable.cpp b/src/cppcache/integration-test/testThinClientCqDurable.cpp
index 862795a..143f90f 100644
--- a/src/cppcache/integration-test/testThinClientCqDurable.cpp
+++ b/src/cppcache/integration-test/testThinClientCqDurable.cpp
@@ -84,8 +84,8 @@ class MyCqListener1 : public CqListener {
void onEvent(const CqEvent& cqe) {
m_cntEvents++;
char* opStr = (char*)"Default";
- CacheableInt32Ptr value(dynCast<CacheableInt32Ptr>(cqe.getNewValue()));
- CacheableInt32Ptr key(dynCast<CacheableInt32Ptr>(cqe.getKey()));
+ CacheableInt32Ptr value(std::dynamic_pointer_cast<CacheableInt32>(cqe.getNewValue()));
+ CacheableInt32Ptr key(std::dynamic_pointer_cast<CacheableInt32>(cqe.getKey()));
switch (cqe.getQueryOperation()) {
case CqOperation::OP_TYPE_CREATE: {
opStr = (char*)"CREATE";
@@ -202,7 +202,7 @@ void RunDurableCqClient() {
// Create CqAttributes and Install Listener
CqAttributesFactory cqFac;
- CqListenerPtr cqLstner(new MyCqListener1());
+ auto cqLstner = std::make_shared<MyCqListener1>();
cqFac.addCqListener(cqLstner);
CqAttributesPtr cqAttr = cqFac.create();
@@ -257,8 +257,7 @@ void RunFeederClient() {
LOGINFO("Created the Region Programmatically.");
for (int i = 0; i < 10; i++) {
- CacheableKeyPtr keyPtr =
- dynCast<CacheableKeyPtr>(CacheableInt32::create(i));
+ auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
CacheableInt32Ptr valPtr = CacheableInt32::create(i);
regionPtr->put(keyPtr, valPtr);
@@ -290,8 +289,7 @@ void RunFeederClient1() {
LOGINFO("Created the Region Programmatically.");
for (int i = 10; i < 20; i++) {
- CacheableKeyPtr keyPtr =
- dynCast<CacheableKeyPtr>(CacheableInt32::create(i));
+ auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
CacheableInt32Ptr valPtr = CacheableInt32::create(i);
regionPtr->put(keyPtr, valPtr);
@@ -366,13 +364,13 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
PoolPtr pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
}
CqAttributesFactory cqFac;
- CqListenerPtr cqLstner(new MyCqListener());
+ auto cqLstner = std::make_shared<MyCqListener>();
cqFac.addCqListener(cqLstner);
CqAttributesPtr cqAttr = cqFac.create();
@@ -412,7 +410,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepTwo2)
qh->populatePortfolioData(regPtr0, 140, 30, 20);
qh->populatePositionData(subregPtr0, 140, 30);
- CacheablePtr port = NULLPTR;
+ CacheablePtr port = nullptr;
for (int i = 1; i < 140; i++) {
if (!m_isPdx) {
port = CacheablePtr(new Portfolio(i, 20));
@@ -456,7 +454,7 @@ void client1Up() {
qs = PoolManager::find(regionNamesCq[0])->getQueryService();
CqAttributesFactory cqFac;
- CqListenerPtr cqLstner(new MyCqListener());
+ auto cqLstner = std::make_shared<MyCqListener>();
cqFac.addCqListener(cqLstner);
CqAttributesPtr cqAttr = cqFac.create();
@@ -519,7 +517,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
PoolPtr pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
@@ -531,10 +529,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
"CLIENT-1 StepFour: verifying getCq() behaviour for the invalid CQ "
"Name");
CqQueryPtr invalidCqptr = qs->getCq("InValidCQ");
- ASSERT(invalidCqptr == NULLPTR,
+ ASSERT(invalidCqptr == nullptr,
"Cqptr must be NULL, as it getCq() is invoked on invalid CQ name");
- /*if(invalidCqptr == NULLPTR){
- LOGINFO("Testing getCq(InvalidName) :: invalidCqptr is NULLPTR");
+ /*if(invalidCqptr == nullptr){
+ LOGINFO("Testing getCq(InvalidName) :: invalidCqptr is nullptr");
}else{
LOGINFO("Testing getCq(InvalidName) :: invalidCqptr is NOT NULL");
}*/
@@ -665,7 +663,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, RegisterCqs1)
{
PoolPtr pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
@@ -692,7 +690,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, RegisterCqsAfterClientup1)
{
PoolPtr pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
@@ -719,7 +717,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, RegisterCqs2)
{
PoolPtr pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
@@ -746,7 +744,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, RegisterCqsAfterClientup2)
{
PoolPtr pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
@@ -773,7 +771,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, VerifyCqs1)
{
PoolPtr pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
@@ -781,7 +779,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, VerifyCqs1)
CacheableArrayListPtr durableCqListPtr = qs->getAllDurableCqsFromServer();
- ASSERT(durableCqListPtr != NULLPTR, "Durable CQ List should not be null");
+ ASSERT(durableCqListPtr != nullptr, "Durable CQ List should not be null");
ASSERT(durableCqListPtr->length() == 2,
"Durable CQ List lenght should be 2");
ASSERT(isDurableCQName(durableCqListPtr->at(0)->toString()->asChar(), 1,
@@ -797,14 +795,14 @@ DUNIT_TASK_DEFINITION(CLIENT1, VerifyCqsAfterClientup1)
{
PoolPtr pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
}
CacheableArrayListPtr durableCqListPtr = qs->getAllDurableCqsFromServer();
- ASSERT(durableCqListPtr != NULLPTR, "Durable CQ List should not be null");
+ ASSERT(durableCqListPtr != nullptr, "Durable CQ List should not be null");
ASSERT(durableCqListPtr->length() == 4,
"Durable CQ List length should be 4");
ASSERT(
@@ -826,13 +824,13 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyCqs2)
{
PoolPtr pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
}
CacheableArrayListPtr durableCqListPtr = qs->getAllDurableCqsFromServer();
- ASSERT(durableCqListPtr != NULLPTR, "Durable CQ List should not be null");
+ ASSERT(durableCqListPtr != nullptr, "Durable CQ List should not be null");
ASSERT(durableCqListPtr->length() == 4,
"Durable CQ List lenght should be 4");
ASSERT(isDurableCQName(durableCqListPtr->at(0)->toString()->asChar(), 2,
@@ -854,13 +852,13 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyCqsAfterClientup2)
{
PoolPtr pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
}
CacheableArrayListPtr durableCqListPtr = qs->getAllDurableCqsFromServer();
- ASSERT(durableCqListPtr != NULLPTR, "Durable CQ List should not be null");
+ ASSERT(durableCqListPtr != nullptr, "Durable CQ List should not be null");
ASSERT(durableCqListPtr->length() == 8,
"Durable CQ List lenght should be 8");
ASSERT(
@@ -893,14 +891,14 @@ END_TASK_DEFINITION
void verifyEmptyDurableCQList() {
PoolPtr pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
}
CacheableArrayListPtr durableCqListPtr = qs->getAllDurableCqsFromServer();
- ASSERT(durableCqListPtr == NULLPTR, "Durable CQ List should be null");
+ ASSERT(durableCqListPtr == nullptr, "Durable CQ List should be null");
}
DUNIT_TASK_DEFINITION(CLIENT1, VerifyEmptyDurableCQList1)
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientCqFailover.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientCqFailover.cpp b/src/cppcache/integration-test/testThinClientCqFailover.cpp
index eb6b252..5b42786 100644
--- a/src/cppcache/integration-test/testThinClientCqFailover.cpp
+++ b/src/cppcache/integration-test/testThinClientCqFailover.cpp
@@ -198,14 +198,14 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
try {
PoolPtr pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
// Using region name as pool name as in ThinClientCq.hpp
qs = pool->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
}
CqAttributesFactory cqFac;
- CqListenerPtr cqLstner(new MyCqListener());
+ auto cqLstner = std::make_shared<MyCqListener>();
cqFac.addCqListener(cqLstner);
CqAttributesPtr cqAttr = cqFac.create();
@@ -244,7 +244,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepThree2)
qh->populatePortfolioData(regPtr0, 150, 40, 150);
qh->populatePositionData(subregPtr0, 150, 40);
for (int i = 1; i < 150; i++) {
- CacheablePtr port(new Portfolio(i, 150));
+ auto port = std::make_shared<Portfolio>(i, 150);
CacheableKeyPtr keyport = CacheableKey::create((char*)"port1-1");
regPtr0->put(keyport, port);
@@ -258,21 +258,21 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, StepThree3)
{
- PoolPtr pool = PoolManager::find(regionNamesCq[0]);
+ auto pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
// Using region name as pool name as in ThinClientCq.hpp
qs = pool->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
}
- CqQueryPtr qry = qs->getCq(cqName);
- ASSERT(qry != NULLPTR, "failed to get CqQuery");
- CqAttributesPtr cqAttr = qry->getCqAttributes();
- ASSERT(cqAttr != NULLPTR, "failed to get CqAttributes");
- CqListenerPtr cqLstner = NULLPTR;
+ auto qry = qs->getCq(cqName);
+ ASSERT(qry != nullptr, "failed to get CqQuery");
+ auto cqAttr = qry->getCqAttributes();
+ ASSERT(cqAttr != nullptr, "failed to get CqAttributes");
+ CqListenerPtr cqLstner = nullptr;
try {
- VectorOfCqListener vl;
+ std::vector<CqListenerPtr> vl;
cqAttr->getCqListeners(vl);
cqLstner = vl[0];
} catch (Exception& excp) {
@@ -281,8 +281,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree3)
LOG(excpmsg);
ASSERT(false, "get listener failed");
}
- ASSERT(cqLstner != NULLPTR, "listener is NULL");
- MyCqListener* myListener = dynamic_cast<MyCqListener*>(cqLstner.ptr());
+ ASSERT(cqLstner != nullptr, "listener is NULL");
+ auto myListener = dynamic_cast<MyCqListener*>(cqLstner.get());
ASSERT(myListener != NULL, "my listener is NULL<cast failed>");
kst = new KillServerThread(myListener);
char buf[1024];
@@ -302,7 +302,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree3)
RegionPtr subregPtr0 = regPtr0->getSubregion(regionNamesCq[1]);
for(int i=1; i < 1500; i++)
{
- CacheablePtr port(new Portfolio(i, 15));
+ auto port = std::make_shared<Portfolio>(i, 15);
CacheableKeyPtr keyport = CacheableKey::create("port1-1");
try {
@@ -324,17 +324,17 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT2, StepThree4)
{
- RegionPtr regPtr0 = getHelper()->getRegion(regionNamesCq[0]);
- RegionPtr subregPtr0 = regPtr0->getSubregion(regionNamesCq[1]);
+ auto regPtr0 = getHelper()->getRegion(regionNamesCq[0]);
+ auto subregPtr0 = regPtr0->getSubregion(regionNamesCq[1]);
- QueryHelper* qh = &QueryHelper::getHelper();
+ auto qh = &QueryHelper::getHelper();
qh->populatePortfolioData(regPtr0, 10, 40, 10);
qh->populatePositionData(subregPtr0, 10, 4);
for (int i = 1; i < 150; i++) {
- CacheablePtr port(new Portfolio(i, 10));
+ auto port = std::make_shared<Portfolio>(i, 10);
- CacheableKeyPtr keyport = CacheableKey::create("port1-1");
+ auto keyport = CacheableKey::create("port1-1");
regPtr0->put(keyport, port);
SLEEP(100); // sleep a while to allow server query to complete
}
@@ -345,21 +345,21 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, CloseCache1)
{
- PoolPtr pool = PoolManager::find(regionNamesCq[0]);
+ auto pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
// Using region name as pool name as in ThinClientCq.hpp
qs = pool->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
}
- CqQueryPtr qry = qs->getCq(cqName);
- ASSERT(qry != NULLPTR, "failed to get CqQuery");
- CqAttributesPtr cqAttr = qry->getCqAttributes();
- ASSERT(cqAttr != NULLPTR, "failed to get CqAttributes");
- CqListenerPtr cqLstner = NULLPTR;
+ auto qry = qs->getCq(cqName);
+ ASSERT(qry != nullptr, "failed to get CqQuery");
+ auto cqAttr = qry->getCqAttributes();
+ ASSERT(cqAttr != nullptr, "failed to get CqAttributes");
+ CqListenerPtr cqLstner = nullptr;
try {
- VectorOfCqListener vl;
+ std::vector<CqListenerPtr> vl;
cqAttr->getCqListeners(vl);
cqLstner = vl[0];
} catch (Exception& excp) {
@@ -368,8 +368,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, CloseCache1)
LOG(excpmsg);
ASSERT(false, "get listener failed");
}
- ASSERT(cqLstner != NULLPTR, "listener is NULL");
- MyCqListener* myListener = dynamic_cast<MyCqListener*>(cqLstner.ptr());
+ ASSERT(cqLstner != nullptr, "listener is NULL");
+ auto myListener = dynamic_cast<MyCqListener*>(cqLstner.get());
ASSERT(myListener != NULL, "my listener is NULL<cast failed>");
char buf[1024];
sprintf(buf, "after failed over: before=%d, after=%d",
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientCqHAFailover.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientCqHAFailover.cpp b/src/cppcache/integration-test/testThinClientCqHAFailover.cpp
index 1b9fbda..914eafb 100644
--- a/src/cppcache/integration-test/testThinClientCqHAFailover.cpp
+++ b/src/cppcache/integration-test/testThinClientCqHAFailover.cpp
@@ -199,13 +199,13 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
try {
PoolPtr pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
}
CqAttributesFactory cqFac;
- CqListenerPtr cqLstner(new MyCqListener());
+ auto cqLstner = std::make_shared<MyCqListener>();
cqFac.addCqListener(cqLstner);
CqAttributesPtr cqAttr = cqFac.create();
@@ -224,22 +224,22 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
while (iter.hasNext()) {
count--;
SerializablePtr ser = iter.next();
- PortfolioPtr portfolio(dynamic_cast<Portfolio*>(ser.ptr()));
- PositionPtr position(dynamic_cast<Position*>(ser.ptr()));
+ PortfolioPtr portfolio(dynamic_cast<Portfolio*>(ser.get()));
+ PositionPtr position(dynamic_cast<Position*>(ser.get()));
- if (portfolio != NULLPTR) {
+ if (portfolio != nullptr) {
printf(" query pulled portfolio object ID %d, pkid %s\n",
portfolio->getID(), portfolio->getPkid()->asChar());
}
- else if (position != NULLPTR) {
+ else if (position != nullptr) {
printf(" query pulled position object secId %s, shares %d\n",
position->getSecId()->asChar(),
position->getSharesOutstanding());
}
else {
- if (ser != NULLPTR) {
+ if (ser != nullptr) {
printf(" query pulled object %s\n", ser->toString()->asChar());
} else {
printf(" query pulled bad object\n");
@@ -280,7 +280,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepThree2)
qh->populatePortfolioData(regPtr0, 150, 40, 10);
qh->populatePositionData(subregPtr0, 150, 40);
for (int i = 1; i < 150; i++) {
- CacheablePtr port(new Portfolio(i, 20));
+ auto port = std::make_shared<Portfolio>(i, 20);
CacheableKeyPtr keyport = CacheableKey::create((char*)"port1-1");
regPtr0->put(keyport, port);
@@ -297,18 +297,18 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree3)
// using region name as pool name
PoolPtr pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
}
CqQueryPtr qry = qs->getCq(cqName);
- ASSERT(qry != NULLPTR, "failed to get CqQuery");
+ ASSERT(qry != nullptr, "failed to get CqQuery");
CqAttributesPtr cqAttr = qry->getCqAttributes();
- ASSERT(cqAttr != NULLPTR, "failed to get CqAttributes");
- CqListenerPtr cqLstner = NULLPTR;
+ ASSERT(cqAttr != nullptr, "failed to get CqAttributes");
+ CqListenerPtr cqLstner = nullptr;
try {
- VectorOfCqListener vl;
+ std::vector<CqListenerPtr> vl;
cqAttr->getCqListeners(vl);
cqLstner = vl[0];
} catch (Exception& excp) {
@@ -317,8 +317,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree3)
LOG(excpmsg);
ASSERT(false, "get listener failed");
}
- ASSERT(cqLstner != NULLPTR, "listener is NULL");
- MyCqListener* myListener = dynamic_cast<MyCqListener*>(cqLstner.ptr());
+ ASSERT(cqLstner != nullptr, "listener is NULL");
+ MyCqListener* myListener = dynamic_cast<MyCqListener*>(cqLstner.get());
ASSERT(myListener != NULL, "my listener is NULL<cast failed>");
kst = new KillServerThread(myListener);
char buf[1024];
@@ -338,7 +338,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree3)
RegionPtr subregPtr0 = regPtr0->getSubregion(regionNamesCq[1]);
for(int i=1; i < 150; i++)
{
- CacheablePtr port(new Portfolio(i, 20));
+ auto port = std::make_shared<Portfolio>(i, 20);
CacheableKeyPtr keyport = CacheableKey::create("port1-1");
try {
@@ -367,7 +367,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepThree4)
qh->populatePortfolioData(regPtr0, 150, 40, 10);
qh->populatePositionData(subregPtr0, 150, 40);
for (int i = 1; i < 150; i++) {
- CacheablePtr port(new Portfolio(i, 20));
+ auto port = std::make_shared<Portfolio>(i, 20);
CacheableKeyPtr keyport = CacheableKey::create("port1-1");
regPtr0->put(keyport, port);
@@ -384,18 +384,18 @@ DUNIT_TASK_DEFINITION(CLIENT1, CloseCache1)
// using region name as pool name
PoolPtr pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
}
CqQueryPtr qry = qs->getCq(cqName);
- ASSERT(qry != NULLPTR, "failed to get CqQuery");
+ ASSERT(qry != nullptr, "failed to get CqQuery");
CqAttributesPtr cqAttr = qry->getCqAttributes();
- ASSERT(cqAttr != NULLPTR, "failed to get CqAttributes");
- CqListenerPtr cqLstner = NULLPTR;
+ ASSERT(cqAttr != nullptr, "failed to get CqAttributes");
+ CqListenerPtr cqLstner = nullptr;
try {
- VectorOfCqListener vl;
+ std::vector<CqListenerPtr> vl;
cqAttr->getCqListeners(vl);
cqLstner = vl[0];
} catch (Exception& excp) {
@@ -404,8 +404,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, CloseCache1)
LOG(excpmsg);
ASSERT(false, "get listener failed");
}
- ASSERT(cqLstner != NULLPTR, "listener is NULL");
- MyCqListener* myListener = dynamic_cast<MyCqListener*>(cqLstner.ptr());
+ ASSERT(cqLstner != nullptr, "listener is NULL");
+ MyCqListener* myListener = dynamic_cast<MyCqListener*>(cqLstner.get());
ASSERT(myListener != NULL, "my listener is NULL<cast failed>");
char buf[1024];
sprintf(buf, "after failed over: before=%d, after=%d",
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientCqIR.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientCqIR.cpp b/src/cppcache/integration-test/testThinClientCqIR.cpp
index fbfc91b..90a8b01 100644
--- a/src/cppcache/integration-test/testThinClientCqIR.cpp
+++ b/src/cppcache/integration-test/testThinClientCqIR.cpp
@@ -137,7 +137,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, PutData)
qh->populatePortfolioPdxData(regPtr0, 150, 40, 150);
qh->populatePositionPdxData(subregPtr0, 150, 40);
- CacheablePtr port = NULLPTR;
+ CacheablePtr port = nullptr;
for (int i = 1; i < 150; i++) {
port = CacheablePtr(new PortfolioPdx(i, 150));
@@ -153,40 +153,31 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, QueryData)
{
- QueryHelper* qh ATTR_UNUSED = &QueryHelper::getHelper();
+ auto& qh ATTR_UNUSED = QueryHelper::getHelper();
// using region name as pool name
- PoolPtr pool = PoolManager::find(regionNamesCq[0]);
+ auto pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
qs = pool->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
}
- CqAttributesFactory cqFac;
- // CqListenerPtr cqLstner(new MyCqListener());
- // cqFac.addCqListener(cqLstner);
- CqAttributesPtr cqAttr = cqFac.create();
+ auto cqAttr = CqAttributesFactory().create();
// char* qryStr = (char*)"select * from /Portfolios p where p.ID != 2";
// qry->execute();
- const char* qryStr = "select * from /Portfolios where ID != 2";
- // const char* qryStr = "select * from /Portfolios p where p.ID < 3";
- // this will cause exception since distinct is not supported:
- // const char* qryStr = "select distinct * from /Portfolios where ID != 2";
- CqQueryPtr qry = qs->newCq(cqName, qryStr, cqAttr);
- // QueryPtr qry = qs->newQuery(qryStr);
+ auto qryStr = "select * from /Portfolios where ID != 2";
+ auto qry = qs->newCq(cqName, qryStr, cqAttr);
- CqResultsPtr results;
try {
LOG("before executing executeWithInitialResults.");
- results = qry->executeWithInitialResults();
+ auto results = qry->executeWithInitialResults();
LOG("before executing executeWithInitialResults done.");
- // results = qry->execute();
- SelectResultsIterator iter = results->getIterator();
+ auto iter = results->getIterator();
char buf[100];
int count = results->size();
sprintf(buf, "results size=%d", count);
@@ -194,41 +185,27 @@ DUNIT_TASK_DEFINITION(CLIENT1, QueryData)
ASSERT(count > 0, "count should be > 0");
while (iter.hasNext()) {
count--;
- SerializablePtr ser = iter.next();
- /*PortfolioPtr portfolio( dynamic_cast<Portfolio*> (ser.ptr() ));
- PositionPtr position(dynamic_cast<Position*> (ser.ptr() ));
-
- if (portfolio != NULLPTR) {
- printf(" query pulled portfolio object ID %d, pkid %s\n",
- portfolio->getID(), portfolio->getPkid()->asChar());
- }
+ auto ser = iter.next();
- else if (position != NULLPTR) {
- printf(" query pulled position object secId %s, shares %d\n",
- position->getSecId()->asChar(), position->getSharesOutstanding());
- }
- */
- if (ser != NULLPTR) {
+ if (ser != nullptr) {
printf(" query pulled object %s\n", ser->toString()->asChar());
- StructPtr stPtr(dynamic_cast<Struct*>(ser.ptr()));
-
- ASSERT(stPtr != NULLPTR, "Failed to get struct in CQ result.");
+ auto stPtr = std::dynamic_pointer_cast<Struct>(ser);
+ ASSERT(stPtr != nullptr, "Failed to get struct in CQ result.");
- if (stPtr != NULLPTR) {
+ if (stPtr != nullptr) {
LOG(" got struct ptr ");
- SerializablePtr serKey = (*(stPtr.ptr()))["key"];
- ASSERT(serKey != NULLPTR, "Failed to get KEY in CQ result.");
- if (serKey != NULLPTR) {
+ auto serKey = (*stPtr)["key"];
+ ASSERT(serKey != nullptr, "Failed to get KEY in CQ result.");
+ if (serKey != nullptr) {
LOG("got struct key ");
printf(" got struct key %s\n", serKey->toString()->asChar());
}
- SerializablePtr serVal = (*(stPtr.ptr()))["value"];
+ auto serVal = (*stPtr)["value"];
+ ASSERT(serVal != nullptr, "Failed to get VALUE in CQ result.");
- ASSERT(serVal != NULLPTR, "Failed to get VALUE in CQ result.");
-
- if (serVal != NULLPTR) {
+ if (serVal != nullptr) {
LOG("got struct value ");
printf(" got struct value %s\n", serVal->toString()->asChar());
}
@@ -246,7 +223,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, QueryData)
results = qry->executeWithInitialResults();
LOG("before executing executeWithInitialResults2 done.");
- SelectResultsIterator iter2 = results->getIterator();
+ auto iter2 = results->getIterator();
count = results->size();
sprintf(buf, "results2 size=%d", count);
@@ -254,29 +231,27 @@ DUNIT_TASK_DEFINITION(CLIENT1, QueryData)
ASSERT(count > 0, "count should be > 0");
while (iter2.hasNext()) {
count--;
- SerializablePtr ser = iter2.next();
+ auto ser = iter2.next();
- if (ser != NULLPTR) {
+ if (ser != nullptr) {
printf(" query pulled object %s\n", ser->toString()->asChar());
- StructPtr stPtr(dynamic_cast<Struct*>(ser.ptr()));
-
- ASSERT(stPtr != NULLPTR, "Failed to get struct in CQ result.");
+ auto stPtr = std::dynamic_pointer_cast<Struct>(ser);
+ ASSERT(stPtr != nullptr, "Failed to get struct in CQ result.");
- if (stPtr != NULLPTR) {
+ if (stPtr != nullptr) {
LOG(" got struct ptr ");
- SerializablePtr serKey = (*(stPtr.ptr()))["key"];
- ASSERT(serKey != NULLPTR, "Failed to get KEY in CQ result.");
- if (serKey != NULLPTR) {
+ auto serKey = (*stPtr)["key"];
+ ASSERT(serKey != nullptr, "Failed to get KEY in CQ result.");
+ if (serKey != nullptr) {
LOG("got struct key ");
printf(" got struct key %s\n", serKey->toString()->asChar());
}
- SerializablePtr serVal = (*(stPtr.ptr()))["value"];
-
- ASSERT(serVal != NULLPTR, "Failed to get VALUE in CQ result.");
+ auto serVal = (*stPtr)["value"];
+ ASSERT(serVal != nullptr, "Failed to get VALUE in CQ result.");
- if (serVal != NULLPTR) {
+ if (serVal != nullptr) {
LOG("got struct value ");
printf(" got struct value %s\n", serVal->toString()->asChar());
}
@@ -288,12 +263,14 @@ DUNIT_TASK_DEFINITION(CLIENT1, QueryData)
sprintf(buf, "results last count=%d", count);
LOG(buf);
- RegionPtr regPtr0 = getHelper()->getRegion(regionNamesCq[0]);
- regPtr0->destroyRegion();
+ {
+ auto regPtr0 = getHelper()->getRegion(regionNamesCq[0]);
+ regPtr0->destroyRegion();
+ }
SLEEP(20000);
qry = qs->getCq(cqName);
sprintf(buf, "cq[%s] should have been removed after close!", cqName);
- ASSERT(qry == NULLPTR, buf);
+ ASSERT(qry == nullptr, buf);
} catch (const Exception& excp) {
std::string logmsg = "";
logmsg += excp.getName();
@@ -313,10 +290,10 @@ DUNIT_TASK_DEFINITION(CLIENT2, CheckRegionDestroy)
LOG("check region destory");
try {
RegionPtr regPtr0 = getHelper()->getRegion(regionNamesCq[0]);
- if (regPtr0 == NULLPTR) {
- LOG("regPtr0==NULLPTR");
+ if (regPtr0 == nullptr) {
+ LOG("regPtr0==nullptr");
} else {
- LOG("regPtr0!=NULLPTR");
+ LOG("regPtr0!=nullptr");
ASSERT(regPtr0->isDestroyed(), "should have been distroyed");
}
} catch (...) {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientDeltaWithNotification.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientDeltaWithNotification.cpp b/src/cppcache/integration-test/testThinClientDeltaWithNotification.cpp
index c3c30df..de9b3d3 100644
--- a/src/cppcache/integration-test/testThinClientDeltaWithNotification.cpp
+++ b/src/cppcache/integration-test/testThinClientDeltaWithNotification.cpp
@@ -85,7 +85,7 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators,
RegionPtr regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
@@ -114,9 +114,9 @@ void createRegion(const char* name, bool ackMode,
fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
fflush(stdout);
// ack, caching
- RegionPtr regPtr = getHelper()->createRegion(name, ackMode, true, NULLPTR,
+ RegionPtr regPtr = getHelper()->createRegion(name, ackMode, true, nullptr,
clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
@@ -224,7 +224,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1_Put)
{
CacheableKeyPtr keyPtr = createKey(keys[0]);
DeltaEx* ptr = new DeltaEx();
- CacheablePtr pdxobj(new PdxDeltaEx());
+ auto pdxobj = std::make_shared<PdxDeltaEx>();
CacheablePtr valPtr(ptr);
RegionPtr regPtr = getHelper()->getRegion(regionNames[0]);
regPtr->put(keyPtr, valPtr);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientDisconnectionListioner.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientDisconnectionListioner.cpp b/src/cppcache/integration-test/testThinClientDisconnectionListioner.cpp
index 3a9154a..7a3e94c 100644
--- a/src/cppcache/integration-test/testThinClientDisconnectionListioner.cpp
+++ b/src/cppcache/integration-test/testThinClientDisconnectionListioner.cpp
@@ -39,7 +39,7 @@ class DisconnectCacheListioner : public CacheListener {
isDisconnected = true;
}
};
-CacheListenerPtr cptr(new DisconnectCacheListioner());
+auto cptr = std::make_shared<DisconnectCacheListioner>();
#include "LocatorHelper.hpp"
DUNIT_TASK_DEFINITION(CLIENT1, SetupClient1_Pool_Locator)
{
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientExecuteFunctionPrSHOP.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientExecuteFunctionPrSHOP.cpp b/src/cppcache/integration-test/testThinClientExecuteFunctionPrSHOP.cpp
index 73ced17..1e6c45e 100644
--- a/src/cppcache/integration-test/testThinClientExecuteFunctionPrSHOP.cpp
+++ b/src/cppcache/integration-test/testThinClientExecuteFunctionPrSHOP.cpp
@@ -73,17 +73,16 @@ class MyResultCollector : public ResultCollector {
void addResult(CacheablePtr& resultItem) {
m_addResultCount++;
- if (resultItem == NULLPTR) {
+ if (resultItem == nullptr) {
return;
}
try {
- CacheableArrayListPtr result = dynCast<CacheableArrayListPtr>(resultItem);
+ auto result = std::dynamic_pointer_cast<CacheableArrayList>(resultItem);
for (int32_t i = 0; i < result->size(); i++) {
m_resultList->push_back(result->operator[](i));
}
} catch (ClassCastException) {
- UserFunctionExecutionExceptionPtr result =
- dynCast<UserFunctionExecutionExceptionPtr>(resultItem);
+ auto result = std::dynamic_pointer_cast<UserFunctionExecutionException>(resultItem);
m_resultList->push_back(result);
}
}
@@ -129,10 +128,10 @@ class MyResultCollector2 : public ResultCollector {
void addResult(CacheablePtr& resultItem) {
m_addResultCount++;
- if (resultItem == NULLPTR) {
+ if (resultItem == nullptr) {
return;
}
- CacheableBooleanPtr result = dynCast<CacheableBooleanPtr>(resultItem);
+ auto result = std::dynamic_pointer_cast<CacheableBoolean>(resultItem);
m_resultList->push_back(result);
}
void endResults() {
@@ -178,7 +177,7 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, StartC1)
{
- initClientWithPool(true, NULL, locHostPort, serverGroup, NULLPTR, 0, true,
+ initClientWithPool(true, NULL, locHostPort, serverGroup, nullptr, 0, true,
-1, -1, 60000, /*singlehop*/ true,
/*threadLocal*/ true);
@@ -211,13 +210,13 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
}
LOGINFO("routingObj size = %d ", routingObj->size());
ExecutionPtr exe = FunctionService::onRegion(regPtr0);
- ASSERT(exe != NULLPTR, "onRegion Returned NULL");
+ ASSERT(exe != nullptr, "onRegion Returned NULL");
CacheableVectorPtr resultList = CacheableVector::create();
LOG("Executing getFuncName function");
CacheableVectorPtr executeFunctionResult =
exe->withFilter(routingObj)->execute(getFuncName, 15)->getResult();
- if (executeFunctionResult == NULLPTR) {
+ if (executeFunctionResult == nullptr) {
ASSERT(false, "executeFunctionResult is NULL");
} else {
sprintf(buf, "result count = %d", executeFunctionResult->size());
@@ -226,7 +225,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
for (unsigned item = 0;
item < static_cast<uint32_t>(executeFunctionResult->size());
item++) {
- CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>(
+ auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>(
executeFunctionResult->operator[](item));
for (unsigned pos = 0;
pos < static_cast<uint32_t>(arrayList->size()); pos++) {
@@ -239,15 +238,15 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
"get executeFunctionResult count is not 40");
for (int32_t i = 0; i < resultList->size(); i++) {
sprintf(buf, "result[%d] is null\n", i);
- ASSERT(resultList->operator[](i) != NULLPTR, buf);
+ ASSERT(resultList->operator[](i) != nullptr, buf);
sprintf(buf, "get result[%d]=%s", i,
- dynCast<CacheableStringPtr>(resultList->operator[](i))
+ std::dynamic_pointer_cast<CacheableString>(resultList->operator[](i))
->asChar());
LOGINFO(buf);
}
}
LOGINFO("getFuncName done");
- MyResultCollectorPtr myRC(new MyResultCollector());
+ auto myRC = std::make_shared<MyResultCollector>();
CacheableVectorPtr executeFunctionResult1 =
exe->withFilter(routingObj)
->withCollector(myRC)
@@ -259,7 +258,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
ASSERT(4 == myRC->getAddResultCount(), "add result count is not 4");
ASSERT(1 == myRC->getEndResultCount(), "end result count is not 1");
ASSERT(1 == myRC->getGetResultCount(), "get result count is not 1");
- if (executeFunctionResult == NULLPTR) {
+ if (executeFunctionResult == nullptr) {
ASSERT(false, "region get new collector: result is NULL");
} else {
sprintf(buf, "result count = %d", executeFunctionResult->size());
@@ -268,7 +267,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
for (unsigned item = 0;
item < static_cast<uint32_t>(executeFunctionResult->size());
item++) {
- CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>(
+ auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>(
executeFunctionResult->operator[](item));
for (unsigned pos = 0;
pos < static_cast<uint32_t>(arrayList->size()); pos++) {
@@ -281,9 +280,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
"get executeFunctionResult count is not 40");
for (int32_t i = 0; i < resultList->size(); i++) {
sprintf(buf, "result[%d] is null\n", i);
- ASSERT(resultList->operator[](i) != NULLPTR, buf);
+ ASSERT(resultList->operator[](i) != nullptr, buf);
sprintf(buf, "get result[%d]=%s", i,
- dynCast<CacheableStringPtr>(resultList->operator[](i))
+ std::dynamic_pointer_cast<CacheableString>(resultList->operator[](i))
->asChar());
LOGINFO(buf);
}
@@ -292,7 +291,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
CacheableVectorPtr executeFunctionResult2 =
exe->withFilter(routingObj)->execute(FEOnRegionPrSHOP)->getResult();
- if (executeFunctionResult2 == NULLPTR) {
+ if (executeFunctionResult2 == nullptr) {
ASSERT(false, "executeFunctionResult2 is NULL");
} else {
sprintf(buf, "result count = %d", executeFunctionResult2->size());
@@ -300,7 +299,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
ASSERT(2 == executeFunctionResult2->size(),
"executeFunctionResult2 size is not 2");
for (int i = 0; i < executeFunctionResult2->size(); i++) {
- bool b = dynCast<CacheableBooleanPtr>(
+ bool b = std::dynamic_pointer_cast<CacheableBoolean>(
executeFunctionResult2->operator[](i))
->value();
LOG(b == true ? "true" : "false");
@@ -324,7 +323,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
ASSERT(2 == myRC2->getAddResultCount(), "add result count is not 2");
ASSERT(1 == myRC2->getEndResultCount(), "end result count is not 1");
ASSERT(1 == myRC2->getGetResultCount(), "get result count is not 1");
- if (executeFunctionResult21 == NULLPTR) {
+ if (executeFunctionResult21 == nullptr) {
ASSERT(false, "executeFunctionResult21 is NULL");
} else {
sprintf(buf, "result count = %d", executeFunctionResult21->size());
@@ -332,7 +331,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
ASSERT(2 == executeFunctionResult21->size(),
"executeFunctionResult21 size is not 2");
for (int i = 0; i < executeFunctionResult21->size(); i++) {
- bool b = dynCast<CacheableBooleanPtr>(
+ bool b = std::dynamic_pointer_cast<CacheableBoolean>(
executeFunctionResult21->operator[](i))
->value();
LOG(b == true ? "true" : "false");
@@ -348,7 +347,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
exe->withFilter(routingObj)
->execute(FEOnRegionPrSHOP_OptimizeForWrite)
->getResult();
- if (executeFunctionResult3 == NULLPTR) {
+ if (executeFunctionResult3 == nullptr) {
ASSERT(false, "executeFunctionResult3 is NULL");
} else {
sprintf(buf, "result count = %d", executeFunctionResult3->size());
@@ -356,7 +355,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
ASSERT(3 == executeFunctionResult3->size(),
"executeFunctionResult3->size() is not 3");
for (int i = 0; i < executeFunctionResult3->size(); i++) {
- bool b = dynCast<CacheableBooleanPtr>(
+ bool b = std::dynamic_pointer_cast<CacheableBoolean>(
executeFunctionResult3->operator[](i))
->value();
LOG(b == true ? "true" : "false");
@@ -379,7 +378,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
ASSERT(3 == myRC3->getAddResultCount(), "add result count is not 3");
ASSERT(1 == myRC3->getEndResultCount(), "end result count is not 1");
ASSERT(1 == myRC3->getGetResultCount(), "get result count is not 1");
- if (executeFunctionResult31 == NULLPTR) {
+ if (executeFunctionResult31 == nullptr) {
ASSERT(false, "executeFunctionResult31 is NULL");
} else {
sprintf(buf, "result count = %d", executeFunctionResult31->size());
@@ -387,7 +386,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
ASSERT(3 == executeFunctionResult31->size(),
"executeFunctionResult31->size() is not 3");
for (int i = 0; i < executeFunctionResult31->size(); i++) {
- bool b = dynCast<CacheableBooleanPtr>(
+ bool b = std::dynamic_pointer_cast<CacheableBoolean>(
executeFunctionResult31->operator[](i))
->value();
LOG(b == true ? "true" : "false");
@@ -400,11 +399,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
}
ExecutionPtr exc = FunctionService::onRegion(regPtr0);
- ASSERT(exc != NULLPTR, "onRegion Returned NULL");
+ ASSERT(exc != nullptr, "onRegion Returned NULL");
// Now w/o filter, chk for singlehop
CacheableVectorPtr executeFunctionResult2 =
exc->execute(FEOnRegionPrSHOP)->getResult();
- if (executeFunctionResult2 == NULLPTR) {
+ if (executeFunctionResult2 == nullptr) {
ASSERT(false, "executeFunctionResult2 is NULL");
} else {
sprintf(buf, "result count = %d", executeFunctionResult2->size());
@@ -412,7 +411,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
ASSERT(2 == executeFunctionResult2->size(),
"executeFunctionResult2 size is not 2");
for (int i = 0; i < executeFunctionResult2->size(); i++) {
- bool b = dynCast<CacheableBooleanPtr>(
+ bool b = std::dynamic_pointer_cast<CacheableBoolean>(
executeFunctionResult2->operator[](i))
->value();
LOG(b == true ? "true" : "false");
@@ -437,7 +436,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
"end result count is not 1");
ASSERT(1 == resultCollector->getGetResultCount(),
"get result count is not 1");
- if (executeFunctionResult21 == NULLPTR) {
+ if (executeFunctionResult21 == nullptr) {
ASSERT(false, "executeFunctionResult21 is NULL");
} else {
sprintf(buf, "result count = %d", executeFunctionResult21->size());
@@ -445,7 +444,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
ASSERT(2 == executeFunctionResult21->size(),
"executeFunctionResult21 size is not 2");
for (int i = 0; i < executeFunctionResult21->size(); i++) {
- bool b = dynCast<CacheableBooleanPtr>(
+ bool b = std::dynamic_pointer_cast<CacheableBoolean>(
executeFunctionResult21->operator[](i))
->value();
LOG(b == true ? "true" : "false");
@@ -466,7 +465,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
ASSERT(3 == rC->getAddResultCount(), "add result count is not 3");
ASSERT(1 == rC->getEndResultCount(), "end result count is not 1");
ASSERT(1 == rC->getGetResultCount(), "get result count is not 1");
- if (executeFunctionResult31 == NULLPTR) {
+ if (executeFunctionResult31 == nullptr) {
ASSERT(false, "executeFunctionResult31 is NULL");
} else {
sprintf(buf, "result count = %d", executeFunctionResult31->size());
@@ -474,7 +473,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
ASSERT(3 == executeFunctionResult31->size(),
"executeFunctionResult31->size() is not 3");
for (int i = 0; i < executeFunctionResult31->size(); i++) {
- bool b = dynCast<CacheableBooleanPtr>(
+ bool b = std::dynamic_pointer_cast<CacheableBoolean>(
executeFunctionResult31->operator[](i))
->value();
LOG(b == true ? "true" : "false");
@@ -488,14 +487,14 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
// Now w/o filter chk for singleHop
CacheableVectorPtr functionResult =
exc->execute(FEOnRegionPrSHOP_OptimizeForWrite)->getResult();
- if (functionResult == NULLPTR) {
+ if (functionResult == nullptr) {
ASSERT(false, "functionResult is NULL");
} else {
sprintf(buf, "result count = %d", functionResult->size());
LOG(buf);
ASSERT(3 == functionResult->size(), "FunctionResult->size() is not 3");
for (int i = 0; i < functionResult->size(); i++) {
- bool b = dynCast<CacheableBooleanPtr>(functionResult->operator[](i))
+ bool b = std::dynamic_pointer_cast<CacheableBoolean>(functionResult->operator[](i))
->value();
LOG(b == true ? "true" : "false");
ASSERT(b == true, "true is not eched back");
@@ -527,8 +526,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
"arrList "
"arguement done.");
for (int i = 0; i < fil->size(); i++) {
- CacheableStringPtr str = fil->at(i);
- CacheableStringPtr val = dynCast<CacheableStringPtr>(regPtr0->get(str));
+ auto str = std::dynamic_pointer_cast<CacheableString>(fil->at(i));
+ auto val = std::dynamic_pointer_cast<CacheableString>(regPtr0->get(str));
LOGINFO("Filter Key = %s , get Value = %s ", str->asChar(),
val->asChar());
if (strcmp(str->asChar(), val->asChar()) != 0) {
@@ -550,8 +549,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
"arguement done.");
SLEEP(4000);
for (int i = 0; i < arrList->size(); i++) {
- CacheableStringPtr str = arrList->at(i);
- CacheableStringPtr val = dynCast<CacheableStringPtr>(regPtr0->get(str));
+ auto str = std::dynamic_pointer_cast<CacheableString>(arrList->at(i));
+ auto val = std::dynamic_pointer_cast<CacheableString>(regPtr0->get(str));
LOGINFO("Filter Key = %s ", str->asChar());
LOGINFO("get Value = %s ", val->asChar());
if (strcmp(str->asChar(), val->asChar()) != 0) {
@@ -566,14 +565,14 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest2)
RexecutionPtr->withArgs(CacheableInt32::create(5000 * 1000))
->execute(FETimeOut, 5000)
->getResult();
- if (fe == NULLPTR) {
+ if (fe == nullptr) {
ASSERT(false, "functionResult is NULL");
} else {
sprintf(buf, "result count = %d", fe->size());
LOG(buf);
ASSERT(2 == fe->size(), "FunctionResult->size() is not 2");
for (int i = 0; i < fe->size(); i++) {
- bool b = dynCast<CacheableBooleanPtr>(fe->operator[](i))->value();
+ bool b = std::dynamic_pointer_cast<CacheableBoolean>(fe->operator[](i))->value();
LOG(b == true ? "true" : "false");
ASSERT(b == true, "true is not eched back");
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientFixedPartitionResolver.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientFixedPartitionResolver.cpp b/src/cppcache/integration-test/testThinClientFixedPartitionResolver.cpp
index b274898..bfede81 100644
--- a/src/cppcache/integration-test/testThinClientFixedPartitionResolver.cpp
+++ b/src/cppcache/integration-test/testThinClientFixedPartitionResolver.cpp
@@ -73,7 +73,7 @@ class CustomFixedPartitionResolver1 : public FixedPartitionResolver {
}
}
};
-FixedPartitionResolverPtr cptr1(new CustomFixedPartitionResolver1());
+auto cptr1 = std::make_shared<CustomFixedPartitionResolver1>();
class CustomFixedPartitionResolver2 : public FixedPartitionResolver {
public:
@@ -112,7 +112,7 @@ class CustomFixedPartitionResolver2 : public FixedPartitionResolver {
}
}
};
-FixedPartitionResolverPtr cptr2(new CustomFixedPartitionResolver2());
+auto cptr2 = std::make_shared<CustomFixedPartitionResolver2>();
class CustomFixedPartitionResolver3 : public FixedPartitionResolver {
public:
@@ -145,7 +145,7 @@ class CustomFixedPartitionResolver3 : public FixedPartitionResolver {
}
}
};
-FixedPartitionResolverPtr cptr3(new CustomFixedPartitionResolver3());
+auto cptr3 = std::make_shared<CustomFixedPartitionResolver3>();
#define CLIENT1 s1p1
#define SERVER1 s2p1
@@ -231,8 +231,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask_REGION)
RegionPtr dataReg = getHelper()->getRegion(partitionRegionName);
for (int i = 0; i < 3000; i++) {
- CacheableKeyPtr keyPtr =
- dynCast<CacheableKeyPtr>(CacheableInt32::create(i));
+ auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
try {
LOGDEBUG("CPPTEST: Putting key %d with hashcode %d", i,
@@ -278,8 +277,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask_REGION)
LOG("CheckPrSingleHopForIntKeysTask_REGION put completed.");
for (int i = 0; i < 1000; i++) {
- CacheableKeyPtr keyPtr =
- dynCast<CacheableKeyPtr>(CacheableInt32::create(i));
+ auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
try {
LOGDEBUG("CPPTEST: getting key %d with hashcode %d", i,
@@ -326,8 +324,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask_REGION)
keys.push_back(CacheableInt32::create(j));
}
- HashMapOfCacheablePtr values(new HashMapOfCacheable());
- HashMapOfExceptionPtr exceptions(new HashMapOfException());
+ auto values = std::make_shared<HashMapOfCacheable>();
+ auto exceptions = std::make_shared<HashMapOfException>();
try {
dataReg->getAll(keys, values, exceptions, false);
@@ -405,8 +403,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask_REGION)
LOG("CheckPrSingleHopForIntKeysTask_REGION getAll completed.");
for (int i = 0; i < 1000; i++) {
- CacheableKeyPtr keyPtr =
- dynCast<CacheableKeyPtr>(CacheableInt32::create(i));
+ auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
try {
LOGDEBUG("CPPTEST: destroying key %d with hashcode %d", i,
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientGetInterests.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientGetInterests.cpp b/src/cppcache/integration-test/testThinClientGetInterests.cpp
index 51c8558..d227dbb 100644
--- a/src/cppcache/integration-test/testThinClientGetInterests.cpp
+++ b/src/cppcache/integration-test/testThinClientGetInterests.cpp
@@ -55,11 +55,11 @@ DUNIT_TASK(CLIENT1, SetupClient1)
RegionPtr regPtr0 = getHelper()->getRegion(regionNames[0]);
VectorOfCacheableKey keys0;
keys0.push_back(keyPtr0);
- regPtr0->registerKeys(keys0, NULLPTR);
+ regPtr0->registerKeys(keys0);
CacheableKeyPtr keyPtr1 = CacheableString::create(keys[1]);
VectorOfCacheableKey keys1;
keys1.push_back(keyPtr1);
- regPtr0->registerKeys(keys1, NULLPTR);
+ regPtr0->registerKeys(keys1);
regPtr0->registerRegex(testregex[0]);
regPtr0->registerRegex(testregex[1]);
CacheableKeyPtr keyPtr2 = CacheableString::create(keys[2]);
@@ -68,7 +68,7 @@ DUNIT_TASK(CLIENT1, SetupClient1)
keyPtr2 = CacheableString::create(keys[3]);
keys2.push_back(keyPtr2);
// durable
- regPtr0->registerKeys(keys2, NULLPTR, true);
+ regPtr0->registerKeys(keys2, false, true);
regPtr0->registerRegex(testregex[2], true);
VectorOfCacheableKey vkey;
@@ -77,7 +77,7 @@ DUNIT_TASK(CLIENT1, SetupClient1)
regPtr0->getInterestListRegex(vreg);
for (int32_t i = 0; i < vkey.length(); i++) {
char buf[1024];
- const char* key = dynCast<CacheableStringPtr>(vkey[i])->asChar();
+ const char* key = std::dynamic_pointer_cast<CacheableString>(vkey[i])->asChar();
sprintf(buf, "key[%d]=%s", i, key);
LOG(buf);
bool found = false;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientHADistOps.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientHADistOps.cpp b/src/cppcache/integration-test/testThinClientHADistOps.cpp
index e592c7d..316df4c 100644
--- a/src/cppcache/integration-test/testThinClientHADistOps.cpp
+++ b/src/cppcache/integration-test/testThinClientHADistOps.cpp
@@ -106,7 +106,7 @@ void _verifyEntry(const char* name, const char* key, const char* val,
free(buf);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
CacheableKeyPtr keyPtr = createKey(key);
@@ -144,10 +144,9 @@ void _verifyEntry(const char* name, const char* key, const char* val,
}
if (val != NULL) {
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
- ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null.");
+ ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
sprintf(buf, "In verify loop, get returned %s for key %s",
checkPtr->asChar(), key);
@@ -202,7 +201,7 @@ void destroyEntry(const char* name, const char* key) {
CacheableKeyPtr keyPtr = CacheableKey::create(key);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
@@ -220,8 +219,8 @@ void createRegion(const char* name, bool ackMode,
fflush(stdout);
char* endpoints = NULL;
RegionPtr regPtr = getHelper()->createRegion(
- name, ackMode, true, NULLPTR, endpoints, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ name, ackMode, true, nullptr, endpoints, clientNotificationEnabled);
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
@@ -236,7 +235,7 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators,
poolname, locators, NULL, reduendency, clientNotificationEnabled);
RegionPtr regPtr = getHelper()->createRegionAndAttachPool(
name, ackMode, poolname, cachingEnable);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
void createEntry(const char* name, const char* key, const char* value) {
@@ -249,7 +248,7 @@ void createEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
@@ -274,7 +273,7 @@ void updateEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
ASSERT(regPtr->containsValueForKey(keyPtr),
@@ -299,12 +298,11 @@ void doGetAgain(const char* name, const char* key, const char* value) {
RegionPtr regPtr = getHelper()->getRegion(name);
fprintf(stdout, "get region name%s\n", regPtr->getName());
fflush(stdout);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); // force a netsearch
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr)); // force a netsearch
- if (checkPtr != NULLPTR) {
+ if (checkPtr != nullptr) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In doGetAgain, get returned %s for key %s",
@@ -331,7 +329,7 @@ void doNetsearch(const char* name, const char* key, const char* value) {
RegionPtr regPtr = getHelper()->getRegion(name);
fprintf(stdout, "netsearch region %s\n", regPtr->getName());
fflush(stdout);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
if (count == 0) {
ASSERT(!regPtr->containsKey(keyPtr),
@@ -340,10 +338,9 @@ void doNetsearch(const char* name, const char* key, const char* value) {
"Value should not have been found in region.");
count++;
}
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); // force a netsearch
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr)); // force a netsearch
- if (checkPtr != NULLPTR) {
+ if (checkPtr != nullptr) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientHAEventIDMap.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientHAEventIDMap.cpp b/src/cppcache/integration-test/testThinClientHAEventIDMap.cpp
index 449a95a..43d2a92 100644
--- a/src/cppcache/integration-test/testThinClientHAEventIDMap.cpp
+++ b/src/cppcache/integration-test/testThinClientHAEventIDMap.cpp
@@ -37,12 +37,12 @@ class DupChecker : public CacheListener {
m_ops++;
CacheableKeyPtr key = event.getKey();
- CacheableInt32Ptr value = dynCast<CacheableInt32Ptr>(event.getNewValue());
+ auto value = std::dynamic_pointer_cast<CacheableInt32>(event.getNewValue());
HashMapOfCacheable::Iterator item = m_map.find(key);
if (item != m_map.end()) {
- CacheableInt32Ptr check = dynCast<CacheableInt32Ptr>(item.second());
+ auto check = std::dynamic_pointer_cast<CacheableInt32>(item.second());
ASSERT(check->value() + 1 == value->value(),
"Duplicate or older value received");
m_map.update(key, value);
@@ -62,7 +62,7 @@ class DupChecker : public CacheListener {
for (HashMapOfCacheable::Iterator item = m_map.begin(); item != m_map.end();
item++) {
- CacheableInt32Ptr check = dynCast<CacheableInt32Ptr>(item.second());
+ auto check = std::dynamic_pointer_cast<CacheableInt32>(item.second());
ASSERT(check->value() == 100, "Expected final value to be 100");
}
}
@@ -138,7 +138,7 @@ void _verifyEntry(const char* name, const char* key, const char* val,
free(buf);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
CacheableKeyPtr keyPtr = createKey(key);
@@ -188,10 +188,9 @@ void _verifyEntry(const char* name, const char* key, const char* val,
}
if (val != NULL) {
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
- ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null.");
+ ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
sprintf(buf, "In verify loop, get returned %s for key %s",
checkPtr->asChar(), key);
@@ -229,7 +228,7 @@ void _verifyIntEntry(const char* name, const char* key, const int val,
free(buf);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
CacheableKeyPtr keyPtr = createKey(key);
@@ -279,10 +278,9 @@ void _verifyIntEntry(const char* name, const char* key, const int val,
}
if (val != 0) {
- CacheableInt32Ptr checkPtr =
- dynCast<CacheableInt32Ptr>(regPtr->get(keyPtr));
+ auto checkPtr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(keyPtr));
- ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null.");
+ ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
sprintf(buf, "In verify loop, get returned %d for key %s",
checkPtr->value(), key);
@@ -340,8 +338,8 @@ void createRegion(const char* name, bool ackMode,
char* endpoints = NULL;
// ack, caching
RegionPtr regPtr = getHelper()->createRegion(
- name, ackMode, true, NULLPTR, endpoints, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ name, ackMode, true, nullptr, endpoints, clientNotificationEnabled);
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
@@ -355,7 +353,7 @@ void createEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
@@ -380,7 +378,7 @@ void createIntEntry(const char* name, const char* key, const int value) {
CacheableInt32Ptr valPtr = CacheableInt32::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
// ASSERT( !regPtr->containsKey( keyPtr ), "Key should not have been found in
// region." );
@@ -452,8 +450,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, InitClient2)
initClientAndRegion(1);
LOG("Initialized client with redundancy level 1.");
- checker1 = new DupChecker();
- checker2 = new DupChecker();
+ checker1 = std::make_shared<DupChecker>();
+ checker2 = std::make_shared<DupChecker>();
setCacheListener(regionNames[0], checker1);
setCacheListener(regionNames[1], checker2);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientHAFailover.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientHAFailover.cpp b/src/cppcache/integration-test/testThinClientHAFailover.cpp
index 265ed5b..6ed19ac 100644
--- a/src/cppcache/integration-test/testThinClientHAFailover.cpp
+++ b/src/cppcache/integration-test/testThinClientHAFailover.cpp
@@ -107,7 +107,7 @@ void _verifyEntry(const char* name, const char* key, const char* val,
free(buf);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
CacheableKeyPtr keyPtr = createKey(key);
@@ -157,10 +157,9 @@ void _verifyEntry(const char* name, const char* key, const char* val,
}
if (val != NULL) {
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
- ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null.");
+ ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
sprintf(buf, "In verify loop, get returned %s for key %s",
checkPtr->asChar(), key);
@@ -206,8 +205,8 @@ void createRegion(const char* name, bool ackMode,
char* endpoints = NULL;
// ack, caching
RegionPtr regPtr = getHelper()->createRegion(
- name, ackMode, true, NULLPTR, endpoints, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ name, ackMode, true, nullptr, endpoints, clientNotificationEnabled);
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
void createEntry(const char* name, const char* key, const char* value) {
@@ -220,7 +219,7 @@ void createEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
@@ -245,7 +244,7 @@ void updateEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
// ASSERT( regPtr->containsValueForKey( keyPtr ), "Value should have been
@@ -271,17 +270,16 @@ void doNetsearch(const char* name, const char* key, const char* value) {
RegionPtr regPtr = getHelper()->getRegion(name);
fprintf(stdout, "netsearch region %s\n", regPtr->getName());
fflush(stdout);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
// ASSERT( !regPtr->containsKey( keyPtr ), "Key should not have been found in
// region." );
// ASSERT( !regPtr->containsValueForKey( keyPtr ), "Value should not have been
// found in region." );
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); // force a netsearch
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr)); // force a netsearch
- if (checkPtr != NULLPTR) {
+ if (checkPtr != nullptr) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
[17/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from cppcache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientPdxTests.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientPdxTests.cpp b/src/cppcache/integration-test/testThinClientPdxTests.cpp
index 756eac9..445142b 100644
--- a/src/cppcache/integration-test/testThinClientPdxTests.cpp
+++ b/src/cppcache/integration-test/testThinClientPdxTests.cpp
@@ -81,7 +81,7 @@ bool genericValCompare(T1 value1, T2 value2) /*const*/
}
void initClient(const bool isthinClient, bool isPdxIgnoreUnreadFields,
- const PropertiesPtr& configPtr = NULLPTR) {
+ const PropertiesPtr& configPtr = nullptr) {
LOGINFO("isPdxIgnoreUnreadFields = %d ", isPdxIgnoreUnreadFields);
if (cacheHelper == NULL) {
cacheHelper = new CacheHelper(isthinClient, isPdxIgnoreUnreadFields, false,
@@ -94,7 +94,7 @@ void initClient(const bool isthinClient, bool isPdxIgnoreUnreadFields,
void initClientN(const bool isthinClient, bool isPdxIgnoreUnreadFields,
bool isPdxReadSerialized = false,
- const PropertiesPtr& configPtr = NULLPTR) {
+ const PropertiesPtr& configPtr = nullptr) {
LOGINFO("isPdxIgnoreUnreadFields = %d ", isPdxIgnoreUnreadFields);
if (cacheHelper == NULL) {
cacheHelper = new CacheHelper(isthinClient, isPdxIgnoreUnreadFields,
@@ -105,7 +105,7 @@ void initClientN(const bool isthinClient, bool isPdxIgnoreUnreadFields,
void stepOneN(bool isPdxIgnoreUnreadFields = false,
bool isPdxReadSerialized = false,
- PropertiesPtr config = NULLPTR) {
+ PropertiesPtr config = nullptr) {
try {
// Serializable::registerType(Position::createDeserializable);
// Serializable::registerType(Portfolio::createDeserializable);
@@ -126,23 +126,23 @@ void stepOneN(bool isPdxIgnoreUnreadFields = false,
DUNIT_TASK_DEFINITION(CLIENT1, StepOnePoolLoc1)
{
LOG("Starting Step One with Pool + Locator lists");
- stepOneN(false, true, NULLPTR);
+ stepOneN(false, true, nullptr);
}
END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT2, StepTwoPoolLoc1)
{
LOG("Starting Step Two with Pool + Locator");
- stepOneN(false, true, NULLPTR);
+ stepOneN(false, true, nullptr);
}
END_TASK_DEFINITION
///////////////
void initClient1WithClientName(const bool isthinClient,
- const PropertiesPtr& configPtr = NULLPTR) {
+ const PropertiesPtr& configPtr = nullptr) {
if (cacheHelper == NULL) {
PropertiesPtr config = configPtr;
- if (config == NULLPTR) {
+ if (config == nullptr) {
config = Properties::create();
}
config->insert("name", "Client-1");
@@ -152,10 +152,10 @@ void initClient1WithClientName(const bool isthinClient,
}
void initClient2WithClientName(const bool isthinClient,
- const PropertiesPtr& configPtr = NULLPTR) {
+ const PropertiesPtr& configPtr = nullptr) {
if (cacheHelper == NULL) {
PropertiesPtr config = configPtr;
- if (config == NULLPTR) {
+ if (config == nullptr) {
config = Properties::create();
}
config->insert("name", "Client-2");
@@ -186,7 +186,7 @@ void stepOneForClient2(bool isPdxIgnoreUnreadFields = false) {
LOG("StepOne complete.");
}
void stepOne(bool isPdxIgnoreUnreadFields = false,
- PropertiesPtr config = NULLPTR) {
+ PropertiesPtr config = nullptr) {
try {
// Serializable::registerType(Position::createDeserializable);
// Serializable::registerType(Portfolio::createDeserializable);
@@ -385,8 +385,7 @@ END_TASK_DEFINITION
void checkPdxInstanceToStringAtServer(RegionPtr regionPtr) {
CacheableKeyPtr keyport = CacheableKey::create("success");
- CacheableBooleanPtr boolPtr =
- dynCast<CacheableBooleanPtr>(regionPtr->get(keyport));
+ auto boolPtr = std::dynamic_pointer_cast<CacheableBoolean>(regionPtr->get(keyport));
bool val = boolPtr->value();
// TODO::Enable asser and disable LOGINFO
ASSERT(val == true, "checkPdxInstanceToStringAtServer: Val should be true");
@@ -414,12 +413,13 @@ DUNIT_TASK_DEFINITION(CLIENT1, testPdxWriterAPIsWithInvalidArgs)
// Put operation
CacheableKeyPtr keyport = CacheableKey::create(1);
- CacheablePtr pdxobj(new PdxTests::InvalidPdxUsage());
+ auto pdxobj = std::make_shared<PdxTests::InvalidPdxUsage>();
regPtr0->put(keyport, pdxobj);
// Check the exception count:: expected is 41.
- expectedExceptionCount = (dynCast<PdxTests::InvalidPdxUsagePtr>(pdxobj))
- ->gettoDataExceptionCount();
+ expectedExceptionCount =
+ (std::dynamic_pointer_cast<PdxTests::InvalidPdxUsage>(pdxobj))
+ ->gettoDataExceptionCount();
// LOGINFO("TASK::testPdxWriterAPIsWithInvalidArgs:: toData ExceptionCount
// ::
// %d ", expectedExceptionCount);
@@ -429,7 +429,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, testPdxWriterAPIsWithInvalidArgs)
// Get Operation and check fromDataExceptionCount, Expected is 41.
PdxTests::InvalidPdxUsagePtr obj2 =
- dynCast<PdxTests::InvalidPdxUsagePtr>(regPtr0->get(keyport));
+ std::dynamic_pointer_cast<PdxTests::InvalidPdxUsage>(
+ regPtr0->get(keyport));
// LOGINFO("TASK::testPdxWriterAPIsWithInvalidArgs:: fromData ExceptionCOunt
// :: %d ", obj2->getfromDataExceptionCount());
expectedExceptionCount = obj2->getfromDataExceptionCount();
@@ -460,7 +461,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, testPdxReaderAPIsWithInvalidArgs)
// Get Operation. Check fromDataExceptionCount. Expected is 41.
CacheableKeyPtr keyport1 = CacheableKey::create(1);
PdxTests::InvalidPdxUsagePtr obj1 =
- dynCast<PdxTests::InvalidPdxUsagePtr>(regPtr0->get(keyport1));
+ std::dynamic_pointer_cast<PdxTests::InvalidPdxUsage>(
+ regPtr0->get(keyport1));
// Check the exception count:: expected is 41.
// LOGINFO("TASK::testPdxReaderAPIsWithInvalidArgs:: fromDataExceptionCount
@@ -488,18 +490,18 @@ DUNIT_TASK_DEFINITION(CLIENT1, testPutWithMultilevelInheritance)
// Put operation
CacheableKeyPtr keyport = CacheableKey::create(1);
- CacheablePtr pdxobj(new PdxTests::Child());
+ auto pdxobj = std::make_shared<PdxTests::Child>();
regPtr0->put(keyport, pdxobj);
LOGINFO("TASK::testPutWithMultilevelInheritance:: Put successful");
// Get Operation and check fromDataExceptionCount, Expected is 41.
PdxTests::ChildPtr obj2 =
- dynCast<PdxTests::ChildPtr>(regPtr0->get(keyport));
+ std::dynamic_pointer_cast<PdxTests::Child>(regPtr0->get(keyport));
// LOGINFO("Task: testPutWithMultilevelInheritance: got members :: %d %d %d
// %d
// %d %d ", obj2->getMember_a(), obj2->getMember_b(), obj2->getMember_c(),
// obj2->getMember_d(), obj2->getMember_e(), obj2->getMember_f());
- bool isEqual = (dynCast<PdxTests::ChildPtr>(pdxobj))->equals(obj2);
+ bool isEqual = (std::dynamic_pointer_cast<PdxTests::Child>(pdxobj))->equals(obj2);
LOGINFO("testPutWithMultilevelInheritance:.. isEqual = %d", isEqual);
ASSERT(isEqual == true, "Objects of type class Child should be equal");
@@ -519,10 +521,10 @@ DUNIT_TASK_DEFINITION(CLIENT2, testGetWithMultilevelInheritance)
CacheableKeyPtr keyport1 = CacheableKey::create(1);
PdxTests::ChildPtr obj1 =
- dynCast<PdxTests::ChildPtr>(regPtr0->get(keyport1));
+ std::dynamic_pointer_cast<PdxTests::Child>(regPtr0->get(keyport1));
- CacheablePtr pdxobj(new PdxTests::Child());
- bool isEqual = (dynCast<PdxTests::ChildPtr>(pdxobj))->equals(obj1);
+ auto pdxobj = std::make_shared<PdxTests::Child>();
+ bool isEqual = (std::dynamic_pointer_cast<PdxTests::Child>(pdxobj))->equals(obj1);
LOGINFO("testPutWithMultilevelInheritance:.. isEqual = %d", isEqual);
ASSERT(isEqual == true, "Objects of type class Child should be equal");
// LOGINFO("Task: testGetWithMultilevelInheritance: got members :: %d %d %d
@@ -544,19 +546,17 @@ DUNIT_TASK_DEFINITION(CLIENT1, JavaPutGet1)
CacheableInt32Ptr valPtr = CacheableInt32::create(123);
regPtr0->put(keyport, valPtr);
- CacheableInt32Ptr getVal =
- dynCast<CacheableInt32Ptr>(regPtr0->get(keyport));
+ auto getVal = std::dynamic_pointer_cast<CacheableInt32>(regPtr0->get(keyport));
- CacheableBooleanPtr boolPtr =
- dynCast<CacheableBooleanPtr>(regPtr0->get("success"));
+ auto boolPtr = std::dynamic_pointer_cast<CacheableBoolean>(regPtr0->get("success"));
- bool isEqual = boolPtr.ptr()->value();
+ bool isEqual = boolPtr.get()->value();
ASSERT(isEqual == true,
"Task JavaPutGet:Objects of type PdxType should be equal");
LOGINFO("Task:JavaPutGet PDX-ON read-serialized = %d",
cacheHelper->getCache()->getPdxReadSerialized());
- PdxInstancePtr jsonDoc = dynCast<PdxInstancePtr>(regPtr0->get("jsondoc1"));
+ auto jsonDoc = std::dynamic_pointer_cast<PdxInstance>(regPtr0->get("jsondoc1"));
CacheableStringPtr toString = jsonDoc->toString();
LOGINFO("Task:JavaPutGet: Result = %s ", toString->asChar());
/*
@@ -570,9 +570,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, JavaPutGet1)
jsonDoc->getField("lastName", &stringVal1);
*/
- CacheablePtr object2 = NULLPTR;
+ CacheablePtr object2 = nullptr;
jsonDoc->getField("kids", object2);
- CacheableLinkedListPtr listPtr = dynCast<CacheableLinkedListPtr>(object2);
+ auto listPtr = std::dynamic_pointer_cast<CacheableLinkedList>(object2);
LOGINFO("Task:JavaPutGet: list size = %d", listPtr->size());
CacheableLinkedListPtr m_linkedlist = CacheableLinkedList::create();
@@ -608,29 +608,28 @@ DUNIT_TASK_DEFINITION(CLIENT1, JavaPutGet)
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
CacheableKeyPtr keyport = CacheableKey::create(1);
- CacheablePtr pdxobj(new PdxTests::PdxType());
+ auto pdxobj = std::make_shared<PdxTests::PdxType>();
regPtr0->put(keyport, pdxobj);
PdxTests::PdxTypePtr obj2 =
- dynCast<PdxTests::PdxTypePtr>(regPtr0->get(keyport));
+ std::dynamic_pointer_cast<PdxTests::PdxType>(regPtr0->get(keyport));
- CacheableBooleanPtr boolPtr =
- dynCast<CacheableBooleanPtr>(regPtr0->get("success"));
- bool isEqual = boolPtr.ptr()->value();
+ auto boolPtr = std::dynamic_pointer_cast<CacheableBoolean>(regPtr0->get("success"));
+ bool isEqual = boolPtr.get()->value();
LOGDEBUG("Task:JavaPutGet: isEqual = %d", isEqual);
ASSERT(isEqual == true,
"Task JavaPutGet:Objects of type PdxType should be equal");
/*
LOGINFO("NILKATH JavaPutGet new test.");
- dynamic_cast<CacheImpl*>(cacheHelper->getCache().ptr())->setPdxReadSerialized(true);
+ dynamic_cast<CacheImpl*>(cacheHelper->getCache().get())->setPdxReadSerialized(true);
LOGINFO("NILKATH JavaPutGet PDX-ON read-serialized = %d",
cacheHelper->getCache()->getPdxReadSerialized());
- PdxInstancePtr jsonDoc = dynCast<PdxInstancePtr>(regPtr0->get("jsondoc1"));
+ auto jsonDoc = std::dynamic_pointer_cast<PdxInstance>(regPtr0->get("jsondoc1"));
int age = 0;
jsonDoc->getField("age", age);
LOGINFO("NILKATH:: Task:JavaPutGet: age = %d", age);
- dynamic_cast<CacheImpl*>(cacheHelper->getCache().ptr())->setPdxReadSerialized(false);
+ dynamic_cast<CacheImpl*>(cacheHelper->getCache().get())->setPdxReadSerialized(false);
LOGINFO("NILKATH JavaPutGet PDX-OFF read-serialized = %d",
cacheHelper->getCache()->getPdxReadSerialized());
*/
@@ -653,15 +652,15 @@ DUNIT_TASK_DEFINITION(CLIENT2, JavaGet)
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
CacheableKeyPtr keyport1 = CacheableKey::create(1);
- CacheablePtr pdxobj(new PdxTests::PdxType());
+ auto pdxobj = std::make_shared<PdxTests::PdxType>();
LOGDEBUG("JavaGet-2 Line_314");
PdxTests::PdxTypePtr obj1 =
- dynCast<PdxTests::PdxTypePtr>(regPtr0->get(keyport1));
+ std::dynamic_pointer_cast<PdxTests::PdxType>(regPtr0->get(keyport1));
LOGDEBUG("JavaGet-3 Line_316");
CacheableKeyPtr keyport2 = CacheableKey::create("putFromjava");
LOGDEBUG("JavaGet-4 Line_316");
PdxTests::PdxTypePtr obj2 =
- dynCast<PdxTests::PdxTypePtr>(regPtr0->get(keyport2));
+ std::dynamic_pointer_cast<PdxTests::PdxType>(regPtr0->get(keyport2));
LOGDEBUG("JavaGet-5 Line_320");
}
END_TASK_DEFINITION
@@ -678,11 +677,11 @@ DUNIT_TASK_DEFINITION(CLIENT2, putAtVersionTwoR21)
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
CacheableKeyPtr keyport = CacheableKey::create(1);
- PdxTypesR2V2Ptr np(new PdxTypesR2V2());
+ auto np = std::make_shared<PdxTypesR2V2>();
regPtr0->put(keyport, np);
- PdxTypesR2V2Ptr pRet = dynCast<PdxTypesR2V2Ptr>(regPtr0->get(keyport));
+ auto pRet = std::dynamic_pointer_cast<PdxTypesR2V2>(regPtr0->get(keyport));
bool isEqual = np->equals(pRet);
LOGDEBUG("putAtVersionTwoR21:.. isEqual = %d", isEqual);
@@ -704,9 +703,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, getPutAtVersionOneR22)
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
CacheableKeyPtr keyport = CacheableKey::create(1);
- PdxTypesV1R2Ptr np(new PdxTypesV1R2());
+ auto np = std::make_shared<PdxTypesV1R2>();
- PdxTypesV1R2Ptr pRet = dynCast<PdxTypesV1R2Ptr>(regPtr0->get(keyport));
+ auto pRet = std::dynamic_pointer_cast<PdxTypesV1R2>(regPtr0->get(keyport));
bool isEqual = np->equals(pRet);
LOGDEBUG("getPutAtVersionOneR22:.. isEqual = %d", isEqual);
@@ -724,9 +723,9 @@ DUNIT_TASK_DEFINITION(CLIENT2, getPutAtVersionTwoR23)
CacheableKeyPtr keyport = CacheableKey::create(1);
- PdxTypesR2V2Ptr np(new PdxTypesR2V2());
+ auto np = std::make_shared<PdxTypesR2V2>();
- PdxTypesR2V2Ptr pRet = dynCast<PdxTypesR2V2Ptr>(regPtr0->get(keyport));
+ auto pRet = std::dynamic_pointer_cast<PdxTypesR2V2>(regPtr0->get(keyport));
bool isEqual = np->equals(pRet);
LOGDEBUG("getPutAtVersionTwoR23:.. isEqual = %d", isEqual);
@@ -743,9 +742,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, getPutAtVersionOneR24)
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
CacheableKeyPtr keyport = CacheableKey::create(1);
- PdxTypesV1R2Ptr np(new PdxTypesV1R2());
+ auto np = std::make_shared<PdxTypesV1R2>();
- PdxTypesV1R2Ptr pRet = dynCast<PdxTypesV1R2Ptr>(regPtr0->get(keyport));
+ auto pRet = std::dynamic_pointer_cast<PdxTypesV1R2>(regPtr0->get(keyport));
bool isEqual = np->equals(pRet);
LOGDEBUG("getPutAtVersionOneR24:.. isEqual = %d", isEqual);
@@ -768,11 +767,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, putAtVersionOne31)
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
CacheableKeyPtr keyport = CacheableKey::create(1);
- PdxType3V1Ptr np(new PdxType3V1());
+ auto np = std::make_shared<PdxType3V1>();
regPtr0->put(keyport, np);
- PdxType3V1Ptr pRet = dynCast<PdxType3V1Ptr>(regPtr0->get(keyport));
+ auto pRet = std::dynamic_pointer_cast<PdxType3V1>(regPtr0->get(keyport));
bool isEqual = np->equals(pRet);
LOGDEBUG("Task:putAtVersionOne31: isEqual = %d", isEqual);
@@ -791,11 +790,11 @@ DUNIT_TASK_DEFINITION(CLIENT2, getPutAtVersionTwo32)
}
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
- PdxTypes3V2Ptr np(new PdxTypes3V2());
+ auto np = std::make_shared<PdxTypes3V2>();
CacheableKeyPtr keyport = CacheableKey::create(1);
- PdxTypes3V2Ptr pRet = dynCast<PdxTypes3V2Ptr>(regPtr0->get(keyport));
+ auto pRet = std::dynamic_pointer_cast<PdxTypes3V2>(regPtr0->get(keyport));
bool isEqual = np->equals(pRet);
LOGDEBUG("Task:getPutAtVersionTwo32.. isEqual = %d", isEqual);
ASSERT(
@@ -811,9 +810,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, getPutAtVersionOne33)
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
CacheableKeyPtr keyport = CacheableKey::create(1);
- PdxType3V1Ptr np(new PdxType3V1());
+ auto np = std::make_shared<PdxType3V1>();
- PdxType3V1Ptr pRet = dynCast<PdxType3V1Ptr>(regPtr0->get(keyport));
+ auto pRet = std::dynamic_pointer_cast<PdxType3V1>(regPtr0->get(keyport));
bool isEqual = np->equals(pRet);
LOGDEBUG("getPutAtVersionOne33:.. isEqual = %d", isEqual);
@@ -829,11 +828,11 @@ DUNIT_TASK_DEFINITION(CLIENT2, getPutAtVersionTwo34)
{
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
- PdxTypes3V2Ptr np(new PdxTypes3V2());
+ auto np = std::make_shared<PdxTypes3V2>();
CacheableKeyPtr keyport = CacheableKey::create(1);
- PdxTypes3V2Ptr pRet = dynCast<PdxTypes3V2Ptr>(regPtr0->get(keyport));
+ auto pRet = std::dynamic_pointer_cast<PdxTypes3V2>(regPtr0->get(keyport));
bool isEqual = np->equals(pRet);
LOGDEBUG("Task:getPutAtVersionTwo34: isEqual = %d", isEqual);
@@ -855,11 +854,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, putAtVersionOne21)
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
CacheableKeyPtr keyport = CacheableKey::create(1);
- PdxType2V1Ptr np(new PdxType2V1());
+ auto np = std::make_shared<PdxType2V1>();
regPtr0->put(keyport, np);
- PdxType2V1Ptr pRet = dynCast<PdxType2V1Ptr>(regPtr0->get(keyport));
+ auto pRet = std::dynamic_pointer_cast<PdxType2V1>(regPtr0->get(keyport));
bool isEqual = np->equals(pRet);
LOGDEBUG("Task:putAtVersionOne21:.. isEqual = %d", isEqual);
@@ -878,11 +877,11 @@ DUNIT_TASK_DEFINITION(CLIENT2, getPutAtVersionTwo22)
}
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
- PdxTypes2V2Ptr np(new PdxTypes2V2());
+ auto np = std::make_shared<PdxTypes2V2>();
CacheableKeyPtr keyport = CacheableKey::create(1);
- PdxTypes2V2Ptr pRet = dynCast<PdxTypes2V2Ptr>(regPtr0->get(keyport));
+ auto pRet = std::dynamic_pointer_cast<PdxTypes2V2>(regPtr0->get(keyport));
bool isEqual = np->equals(pRet);
LOGDEBUG("Task:getPutAtVersionTwo22.. isEqual = %d", isEqual);
ASSERT(
@@ -897,11 +896,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, getPutAtVersionOne23)
{
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
- PdxType2V1Ptr np(new PdxType2V1());
+ auto np = std::make_shared<PdxType2V1>();
CacheableKeyPtr keyport = CacheableKey::create(1);
- PdxType2V1Ptr pRet = dynCast<PdxType2V1Ptr>(regPtr0->get(keyport));
+ auto pRet = std::dynamic_pointer_cast<PdxType2V1>(regPtr0->get(keyport));
bool isEqual = np->equals(pRet);
LOGDEBUG("Task:getPutAtVersionOne23: isEqual = %d", isEqual);
@@ -916,10 +915,10 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT2, getPutAtVersionTwo24)
{
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
- PdxTypes2V2Ptr np(new PdxTypes2V2());
+ auto np = std::make_shared<PdxTypes2V2>();
CacheableKeyPtr keyport = CacheableKey::create(1);
- PdxTypes2V2Ptr pRet = dynCast<PdxTypes2V2Ptr>(regPtr0->get(keyport));
+ auto pRet = std::dynamic_pointer_cast<PdxTypes2V2>(regPtr0->get(keyport));
bool isEqual = np->equals(pRet);
LOGDEBUG("Task:getPutAtVersionTwo24.. isEqual = %d", isEqual);
@@ -942,12 +941,12 @@ DUNIT_TASK_DEFINITION(CLIENT1, putAtVersionOne11)
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
CacheableKeyPtr keyport = CacheableKey::create(1);
- PdxTests::PdxType1V1Ptr np(new PdxTests::PdxType1V1());
+ auto np = std::make_shared<PdxTests::PdxType1V1>();
regPtr0->put(keyport, np);
PdxTests::PdxType1V1Ptr pRet =
- dynCast<PdxTests::PdxType1V1Ptr>(regPtr0->get(keyport));
+ std::dynamic_pointer_cast<PdxTests::PdxType1V1>(regPtr0->get(keyport));
bool isEqual = np->equals(pRet);
LOGDEBUG("NIL:putAtVersionOne11:.. isEqual = %d", isEqual);
@@ -971,11 +970,11 @@ DUNIT_TASK_DEFINITION(CLIENT2, putAtVersionTwo1)
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
CacheableKeyPtr keyport = CacheableKey::create(1);
- PdxTypesR1V2Ptr np(new PdxTypesR1V2());
+ auto np = std::make_shared<PdxTypesR1V2>();
regPtr0->put(keyport, np);
- PdxTypesR1V2Ptr pRet = dynCast<PdxTypesR1V2Ptr>(regPtr0->get(keyport));
+ auto pRet = std::dynamic_pointer_cast<PdxTypesR1V2>(regPtr0->get(keyport));
bool isEqual = np->equals(pRet);
LOGDEBUG("NIL:putAtVersionTwo1:.. isEqual = %d", isEqual);
@@ -995,11 +994,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, getPutAtVersionOne2)
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
- PdxTypesV1R1Ptr np(new PdxTypesV1R1());
+ auto np = std::make_shared<PdxTypesV1R1>();
CacheableKeyPtr keyport = CacheableKey::create(1);
- PdxTypesV1R1Ptr pRet = dynCast<PdxTypesV1R1Ptr>(regPtr0->get(keyport));
+ auto pRet = std::dynamic_pointer_cast<PdxTypesV1R1>(regPtr0->get(keyport));
bool isEqual = np->equals(pRet);
LOGDEBUG("NIL:getPutAtVersionOne2:.. isEqual = %d", isEqual);
@@ -1014,11 +1013,11 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT2, getPutAtVersionTwo3)
{
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
- PdxTypesR1V2Ptr np(new PdxTypesR1V2());
+ auto np = std::make_shared<PdxTypesR1V2>();
CacheableKeyPtr keyport = CacheableKey::create(1);
- PdxTypesR1V2Ptr pRet = dynCast<PdxTypesR1V2Ptr>(regPtr0->get(keyport));
+ auto pRet = std::dynamic_pointer_cast<PdxTypesR1V2>(regPtr0->get(keyport));
bool isEqual = np->equals(pRet);
LOGDEBUG("NIL:getPutAtVersionTwo3.. isEqual = %d", isEqual);
ASSERT(
@@ -1032,10 +1031,10 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, getPutAtVersionOne4)
{
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
- PdxTypesV1R1Ptr np(new PdxTypesV1R1());
+ auto np = std::make_shared<PdxTypesV1R1>();
CacheableKeyPtr keyport = CacheableKey::create(1);
- PdxTypesV1R1Ptr pRet = dynCast<PdxTypesV1R1Ptr>(regPtr0->get(keyport));
+ auto pRet = std::dynamic_pointer_cast<PdxTypesV1R1>(regPtr0->get(keyport));
bool isEqual = np->equals(pRet);
LOGDEBUG("getPutAtVersionOne4: isEqual = %d", isEqual);
@@ -1050,12 +1049,12 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT2, getPutAtVersionTwo5)
{
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
- PdxTypesR1V2Ptr np(new PdxTypesR1V2());
+ auto np = std::make_shared<PdxTypesR1V2>();
// GET
CacheableKeyPtr keyport = CacheableKey::create(1);
- PdxTypesR1V2Ptr pRet = dynCast<PdxTypesR1V2Ptr>(regPtr0->get(keyport));
+ auto pRet = std::dynamic_pointer_cast<PdxTypesR1V2>(regPtr0->get(keyport));
bool isEqual = np->equals(pRet);
LOGDEBUG("Task:getPutAtVersionTwo5.. isEqual = %d", isEqual);
@@ -1070,10 +1069,10 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, getPutAtVersionOne6)
{
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
- PdxTypesV1R1Ptr np(new PdxTypesV1R1());
+ auto np = std::make_shared<PdxTypesV1R1>();
CacheableKeyPtr keyport = CacheableKey::create(1);
- PdxTypesV1R1Ptr pRet = dynCast<PdxTypesV1R1Ptr>(regPtr0->get(keyport));
+ auto pRet = std::dynamic_pointer_cast<PdxTypesV1R1>(regPtr0->get(keyport));
bool isEqual = np->equals(pRet);
LOGDEBUG("Task getPutAtVersionOne6:.. isEqual = %d", isEqual);
@@ -1096,12 +1095,11 @@ DUNIT_TASK_DEFINITION(CLIENT2, putV2PdxUI)
// PdxTests::PdxTypesIgnoreUnreadFieldsV2::reset(false);
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
- PdxTypesIgnoreUnreadFieldsV2Ptr np(new PdxTypesIgnoreUnreadFieldsV2());
+ auto np = std::make_shared<PdxTypesIgnoreUnreadFieldsV2>();
CacheableKeyPtr keyport = CacheableKey::create(1);
regPtr0->put(keyport, np);
- PdxTypesIgnoreUnreadFieldsV2Ptr pRet =
- dynCast<PdxTypesIgnoreUnreadFieldsV2Ptr>(regPtr0->get(keyport));
+ auto pRet = std::dynamic_pointer_cast<PdxTypesIgnoreUnreadFieldsV2>(regPtr0->get(keyport));
bool isEqual = np->equals(pRet);
LOGDEBUG("NIL:putV2PdxUI:.. isEqual = %d", isEqual);
@@ -1125,8 +1123,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, putV1PdxUI)
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
CacheableKeyPtr keyport = CacheableKey::create(1);
- PdxTypesIgnoreUnreadFieldsV1Ptr pRet =
- dynCast<PdxTypesIgnoreUnreadFieldsV1Ptr>(regPtr0->get(keyport));
+ auto pRet = std::dynamic_pointer_cast<PdxTypesIgnoreUnreadFieldsV1>(regPtr0->get(keyport));
regPtr0->put(keyport, pRet);
}
END_TASK_DEFINITION
@@ -1134,11 +1131,10 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT2, getV2PdxUI)
{
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
- PdxTypesIgnoreUnreadFieldsV2Ptr np(new PdxTypesIgnoreUnreadFieldsV2());
+ auto np = std::make_shared<PdxTypesIgnoreUnreadFieldsV2>();
CacheableKeyPtr keyport = CacheableKey::create(1);
- PdxTypesIgnoreUnreadFieldsV2Ptr pRet =
- dynCast<PdxTypesIgnoreUnreadFieldsV2Ptr>(regPtr0->get(keyport));
+ auto pRet = std::dynamic_pointer_cast<PdxTypesIgnoreUnreadFieldsV2>(regPtr0->get(keyport));
bool isEqual = np->equals(pRet);
LOGDEBUG("Task:getV2PdxUI:.. isEqual = %d", isEqual);
@@ -1159,11 +1155,11 @@ DUNIT_TASK_DEFINITION(CLIENT2, getPutAtVersionTwo12)
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
- PdxTypes1V2Ptr np(new PdxTypes1V2());
+ auto np = std::make_shared<PdxTypes1V2>();
CacheableKeyPtr keyport = CacheableKey::create(1);
- PdxTypes1V2Ptr pRet = dynCast<PdxTypes1V2Ptr>(regPtr0->get(keyport));
+ auto pRet = std::dynamic_pointer_cast<PdxTypes1V2>(regPtr0->get(keyport));
bool isEqual = np->equals(pRet);
LOGDEBUG("NIL:getPutAtVersionTwo12:.. isEqual = %d", isEqual);
@@ -1178,11 +1174,11 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, getPutAtVersionOne13)
{
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
- PdxType1V1Ptr np(new PdxType1V1());
+ auto np = std::make_shared<PdxType1V1>();
CacheableKeyPtr keyport = CacheableKey::create(1);
- PdxType1V1Ptr pRet = dynCast<PdxType1V1Ptr>(regPtr0->get(keyport));
+ auto pRet = std::dynamic_pointer_cast<PdxType1V1>(regPtr0->get(keyport));
bool isEqual = np->equals(pRet);
LOGDEBUG("NIL:getPutAtVersionOne13:221.. isEqual = %d", isEqual);
@@ -1198,10 +1194,10 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT2, getPutAtVersionTwo14)
{
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
- PdxTypes1V2Ptr np(new PdxTypes1V2());
+ auto np = std::make_shared<PdxTypes1V2>();
CacheableKeyPtr keyport = CacheableKey::create(1);
- PdxTypes1V2Ptr pRet = dynCast<PdxTypes1V2Ptr>(regPtr0->get(keyport));
+ auto pRet = std::dynamic_pointer_cast<PdxTypes1V2>(regPtr0->get(keyport));
bool isEqual = np->equals(pRet);
LOGDEBUG("NIL:getPutAtVersionTwo14:241.. isEqual = %d", isEqual);
@@ -1217,12 +1213,12 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, getPutAtVersionOne15)
{
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
- PdxType1V1Ptr np(new PdxType1V1());
+ auto np = std::make_shared<PdxType1V1>();
// GET
CacheableKeyPtr keyport = CacheableKey::create(1);
- PdxType1V1Ptr pRet = dynCast<PdxType1V1Ptr>(regPtr0->get(keyport));
+ auto pRet = std::dynamic_pointer_cast<PdxType1V1>(regPtr0->get(keyport));
bool isEqual = np->equals(pRet);
LOGDEBUG("NIL:getPutAtVersionOne15:784.. isEqual = %d", isEqual);
@@ -1249,10 +1245,10 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT2, getPutAtVersionTwo16)
{
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
- PdxTypes1V2Ptr np(new PdxTypes1V2());
+ auto np = std::make_shared<PdxTypes1V2>();
CacheableKeyPtr keyport = CacheableKey::create(1);
- PdxTypes1V2Ptr pRet = dynCast<PdxTypes1V2Ptr>(regPtr0->get(keyport));
+ auto pRet = std::dynamic_pointer_cast<PdxTypes1V2>(regPtr0->get(keyport));
bool isEqual = np->equals(pRet);
LOGDEBUG("NIL:getPutAtVersionTwo14:.. isEqual = %d", isEqual);
@@ -1286,13 +1282,13 @@ DUNIT_TASK_DEFINITION(CLIENT1, Puts2)
CacheableKeyPtr keyport = CacheableKey::create(1);
- CacheablePtr pdxobj(new PdxTests::PdxTypes1());
+ auto pdxobj = std::make_shared<PdxTests::PdxTypes1>();
regPtr0->put(keyport, pdxobj);
CacheableKeyPtr keyport2 = CacheableKey::create(2);
- CacheablePtr pdxobj2(new PdxTests::PdxTypes2());
+ auto pdxobj2 = std::make_shared<PdxTests::PdxTypes2>();
regPtr0->put(keyport2, pdxobj2);
@@ -1314,7 +1310,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, forCleanup)
CacheableKeyPtr keyport = CacheableKey::create(1);
- CacheablePtr pdxobj(new PdxTests::PdxTypes1());
+ auto pdxobj = std::make_shared<PdxTests::PdxTypes1>();
regPtr0->put(keyport, pdxobj);
} catch (...) {
@@ -1330,13 +1326,13 @@ DUNIT_TASK_DEFINITION(CLIENT1, Puts22)
CacheableKeyPtr keyport = CacheableKey::create(1);
- CacheablePtr pdxobj(new PdxTests::PdxTypes1());
+ auto pdxobj = std::make_shared<PdxTests::PdxTypes1>();
regPtr0->put(keyport, pdxobj);
CacheableKeyPtr keyport2 = CacheableKey::create(2);
- CacheablePtr pdxobj2(new PdxTests::PdxTypes2());
+ auto pdxobj2 = std::make_shared<PdxTests::PdxTypes2>();
regPtr0->put(keyport2, pdxobj2);
@@ -1362,7 +1358,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, Get2)
CacheableKeyPtr keyport = CacheableKey::create(2);
PdxTests::PdxTypes2Ptr obj2 =
- dynCast<PdxTests::PdxTypes2Ptr>(regPtr0->get(keyport));
+ std::dynamic_pointer_cast<PdxTests::PdxTypes2>(regPtr0->get(keyport));
LOG("Get2 complete.\n");
}
@@ -1386,19 +1382,19 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutAndVerifyPdxInGet)
CacheableKeyPtr keyport = CacheableKey::create(1);
- CacheablePtr pdxobj(new PdxTests::PdxType());
+ auto pdxobj = std::make_shared<PdxTests::PdxType>();
regPtr0->put(keyport, pdxobj);
PdxTests::PdxTypePtr obj2 =
- dynCast<PdxTests::PdxTypePtr>(regPtr0->get(keyport));
+ std::dynamic_pointer_cast<PdxTests::PdxType>(regPtr0->get(keyport));
checkPdxInstanceToStringAtServer(regPtr0);
ASSERT(cacheHelper->getCache()->getPdxReadSerialized() == false,
"Pdx read serialized property should be false.");
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.ptr()));
+ LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.get()));
LOGINFO("PdxSerializations = %d ",
lregPtr->getCacheImpl()->m_cacheStats->getPdxSerializations());
LOGINFO("PdxDeSerializations = %d ",
@@ -1444,14 +1440,14 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutAndVerifyNestedPdxInGet)
// ignore exception
}
- NestedPdxPtr p1(new NestedPdx());
+ auto p1 = std::make_shared<NestedPdx>();
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
CacheableKeyPtr keyport = CacheableKey::create(1);
regPtr0->put(keyport, p1);
- NestedPdxPtr obj2 = dynCast<NestedPdxPtr>(regPtr0->get(keyport));
+ auto obj2 = std::dynamic_pointer_cast<NestedPdx>(regPtr0->get(keyport));
ASSERT(obj2->equals(p1) == true, "Nested pdx objects should be equal");
@@ -1482,10 +1478,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutMixedVersionNestedPdx)
// ignore exception
}
- LOG("MixedVersionNestedPdxPtr p1(new MixedVersionNestedPdx()); ");
- MixedVersionNestedPdxPtr p1(new MixedVersionNestedPdx());
- MixedVersionNestedPdxPtr p2(new MixedVersionNestedPdx());
- MixedVersionNestedPdxPtr p3(new MixedVersionNestedPdx());
+ LOG("auto p1 = std::make_shared<MixedVersionNestedPdx>(); ");
+ auto p1 = std::make_shared<MixedVersionNestedPdx>();
+ auto p2 = std::make_shared<MixedVersionNestedPdx>();
+ auto p3 = std::make_shared<MixedVersionNestedPdx>();
LOG("RegionPtr regPtr0 = getHelper()->getRegion(\"DistRegionAck\");");
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
@@ -1565,14 +1561,13 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutAndVerifyPdxInGFSInGet)
}
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
- PdxInsideIGeodeSerializablePtr np(new PdxInsideIGeodeSerializable());
+ auto np = std::make_shared<PdxInsideIGeodeSerializable>();
CacheableKeyPtr keyport = CacheableKey::create(1);
regPtr0->put(keyport, np);
// GET
- PdxInsideIGeodeSerializablePtr pRet =
- dynCast<PdxInsideIGeodeSerializablePtr>(regPtr0->get(keyport));
+ auto pRet = std::dynamic_pointer_cast<PdxInsideIGeodeSerializable>(regPtr0->get(keyport));
ASSERT(
pRet->equals(np) == true,
"TASK PutAndVerifyPdxInIGFSInGet: PdxInsideIGeodeSerializable objects "
@@ -1641,12 +1636,11 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyPdxInGFSGetOnly)
}
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
- PdxInsideIGeodeSerializablePtr orig(new PdxInsideIGeodeSerializable());
+ auto orig = std::make_shared<PdxInsideIGeodeSerializable>();
// GET
CacheableKeyPtr keyport = CacheableKey::create(1);
- PdxInsideIGeodeSerializablePtr pRet =
- dynCast<PdxInsideIGeodeSerializablePtr>(regPtr0->get(keyport));
+ auto pRet = std::dynamic_pointer_cast<PdxInsideIGeodeSerializable>(regPtr0->get(keyport));
ASSERT(pRet->equals(orig) == true,
"TASK:VerifyPdxInIGFSGetOnly, PdxInsideIGeodeSerializable objects "
"should "
@@ -1677,19 +1671,16 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyMixedVersionNestedGetOnly)
// ignore exception
}
- MixedVersionNestedPdxPtr p1(new MixedVersionNestedPdx());
+ auto p1 = std::make_shared<MixedVersionNestedPdx>();
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
CacheableKeyPtr keyport1 = CacheableKey::create(1);
CacheableKeyPtr keyport2 = CacheableKey::create(2);
CacheableKeyPtr keyport3 = CacheableKey::create(3);
- MixedVersionNestedPdxPtr obj1 =
- dynCast<MixedVersionNestedPdxPtr>(regPtr0->get(keyport1));
- MixedVersionNestedPdxPtr obj2 =
- dynCast<MixedVersionNestedPdxPtr>(regPtr0->get(keyport2));
- MixedVersionNestedPdxPtr obj3 =
- dynCast<MixedVersionNestedPdxPtr>(regPtr0->get(keyport3));
+ auto obj1 = std::dynamic_pointer_cast<MixedVersionNestedPdx>(regPtr0->get(keyport1));
+ auto obj2 = std::dynamic_pointer_cast<MixedVersionNestedPdx>(regPtr0->get(keyport2));
+ auto obj3 = std::dynamic_pointer_cast<MixedVersionNestedPdx>(regPtr0->get(keyport3));
ASSERT(obj1->equals(p1) == true, "Nested pdx objects should be equal");
@@ -1719,12 +1710,12 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyNestedGetOnly)
// ignore exception
}
- NestedPdxPtr p1(new NestedPdx());
+ auto p1 = std::make_shared<NestedPdx>();
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
CacheableKeyPtr keyport = CacheableKey::create(1);
- NestedPdxPtr obj2 = dynCast<NestedPdxPtr>(regPtr0->get(keyport));
+ auto obj2 = std::dynamic_pointer_cast<NestedPdx>(regPtr0->get(keyport));
ASSERT(obj2->equals(p1) == true, "Nested pdx objects should be equal");
@@ -1750,11 +1741,11 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyGetOnly)
CacheableKeyPtr keyport = CacheableKey::create(1);
PdxTests::PdxTypePtr obj2 =
- dynCast<PdxTests::PdxTypePtr>(regPtr0->get(keyport));
+ std::dynamic_pointer_cast<PdxTests::PdxType>(regPtr0->get(keyport));
checkPdxInstanceToStringAtServer(regPtr0);
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.ptr()));
+ LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.get()));
LOGINFO("PdxSerializations = %d ",
lregPtr->getCacheImpl()->m_cacheStats->getPdxSerializations());
LOGINFO("PdxDeSerializations = %d ",
@@ -1844,17 +1835,17 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutAndVerifyVariousPdxTypes)
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
bool flag = false;
{
- PdxTypes1Ptr p1(new PdxTypes1());
+ auto p1 = std::make_shared<PdxTypes1>();
CacheableKeyPtr keyport = CacheableKey::create(11);
regPtr0->put(keyport, p1);
- PdxTypes1Ptr pRet = dynCast<PdxTypes1Ptr>(regPtr0->get(keyport));
+ auto pRet = std::dynamic_pointer_cast<PdxTypes1>(regPtr0->get(keyport));
flag = p1->equals(pRet);
LOGDEBUG("PutAndVerifyVariousPdxTypes:.. flag = %d", flag);
ASSERT(flag == true, "Objects of type PdxTypes1 should be equal");
checkPdxInstanceToStringAtServer(regPtr0);
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.ptr()));
+ LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.get()));
LOGINFO("PdxSerializations = %d ",
lregPtr->getCacheImpl()->m_cacheStats->getPdxSerializations());
LOGINFO("PdxDeSerializations = %d ",
@@ -1879,17 +1870,17 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutAndVerifyVariousPdxTypes)
}
{
- PdxTypes2Ptr p2(new PdxTypes2());
+ auto p2 = std::make_shared<PdxTypes2>();
CacheableKeyPtr keyport2 = CacheableKey::create(12);
regPtr0->put(keyport2, p2);
- PdxTypes2Ptr pRet2 = dynCast<PdxTypes2Ptr>(regPtr0->get(keyport2));
+ auto pRet2 = std::dynamic_pointer_cast<PdxTypes2>(regPtr0->get(keyport2));
flag = p2->equals(pRet2);
LOGDEBUG("PutAndVerifyVariousPdxTypes:.. flag = %d", flag);
ASSERT(flag == true, "Objects of type PdxTypes2 should be equal");
checkPdxInstanceToStringAtServer(regPtr0);
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.ptr()));
+ LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.get()));
LOGINFO("PdxSerializations = %d ",
lregPtr->getCacheImpl()->m_cacheStats->getPdxSerializations());
LOGINFO("PdxDeSerializations = %d ",
@@ -1914,17 +1905,17 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutAndVerifyVariousPdxTypes)
}
{
- PdxTypes3Ptr p3(new PdxTypes3());
+ auto p3 = std::make_shared<PdxTypes3>();
CacheableKeyPtr keyport3 = CacheableKey::create(13);
regPtr0->put(keyport3, p3);
- PdxTypes3Ptr pRet3 = dynCast<PdxTypes3Ptr>(regPtr0->get(keyport3));
+ auto pRet3 = std::dynamic_pointer_cast<PdxTypes3>(regPtr0->get(keyport3));
flag = p3->equals(pRet3);
LOGDEBUG("PutAndVerifyVariousPdxTypes:.. flag = %d", flag);
ASSERT(flag == true, "Objects of type PdxTypes3 should be equal");
checkPdxInstanceToStringAtServer(regPtr0);
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.ptr()));
+ LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.get()));
LOGINFO("PdxSerializations = %d ",
lregPtr->getCacheImpl()->m_cacheStats->getPdxSerializations());
LOGINFO("PdxDeSerializations = %d ",
@@ -1949,17 +1940,17 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutAndVerifyVariousPdxTypes)
}
{
- PdxTypes4Ptr p4(new PdxTypes4());
+ auto p4 = std::make_shared<PdxTypes4>();
CacheableKeyPtr keyport4 = CacheableKey::create(14);
regPtr0->put(keyport4, p4);
- PdxTypes4Ptr pRet4 = dynCast<PdxTypes4Ptr>(regPtr0->get(keyport4));
+ auto pRet4 = std::dynamic_pointer_cast<PdxTypes4>(regPtr0->get(keyport4));
flag = p4->equals(pRet4);
LOGDEBUG("PutAndVerifyVariousPdxTypes:.. flag = %d", flag);
ASSERT(flag == true, "Objects of type PdxTypes4 should be equal");
checkPdxInstanceToStringAtServer(regPtr0);
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.ptr()));
+ LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.get()));
LOGINFO("PdxSerializations = %d ",
lregPtr->getCacheImpl()->m_cacheStats->getPdxSerializations());
LOGINFO("PdxDeSerializations = %d ",
@@ -1984,17 +1975,17 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutAndVerifyVariousPdxTypes)
}
{
- PdxTypes5Ptr p5(new PdxTypes5());
+ auto p5 = std::make_shared<PdxTypes5>();
CacheableKeyPtr keyport5 = CacheableKey::create(15);
regPtr0->put(keyport5, p5);
- PdxTypes5Ptr pRet5 = dynCast<PdxTypes5Ptr>(regPtr0->get(keyport5));
+ auto pRet5 = std::dynamic_pointer_cast<PdxTypes5>(regPtr0->get(keyport5));
flag = p5->equals(pRet5);
LOGDEBUG("PutAndVerifyVariousPdxTypes:.. flag = %d", flag);
ASSERT(flag == true, "Objects of type PdxTypes5 should be equal");
checkPdxInstanceToStringAtServer(regPtr0);
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.ptr()));
+ LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.get()));
LOGINFO("PdxSerializations = %d ",
lregPtr->getCacheImpl()->m_cacheStats->getPdxSerializations());
LOGINFO("PdxDeSerializations = %d ",
@@ -2019,17 +2010,17 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutAndVerifyVariousPdxTypes)
}
{
- PdxTypes6Ptr p6(new PdxTypes6());
+ auto p6 = std::make_shared<PdxTypes6>();
CacheableKeyPtr keyport6 = CacheableKey::create(16);
regPtr0->put(keyport6, p6);
- PdxTypes6Ptr pRet6 = dynCast<PdxTypes6Ptr>(regPtr0->get(keyport6));
+ auto pRet6 = std::dynamic_pointer_cast<PdxTypes6>(regPtr0->get(keyport6));
flag = p6->equals(pRet6);
LOGDEBUG("PutAndVerifyVariousPdxTypes:.. flag = %d", flag);
ASSERT(flag == true, "Objects of type PdxTypes6 should be equal");
checkPdxInstanceToStringAtServer(regPtr0);
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.ptr()));
+ LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.get()));
LOGINFO("PdxSerializations = %d ",
lregPtr->getCacheImpl()->m_cacheStats->getPdxSerializations());
LOGINFO("PdxDeSerializations = %d ",
@@ -2054,17 +2045,17 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutAndVerifyVariousPdxTypes)
}
{
- PdxTypes7Ptr p7(new PdxTypes7());
+ auto p7 = std::make_shared<PdxTypes7>();
CacheableKeyPtr keyport7 = CacheableKey::create(17);
regPtr0->put(keyport7, p7);
- PdxTypes7Ptr pRet7 = dynCast<PdxTypes7Ptr>(regPtr0->get(keyport7));
+ auto pRet7 = std::dynamic_pointer_cast<PdxTypes7>(regPtr0->get(keyport7));
flag = p7->equals(pRet7);
LOGDEBUG("PutAndVerifyVariousPdxTypes:.. flag = %d", flag);
ASSERT(flag == true, "Objects of type PdxTypes7 should be equal");
checkPdxInstanceToStringAtServer(regPtr0);
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.ptr()));
+ LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.get()));
LOGINFO("PdxSerializations = %d ",
lregPtr->getCacheImpl()->m_cacheStats->getPdxSerializations());
LOGINFO("PdxDeSerializations = %d ",
@@ -2089,17 +2080,17 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutAndVerifyVariousPdxTypes)
}
{
- PdxTypes8Ptr p8(new PdxTypes8());
+ auto p8 = std::make_shared<PdxTypes8>();
CacheableKeyPtr keyport8 = CacheableKey::create(18);
regPtr0->put(keyport8, p8);
- PdxTypes8Ptr pRet8 = dynCast<PdxTypes8Ptr>(regPtr0->get(keyport8));
+ auto pRet8 = std::dynamic_pointer_cast<PdxTypes8>(regPtr0->get(keyport8));
flag = p8->equals(pRet8);
LOGDEBUG("PutAndVerifyVariousPdxTypes:.. flag = %d", flag);
ASSERT(flag == true, "Objects of type PdxTypes8 should be equal");
checkPdxInstanceToStringAtServer(regPtr0);
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.ptr()));
+ LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.get()));
LOGINFO("PdxSerializations = %d ",
lregPtr->getCacheImpl()->m_cacheStats->getPdxSerializations());
LOGINFO("PdxDeSerializations = %d ",
@@ -2124,17 +2115,17 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutAndVerifyVariousPdxTypes)
}
{
- PdxTypes9Ptr p9(new PdxTypes9());
+ auto p9 = std::make_shared<PdxTypes9>();
CacheableKeyPtr keyport9 = CacheableKey::create(19);
regPtr0->put(keyport9, p9);
- PdxTypes9Ptr pRet9 = dynCast<PdxTypes9Ptr>(regPtr0->get(keyport9));
+ auto pRet9 = std::dynamic_pointer_cast<PdxTypes9>(regPtr0->get(keyport9));
flag = p9->equals(pRet9);
LOGDEBUG("PutAndVerifyVariousPdxTypes:.. flag = %d", flag);
ASSERT(flag == true, "Objects of type PdxTypes9 should be equal");
checkPdxInstanceToStringAtServer(regPtr0);
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.ptr()));
+ LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.get()));
LOGINFO("PdxSerializations = %d ",
lregPtr->getCacheImpl()->m_cacheStats->getPdxSerializations());
LOGINFO("PdxDeSerializations = %d ",
@@ -2159,17 +2150,17 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutAndVerifyVariousPdxTypes)
}
{
- PdxTypes10Ptr p10(new PdxTypes10());
+ auto p10 = std::make_shared<PdxTypes10>();
CacheableKeyPtr keyport10 = CacheableKey::create(20);
regPtr0->put(keyport10, p10);
- PdxTypes10Ptr pRet10 = dynCast<PdxTypes10Ptr>(regPtr0->get(keyport10));
+ auto pRet10 = std::dynamic_pointer_cast<PdxTypes10>(regPtr0->get(keyport10));
flag = p10->equals(pRet10);
LOGDEBUG("PutAndVerifyVariousPdxTypes:.. flag = %d", flag);
ASSERT(flag == true, "Objects of type PdxTypes10 should be equal");
checkPdxInstanceToStringAtServer(regPtr0);
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.ptr()));
+ LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.get()));
LOGINFO("PdxSerializations = %d ",
lregPtr->getCacheImpl()->m_cacheStats->getPdxSerializations());
LOGINFO("PdxDeSerializations = %d ",
@@ -2212,19 +2203,18 @@ DUNIT_TASK_DEFINITION(CLIENT1, generateJavaPdxType)
ResultCollectorPtr collector = funcExec->withArgs(args)
->withFilter(routingObj)
->execute("ComparePdxTypes", true);
- ASSERT(collector != NULLPTR, "onRegion collector NULL");
+ ASSERT(collector != nullptr, "onRegion collector NULL");
CacheableVectorPtr result = collector->getResult();
LOGINFO("NIL:: testTCPDXTests: result->size = %d ", result->size());
- if (result == NULLPTR) {
+ if (result == nullptr) {
ASSERT(false, "echo String : result is NULL");
} else {
//
bool gotResult = false;
for (int i = 0; i < result->size(); i++) {
try {
- CacheableBooleanPtr boolValue =
- dynCast<CacheableBooleanPtr>(result->operator[](i));
+ auto boolValue = std::dynamic_pointer_cast<CacheableBoolean>(result->operator[](i));
LOGINFO("NIL:: boolValue is %d ", boolValue->value());
bool resultVal = boolValue->value();
ASSERT(resultVal == true,
@@ -2242,9 +2232,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, generateJavaPdxType)
LOG("exFuncNameSendException now casting to "
"UserFunctionExecutionExceptionPtr for arrayList arguement "
"exception.");
- UserFunctionExecutionExceptionPtr uFEPtr =
- dynCast<UserFunctionExecutionExceptionPtr>(result->operator[](i));
- ASSERT(uFEPtr != NULLPTR, "uFEPtr exception is NULL");
+ auto uFEPtr = std::dynamic_pointer_cast<UserFunctionExecutionException>(result->operator[](i));
+ ASSERT(uFEPtr != nullptr, "uFEPtr exception is NULL");
LOGINFO("Done casting to uFEPtr");
LOGINFO("Read expected uFEPtr exception %s ",
uFEPtr->getMessage()->asChar());
@@ -2318,43 +2307,43 @@ DUNIT_TASK_DEFINITION(CLIENT1, putAllPdxTypes)
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
- PdxTypes1Ptr p1(new PdxTypes1());
+ auto p1 = std::make_shared<PdxTypes1>();
CacheableKeyPtr keyport1 = CacheableKey::create(p1->getClassName());
regPtr0->put(keyport1, p1);
- PdxTypes2Ptr p2(new PdxTypes2());
+ auto p2 = std::make_shared<PdxTypes2>();
CacheableKeyPtr keyport2 = CacheableKey::create(p2->getClassName());
regPtr0->put(keyport2, p2);
- PdxTypes3Ptr p3(new PdxTypes3());
+ auto p3 = std::make_shared<PdxTypes3>();
CacheableKeyPtr keyport3 = CacheableKey::create(p3->getClassName());
regPtr0->put(keyport3, p3);
- PdxTypes4Ptr p4(new PdxTypes4());
+ auto p4 = std::make_shared<PdxTypes4>();
CacheableKeyPtr keyport4 = CacheableKey::create(p4->getClassName());
regPtr0->put(keyport4, p4);
- PdxTypes5Ptr p5(new PdxTypes5());
+ auto p5 = std::make_shared<PdxTypes5>();
CacheableKeyPtr keyport5 = CacheableKey::create(p5->getClassName());
regPtr0->put(keyport5, p5);
- PdxTypes6Ptr p6(new PdxTypes6());
+ auto p6 = std::make_shared<PdxTypes6>();
CacheableKeyPtr keyport6 = CacheableKey::create(p6->getClassName());
regPtr0->put(keyport6, p6);
- PdxTypes7Ptr p7(new PdxTypes7());
+ auto p7 = std::make_shared<PdxTypes7>();
CacheableKeyPtr keyport7 = CacheableKey::create(p7->getClassName());
regPtr0->put(keyport7, p7);
- PdxTypes8Ptr p8(new PdxTypes8());
+ auto p8 = std::make_shared<PdxTypes8>();
CacheableKeyPtr keyport8 = CacheableKey::create(p8->getClassName());
regPtr0->put(keyport8, p8);
- PdxTypes9Ptr p9(new PdxTypes9());
+ auto p9 = std::make_shared<PdxTypes9>();
CacheableKeyPtr keyport9 = CacheableKey::create(p9->getClassName());
regPtr0->put(keyport9, p9);
- PdxTypes10Ptr p10(new PdxTypes10());
+ auto p10 = std::make_shared<PdxTypes10>();
CacheableKeyPtr keyport10 = CacheableKey::create(p10->getClassName());
regPtr0->put(keyport10, p10);
@@ -2376,19 +2365,18 @@ DUNIT_TASK_DEFINITION(CLIENT1, verifyDotNetPdxTypes)
ResultCollectorPtr collector = funcExec->withArgs(args)
->withFilter(routingObj)
->execute("ComparePdxTypes", true);
- ASSERT(collector != NULLPTR, "onRegion collector NULL");
+ ASSERT(collector != nullptr, "onRegion collector NULL");
CacheableVectorPtr result = collector->getResult();
LOGINFO("NIL:: testTCPDXTests:verifyDotNetPdxTypes result->size = %d ",
result->size());
- if (result == NULLPTR) {
+ if (result == nullptr) {
ASSERT(false, "echo String : result is NULL");
} else {
bool gotResult = false;
for (int i = 0; i < result->size(); i++) {
try {
- CacheableBooleanPtr boolValue =
- dynCast<CacheableBooleanPtr>(result->operator[](i));
+ auto boolValue = std::dynamic_pointer_cast<CacheableBoolean>(result->operator[](i));
LOGINFO("NIL::verifyDotNetPdxTypes boolValue is %d ",
boolValue->value());
bool resultVal = boolValue->value();
@@ -2407,9 +2395,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, verifyDotNetPdxTypes)
LOG("exFuncNameSendException now casting to "
"UserFunctionExecutionExceptionPtr for arrayList arguement "
"exception.");
- UserFunctionExecutionExceptionPtr uFEPtr =
- dynCast<UserFunctionExecutionExceptionPtr>(result->operator[](i));
- ASSERT(uFEPtr != NULLPTR, "uFEPtr exception is NULL");
+ auto uFEPtr = std::dynamic_pointer_cast<UserFunctionExecutionException>(result->operator[](i));
+ ASSERT(uFEPtr != nullptr, "uFEPtr exception is NULL");
LOGINFO("Done casting to uFEPtr");
LOGINFO("Read expected uFEPtr exception %s ",
uFEPtr->getMessage()->asChar());
@@ -2438,7 +2425,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, client1PutsV1Object)
PdxTests::PdxType3V1::reset(false);
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
CacheableKeyPtr keyport = CacheableKey::create(1);
- PdxType3V1Ptr np(new PdxType3V1());
+ auto np = std::make_shared<PdxType3V1>();
regPtr0->put(keyport, np);
}
@@ -2457,10 +2444,10 @@ DUNIT_TASK_DEFINITION(CLIENT2, client2GetsV1ObjectAndPutsV2Object)
// get v1 object
CacheableKeyPtr keyport = CacheableKey::create(1);
- PdxTypes3V2Ptr pRet = dynCast<PdxTypes3V2Ptr>(regPtr0->get(keyport));
+ auto pRet = std::dynamic_pointer_cast<PdxTypes3V2>(regPtr0->get(keyport));
// now put v2 object
- PdxTypes3V2Ptr np(new PdxTypes3V2());
+ auto np = std::make_shared<PdxTypes3V2>();
regPtr0->put(keyport, np);
LOGDEBUG("Task:client2GetsV1ObjectAndPutsV2Object Done successfully ");
@@ -2478,19 +2465,18 @@ DUNIT_TASK_DEFINITION(CLIENT3, client3GetsV2Object)
ExecutionPtr funcExec = FunctionService::onRegion(regPtr0);
ResultCollectorPtr collector = funcExec->execute("IterateRegion", true);
- ASSERT(collector != NULLPTR, "onRegion collector NULL");
+ ASSERT(collector != nullptr, "onRegion collector NULL");
CacheableVectorPtr result = collector->getResult();
LOGINFO("NIL:: testTCPDXTests:verifyDotNetPdxTypes result->size = %d ",
result->size());
- if (result == NULLPTR) {
+ if (result == nullptr) {
ASSERT(false, "echo String : result is NULL");
} else {
bool gotResult = false;
for (int i = 0; i < result->size(); i++) {
try {
- CacheableBooleanPtr boolValue =
- dynCast<CacheableBooleanPtr>(result->operator[](i));
+ auto boolValue = std::dynamic_pointer_cast<CacheableBoolean>(result->operator[](i));
LOGINFO("NIL::verifyDotNetPdxTypes boolValue is %d ",
boolValue->value());
bool resultVal = boolValue->value();
@@ -2509,9 +2495,8 @@ DUNIT_TASK_DEFINITION(CLIENT3, client3GetsV2Object)
LOG("exFuncNameSendException now casting to "
"UserFunctionExecutionExceptionPtr for arrayList arguement "
"exception.");
- UserFunctionExecutionExceptionPtr uFEPtr =
- dynCast<UserFunctionExecutionExceptionPtr>(result->operator[](i));
- ASSERT(uFEPtr != NULLPTR, "uFEPtr exception is NULL");
+ auto uFEPtr = std::dynamic_pointer_cast<UserFunctionExecutionException>(result->operator[](i));
+ ASSERT(uFEPtr != nullptr, "uFEPtr exception is NULL");
LOGINFO("Done casting to uFEPtr");
LOGINFO("Read expected uFEPtr exception %s ",
uFEPtr->getMessage()->asChar());
@@ -2586,9 +2571,9 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyVariousPdxGets)
RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
bool flag = false;
{
- PdxTypes1Ptr p1(new PdxTypes1());
+ auto p1 = std::make_shared<PdxTypes1>();
CacheableKeyPtr keyport = CacheableKey::create(11);
- PdxTypes1Ptr pRet = dynCast<PdxTypes1Ptr>(regPtr0->get(keyport));
+ auto pRet = std::dynamic_pointer_cast<PdxTypes1>(regPtr0->get(keyport));
flag = p1->equals(pRet);
LOGDEBUG("VerifyVariousPdxGets:.. flag = %d", flag);
@@ -2596,7 +2581,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyVariousPdxGets)
"VerifyVariousPdxGets:Objects of type PdxTypes1 should be equal");
checkPdxInstanceToStringAtServer(regPtr0);
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.ptr()));
+ LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.get()));
LOGINFO("PdxSerializations = %d ",
lregPtr->getCacheImpl()->m_cacheStats->getPdxSerializations());
LOGINFO("PdxDeSerializations = %d ",
@@ -2620,9 +2605,9 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyVariousPdxGets)
}
{
- PdxTypes2Ptr p2(new PdxTypes2());
+ auto p2 = std::make_shared<PdxTypes2>();
CacheableKeyPtr keyport2 = CacheableKey::create(12);
- PdxTypes2Ptr pRet2 = dynCast<PdxTypes2Ptr>(regPtr0->get(keyport2));
+ auto pRet2 = std::dynamic_pointer_cast<PdxTypes2>(regPtr0->get(keyport2));
flag = p2->equals(pRet2);
LOGDEBUG("VerifyVariousPdxGets:. flag = %d", flag);
@@ -2630,7 +2615,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyVariousPdxGets)
"VerifyVariousPdxGets:Objects of type PdxTypes2 should be equal");
checkPdxInstanceToStringAtServer(regPtr0);
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.ptr()));
+ LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.get()));
LOGINFO("PdxSerializations = %d ",
lregPtr->getCacheImpl()->m_cacheStats->getPdxSerializations());
LOGINFO("PdxDeSerializations = %d ",
@@ -2654,9 +2639,9 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyVariousPdxGets)
}
{
- PdxTypes3Ptr p3(new PdxTypes3());
+ auto p3 = std::make_shared<PdxTypes3>();
CacheableKeyPtr keyport3 = CacheableKey::create(13);
- PdxTypes3Ptr pRet3 = dynCast<PdxTypes3Ptr>(regPtr0->get(keyport3));
+ auto pRet3 = std::dynamic_pointer_cast<PdxTypes3>(regPtr0->get(keyport3));
flag = p3->equals(pRet3);
LOGDEBUG("VerifyVariousPdxGets:.. flag = %d", flag);
@@ -2664,7 +2649,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyVariousPdxGets)
"VerifyVariousPdxGets:Objects of type PdxTypes3 should be equal");
checkPdxInstanceToStringAtServer(regPtr0);
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.ptr()));
+ LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.get()));
LOGINFO("PdxSerializations = %d ",
lregPtr->getCacheImpl()->m_cacheStats->getPdxSerializations());
LOGINFO("PdxDeSerializations = %d ",
@@ -2688,9 +2673,9 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyVariousPdxGets)
}
{
- PdxTypes4Ptr p4(new PdxTypes4());
+ auto p4 = std::make_shared<PdxTypes4>();
CacheableKeyPtr keyport4 = CacheableKey::create(14);
- PdxTypes4Ptr pRet4 = dynCast<PdxTypes4Ptr>(regPtr0->get(keyport4));
+ auto pRet4 = std::dynamic_pointer_cast<PdxTypes4>(regPtr0->get(keyport4));
flag = p4->equals(pRet4);
LOGDEBUG("VerifyVariousPdxGets:.. flag = %d", flag);
@@ -2698,7 +2683,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyVariousPdxGets)
"VerifyVariousPdxGets:Objects of type PdxTypes4 should be equal");
checkPdxInstanceToStringAtServer(regPtr0);
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.ptr()));
+ LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.get()));
LOGINFO("PdxSerializations = %d ",
lregPtr->getCacheImpl()->m_cacheStats->getPdxSerializations());
LOGINFO("PdxDeSerializations = %d ",
@@ -2722,9 +2707,9 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyVariousPdxGets)
}
{
- PdxTypes5Ptr p5(new PdxTypes5());
+ auto p5 = std::make_shared<PdxTypes5>();
CacheableKeyPtr keyport5 = CacheableKey::create(15);
- PdxTypes5Ptr pRet5 = dynCast<PdxTypes5Ptr>(regPtr0->get(keyport5));
+ auto pRet5 = std::dynamic_pointer_cast<PdxTypes5>(regPtr0->get(keyport5));
flag = p5->equals(pRet5);
LOGDEBUG("VerifyVariousPdxGets:.. flag = %d", flag);
@@ -2732,7 +2717,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyVariousPdxGets)
"VerifyVariousPdxGets:Objects of type PdxTypes5 should be equal");
checkPdxInstanceToStringAtServer(regPtr0);
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.ptr()));
+ LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.get()));
LOGINFO("PdxSerializations = %d ",
lregPtr->getCacheImpl()->m_cacheStats->getPdxSerializations());
LOGINFO("PdxDeSerializations = %d ",
@@ -2756,9 +2741,9 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyVariousPdxGets)
}
{
- PdxTypes6Ptr p6(new PdxTypes6());
+ auto p6 = std::make_shared<PdxTypes6>();
CacheableKeyPtr keyport6 = CacheableKey::create(16);
- PdxTypes6Ptr pRet6 = dynCast<PdxTypes6Ptr>(regPtr0->get(keyport6));
+ auto pRet6 = std::dynamic_pointer_cast<PdxTypes6>(regPtr0->get(keyport6));
flag = p6->equals(pRet6);
LOGDEBUG("VerifyVariousPdxGets:.. flag = %d", flag);
@@ -2766,7 +2751,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyVariousPdxGets)
"VerifyVariousPdxGets:Objects of type PdxTypes6 should be equal");
checkPdxInstanceToStringAtServer(regPtr0);
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.ptr()));
+ LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.get()));
LOGINFO("PdxSerializations = %d ",
lregPtr->getCacheImpl()->m_cacheStats->getPdxSerializations());
LOGINFO("PdxDeSerializations = %d ",
@@ -2790,9 +2775,9 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyVariousPdxGets)
}
{
- PdxTypes7Ptr p7(new PdxTypes7());
+ auto p7 = std::make_shared<PdxTypes7>();
CacheableKeyPtr keyport7 = CacheableKey::create(17);
- PdxTypes7Ptr pRet7 = dynCast<PdxTypes7Ptr>(regPtr0->get(keyport7));
+ auto pRet7 = std::dynamic_pointer_cast<PdxTypes7>(regPtr0->get(keyport7));
flag = p7->equals(pRet7);
LOGDEBUG("VerifyVariousPdxGets:.. flag = %d", flag);
@@ -2800,7 +2785,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyVariousPdxGets)
"VerifyVariousPdxGets:Objects of type PdxTypes7 should be equal");
checkPdxInstanceToStringAtServer(regPtr0);
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.ptr()));
+ LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.get()));
LOGINFO("PdxSerializations = %d ",
lregPtr->getCacheImpl()->m_cacheStats->getPdxSerializations());
LOGINFO("PdxDeSerializations = %d ",
@@ -2824,9 +2809,9 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyVariousPdxGets)
}
{
- PdxTypes8Ptr p8(new PdxTypes8());
+ auto p8 = std::make_shared<PdxTypes8>();
CacheableKeyPtr keyport8 = CacheableKey::create(18);
- PdxTypes8Ptr pRet8 = dynCast<PdxTypes8Ptr>(regPtr0->get(keyport8));
+ auto pRet8 = std::dynamic_pointer_cast<PdxTypes8>(regPtr0->get(keyport8));
flag = p8->equals(pRet8);
LOGDEBUG("VerifyVariousPdxGets:.. flag = %d", flag);
@@ -2834,7 +2819,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyVariousPdxGets)
"VerifyVariousPdxGets:Objects of type PdxTypes8 should be equal");
checkPdxInstanceToStringAtServer(regPtr0);
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.ptr()));
+ LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.get()));
LOGINFO("PdxSerializations = %d ",
lregPtr->getCacheImpl()->m_cacheStats->getPdxSerializations());
LOGINFO("PdxDeSerializations = %d ",
@@ -2858,9 +2843,9 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyVariousPdxGets)
}
{
- PdxTypes9Ptr p9(new PdxTypes9());
+ auto p9 = std::make_shared<PdxTypes9>();
CacheableKeyPtr keyport9 = CacheableKey::create(19);
- PdxTypes9Ptr pRet9 = dynCast<PdxTypes9Ptr>(regPtr0->get(keyport9));
+ auto pRet9 = std::dynamic_pointer_cast<PdxTypes9>(regPtr0->get(keyport9));
flag = p9->equals(pRet9);
LOGDEBUG("VerifyVariousPdxGets:. flag = %d", flag);
@@ -2868,7 +2853,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyVariousPdxGets)
"VerifyVariousPdxGets:Objects of type PdxTypes9 should be equal");
checkPdxInstanceToStringAtServer(regPtr0);
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.ptr()));
+ LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.get()));
LOGINFO("PdxSerializations = %d ",
lregPtr->getCacheImpl()->m_cacheStats->getPdxSerializations());
LOGINFO("PdxDeSerializations = %d ",
@@ -2892,9 +2877,9 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyVariousPdxGets)
}
{
- PdxTypes10Ptr p10(new PdxTypes10());
+ auto p10 = std::make_shared<PdxTypes10>();
CacheableKeyPtr keyport10 = CacheableKey::create(20);
- PdxTypes10Ptr pRet10 = dynCast<PdxTypes10Ptr>(regPtr0->get(keyport10));
+ auto pRet10 = std::dynamic_pointer_cast<PdxTypes10>(regPtr0->get(keyport10));
flag = p10->equals(pRet10);
LOGDEBUG("VerifyVariousPdxGets:.. flag = %d", flag);
@@ -2902,7 +2887,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyVariousPdxGets)
"VerifyVariousPdxGets:Objects of type PdxTypes10 should be equal");
checkPdxInstanceToStringAtServer(regPtr0);
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.ptr()));
+ LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.get()));
LOGINFO("PdxSerializations = %d ",
lregPtr->getCacheImpl()->m_cacheStats->getPdxSerializations());
LOGINFO("PdxDeSerializations = %d ",
@@ -2938,7 +2923,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, putOperation)
// RegionPtr testReg = getHelper()->getRegion("testregion");
CacheablePtr valuePtr1 = regPtr0->get("clientName1");
const char* clientName1 =
- (dynCast<CacheableStringPtr>(valuePtr1))->asChar();
+ (std::dynamic_pointer_cast<CacheableString>(valuePtr1))->asChar();
LOGINFO(" C1.putOperation Got ClientName1 = %s ", clientName1);
ASSERT(strcmp(clientName1, "Client-1") == 0,
"ClientName for Client-1 is not set");
@@ -2955,7 +2940,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, getOperation)
// Verify Client Name for C2
CacheablePtr valuePtr2 = regPtr0->get("clientName2");
const char* clientName2 =
- (dynCast<CacheableStringPtr>(valuePtr2))->asChar();
+ (std::dynamic_pointer_cast<CacheableString>(valuePtr2))->asChar();
LOGINFO(" C2.getOperation Got ClientName2 = %s ", clientName2);
ASSERT(strcmp(clientName2, "Client-2") == 0,
"ClientName for Client-2 is not set");
@@ -2975,7 +2960,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, putCharTypes)
LOG("PdxTests::CharTypes Registered Successfully....");
LOG("Trying to populate PDX objects.....\n");
- CacheablePtr pdxobj(new PdxTests::CharTypes());
+ auto pdxobj = std::make_shared<PdxTests::CharTypes>();
CacheableKeyPtr keyport = CacheableKey::create(1);
// PUT Operation
@@ -3002,17 +2987,17 @@ DUNIT_TASK_DEFINITION(CLIENT2, getCharTypes)
// ignore exception
}
- PdxTests::CharTypesPtr localPdxptr(new PdxTests::CharTypes());
+ auto localPdxptr = std::make_shared<PdxTests::CharTypes>();
CacheableKeyPtr keyport = CacheableKey::create(1);
LOG("Client-2 PdxTests::CharTypes GET OP Start....");
PdxTests::CharTypesPtr remotePdxptr =
- dynCast<PdxTests::CharTypesPtr>(regPtr0->get(keyport));
+ std::dynamic_pointer_cast<PdxTests::CharTypes>(regPtr0->get(keyport));
LOG("Client-2 PdxTests::CharTypes GET OP Done....");
- PdxTests::CharTypes* localPdx = localPdxptr.ptr();
+ PdxTests::CharTypes* localPdx = localPdxptr.get();
PdxTests::CharTypes* remotePdx =
- dynamic_cast<PdxTests::CharTypes*>(remotePdxptr.ptr());
+ dynamic_cast<PdxTests::CharTypes*>(remotePdxptr.get());
LOGINFO("testThinClientPdxTests:StepFour before equal() check");
ASSERT(remotePdx->equals(*localPdx) == true,
@@ -3050,7 +3035,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
LOG("PdxClassV1 Registered Successfully....");
LOG("Trying to populate PDX objects.....\n");
- CacheablePtr pdxobj(new PdxTests::PdxType());
+ auto pdxobj = std::make_shared<PdxTests::PdxType>();
CacheableKeyPtr keyport = CacheableKey::create(1);
// PUT Operation
@@ -3086,7 +3071,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
regPtr0->get(keyport);
regPtr0->get(keyport2);
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.ptr()));
+ LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.get()));
LOGINFO("PdxSerializations = %d ",
lregPtr->getCacheImpl()->m_cacheStats->getPdxSerializations());
LOGINFO("PdxDeSerializations = %d ",
@@ -3171,8 +3156,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepFour)
// Get remote CacheableObjectArray on key 2
CacheableKeyPtr keyport2 = CacheableKey::create(2);
LOGINFO("Client-2 PdxTests::PdxType GET OP Start....");
- CacheableObjectArrayPtr remoteCObjArray =
- dynCast<CacheableObjectArrayPtr>(regPtr0->get(keyport2));
+ auto remoteCObjArray = std::dynamic_pointer_cast<CacheableObjectArray>(regPtr0->get(keyport2));
LOGINFO(
"Client-2 PdxTests::PdxType GET OP Done.. Received CObjeArray Size = "
@@ -3185,8 +3169,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepFour)
// Compare local vs remote CacheableObjectArray elements.
bool isEqual = true;
for (int i = 0; i < remoteCObjArray->size(); i++) {
- Address* rAddr1 = dynamic_cast<Address*>(remoteCObjArray->at(i).ptr());
- Address* lAddr1 = dynamic_cast<Address*>(m_localObjectArray->at(i).ptr());
+ Address* rAddr1 = dynamic_cast<Address*>(remoteCObjArray->at(i).get());
+ Address* lAddr1 = dynamic_cast<Address*>(m_localObjectArray->at(i).get());
LOGINFO("Remote Address:: %d th element AptNum=%d street=%s city=%s ",
i, rAddr1->getAptNum(), rAddr1->getStreet(), rAddr1->getCity());
if (!rAddr1->equals(*lAddr1)) {
@@ -3197,18 +3181,18 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepFour)
ASSERT(isEqual == true,
"PdxTests StepFour: CacheableObjectArray elements are not matched");
- PdxTests::PdxTypePtr localPdxptr(new PdxTests::PdxType());
+ auto localPdxptr = std::make_shared<PdxTests::PdxType>();
CacheableKeyPtr keyport = CacheableKey::create(1);
LOG("Client-2 PdxTests::PdxType GET OP Start....");
PdxTests::PdxTypePtr remotePdxptr =
- dynCast<PdxTests::PdxTypePtr>(regPtr0->get(keyport));
+ std::dynamic_pointer_cast<PdxTests::PdxType>(regPtr0->get(keyport));
LOG("Client-2 PdxTests::PdxType GET OP Done....");
//
- PdxTests::PdxType* localPdx = localPdxptr.ptr();
+ PdxTests::PdxType* localPdx = localPdxptr.get();
PdxTests::PdxType* remotePdx =
- dynamic_cast<PdxTests::PdxType*>(remotePdxptr.ptr());
+ dynamic_cast<PdxTests::PdxType*>(remotePdxptr.get());
// ToDo open this equals check
LOGINFO("testThinClientPdxTests:StepFour before equal() check");
@@ -3226,7 +3210,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepFour)
remotePdx->getArrayOfByteArrays()[1][1]);
CacheableInt32* element =
- dynamic_cast<CacheableInt32*>(remotePdx->getArrayList()->at(0).ptr());
+ dynamic_cast<CacheableInt32*>(remotePdx->getArrayList()->at(0).get());
LOGINFO("GET OP Result_1233: Array List element Value =%d",
element->value());
@@ -3235,8 +3219,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepFour)
for (CacheableHashTable::Iterator iter = remotePdx->getHashTable()->begin();
iter != remotePdx->getHashTable()->end(); ++iter) {
- remoteKey = dynamic_cast<CacheableInt32*>(iter.first().ptr());
- remoteVal = dynamic_cast<CacheableString*>(iter.second().ptr());
+ remoteKey = dynamic_cast<CacheableInt32*>(iter.first().get());
+ remoteVal = dynamic_cast<CacheableString*>(iter.second().get());
LOGINFO("HashTable Key Val = %d", remoteKey->value());
LOGINFO("HashTable Val = %s", remoteVal->asChar());
//(*iter1).first.value();
@@ -3244,7 +3228,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepFour)
}
// Now get values for key3 and 4 to asset against stats of this client
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.ptr()));
+ LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr0.get()));
LOGINFO("PdxSerializations = %d ",
lregPtr->getCacheImpl()->m_cacheStats->getPdxSerializations());
LOGINFO("PdxDeSerializations = %d ",
@@ -3257,10 +3241,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepFour)
CacheableKeyPtr keyport3 = CacheableKey::create(3);
CacheableKeyPtr keyport4 = CacheableKey::create(4);
- CacheableInt32Ptr int32Ptr =
- dynCast<CacheableInt32Ptr>(regPtr0->get(keyport3));
- CacheableInt64Ptr int64Ptr =
- dynCast<CacheableInt64Ptr>(regPtr0->get(keyport4));
+ auto int32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr0->get(keyport3));
+ auto int64Ptr = std::dynamic_pointer_cast<CacheableInt64>(regPtr0->get(keyport4));
ASSERT(int32Ptr->value() ==
lregPtr->getCacheImpl()->m_cacheStats->getPdxDeSerializations(),
"Total pdxDeserializations should be equal to Total "
[14/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from cppcache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientPoolExecuteHAFunction.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientPoolExecuteHAFunction.cpp b/src/cppcache/integration-test/testThinClientPoolExecuteHAFunction.cpp
index 0fbef1b..3c86261 100644
--- a/src/cppcache/integration-test/testThinClientPoolExecuteHAFunction.cpp
+++ b/src/cppcache/integration-test/testThinClientPoolExecuteHAFunction.cpp
@@ -40,17 +40,18 @@ char* OnServerHAExceptionFunction = (char*)"OnServerHAExceptionFunction";
char* OnServerHAShutdownFunction = (char*)"OnServerHAShutdownFunction";
char* RegionOperationsHAFunction = (char*)"RegionOperationsHAFunction";
-#define verifyGetResults() \
- bool found = false; \
- for (int j = 0; j < 34; j++) { \
- if (j % 2 == 0) continue; \
- sprintf(buf, "VALUE--%d", j); \
- if (strcmp(buf, dynCast<CacheableStringPtr>(resultList->operator[](i)) \
- ->asChar()) == 0) { \
- found = true; \
- break; \
- } \
- } \
+#define verifyGetResults() \
+ bool found = false; \
+ for (int j = 0; j < 34; j++) { \
+ if (j % 2 == 0) continue; \
+ sprintf(buf, "VALUE--%d", j); \
+ if (strcmp(buf, std::dynamic_pointer_cast<CacheableString>( \
+ resultList->operator[](i)) \
+ ->asChar()) == 0) { \
+ found = true; \
+ break; \
+ } \
+ } \
ASSERT(found, "this returned value is invalid");
#define verifyPutResults() \
@@ -90,8 +91,8 @@ class MyResultCollector : public ResultCollector {
void addResult(CacheablePtr& resultItem) {
m_addResultCount++;
- if (resultItem == NULLPTR) return;
- CacheableArrayListPtr result = dynCast<CacheableArrayListPtr>(resultItem);
+ if (resultItem == nullptr) return;
+ auto result = std::dynamic_pointer_cast<CacheableArrayList>(resultItem);
for (int32_t i = 0; i < result->size(); i++) {
m_resultList->push_back(result->operator[](i));
}
@@ -152,7 +153,7 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, StartC1)
{
- initClientWithPool(true, NULL, locHostPort, serverGroup, NULLPTR, 0, true,
+ initClientWithPool(true, NULL, locHostPort, serverGroup, nullptr, 0, true,
-1, 5, 60000);
// createPool(poolName, locHostPort,serverGroup, NULL, 0, true );
// createRegionAndAttachPool(poolRegNames[0],USE_ACK, poolName);
@@ -181,39 +182,36 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
{
- RegionPtr regPtr0 = getHelper()->getRegion(poolRegNames[0]);
+ auto regPtr0 = getHelper()->getRegion(poolRegNames[0]);
char buf[128];
for (int i = 0; i < 34; i++) {
sprintf(buf, "VALUE--%d", i);
- CacheablePtr value(CacheableString::create(buf));
+ auto value = CacheableString::create(buf);
sprintf(buf, "KEY--%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
+ auto key = CacheableKey::create(buf);
regPtr0->put(key, value);
}
SLEEP(10000); // let the put finish
try {
- CacheablePtr args = CacheableBoolean::create(1);
- CacheableVectorPtr routingObj = CacheableVector::create();
+ auto routingObj = CacheableVector::create();
for (int i = 0; i < 34; i++) {
if (i % 2 == 0) continue;
sprintf(buf, "KEY--%d", i);
CacheableKeyPtr key = CacheableKey::create(buf);
routingObj->push_back(key);
}
- args = routingObj;
// UNUSED bool getResult = true;
- ExecutionPtr exc = FunctionService::onRegion(regPtr0);
- ASSERT(exc != NULLPTR, "onRegion Returned NULL");
- CacheableVectorPtr resultList = CacheableVector::create();
+ auto exc = FunctionService::onRegion(regPtr0);
+ ASSERT(exc != nullptr, "onRegion Returned NULL");
+ auto resultList = CacheableVector::create();
- CacheableVectorPtr executeFunctionResult =
- exc->withArgs(args)
- ->execute(RegionOperationsHAFunction, 15)
- ->getResult();
+ auto executeFunctionResult = exc->withArgs(routingObj)
+ ->execute(RegionOperationsHAFunction, 15)
+ ->getResult();
- if (executeFunctionResult == NULLPTR) {
+ if (executeFunctionResult == nullptr) {
ASSERT(false, "get executeFunctionResult is NULL");
} else {
sprintf(buf, "echo String : result count = %d",
@@ -224,7 +222,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
for (unsigned item = 0;
item < static_cast<uint32_t>(executeFunctionResult->size());
item++) {
- CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>(
+ auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>(
executeFunctionResult->operator[](item));
for (unsigned pos = 0; pos < static_cast<uint32_t>(arrayList->size());
pos++) {
@@ -237,10 +235,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
"get executeFunctionResult count is not 17");
for (int32_t i = 0; i < resultList->size(); i++) {
sprintf(buf, "result[%d] is null\n", i);
- ASSERT(resultList->operator[](i) != NULLPTR, buf);
- sprintf(
- buf, "get result[%d]=%s", i,
- dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar());
+ ASSERT(resultList->operator[](i) != nullptr, buf);
+ sprintf(buf, "get result[%d]=%s", i,
+ std::dynamic_pointer_cast<CacheableString>(
+ resultList->operator[](i))
+ ->asChar());
LOG(buf);
verifyGetResults()
}
@@ -248,15 +247,15 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
/*-------------------------------onRegion with single filter
* key---------------------------------------*/
- CacheableVectorPtr filter = CacheableVector::create();
+ auto filter = CacheableVector::create();
const char* key = "KEY--10";
filter->push_back(CacheableString::create(key));
- executeFunctionResult = exc->withArgs(args)
+ executeFunctionResult = exc->withArgs(routingObj)
->withFilter(filter)
->execute(RegionOperationsHAFunction, 15)
->getResult();
- if (executeFunctionResult == NULLPTR) {
+ if (executeFunctionResult == nullptr) {
ASSERT(false, "get executeFunctionResult is NULL");
} else {
sprintf(buf, "echo String : result count = %d",
@@ -267,7 +266,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
for (unsigned item = 0;
item < static_cast<uint32_t>(executeFunctionResult->size());
item++) {
- CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>(
+ auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>(
executeFunctionResult->operator[](item));
for (unsigned pos = 0; pos < static_cast<uint32_t>(arrayList->size());
pos++) {
@@ -280,10 +279,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
"get executeFunctionResult count is not 17");
for (int32_t i = 0; i < resultList->size(); i++) {
sprintf(buf, "result[%d] is null\n", i);
- ASSERT(resultList->operator[](i) != NULLPTR, buf);
- sprintf(
- buf, "get result[%d]=%s", i,
- dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar());
+ ASSERT(resultList->operator[](i) != nullptr, buf);
+ sprintf(buf, "get result[%d]=%s", i,
+ std::dynamic_pointer_cast<CacheableString>(
+ resultList->operator[](i))
+ ->asChar());
LOG(buf);
verifyGetResults()
}
@@ -305,43 +305,41 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, Client1OnServerHATest)
{
- RegionPtr regPtr0 = getHelper()->getRegion(poolRegNames[0]);
+ auto regPtr0 = getHelper()->getRegion(poolRegNames[0]);
char buf[128];
for (int i = 0; i < 34; i++) {
sprintf(buf, "VALUE--%d", i);
- CacheablePtr value(CacheableString::create(buf));
+ auto value = CacheableString::create(buf);
sprintf(buf, "KEY--%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
+ auto key = CacheableKey::create(buf);
regPtr0->put(key, value);
}
SLEEP(10000); // let the put finish
try {
- CacheablePtr args = CacheableBoolean::create(1);
- CacheableVectorPtr routingObj = CacheableVector::create();
+ auto routingObj = CacheableVector::create();
for (int i = 0; i < 34; i++) {
if (i % 2 == 0) continue;
sprintf(buf, "KEY--%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
+ auto key = CacheableKey::create(buf);
routingObj->push_back(key);
}
// UNUSED bool getResult = true;
- PoolPtr pool = apache::geode::client::PoolManager::find("__TEST_POOL1__");
- ExecutionPtr exc = FunctionService::onServer(pool);
- ASSERT(exc != NULLPTR, "onServer Returned NULL");
+ auto pool = apache::geode::client::PoolManager::find("__TEST_POOL1__");
+ auto exc = FunctionService::onServer(pool);
+ ASSERT(exc != nullptr, "onServer Returned NULL");
- args = routingObj;
- CacheableVectorPtr resultList = CacheableVector::create();
+ auto resultList = CacheableVector::create();
// Test with HA exception
- CacheableVectorPtr executeFunctionResult =
- exc->withArgs(args)
+ auto executeFunctionResult =
+ exc->withArgs(routingObj)
->execute(OnServerHAExceptionFunction, 15)
->getResult();
- if (executeFunctionResult == NULLPTR) {
+ if (executeFunctionResult == nullptr) {
ASSERT(false, "get executeFunctionResult is NULL");
} else {
sprintf(buf, "echo String : result count = %d",
@@ -351,7 +349,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OnServerHATest)
for (unsigned item = 0;
item < static_cast<uint32_t>(executeFunctionResult->size());
item++) {
- CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>(
+ auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>(
executeFunctionResult->operator[](item));
for (unsigned pos = 0; pos < static_cast<uint32_t>(arrayList->size());
pos++) {
@@ -364,22 +362,23 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OnServerHATest)
"get executeFunctionResult count is not 17");
for (int32_t i = 0; i < resultList->size(); i++) {
sprintf(buf, "result[%d] is null\n", i);
- ASSERT(resultList->operator[](i) != NULLPTR, buf);
- sprintf(
- buf, "get result[%d]=%s", i,
- dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar());
+ ASSERT(resultList->operator[](i) != nullptr, buf);
+ sprintf(buf, "get result[%d]=%s", i,
+ std::dynamic_pointer_cast<CacheableString>(
+ resultList->operator[](i))
+ ->asChar());
LOG(buf);
verifyGetResults()
}
}
// Test with HA server shutdown
- CacheableVectorPtr executeFunctionResult1 =
- exc->withArgs(args)
+ auto executeFunctionResult1 =
+ exc->withArgs(routingObj)
->execute(OnServerHAShutdownFunction, 15)
->getResult();
- if (executeFunctionResult1 == NULLPTR) {
+ if (executeFunctionResult1 == nullptr) {
ASSERT(false, "get executeFunctionResult1 is NULL");
} else {
sprintf(buf, "echo String : result count = %d",
@@ -389,7 +388,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OnServerHATest)
for (unsigned item = 0;
item < static_cast<uint32_t>(executeFunctionResult1->size());
item++) {
- CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>(
+ auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>(
executeFunctionResult1->operator[](item));
for (unsigned pos = 0; pos < static_cast<uint32_t>(arrayList->size());
pos++) {
@@ -402,10 +401,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OnServerHATest)
"get executeFunctionResult1 count is not 17");
for (int32_t i = 0; i < resultList->size(); i++) {
sprintf(buf, "result[%d] is null\n", i);
- ASSERT(resultList->operator[](i) != NULLPTR, buf);
- sprintf(
- buf, "get result[%d]=%s", i,
- dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar());
+ ASSERT(resultList->operator[](i) != nullptr, buf);
+ sprintf(buf, "get result[%d]=%s", i,
+ std::dynamic_pointer_cast<CacheableString>(
+ resultList->operator[](i))
+ ->asChar());
LOG(buf);
verifyGetResults()
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientPoolExecuteHAFunctionPrSHOP.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientPoolExecuteHAFunctionPrSHOP.cpp b/src/cppcache/integration-test/testThinClientPoolExecuteHAFunctionPrSHOP.cpp
index bb6aa4d..a453738 100644
--- a/src/cppcache/integration-test/testThinClientPoolExecuteHAFunctionPrSHOP.cpp
+++ b/src/cppcache/integration-test/testThinClientPoolExecuteHAFunctionPrSHOP.cpp
@@ -40,17 +40,18 @@ char* OnServerHAShutdownFunction = (char*)"OnServerHAShutdownFunction";
char* RegionOperationsHAFunction = (char*)"RegionOperationsHAFunction";
char* RegionOperationsHAFunctionPrSHOP =
(char*)"RegionOperationsHAFunctionPrSHOP";
-#define verifyGetResults() \
- bool found = false; \
- for (int j = 0; j < 34; j++) { \
- if (j % 2 == 0) continue; \
- sprintf(buf, "VALUE--%d", j); \
- if (strcmp(buf, dynCast<CacheableStringPtr>(resultList->operator[](i)) \
- ->asChar()) == 0) { \
- found = true; \
- break; \
- } \
- } \
+#define verifyGetResults() \
+ bool found = false; \
+ for (int j = 0; j < 34; j++) { \
+ if (j % 2 == 0) continue; \
+ sprintf(buf, "VALUE--%d", j); \
+ if (strcmp(buf, std::dynamic_pointer_cast<CacheableString>( \
+ resultList->operator[](i)) \
+ ->asChar()) == 0) { \
+ found = true; \
+ break; \
+ } \
+ } \
ASSERT(found, "this returned value is invalid");
#define verifyPutResults() \
@@ -90,8 +91,8 @@ class MyResultCollector : public ResultCollector {
void addResult(CacheablePtr& resultItem) {
m_addResultCount++;
- if (resultItem == NULLPTR) return;
- CacheableArrayListPtr result = dynCast<CacheableArrayListPtr>(resultItem);
+ if (resultItem == nullptr) return;
+ auto result = std::dynamic_pointer_cast<CacheableArrayList>(resultItem);
for (int32_t i = 0; i < result->size(); i++) {
m_resultList->push_back(result->operator[](i));
}
@@ -149,7 +150,7 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, StartC1)
{
// initClient(true);
- initClientWithPool(true, NULL, locHostPort, serverGroup, NULLPTR, 1, true,
+ initClientWithPool(true, NULL, locHostPort, serverGroup, nullptr, 1, true,
-1, 5, 60000, /*singlehop*/ true,
/*threadLocal*/ true);
// createPool(poolName, locHostPort,serverGroup, NULL, 0, true );
@@ -179,39 +180,37 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
{
- RegionPtr regPtr0 = getHelper()->getRegion(poolRegNames[0]);
+ auto regPtr0 = getHelper()->getRegion(poolRegNames[0]);
char buf[128];
for (int i = 0; i < 350; i++) {
sprintf(buf, "VALUE--%d", i);
- CacheablePtr value(CacheableString::create(buf));
+ auto value = CacheableString::create(buf);
sprintf(buf, "KEY--%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
+ auto key = CacheableKey::create(buf);
regPtr0->put(key, value);
}
SLEEP(10000); // let the put finish
try {
- CacheablePtr args = CacheableBoolean::create(1);
- CacheableVectorPtr routingObj = CacheableVector::create();
+ auto routingObj = CacheableVector::create();
for (int i = 0; i < 34; i++) {
if (i % 2 == 0) continue;
sprintf(buf, "KEY--%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
+ auto key = CacheableKey::create(buf);
routingObj->push_back(key);
}
- args = routingObj;
// UNUSED bool getResult = true;
ExecutionPtr exc = FunctionService::onRegion(regPtr0);
- ASSERT(exc != NULLPTR, "onRegion Returned NULL");
- CacheableVectorPtr resultList = CacheableVector::create();
+ ASSERT(exc != nullptr, "onRegion Returned NULL");
+ auto resultList = CacheableVector::create();
- CacheableVectorPtr executeFunctionResult =
- exc->withArgs(args)
+ auto executeFunctionResult =
+ exc->withArgs(routingObj)
->execute(RegionOperationsHAFunctionPrSHOP, 15)
->getResult();
- if (executeFunctionResult == NULLPTR) {
+ if (executeFunctionResult == nullptr) {
ASSERT(false, "get executeFunctionResult is NULL");
} else {
sprintf(buf, "echo String : result count = %d",
@@ -222,7 +221,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
for (unsigned item = 0;
item < static_cast<uint32_t>(executeFunctionResult->size());
item++) {
- CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>(
+ auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>(
executeFunctionResult->operator[](item));
for (unsigned pos = 0; pos < static_cast<uint32_t>(arrayList->size());
pos++) {
@@ -235,10 +234,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
"get executeFunctionResult count is not 17");
for (int32_t i = 0; i < resultList->size(); i++) {
sprintf(buf, "result[%d] is null\n", i);
- ASSERT(resultList->operator[](i) != NULLPTR, buf);
- sprintf(
- buf, "get result[%d]=%s", i,
- dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar());
+ ASSERT(resultList->operator[](i) != nullptr, buf);
+ sprintf(buf, "get result[%d]=%s", i,
+ std::dynamic_pointer_cast<CacheableString>(
+ resultList->operator[](i))
+ ->asChar());
LOG(buf);
verifyGetResults()
}
@@ -257,21 +257,20 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, Client1OnServerHATest)
{
- RegionPtr regPtr0 = getHelper()->getRegion(poolRegNames[0]);
+ auto regPtr0 = getHelper()->getRegion(poolRegNames[0]);
char buf[128];
for (int i = 0; i < 34; i++) {
sprintf(buf, "VALUE--%d", i);
- CacheablePtr value(CacheableString::create(buf));
+ auto value = CacheableString::create(buf);
sprintf(buf, "KEY--%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
+ auto key = CacheableKey::create(buf);
regPtr0->put(key, value);
}
SLEEP(10000); // let the put finish
try {
- CacheablePtr args = CacheableBoolean::create(1);
- CacheableVectorPtr routingObj = CacheableVector::create();
+ auto routingObj = CacheableVector::create();
for (int i = 0; i < 34; i++) {
if (i % 2 == 0) continue;
sprintf(buf, "KEY--%d", i);
@@ -280,20 +279,19 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OnServerHATest)
}
// UNUSED bool getResult = true;
- PoolPtr pool = apache::geode::client::PoolManager::find("__TEST_POOL1__");
- ExecutionPtr exc = FunctionService::onServer(pool);
- ASSERT(exc != NULLPTR, "onServer Returned NULL");
+ auto pool = apache::geode::client::PoolManager::find("__TEST_POOL1__");
+ auto exc = FunctionService::onServer(pool);
+ ASSERT(exc != nullptr, "onServer Returned NULL");
- args = routingObj;
- CacheableVectorPtr resultList = CacheableVector::create();
+ auto resultList = CacheableVector::create();
// Test with HA exception
- CacheableVectorPtr executeFunctionResult =
- exc->withArgs(args)
+ auto executeFunctionResult =
+ exc->withArgs(routingObj)
->execute(OnServerHAExceptionFunction, 15)
->getResult();
- if (executeFunctionResult == NULLPTR) {
+ if (executeFunctionResult == nullptr) {
ASSERT(false, "get executeFunctionResult is NULL");
} else {
sprintf(buf, "echo String : result count = %d",
@@ -303,7 +301,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OnServerHATest)
for (unsigned item = 0;
item < static_cast<uint32_t>(executeFunctionResult->size());
item++) {
- CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>(
+ auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>(
executeFunctionResult->operator[](item));
for (unsigned pos = 0; pos < static_cast<uint32_t>(arrayList->size());
pos++) {
@@ -316,22 +314,23 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OnServerHATest)
"get executeFunctionResult count is not 17");
for (int32_t i = 0; i < resultList->size(); i++) {
sprintf(buf, "result[%d] is null\n", i);
- ASSERT(resultList->operator[](i) != NULLPTR, buf);
- sprintf(
- buf, "get result[%d]=%s", i,
- dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar());
+ ASSERT(resultList->operator[](i) != nullptr, buf);
+ sprintf(buf, "get result[%d]=%s", i,
+ std::dynamic_pointer_cast<CacheableString>(
+ resultList->operator[](i))
+ ->asChar());
LOG(buf);
verifyGetResults()
}
}
// Test with HA server shutdown
- CacheableVectorPtr executeFunctionResult1 =
- exc->withArgs(args)
+ auto executeFunctionResult1 =
+ exc->withArgs(routingObj)
->execute(OnServerHAShutdownFunction, 15)
->getResult();
- if (executeFunctionResult1 == NULLPTR) {
+ if (executeFunctionResult1 == nullptr) {
ASSERT(false, "get executeFunctionResult1 is NULL");
} else {
sprintf(buf, "echo String : result count = %d",
@@ -341,7 +340,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OnServerHATest)
for (unsigned item = 0;
item < static_cast<uint32_t>(executeFunctionResult1->size());
item++) {
- CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>(
+ auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>(
executeFunctionResult1->operator[](item));
for (unsigned pos = 0; pos < static_cast<uint32_t>(arrayList->size());
pos++) {
@@ -354,10 +353,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OnServerHATest)
"get executeFunctionResult1 count is not 17");
for (int32_t i = 0; i < resultList->size(); i++) {
sprintf(buf, "result[%d] is null\n", i);
- ASSERT(resultList->operator[](i) != NULLPTR, buf);
- sprintf(
- buf, "get result[%d]=%s", i,
- dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar());
+ ASSERT(resultList->operator[](i) != nullptr, buf);
+ sprintf(buf, "get result[%d]=%s", i,
+ std::dynamic_pointer_cast<CacheableString>(
+ resultList->operator[](i))
+ ->asChar());
LOG(buf);
verifyGetResults()
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientPoolLocator.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientPoolLocator.cpp b/src/cppcache/integration-test/testThinClientPoolLocator.cpp
index 6c8533d..6bb4db9 100644
--- a/src/cppcache/integration-test/testThinClientPoolLocator.cpp
+++ b/src/cppcache/integration-test/testThinClientPoolLocator.cpp
@@ -37,14 +37,11 @@ DUNIT_TASK(CLIENT1, SetupClient1_NoLocators_At_Init)
try {
createEntry(regionNames[0], keys[0], vals[0]);
} catch (NotConnectedException& ex) {
- try {
- ExceptionPtr exCause =
- dynCast<SharedPtr<NoAvailableLocatorsException> >(ex.getCause());
- } catch (ClassCastException&) {
- FAIL(
- "NotconnectedException with cause NoAvailableLocatorsException was "
- "not thrown.");
- }
+ ASSERT(
+ std::dynamic_pointer_cast<NoAvailableLocatorsException>(
+ ex.getCause()),
+ "NotconnectedException with cause NoAvailableLocatorsException was "
+ "not thrown.");
}
LOG("SetupClient1 complete.");
}
@@ -197,12 +194,8 @@ DUNIT_TASK(CLIENT2, AgainFailoverC2)
updateEntry(regionNames[0], keys[1], vals[1]);
FAIL("Client Failover Should Fail");
} catch (const NotConnectedException& ex) {
- try {
- ExceptionPtr exCause =
- dynCast<SharedPtr<NoAvailableLocatorsException> >(ex.getCause());
- LOG("Expected exception "
- "NoAvailableLocatorsException got");
- } catch (ClassCastException&) {
+ if (!std::dynamic_pointer_cast<NoAvailableLocatorsException>(
+ ex.getCause())) {
LOG(ex.getName());
LOG(ex.getMessage());
FAIL(
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientPoolRedundancy.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientPoolRedundancy.cpp b/src/cppcache/integration-test/testThinClientPoolRedundancy.cpp
index 3423286..c442451 100644
--- a/src/cppcache/integration-test/testThinClientPoolRedundancy.cpp
+++ b/src/cppcache/integration-test/testThinClientPoolRedundancy.cpp
@@ -117,9 +117,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, CreateClient1_1)
RegionPtr regPtr1 = getHelper()->getRegion(poolRegNames[1]);
RegionPtr regPtr2 = getHelper()->getRegion(poolRegNames[2]);
- regPtr0->registerAllKeys(false, NULLPTR, true);
- regPtr1->registerAllKeys(false, NULLPTR, true);
- regPtr2->registerAllKeys(false, NULLPTR, true);
+ regPtr0->registerAllKeys(false, nullptr, true);
+ regPtr1->registerAllKeys(false, nullptr, true);
+ regPtr2->registerAllKeys(false, nullptr, true);
LOG("CreateClient1 complete.");
}
@@ -145,9 +145,9 @@ DUNIT_TASK_DEFINITION(CLIENT2, CreateClient2_1)
RegionPtr regPtr1 = getHelper()->getRegion(poolRegNames[1]);
RegionPtr regPtr2 = getHelper()->getRegion(poolRegNames[2]);
- regPtr0->registerAllKeys(false, NULLPTR, true);
- regPtr1->registerAllKeys(false, NULLPTR, true);
- regPtr2->registerAllKeys(false, NULLPTR, true);
+ regPtr0->registerAllKeys(false, nullptr, true);
+ regPtr1->registerAllKeys(false, nullptr, true);
+ regPtr2->registerAllKeys(false, nullptr, true);
LOG("CreateClient2 verify starts.");
verifyEntries(0);
@@ -176,9 +176,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, CreateClient1_2)
RegionPtr regPtr1 = getHelper()->getRegion(poolRegNames[1]);
RegionPtr regPtr2 = getHelper()->getRegion(poolRegNames[2]);
- regPtr0->registerAllKeys(false, NULLPTR, true);
- regPtr1->registerAllKeys(false, NULLPTR, true);
- regPtr2->registerAllKeys(false, NULLPTR, true);
+ regPtr0->registerAllKeys(false, nullptr, true);
+ regPtr1->registerAllKeys(false, nullptr, true);
+ regPtr2->registerAllKeys(false, nullptr, true);
LOG("CreateClient1 complete.");
}
@@ -204,9 +204,9 @@ DUNIT_TASK_DEFINITION(CLIENT2, CreateClient2_2)
RegionPtr regPtr1 = getHelper()->getRegion(poolRegNames[1]);
RegionPtr regPtr2 = getHelper()->getRegion(poolRegNames[2]);
- regPtr0->registerAllKeys(false, NULLPTR, true);
- regPtr1->registerAllKeys(false, NULLPTR, true);
- regPtr2->registerAllKeys(false, NULLPTR, true);
+ regPtr0->registerAllKeys(false, nullptr, true);
+ regPtr1->registerAllKeys(false, nullptr, true);
+ regPtr2->registerAllKeys(false, nullptr, true);
verifyEntries(0);
@@ -272,10 +272,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, VerifyK1C1New2)
CacheableKeyPtr keyPtr = createKey(keys[1]);
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
- ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null.");
+ ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
sprintf(buf, "get returned %s for key %s", checkPtr->asChar(), keys[1]);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientPutAllPRSingleHop.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientPutAllPRSingleHop.cpp b/src/cppcache/integration-test/testThinClientPutAllPRSingleHop.cpp
index a47c7b2..83faa8a 100644
--- a/src/cppcache/integration-test/testThinClientPutAllPRSingleHop.cpp
+++ b/src/cppcache/integration-test/testThinClientPutAllPRSingleHop.cpp
@@ -108,10 +108,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepOne_Pooled_EndpointTL)
RegionPtr regPtr = getHelper()->createPooledRegionStickySingleHop(
regionNames[0], USE_ACK, NULL, "__TEST_POOL1__", false, false);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
regPtr = getHelper()->createPooledRegionStickySingleHop(
regionNames[1], NO_ACK, NULL, "__TEST_POOL1__", false, false);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("StepOne_Pooled_EndPointTL complete.");
}
@@ -126,8 +126,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, WarmUpTask)
// This is to get MetaDataService going.
for (int i = 3000; i < 8000; i++) {
- CacheableKeyPtr keyPtr =
- dynCast<CacheableKeyPtr>(CacheableInt32::create(i));
+ auto keyPtr =
+ std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
try {
LOGINFO("CPPTEST: put item %d", i);
dataReg->put(keyPtr, keyPtr->hashcode());
@@ -208,10 +208,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask)
HashMapOfCacheable valMap;
for (int j = 1000; j < 25000; j++) {
- CacheableKeyPtr keyPtr =
- dynCast<CacheableKeyPtr>(CacheableInt32::create(j));
- CacheablePtr valPtr =
- dynCast<CacheablePtr>(CacheableInt32::create(keyPtr->hashcode()));
+ auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(
+ CacheableInt32::create(j));
+ auto valPtr = std::dynamic_pointer_cast<Cacheable>(
+ CacheableInt32::create(keyPtr->hashcode()));
LOGINFO("CPPTEST: putALL CASE:: getting key %d with hashcode %d", j,
keyPtr->hashcode());
valMap.insert(keyPtr, valPtr);
@@ -270,10 +270,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopRemoveAllForIntKeysTask)
HashMapOfCacheable valMap;
VectorOfCacheableKey keys;
for (int j = 1000; j < 25000; j++) {
- CacheableKeyPtr keyPtr =
- dynCast<CacheableKeyPtr>(CacheableInt32::create(j));
- CacheablePtr valPtr =
- dynCast<CacheablePtr>(CacheableInt32::create(keyPtr->hashcode()));
+ auto keyPtr = CacheableInt32::create(j);
+ auto valPtr = CacheableInt32::create(keyPtr->hashcode());
LOGINFO("CPPTEST: removeall CASE:: getting key %d with hashcode %d",
j, keyPtr->hashcode());
valMap.insert(keyPtr, valPtr);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientPutWithDelta.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientPutWithDelta.cpp b/src/cppcache/integration-test/testThinClientPutWithDelta.cpp
index 94d68df..e4588ec 100644
--- a/src/cppcache/integration-test/testThinClientPutWithDelta.cpp
+++ b/src/cppcache/integration-test/testThinClientPutWithDelta.cpp
@@ -72,7 +72,7 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators,
RegionPtr regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
@@ -83,8 +83,8 @@ void createRegion(const char* name, bool ackMode, const char* endpoints,
fflush(stdout);
// ack, caching
RegionPtr regPtr = getHelper()->createRegion(
- name, ackMode, true, NULLPTR, endpoints, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ name, ackMode, true, nullptr, endpoints, clientNotificationEnabled);
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
@@ -116,22 +116,20 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepOne)
DeltaEx::toDataCount = 0;
CacheableKeyPtr keyPtr = createKey(keys[0]);
- DeltaEx* ptr = new DeltaEx();
- CacheablePtr valPtr(ptr);
+ auto valPtr = std::make_shared<DeltaEx>();
RegionPtr regPtr = getHelper()->getRegion(regionNames[0]);
regPtr->put(keyPtr, valPtr);
- ptr->setDelta(true);
+ valPtr->setDelta(true);
regPtr->put(keyPtr, valPtr);
// Test create with delta - toData() should be invoked instead of toDelta()
regPtr->destroy(keyPtr);
- ptr->setDelta(true);
+ valPtr->setDelta(true);
regPtr->create(keyPtr, valPtr);
- DeltaEx* ptr1 = new DeltaEx(0);
- CacheablePtr valPtr1(ptr1);
+ auto valPtr1 = std::make_shared<DeltaEx>(0);
regPtr->put(keyPtr, valPtr1);
- ptr1->setDelta(true);
+ valPtr1->setDelta(true);
regPtr->put(keyPtr, valPtr1);
ASSERT(DeltaEx::toDeltaCount == 2, " Delta count should have been 2 ");
ASSERT(DeltaEx::toDataCount == 4, " Data count should have been 3 ");
@@ -149,12 +147,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepOne_DisableDelta)
} catch (IllegalStateException&) {
// Ignore the exception caused by re-registration of DeltaEx.
}
- CacheableKeyPtr keyPtr = createKey(keys[0]);
- DeltaEx* ptr = new DeltaEx();
- CacheablePtr valPtr(ptr);
- RegionPtr regPtr = getHelper()->getRegion(regionNames[0]);
+ auto keyPtr = createKey(keys[0]);
+ auto valPtr = std::make_shared<DeltaEx>();
+ auto regPtr = getHelper()->getRegion(regionNames[0]);
regPtr->put(keyPtr, valPtr);
- ptr->setDelta(true);
+ valPtr->setDelta(true);
regPtr->put(keyPtr, valPtr);
ASSERT(DeltaEx::toDeltaCount == 0, " Delta count should have been 0 ");
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientRegionQueryDifferentServerConfigs.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientRegionQueryDifferentServerConfigs.cpp b/src/cppcache/integration-test/testThinClientRegionQueryDifferentServerConfigs.cpp
index 84228aa..a6e5570 100644
--- a/src/cppcache/integration-test/testThinClientRegionQueryDifferentServerConfigs.cpp
+++ b/src/cppcache/integration-test/testThinClientRegionQueryDifferentServerConfigs.cpp
@@ -85,7 +85,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, InitClientCreateRegionAndRunQueries)
{
LOG("Starting Step One with Pool + Locator lists");
initClient();
- PoolPtr pool1 = NULLPTR;
+ PoolPtr pool1 = nullptr;
pool1 = createPool(poolNames[0], locHostPort, sGNames[0], 0, true);
createRegionAndAttachPool(qRegionNames[0], USE_ACK, poolNames[0]);
@@ -98,7 +98,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, InitClientCreateRegionAndRunQueries)
std::string qry1Str = (std::string) "select * from /" + qRegionNames[0];
std::string qry2Str = (std::string) "select * from /" + qRegionNames[1];
- QueryServicePtr qs = NULLPTR;
+ QueryServicePtr qs = nullptr;
qs = pool1->getQueryService();
SelectResultsPtr results;
@@ -146,7 +146,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CreateRegionAndRunQueries)
{
LOG("Starting Step Two with Pool + Locator list");
// Create pool2
- PoolPtr pool2 = NULLPTR;
+ PoolPtr pool2 = nullptr;
pool2 = createPool(poolNames[1], locHostPort, sGNames[1], 0, true);
createRegionAndAttachPool(qRegionNames[1], USE_ACK, poolNames[1]);
@@ -160,7 +160,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CreateRegionAndRunQueries)
std::string qry1Str = (std::string) "select * from /" + qRegionNames[0];
std::string qry2Str = (std::string) "select * from /" + qRegionNames[1];
- QueryServicePtr qs = NULLPTR;
+ QueryServicePtr qs = nullptr;
qs = pool2->getQueryService();
SelectResultsPtr results;
QueryPtr qry;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientRegionQueryExclusiveness.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientRegionQueryExclusiveness.cpp b/src/cppcache/integration-test/testThinClientRegionQueryExclusiveness.cpp
index 7f05959..5dc3456 100644
--- a/src/cppcache/integration-test/testThinClientRegionQueryExclusiveness.cpp
+++ b/src/cppcache/integration-test/testThinClientRegionQueryExclusiveness.cpp
@@ -61,7 +61,7 @@ void clientOperations() {
initClient(true);
try {
- QueryServicePtr qs = NULLPTR; // getHelper()->cachePtr->getQueryService();
+ QueryServicePtr qs = nullptr; // getHelper()->cachePtr->getQueryService();
qs = createPool2("_TESTFAILPOOL_", NULL, NULL)->getQueryService();
@@ -75,22 +75,22 @@ void clientOperations() {
LOG(err_msg);
}
- PoolPtr pool1 = NULLPTR;
+ PoolPtr pool1 = nullptr;
pool1 = createPool(poolNames[0], locHostPort, NULL, 0, true);
createRegionAndAttachPool(qRegionNames[0], USE_ACK, poolNames[0]);
RegionPtr rptr = getHelper()->cachePtr->getRegion(qRegionNames[0]);
- PortfolioPtr p1(new Portfolio(1, 100));
- PortfolioPtr p2(new Portfolio(2, 100));
- PortfolioPtr p3(new Portfolio(3, 100));
- PortfolioPtr p4(new Portfolio(4, 100));
+ auto p1 = std::make_shared<Portfolio>(1, 100);
+ auto p2 = std::make_shared<Portfolio>(2, 100);
+ auto p3 = std::make_shared<Portfolio>(3, 100);
+ auto p4 = std::make_shared<Portfolio>(4, 100);
rptr->put("1", p1);
rptr->put("2", p2);
rptr->put("3", p3);
rptr->put("4", p4);
- QueryServicePtr qs = NULLPTR;
+ QueryServicePtr qs = nullptr;
qs = pool1->getQueryService();
QueryPtr qry1 = qs->newQuery("select distinct * from /Portfolios");
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientRemoteQueryFailover.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientRemoteQueryFailover.cpp b/src/cppcache/integration-test/testThinClientRemoteQueryFailover.cpp
index 2befb52..560312d 100644
--- a/src/cppcache/integration-test/testThinClientRemoteQueryFailover.cpp
+++ b/src/cppcache/integration-test/testThinClientRemoteQueryFailover.cpp
@@ -127,10 +127,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, RegisterTypesAndCreatePoolAndRegion)
RegionPtr rptr = getHelper()->cachePtr->getRegion(qRegionNames[0]);
- CacheablePtr port1(new Portfolio(1, 100));
- CacheablePtr port2(new Portfolio(2, 200));
- CacheablePtr port3(new Portfolio(3, 300));
- CacheablePtr port4(new Portfolio(4, 400));
+ auto port1 = std::make_shared<Portfolio>(1, 100);
+ auto port2 = std::make_shared<Portfolio>(2, 200);
+ auto port3 = std::make_shared<Portfolio>(3, 300);
+ auto port4 = std::make_shared<Portfolio>(4, 400);
rptr->put("1", port1);
rptr->put("2", port2);
@@ -146,7 +146,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, ValidateQueryExecutionAcrossServerFailure)
try {
kst = new KillServerThread();
- QueryServicePtr qs = NULLPTR;
+ QueryServicePtr qs = nullptr;
if (isPoolConfig) {
PoolPtr pool1 = findPool(poolNames[0]);
qs = pool1->getQueryService();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientRemoteQueryFailoverPdx.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientRemoteQueryFailoverPdx.cpp b/src/cppcache/integration-test/testThinClientRemoteQueryFailoverPdx.cpp
index a6221ee..15cdc47 100644
--- a/src/cppcache/integration-test/testThinClientRemoteQueryFailoverPdx.cpp
+++ b/src/cppcache/integration-test/testThinClientRemoteQueryFailoverPdx.cpp
@@ -127,10 +127,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, RegisterTypesAndCreatePoolAndRegion)
RegionPtr rptr = getHelper()->cachePtr->getRegion(qRegionNames[0]);
- CacheablePtr port1(new PortfolioPdx(1, 100));
- CacheablePtr port2(new PortfolioPdx(2, 200));
- CacheablePtr port3(new PortfolioPdx(3, 300));
- CacheablePtr port4(new PortfolioPdx(4, 400));
+ auto port1 = std::make_shared<PortfolioPdx>(1, 100);
+ auto port2 = std::make_shared<PortfolioPdx>(2, 200);
+ auto port3 = std::make_shared<PortfolioPdx>(3, 300);
+ auto port4 = std::make_shared<PortfolioPdx>(4, 400);
rptr->put("1", port1);
rptr->put("2", port2);
@@ -146,7 +146,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, ValidateQueryExecutionAcrossServerFailure)
try {
kst = new KillServerThread();
- QueryServicePtr qs = NULLPTR;
+ QueryServicePtr qs = nullptr;
if (isPoolConfig) {
PoolPtr pool1 = findPool(poolNames[0]);
qs = pool1->getQueryService();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientRemoteQueryRS.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientRemoteQueryRS.cpp b/src/cppcache/integration-test/testThinClientRemoteQueryRS.cpp
index f324036..1500531 100644
--- a/src/cppcache/integration-test/testThinClientRemoteQueryRS.cpp
+++ b/src/cppcache/integration-test/testThinClientRemoteQueryRS.cpp
@@ -169,7 +169,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
bool doAnyErrorOccured = false;
QueryHelper* qh = &QueryHelper::getHelper();
- QueryServicePtr qs = NULLPTR;
+ QueryServicePtr qs = nullptr;
if (isPoolConfig) {
PoolPtr pool1 = findPool(poolNames[0]);
qs = pool1->getQueryService();
@@ -188,7 +188,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
continue;
}
- ResultSetPtr rsptr = dynCast<ResultSetPtr>(results);
+ auto rsptr = std::dynamic_pointer_cast<ResultSet>(results);
SelectResultsIterator iter = rsptr->getIterator();
for (int32_t rows = 0; rows < rsptr->size(); rows++) {
if (rows > (int32_t)QueryHelper::getHelper().getPortfolioSetSize()) {
@@ -197,20 +197,20 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
if (!m_isPdx) {
SerializablePtr ser = (*rsptr)[rows];
- if (instanceOf<PortfolioPtr>(ser)) {
- PortfolioPtr portfolio = staticCast<PortfolioPtr>(ser);
+ if (std::dynamic_pointer_cast<Portfolio>(ser)) {
+ PortfolioPtr portfolio = std::static_pointer_cast<GF_UNWRAP_SP(PortfolioPtr)>(ser);
printf(
" query idx %d pulled portfolio object ID %d, pkid :: %s\n",
i, portfolio->getID(), portfolio->getPkid()->asChar());
- } else if (instanceOf<PositionPtr>(ser)) {
- PositionPtr position = staticCast<PositionPtr>(ser);
+ } else if (std::dynamic_pointer_cast<Position>(ser)) {
+ PositionPtr position = std::static_pointer_cast<GF_UNWRAP_SP(PositionPtr)>(ser);
printf(
" query idx %d pulled position object secId %s, shares :: "
"%d\n",
i, position->getSecId()->asChar(),
position->getSharesOutstanding());
} else {
- if (ser != NULLPTR) {
+ if (ser != nullptr) {
printf(" query idx %d pulled object %s \n", i,
ser->toString()->asChar());
} else {
@@ -220,14 +220,14 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
}
} else {
SerializablePtr pdxser = (*rsptr)[rows];
- if (instanceOf<PortfolioPdxPtr>(pdxser)) {
- PortfolioPdxPtr portfoliopdx = staticCast<PortfolioPdxPtr>(pdxser);
+ if (std::dynamic_pointer_cast<PortfolioPdx>(pdxser)) {
+ PortfolioPdxPtr portfoliopdx = std::static_pointer_cast<GF_UNWRAP_SP(PortfolioPdxPtr)>(pdxser);
printf(
" query idx %d pulled portfolioPdx object ID %d, pkid %s :: "
"\n",
i, portfoliopdx->getID(), portfoliopdx->getPkid());
- } else if (instanceOf<PositionPdxPtr>(pdxser)) {
- PositionPdxPtr positionpdx = staticCast<PositionPdxPtr>(pdxser);
+ } else if (std::dynamic_pointer_cast<PositionPdx>(pdxser)) {
+ PositionPdxPtr positionpdx = std::static_pointer_cast<GF_UNWRAP_SP(PositionPdxPtr)>(pdxser);
printf(
" query idx %d pulled positionPdx object secId %s, shares %d "
" "
@@ -235,7 +235,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
i, positionpdx->getSecId(),
positionpdx->getSharesOutstanding());
} else {
- if (pdxser != NULLPTR) {
+ if (pdxser != nullptr) {
if (pdxser->toString()->isWideString()) {
printf(" query idx %d pulled object %S :: \n", i,
pdxser->toString()->asWChar());
@@ -268,7 +268,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFive)
bool doAnyErrorOccured = false;
QueryHelper* qh = &QueryHelper::getHelper();
- QueryServicePtr qs = NULLPTR;
+ QueryServicePtr qs = nullptr;
if (isPoolConfig) {
PoolPtr pool1 = findPool(poolNames[0]);
qs = pool1->getQueryService();
@@ -300,7 +300,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFive)
continue;
}
- ResultSetPtr rsptr = dynCast<ResultSetPtr>(results);
+ auto rsptr = std::dynamic_pointer_cast<ResultSet>(results);
SelectResultsIterator iter = rsptr->getIterator();
for (int32_t rows = 0; rows < rsptr->size(); rows++) {
if (rows > (int32_t)QueryHelper::getHelper().getPortfolioSetSize()) {
@@ -309,21 +309,21 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFive)
if (!m_isPdx) {
SerializablePtr ser = (*rsptr)[rows];
- if (instanceOf<PortfolioPtr>(ser)) {
- PortfolioPtr portfolio = staticCast<PortfolioPtr>(ser);
+ if (std::dynamic_pointer_cast<Portfolio>(ser)) {
+ PortfolioPtr portfolio = std::static_pointer_cast<GF_UNWRAP_SP(PortfolioPtr)>(ser);
printf(
" query idx %d pulled portfolio object ID %d, pkid :: "
"%s\n",
i, portfolio->getID(), portfolio->getPkid()->asChar());
- } else if (instanceOf<PositionPtr>(ser)) {
- PositionPtr position = staticCast<PositionPtr>(ser);
+ } else if (std::dynamic_pointer_cast<Position>(ser)) {
+ PositionPtr position = std::static_pointer_cast<GF_UNWRAP_SP(PositionPtr)>(ser);
printf(
" query idx %d pulled position object secId %s, shares :: "
"%d\n",
i, position->getSecId()->asChar(),
position->getSharesOutstanding());
} else {
- if (ser != NULLPTR) {
+ if (ser != nullptr) {
printf(" query idx %d pulled object %s \n", i,
ser->toString()->asChar());
} else {
@@ -333,16 +333,16 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFive)
}
} else {
SerializablePtr pdxser = (*rsptr)[rows];
- if (instanceOf<PortfolioPdxPtr>(pdxser)) {
+ if (std::dynamic_pointer_cast<PortfolioPdx>(pdxser)) {
PortfolioPdxPtr portfoliopdx =
- staticCast<PortfolioPdxPtr>(pdxser);
+ std::static_pointer_cast<GF_UNWRAP_SP(PortfolioPdxPtr)>(pdxser);
printf(
" query idx %d pulled portfolioPdx object ID %d, pkid %s "
":: "
"\n",
i, portfoliopdx->getID(), portfoliopdx->getPkid());
- } else if (instanceOf<PositionPdxPtr>(pdxser)) {
- PositionPdxPtr positionpdx = staticCast<PositionPdxPtr>(pdxser);
+ } else if (std::dynamic_pointer_cast<PositionPdx>(pdxser)) {
+ PositionPdxPtr positionpdx = std::static_pointer_cast<GF_UNWRAP_SP(PositionPdxPtr)>(pdxser);
printf(
" query idx %d pulled positionPdx object secId %s, shares "
"%d "
@@ -350,7 +350,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFive)
i, positionpdx->getSecId(),
positionpdx->getSharesOutstanding());
} else {
- if (pdxser != NULLPTR) {
+ if (pdxser != nullptr) {
if (pdxser->toString()->isWideString()) {
printf(" query idx %d pulled object %S :: \n", i,
pdxser->toString()->asWChar());
@@ -384,7 +384,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSix)
bool doAnyErrorOccured = false;
QueryHelper* qh = &QueryHelper::getHelper();
- QueryServicePtr qs = NULLPTR;
+ QueryServicePtr qs = nullptr;
if (isPoolConfig) {
PoolPtr pool1 = findPool(poolNames[0]);
qs = pool1->getQueryService();
@@ -422,7 +422,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSix)
continue;
}
- ResultSetPtr rsptr = dynCast<ResultSetPtr>(results);
+ auto rsptr = std::dynamic_pointer_cast<ResultSet>(results);
SelectResultsIterator iter = rsptr->getIterator();
for (int32_t rows = 0; rows < rsptr->size(); rows++) {
if (rows > (int32_t)QueryHelper::getHelper().getPortfolioSetSize()) {
@@ -431,13 +431,13 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSix)
if (!m_isPdx) {
SerializablePtr ser = (*rsptr)[rows];
- if (instanceOf<PortfolioPtr>(ser)) {
- PortfolioPtr portfolio = staticCast<PortfolioPtr>(ser);
+ if (std::dynamic_pointer_cast<Portfolio>(ser)) {
+ PortfolioPtr portfolio = std::static_pointer_cast<GF_UNWRAP_SP(PortfolioPtr)>(ser);
printf(
" query idx %d pulled portfolio object ID %d, pkid %s : \n",
i, portfolio->getID(), portfolio->getPkid()->asChar());
- } else if (instanceOf<PositionPtr>(ser)) {
- PositionPtr position = staticCast<PositionPtr>(ser);
+ } else if (std::dynamic_pointer_cast<Position>(ser)) {
+ PositionPtr position = std::static_pointer_cast<GF_UNWRAP_SP(PositionPtr)>(ser);
printf(
" query idx %d pulled position object secId %s, shares %d "
": "
@@ -445,7 +445,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSix)
i, position->getSecId()->asChar(),
position->getSharesOutstanding());
} else {
- if (ser != NULLPTR) {
+ if (ser != nullptr) {
printf(" query idx %d pulled object %s : \n", i,
ser->toString()->asChar());
} else {
@@ -455,15 +455,15 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSix)
}
} else {
SerializablePtr ser = (*rsptr)[rows];
- if (instanceOf<PortfolioPdxPtr>(ser)) {
- PortfolioPdxPtr portfoliopdx = staticCast<PortfolioPdxPtr>(ser);
+ if (std::dynamic_pointer_cast<PortfolioPdx>(ser)) {
+ PortfolioPdxPtr portfoliopdx = std::static_pointer_cast<GF_UNWRAP_SP(PortfolioPdxPtr)>(ser);
printf(
" query idx %d pulled portfolioPdx object ID %d, pkid %s "
": "
"\n",
i, portfoliopdx->getID(), portfoliopdx->getPkid());
- } else if (instanceOf<PositionPdxPtr>(ser)) {
- PositionPdxPtr positionpdx = staticCast<PositionPdxPtr>(ser);
+ } else if (std::dynamic_pointer_cast<PositionPdx>(ser)) {
+ PositionPdxPtr positionpdx = std::static_pointer_cast<GF_UNWRAP_SP(PositionPdxPtr)>(ser);
printf(
" query idx %d pulled positionPdx object secId %s, shares "
"%d "
@@ -471,7 +471,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSix)
i, positionpdx->getSecId(),
positionpdx->getSharesOutstanding());
} else {
- if (ser != NULLPTR) {
+ if (ser != nullptr) {
printf(" query idx %d pulled object %s : \n", i,
ser->toString()->asChar());
} else {
@@ -496,7 +496,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, DoQueryRSError)
{
QueryHelper* qh ATTR_UNUSED = &QueryHelper::getHelper();
- QueryServicePtr qs = NULLPTR;
+ QueryServicePtr qs = nullptr;
if (isPoolConfig) {
PoolPtr pool1 = findPool(poolNames[0]);
qs = pool1->getQueryService();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientRemoteQuerySS.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientRemoteQuerySS.cpp b/src/cppcache/integration-test/testThinClientRemoteQuerySS.cpp
index 773793c..254db9e 100644
--- a/src/cppcache/integration-test/testThinClientRemoteQuerySS.cpp
+++ b/src/cppcache/integration-test/testThinClientRemoteQuerySS.cpp
@@ -57,35 +57,28 @@ const wchar_t* checkNullString(const wchar_t* str) {
}
void _printFields(CacheablePtr field, Struct* ssptr, int32_t& fields) {
- PortfolioPtr portfolio = NULLPTR;
- PositionPtr position = NULLPTR;
- PortfolioPdxPtr portfolioPdx = NULLPTR;
- PositionPdxPtr positionPdx = NULLPTR;
- CacheableStringPtr str = NULLPTR;
- CacheableBooleanPtr boolptr = NULLPTR;
-
- if ((portfolio = dynamic_cast<Portfolio*>(field.ptr())) != NULLPTR) {
+
+ if (auto portfolio = std::dynamic_pointer_cast<Portfolio>(field)) {
printf(" pulled %s :- ID %d, pkid %s\n",
checkNullString(ssptr->getFieldName(fields)), portfolio->getID(),
checkNullString(portfolio->getPkid()->asChar()));
- } else if ((position = dynamic_cast<Position*>(field.ptr())) != NULLPTR) {
+ } else if (auto position = std::dynamic_pointer_cast<Position>(field)) {
printf(" pulled %s :- secId %s, shares %d\n",
checkNullString(ssptr->getFieldName(fields)),
checkNullString(position->getSecId()->asChar()),
position->getSharesOutstanding());
- } else if ((portfolioPdx = dynamic_cast<PortfolioPdx*>(field.ptr())) !=
- NULLPTR) {
+ } else if (auto portfolioPdx =
+ std::dynamic_pointer_cast<PortfolioPdx>(field)) {
printf(" pulled %s :- ID %d, pkid %s\n",
checkNullString(ssptr->getFieldName(fields)), portfolioPdx->getID(),
checkNullString(portfolioPdx->getPkid()));
- } else if ((positionPdx = dynamic_cast<PositionPdx*>(field.ptr())) !=
- NULLPTR) {
+ } else if (auto positionPdx = std::dynamic_pointer_cast<PositionPdx>(field)) {
printf(" pulled %s :- secId %s, shares %d\n",
checkNullString(ssptr->getFieldName(fields)),
checkNullString(positionPdx->getSecId()),
positionPdx->getSharesOutstanding());
} else {
- if ((str = dynamic_cast<CacheableString*>(field.ptr())) != NULLPTR) {
+ if (auto str = std::dynamic_pointer_cast<CacheableString>(field)) {
if (str->isWideString()) {
printf(" pulled %s :- %S\n",
checkNullString(ssptr->getFieldName(fields)),
@@ -95,24 +88,19 @@ void _printFields(CacheablePtr field, Struct* ssptr, int32_t& fields) {
checkNullString(ssptr->getFieldName(fields)),
checkNullString(str->asChar()));
}
- } else if ((boolptr = dynamic_cast<CacheableBoolean*>(field.ptr())) !=
- NULLPTR) {
+ } else if (auto boolptr =
+ std::dynamic_pointer_cast<CacheableBoolean>(field)) {
printf(" pulled %s :- %s\n",
checkNullString(ssptr->getFieldName(fields)),
boolptr->toString()->asChar());
} else {
- CacheableKeyPtr ptr = NULLPTR;
- CacheableStringArrayPtr strArr = NULLPTR;
- CacheableHashMapPtr map = NULLPTR;
- StructPtr structimpl = NULLPTR;
-
- if ((ptr = dynamic_cast<CacheableKey*>(field.ptr())) != NULLPTR) {
+ if (auto ptr = std::dynamic_pointer_cast<CacheableKey>(field)) {
char buff[1024] = {'\0'};
ptr->logString(&buff[0], 1024);
printf(" pulled %s :- %s \n",
checkNullString(ssptr->getFieldName(fields)), buff);
- } else if ((strArr = dynamic_cast<CacheableStringArray*>(field.ptr())) !=
- NULLPTR) {
+ } else if (auto strArr =
+ std::dynamic_pointer_cast<CacheableStringArray>(field)) {
printf(" string array object printing \n\n");
for (int stri = 0; stri < strArr->length(); stri++) {
if (strArr->operator[](stri)->isWideString()) {
@@ -125,28 +113,27 @@ void _printFields(CacheablePtr field, Struct* ssptr, int32_t& fields) {
checkNullString(strArr->operator[](stri)->asChar()));
}
}
- } else if ((map = dynamic_cast<CacheableHashMap*>(field.ptr())) !=
- NULLPTR) {
+ } else if (auto map =
+ std::dynamic_pointer_cast<CacheableHashMap>(field)) {
int index = 0;
- for (CacheableHashMap::Iterator iter = map->begin(); iter != map->end();
- iter++) {
+ for (auto iter = map->begin(); iter != map->end(); iter++) {
printf(" hashMap %d of %d ... \n", ++index, map->size());
_printFields(iter.first(), ssptr, fields);
_printFields(iter.second(), ssptr, fields);
}
printf(" end of map \n");
- } else if ((structimpl = dynamic_cast<Struct*>(field.ptr())) != NULLPTR) {
+ } else if (auto structimpl = std::dynamic_pointer_cast<Struct>(field)) {
printf(" structImpl %s {\n",
checkNullString(ssptr->getFieldName(fields)));
for (int32_t inner_fields = 0; inner_fields < structimpl->length();
inner_fields++) {
SerializablePtr field = (*structimpl)[inner_fields];
- if (field == NULLPTR) {
+ if (field == nullptr) {
printf("we got null fields here, probably we have NULL data\n");
continue;
}
- _printFields(field, structimpl.ptr(), inner_fields);
+ _printFields(field, structimpl.get(), inner_fields);
} // end of field iterations
printf(" } //end of %s\n",
@@ -168,7 +155,7 @@ void _verifyStructSet(StructSetPtr& ssptr, int i) {
continue;
}
- Struct* siptr = dynamic_cast<Struct*>(((*ssptr)[rows]).ptr());
+ Struct* siptr = dynamic_cast<Struct*>(((*ssptr)[rows]).get());
if (siptr == NULL) {
printf("siptr is NULL \n\n");
continue;
@@ -177,7 +164,7 @@ void _verifyStructSet(StructSetPtr& ssptr, int i) {
printf(" Row : %d \n", rows);
for (int32_t fields = 0; fields < siptr->length(); fields++) {
SerializablePtr field = (*siptr)[fields];
- if (field == NULLPTR) {
+ if (field == nullptr) {
printf("we got null fields here, probably we have NULL data\n");
continue;
}
@@ -202,19 +189,21 @@ void compareMaps(HashMapOfCacheable& map, HashMapOfCacheable& expectedMap) {
}
const CacheablePtr& expectedVal = expectedIter.second();
- if (instanceOf<PositionPdxPtr>(expectedVal)) {
- const PositionPdxPtr& posVal = dynCast<PositionPdxPtr>(val);
+ if (std::dynamic_pointer_cast<PositionPdx>(expectedVal)) {
+ const PositionPdxPtr& posVal =
+ std::dynamic_pointer_cast<PositionPdx>(val);
const PositionPdxPtr& expectedPosVal =
- staticCast<PositionPdxPtr>(expectedVal);
+ std::static_pointer_cast<PositionPdx>(expectedVal);
ASSERT(*expectedPosVal->getSecId() == *posVal->getSecId(),
"Expected the secIDs to be equal in PositionPdx");
ASSERT(expectedPosVal->getSharesOutstanding() ==
posVal->getSharesOutstanding(),
"Expected the sharesOutstanding to be equal in PositionPdx");
} else {
- const PortfolioPdxPtr& portVal = dynCast<PortfolioPdxPtr>(val);
+ const PortfolioPdxPtr& portVal =
+ std::dynamic_pointer_cast<PortfolioPdx>(val);
const PortfolioPdxPtr& expectedPortVal =
- dynCast<PortfolioPdxPtr>(expectedVal);
+ std::dynamic_pointer_cast<PortfolioPdx>(expectedVal);
ASSERT(expectedPortVal->getID() == portVal->getID(),
"Expected the IDs to be equal in PortfolioPdx");
ASSERT(expectedPortVal->getNewValSize() == portVal->getNewValSize(),
@@ -289,14 +278,14 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
{
- RegionPtr regPtr0 = getHelper()->getRegion(qRegionNames[0]);
- RegionPtr regPtr1 = regPtr0->getSubregion("Positions");
- RegionPtr regPtr2 = getHelper()->getRegion(qRegionNames[1]);
+ auto regPtr0 = getHelper()->getRegion(qRegionNames[0]);
+ auto regPtr1 = regPtr0->getSubregion("Positions");
+ auto regPtr2 = getHelper()->getRegion(qRegionNames[1]);
- RegionPtr regPtr3 = getHelper()->getRegion(qRegionNames[2]);
- RegionPtr regPtr4 = getHelper()->getRegion(qRegionNames[3]);
+ auto regPtr3 = getHelper()->getRegion(qRegionNames[2]);
+ auto regPtr4 = getHelper()->getRegion(qRegionNames[3]);
- QueryHelper* qh = &QueryHelper::getHelper();
+ auto* qh = &QueryHelper::getHelper();
qh->populatePortfolioPdxData(regPtr0, qh->getPortfolioSetSize(),
qh->getPortfolioNumSets());
@@ -323,20 +312,19 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
{
SLEEP(100);
bool doAnyErrorOccured = false;
- QueryHelper* qh = &QueryHelper::getHelper();
+ auto* qh = &QueryHelper::getHelper();
- QueryServicePtr qs = NULLPTR;
+ QueryServicePtr qs = nullptr;
if (isPoolConfig) {
- PoolPtr pool1 = findPool(poolNames[0]);
+ auto pool1 = findPool(poolNames[0]);
qs = pool1->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
}
for (int i = 0; i < QueryStrings::SSOPLsize(); i++) {
- QueryPtr qry =
- qs->newQuery(const_cast<char*>(structsetQueriesOPL[i].query()));
- SelectResultsPtr results = qry->execute();
+ auto qry = qs->newQuery(structsetQueriesOPL[i].query());
+ auto results = qry->execute();
if (!qh->verifySS(results, structsetRowCountsOPL[i],
structsetFieldCountsOPL[i])) {
char failmsg[100] = {0};
@@ -345,9 +333,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
continue;
}
- StructSetPtr ssptr =
- StructSetPtr(dynamic_cast<StructSet*>(results.ptr()));
- if ((ssptr) == NULLPTR) {
+ auto ssptr = std::dynamic_pointer_cast<StructSet>(results);
+ if ((ssptr) == nullptr) {
LOG("Zero records were expected and found. Moving onto next. ");
continue;
}
@@ -365,11 +352,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFive)
{
SLEEP(100);
bool doAnyErrorOccured = false;
- QueryHelper* qh = &QueryHelper::getHelper();
+ auto qh = &QueryHelper::getHelper();
- QueryServicePtr qs = NULLPTR;
+ QueryServicePtr qs = nullptr;
if (isPoolConfig) {
- PoolPtr pool1 = findPool(poolNames[0]);
+ auto pool1 = findPool(poolNames[0]);
qs = pool1->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
@@ -382,9 +369,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFive)
}
if (structsetQueries[i].category != unsupported) {
- QueryPtr qry =
- qs->newQuery(const_cast<char*>(structsetQueries[i].query()));
- SelectResultsPtr results = qry->execute();
+ auto qry = qs->newQuery(structsetQueries[i].query());
+ auto results = qry->execute();
if (!qh->verifySS(results, (qh->isExpectedRowsConstantSS(i)
? structsetRowCounts[i]
: structsetRowCounts[i] *
@@ -396,9 +382,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFive)
continue;
}
- StructSetPtr ssptr =
- StructSetPtr(dynamic_cast<StructSet*>(results.ptr()));
- if ((ssptr) == NULLPTR) {
+ auto ssptr = std::dynamic_pointer_cast<StructSet>(results);
+ if ((ssptr) == nullptr) {
LOG("Zero records were expected and found. Moving onto next. ");
continue;
}
@@ -417,11 +402,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSix)
{
SLEEP(100);
bool doAnyErrorOccured = false;
- QueryHelper* qh = &QueryHelper::getHelper();
+ auto* qh = &QueryHelper::getHelper();
- QueryServicePtr qs = NULLPTR;
+ QueryServicePtr qs = nullptr;
if (isPoolConfig) {
- PoolPtr pool1 = findPool(poolNames[0]);
+ auto pool1 = findPool(poolNames[0]);
qs = pool1->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
@@ -434,9 +419,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSix)
}
if (structsetParamQueries[i].category != unsupported) {
- QueryPtr qry =
- qs->newQuery(const_cast<char*>(structsetParamQueries[i].query()));
- CacheableVectorPtr paramList = CacheableVector::create();
+ auto qry = qs->newQuery(structsetParamQueries[i].query());
+ auto paramList = CacheableVector::create();
for (int j = 0; j < numSSQueryParam[i]; j++) {
// LOGINFO("NIL::SSPQ::328: queryparamSetSS[%d][%d] = %s", i, j,
@@ -449,7 +433,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSix)
}
}
- SelectResultsPtr results = qry->execute(paramList);
+ auto results = qry->execute(paramList);
if (!qh->verifySS(results, (qh->isExpectedRowsConstantSSPQ(i)
? structsetRowCountsPQ[i]
: structsetRowCountsPQ[i] *
@@ -461,9 +445,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSix)
continue;
}
- StructSetPtr ssptr =
- StructSetPtr(dynamic_cast<StructSet*>(results.ptr()));
- if ((ssptr) == NULLPTR) {
+ auto ssptr = std::dynamic_pointer_cast<StructSet>(results);
+ if ((ssptr) == nullptr) {
LOG("Zero records were expected and found. Moving onto next. ");
continue;
}
@@ -479,11 +462,11 @@ END_TASK_DEFINITION
// on the server
DUNIT_TASK_DEFINITION(CLIENT1, GetAll)
{
- RegionPtr regPtr0 = getHelper()->getRegion(qRegionNames[0]);
- RegionPtr regPtr1 = regPtr0->getSubregion("Positions");
- RegionPtr regPtr2 = getHelper()->getRegion(qRegionNames[1]);
- RegionPtr regPtr3 = getHelper()->getRegion(qRegionNames[2]);
- RegionPtr regPtr4 = getHelper()->getRegion(qRegionNames[3]);
+ auto regPtr0 = getHelper()->getRegion(qRegionNames[0]);
+ auto regPtr1 = regPtr0->getSubregion("Positions");
+ auto regPtr2 = getHelper()->getRegion(qRegionNames[1]);
+ auto regPtr3 = getHelper()->getRegion(qRegionNames[2]);
+ auto regPtr4 = getHelper()->getRegion(qRegionNames[3]);
// reset the counter for uniform population of position objects
PositionPdx::resetCounter();
@@ -495,7 +478,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, GetAll)
HashMapOfCacheable expectedPosMap;
HashMapOfCacheable expectedPortMap;
- QueryHelper& qh = QueryHelper::getHelper();
+ auto& qh = QueryHelper::getHelper();
int setSize = qh.getPositionSetSize();
int numSets = qh.getPositionNumSets();
@@ -504,10 +487,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, GetAll)
char posname[100] = {0};
ACE_OS::sprintf(posname, "pos%d-%d", set, current);
- CacheableKeyPtr posKey(CacheableKey::create(posname));
- CacheablePtr pos = NULLPTR;
- pos = CacheablePtr(
- new PositionPdx(secIds[current % numSecIds], current * 100));
+ auto posKey(CacheableKey::create(posname));
+ auto pos = std::make_shared<PositionPdx>(secIds[current % numSecIds],
+ current * 100);
posKeys.push_back(posKey);
expectedPosMap.insert(posKey, pos);
@@ -524,17 +506,16 @@ DUNIT_TASK_DEFINITION(CLIENT1, GetAll)
char portname[100] = {0};
ACE_OS::sprintf(portname, "port%d-%d", set, current);
- CacheableKeyPtr portKey(CacheableKey::create(portname));
- CacheablePtr port = NULLPTR;
- port = CacheablePtr(new PortfolioPdx(current, 1));
+ auto portKey = CacheableKey::create(portname);
+ auto port = std::make_shared<PortfolioPdx>(current, 1);
portKeys.push_back(portKey);
expectedPortMap.insert(portKey, port);
}
}
- HashMapOfCacheablePtr resMap(new HashMapOfCacheable());
- HashMapOfExceptionPtr exMap(new HashMapOfException());
+ auto resMap = std::make_shared<HashMapOfCacheable>();
+ auto exMap = std::make_shared<HashMapOfException>();
// execute getAll for different regions and verify results
regPtr0->getAll(portKeys, resMap, exMap);
@@ -566,11 +547,11 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, DoQuerySSError)
{
- QueryHelper* qh ATTR_UNUSED = &QueryHelper::getHelper();
+ auto* qh ATTR_UNUSED = &QueryHelper::getHelper();
- QueryServicePtr qs = NULLPTR;
+ QueryServicePtr qs = nullptr;
if (isPoolConfig) {
- PoolPtr pool1 = findPool(poolNames[0]);
+ auto pool1 = findPool(poolNames[0]);
qs = pool1->getQueryService();
} else {
qs = getHelper()->cachePtr->getQueryService();
@@ -578,11 +559,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, DoQuerySSError)
for (int i = 0; i < QueryStrings::SSsize(); i++) {
if (structsetQueries[i].category == unsupported) {
- QueryPtr qry =
- qs->newQuery(const_cast<char*>(structsetQueries[i].query()));
+ auto qry = qs->newQuery(structsetQueries[i].query());
try {
- SelectResultsPtr results = qry->execute();
+ auto results = qry->execute();
char failmsg[100] = {0};
ACE_OS::sprintf(failmsg, "Query exception didnt occur for index %d",
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientRemoteQueryTimeout.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientRemoteQueryTimeout.cpp b/src/cppcache/integration-test/testThinClientRemoteQueryTimeout.cpp
index ccd016b..538cb27 100644
--- a/src/cppcache/integration-test/testThinClientRemoteQueryTimeout.cpp
+++ b/src/cppcache/integration-test/testThinClientRemoteQueryTimeout.cpp
@@ -134,7 +134,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
{
QueryHelper* qh ATTR_UNUSED = &QueryHelper::getHelper();
- QueryServicePtr qs = NULLPTR;
+ QueryServicePtr qs = nullptr;
if (isPoolConfig) {
PoolPtr pool1 = findPool(poolNames[0]);
qs = pool1->getQueryService();
@@ -178,7 +178,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
{
QueryHelper* qh ATTR_UNUSED = &QueryHelper::getHelper();
- QueryServicePtr qs = NULLPTR;
+ QueryServicePtr qs = nullptr;
if (isPoolConfig) {
PoolPtr pool1 = findPool(poolNames[0]);
qs = pool1->getQueryService();
@@ -218,7 +218,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFive)
{
QueryHelper* qh ATTR_UNUSED = &QueryHelper::getHelper();
- QueryServicePtr qs = NULLPTR;
+ QueryServicePtr qs = nullptr;
if (isPoolConfig) {
PoolPtr pool1 = findPool(poolNames[0]);
qs = pool1->getQueryService();
@@ -262,7 +262,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSix)
{
QueryHelper* qh ATTR_UNUSED = &QueryHelper::getHelper();
- QueryServicePtr qs = NULLPTR;
+ QueryServicePtr qs = nullptr;
if (isPoolConfig) {
PoolPtr pool1 = findPool(poolNames[0]);
qs = pool1->getQueryService();
@@ -302,7 +302,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSeven)
{
QueryHelper* qh ATTR_UNUSED = &QueryHelper::getHelper();
- QueryServicePtr qs = NULLPTR;
+ QueryServicePtr qs = nullptr;
if (isPoolConfig) {
PoolPtr pool1 = findPool(poolNames[0]);
qs = pool1->getQueryService();
@@ -355,7 +355,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepEight)
{
QueryHelper* qh ATTR_UNUSED = &QueryHelper::getHelper();
- QueryServicePtr qs = NULLPTR;
+ QueryServicePtr qs = nullptr;
if (isPoolConfig) {
PoolPtr pool1 = findPool(poolNames[0]);
qs = pool1->getQueryService();
@@ -405,7 +405,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, verifyNegativeValueTimeout)
{
QueryHelper* qh ATTR_UNUSED = &QueryHelper::getHelper();
- QueryServicePtr qs = NULLPTR;
+ QueryServicePtr qs = nullptr;
if (isPoolConfig) {
PoolPtr pool1 = findPool(poolNames[0]);
qs = pool1->getQueryService();
@@ -451,7 +451,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, verifyLargeValueTimeout)
{
QueryHelper* qh ATTR_UNUSED = &QueryHelper::getHelper();
- QueryServicePtr qs = NULLPTR;
+ QueryServicePtr qs = nullptr;
if (isPoolConfig) {
PoolPtr pool1 = findPool(poolNames[0]);
qs = pool1->getQueryService();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientRemoteRegionQuery.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientRemoteRegionQuery.cpp b/src/cppcache/integration-test/testThinClientRemoteRegionQuery.cpp
index 422685e..e8a7ab0 100644
--- a/src/cppcache/integration-test/testThinClientRemoteRegionQuery.cpp
+++ b/src/cppcache/integration-test/testThinClientRemoteRegionQuery.cpp
@@ -328,7 +328,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFive)
region->selectValue(const_cast<char*>(regionQueries[i].query()));
/*
- if (result == NULLPTR)
+ if (result == nullptr)
{
char logmsg[100] = {0};
ACE_OS::sprintf(logmsg, "Query # %d query selectValue result is
@@ -370,7 +370,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFive)
}
try {
- SelectResultsPtr results = region->selectValue("");
+ auto results =
+ std::dynamic_pointer_cast<SelectResults>(region->selectValue(""));
FAIL("Expected IllegalArgumentException exception for empty predicate");
} catch (apache::geode::client::IllegalArgumentException ex) {
LOG("got expected IllegalArgumentException exception for empty "
@@ -379,8 +380,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFive)
}
try {
- SelectResultsPtr results = region->selectValue(
- const_cast<char*>(regionQueries[0].query()), 2200000);
+ auto results =
+ std::dynamic_pointer_cast<SelectResults>(region->selectValue(
+ const_cast<char*>(regionQueries[0].query()), 2200000));
FAIL("Expected IllegalArgumentException exception for invalid timeout");
} catch (apache::geode::client::IllegalArgumentException ex) {
LOG("got expected IllegalArgumentException exception for invalid "
@@ -389,8 +391,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFive)
}
try {
- SelectResultsPtr results =
- region->selectValue(const_cast<char*>(regionQueries[0].query()), -1);
+ auto results = std::dynamic_pointer_cast<SelectResults>(
+ region->selectValue(const_cast<char*>(regionQueries[0].query()), -1));
FAIL("Expected IllegalArgumentException exception for invalid timeout");
} catch (apache::geode::client::IllegalArgumentException ex) {
LOG("got expected IllegalArgumentException exception for invalid "
@@ -398,7 +400,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFive)
LOG(ex.getMessage());
}
try {
- SelectResultsPtr results = region->selectValue("bad predicate");
+ auto results = std::dynamic_pointer_cast<SelectResults>(
+ region->selectValue("bad predicate"));
FAIL("Expected IllegalArgumentException exception for wrong predicate");
} catch (QueryException ex) {
LOG("got expected QueryException for wrong predicate:");
[37/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from clicache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/LocalRegion.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/LocalRegion.cpp b/src/clicache/src/LocalRegion.cpp
index 9fd618f..e1d6d2d 100644
--- a/src/clicache/src/LocalRegion.cpp
+++ b/src/clicache/src/LocalRegion.cpp
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-//#include "geode_includes.hpp"
#include "LocalRegion.hpp"
#include "Cache.hpp"
#include "CacheStatistics.hpp"
@@ -23,8 +22,6 @@
#include "RegionEntry.hpp"
#include "impl/AuthenticatedCache.hpp"
#include "impl/SafeConvert.hpp"
-//#include <geode/Serializable.hpp>
-//#include <cppcache/DataOutPut.hpp>
using namespace System;
@@ -38,8 +35,8 @@ namespace Apache
generic<class TKey, class TValue>
TValue LocalRegion<TKey, TValue>::Get(TKey key, Object^ callbackArg)
{
- apache::geode::client::CacheableKeyPtr keyptr( Serializable::GetUnmanagedValueGeneric<TKey>( key ) );
- apache::geode::client::CacheablePtr nativeptr(this->getRegionEntryValue(keyptr));
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key );
+ auto nativeptr= this->getRegionEntryValue(keyptr);
if (nativeptr == nullptr)
{
throw gcnew KeyNotFoundException("The given key was not present in the region");
@@ -52,12 +49,18 @@ namespace Apache
apache::geode::client::SerializablePtr LocalRegion<TKey, TValue>::getRegionEntryValue(apache::geode::client::CacheableKeyPtr& keyptr)
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::RegionEntryPtr entryPtr = NativePtr->getEntry( keyptr );
- if (entryPtr != nullptr) {
- return entryPtr->getValue() ;
+ try
+ {
+ if (auto entryPtr = m_nativeptr->get()->getEntry(keyptr)) {
+ return entryPtr->getValue();
+ }
+ else {
+ return nullptr;
+ }
}
- else {
- return nullptr;
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
}
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -67,11 +70,17 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::CacheableKeyPtr keyptr( Serializable::GetUnmanagedValueGeneric<TKey>( key ) );
- apache::geode::client::CacheablePtr valueptr( Serializable::GetUnmanagedValueGeneric<TValue>( value ) );
- apache::geode::client::UserDataPtr callbackptr(
- Serializable::GetUnmanagedValueGeneric<Object^>( callbackArg ) );
- NativePtr->localPut( keyptr, valueptr, callbackptr );
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key );
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>( value );
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>( callbackArg );
+ m_nativeptr->get()->localPut( keyptr, valueptr, callbackptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -79,8 +88,8 @@ namespace Apache
generic<class TKey, class TValue>
TValue LocalRegion<TKey, TValue>::default::get(TKey key)
{
- apache::geode::client::CacheableKeyPtr keyptr( Serializable::GetUnmanagedValueGeneric<TKey>( key ) );
- apache::geode::client::CacheablePtr nativeptr(this->getRegionEntryValue(keyptr));
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key );
+ auto nativeptr = this->getRegionEntryValue(keyptr);
if (nativeptr == nullptr)
{
throw gcnew KeyNotFoundException("The given key was not present in the region");
@@ -94,9 +103,16 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::CacheableKeyPtr keyptr( Serializable::GetUnmanagedValueGeneric<TKey>( key ) );
- apache::geode::client::CacheablePtr valueptr( Serializable::GetUnmanagedValueGeneric<TValue>( value ) );
- NativePtr->localPut( keyptr, valueptr );
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key );
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>( value );
+ m_nativeptr->get()->localPut( keyptr, valueptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -105,20 +121,25 @@ namespace Apache
System::Collections::Generic::IEnumerator<KeyValuePair<TKey,TValue>>^
LocalRegion<TKey, TValue>::GetEnumerator()
{
- array<KeyValuePair<TKey,TValue>>^ toArray;
apache::geode::client::VectorOfRegionEntry vc;
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->entries( vc, false );
+ try
+ {
+ m_nativeptr->get()->entries( vc, false );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
- toArray = gcnew array<KeyValuePair<TKey,TValue>>(vc.size());
-
+ auto toArray = gcnew array<KeyValuePair<TKey,TValue>>(vc.size());
for( System::Int32 index = 0; index < vc.size( ); index++ )
{
- apache::geode::client::RegionEntryPtr nativeptr = vc[ index ];
+ auto nativeptr = vc[ index ];
TKey key = Serializable::GetManagedValueGeneric<TKey> (nativeptr->getKey());
TValue val = Serializable::GetManagedValueGeneric<TValue> (nativeptr->getValue());
toArray[ index ] = KeyValuePair<TKey,TValue>(key, val);
@@ -130,20 +151,25 @@ namespace Apache
System::Collections::IEnumerator^
LocalRegion<TKey, TValue>::GetEnumeratorOld()
{
- array<Object^>^ toArray;
apache::geode::client::VectorOfRegionEntry vc;
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->entries( vc, false );
+ try
+ {
+ m_nativeptr->get()->entries( vc, false );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
- toArray = gcnew array<Object^>(vc.size());
-
+ auto toArray = gcnew array<Object^>(vc.size());
for( System::Int32 index = 0; index < vc.size( ); index++ )
{
- apache::geode::client::RegionEntryPtr nativeptr = vc[ index ];
+ auto nativeptr = vc[ index ];
TKey key = Serializable::GetManagedValueGeneric<TKey> (nativeptr->getKey());
TValue val = Serializable::GetManagedValueGeneric<TValue> (nativeptr->getValue());
toArray[ index ] = KeyValuePair<TKey,TValue>(key, val);
@@ -189,8 +215,8 @@ namespace Apache
generic<class TKey, class TValue>
bool LocalRegion<TKey, TValue>::Contains(KeyValuePair<TKey,TValue> keyValuePair)
{
- apache::geode::client::CacheableKeyPtr keyptr( Serializable::GetUnmanagedValueGeneric<TKey>( keyValuePair.Key ) );
- apache::geode::client::CacheablePtr nativeptr(this->getRegionEntryValue(keyptr));
+ auto keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( keyValuePair.Key );
+ auto nativeptr = this->getRegionEntryValue(keyptr);
//This means that key is not present.
if (nativeptr == nullptr) {
return false;
@@ -204,9 +230,15 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::CacheableKeyPtr keyptr( Serializable::GetUnmanagedValueGeneric<TKey>( key ) );
-
- return NativePtr->containsKey( keyptr );
+ try
+ {
+ auto keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key );
+ return m_nativeptr->get()->containsKey(keyptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -214,8 +246,8 @@ namespace Apache
generic<class TKey, class TValue>
bool LocalRegion<TKey, TValue>::TryGetValue(TKey key, TValue %val)
{
- apache::geode::client::CacheableKeyPtr keyptr( Serializable::GetUnmanagedValueGeneric<TKey>( key ) );
- apache::geode::client::CacheablePtr nativeptr(this->getRegionEntryValue(keyptr));
+ auto keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key );
+ auto nativeptr = this->getRegionEntryValue(keyptr);
if (nativeptr == nullptr) {
val = TValue();
return false;
@@ -232,17 +264,22 @@ namespace Apache
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
apache::geode::client::VectorOfCacheableKey vc;
- NativePtr->keys( vc );
- //List<TKey>^ collectionlist = gcnew List<TKey>(vc.size());
- array<TKey>^ keyarr =
- gcnew array<TKey>( vc.size( ) );
+ try
+ {
+ m_nativeptr->get()->keys(vc);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ auto keyarr = gcnew array<TKey>( vc.size( ) );
for( System::Int32 index = 0; index < vc.size( ); index++ )
{
- apache::geode::client::CacheableKeyPtr& nativeptr( vc[ index ] );
+ auto& nativeptr = vc[ index ];
keyarr[ index ] = Serializable::GetManagedValueGeneric<TKey>(nativeptr);
- //collectionlist[ index ] = Serializable::GetManagedValue<TKey>(nativeptr);
}
- System::Collections::Generic::ICollection<TKey>^ collectionlist = (System::Collections::Generic::ICollection<TKey>^)keyarr;
+ auto collectionlist = (System::Collections::Generic::ICollection<TKey>^)keyarr;
return collectionlist;
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
@@ -254,17 +291,23 @@ namespace Apache
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
apache::geode::client::VectorOfCacheable vc;
- NativePtr->values( vc );
+ try
+ {
+ m_nativeptr->get()->values( vc );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
//List<TValue>^ collectionlist = gcnew List<TValue>(vc.size());
- array<TValue>^ valarr =
- gcnew array<TValue>( vc.size( ) );
+ auto valarr = gcnew array<TValue>( vc.size( ) );
for( System::Int32 index = 0; index < vc.size( ); index++ )
{
- apache::geode::client::CacheablePtr& nativeptr( vc[ index ] );
+ auto& nativeptr = vc[ index ];
valarr[ index ] = Serializable::GetManagedValueGeneric<TValue>(nativeptr);
- //collectionlist[ index ] = Serializable::GetManagedValueGeneric<TValue>(nativeptr);
}
- System::Collections::Generic::ICollection<TValue>^ collectionlist = (System::Collections::Generic::ICollection<TValue>^)valarr;
+ auto collectionlist = (System::Collections::Generic::ICollection<TValue>^)valarr;
return collectionlist;
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
@@ -275,9 +318,16 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::CacheableKeyPtr keyptr( Serializable::GetUnmanagedValueGeneric<TKey>( key ) );
- apache::geode::client::CacheablePtr valueptr( Serializable::GetUnmanagedValueGeneric<TValue>( value ) );
- NativePtr->localCreate( keyptr, valueptr );
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key );
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>( value );
+ m_nativeptr->get()->localCreate( keyptr, valueptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -287,9 +337,16 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::CacheableKeyPtr keyptr( Serializable::GetUnmanagedValueGeneric<TKey>( keyValuePair.Key ) );
- apache::geode::client::CacheablePtr valueptr( Serializable::GetUnmanagedValueGeneric<TValue>( keyValuePair.Value ) );
- NativePtr->localCreate( keyptr, valueptr );
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( keyValuePair.Key );
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>( keyValuePair.Value );
+ m_nativeptr->get()->localCreate( keyptr, valueptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -299,11 +356,17 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::CacheableKeyPtr keyptr( Serializable::GetUnmanagedValueGeneric<TKey>( key ) );
- apache::geode::client::CacheablePtr valueptr( Serializable::GetUnmanagedValueGeneric<TValue>( value ) );
- apache::geode::client::UserDataPtr callbackptr(
- Serializable::GetUnmanagedValueGeneric<Object^>( callbackArg ) );
- NativePtr->localCreate( keyptr, valueptr, callbackptr );
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key );
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>( value );
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>( callbackArg );
+ m_nativeptr->get()->localCreate( keyptr, valueptr, callbackptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -315,14 +378,18 @@ namespace Apache
try
{
- apache::geode::client::CacheableKeyPtr keyptr( Serializable::GetUnmanagedValueGeneric<TKey>( key ) );
- NativePtr->localDestroy( keyptr );
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key);
+ m_nativeptr->get()->localDestroy(keyptr);
return true;
}
- catch(apache::geode::client::EntryNotFoundException /*ex*/)
+ catch (apache::geode::client::EntryNotFoundException /*ex*/)
{
return false;
}
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
@@ -332,20 +399,22 @@ namespace Apache
bool LocalRegion<TKey, TValue>::Remove( TKey key, Object^ callbackArg )
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- try
- {
- apache::geode::client::CacheableKeyPtr keyptr( Serializable::GetUnmanagedValueGeneric<TKey>( key ) );
- apache::geode::client::UserDataPtr callbackptr(
- Serializable::GetUnmanagedValueGeneric<Object^>( callbackArg ) );
- NativePtr->localDestroy( keyptr, callbackptr );
- return true;
- }
- catch(apache::geode::client::EntryNotFoundException /*ex*/)
- {
- return false;
- }
-
- _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key);
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg);
+ m_nativeptr->get()->localDestroy(keyptr, callbackptr);
+ return true;
+ }
+ catch (apache::geode::client::EntryNotFoundException /*ex*/)
+ {
+ return false;
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
generic<class TKey, class TValue>
@@ -353,32 +422,18 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::CacheableKeyPtr keyptr( Serializable::GetUnmanagedValueGeneric<TKey>( keyValuePair.Key ) );
- apache::geode::client::CacheablePtr valueptr( Serializable::GetUnmanagedValueGeneric<TValue>( keyValuePair.Value ) );
- return NativePtr->localRemove(keyptr, valueptr);
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( keyValuePair.Key );
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>( keyValuePair.Value );
+ return m_nativeptr->get()->localRemove(keyptr, valueptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
-
- //_GF_MG_EXCEPTION_TRY2/* due to auto replace */
-
- //apache::geode::client::CacheableKeyPtr keyptr( Serializable::GetUnmanagedValueGeneric<TKey>( keyValuePair.Key ) );
- //if (NativePtr->containsKey( keyptr )) {
- // apache::geode::client::CacheablePtr nativeptr(this->getRegionEntryValue(keyptr));
- // TValue returnVal = Serializable::GetManagedValueGeneric<TValue>( nativeptr );
- // apache::geode::client::CacheablePtr valueptr( Serializable::GetUnmanagedValueGeneric<TValue>( keyValuePair.Value ) );
- // TValue actualVal = Serializable::GetManagedValueGeneric<TValue>( valueptr );
- // if (actualVal->Equals(returnVal)) {
- // NativePtr->localDestroy( keyptr );
- // return true;
- // }
- // else {
- // return false;
- // }
- //}
- //else {
- // return false;
- //}
- //_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
generic<class TKey, class TValue>
@@ -386,10 +441,17 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::CacheableKeyPtr keyptr( Serializable::GetUnmanagedValueGeneric<TKey>( key ) );
- apache::geode::client::CacheablePtr valueptr ( Serializable::GetUnmanagedValueGeneric<TValue>( value ));
- apache::geode::client::UserDataPtr callbackptr( Serializable::GetUnmanagedValueGeneric<Object^>( callbackArg ) );
- return NativePtr->localRemove(keyptr, valueptr, callbackptr);
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key);
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(value);
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg);
+ return m_nativeptr->get()->localRemove(keyptr, valueptr, callbackptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -409,9 +471,15 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::UserDataPtr callbackptr(
- Serializable::GetUnmanagedValueGeneric<Object^>( callbackArg ) );
- NativePtr->localInvalidateRegion( callbackptr );
+ try
+ {
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>( callbackArg );
+ m_nativeptr->get()->localInvalidateRegion( callbackptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -430,9 +498,15 @@ namespace Apache
void LocalRegion<TKey, TValue>::DestroyRegion(Object^ callbackArg)
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::UserDataPtr callbackptr(
- Serializable::GetUnmanagedValueGeneric<Object^>( callbackArg ) );
- NativePtr->localDestroyRegion( callbackptr );
+ try
+ {
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>( callbackArg );
+ m_nativeptr->get()->localDestroyRegion( callbackptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -452,10 +526,16 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::CacheableKeyPtr keyptr( Serializable::GetUnmanagedValueGeneric<TKey>( key ) );
- apache::geode::client::UserDataPtr callbackptr(
- Serializable::GetUnmanagedValueGeneric<Object^>( callbackArg ) );
- NativePtr->localInvalidate( keyptr, callbackptr );
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>( key );
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>( callbackArg );
+ m_nativeptr->get()->localInvalidate( keyptr, callbackptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -520,13 +600,27 @@ namespace Apache
generic<class TKey, class TValue>
String^ LocalRegion<TKey, TValue>::Name::get()
{
- return ManagedString::Get( NativePtr->getName( ) );
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getName( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TValue>
String^ LocalRegion<TKey, TValue>::FullPath::get()
{
- return ManagedString::Get( NativePtr->getFullPath( ) );
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getFullPath( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TValue>
@@ -534,14 +628,19 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::RegionPtr& nativeptr( NativePtr->getParentRegion( ) );
-
- IRegion<TKey, TValue>^ region = Region<TKey, TValue>::Create( nativeptr.ptr( ) );
- if (region == nullptr) {
- return nullptr;
- }
- return region->GetLocalView();
-
+ try
+ {
+ auto parentRegion = m_nativeptr->get()->getParentRegion( );
+ auto region = Region<TKey, TValue>::Create( parentRegion );
+ if (region == nullptr) {
+ return nullptr;
+ }
+ return region->GetLocalView();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -550,9 +649,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::RegionAttributesPtr& nativeptr( NativePtr->getAttributes( ) );
-
- return Apache::Geode::Client::RegionAttributes<TKey, TValue>::Create(nativeptr.get());
+ try
+ {
+ return Apache::Geode::Client::RegionAttributes<TKey, TValue>::Create(m_nativeptr->get()->getAttributes());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -562,10 +666,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::AttributesMutatorPtr& nativeptr(
- NativePtr->getAttributesMutator( ) );
-
- return Apache::Geode::Client::AttributesMutator<TKey, TValue>::Create( nativeptr.ptr( ) );
+ try
+ {
+ return Apache::Geode::Client::AttributesMutator<TKey, TValue>::Create(m_nativeptr->get()->getAttributesMutator());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -575,8 +683,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::CacheStatisticsPtr& nativeptr( NativePtr->getStatistics( ) );
- return Apache::Geode::Client::CacheStatistics::Create( nativeptr.ptr( ) );
+ try
+ {
+ return Apache::Geode::Client::CacheStatistics::Create(m_nativeptr->get()->getStatistics());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -586,14 +700,20 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- ManagedString mg_path( path );
- apache::geode::client::RegionPtr& nativeptr(
- NativePtr->getSubregion( mg_path.CharPtr ) );
- IRegion<TKey, TValue>^ region = Region<TKey, TValue>::Create( nativeptr.ptr( ) );
- if (region == nullptr) {
- return nullptr;
+ try
+ {
+ ManagedString mg_path(path);
+ auto nativeptr = m_nativeptr->get()->getSubregion(mg_path.CharPtr);
+ auto region = Region<TKey, TValue>::Create(nativeptr);
+ if (region == nullptr) {
+ return nullptr;
+ }
+ return region->GetLocalView();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
}
- return region->GetLocalView();
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -604,14 +724,16 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- ManagedString mg_subregionName( subRegionName );
- //TODO::split
- /* apache::geode::client::RegionAttributesPtr p_attrs(
- GetNativePtrFromSBWrap<apache::geode::client::RegionAttributes>( attributes ) );*/
-
- apache::geode::client::RegionPtr& nativeptr( NativePtr->createSubregion(
- mg_subregionName.CharPtr, /*p_attrs*/nullptr ) );
- return Region<TKey, TValue>::Create( nativeptr.ptr( ) )->GetLocalView();
+ try
+ {
+ ManagedString mg_subregionName(subRegionName);
+ return Region<TKey, TValue>::Create(m_nativeptr->get()->createSubregion(
+ mg_subregionName.CharPtr, __nullptr))->GetLocalView();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
@@ -623,17 +745,23 @@ namespace Apache
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
apache::geode::client::VectorOfRegion vsr;
- NativePtr->subregions( recursive, vsr );
+ try
+ {
+ m_nativeptr->get()->subregions( recursive, vsr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
array<IRegion<TKey, TValue>^>^ subRegions =
gcnew array<IRegion<TKey, TValue>^>( vsr.size( ) );
for( System::Int32 index = 0; index < vsr.size( ); index++ )
{
- apache::geode::client::RegionPtr& nativeptr( vsr[ index ] );
- subRegions[ index ] = Region<TKey, TValue>::Create( nativeptr.ptr( ) )->GetLocalView();
+ auto nativeptr = vsr[ index ];
+ subRegions[ index ] = Region<TKey, TValue>::Create( nativeptr )->GetLocalView();
}
- System::Collections::Generic::ICollection<IRegion<TKey, TValue>^>^ collection =
- (System::Collections::Generic::ICollection<IRegion<TKey, TValue>^>^)subRegions;
+ auto collection = (System::Collections::Generic::ICollection<IRegion<TKey, TValue>^>^)subRegions;
return collection;
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
@@ -644,10 +772,17 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::CacheableKeyPtr keyptr( Serializable::GetUnmanagedValueGeneric<TKey>( key ) );
- apache::geode::client::RegionEntryPtr& nativeptr( NativePtr->getEntry( keyptr ) );
- return RegionEntry<TKey, TValue>::Create( nativeptr.ptr( ) );
-
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key);
+ auto nativeptr = m_nativeptr->get()->getEntry(keyptr);
+ return RegionEntry<TKey, TValue>::Create(nativeptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -657,18 +792,23 @@ namespace Apache
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
apache::geode::client::VectorOfRegionEntry vc;
- NativePtr->entries( vc, recursive );
- array<RegionEntry<TKey, TValue>^>^ entryarr = gcnew array<RegionEntry<TKey, TValue>^>( vc.size( ) );
+ try
+ {
+ m_nativeptr->get()->entries( vc, recursive );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ auto entryarr = gcnew array<RegionEntry<TKey, TValue>^>( vc.size( ) );
for( System::Int32 index = 0; index < vc.size( ); index++ )
{
- apache::geode::client::RegionEntryPtr& nativeptr( vc[ index ] );
- entryarr[ index ] = RegionEntry<TKey, TValue>::Create( nativeptr.ptr( ) );
+ auto nativeptr = vc[ index ] ;
+ entryarr[ index ] = RegionEntry<TKey, TValue>::Create( nativeptr );
}
- System::Collections::Generic::ICollection<RegionEntry<TKey, TValue>^>^ collection =
- (System::Collections::Generic::ICollection<RegionEntry<TKey, TValue>^>^)entryarr;
-
- return collection;
+ auto collection = (System::Collections::Generic::ICollection<RegionEntry<TKey, TValue>^>^)entryarr;
+ return collection;
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
@@ -679,17 +819,21 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::RegionServicePtr& nativeptr( NativePtr->getRegionService( ) );
-
- apache::geode::client::Cache* realCache = dynamic_cast<apache::geode::client::Cache*>(nativeptr.get());
-
- if(realCache != NULL)
+ try
{
- return Apache::Geode::Client::Cache::Create( ((apache::geode::client::CachePtr)nativeptr).ptr( ) );
+ auto regionService = m_nativeptr->get()->getRegionService();
+ if (auto realCache = std::dynamic_pointer_cast<apache::geode::client::Cache>(regionService))
+ {
+ return Apache::Geode::Client::Cache::Create(realCache);
+ }
+ else
+ {
+ return Apache::Geode::Client::AuthenticatedCache::Create(regionService);
+ }
}
- else
+ finally
{
- return Apache::Geode::Client::AuthenticatedCache::Create( nativeptr.ptr( ) );
+ GC::KeepAlive(m_nativeptr);
}
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
@@ -700,8 +844,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::CacheableKeyPtr keyptr( Serializable::GetUnmanagedValueGeneric<TKey>( key ) );
- return NativePtr->containsValueForKey( keyptr );
+ try
+ {
+ return m_nativeptr->get()->containsValueForKey(Serializable::GetUnmanagedValueGeneric<TKey>(key));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -709,7 +859,14 @@ namespace Apache
generic<class TKey, class TValue>
int LocalRegion<TKey, TValue>::Count::get()
{
- return NativePtr->size();
+ try
+ {
+ return m_nativeptr->get()->size();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TValue>
@@ -721,10 +878,15 @@ namespace Apache
generic<class TKey, class TValue>
void LocalRegion<TKey, TValue>::Clear(Object^ callbackArg)
{
- _GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::UserDataPtr callbackptr(
- Serializable::GetUnmanagedValueGeneric<Object^>( callbackArg ) );
- NativePtr->localClear(callbackptr );
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ try
+ {
+ m_nativeptr->get()->localClear(Serializable::GetUnmanagedValueGeneric<Object^>( callbackArg ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -745,7 +907,14 @@ namespace Apache
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
apache::geode::client::VectorOfRegionEntry vc;
- NativePtr->entries( vc, false );
+ try
+ {
+ m_nativeptr->get()->entries( vc, false );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
if (toArray->Rank > 1 || (vc.size() > (toArray->Length - startIdx)))
{
@@ -767,7 +936,14 @@ namespace Apache
generic<class TKey, class TValue>
bool LocalRegion<TKey, TValue>::IsDestroyed::get()
{
- return NativePtr->isDestroyed();
+ try
+ {
+ return m_nativeptr->get()->isDestroyed();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TValue>
@@ -817,8 +993,8 @@ namespace Apache
generic<class TKey, class TValue>
IRegion<TKey, TValue>^ LocalRegion<TKey, TValue>::GetLocalView()
{
- throw gcnew System::NotSupportedException;
+ throw gcnew System::NotSupportedException;
+ }
} // namespace Client
} // namespace Geode
} // namespace Apache
- } //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/LocalRegion.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/LocalRegion.hpp b/src/clicache/src/LocalRegion.hpp
index 2954a99..aa9679d 100644
--- a/src/clicache/src/LocalRegion.hpp
+++ b/src/clicache/src/LocalRegion.hpp
@@ -18,8 +18,11 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/Cache.hpp>
-//#include "impl/NativeWrapper.hpp"
+#include "end_native.hpp"
+
+#include "native_shared_ptr.hpp"
#include "IRegion.hpp"
#include "Log.hpp"
#include "ExceptionTypes.hpp"
@@ -35,6 +38,8 @@ namespace Apache
namespace Client
{
+ namespace native = apache::geode::client;
+
generic<class TKey, class TValue>
ref class RegionEntry;
@@ -42,7 +47,7 @@ namespace Apache
ref class AttributesMutator;
generic<class TKey, class TValue>
- public ref class LocalRegion : public Client::Internal::SBWrap<apache::geode::client::Region>, public IRegion<TKey, TValue>
+ public ref class LocalRegion : public IRegion<TKey, TValue>
{
public:
@@ -226,22 +231,31 @@ namespace Apache
/// The managed wrapper object; null if the native pointer is null.
/// </returns>
//generic<class TKey, class TValue>
- inline static IRegion<TKey, TValue>^ Create( apache::geode::client::Region* nativeptr )
+ inline static IRegion<TKey, TValue>^ Create( native::RegionPtr nativeptr )
{
- return ( nativeptr != nullptr ?
- gcnew LocalRegion<TKey, TValue>( nativeptr ) : nullptr );
+ return __nullptr == nativeptr ? nullptr :
+ gcnew LocalRegion<TKey, TValue>( nativeptr );
+ }
+
+ std::shared_ptr<native::Region> GetNative()
+ {
+ return m_nativeptr->get_shared_ptr();
}
/// <summary>
/// Private constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline LocalRegion( apache::geode::client::Region* nativeptr )
- : SBWrap( nativeptr ) { }
+ inline LocalRegion( native::RegionPtr nativeptr )
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::Region>(nativeptr);
+ }
private:
inline apache::geode::client::SerializablePtr getRegionEntryValue(apache::geode::client::CacheableKeyPtr& key);
bool AreValuesEqual(apache::geode::client::CacheablePtr& val1, apache::geode::client::CacheablePtr& val2);
+
+ native_shared_ptr<native::Region>^ m_nativeptr;
};
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/Log.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/Log.hpp b/src/clicache/src/Log.hpp
index 9c13d0c..ed5dd28 100644
--- a/src/clicache/src/Log.hpp
+++ b/src/clicache/src/Log.hpp
@@ -18,7 +18,10 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/Log.hpp>
+#include "end_native.hpp"
+
using namespace System;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/Pool.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/Pool.cpp b/src/clicache/src/Pool.cpp
index 3a3e68f..32921fb 100644
--- a/src/clicache/src/Pool.cpp
+++ b/src/clicache/src/Pool.cpp
@@ -35,195 +35,409 @@ namespace Apache
namespace Client
{
- //generic<class TKey, class TValue>
- String^ Pool/*<TKey, TValue>*/::Name::get( )
+
+ String^ Pool::Name::get( )
{
- return ManagedString::Get( NativePtr->getName( ) );
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getName( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
}
- //generic<class TKey, class TValue>
- Int32 Pool/*<TKey, TValue>*/::FreeConnectionTimeout::get()
+
+ Int32 Pool::FreeConnectionTimeout::get()
{
- return NativePtr->getFreeConnectionTimeout();
+ try
+ {
+ return m_nativeptr->get()->getFreeConnectionTimeout();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
}
- //generic<class TKey, class TValue>
- Int32 Pool/*<TKey, TValue>*/::LoadConditioningInterval::get()
+
+ Int32 Pool::LoadConditioningInterval::get()
{
- return NativePtr->getLoadConditioningInterval();
+ try
+ {
+ return m_nativeptr->get()->getLoadConditioningInterval();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
}
- //generic<class TKey, class TValue>
- Int32 Pool/*<TKey, TValue>*/::SocketBufferSize::get()
+
+ Int32 Pool::SocketBufferSize::get()
{
- return NativePtr->getSocketBufferSize();
+ try
+ {
+ return m_nativeptr->get()->getSocketBufferSize();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
}
- //generic<class TKey, class TValue>
- Int32 Pool/*<TKey, TValue>*/::ReadTimeout::get()
+
+ Int32 Pool::ReadTimeout::get()
{
- return NativePtr->getReadTimeout();
+ try
+ {
+ return m_nativeptr->get()->getReadTimeout();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
}
- //generic<class TKey, class TValue>
- Int32 Pool/*<TKey, TValue>*/::MinConnections::get()
+
+ Int32 Pool::MinConnections::get()
{
- return NativePtr->getMinConnections();
+ try
+ {
+ return m_nativeptr->get()->getMinConnections();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
}
- //generic<class TKey, class TValue>
- Int32 Pool/*<TKey, TValue>*/::MaxConnections::get()
+
+ Int32 Pool::MaxConnections::get()
{
- return NativePtr->getMaxConnections();
+ try
+ {
+ return m_nativeptr->get()->getMaxConnections();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
}
- //generic<class TKey, class TValue>
- Int32 Pool/*<TKey, TValue>*/::IdleTimeout::get()
+
+ Int32 Pool::IdleTimeout::get()
{
- return NativePtr->getIdleTimeout();
+ try
+ {
+ return m_nativeptr->get()->getIdleTimeout();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
}
- //generic<class TKey, class TValue>
- Int32 Pool/*<TKey, TValue>*/::PingInterval::get()
+
+ Int32 Pool::PingInterval::get()
{
- return NativePtr->getPingInterval();
+ try
+ {
+ return m_nativeptr->get()->getPingInterval();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
}
- //generic<class TKey, class TValue>
- Int32 Pool/*<TKey, TValue>*/::UpdateLocatorListInterval::get()
+
+ Int32 Pool::UpdateLocatorListInterval::get()
{
- return NativePtr->getUpdateLocatorListInterval();
+ try
+ {
+ return m_nativeptr->get()->getUpdateLocatorListInterval();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
}
- //generic<class TKey, class TValue>
- Int32 Pool/*<TKey, TValue>*/::StatisticInterval::get()
+
+ Int32 Pool::StatisticInterval::get()
{
- return NativePtr->getStatisticInterval();
+ try
+ {
+ return m_nativeptr->get()->getStatisticInterval();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
}
- //generic<class TKey, class TValue>
- Int32 Pool/*<TKey, TValue>*/::RetryAttempts::get()
+
+ Int32 Pool::RetryAttempts::get()
{
- return NativePtr->getRetryAttempts();
+ try
+ {
+ return m_nativeptr->get()->getRetryAttempts();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
}
- //generic<class TKey, class TValue>
- Boolean Pool/*<TKey, TValue>*/::SubscriptionEnabled::get()
+
+ Boolean Pool::SubscriptionEnabled::get()
{
- return NativePtr->getSubscriptionEnabled();
+ try
+ {
+ return m_nativeptr->get()->getSubscriptionEnabled();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
}
- //generic<class TKey, class TValue>
- Boolean Pool/*<TKey, TValue>*/::PRSingleHopEnabled::get()
+
+ Boolean Pool::PRSingleHopEnabled::get()
{
- return NativePtr->getPRSingleHopEnabled();
+ try
+ {
+ return m_nativeptr->get()->getPRSingleHopEnabled();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
}
- //generic<class TKey, class TValue>
- Int32 Pool/*<TKey, TValue>*/::SubscriptionRedundancy::get()
+
+ Int32 Pool::SubscriptionRedundancy::get()
{
- return NativePtr->getSubscriptionRedundancy();
+ try
+ {
+ return m_nativeptr->get()->getSubscriptionRedundancy();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
}
- //generic<class TKey, class TValue>
- Int32 Pool/*<TKey, TValue>*/::SubscriptionMessageTrackingTimeout::get()
+
+ Int32 Pool::SubscriptionMessageTrackingTimeout::get()
{
- return NativePtr->getSubscriptionMessageTrackingTimeout();
+ try
+ {
+ return m_nativeptr->get()->getSubscriptionMessageTrackingTimeout();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
}
- //generic<class TKey, class TValue>
- Int32 Pool/*<TKey, TValue>*/::SubscriptionAckInterval::get()
+
+ Int32 Pool::SubscriptionAckInterval::get()
{
- return NativePtr->getSubscriptionAckInterval();
+ try
+ {
+ return m_nativeptr->get()->getSubscriptionAckInterval();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
}
- //generic<class TKey, class TValue>
- String^ Pool/*<TKey, TValue>*/::ServerGroup::get( )
+
+ String^ Pool::ServerGroup::get( )
{
- return ManagedString::Get( NativePtr->getServerGroup( ) );
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getServerGroup( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
}
- //generic<class TKey, class TValue>
- array<String^>^ Pool/*<TKey, TValue>*/::Locators::get()
+
+ array<String^>^ Pool::Locators::get()
{
- apache::geode::client::CacheableStringArrayPtr locators = NativePtr->getLocators();
- int length = locators->length();
- if (length > 0)
+ try
{
- array<String^>^ result = gcnew array<String^>(length);
- for (int item = 0; item < length; item++)
+ auto locators = m_nativeptr->get()->getLocators();
+ int length = locators->length();
+ if (length > 0)
+ {
+ array<String^>^ result = gcnew array<String^>(length);
+ for (int item = 0; item < length; item++)
+ {
+ result[item] = CacheableString::GetString((*locators)[item].get());
+ }
+ return result;
+ }
+ else
{
- result[item] = CacheableString::GetString(locators[item].get());
+ return nullptr;
}
- return result;
}
- else
+ finally
{
- return nullptr;
+ GC::KeepAlive(m_nativeptr);
}
}
- //generic<class TKey, class TValue>
- array<String^>^ Pool/*<TKey, TValue>*/::Servers::get()
+
+ array<String^>^ Pool::Servers::get()
{
- apache::geode::client::CacheableStringArrayPtr servers = NativePtr->getServers();
- int length = servers->length();
- if (length > 0)
+ try
{
- array<String^>^ result = gcnew array<String^>(length);
- for (int item = 0; item < length; item++)
+ auto servers = m_nativeptr->get()->getServers();
+ int length = servers->length();
+ if (length > 0)
{
- result[item] = CacheableString::GetString(servers[item].get());
+ array<String^>^ result = gcnew array<String^>(length);
+ for (int item = 0; item < length; item++)
+ {
+ result[item] = CacheableString::GetString((*servers)[item].get());
+ }
+ return result;
+ }
+ else
+ {
+ return nullptr;
}
- return result;
}
- else
+ finally
{
- return nullptr;
+ GC::KeepAlive(m_nativeptr);
}
}
//generic<class TKey, class TValue>
- Boolean Pool/*<TKey, TValue>*/::ThreadLocalConnections::get()
+ Boolean Pool::ThreadLocalConnections::get()
{
- return NativePtr->getThreadLocalConnections();
+ try
+ {
+ return m_nativeptr->get()->getThreadLocalConnections();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
}
- //generic<class TKey, class TValue>
- bool Pool/*<TKey, TValue>*/::MultiuserAuthentication::get()
+
+ bool Pool::MultiuserAuthentication::get()
{
- return NativePtr->getMultiuserAuthentication();
+ try
+ {
+ return m_nativeptr->get()->getMultiuserAuthentication();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
}
- //generic<class TKey, class TValue>
- void Pool/*<TKey, TValue>*/::Destroy(Boolean KeepAlive)
+
+ void Pool::Destroy(Boolean KeepAlive)
{
- NativePtr->destroy(KeepAlive);
+ try
+ {
+ m_nativeptr->get()->destroy(KeepAlive);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
}
void Pool::ReleaseThreadLocalConnection()
{
- NativePtr->releaseThreadLocalConnection();
+ try
+ {
+ m_nativeptr->get()->releaseThreadLocalConnection();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
}
- //generic<class TKey, class TValue>
- void Pool/*<TKey, TValue>*/::Destroy()
+
+ void Pool::Destroy()
{
- NativePtr->destroy();
+ try
+ {
+ m_nativeptr->get()->destroy();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
}
- //generic<class TKey, class TValue>
- Boolean Pool/*<TKey, TValue>*/::Destroyed::get()
+
+ Boolean Pool::Destroyed::get()
{
- return NativePtr->isDestroyed();
+ try
+ {
+ return m_nativeptr->get()->isDestroyed();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
}
generic<class TKey, class TResult>
- QueryService<TKey, TResult>^ Pool/*<TKey, TValue>*/::GetQueryService()
+ QueryService<TKey, TResult>^ Pool::GetQueryService()
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return QueryService<TKey, TResult>::Create( NativePtr->getQueryService( ).ptr( ) );
+ try
+ {
+ return QueryService<TKey, TResult>::Create(m_nativeptr->get()->getQueryService());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -232,11 +446,18 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- return NativePtr->getPendingEventCount();
+ try
+ {
+ return m_nativeptr->get()->getPendingEventCount();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
_GF_MG_EXCEPTION_CATCH_ALL2
+ }
} // namespace Client
} // namespace Geode
} // namespace Apache
-
- } //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/Pool.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/Pool.hpp b/src/clicache/src/Pool.hpp
index b1af11c..5be1cd3 100644
--- a/src/clicache/src/Pool.hpp
+++ b/src/clicache/src/Pool.hpp
@@ -18,8 +18,11 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/Pool.hpp>
-#include "impl/NativeWrapper.hpp"
+#include "end_native.hpp"
+
+#include "native_shared_ptr.hpp"
using namespace System;
@@ -30,9 +33,7 @@ namespace Apache
{
namespace Client
{
-
- //generic<class TKey, class TResult>
- //ref class Properties;
+ namespace native = apache::geode::client;
generic<class TKey, class TResult>
ref class QueryService;
@@ -47,7 +48,6 @@ namespace Apache
/// </remarks>
// generic<class TKey, class TValue>
public ref class Pool sealed
- : public Client::Internal::SBWrap<apache::geode::client::Pool>
{
public:
@@ -323,10 +323,15 @@ namespace Apache
/// <returns>
/// The managed wrapper object; null if the native pointer is null.
/// </returns>
- inline static Pool^ Create(apache::geode::client::Pool* nativeptr)
+ inline static Pool^ Create(native::PoolPtr nativeptr)
+ {
+ return __nullptr == nativeptr ? nullptr :
+ gcnew Pool( nativeptr );
+ }
+
+ std::shared_ptr<native::Pool> GetNative()
{
- return (nativeptr != nullptr ?
- gcnew Pool(nativeptr) : nullptr);
+ return m_nativeptr->get_shared_ptr();
}
private:
@@ -335,8 +340,12 @@ namespace Apache
/// Private constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline Pool(apache::geode::client::Pool* nativeptr)
- : SBWrap(nativeptr) { }
+ inline Pool(native::PoolPtr nativeptr)
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::Pool>(nativeptr);
+ }
+
+ native_shared_ptr<native::Pool>^ m_nativeptr;
};
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/PoolFactory.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/PoolFactory.cpp b/src/clicache/src/PoolFactory.cpp
index 427453a..e17bdee 100644
--- a/src/clicache/src/PoolFactory.cpp
+++ b/src/clicache/src/PoolFactory.cpp
@@ -17,7 +17,6 @@
#pragma once
-//#include "geode_includes.hpp"
#include "Pool.hpp"
#include "PoolFactory.hpp"
@@ -33,260 +32,419 @@ namespace Apache
namespace Client
{
- //generic<class TKey, class TValue>
- PoolFactory^ PoolFactory/*<TKey, TValue>*/::SetFreeConnectionTimeout( Int32 connectionTimeout )
+
+ PoolFactory^ PoolFactory::SetFreeConnectionTimeout( Int32 connectionTimeout )
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->setFreeConnectionTimeout( connectionTimeout );
+ try
+ {
+ m_nativeptr->get()->setFreeConnectionTimeout( connectionTimeout );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
return this;
}
- //generic<class TKey, class TValue>
- PoolFactory^ PoolFactory/*<TKey, TValue>*/::SetLoadConditioningInterval( Int32 loadConditioningInterval )
+
+ PoolFactory^ PoolFactory::SetLoadConditioningInterval( Int32 loadConditioningInterval )
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->setLoadConditioningInterval( loadConditioningInterval );
+ try
+ {
+ m_nativeptr->get()->setLoadConditioningInterval( loadConditioningInterval );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
return this;
}
- //generic<class TKey, class TValue>
- PoolFactory^ PoolFactory/*<TKey, TValue>*/::SetSocketBufferSize( Int32 bufferSize )
+
+ PoolFactory^ PoolFactory::SetSocketBufferSize( Int32 bufferSize )
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->setSocketBufferSize( bufferSize );
+ try
+ {
+ m_nativeptr->get()->setSocketBufferSize( bufferSize );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
return this;
}
- //generic<class TKey, class TValue>
- PoolFactory^ PoolFactory/*<TKey, TValue>*/::SetReadTimeout( Int32 timeout )
+
+ PoolFactory^ PoolFactory::SetReadTimeout( Int32 timeout )
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->setReadTimeout( timeout );
+ try
+ {
+ m_nativeptr->get()->setReadTimeout( timeout );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
return this;
}
- //generic<class TKey, class TValue>
- PoolFactory^ PoolFactory/*<TKey, TValue>*/::SetMinConnections( Int32 minConnections )
+
+ PoolFactory^ PoolFactory::SetMinConnections( Int32 minConnections )
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->setMinConnections( minConnections );
+ try
+ {
+ m_nativeptr->get()->setMinConnections( minConnections );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
return this;
}
- //generic<class TKey, class TValue>
- PoolFactory^ PoolFactory/*<TKey, TValue>*/::SetMaxConnections( Int32 maxConnections )
+
+ PoolFactory^ PoolFactory::SetMaxConnections( Int32 maxConnections )
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->setMaxConnections( maxConnections );
+ try
+ {
+ m_nativeptr->get()->setMaxConnections( maxConnections );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
return this;
}
- //generic<class TKey, class TValue>
- PoolFactory^ PoolFactory/*<TKey, TValue>*/::SetIdleTimeout( Int32 idleTimeout )
+
+ PoolFactory^ PoolFactory::SetIdleTimeout( Int32 idleTimeout )
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->setIdleTimeout( idleTimeout );
+ try
+ {
+ m_nativeptr->get()->setIdleTimeout( idleTimeout );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
return this;
}
- //generic<class TKey, class TValue>
- PoolFactory^ PoolFactory/*<TKey, TValue>*/::SetRetryAttempts( Int32 retryAttempts )
+
+ PoolFactory^ PoolFactory::SetRetryAttempts( Int32 retryAttempts )
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->setRetryAttempts( retryAttempts );
+ try
+ {
+ m_nativeptr->get()->setRetryAttempts( retryAttempts );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
return this;
}
- //generic<class TKey, class TValue>
- PoolFactory^ PoolFactory/*<TKey, TValue>*/::SetPingInterval( Int32 pingInterval )
+
+ PoolFactory^ PoolFactory::SetPingInterval( Int32 pingInterval )
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->setPingInterval( pingInterval );
+ try
+ {
+ m_nativeptr->get()->setPingInterval( pingInterval );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
return this;
}
- //generic<class TKey, class TValue>
- PoolFactory^ PoolFactory/*<TKey, TValue>*/::SetUpdateLocatorListInterval( Int32 updateLocatorListInterval )
+
+ PoolFactory^ PoolFactory::SetUpdateLocatorListInterval( Int32 updateLocatorListInterval )
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->setUpdateLocatorListInterval( updateLocatorListInterval );
+ try
+ {
+ m_nativeptr->get()->setUpdateLocatorListInterval( updateLocatorListInterval );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
return this;
}
- //generic<class TKey, class TValue>
- PoolFactory^ PoolFactory/*<TKey, TValue>*/::SetStatisticInterval( Int32 statisticInterval )
+
+ PoolFactory^ PoolFactory::SetStatisticInterval( Int32 statisticInterval )
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->setStatisticInterval( statisticInterval );
+ try
+ {
+ m_nativeptr->get()->setStatisticInterval( statisticInterval );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
return this;
}
- //generic<class TKey, class TValue>
- PoolFactory^ PoolFactory/*<TKey, TValue>*/::SetServerGroup( String^ group )
+
+ PoolFactory^ PoolFactory::SetServerGroup( String^ group )
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
ManagedString mg_servergroup( group );
- NativePtr->setServerGroup( mg_servergroup.CharPtr );
+ try
+ {
+ m_nativeptr->get()->setServerGroup( mg_servergroup.CharPtr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
return this;
}
- //generic<class TKey, class TValue>
- PoolFactory^ PoolFactory/*<TKey, TValue>*/::AddLocator( String^ host, Int32 port )
+
+ PoolFactory^ PoolFactory::AddLocator( String^ host, Int32 port )
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
ManagedString mg_host( host );
- NativePtr->addLocator( mg_host.CharPtr, port );
+ try
+ {
+ m_nativeptr->get()->addLocator( mg_host.CharPtr, port );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
return this;
}
- //generic<class TKey, class TValue>
- PoolFactory^ PoolFactory/*<TKey, TValue>*/::AddServer( String^ host, Int32 port )
+
+ PoolFactory^ PoolFactory::AddServer( String^ host, Int32 port )
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
ManagedString mg_host( host );
- NativePtr->addServer( mg_host.CharPtr, port );
+ try
+ {
+ m_nativeptr->get()->addServer( mg_host.CharPtr, port );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
return this;
}
- //generic<class TKey, class TValue>
- PoolFactory^ PoolFactory/*<TKey, TValue>*/::SetSubscriptionEnabled( Boolean enabled )
+
+ PoolFactory^ PoolFactory::SetSubscriptionEnabled( Boolean enabled )
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->setSubscriptionEnabled( enabled );
+ try
+ {
+ m_nativeptr->get()->setSubscriptionEnabled( enabled );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
return this;
}
- //generic<class TKey, class TValue>
- PoolFactory^ PoolFactory/*<TKey, TValue>*/::SetPRSingleHopEnabled( Boolean enabled )
+
+ PoolFactory^ PoolFactory::SetPRSingleHopEnabled( Boolean enabled )
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->setPRSingleHopEnabled(enabled);
+ try
+ {
+ m_nativeptr->get()->setPRSingleHopEnabled(enabled);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
return this;
}
- //generic<class TKey, class TValue>
- PoolFactory^ PoolFactory/*<TKey, TValue>*/::SetSubscriptionRedundancy( Int32 redundancy )
+
+ PoolFactory^ PoolFactory::SetSubscriptionRedundancy( Int32 redundancy )
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->setSubscriptionRedundancy( redundancy );
+ try
+ {
+ m_nativeptr->get()->setSubscriptionRedundancy( redundancy );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
return this;
}
- //generic<class TKey, class TValue>
- PoolFactory^ PoolFactory/*<TKey, TValue>*/::SetSubscriptionMessageTrackingTimeout( Int32 messageTrackingTimeout )
+
+ PoolFactory^ PoolFactory::SetSubscriptionMessageTrackingTimeout( Int32 messageTrackingTimeout )
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->setSubscriptionMessageTrackingTimeout( messageTrackingTimeout );
+ try
+ {
+ m_nativeptr->get()->setSubscriptionMessageTrackingTimeout( messageTrackingTimeout );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
return this;
}
- //generic<class TKey, class TValue>
- PoolFactory^ PoolFactory/*<TKey, TValue>*/::SetSubscriptionAckInterval( Int32 ackInterval )
+
+ PoolFactory^ PoolFactory::SetSubscriptionAckInterval( Int32 ackInterval )
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->setSubscriptionAckInterval( ackInterval );
+ try
+ {
+ m_nativeptr->get()->setSubscriptionAckInterval( ackInterval );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
return this;
}
- PoolFactory^ PoolFactory/*<TKey, TValue>*/::SetThreadLocalConnections( Boolean enabled )
+ PoolFactory^ PoolFactory::SetThreadLocalConnections( Boolean enabled )
{
_GF_MG_EXCEPTION_TRY2
- NativePtr->setThreadLocalConnections( enabled );
+ try
+ {
+ m_nativeptr->get()->setThreadLocalConnections( enabled );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2
return this;
}
- //generic<class TKey, class TValue>
- PoolFactory^ PoolFactory/*<TKey, TValue>*/::SetMultiuserAuthentication( bool multiuserAuthentication )
+
+ PoolFactory^ PoolFactory::SetMultiuserAuthentication( bool multiuserAuthentication )
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->setMultiuserAuthentication( multiuserAuthentication );
+ try
+ {
+ m_nativeptr->get()->setMultiuserAuthentication( multiuserAuthentication );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
return this;
}
- //generic<class TKey, class TValue>
- PoolFactory^ PoolFactory/*<TKey, TValue>*/::Reset()
+
+ PoolFactory^ PoolFactory::Reset()
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->reset( );
+ try
+ {
+ m_nativeptr->get()->reset( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
return this;
}
- //generic<class TKey, class TValue>
- Pool/*<TKey, TValue>*/^ PoolFactory/*<TKey, TValue>*/::Create( String^ name )
- {
- _GF_MG_EXCEPTION_TRY2/* due to auto replace */
- ManagedString mg_name( name );
- apache::geode::client::PoolPtr & pool = NativePtr->create(mg_name.CharPtr);
- return Pool/*<TKey, TValue>*/::Create(pool.get());
+ Pool^ PoolFactory::Create(String^ name)
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
- _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ ManagedString mg_name(name);
+ try
+ {
+ return Pool::Create(m_nativeptr->get()->create(mg_name.CharPtr));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
} // namespace Client
} // namespace Geode
} // namespace Apache
-
- } //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/PoolFactory.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/PoolFactory.hpp b/src/clicache/src/PoolFactory.hpp
index 4f81e57..49665bb 100644
--- a/src/clicache/src/PoolFactory.hpp
+++ b/src/clicache/src/PoolFactory.hpp
@@ -18,8 +18,11 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/PoolFactory.hpp>
-//#include "impl/NativeWrapper.hpp"
+#include "end_native.hpp"
+
+#include "native_shared_ptr.hpp"
using namespace System;
@@ -29,16 +32,16 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
+
- // generic<class TKey, class TValue>
ref class Pool;
/// <summary>
/// This interface provides for the configuration and creation of instances of Pool.
/// </summary>
- // generic<class TKey, class TValue>
+
public ref class PoolFactory sealed
- : public Internal::SBWrap<apache::geode::client::PoolFactory>
{
public:
@@ -387,7 +390,7 @@ namespace Apache
/// throws IllegalStateException if a pool with name already exists
/// throws IllegalStateException if a locator or server has not been added.
/// </exception>
- Pool/*<TKey, TValue>*/^ Create(String^ name);
+ Pool^ Create(String^ name);
internal:
@@ -399,10 +402,10 @@ namespace Apache
/// <returns>
/// The managed wrapper object; null if the native pointer is null.
/// </returns>
- inline static PoolFactory/*<TKey, TValue>*/^ Create(apache::geode::client::PoolFactory* nativeptr)
+ inline static PoolFactory^ Create(native::PoolFactoryPtr nativeptr)
{
- return (nativeptr != nullptr ?
- gcnew PoolFactory(nativeptr) : nullptr);
+ return __nullptr == nativeptr ? nullptr :
+ gcnew PoolFactory( nativeptr );
}
private:
@@ -411,8 +414,12 @@ namespace Apache
/// Private constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline PoolFactory(apache::geode::client::PoolFactory* nativeptr)
- : SBWrap(nativeptr) { }
+ inline PoolFactory(native::PoolFactoryPtr nativeptr)
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::PoolFactory>(nativeptr);
+ }
+
+ native_shared_ptr<native::PoolFactory>^ m_nativeptr;
};
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/PoolManager.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/PoolManager.cpp b/src/clicache/src/PoolManager.cpp
index d609860..d2aa28d 100644
--- a/src/clicache/src/PoolManager.cpp
+++ b/src/clicache/src/PoolManager.cpp
@@ -17,13 +17,11 @@
#pragma once
-//#include "geode_includes.hpp"
#include "Region.hpp"
#include "Pool.hpp"
#include "PoolManager.hpp"
#include "PoolFactory.hpp"
#include "CacheableString.hpp"
-#include "impl/SafeConvert.hpp"
using namespace System;
@@ -33,55 +31,47 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
- //generic<class TKey, class TValue>
- PoolFactory/*<TKey, TValue>*/^ PoolManager/*<TKey, TValue>*/::CreateFactory()
+ PoolFactory^ PoolManager::CreateFactory()
{
- return PoolFactory/*<TKey, TValue>*/::Create(apache::geode::client::PoolManager::createFactory().get());
+ return PoolFactory::Create(native::PoolManager::createFactory());
}
- //generic<class TKey, class TValue>
- const Dictionary<String^, Pool/*<TKey, TValue>*/^>^ PoolManager/*<TKey, TValue>*/::GetAll()
+ const Dictionary<String^, Pool^>^ PoolManager::GetAll()
{
- apache::geode::client::HashMapOfPools pools = apache::geode::client::PoolManager::getAll();
- Dictionary<String^, Pool/*<TKey, TValue>*/^>^ result = gcnew Dictionary<String^, Pool/*<TKey, TValue>*/^>();
- for (apache::geode::client::HashMapOfPools::Iterator iter = pools.begin(); iter != pools.end(); ++iter)
+ auto pools = native::PoolManager::getAll();
+ auto result = gcnew Dictionary<String^, Pool^>();
+ for (native::HashMapOfPools::Iterator iter = pools.begin(); iter != pools.end(); ++iter)
{
- String^ key = CacheableString::GetString(iter.first().get());
- Pool/*<TKey, TValue>*/^ val = Pool/*<TKey, TValue>*/::Create(iter.second().get());
+ auto key = CacheableString::GetString(iter.first().get());
+ auto val = Pool::Create(iter.second());
result->Add(key, val);
}
return result;
}
- //generic<class TKey, class TValue>
- Pool/*<TKey, TValue>*/^ PoolManager/*<TKey, TValue>*/::Find(String^ name)
+ Pool^ PoolManager::Find(String^ name)
{
ManagedString mg_name( name );
- apache::geode::client::PoolPtr pool = apache::geode::client::PoolManager::find(mg_name.CharPtr);
- return Pool/*<TKey, TValue>*/::Create(pool.get());
+ auto pool = native::PoolManager::find(mg_name.CharPtr);
+ return Pool::Create(pool);
}
- //generic <class TKey, class TValue>
- Pool/*<TKey, TValue>*/^ PoolManager/*<TKey, TValue>*/::Find(Client::Region<Object^, Object^>^ region)
+ Pool^ PoolManager::Find(Client::Region<Object^, Object^>^ region)
{
- //return Pool::Create(apache::geode::client::PoolManager::find(apache::geode::client::RegionPtr(GetNativePtr<apache::geode::client::Region>(region))).get());
- return Pool/*<TKey, TValue>*/::Create(apache::geode::client::PoolManager::find(apache::geode::client::RegionPtr(region->_NativePtr)).get());
+ return Pool::Create(native::PoolManager::find(region->GetNative()));
}
- //generic<class TKey, class TValue>
- void PoolManager/*<TKey, TValue>*/::Close(Boolean KeepAlive)
+ void PoolManager::Close(Boolean KeepAlive)
{
- apache::geode::client::PoolManager::close(KeepAlive);
+ native::PoolManager::close(KeepAlive);
}
- //generic<class TKey, class TValue>
- void PoolManager/*<TKey, TValue>*/::Close()
+ void PoolManager::Close()
{
- apache::geode::client::PoolManager::close();
+ native::PoolManager::close();
+ }
} // namespace Client
} // namespace Geode
} // namespace Apache
-
-
- } //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/PoolManager.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/PoolManager.hpp b/src/clicache/src/PoolManager.hpp
index a04d1ac..f47d553 100644
--- a/src/clicache/src/PoolManager.hpp
+++ b/src/clicache/src/PoolManager.hpp
@@ -18,8 +18,11 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/PoolManager.hpp>
-//#include "impl/NativeWrapper.hpp"
+#include "end_native.hpp"
+
+
using namespace System;
[08/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from cppcache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/MapSegment.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/MapSegment.cpp b/src/cppcache/src/MapSegment.cpp
index 0eb333a..cd4731c 100644
--- a/src/cppcache/src/MapSegment.cpp
+++ b/src/cppcache/src/MapSegment.cpp
@@ -30,7 +30,7 @@ using namespace apache::geode::client;
#define _GF_GUARD_SEGMENT SpinLockGuard mapGuard(m_spinlock)
#define _VERSION_TAG_NULL_CHK \
- (versionTag != NULLPTR && versionTag.ptr() != NULL)
+ (versionTag != nullptr && versionTag.get() != NULL)
bool MapSegment::boolVal = false;
MapSegment::~MapSegment() {
delete m_map;
@@ -84,9 +84,9 @@ GfErrType MapSegment::create(const CacheableKeyPtr& key,
return err;
}
} else {
- MapEntryImpl* entryImpl = entry->getImplPtr();
+ MapEntryImplPtr entryImpl = entry->getImplPtr();
entryImpl->getValueI(oldValue);
- if (oldValue == NULLPTR || CacheableToken::isTombstone(oldValue)) {
+ if (oldValue == nullptr || CacheableToken::isTombstone(oldValue)) {
// pass the version stamp
VersionStamp versionStamp;
if (m_concurrencyChecksEnabled) {
@@ -99,7 +99,7 @@ GfErrType MapSegment::create(const CacheableKeyPtr& key,
}
}
// good case; go ahead with the create
- if (oldValue == NULLPTR) {
+ if (oldValue == nullptr) {
err = putForTrackedEntry(key, newValue, entry, entryImpl, updateCount,
versionStamp);
} else {
@@ -108,7 +108,7 @@ GfErrType MapSegment::create(const CacheableKeyPtr& key,
versionTag, &versionStamp);
}
- oldValue = NULLPTR;
+ oldValue = nullptr;
} else {
err = GF_CACHE_ENTRY_EXISTS;
@@ -154,7 +154,7 @@ GfErrType MapSegment::put(const CacheableKeyPtr& key,
err = putNoEntry(key, newValue, me, updateCount, destroyTracker,
versionTag);
} else {
- MapEntryImpl* entryImpl = entry->getImplPtr();
+ MapEntryImplPtr entryImpl = entry->getImplPtr();
CacheablePtr meOldValue;
entryImpl->getValueI(meOldValue);
// pass the version stamp
@@ -178,14 +178,14 @@ GfErrType MapSegment::put(const CacheableKeyPtr& key,
unguardedRemoveActualEntryWithoutCancelTask(key, handler, taskid);
err = putNoEntry(key, newValue, me, updateCount, destroyTracker,
versionTag, &versionStamp);
- meOldValue = NULLPTR;
+ meOldValue = nullptr;
isUpdate = false;
} else if ((err = putForTrackedEntry(key, newValue, entry, entryImpl,
updateCount, versionStamp, delta)) ==
GF_NOERR) {
me = entryImpl;
oldValue = meOldValue;
- isUpdate = (meOldValue != NULLPTR);
+ isUpdate = (meOldValue != nullptr);
}
}
}
@@ -214,10 +214,10 @@ GfErrType MapSegment::invalidate(const CacheableKeyPtr& key,
versionStamp.setVersions(versionTag);
}
}
- MapEntryImpl* entryImpl = entry->getImplPtr();
+ MapEntryImplPtr entryImpl = entry->getImplPtr();
entryImpl->getValueI(oldValue);
if (CacheableToken::isTombstone(oldValue)) {
- oldValue = NULLPTR;
+ oldValue = nullptr;
return GF_CACHE_ENTRY_NOT_FOUND;
}
entryImpl->setValueI(CacheableToken::invalid());
@@ -225,7 +225,7 @@ GfErrType MapSegment::invalidate(const CacheableKeyPtr& key,
entryImpl->getVersionStamp().setVersions(versionStamp);
}
(void)incrementUpdateCount(key, entry);
- if (oldValue != NULLPTR) {
+ if (oldValue != nullptr) {
me = entryImpl;
}
} else {
@@ -267,10 +267,10 @@ GfErrType MapSegment::removeWhenConcurrencyEnabled(
versionStamp.setVersions(versionTag);
}
// Get the old value for returning
- MapEntryImpl* entryImpl = entry->getImplPtr();
+ MapEntryImplPtr entryImpl = entry->getImplPtr();
entryImpl->getValueI(oldValue);
- if (oldValue != NULLPTR) me = entryImpl;
+ if (oldValue) me = entryImpl;
if ((err = putForTrackedEntry(key, CacheableToken::tombstone(), entry,
entryImpl, updateCount, versionStamp)) ==
@@ -279,7 +279,7 @@ GfErrType MapSegment::removeWhenConcurrencyEnabled(
expTaskSet = true;
}
if (CacheableToken::isTombstone(oldValue)) {
- oldValue = NULLPTR;
+ oldValue = nullptr;
if (afterRemote) {
return GF_NOERR; // We are here because a remote op succeeded, no need
// to throw an error
@@ -298,7 +298,7 @@ GfErrType MapSegment::removeWhenConcurrencyEnabled(
expiryTaskID);
expTaskSet = true;
}
- oldValue = NULLPTR;
+ oldValue = nullptr;
isEntryFound = false;
if (afterRemote) {
err = GF_NOERR; // We are here because a remote op succeeded, no need to
@@ -344,7 +344,7 @@ GfErrType MapSegment::remove(const CacheableKeyPtr& key, CacheablePtr& oldValue,
CacheablePtr value;
if ((status = m_map->unbind(key, entry)) == -1) {
// didn't unbind, probably no entry...
- oldValue = NULLPTR;
+ oldValue = nullptr;
volatile int destroyTrackers = *m_numDestroyTrackers;
if (destroyTrackers > 0) {
m_destroyedKeys[key] = destroyTrackers + 1;
@@ -356,10 +356,10 @@ GfErrType MapSegment::remove(const CacheableKeyPtr& key, CacheablePtr& oldValue,
// this is the case when entry has been updated while being tracked
return GF_CACHE_ENTRY_UPDATED;
}
- MapEntryImpl* entryImpl = entry->getImplPtr();
+ MapEntryImplPtr entryImpl = entry->getImplPtr();
entryImpl->getValueI(oldValue);
- if (CacheableToken::isTombstone(oldValue)) oldValue = NULLPTR;
- if (oldValue != NULLPTR) {
+ if (CacheableToken::isTombstone(oldValue)) oldValue = nullptr;
+ if (oldValue) {
me = entryImpl;
}
return GF_NOERR;
@@ -401,17 +401,17 @@ bool MapSegment::getEntry(const CacheableKeyPtr& key, MapEntryImplPtr& result,
int status;
MapEntryPtr entry;
if ((status = m_map->find(key, entry)) == -1) {
- result = NULLPTR;
- value = NULLPTR;
+ result = nullptr;
+ value = nullptr;
return false;
}
// If the value is a tombstone return not found
- MapEntryImpl* mePtr = entry->getImplPtr();
+ MapEntryImplPtr mePtr = entry->getImplPtr();
mePtr->getValueI(value);
- if (value == NULLPTR || CacheableToken::isTombstone(value)) {
- result = NULLPTR;
- value = NULLPTR;
+ if (value == nullptr || CacheableToken::isTombstone(value)) {
+ result = nullptr;
+ value = nullptr;
return false;
}
result = mePtr;
@@ -430,9 +430,9 @@ bool MapSegment::containsKey(const CacheableKeyPtr& key) {
}
// If the value is a tombstone return not found
CacheablePtr value;
- MapEntryImpl* mePtr1 = mePtr->getImplPtr();
+ MapEntryImplPtr mePtr1 = mePtr->getImplPtr();
mePtr1->getValueI(value);
- if (value != NULLPTR && CacheableToken::isTombstone(value)) return false;
+ if (value != nullptr && CacheableToken::isTombstone(value)) return false;
return true;
}
@@ -463,11 +463,11 @@ void MapSegment::entries(VectorOfRegionEntry& result) {
iter != m_map->end(); iter++) {
CacheableKeyPtr keyPtr;
CacheablePtr valuePtr;
- MapEntryImpl* me = ((*iter).int_id_)->getImplPtr();
+ MapEntryImplPtr me = ((*iter).int_id_)->getImplPtr();
me->getValueI(valuePtr);
- if (valuePtr != NULLPTR && !CacheableToken::isTombstone(valuePtr)) {
+ if (valuePtr != nullptr && !CacheableToken::isTombstone(valuePtr)) {
if (CacheableToken::isInvalid(valuePtr)) {
- valuePtr = NULLPTR;
+ valuePtr = nullptr;
}
me->getKeyI(keyPtr);
RegionEntryPtr rePtr = m_region->createRegionEntry(keyPtr, valuePtr);
@@ -493,8 +493,8 @@ void MapSegment::values(VectorOfCacheable& result) {
status = m_map->find(keyPtr, entry);
if (status != -1) {
- MapEntryImpl* entryImpl = entry->getImplPtr();
- if (valuePtr != NULLPTR && !CacheableToken::isInvalid(valuePtr) &&
+ MapEntryImplPtr entryImpl = entry->getImplPtr();
+ if (valuePtr != nullptr && !CacheableToken::isInvalid(valuePtr) &&
!CacheableToken::isDestroyed(valuePtr) &&
!CacheableToken::isTombstone(valuePtr)) {
if (CacheableToken::isOverflowed(valuePtr)) { // get Value from disc.
@@ -519,7 +519,7 @@ int MapSegment::addTrackerForEntry(const CacheableKeyPtr& key,
MapEntryPtr newEntry;
int status;
if ((status = m_map->find(key, entry)) == -1) {
- oldValue = NULLPTR;
+ oldValue = nullptr;
if (addIfAbsent) {
MapEntryImplPtr entryImpl;
// add a new entry with value as destroyed
@@ -546,7 +546,7 @@ int MapSegment::addTrackerForEntry(const CacheableKeyPtr& key,
} else {
updateCount = entry->addTracker(newEntry);
}
- if (newEntry != NULLPTR) {
+ if (newEntry != nullptr) {
if (status == -1) {
m_map->bind(key, newEntry);
} else {
@@ -565,7 +565,8 @@ void MapSegment::removeTrackerForEntry(const CacheableKeyPtr& key) {
MapEntryPtr entry;
int status;
if ((status = m_map->find(key, entry)) != -1) {
- removeTrackerForEntry(key, entry, NULL);
+ auto impl = entry->getImplPtr();
+ removeTrackerForEntry(key, entry, impl);
}
}
@@ -582,7 +583,7 @@ void MapSegment::addTrackerForAllEntries(
iter != m_map->end(); ++iter) {
(*iter).int_id_->getKey(key);
int updateCount = (*iter).int_id_->addTracker(newEntry);
- if (newEntry != NULLPTR) {
+ if (newEntry != nullptr) {
m_map->rebind(key, newEntry);
}
updateCounterMap.insert(std::make_pair(key, updateCount));
@@ -625,14 +626,15 @@ void MapSegment::rehash() { // Only called from put, segment must already be
}
CacheablePtr MapSegment::getFromDisc(CacheableKeyPtr key,
- MapEntryImpl* entryImpl) {
+ MapEntryImplPtr& entryImpl) {
LocalRegion* lregion = static_cast<LocalRegion*>(m_region);
EntriesMap* em = lregion->getEntryMap();
return em->getFromDisk(key, entryImpl);
}
+
GfErrType MapSegment::putForTrackedEntry(
const CacheableKeyPtr& key, const CacheablePtr& newValue,
- MapEntryPtr& entry, MapEntryImpl* entryImpl, int updateCount,
+ MapEntryPtr& entry, MapEntryImplPtr& entryImpl, int updateCount,
VersionStamp& versionStamp, DataInput* delta) {
if (updateCount < 0 || m_concurrencyChecksEnabled) {
// for a non-tracked put (e.g. from notification) go ahead with the
@@ -645,7 +647,7 @@ GfErrType MapSegment::putForTrackedEntry(
if (delta != NULL) {
CacheablePtr oldValue;
entryImpl->getValueI(oldValue);
- if (oldValue == NULLPTR || CacheableToken::isDestroyed(oldValue) ||
+ if (oldValue == nullptr || CacheableToken::isDestroyed(oldValue) ||
CacheableToken::isInvalid(oldValue) ||
CacheableToken::isTombstone(oldValue)) {
if (m_poolDM) m_poolDM->updateNotificationStats(false, 0);
@@ -653,12 +655,12 @@ GfErrType MapSegment::putForTrackedEntry(
} else if (CacheableToken::isOverflowed(
oldValue)) { // get Value from disc.
oldValue = getFromDisc(key, entryImpl);
- if (oldValue == NULLPTR) {
+ if (oldValue == nullptr) {
if (m_poolDM) m_poolDM->updateNotificationStats(false, 0);
return GF_INVALID_DELTA;
}
}
- DeltaPtr valueWithDelta(dynCast<DeltaPtr>(oldValue));
+ auto valueWithDelta = std::dynamic_pointer_cast<Delta>(oldValue);
CacheablePtr& newValue1 = const_cast<CacheablePtr&>(newValue);
try {
if (m_region->getAttributes()->getCloningEnabled()) {
@@ -670,18 +672,19 @@ GfErrType MapSegment::putForTrackedEntry(
true,
((ACE_OS::gettimeofday() - currTimeBefore).msec()) * 1000000);
}
- newValue1 = tempVal;
+ newValue1 = std::dynamic_pointer_cast<Serializable>(tempVal);
entryImpl->setValueI(newValue1);
} else {
ACE_Time_Value currTimeBefore = ACE_OS::gettimeofday();
valueWithDelta->fromDelta(*delta);
- newValue1 = valueWithDelta;
+ newValue1 = std::dynamic_pointer_cast<Serializable>(valueWithDelta);
if (m_poolDM) {
m_poolDM->updateNotificationStats(
true,
((ACE_OS::gettimeofday() - currTimeBefore).msec()) * 1000000);
}
- entryImpl->setValueI(valueWithDelta);
+ entryImpl->setValueI(
+ std::dynamic_pointer_cast<Serializable>(valueWithDelta));
}
} catch (InvalidDeltaException&) {
return GF_INVALID_DELTA;
@@ -721,7 +724,7 @@ GfErrType MapSegment::isTombstone(CacheableKeyPtr key, MapEntryImplPtr& me,
bool& result) {
CacheablePtr value;
MapEntryPtr entry;
- MapEntryImpl* mePtr;
+ MapEntryImplPtr mePtr;
if (m_map->find(key, entry) == -1) {
result = false;
return GF_NOERR;
@@ -734,15 +737,13 @@ GfErrType MapSegment::isTombstone(CacheableKeyPtr key, MapEntryImplPtr& me,
* Fix : Aded a check for null ptr
*/
- if (mePtr == (MapEntryImpl*)0) {
+ if (!mePtr) {
result = false;
return GF_NOERR;
}
mePtr->getValueI(value);
- result = mePtr;
-
- if (value == NULLPTR || value.ptr() == NULL) {
+ if (!value) {
result = false;
return GF_NOERR;
}
@@ -751,7 +752,7 @@ GfErrType MapSegment::isTombstone(CacheableKeyPtr key, MapEntryImplPtr& me,
if (m_tombstoneList->getEntryFromTombstoneList(key)) {
MapEntryPtr entry;
if (m_map->find(key, entry) != -1) {
- MapEntryImpl* mePtr = entry->getImplPtr();
+ auto mePtr = entry->getImplPtr();
me = mePtr;
}
result = true;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/MapSegment.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/MapSegment.hpp b/src/cppcache/src/MapSegment.hpp
index 6b91c93..2ed6f66 100644
--- a/src/cppcache/src/MapSegment.hpp
+++ b/src/cppcache/src/MapSegment.hpp
@@ -107,7 +107,7 @@ class CPPCACHE_EXPORT MapSegment {
if (m_concurrencyChecksEnabled) return false;
MapEntryPtr newEntry;
entry->incrementUpdateCount(newEntry);
- if (newEntry != NULLPTR) {
+ if (newEntry != nullptr) {
m_map->rebind(key, newEntry);
entry = newEntry;
return true;
@@ -118,7 +118,7 @@ class CPPCACHE_EXPORT MapSegment {
// remove a tracker for the given entry
inline void removeTrackerForEntry(const CacheableKeyPtr& key,
MapEntryPtr& entry,
- MapEntryImpl* entryImpl) {
+ MapEntryImplPtr& entryImpl) {
// This function is disabled if concurrency checks are enabled. The
// versioning
// changes takes care of the version and no need for tracking the entry
@@ -130,14 +130,14 @@ class CPPCACHE_EXPORT MapSegment {
entryImpl = entry->getImplPtr();
}
entryImpl->getValueI(value);
- if (value == NULLPTR) {
+ if (value == nullptr) {
// get rid of an entry marked as destroyed
m_map->unbind(key);
return;
}
}
if (trackerPair.first) {
- entry = (entryImpl != NULL ? entryImpl : entry->getImplPtr());
+ entry = entryImpl ? entryImpl : entry->getImplPtr();
m_map->rebind(key, entry);
}
}
@@ -164,7 +164,7 @@ class CPPCACHE_EXPORT MapSegment {
m_entryFactory->newMapEntry(key, newEntry);
newEntry->setValueI(newValue);
if (m_concurrencyChecksEnabled) {
- if (versionTag != NULLPTR && versionTag.ptr() != NULL) {
+ if (versionTag != nullptr && versionTag.get() != NULL) {
newEntry->getVersionStamp().setVersions(versionTag);
} else if (versionStamp != NULL) {
newEntry->getVersionStamp().setVersions(*versionStamp);
@@ -176,11 +176,11 @@ class CPPCACHE_EXPORT MapSegment {
GfErrType putForTrackedEntry(const CacheableKeyPtr& key,
const CacheablePtr& newValue, MapEntryPtr& entry,
- MapEntryImpl* entryImpl, int updateCount,
+ MapEntryImplPtr& entryImpl, int updateCount,
VersionStamp& versionStamp,
DataInput* delta = NULL);
- CacheablePtr getFromDisc(CacheableKeyPtr key, MapEntryImpl* entryImpl);
+ CacheablePtr getFromDisc(CacheableKeyPtr key, MapEntryImplPtr& entryImpl);
GfErrType removeWhenConcurrencyEnabled(
const CacheableKeyPtr& key, CacheablePtr& oldValue, MapEntryImplPtr& me,
@@ -192,7 +192,7 @@ class CPPCACHE_EXPORT MapSegment {
MapSegment()
: m_map(NULL),
m_entryFactory(NULL),
- m_region(NULL),
+ m_region(nullptr),
m_primeIndex(0),
m_spinlock(),
m_segmentMutex(),
@@ -200,7 +200,7 @@ class CPPCACHE_EXPORT MapSegment {
m_numDestroyTrackers(NULL),
m_rehashCount(0) // COVERITY --> 30303 Uninitialized scalar field
{
- m_tombstoneList = new TombstoneList(this);
+ m_tombstoneList = std::make_shared<TombstoneList>(this);
}
~MapSegment();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/MapWithLock.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/MapWithLock.hpp b/src/cppcache/src/MapWithLock.hpp
index 32d259c..d8e4500 100644
--- a/src/cppcache/src/MapWithLock.hpp
+++ b/src/cppcache/src/MapWithLock.hpp
@@ -49,7 +49,7 @@ template <>
struct equal_to<apache::geode::client::CacheableKeyPtr> {
size_t operator()(const apache::geode::client::CacheableKeyPtr& key1,
const apache::geode::client::CacheableKeyPtr& key2) const {
- return (*key1.ptr() == *key2.ptr());
+ return (*key1.get() == *key2.get());
}
};
} // namespace std
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/MemberListForVersionStamp.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/MemberListForVersionStamp.cpp b/src/cppcache/src/MemberListForVersionStamp.cpp
index 025d021..210db09 100644
--- a/src/cppcache/src/MemberListForVersionStamp.cpp
+++ b/src/cppcache/src/MemberListForVersionStamp.cpp
@@ -50,5 +50,5 @@ DSMemberForVersionStampPtr MemberListForVersionStamp::getDSMember(
std::unordered_map<uint32_t, DSMemberForVersionStampPtr>::iterator it =
m_members1.find(memberId);
if (it != m_members1.end()) return (*it).second;
- return NULLPTR;
+ return nullptr;
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/MemberListForVersionStamp.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/MemberListForVersionStamp.hpp b/src/cppcache/src/MemberListForVersionStamp.hpp
index 3f21988..de759fd 100644
--- a/src/cppcache/src/MemberListForVersionStamp.hpp
+++ b/src/cppcache/src/MemberListForVersionStamp.hpp
@@ -33,7 +33,7 @@ namespace client {
struct DistributedMemberWithIntIdentifier {
public:
DistributedMemberWithIntIdentifier(
- DSMemberForVersionStampPtr dsmember = NULLPTR, uint16_t id = 0) {
+ DSMemberForVersionStampPtr dsmember = nullptr, uint16_t id = 0) {
this->m_member = dsmember;
this->m_identifier = id;
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/PdxEnumInstantiator.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxEnumInstantiator.cpp b/src/cppcache/src/PdxEnumInstantiator.cpp
index 16e3964..8584186 100644
--- a/src/cppcache/src/PdxEnumInstantiator.cpp
+++ b/src/cppcache/src/PdxEnumInstantiator.cpp
@@ -43,7 +43,7 @@ void PdxEnumInstantiator::toData(DataOutput& output) const {
Serializable* PdxEnumInstantiator::fromData(DataInput& input) {
m_enumObject = CacheableEnum::create(" ", " ", 0);
m_enumObject->fromData(input);
- return m_enumObject.ptr();
+ return m_enumObject.get();
}
CacheableStringPtr PdxEnumInstantiator::toString() const {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/PdxFieldType.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxFieldType.cpp b/src/cppcache/src/PdxFieldType.cpp
index 72f20cf..5652d64 100644
--- a/src/cppcache/src/PdxFieldType.cpp
+++ b/src/cppcache/src/PdxFieldType.cpp
@@ -102,9 +102,9 @@ Serializable* PdxFieldType::fromData(DataInput& input) {
}
bool PdxFieldType::equals(PdxFieldTypePtr otherObj) {
- if (otherObj == NULLPTR) return false;
+ if (otherObj == nullptr) return false;
- PdxFieldType* otherFieldType = dynamic_cast<PdxFieldType*>(otherObj.ptr());
+ PdxFieldType* otherFieldType = dynamic_cast<PdxFieldType*>(otherObj.get());
if (otherFieldType == NULL) return false;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/PdxHelper.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxHelper.cpp b/src/cppcache/src/PdxHelper.cpp
index 200fb69..1055e5b 100644
--- a/src/cppcache/src/PdxHelper.cpp
+++ b/src/cppcache/src/PdxHelper.cpp
@@ -46,138 +46,61 @@ PdxHelper::~PdxHelper() {}
CacheImpl* PdxHelper::getCacheImpl() {
CachePtr cache = CacheFactory::getAnyInstance();
- if (cache == NULLPTR) {
+ if (cache == nullptr) {
throw IllegalStateException("cache has not been created yet.");
;
}
if (cache->isClosed()) {
throw IllegalStateException("cache has been closed. ");
}
- return CacheRegionHelper::getCacheImpl(cache.ptr());
+ return CacheRegionHelper::getCacheImpl(cache.get());
}
void PdxHelper::serializePdx(DataOutput& output,
const PdxSerializable& pdxObject) {
+ serializePdx(
+ output,
+ std::static_pointer_cast<PdxSerializable>(
+ std::const_pointer_cast<Serializable>(pdxObject.shared_from_this())));
+}
+
+void PdxHelper::serializePdx(DataOutput& output,
+ const PdxSerializablePtr& pdxObject) {
const char* pdxClassname = NULL;
- PdxSerializable& pdx = const_cast<PdxSerializable&>(pdxObject);
- PdxInstanceImpl* pdxII = dynamic_cast<PdxInstanceImpl*>(&pdx /*.ptr()*/);
+ auto pdxII = std::dynamic_pointer_cast<PdxInstanceImpl>(pdxObject);
if (pdxII != NULL) {
PdxTypePtr piPt = pdxII->getPdxType();
- if (piPt != NULLPTR &&
+ if (piPt != nullptr &&
piPt->getTypeId() ==
0) // from pdxInstance factory need to get typeid from server
{
int typeId = PdxTypeRegistry::getPDXIdForType(piPt, output.getPoolName());
pdxII->setPdxId(typeId);
}
- PdxLocalWriterPtr plw(new PdxLocalWriter(output, piPt));
+ auto plw = std::make_shared<PdxLocalWriter>(output, piPt);
pdxII->toData(plw);
plw->endObjectWriting(); // now write typeid
int len = 0;
uint8_t* pdxStream = plw->getPdxStream(len);
pdxII->updatePdxStream(pdxStream, len);
- /*
- ==18904== 265,458 bytes in 2 blocks are definitely lost in loss record 928
- of 932
- ==18904== at 0x400791A: operator new[](unsigned int)
- (vg_replace_malloc.c:378)
- ==18904== by 0x4324354:
- apache::geode::client::PdxLocalWriter::getPdxStream(int&)
- (DataOutput.hpp:744)
- ==18904== by 0x4303E6F:
- apache::geode::client::PdxHelper::serializePdx(apache::geode::client::DataOutput&,
- apache::geode::client::PdxSerializable const&) (PdxHelper.cpp:64)
- ==18904== by 0x4377028:
- apache::geode::client::TcrMessage::writeObjectPart(apache::geode::client::SharedPtr<apache::geode::client::Serializable>
- const&, bool, bool, apache::geode::client::VectorOfCacheableKey const*)
- (DataOutput.hpp:580)
- ==18904== by 0x437BB9E:
- apache::geode::client::TcrMessage::TcrMessage(apache::geode::client::TcrMessage::MsgType,
- apache::geode::client::Region const*,
- apache::geode::client::SharedPtr<apache::geode::client::CacheableKey>
- const&,
- apache::geode::client::SharedPtr<apache::geode::client::Serializable>
- const&,
- apache::geode::client::SharedPtr<apache::geode::client::Serializable>
- const&, bool,
- apache::geode::client::ThinClientBaseDM*, bool, bool, char const*)
- (TcrMessage.cpp:2216)
- ==18904== by 0x43B9EE5:
- apache::geode::client::ThinClientRegion::putNoThrow_remote(apache::geode::client::SharedPtr<apache::geode::client::CacheableKey>
- const&,
- apache::geode::client::SharedPtr<apache::geode::client::Serializable>
- const&,
- apache::geode::client::SharedPtr<apache::geode::client::Serializable>
- const&,
- apache::geode::client::SharedPtr<apache::geode::client::VersionTag>&, bool)
- (ThinClientRegion.cpp:909)
- ==18904== by 0x42EFCEF: GfErrType
- apache::geode::client::LocalRegion::updateNoThrow<apache::geode::client::PutActions>(apache::geode::client::SharedPtr<apache::geode::client::CacheableKey>
- const&,
- apache::geode::client::SharedPtr<apache::geode::client::Serializable>
- const&,
- apache::geode::client::SharedPtr<apache::geode::client::Serializable>
- const&,
- apache::geode::client::SharedPtr<apache::geode::client::Serializable>&, int,
- apache::geode::client::CacheEventFlags,
- apache::geode::client::SharedPtr<apache::geode::client::VersionTag>,
- apache::geode::client::DataInput*,
- apache::geode::client::SharedPtr<apache::geode::client::EventId>)
- (LocalRegion.cpp:1097)
- ==18904== by 0x42E4DC6:
- apache::geode::client::LocalRegion::putNoThrow(apache::geode::client::SharedPtr<apache::geode::client::CacheableKey>
- const&,
- apache::geode::client::SharedPtr<apache::geode::client::Serializable>
- const&,
- apache::geode::client::SharedPtr<apache::geode::client::Serializable>
- const&,
- apache::geode::client::SharedPtr<apache::geode::client::Serializable>&, int,
- apache::geode::client::CacheEventFlags,
- apache::geode::client::SharedPtr<apache::geode::client::VersionTag>,
- apache::geode::client::DataInput*,
- apache::geode::client::SharedPtr<apache::geode::client::EventId>)
- (LocalRegion.cpp:1799)
- ==18904== by 0x42DBEB4:
- apache::geode::client::LocalRegion::put(apache::geode::client::SharedPtr<apache::geode::client::CacheableKey>
- const&,
- apache::geode::client::SharedPtr<apache::geode::client::Serializable>
- const&,
- apache::geode::client::SharedPtr<apache::geode::client::Serializable>
- const&) (LocalRegion.cpp:342)
- ==18904== by 0x8069744: void
- apache::geode::client::Region::put<apache::geode::client::SharedPtr<apache::geode::client::WritablePdxInstance>
- >(apache::geode::client::SharedPtr<apache::geode::client::CacheableKey>
- const&,
- apache::geode::client::SharedPtr<apache::geode::client::WritablePdxInstance>
- const&,
- apache::geode::client::SharedPtr<apache::geode::client::Serializable>
- const&) (in
- /export/pnq-gst-dev01a/users/adongre/cedar_dev_Nov12/build-artifacts/linux/tests/cppcache/testThinClientPdxInstance)
- ==18904== by 0x808D107: Task_modifyPdxInstance::doTask() (in
- /export/pnq-gst-dev01a/users/adongre/cedar_dev_Nov12/build-artifacts/linux/tests/cppcache/testThinClientPdxInstance)
- ==18904== by 0x80986CA: dunit::TestSlave::begin() (in
- /export/pnq-gst-dev01a/users/adongre/cedar_dev_Nov12/build-artifacts/linux/tests/cppcache/testThinClientPdxInstance)
- ==18904==
- */
delete[] pdxStream;
return;
}
- const char* pdxType = pdx.getClassName();
+ const char* pdxType = pdxObject->getClassName();
pdxClassname = pdxType;
PdxTypePtr localPdxType = PdxTypeRegistry::getLocalPdxType(pdxType);
- if (localPdxType == NULLPTR) {
+ if (localPdxType == nullptr) {
// need to grab type info, as fromdata is not called yet
- PdxWriterWithTypeCollectorPtr ptc(
- new PdxWriterWithTypeCollector(output, pdxType));
- PdxWriterPtr pwp(dynCast<PdxWriterPtr>(ptc));
- pdx.toData(pwp);
+ PdxWriterWithTypeCollectorPtr ptc =
+ std::make_shared<PdxWriterWithTypeCollector>(output, pdxType);
+ pdxObject->toData(std::dynamic_pointer_cast<PdxWriter>(ptc));
PdxTypePtr nType = ptc->getPdxLocalType();
nType->InitializeType();
@@ -206,25 +129,21 @@ void PdxHelper::serializePdx(DataOutput& output,
// if object got from server than create instance of RemoteWriter otherwise
// local writer.
- PdxSerializablePtr pdxObjptr = NULLPTR;
- pdxObjptr = PdxSerializablePtr(&pdx);
-
- PdxRemotePreservedDataPtr pd = PdxTypeRegistry::getPreserveData(pdxObjptr);
+ PdxRemotePreservedDataPtr pd = PdxTypeRegistry::getPreserveData(pdxObject);
// now always remotewriter as we have API Read/WriteUnreadFields
// so we don't know whether user has used those or not;; Can we do some
// trick here?
- PdxRemoteWriterPtr prw = NULLPTR;
+ PdxRemoteWriterPtr prw = nullptr;
- if (pd != NULLPTR) {
+ if (pd != nullptr) {
PdxTypePtr mergedPdxType =
PdxTypeRegistry::getPdxType(pd->getMergedTypeId());
- prw = PdxRemoteWriterPtr(new PdxRemoteWriter(output, mergedPdxType, pd));
+ prw = std::make_shared<PdxRemoteWriter>(output, mergedPdxType, pd);
} else {
- prw = PdxRemoteWriterPtr(new PdxRemoteWriter(output, pdxClassname));
+ prw = std::make_shared<PdxRemoteWriter>(output, pdxClassname);
}
- PdxWriterPtr pwptr(dynCast<PdxWriterPtr>(prw));
- pdx.toData(pwptr);
+ pdxObject->toData(std::dynamic_pointer_cast<PdxWriter>(prw));
prw->endObjectWriting();
//[ToDo] need to write bytes for stats
@@ -243,15 +162,15 @@ PdxSerializablePtr PdxHelper::deserializePdx(DataInput& dataInput,
bool forceDeserialize,
int32_t typeId, int32_t length) {
char* pdxClassname = NULL;
- PdxSerializablePtr pdxObjectptr = NULLPTR;
- PdxTypePtr pdxLocalType = NULLPTR;
+ PdxSerializablePtr pdxObjectptr = nullptr;
+ PdxTypePtr pdxLocalType = nullptr;
PdxTypePtr pType = PdxTypeRegistry::getPdxType(typeId);
- if (pType != NULLPTR) { // this may happen with PdxInstanceFactory {
+ if (pType != nullptr) { // this may happen with PdxInstanceFactory {
pdxLocalType = PdxTypeRegistry::getLocalPdxType(
pType->getPdxClassName()); // this should be fine for IPdxTypeMapper
}
- if (pType != NULLPTR && pdxLocalType != NULLPTR) // type found
+ if (pType != nullptr && pdxLocalType != nullptr) // type found
{
pdxClassname = pType->getPdxClassName();
LOGDEBUG("deserializePdx ClassName = %s, isLocal = %d ",
@@ -260,20 +179,20 @@ PdxSerializablePtr PdxHelper::deserializePdx(DataInput& dataInput,
pdxObjectptr = SerializationRegistry::getPdxType(pdxClassname);
if (pType->isLocal()) // local type no need to read Unread data
{
- PdxLocalReaderPtr plr(new PdxLocalReader(dataInput, pType, length));
- PdxReaderPtr prp(dynCast<PdxReaderPtr>(plr));
- pdxObjectptr->fromData(prp);
+ PdxLocalReaderPtr plr =
+ std::make_shared<PdxLocalReader>(dataInput, pType, length);
+ pdxObjectptr->fromData(std::dynamic_pointer_cast<PdxReader>(plr));
plr->MoveStream();
} else {
- PdxRemoteReaderPtr prr(new PdxRemoteReader(dataInput, pType, length));
- PdxReaderPtr prp(dynCast<PdxReaderPtr>(prr));
- pdxObjectptr->fromData(prp);
+ PdxRemoteReaderPtr prr =
+ std::make_shared<PdxRemoteReader>(dataInput, pType, length);
+ pdxObjectptr->fromData(std::dynamic_pointer_cast<PdxReader>(prr));
PdxTypePtr mergedVersion =
PdxTypeRegistry::getMergedType(pType->getTypeId());
PdxRemotePreservedDataPtr preserveData =
prr->getPreservedData(mergedVersion, pdxObjectptr);
- if (preserveData != NULLPTR) {
+ if (preserveData != nullptr) {
PdxTypeRegistry::setPreserveData(
pdxObjectptr, preserveData); // it will set data in weakhashmap
}
@@ -281,9 +200,10 @@ PdxSerializablePtr PdxHelper::deserializePdx(DataInput& dataInput,
}
} else {
// type not found; need to get from server
- if (pType == NULLPTR) {
- pType = SerializationRegistry::GetPDXTypeById(dataInput.getPoolName(),
- typeId);
+ if (pType == nullptr) {
+ pType = std::static_pointer_cast<PdxType>(
+ SerializationRegistry::GetPDXTypeById(dataInput.getPoolName(),
+ typeId));
pdxLocalType = PdxTypeRegistry::getLocalPdxType(pType->getPdxClassName());
}
/* adongre - Coverity II
@@ -295,12 +215,12 @@ PdxSerializablePtr PdxHelper::deserializePdx(DataInput& dataInput,
// pdxClassname = pType->getPdxClassName();
pdxObjectptr = SerializationRegistry::getPdxType(pType->getPdxClassName());
PdxSerializablePtr pdxRealObject = pdxObjectptr;
- if (pdxLocalType == NULLPTR) // need to know local type
+ if (pdxLocalType == nullptr) // need to know local type
{
- PdxReaderWithTypeCollectorPtr prtc(
- new PdxReaderWithTypeCollector(dataInput, pType, length));
- PdxReaderPtr prp(dynCast<PdxReaderPtr>(prtc));
- pdxObjectptr->fromData(prp);
+ PdxReaderWithTypeCollectorPtr prtc =
+ std::make_shared<PdxReaderWithTypeCollector>(dataInput, pType,
+ length);
+ pdxObjectptr->fromData(std::dynamic_pointer_cast<PdxReader>(prtc));
// Check for the PdxWrapper
@@ -333,7 +253,7 @@ PdxSerializablePtr PdxHelper::deserializePdx(DataInput& dataInput,
PdxRemotePreservedDataPtr preserveData =
prtc->getPreservedData(mergedVersion, pdxObjectptr);
- if (preserveData != NULLPTR) {
+ if (preserveData != nullptr) {
PdxTypeRegistry::setPreserveData(pdxObjectptr, preserveData);
}
}
@@ -343,9 +263,9 @@ PdxSerializablePtr PdxHelper::deserializePdx(DataInput& dataInput,
LOGDEBUG("Adding type %d ", pType->getTypeId());
PdxTypeRegistry::addPdxType(pType->getTypeId(),
pType); // adding remote type
- PdxRemoteReaderPtr prr(new PdxRemoteReader(dataInput, pType, length));
- PdxReaderPtr prp(dynCast<PdxReaderPtr>(prr));
- pdxObjectptr->fromData(prp);
+ PdxRemoteReaderPtr prr =
+ std::make_shared<PdxRemoteReader>(dataInput, pType, length);
+ pdxObjectptr->fromData(std::dynamic_pointer_cast<PdxReader>(prr));
// Check for PdxWrapper to getObject.
@@ -356,7 +276,7 @@ PdxSerializablePtr PdxHelper::deserializePdx(DataInput& dataInput,
PdxRemotePreservedDataPtr preserveData =
prr->getPreservedData(mergedVersion, pdxObjectptr);
- if (preserveData != NULLPTR) {
+ if (preserveData != nullptr) {
PdxTypeRegistry::setPreserveData(pdxObjectptr, preserveData);
}
prr->MoveStream();
@@ -381,8 +301,8 @@ PdxSerializablePtr PdxHelper::deserializePdx(DataInput& dataInput,
cacheImpl->m_cacheStats->incPdxDeSerialization(len +
9); // pdxLen + 1 + 2*4
}
- return PdxHelper::deserializePdx(dataInput, forceDeserialize, (int32_t)typeId,
- (int32_t)len);
+ return PdxHelper::deserializePdx(dataInput, forceDeserialize,
+ (int32_t)typeId, (int32_t)len);
} else {
// Read Length
@@ -395,73 +315,18 @@ PdxSerializablePtr PdxHelper::deserializePdx(DataInput& dataInput,
PdxTypePtr pType = PdxTypeRegistry::getPdxType(typeId);
- if (pType == NULLPTR) {
- PdxTypePtr pType = SerializationRegistry::GetPDXTypeById(
- dataInput.getPoolName(), typeId);
+ if (pType == nullptr) {
+ // TODO shared_ptr why redef?
+ PdxTypePtr pType = std::static_pointer_cast<PdxType>(
+ SerializationRegistry::GetPDXTypeById(dataInput.getPoolName(),
+ typeId));
PdxTypeRegistry::addLocalPdxType(pType->getPdxClassName(), pType);
PdxTypeRegistry::addPdxType(pType->getTypeId(), pType);
}
- /*
- ==2018== 398,151 bytes in 3 blocks are definitely lost in loss record 707 of
- 710
- ==2018== at 0x400791A: operator new[](unsigned int)
- (vg_replace_malloc.c:378)
- ==2018== by 0x4303969:
- apache::geode::client::PdxHelper::deserializePdx(apache::geode::client::DataInput&,
- bool)
- (DataInput.hpp:1007)
- ==2018== by 0x43210D4:
- apache::geode::client::PdxInstantiator::fromData(apache::geode::client::DataInput&)
- (PdxInstantiator.cpp:30)
- ==2018== by 0x434A72E:
- apache::geode::client::SerializationRegistry::deserialize(apache::geode::client::DataInput&,
- signed
- char) (SerializationRegistry.cpp:378)
- ==2018== by 0x42280FB:
- apache::geode::client::DataInput::readObjectInternal(apache::geode::client::SharedPtr<apache::geode::client::Serializable>&,
- signed char) (DataInput.cpp:9)
- ==2018== by 0x438107E:
- apache::geode::client::TcrMessage::readObjectPart(apache::geode::client::DataInput&,
- bool)
- (DataInput.hpp:694)
- ==2018== by 0x4375638:
- apache::geode::client::TcrMessage::handleByteArrayResponse(char
- const*, int, unsigned short) (TcrMessage.cpp:1087)
- ==2018== by 0x4375B2E: apache::geode::client::TcrMessage::setData(char
- const*, int,
- unsigned short) (TcrMessage.cpp:3933)
- ==2018== by 0x4367EE6:
- apache::geode::client::TcrEndpoint::sendRequestConn(apache::geode::client::TcrMessage
- const&,
- apache::geode::client::TcrMessage&, apache::geode::client::TcrConnection*,
- stlp_std::basic_string<char,
- stlp_std::char_traits<char>, stlp_std::allocator<char> >&)
- (TcrEndpoint.cpp:764)
- ==2018== by 0x43682E3:
- apache::geode::client::TcrEndpoint::sendRequestWithRetry(apache::geode::client::TcrMessage
- const&,
- apache::geode::client::TcrMessage&, apache::geode::client::TcrConnection*&,
- bool&,
- stlp_std::basic_string<char, stlp_std::char_traits<char>,
- stlp_std::allocator<char> >&, int, bool, long long, bool)
- (TcrEndpoint.cpp:869)
- ==2018== by 0x4368EBA:
- apache::geode::client::TcrEndpoint::sendRequestConnWithRetry(apache::geode::client::TcrMessage
- const&,
- apache::geode::client::TcrMessage&, apache::geode::client::TcrConnection*&,
- bool) (TcrEndpoint.cpp:1060)
- ==2018== by 0x4393D2D:
- apache::geode::client::ThinClientPoolDM::sendSyncRequest(apache::geode::client::TcrMessage&,
- apache::geode::client::TcrMessage&, bool, bool,
- apache::geode::client::SharedPtr<apache::geode::client::BucketServerLocation>
- const&)
- (ThinClientPoolDM.cpp:1408)
- ==2018==
- */
// TODO::Enable it once the PdxInstanceImple is CheckedIn.
- PdxSerializablePtr pdxObject(new PdxInstanceImpl(
- const_cast<uint8_t*>(dataInput.currentBufferPosition()), len, typeId));
+ auto pdxObject = std::make_shared<PdxInstanceImpl>(
+ const_cast<uint8_t*>(dataInput.currentBufferPosition()), len, typeId);
dataInput.advanceCursor(len);
@@ -550,8 +415,8 @@ int32_t PdxHelper::readInt(uint8_t* offsetPosition, int size) {
}
int32_t PdxHelper::getEnumValue(const char* enumClassName, const char* enumName,
- int hashcode) {
- EnumInfoPtr ei(new EnumInfo(enumClassName, enumName, hashcode));
+ int hashcode) {
+ auto ei = std::make_shared<EnumInfo>(enumClassName, enumName, hashcode);
return PdxTypeRegistry::getEnumValue(ei);
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/PdxHelper.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxHelper.hpp b/src/cppcache/src/PdxHelper.hpp
index 9a84ef4..546278e 100644
--- a/src/cppcache/src/PdxHelper.hpp
+++ b/src/cppcache/src/PdxHelper.hpp
@@ -50,6 +50,9 @@ class PdxHelper {
static void serializePdx(DataOutput& output,
const PdxSerializable& pdxObject);
+ static void serializePdx(DataOutput& output,
+ const PdxSerializablePtr& pdxObject);
+
static PdxSerializablePtr deserializePdx(DataInput& dataInput,
bool forceDeserialize);
@@ -74,7 +77,7 @@ class PdxHelper {
static int32_t readInt(uint8_t* offsetPosition, int size);
static int32_t getEnumValue(const char* enumClassName, const char* enumName,
- int hashcode);
+ int hashcode);
static EnumInfoPtr getEnum(int enumId);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/PdxInstanceFactoryImpl.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxInstanceFactoryImpl.cpp b/src/cppcache/src/PdxInstanceFactoryImpl.cpp
index 6342ec0..171b889 100644
--- a/src/cppcache/src/PdxInstanceFactoryImpl.cpp
+++ b/src/cppcache/src/PdxInstanceFactoryImpl.cpp
@@ -31,16 +31,17 @@ PdxInstanceFactoryImpl::PdxInstanceFactoryImpl(const char* className) {
*className == '\0') { // COVERITY ---> 30289 Same on both sides
throw IllegalStateException("className should not be null.");
}
- m_pdxType = new PdxType(className, false);
+ m_pdxType = std::make_shared<PdxType>(className, false);
m_created = false;
}
-PdxInstancePtr PdxInstanceFactoryImpl::create() {
+std::unique_ptr<PdxInstance> PdxInstanceFactoryImpl::create() {
if (m_created) {
throw IllegalStateException(
"The PdxInstanceFactory.Create() method can only be called once.");
}
- PdxInstancePtr pi(new PdxInstanceImpl(m_FieldVsValues, m_pdxType));
+ auto pi = std::unique_ptr<PdxInstance>(
+ new PdxInstanceImpl(m_FieldVsValues, m_pdxType));
m_created = true;
return pi;
}
@@ -53,7 +54,7 @@ PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeWideChar(
CacheablePtr cacheableObject = CacheableWideChar::create(value);
m_FieldVsValues.insert(
std::pair<const char*, CacheablePtr>(fieldName, cacheableObject));
- return PdxInstanceFactoryPtr(this);
+ return shared_from_this();
}
PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeChar(const char* fieldName,
@@ -65,7 +66,7 @@ PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeChar(const char* fieldName,
CacheablePtr cacheableObject = CacheableWideChar::create(tempWideChar);
m_FieldVsValues.insert(
std::pair<const char*, CacheablePtr>(fieldName, cacheableObject));
- return PdxInstanceFactoryPtr(this);
+ return shared_from_this();
}
PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeBoolean(
@@ -76,7 +77,7 @@ PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeBoolean(
CacheablePtr cacheableObject = CacheableBoolean::create(value);
m_FieldVsValues.insert(
std::pair<const char*, CacheablePtr>(fieldName, cacheableObject));
- return PdxInstanceFactoryPtr(this);
+ return shared_from_this();
}
PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeByte(const char* fieldName,
@@ -87,7 +88,7 @@ PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeByte(const char* fieldName,
CacheablePtr cacheableObject = CacheableByte::create(value);
m_FieldVsValues.insert(
std::pair<const char*, CacheablePtr>(fieldName, cacheableObject));
- return PdxInstanceFactoryPtr(this);
+ return shared_from_this();
}
PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeShort(const char* fieldName,
@@ -98,7 +99,7 @@ PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeShort(const char* fieldName,
CacheablePtr cacheableObject = CacheableInt16::create(value);
m_FieldVsValues.insert(
std::pair<const char*, CacheablePtr>(fieldName, cacheableObject));
- return PdxInstanceFactoryPtr(this);
+ return shared_from_this();
}
PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeInt(const char* fieldName,
@@ -109,7 +110,7 @@ PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeInt(const char* fieldName,
CacheablePtr cacheableObject = CacheableInt32::create(value);
m_FieldVsValues.insert(
std::pair<const char*, CacheablePtr>(fieldName, cacheableObject));
- return PdxInstanceFactoryPtr(this);
+ return shared_from_this();
}
PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeLong(const char* fieldName,
@@ -120,7 +121,7 @@ PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeLong(const char* fieldName,
CacheablePtr cacheableObject = CacheableInt64::create(value);
m_FieldVsValues.insert(
std::pair<const char*, CacheablePtr>(fieldName, cacheableObject));
- return PdxInstanceFactoryPtr(this);
+ return shared_from_this();
}
PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeFloat(const char* fieldName,
@@ -131,7 +132,7 @@ PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeFloat(const char* fieldName,
CacheablePtr cacheableObject = CacheableFloat::create(value);
m_FieldVsValues.insert(
std::pair<const char*, CacheablePtr>(fieldName, cacheableObject));
- return PdxInstanceFactoryPtr(this);
+ return shared_from_this();
}
PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeDouble(const char* fieldName,
@@ -142,7 +143,7 @@ PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeDouble(const char* fieldName,
CacheablePtr cacheableObject = CacheableDouble::create(value);
m_FieldVsValues.insert(
std::pair<const char*, CacheablePtr>(fieldName, cacheableObject));
- return PdxInstanceFactoryPtr(this);
+ return shared_from_this();
}
PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeWideString(
@@ -153,7 +154,7 @@ PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeWideString(
CacheablePtr cacheableObject = CacheableString::create(value);
m_FieldVsValues.insert(
std::pair<const char*, CacheablePtr>(fieldName, cacheableObject));
- return PdxInstanceFactoryPtr(this);
+ return shared_from_this();
}
PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeString(const char* fieldName,
@@ -164,7 +165,7 @@ PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeString(const char* fieldName,
CacheablePtr cacheableObject = CacheableString::create(value);
m_FieldVsValues.insert(
std::pair<const char*, CacheablePtr>(fieldName, cacheableObject));
- return PdxInstanceFactoryPtr(this);
+ return shared_from_this();
}
PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeObject(const char* fieldName,
@@ -174,7 +175,7 @@ PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeObject(const char* fieldName,
PdxFieldTypes::OBJECT);
m_FieldVsValues.insert(
std::pair<const char*, CacheablePtr>(fieldName, value));
- return PdxInstanceFactoryPtr(this);
+ return shared_from_this();
}
PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeObjectArray(
@@ -184,7 +185,7 @@ PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeObjectArray(
PdxFieldTypes::OBJECT_ARRAY);
m_FieldVsValues.insert(
std::pair<const char*, CacheablePtr>(fieldName, value));
- return PdxInstanceFactoryPtr(this);
+ return shared_from_this();
}
PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeBooleanArray(
@@ -195,7 +196,7 @@ PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeBooleanArray(
CacheablePtr cacheableObject = BooleanArray::create(value, length);
m_FieldVsValues.insert(
std::pair<std::string, CacheablePtr>(fieldName, cacheableObject));
- return PdxInstanceFactoryPtr(this);
+ return shared_from_this();
}
PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeWideCharArray(
@@ -206,7 +207,7 @@ PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeWideCharArray(
CacheablePtr cacheableObject = CharArray::create(value, length);
m_FieldVsValues.insert(
std::pair<const char*, CacheablePtr>(fieldName, cacheableObject));
- return PdxInstanceFactoryPtr(this);
+ return shared_from_this();
}
PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeCharArray(
@@ -221,7 +222,7 @@ PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeCharArray(
m_FieldVsValues.insert(
std::pair<const char*, CacheablePtr>(fieldName, cacheableObject));
delete[] tempWideCharArray;
- return PdxInstanceFactoryPtr(this);
+ return shared_from_this();
}
PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeByteArray(
@@ -233,7 +234,7 @@ PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeByteArray(
CacheableBytes::create(reinterpret_cast<uint8_t*>(value), length);
m_FieldVsValues.insert(
std::pair<const char*, CacheablePtr>(fieldName, cacheableObject));
- return PdxInstanceFactoryPtr(this);
+ return shared_from_this();
}
PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeShortArray(
@@ -244,7 +245,7 @@ PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeShortArray(
CacheablePtr cacheableObject = CacheableInt16Array::create(value, length);
m_FieldVsValues.insert(
std::pair<const char*, CacheablePtr>(fieldName, cacheableObject));
- return PdxInstanceFactoryPtr(this);
+ return shared_from_this();
}
PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeIntArray(
@@ -255,7 +256,7 @@ PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeIntArray(
CacheablePtr cacheableObject = CacheableInt32Array::create(value, length);
m_FieldVsValues.insert(
std::pair<const char*, CacheablePtr>(fieldName, cacheableObject));
- return PdxInstanceFactoryPtr(this);
+ return shared_from_this();
}
PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeLongArray(
@@ -266,7 +267,7 @@ PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeLongArray(
CacheablePtr cacheableObject = CacheableInt64Array::create(value, length);
m_FieldVsValues.insert(
std::pair<const char*, CacheablePtr>(fieldName, cacheableObject));
- return PdxInstanceFactoryPtr(this);
+ return shared_from_this();
}
PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeFloatArray(
@@ -277,7 +278,7 @@ PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeFloatArray(
CacheablePtr cacheableObject = CacheableFloatArray::create(value, length);
m_FieldVsValues.insert(
std::pair<const char*, CacheablePtr>(fieldName, cacheableObject));
- return PdxInstanceFactoryPtr(this);
+ return shared_from_this();
}
PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeDoubleArray(
@@ -288,7 +289,7 @@ PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeDoubleArray(
CacheablePtr cacheableObject = CacheableDoubleArray::create(value, length);
m_FieldVsValues.insert(
std::pair<const char*, CacheablePtr>(fieldName, cacheableObject));
- return PdxInstanceFactoryPtr(this);
+ return shared_from_this();
}
PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeStringArray(
@@ -314,7 +315,7 @@ PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeStringArray(
if (ptrArr) {
delete[] ptrArr;
}
- return PdxInstanceFactoryPtr(this);
+ return shared_from_this();
}
PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeWideStringArray(
@@ -340,7 +341,7 @@ PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeWideStringArray(
if (ptrArr) {
delete[] ptrArr;
}
- return PdxInstanceFactoryPtr(this);
+ return shared_from_this();
}
PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeDate(
@@ -350,7 +351,7 @@ PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeDate(
PdxTypes::DATE_SIZE /*+ 1*/);
m_FieldVsValues.insert(
std::pair<const char*, CacheablePtr>(fieldName, value));
- return PdxInstanceFactoryPtr(this);
+ return shared_from_this();
}
PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeArrayOfByteArrays(
@@ -367,18 +368,18 @@ PdxInstanceFactoryPtr PdxInstanceFactoryImpl::writeArrayOfByteArrays(
}
m_FieldVsValues.insert(
std::pair<const char*, CacheablePtr>(fieldName, cacheableObject));
- return PdxInstanceFactoryPtr(this);
+ return shared_from_this();
}
PdxInstanceFactoryPtr PdxInstanceFactoryImpl::markIdentityField(
const char* fieldName) {
PdxFieldTypePtr pfType = m_pdxType->getPdxField(fieldName);
- if (pfType == NULLPTR) {
+ if (pfType == nullptr) {
throw IllegalStateException(
"Field must be added before calling MarkIdentityField ");
}
pfType->setIdentityField(true);
- return PdxInstanceFactoryPtr(this);
+ return shared_from_this();
}
void PdxInstanceFactoryImpl::isFieldAdded(const char* fieldName) {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/PdxInstanceFactoryImpl.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxInstanceFactoryImpl.hpp b/src/cppcache/src/PdxInstanceFactoryImpl.hpp
index 228a34e..fe49eb8 100644
--- a/src/cppcache/src/PdxInstanceFactoryImpl.hpp
+++ b/src/cppcache/src/PdxInstanceFactoryImpl.hpp
@@ -42,7 +42,9 @@ typedef std::map<std::string, CacheablePtr> FieldVsValues;
* multiple factories or use {@link PdxInstance#createWriter} to create
* subsequent instances.
*/
-class CPPCACHE_EXPORT PdxInstanceFactoryImpl : public PdxInstanceFactory {
+class CPPCACHE_EXPORT PdxInstanceFactoryImpl
+ : public PdxInstanceFactory,
+ public std::enable_shared_from_this<PdxInstanceFactoryImpl> {
public:
/**
* @brief destructor
@@ -56,7 +58,7 @@ class CPPCACHE_EXPORT PdxInstanceFactoryImpl : public PdxInstanceFactory {
* @return the created Pdxinstance
* @throws IllegalStateException if called more than once
*/
- virtual PdxInstancePtr create();
+ virtual std::unique_ptr<PdxInstance> create();
/**
* Writes the named field with the given value to the serialized form.
[03/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from cppcache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/ThinClientRegion.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ThinClientRegion.cpp b/src/cppcache/src/ThinClientRegion.cpp
index 0d763b9..d9ee994 100644
--- a/src/cppcache/src/ThinClientRegion.cpp
+++ b/src/cppcache/src/ThinClientRegion.cpp
@@ -79,24 +79,24 @@ class PutAllWork : public PooledWork<GfErrType>,
m_serverLocation(serverLocation),
m_attemptFailover(attemptFailover),
m_isBGThread(isBGThread),
- m_userAttribute(NULLPTR),
+ m_userAttribute(nullptr),
m_region(region),
m_keys(keys),
m_map(map),
m_timeout(timeout),
- m_papException(NULLPTR),
+ m_papException(nullptr),
m_isPapeReceived(false)
// UNUSED , m_aCallbackArgument(aCallbackArgument)
{
- m_request = new TcrMessagePutAll(m_region.ptr(), *m_map.ptr(),
+ m_request = new TcrMessagePutAll(m_region.get(), *m_map.get(),
static_cast<int>(m_timeout * 1000),
m_poolDM, aCallbackArgument);
m_reply = new TcrMessageReply(true, m_poolDM);
// create new instanceof VCOPL
ACE_Recursive_Thread_Mutex responseLock;
- m_verObjPartListPtr =
- new VersionedCacheableObjectPartList(keys.ptr(), responseLock);
+ m_verObjPartListPtr = std::make_shared<VersionedCacheableObjectPartList>(
+ keys.get(), responseLock);
if (m_poolDM->isMultiUserMode()) {
m_userAttribute = TSSUserAttributesWrapper::s_geodeTSSUserAttributes
@@ -136,7 +136,7 @@ class PutAllWork : public PooledWork<GfErrType>,
GfErrType execute(void) {
GuardUserAttribures gua;
- if (m_userAttribute != NULLPTR) {
+ if (m_userAttribute != nullptr) {
gua.setProxyCache(m_userAttribute->getProxyCache());
}
@@ -222,19 +222,19 @@ class RemoveAllWork : public PooledWork<GfErrType>,
m_serverLocation(serverLocation),
m_attemptFailover(attemptFailover),
m_isBGThread(isBGThread),
- m_userAttribute(NULLPTR),
+ m_userAttribute(nullptr),
m_region(region),
m_aCallbackArgument(aCallbackArgument),
m_keys(keys),
- m_papException(NULLPTR),
+ m_papException(nullptr),
m_isPapeReceived(false) {
- m_request = new TcrMessageRemoveAll(m_region.ptr(), *keys,
+ m_request = new TcrMessageRemoveAll(m_region.get(), *keys,
m_aCallbackArgument, m_poolDM);
m_reply = new TcrMessageReply(true, m_poolDM);
// create new instanceof VCOPL
ACE_Recursive_Thread_Mutex responseLock;
- m_verObjPartListPtr =
- new VersionedCacheableObjectPartList(keys.ptr(), responseLock);
+ m_verObjPartListPtr = std::make_shared<VersionedCacheableObjectPartList>(
+ keys.get(), responseLock);
if (m_poolDM->isMultiUserMode()) {
m_userAttribute = TSSUserAttributesWrapper::s_geodeTSSUserAttributes
@@ -270,7 +270,7 @@ class RemoveAllWork : public PooledWork<GfErrType>,
GfErrType execute(void) {
GuardUserAttribures gua;
- if (m_userAttribute != NULLPTR) {
+ if (m_userAttribute != nullptr) {
gua.setProxyCache(m_userAttribute->getProxyCache());
}
@@ -328,7 +328,7 @@ class RemoveAllWork : public PooledWork<GfErrType>,
};
ThinClientRegion::ThinClientRegion(const std::string& name, CacheImpl* cache,
- RegionInternal* rPtr,
+ const RegionInternalPtr& rPtr,
const RegionAttributesPtr& attributes,
const CacheStatisticsPtr& stats, bool shared)
: LocalRegion(name, cache, rPtr, attributes, stats, shared),
@@ -344,7 +344,7 @@ ThinClientRegion::ThinClientRegion(const std::string& name, CacheImpl* cache,
void ThinClientRegion::initTCR() {
bool subscription = false;
PoolPtr pool = PoolManager::find(getAttributes()->getPoolName());
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
subscription = pool->getSubscriptionEnabled();
}
bool notificationEnabled =
@@ -375,7 +375,7 @@ void ThinClientRegion::registerKeys(const VectorOfCacheableKey& keys,
bool isDurable, bool getInitialValues,
bool receiveValues) {
PoolPtr pool = PoolManager::find(getAttributes()->getPoolName());
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
if (!pool->getSubscriptionEnabled()) {
LOGERROR(
"Registering keys is supported "
@@ -418,7 +418,7 @@ void ThinClientRegion::registerKeys(const VectorOfCacheableKey& keys,
void ThinClientRegion::unregisterKeys(const VectorOfCacheableKey& keys) {
PoolPtr pool = PoolManager::find(getAttributes()->getPoolName());
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
if (!pool->getSubscriptionEnabled()) {
LOGERROR(
"Unregister keys is supported "
@@ -453,7 +453,7 @@ void ThinClientRegion::registerAllKeys(bool isDurable,
bool getInitialValues,
bool receiveValues) {
PoolPtr pool = PoolManager::find(getAttributes()->getPoolName());
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
if (!pool->getSubscriptionEnabled()) {
LOGERROR(
"Register all keys is supported only "
@@ -473,7 +473,7 @@ void ThinClientRegion::registerAllKeys(bool isDurable,
}
bool isresultKeys = true;
- if (resultKeys == NULLPTR) {
+ if (resultKeys == nullptr) {
resultKeys = VectorOfCacheableKeyPtr(new VectorOfCacheableKey());
isresultKeys = false;
}
@@ -500,7 +500,7 @@ void ThinClientRegion::registerAllKeys(bool isDurable,
// Get the entries from the server using a special GET_ALL message
if (isresultKeys == false) {
- resultKeys = NULLPTR;
+ resultKeys = nullptr;
}
GfErrTypeToException("Region::registerAllKeys", err);
}
@@ -510,7 +510,7 @@ void ThinClientRegion::registerRegex(const char* regex, bool isDurable,
bool getInitialValues,
bool receiveValues) {
PoolPtr pool = PoolManager::find(getAttributes()->getPoolName());
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
if (!pool->getSubscriptionEnabled()) {
LOGERROR(
"Register regex is supported only if "
@@ -537,8 +537,8 @@ void ThinClientRegion::registerRegex(const char* regex, bool isDurable,
bool isresultKeys = true;
// if we need initial values then use resultKeys to get the keys from server
- if (resultKeys == NULLPTR) {
- resultKeys = new VectorOfCacheableKey();
+ if (resultKeys == nullptr) {
+ resultKeys = std::make_shared<VectorOfCacheableKey>();
isresultKeys = false;
}
@@ -563,14 +563,14 @@ void ThinClientRegion::registerRegex(const char* regex, bool isDurable,
}
if (isresultKeys == false) {
- resultKeys = NULLPTR;
+ resultKeys = nullptr;
}
GfErrTypeToException("Region::registerRegex", err);
}
void ThinClientRegion::unregisterRegex(const char* regex) {
PoolPtr pool = PoolManager::find(getAttributes()->getPoolName());
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
if (!pool->getSubscriptionEnabled()) {
LOGERROR(
"Unregister regex is supported only if "
@@ -595,7 +595,7 @@ void ThinClientRegion::unregisterRegex(const char* regex) {
void ThinClientRegion::unregisterAllKeys() {
PoolPtr pool = PoolManager::find(getAttributes()->getPoolName());
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
if (!pool->getSubscriptionEnabled()) {
LOGERROR(
"Unregister all keys is supported only if "
@@ -665,20 +665,20 @@ SelectResultsPtr ThinClientRegion::query(const char* predicate,
ThinClientPoolDM* poolDM = dynamic_cast<ThinClientPoolDM*>(m_tcrdm);
if (poolDM) {
- queryPtr = dynCast<RemoteQueryPtr>(
+ queryPtr = std::dynamic_pointer_cast<RemoteQuery>(
poolDM->getQueryServiceWithoutCheck()->newQuery(squery.c_str()));
} else {
- queryPtr = dynCast<RemoteQueryPtr>(
+ queryPtr = std::dynamic_pointer_cast<RemoteQuery>(
m_cacheImpl->getQueryService()->newQuery(squery.c_str()));
}
- return queryPtr->execute(timeout, "Region::query", m_tcrdm, NULLPTR);
+ return queryPtr->execute(timeout, "Region::query", m_tcrdm, nullptr);
}
bool ThinClientRegion::existsValue(const char* predicate, uint32_t timeout) {
SelectResultsPtr results = query(predicate, timeout);
- if (results == NULLPTR) {
+ if (results == nullptr) {
return false;
}
@@ -687,7 +687,7 @@ bool ThinClientRegion::existsValue(const char* predicate, uint32_t timeout) {
GfErrType ThinClientRegion::unregisterKeysBeforeDestroyRegion() {
PoolPtr pool = PoolManager::find(getAttributes()->getPoolName());
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
if (!pool->getSubscriptionEnabled()) {
LOGDEBUG(
"pool subscription-enabled attribute is false, No need to Unregister "
@@ -739,8 +739,8 @@ SerializablePtr ThinClientRegion::selectValue(const char* predicate,
uint32_t timeout) {
SelectResultsPtr results = query(predicate, timeout);
- if (results == NULLPTR || results->size() == 0) {
- return NULLPTR;
+ if (results == nullptr || results->size() == 0) {
+ return nullptr;
}
if (results->size() > 1) {
@@ -800,7 +800,7 @@ bool ThinClientRegion::containsKeyOnServer(
if (txState != NULL) {
// if (!txState->isReplay()) {
- // VectorOfCacheablePtr args(new VectorOfCacheable());
+ // auto args = std::make_shared<VectorOfCacheable>();
// txState->recordTXOperation(GF_CONTAINS_KEY,
// getFullPath(),
// keyPtr,
@@ -810,7 +810,7 @@ bool ThinClientRegion::containsKeyOnServer(
/** @brief Create message and send to bridge server */
- TcrMessageContainsKey request(this, keyPtr, static_cast<UserDataPtr>(NULLPTR),
+ TcrMessageContainsKey request(this, keyPtr, static_cast<UserDataPtr>(nullptr),
true, m_tcrdm);
TcrMessageReply reply(true, m_tcrdm);
reply.setMessageTypeRequest(TcrMessage::CONTAINS_KEY);
@@ -843,7 +843,7 @@ bool ThinClientRegion::containsKeyOnServer(
CacheableBooleanPtr rptr = CacheableBoolean::create(ret);
- rptr = handleReplay(err, rptr);
+ rptr = std::static_pointer_cast<CacheableBoolean>(handleReplay(err, rptr));
GfErrTypeToException("Region::containsKeyOnServer ", err);
return rptr->value();
}
@@ -856,7 +856,7 @@ bool ThinClientRegion::containsValueForKey_remote(
if (txState != NULL) {
// if (!txState->isReplay()) {
- // VectorOfCacheablePtr args(new VectorOfCacheable());
+ // auto args = std::make_shared<VectorOfCacheable>();
// txState->recordTXOperation(GF_CONTAINS_VALUE_FOR_KEY,
// getFullPath(), keyPtr, args);
// }
@@ -864,7 +864,7 @@ bool ThinClientRegion::containsValueForKey_remote(
/** @brief Create message and send to bridge server */
- TcrMessageContainsKey request(this, keyPtr, static_cast<UserDataPtr>(NULLPTR),
+ TcrMessageContainsKey request(this, keyPtr, static_cast<UserDataPtr>(nullptr),
false, m_tcrdm);
TcrMessageReply reply(true, m_tcrdm);
reply.setMessageTypeRequest(TcrMessage::CONTAINS_KEY);
@@ -897,7 +897,7 @@ bool ThinClientRegion::containsValueForKey_remote(
CacheableBooleanPtr rptr = CacheableBoolean::create(ret);
- rptr = handleReplay(err, rptr);
+ rptr = std::static_pointer_cast<CacheableBoolean>(handleReplay(err, rptr));
GfErrTypeToException("Region::containsValueForKey ", err);
return rptr->value();
@@ -1030,10 +1030,10 @@ GfErrType ThinClientRegion::putNoThrow_remote(
bool delta = false;
const char* conFlationValue =
DistributedSystem::getSystemProperties()->conflateEvents();
- if (checkDelta && valuePtr != NULLPTR && conFlationValue != NULL &&
+ if (checkDelta && valuePtr != nullptr && conFlationValue != NULL &&
strcmp(conFlationValue, "true") != 0 &&
ThinClientBaseDM::isDeltaEnabledOnServer()) {
- Delta* temp = dynamic_cast<Delta*>(valuePtr.ptr());
+ Delta* temp = dynamic_cast<Delta*>(valuePtr.get());
delta = (temp && temp->hasDelta());
}
TcrMessagePut request(this, keyPtr, valuePtr, aCallbackArgument, delta,
@@ -1094,7 +1094,7 @@ GfErrType ThinClientRegion::destroyNoThrow_remote(
GfErrType err = GF_NOERR;
// do TCR destroy
- TcrMessageDestroy request(this, keyPtr, NULLPTR, aCallbackArgument, m_tcrdm);
+ TcrMessageDestroy request(this, keyPtr, nullptr, aCallbackArgument, m_tcrdm);
TcrMessageReply reply(true, m_tcrdm);
err = m_tcrdm->sendSyncRequest(request, reply);
if (err != GF_NOERR) return err;
@@ -1176,7 +1176,7 @@ GfErrType ThinClientRegion::removeNoThrowEX_remote(
GfErrType err = GF_NOERR;
// do TCR remove
- TcrMessageDestroy request(this, keyPtr, NULLPTR, aCallbackArgument, m_tcrdm);
+ TcrMessageDestroy request(this, keyPtr, nullptr, aCallbackArgument, m_tcrdm);
TcrMessageReply reply(true, m_tcrdm);
err = m_tcrdm->sendSyncRequest(request, reply);
if (err != GF_NOERR) {
@@ -1301,7 +1301,7 @@ GfErrType ThinClientRegion::singleHopPutAllNoThrow_remote(
const UserDataPtr& aCallbackArgument) {
LOGDEBUG(" ThinClientRegion::singleHopPutAllNoThrow_remote map size = %d",
map.size());
- RegionPtr region(this);
+ RegionPtr region = shared_from_this();
GfErrType error = GF_NOERR;
/*Step-1::
@@ -1325,80 +1325,13 @@ GfErrType ThinClientRegion::singleHopPutAllNoThrow_remote(
if (locationMap == NULL) {
// putAll with multiple hop implementation
LOGDEBUG("locationMap is Null or Empty");
- /*
- ==24194== 7,825,919 (24 direct, 7,825,895 indirect) bytes in 2 blocks are
- definitely lost in loss record 598 of 598
- ==24194== at 0x4007D75: operator new(unsigned int)
- (vg_replace_malloc.c:313)
- ==24194== by 0x43B5C5F:
- apache::geode::client::ThinClientRegion::singleHopPutAllNoThrow_remote(apache::geode::client::ThinClientPoolDM*,
- apache::geode::client::HashMapOfCacheable const&,
- apache::geode::client::SharedPtr<apache::geode::client::VersionedCacheableObjectPartList>&,
- unsigned
- int) (ThinClientRegion.cpp:1180)
- ==24194== by 0x43B8B65:
- apache::geode::client::ThinClientRegion::putAllNoThrow_remote(apache::geode::client::HashMapOfCacheable
- const&,
- apache::geode::client::SharedPtr<apache::geode::client::VersionedCacheableObjectPartList>&,
- unsigned int) (ThinClientRegion.cpp:1500)
- ==24194== by 0x42E55F5:
- apache::geode::client::LocalRegion::putAllNoThrow(apache::geode::client::HashMapOfCacheable
- const&,
- unsigned int) (LocalRegion.cpp:1956)
- ==24194== by 0x42DC797:
- apache::geode::client::LocalRegion::putAll(apache::geode::client::HashMapOfCacheable
- const&, unsigned
- int) (LocalRegion.cpp:366)
- ==24194== by 0x806FF8D: Task_StepEight::doTask() (in
- /export/pnq-gst-dev01a/users/adongre/cedar_dev_Nov12/build-artifacts/linux/tests/cppcache/testThinClientPutAll)
- ==24194== by 0x807CE2A: dunit::TestSlave::begin() (in
- /export/pnq-gst-dev01a/users/adongre/cedar_dev_Nov12/build-artifacts/linux/tests/cppcache/testThinClientPutAll)
- ==24194== by 0x8078F57: dunit::dmain(int, char**) (in
- /export/pnq-gst-dev01a/users/adongre/cedar_dev_Nov12/build-artifacts/linux/tests/cppcache/testThinClientPutAll)
- ==24194== by 0x805D7EA: main (in
- /export/pnq-gst-dev01a/users/adongre/cedar_dev_Nov12/build-artifacts/linux/tests/cppcache/testThinClientPutAll)
- ==24194==
- */
delete userKeys;
userKeys = NULL;
return multiHopPutAllNoThrow_remote(map, versionedObjPartList, timeout,
aCallbackArgument);
}
- /*
- ==24194== 7,825,919 (24 direct, 7,825,895 indirect) bytes in 2 blocks are
- definitely lost in loss record 598 of 598
- ==24194== at 0x4007D75: operator new(unsigned int)
- (vg_replace_malloc.c:313)
- ==24194== by 0x43B5C5F:
- apache::geode::client::ThinClientRegion::singleHopPutAllNoThrow_remote(apache::geode::client::ThinClientPoolDM*,
- apache::geode::client::HashMapOfCacheable const&,
- apache::geode::client::SharedPtr<apache::geode::client::VersionedCacheableObjectPartList>&,
- unsigned int)
- (ThinClientRegion.cpp:1180)
- ==24194== by 0x43B8B65:
- apache::geode::client::ThinClientRegion::putAllNoThrow_remote(apache::geode::client::HashMapOfCacheable
- const&,
- apache::geode::client::SharedPtr<apache::geode::client::VersionedCacheableObjectPartList>&,
- unsigned int) (ThinClientRegion.cpp:1500)
- ==24194== by 0x42E55F5:
- apache::geode::client::LocalRegion::putAllNoThrow(apache::geode::client::HashMapOfCacheable
- const&,
- unsigned int) (LocalRegion.cpp:1956)
- ==24194== by 0x42DC797:
- apache::geode::client::LocalRegion::putAll(apache::geode::client::HashMapOfCacheable
- const&, unsigned int)
- (LocalRegion.cpp:366)
- ==24194== by 0x806FF8D: Task_StepEight::doTask() (in
- /export/pnq-gst-dev01a/users/adongre/cedar_dev_Nov12/build-artifacts/linux/tests/cppcache/testThinClientPutAll)
- ==24194== by 0x807CE2A: dunit::TestSlave::begin() (in
- /export/pnq-gst-dev01a/users/adongre/cedar_dev_Nov12/build-artifacts/linux/tests/cppcache/testThinClientPutAll)
- ==24194== by 0x8078F57: dunit::dmain(int, char**) (in
- /export/pnq-gst-dev01a/users/adongre/cedar_dev_Nov12/build-artifacts/linux/tests/cppcache/testThinClientPutAll)
- ==24194== by 0x805D7EA: main (in
- /export/pnq-gst-dev01a/users/adongre/cedar_dev_Nov12/build-artifacts/linux/tests/cppcache/testThinClientPutAll)
- ==24194==
- */
+
delete userKeys;
userKeys = NULL;
@@ -1425,14 +1358,14 @@ GfErrType ThinClientRegion::singleHopPutAllNoThrow_remote(
locationIter = locationMap->begin();
locationIter != locationMap->end(); locationIter++) {
BucketServerLocationPtr serverLocation = locationIter.first();
- if (serverLocation == NULLPTR) {
- LOGDEBUG("serverLocation is NULLPTR");
+ if (serverLocation == nullptr) {
+ LOGDEBUG("serverLocation is nullptr");
}
VectorOfCacheableKeyPtr keys = locationIter.second();
// Create server specific Sub-Map by iterating over keys.
- HashMapOfCacheablePtr filteredMap(new HashMapOfCacheable());
- if (keys != NULLPTR && keys->size() > 0) {
+ auto filteredMap = std::make_shared<HashMapOfCacheable>();
+ if (keys != nullptr && keys->size() > 0) {
for (int32_t index = 0; index < keys->size(); index++) {
HashMapOfCacheable::Iterator iter = map.find(keys->at(index));
if (iter != map.end()) {
@@ -1448,10 +1381,10 @@ GfErrType ThinClientRegion::singleHopPutAllNoThrow_remote(
LOGDEBUG("Printing map at %d locationMapindex ", locationMapIndex);
for (HashMapOfCacheable::Iterator filteredMapIter = filteredMap->begin();
filteredMapIter != filteredMap->end(); ++filteredMapIter) {
- CacheableInt32Ptr kPtr =
- dynCast<CacheableInt32Ptr>(filteredMapIter.first()) ;
- CacheableInt32Ptr vPtr =
- dynCast<CacheableInt32Ptr>(filteredMapIter.second());
+ auto kPtr =
+ std::dynamic_pointer_cast<CacheableInt32>(filteredMapIter.first()) ;
+ auto vPtr =
+ std::dynamic_pointer_cast<CacheableInt32>(filteredMapIter.second());
LOGDEBUG("Key = %d Value = %d ", kPtr->value(), vPtr->value() );
}
*/
@@ -1539,8 +1472,7 @@ GfErrType ThinClientRegion::singleHopPutAllNoThrow_remote(
* PutAllPartialResultServerException
*/
ACE_Recursive_Thread_Mutex responseLock;
- PutAllPartialResultPtr result(
- new PutAllPartialResult(map.size(), responseLock));
+ auto result = std::make_shared<PutAllPartialResult>(map.size(), responseLock);
LOGDEBUG(
" TCRegion:: %s:%d "
"result->getSucceededKeysAndVersions()->getVersionedTagsize() = %d ",
@@ -1553,10 +1485,10 @@ GfErrType ThinClientRegion::singleHopPutAllNoThrow_remote(
resultMapIter != resultMap->end(); resultMapIter++) {
SerializablePtr value = resultMapIter.second();
PutAllPartialResultServerException* papException = NULL;
- VersionedCacheableObjectPartListPtr list = NULLPTR;
+ VersionedCacheableObjectPartListPtr list = nullptr;
papException =
- dynamic_cast<PutAllPartialResultServerException*>(value.ptr());
+ dynamic_cast<PutAllPartialResultServerException*>(value.get());
// LOGDEBUG(" TCRegion:: %s:%d
// result->getSucceededKeysAndVersions()->getVersionedTagsize() = %d ",
// __FILE__, __LINE__,
@@ -1572,9 +1504,10 @@ GfErrType ThinClientRegion::singleHopPutAllNoThrow_remote(
// ", papException->getMessage()->asChar());
// TODO:: need to read papException and populate PutAllPartialResult.
result->consolidate(papException->getResult());
- } else if (value != NULLPTR &&
- (list = dynCast<VersionedCacheableObjectPartListPtr>(value)) !=
- NULLPTR) {
+ } else if (value != nullptr &&
+ (list =
+ std::dynamic_pointer_cast<VersionedCacheableObjectPartList>(
+ value)) != nullptr) {
// value in resultMap is of type VCOPL.
// LOGDEBUG("TCRegion:: %s:%d :: list->getSucceededKeys()->size()=%d
// list->getVersionedTagsize() = %d", __FILE__, __LINE__,
@@ -1582,7 +1515,7 @@ GfErrType ThinClientRegion::singleHopPutAllNoThrow_remote(
result->addKeysAndVersions(list);
} else {
// ERROR CASE
- if (value != NULLPTR) {
+ if (value != nullptr) {
LOGERROR(
"ERROR:: ThinClientRegion::singleHopPutAllNoThrow_remote value "
"could not Cast to either VCOPL or "
@@ -1612,7 +1545,7 @@ GfErrType ThinClientRegion::singleHopPutAllNoThrow_remote(
// then we need to gather up the keys that we know have succeeded so far and
// add them to the partial result set (See bug Id #955)
if (failedServers->size() > 0) {
- VectorOfCacheableKeyPtr succeedKeySet(new VectorOfCacheableKey());
+ auto succeedKeySet = std::make_shared<VectorOfCacheableKey>();
if (result->getSucceededKeysAndVersions()->size() == 0) {
for (HashMapT<BucketServerLocationPtr, VectorOfCacheableKeyPtr>::Iterator
locationIter = locationMap->begin();
@@ -1650,19 +1583,19 @@ GfErrType ThinClientRegion::singleHopPutAllNoThrow_remote(
}
HashMapT<BucketServerLocationPtr, VectorOfCacheableKeyPtr>::Iterator
failedSerInLocMapIter = locationMap->find(failedServerIter.first());
- VectorOfCacheableKeyPtr failedKeys = NULLPTR;
+ VectorOfCacheableKeyPtr failedKeys = nullptr;
if (failedSerInLocMapIter != locationMap->end()) {
failedKeys = failedSerInLocMapIter.second();
}
- if (failedKeys == NULLPTR) {
+ if (failedKeys == nullptr) {
LOGERROR(
"TCRegion::singleHopPutAllNoThrow_remote :: failedKeys are NULL that "
"is not valid");
}
- HashMapOfCacheablePtr newSubMap(new HashMapOfCacheable());
- if (failedKeys != NULLPTR && failedKeys->size() > 0) {
+ auto newSubMap = std::make_shared<HashMapOfCacheable>();
+ if (failedKeys != nullptr && failedKeys->size() > 0) {
for (int32_t index = 0; index < failedKeys->size(); index++) {
HashMapOfCacheable::Iterator iter = map.find(failedKeys->at(index));
if (iter != map.end()) {
@@ -1676,21 +1609,20 @@ GfErrType ThinClientRegion::singleHopPutAllNoThrow_remote(
}
VersionedCacheableObjectPartListPtr vcopListPtr;
- PutAllPartialResultServerExceptionPtr papResultServerExc = NULLPTR;
GfErrType errCode = multiHopPutAllNoThrow_remote(
- *newSubMap.ptr(), vcopListPtr, timeout, aCallbackArgument);
+ *newSubMap.get(), vcopListPtr, timeout, aCallbackArgument);
if (errCode == GF_NOERR) {
result->addKeysAndVersions(vcopListPtr);
} else if (errCode == GF_PUTALL_PARTIAL_RESULT_EXCEPTION) {
oneSubMapRetryFailed = true;
- // TODO:: Commented it as papResultServerExc is NULLPTR this time
+ // TODO:: Commented it as papResultServerExc is nullptr this time
// UnComment it once you read papResultServerExc.
// result->consolidate(papResultServerExc->getResult());
error = errCode;
} else /*if(errCode != GF_NOERR)*/ {
oneSubMapRetryFailed = true;
CacheableKeyPtr firstKey = newSubMap->begin().first();
- ExceptionPtr excptPtr = NULLPTR;
+ ExceptionPtr excptPtr = nullptr;
// TODO:: formulat excptPtr from the errCode
result->saveFailedKey(firstKey, excptPtr);
error = errCode;
@@ -1726,10 +1658,11 @@ GfErrType ThinClientRegion::multiHopPutAllNoThrow_remote(
reply.setTimeout(timeout);
ACE_Recursive_Thread_Mutex responseLock;
- versionedObjPartList = new VersionedCacheableObjectPartList(responseLock);
+ versionedObjPartList =
+ std::make_shared<VersionedCacheableObjectPartList>(responseLock);
// need to check
ChunkedPutAllResponse* resultCollector(new ChunkedPutAllResponse(
- RegionPtr(this), reply, responseLock, versionedObjPartList));
+ shared_from_this(), reply, responseLock, versionedObjPartList));
reply.setChunkedResultHandler(resultCollector);
err = m_tcrdm->sendSyncRequest(request, reply);
@@ -1804,7 +1737,7 @@ GfErrType ThinClientRegion::singleHopRemoveAllNoThrow_remote(
const UserDataPtr& aCallbackArgument) {
LOGDEBUG(" ThinClientRegion::singleHopRemoveAllNoThrow_remote keys size = %d",
keys.size());
- RegionPtr region(this);
+ RegionPtr region = shared_from_this();
GfErrType error = GF_NOERR;
HashMapT<BucketServerLocationPtr, VectorOfCacheableKeyPtr>* locationMap =
@@ -1840,8 +1773,8 @@ GfErrType ThinClientRegion::singleHopRemoveAllNoThrow_remote(
locationIter = locationMap->begin();
locationIter != locationMap->end(); locationIter++) {
BucketServerLocationPtr serverLocation = locationIter.first();
- if (serverLocation == NULLPTR) {
- LOGDEBUG("serverLocation is NULLPTR");
+ if (serverLocation == nullptr) {
+ LOGDEBUG("serverLocation is nullptr");
}
VectorOfCacheableKeyPtr mappedkeys = locationIter.second();
RemoveAllWork* worker = new RemoveAllWork(
@@ -1914,8 +1847,8 @@ GfErrType ThinClientRegion::singleHopRemoveAllNoThrow_remote(
* PutAllPartialResultServerException
*/
ACE_Recursive_Thread_Mutex responseLock;
- PutAllPartialResultPtr result(
- new PutAllPartialResult(keys.size(), responseLock));
+ auto result =
+ std::make_shared<PutAllPartialResult>(keys.size(), responseLock);
LOGDEBUG(
" TCRegion:: %s:%d "
"result->getSucceededKeysAndVersions()->getVersionedTagsize() = %d ",
@@ -1928,10 +1861,10 @@ GfErrType ThinClientRegion::singleHopRemoveAllNoThrow_remote(
resultMapIter != resultMap->end(); resultMapIter++) {
SerializablePtr value = resultMapIter.second();
PutAllPartialResultServerException* papException = NULL;
- VersionedCacheableObjectPartListPtr list = NULLPTR;
+ VersionedCacheableObjectPartListPtr list = nullptr;
papException =
- dynamic_cast<PutAllPartialResultServerException*>(value.ptr());
+ dynamic_cast<PutAllPartialResultServerException*>(value.get());
if (papException != NULL) {
// PutAllPartialResultServerException CASE:: value in resultMap is of type
// PutAllPartialResultServerException.
@@ -1943,9 +1876,10 @@ GfErrType ThinClientRegion::singleHopRemoveAllNoThrow_remote(
// ", papException->getMessage()->asChar());
// TODO:: need to read papException and populate PutAllPartialResult.
result->consolidate(papException->getResult());
- } else if (value != NULLPTR &&
- (list = dynCast<VersionedCacheableObjectPartListPtr>(value)) !=
- NULLPTR) {
+ } else if (value != nullptr &&
+ (list =
+ std::dynamic_pointer_cast<VersionedCacheableObjectPartList>(
+ value)) != nullptr) {
// value in resultMap is of type VCOPL.
// LOGDEBUG("TCRegion:: %s:%d :: list->getSucceededKeys()->size()=%d
// list->getVersionedTagsize() = %d", __FILE__, __LINE__,
@@ -1953,7 +1887,7 @@ GfErrType ThinClientRegion::singleHopRemoveAllNoThrow_remote(
result->addKeysAndVersions(list);
} else {
// ERROR CASE
- if (value != NULLPTR) {
+ if (value != nullptr) {
LOGERROR(
"ERROR:: ThinClientRegion::singleHopRemoveAllNoThrow_remote value "
"could not Cast to either VCOPL or "
@@ -1983,7 +1917,7 @@ GfErrType ThinClientRegion::singleHopRemoveAllNoThrow_remote(
// then we need to gather up the keys that we know have succeeded so far and
// add them to the partial result set (See bug Id #955)
if (failedServers->size() > 0) {
- VectorOfCacheableKeyPtr succeedKeySet(new VectorOfCacheableKey());
+ auto succeedKeySet = std::make_shared<VectorOfCacheableKey>();
if (result->getSucceededKeysAndVersions()->size() == 0) {
for (HashMapT<BucketServerLocationPtr, VectorOfCacheableKeyPtr>::Iterator
locationIter = locationMap->begin();
@@ -2021,19 +1955,19 @@ GfErrType ThinClientRegion::singleHopRemoveAllNoThrow_remote(
}
HashMapT<BucketServerLocationPtr, VectorOfCacheableKeyPtr>::Iterator
failedSerInLocMapIter = locationMap->find(failedServerIter.first());
- VectorOfCacheableKeyPtr failedKeys = NULLPTR;
+ VectorOfCacheableKeyPtr failedKeys = nullptr;
if (failedSerInLocMapIter != locationMap->end()) {
failedKeys = failedSerInLocMapIter.second();
}
- if (failedKeys == NULLPTR) {
+ if (failedKeys == nullptr) {
LOGERROR(
"TCRegion::singleHopRemoveAllNoThrow_remote :: failedKeys are NULL "
"that is not valid");
}
VersionedCacheableObjectPartListPtr vcopListPtr;
- PutAllPartialResultServerExceptionPtr papResultServerExc = NULLPTR;
+ PutAllPartialResultServerExceptionPtr papResultServerExc = nullptr;
GfErrType errCode = multiHopRemoveAllNoThrow_remote(
*failedKeys, vcopListPtr, aCallbackArgument);
if (errCode == GF_NOERR) {
@@ -2043,7 +1977,7 @@ GfErrType ThinClientRegion::singleHopRemoveAllNoThrow_remote(
error = errCode;
} else /*if(errCode != GF_NOERR)*/ {
oneSubMapRetryFailed = true;
- ExceptionPtr excptPtr = NULLPTR;
+ ExceptionPtr excptPtr = nullptr;
result->saveFailedKey(failedKeys->at(0), excptPtr);
error = errCode;
}
@@ -2074,10 +2008,11 @@ GfErrType ThinClientRegion::multiHopRemoveAllNoThrow_remote(
TcrMessageReply reply(true, m_tcrdm);
ACE_Recursive_Thread_Mutex responseLock;
- versionedObjPartList = new VersionedCacheableObjectPartList(responseLock);
+ versionedObjPartList =
+ std::make_shared<VersionedCacheableObjectPartList>(responseLock);
// need to check
ChunkedRemoveAllResponse* resultCollector(new ChunkedRemoveAllResponse(
- RegionPtr(this), reply, responseLock, versionedObjPartList));
+ shared_from_this(), reply, responseLock, versionedObjPartList));
reply.setChunkedResultHandler(resultCollector);
err = m_tcrdm->sendSyncRequest(request, reply);
@@ -2155,7 +2090,9 @@ uint32_t ThinClientRegion::size_remote() {
switch (reply.getMessageType()) {
case TcrMessage::RESPONSE: {
- CacheableInt32Ptr size = staticCast<CacheableInt32Ptr>(reply.getValue());
+ CacheableInt32Ptr size =
+ std::static_pointer_cast<GF_UNWRAP_SP(CacheableInt32Ptr)>(
+ reply.getValue());
return size->value();
// LOGINFO("Map is written into remote server at region %s",
// m_fullPath.c_str());
@@ -2189,7 +2126,7 @@ GfErrType ThinClientRegion::registerStoredRegex(
for (std::unordered_map<std::string, InterestResultPolicy>::iterator it =
interestListRegex.begin();
it != interestListRegex.end(); ++it) {
- opErr = registerRegexNoThrow(it->first, false, endpoint, isDurable, NULLPTR,
+ opErr = registerRegexNoThrow(it->first, false, endpoint, isDurable, nullptr,
it->second, receiveValues);
if (opErr != GF_NOERR) {
retVal = opErr;
@@ -2257,7 +2194,7 @@ GfErrType ThinClientRegion::registerKeys(TcrEndpoint* endpoint,
reply = NULL;
}
opErr = registerRegexNoThrow(
- newRegex, false, endpoint, isDurable, NULLPTR,
+ newRegex, false, endpoint, isDurable, nullptr,
request->getInterestResultPolicy(), receiveValues, reply);
err = opErr != GF_NOERR ? opErr : err;
}
@@ -2409,19 +2346,19 @@ GfErrType ThinClientRegion::registerKeysNoThrow(
ACE_Recursive_Thread_Mutex responseLock;
TcrChunkedResult* resultCollector = NULL;
if (interestPolicy.ordinal == InterestResultPolicy::KEYS_VALUES.ordinal) {
- HashMapOfCacheablePtr values(new HashMapOfCacheable());
- HashMapOfExceptionPtr exceptions(new HashMapOfException());
+ auto values = std::make_shared<HashMapOfCacheable>();
+ auto exceptions = std::make_shared<HashMapOfException>();
MapOfUpdateCounters trackers;
int32_t destroyTracker = 1;
if (needToCreateRC) {
resultCollector = (new ChunkedGetAllResponse(
- request, this, &keys, values, exceptions, NULLPTR, trackers,
+ request, this, &keys, values, exceptions, nullptr, trackers,
destroyTracker, true, responseLock));
reply->setChunkedResultHandler(resultCollector);
}
} else {
if (needToCreateRC) {
- resultCollector = (new ChunkedInterestResponse(request, NULLPTR, *reply));
+ resultCollector = (new ChunkedInterestResponse(request, nullptr, *reply));
reply->setChunkedResultHandler(resultCollector);
}
}
@@ -2584,11 +2521,11 @@ GfErrType ThinClientRegion::registerRegexNoThrow(
if (reply == NULL) {
reply = &replyLocal;
if (interestPolicy.ordinal == InterestResultPolicy::KEYS_VALUES.ordinal) {
- HashMapOfCacheablePtr values(new HashMapOfCacheable());
- HashMapOfExceptionPtr exceptions(new HashMapOfException());
+ auto values = std::make_shared<HashMapOfCacheable>();
+ auto exceptions = std::make_shared<HashMapOfException>();
MapOfUpdateCounters trackers;
int32_t destroyTracker = 1;
- if (resultKeys == NULLPTR) {
+ if (resultKeys == nullptr) {
resultKeys = VectorOfCacheableKeyPtr(new VectorOfCacheableKey());
}
// need to check
@@ -2622,7 +2559,7 @@ GfErrType ThinClientRegion::registerRegexNoThrow(
const VectorOfCacheableKeyPtr& keys =
resultCollector != NULL ? resultCollector->getResultKeys()
: getAllResultCollector->getResultKeys();
- if (keys != NULLPTR) {
+ if (keys != nullptr) {
localInvalidateForRegisterInterest(*keys);
}
}
@@ -2806,12 +2743,11 @@ GfErrType ThinClientRegion::clientNotificationHandler(TcrMessage& msg) {
LOGDEBUG("remote clear region event for reigon[%s]",
msg.getRegionName().c_str());
err = localClearNoThrow(
- NULLPTR, CacheEventFlags::NOTIFICATION | CacheEventFlags::LOCAL);
+ nullptr, CacheEventFlags::NOTIFICATION | CacheEventFlags::LOCAL);
break;
}
case TcrMessage::LOCAL_DESTROY_REGION: {
m_notifyRelease = true;
- preserveSB();
err = LocalRegion::destroyRegionNoThrow(
msg.getCallbackArgument(), true,
CacheEventFlags::NOTIFICATION | CacheEventFlags::LOCAL);
@@ -3017,9 +2953,9 @@ void ThinClientRegion::registerInterestGetValues(
const char* method, const VectorOfCacheableKey* keys,
const VectorOfCacheableKeyPtr& resultKeys) {
try {
- HashMapOfExceptionPtr exceptions(new HashMapOfException());
- GfErrType err = getAllNoThrow_remote(keys, NULLPTR, exceptions, resultKeys,
- true, NULLPTR);
+ auto exceptions = std::make_shared<HashMapOfException>();
+ GfErrType err = getAllNoThrow_remote(keys, nullptr, exceptions, resultKeys,
+ true, nullptr);
GfErrTypeToException(method, err);
// log any exceptions here
for (HashMapOfException::Iterator iter = exceptions->begin();
@@ -3092,11 +3028,11 @@ void ThinClientRegion::releaseGlobals(bool isFailover) {
// uint8_t getResult, ResultCollectorPtr rc, int32_t retryAttempts,
// uint32_t timeout) {
// int32_t attempt = 0;
-// CacheableHashSetPtr failedNodes = NULLPTR;
+// CacheableHashSetPtr failedNodes = nullptr;
//
// //CacheableStringArrayPtr csArray = poolDM->getServers();
//
-// //if (csArray != NULLPTR && csArray->length() != 0) {
+// //if (csArray != nullptr && csArray->length() != 0) {
// // for (int i = 0; i < csArray->length(); i++) {
// // CacheableStringPtr cs = csArray[i];
// // TcrEndpoint *ep = NULL;
@@ -3157,7 +3093,7 @@ void ThinClientRegion::releaseGlobals(bool isFailover) {
// resultCollector->getFunctionExecutionResults();
// return values;
// }
-// return NULLPTR;
+// return nullptr;
//}
void ThinClientRegion::executeFunction(const char* func,
@@ -3215,7 +3151,7 @@ void ThinClientRegion::executeFunction(const char* func,
rc->clearResults();
CacheableHashSetPtr failedNodesIds(reply.getFailedNode());
failedNodes->clear();
- if (failedNodesIds != NULLPTR && failedNodesIds->size() > 0) {
+ if (failedNodesIds != nullptr && failedNodesIds->size() > 0) {
LOGDEBUG(
"ThinClientRegion::executeFunction with GF_FUNCTION_EXCEPTION "
"failedNodesIds size = %d ",
@@ -3310,7 +3246,7 @@ CacheableVectorPtr ThinClientRegion::reExecuteFunction(
rc->clearResults();
CacheableHashSetPtr failedNodesIds(reply.getFailedNode());
failedNodes->clear();
- if (failedNodesIds != NULLPTR && failedNodesIds->size() > 0) {
+ if (failedNodesIds != nullptr && failedNodesIds->size() > 0) {
LOGDEBUG(
"ThinClientRegion::reExecuteFunction with GF_FUNCTION_EXCEPTION "
"failedNodesIds size = %d ",
@@ -3341,7 +3277,7 @@ CacheableVectorPtr ThinClientRegion::reExecuteFunction(
}
}
} while (reExecute);
- return NULLPTR;
+ return nullptr;
}
bool ThinClientRegion::executeFunctionSH(
@@ -3402,7 +3338,7 @@ bool ThinClientRegion::executeFunctionSH(
rc->clearResults();
}
CacheableHashSetPtr failedNodeIds(currentReply->getFailedNode());
- if (failedNodeIds != NULLPTR && failedNodeIds->size() > 0) {
+ if (failedNodeIds != nullptr && failedNodeIds->size() > 0) {
LOGDEBUG(
"ThinClientRegion::executeFunctionSH with GF_FUNCTION_EXCEPTION "
"failedNodeIds size = %d ",
@@ -3532,7 +3468,7 @@ void ThinClientRegion::txPut(const CacheableKeyPtr& key,
}
void ChunkedInterestResponse::reset() {
- if (m_resultKeys != NULLPTR && m_resultKeys->size() > 0) {
+ if (m_resultKeys != nullptr && m_resultKeys->size() > 0) {
m_resultKeys->clear();
}
}
@@ -3555,8 +3491,8 @@ void ChunkedInterestResponse::handleChunk(const uint8_t* chunk,
return;
}
- if (m_resultKeys == NULLPTR) {
- GF_NEW(m_resultKeys, VectorOfCacheableKey);
+ if (m_resultKeys == nullptr) {
+ m_resultKeys = std::make_shared<VectorOfCacheableKey>();
}
serializer::readObject(input, *m_resultKeys);
m_replyMsg.readSecureObjectPart(input, false, true, isLastChunkWithSecurity);
@@ -3835,7 +3771,7 @@ void ChunkedFunctionExecutionResponse::handleChunk(
if (static_cast<TcrMessageHelper::ChunkObjectType>(arrayType) ==
TcrMessageHelper::NULL_OBJECT) {
LOGDEBUG("ChunkedFunctionExecutionResponse::handleChunk NULL object");
- // m_functionExecutionResults->push_back(NULLPTR);
+ // m_functionExecutionResults->push_back(nullptr);
m_msg.readSecureObjectPart(input, false, true, isLastChunkWithSecurity);
return;
}
@@ -3924,14 +3860,13 @@ void ChunkedFunctionExecutionResponse::handleChunk(
} else {
value = CacheableString::create("Function exception result.");
}
- if (m_rc != NULLPTR) {
- CacheablePtr result = NULLPTR;
+ if (m_rc != nullptr) {
+ CacheablePtr result = nullptr;
if (isExceptionPart) {
- UserFunctionExecutionExceptionPtr uFEPtr(
- new UserFunctionExecutionException(value->toString()));
- result = dynCast<CacheablePtr>(uFEPtr);
+ result =
+ std::make_shared<UserFunctionExecutionException>(value->toString());
} else {
- result = dynCast<CacheablePtr>(value);
+ result = std::dynamic_pointer_cast<Cacheable>(value);
}
if (m_resultCollectorLock.get() != 0) {
ACE_Guard<ACE_Recursive_Thread_Mutex> guard(*m_resultCollectorLock);
@@ -3947,7 +3882,7 @@ void ChunkedFunctionExecutionResponse::handleChunk(
void ChunkedGetAllResponse::reset() {
m_keysOffset = 0;
- if (m_resultKeys != NULLPTR && m_resultKeys->size() > 0) {
+ if (m_resultKeys != nullptr && m_resultKeys->size() > 0) {
m_resultKeys->clear();
}
}
@@ -3978,14 +3913,14 @@ void ChunkedGetAllResponse::handleChunk(const uint8_t* chunk, int32_t chunkLen,
}
void ChunkedGetAllResponse::add(const ChunkedGetAllResponse* other) {
- if (m_values != NULLPTR) {
+ if (m_values != nullptr) {
for (HashMapOfCacheable::Iterator iter = other->m_values->begin();
iter != other->m_values->end(); iter++) {
m_values->insert(iter.first(), iter.second());
}
}
- if (m_exceptions != NULLPTR) {
+ if (m_exceptions != nullptr) {
for (HashMapOfException::Iterator iter = other->m_exceptions->begin();
iter != other->m_exceptions->end(); iter++) {
m_exceptions->insert(iter.first(), iter.second());
@@ -3997,7 +3932,7 @@ void ChunkedGetAllResponse::add(const ChunkedGetAllResponse* other) {
m_trackerMap[iter->first] = iter->second;
}
- if (m_resultKeys != NULLPTR) {
+ if (m_resultKeys != nullptr) {
for (VectorOfCacheableKey::Iterator iter = other->m_resultKeys->begin();
iter != other->m_resultKeys->end(); iter++) {
m_resultKeys->push_back(*iter);
@@ -4006,7 +3941,7 @@ void ChunkedGetAllResponse::add(const ChunkedGetAllResponse* other) {
}
void ChunkedPutAllResponse::reset() {
- if (m_list != NULLPTR && m_list->size() > 0) {
+ if (m_list != nullptr && m_list->size() > 0) {
m_list->getVersionedTagptr().clear();
}
}
@@ -4034,9 +3969,8 @@ void ChunkedPutAllResponse::handleChunk(const uint8_t* chunk, int32_t chunkLen,
TcrMessageHelper::OBJECT) {
LOGDEBUG("ChunkedPutAllResponse::handleChunk object");
ACE_Recursive_Thread_Mutex responseLock;
- VersionedCacheableObjectPartListPtr vcObjPart(
- new VersionedCacheableObjectPartList(
- m_msg.getChunkedResultHandler()->getEndpointMemId(), responseLock));
+ auto vcObjPart = std::make_shared<VersionedCacheableObjectPartList>(
+ m_msg.getChunkedResultHandler()->getEndpointMemId(), responseLock);
vcObjPart->fromData(input);
m_list->addAll(vcObjPart);
m_msg.readSecureObjectPart(input, false, true, isLastChunkWithSecurity);
@@ -4051,9 +3985,9 @@ void ChunkedPutAllResponse::handleChunk(const uint8_t* chunk, int32_t chunkLen,
m_msg.readSecureObjectPart(input, false, true, isLastChunkWithSecurity);
PoolPtr pool = PoolManager::find(m_msg.getPoolName());
- if (pool != NULLPTR && !pool->isDestroyed() &&
+ if (pool != nullptr && !pool->isDestroyed() &&
pool->getPRSingleHopEnabled()) {
- ThinClientPoolDM* poolDM = dynamic_cast<ThinClientPoolDM*>(pool.ptr());
+ ThinClientPoolDM* poolDM = dynamic_cast<ThinClientPoolDM*>(pool.get());
if ((poolDM != NULL) && (poolDM->getClientMetaDataService() != NULL) &&
(byte0 != 0)) {
LOGFINE(
@@ -4068,7 +4002,7 @@ void ChunkedPutAllResponse::handleChunk(const uint8_t* chunk, int32_t chunkLen,
}
void ChunkedRemoveAllResponse::reset() {
- if (m_list != NULLPTR && m_list->size() > 0) {
+ if (m_list != nullptr && m_list->size() > 0) {
m_list->getVersionedTagptr().clear();
}
}
@@ -4097,9 +4031,8 @@ void ChunkedRemoveAllResponse::handleChunk(const uint8_t* chunk,
TcrMessageHelper::OBJECT) {
LOGDEBUG("ChunkedRemoveAllResponse::handleChunk object");
ACE_Recursive_Thread_Mutex responseLock;
- VersionedCacheableObjectPartListPtr vcObjPart(
- new VersionedCacheableObjectPartList(
- m_msg.getChunkedResultHandler()->getEndpointMemId(), responseLock));
+ auto vcObjPart = std::make_shared<VersionedCacheableObjectPartList>(
+ m_msg.getChunkedResultHandler()->getEndpointMemId(), responseLock);
vcObjPart->fromData(input);
m_list->addAll(vcObjPart);
m_msg.readSecureObjectPart(input, false, true, isLastChunkWithSecurity);
@@ -4115,9 +4048,9 @@ void ChunkedRemoveAllResponse::handleChunk(const uint8_t* chunk,
m_msg.readSecureObjectPart(input, false, true, isLastChunkWithSecurity);
PoolPtr pool = PoolManager::find(m_msg.getPoolName());
- if (pool != NULLPTR && !pool->isDestroyed() &&
+ if (pool != nullptr && !pool->isDestroyed() &&
pool->getPRSingleHopEnabled()) {
- ThinClientPoolDM* poolDM = dynamic_cast<ThinClientPoolDM*>(pool.ptr());
+ ThinClientPoolDM* poolDM = dynamic_cast<ThinClientPoolDM*>(pool.get());
if ((poolDM != NULL) && (poolDM->getClientMetaDataService() != NULL) &&
(byte0 != 0)) {
LOGFINE(
@@ -4132,7 +4065,7 @@ void ChunkedRemoveAllResponse::handleChunk(const uint8_t* chunk,
}
void ChunkedDurableCQListResponse::reset() {
- if (m_resultList != NULLPTR && m_resultList->length() > 0) {
+ if (m_resultList != nullptr && m_resultList->length() > 0) {
m_resultList->clear();
}
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/ThinClientRegion.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ThinClientRegion.hpp b/src/cppcache/src/ThinClientRegion.hpp
index 1d65fee..e124ceb 100644
--- a/src/cppcache/src/ThinClientRegion.hpp
+++ b/src/cppcache/src/ThinClientRegion.hpp
@@ -55,7 +55,8 @@ class CPPCACHE_EXPORT ThinClientRegion : public LocalRegion {
* @brief constructor/initializer/destructor
*/
ThinClientRegion(const std::string& name, CacheImpl* cache,
- RegionInternal* rPtr, const RegionAttributesPtr& attributes,
+ const RegionInternalPtr& rPtr,
+ const RegionAttributesPtr& attributes,
const CacheStatisticsPtr& stats, bool shared = false);
virtual void initTCR();
virtual ~ThinClientRegion();
@@ -70,17 +71,17 @@ class CPPCACHE_EXPORT ThinClientRegion : public LocalRegion {
bool receiveValues = true);
virtual void unregisterKeys(const VectorOfCacheableKey& keys);
virtual void registerAllKeys(bool isDurable = false,
- VectorOfCacheableKeyPtr resultKeys = NULLPTR,
+ VectorOfCacheableKeyPtr resultKeys = nullptr,
bool getInitialValues = false,
bool receiveValues = true);
virtual void unregisterAllKeys();
virtual void registerRegex(const char* regex, bool isDurable = false,
- VectorOfCacheableKeyPtr resultKeys = NULLPTR,
+ VectorOfCacheableKeyPtr resultKeys = nullptr,
bool getInitialValues = false,
bool receiveValues = true);
virtual void unregisterRegex(const char* regex);
virtual void serverKeys(VectorOfCacheableKey& v);
- virtual void clear(const UserDataPtr& aCallbackArgument = NULLPTR);
+ virtual void clear(const UserDataPtr& aCallbackArgument = nullptr);
virtual SelectResultsPtr query(
const char* predicate, uint32_t timeout = DEFAULT_QUERY_RESPONSE_TIMEOUT);
@@ -96,11 +97,11 @@ class CPPCACHE_EXPORT ThinClientRegion : public LocalRegion {
const HashMapOfCacheable& map,
VersionedCacheableObjectPartListPtr& versionedObjPartList,
uint32_t timeout = DEFAULT_RESPONSE_TIMEOUT,
- const UserDataPtr& aCallbackArgument = NULLPTR);
+ const UserDataPtr& aCallbackArgument = nullptr);
GfErrType removeAllNoThrow_remote(
const VectorOfCacheableKey& keys,
VersionedCacheableObjectPartListPtr& versionedObjPartList,
- const UserDataPtr& aCallbackArgument = NULLPTR);
+ const UserDataPtr& aCallbackArgument = nullptr);
GfErrType registerKeys(TcrEndpoint* endpoint = NULL,
const TcrMessage* request = NULL,
TcrMessageReply* reply = NULL);
@@ -131,7 +132,7 @@ class CPPCACHE_EXPORT ThinClientRegion : public LocalRegion {
void localInvalidateFailover();
- inline ThinClientBaseDM* getDistMgr() { return m_tcrdm; }
+ inline ThinClientBaseDM* getDistMgr() const { return m_tcrdm; }
CacheableVectorPtr reExecuteFunction(
const char* func, const CacheablePtr& args, CacheableVectorPtr routingObj,
@@ -217,7 +218,7 @@ class CPPCACHE_EXPORT ThinClientRegion : public LocalRegion {
GfErrType registerRegexNoThrow(
const std::string& regex, bool attemptFailover = true,
TcrEndpoint* endpoint = NULL, bool isDurable = false,
- VectorOfCacheableKeyPtr resultKeys = NULLPTR,
+ VectorOfCacheableKeyPtr resultKeys = nullptr,
InterestResultPolicy interestPolicy = InterestResultPolicy::NONE,
bool receiveValues = true, TcrMessageReply* reply = NULL);
GfErrType unregisterRegexNoThrow(const std::string& regex,
@@ -300,21 +301,21 @@ class CPPCACHE_EXPORT ThinClientRegion : public LocalRegion {
ThinClientPoolDM* tcrdm, const HashMapOfCacheable& map,
VersionedCacheableObjectPartListPtr& versionedObjPartList,
uint32_t timeout = DEFAULT_RESPONSE_TIMEOUT,
- const UserDataPtr& aCallbackArgument = NULLPTR);
+ const UserDataPtr& aCallbackArgument = nullptr);
GfErrType multiHopPutAllNoThrow_remote(
const HashMapOfCacheable& map,
VersionedCacheableObjectPartListPtr& versionedObjPartList,
uint32_t timeout = DEFAULT_RESPONSE_TIMEOUT,
- const UserDataPtr& aCallbackArgument = NULLPTR);
+ const UserDataPtr& aCallbackArgument = nullptr);
GfErrType singleHopRemoveAllNoThrow_remote(
ThinClientPoolDM* tcrdm, const VectorOfCacheableKey& keys,
VersionedCacheableObjectPartListPtr& versionedObjPartList,
- const UserDataPtr& aCallbackArgument = NULLPTR);
+ const UserDataPtr& aCallbackArgument = nullptr);
GfErrType multiHopRemoveAllNoThrow_remote(
const VectorOfCacheableKey& keys,
VersionedCacheableObjectPartListPtr& versionedObjPartList,
- const UserDataPtr& aCallbackArgument = NULLPTR);
+ const UserDataPtr& aCallbackArgument = nullptr);
ACE_RW_Thread_Mutex m_RegionMutex;
bool m_isMetaDataRefreshed;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/ThinClientStickyManager.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ThinClientStickyManager.cpp b/src/cppcache/src/ThinClientStickyManager.cpp
index 5d5a228..cfac1db 100644
--- a/src/cppcache/src/ThinClientStickyManager.cpp
+++ b/src/cppcache/src/ThinClientStickyManager.cpp
@@ -64,15 +64,15 @@ void ThinClientStickyManager::addStickyConnection(TcrConnection* conn) {
if (it != m_stickyConnList.end()) {
oldConn->setAndGetBeingUsed(false, false);
m_stickyConnList.erase(it);
- PoolPtr p = NULLPTR;
+ PoolPtr p = nullptr;
TssConnectionWrapper::s_geodeTSSConn->setConnection(NULL, p);
m_dm->put(oldConn, false);
}
}
if (conn) {
- PoolPtr p(m_dm);
- TssConnectionWrapper::s_geodeTSSConn->setConnection(conn, p);
+ TssConnectionWrapper::s_geodeTSSConn->setConnection(
+ conn, m_dm->shared_from_this());
conn->setAndGetBeingUsed(true, true); // this is done for transaction
// thread when some one resume
// transaction
@@ -86,16 +86,16 @@ void ThinClientStickyManager::setStickyConnection(TcrConnection* conn,
// ACE_Guard<ACE_Recursive_Thread_Mutex> guard( m_stickyLock );
if (!conn) {
ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_stickyLock);
- PoolPtr p = NULLPTR;
- TssConnectionWrapper::s_geodeTSSConn->setConnection(NULL, p);
+ TssConnectionWrapper::s_geodeTSSConn->setConnection(
+ NULL, m_dm->shared_from_this());
} else {
TcrConnection* currentConn =
TssConnectionWrapper::s_geodeTSSConn->getConnection();
if (currentConn != conn) // otherwsie no need to set it again
{
ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_stickyLock);
- PoolPtr p(m_dm);
- TssConnectionWrapper::s_geodeTSSConn->setConnection(conn, p);
+ TssConnectionWrapper::s_geodeTSSConn->setConnection(
+ conn, m_dm->shared_from_this());
conn->setAndGetBeingUsed(
false,
forTransaction); // if transaction then it will keep this as used
@@ -200,11 +200,11 @@ void ThinClientStickyManager::releaseThreadLocalConnection() {
false); // now this can be used by next one
m_dm->put(conn, false);
}
- PoolPtr p(m_dm);
- TssConnectionWrapper::s_geodeTSSConn->setConnection(NULL, p);
+ TssConnectionWrapper::s_geodeTSSConn->setConnection(
+ NULL, m_dm->shared_from_this());
}
- PoolPtr p(m_dm);
- TssConnectionWrapper::s_geodeTSSConn->releaseSHConnections(p);
+ TssConnectionWrapper::s_geodeTSSConn->releaseSHConnections(
+ m_dm->shared_from_this());
}
bool ThinClientStickyManager::isNULL(TcrConnection** conn) {
if (*conn == NULL) return true;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/TombstoneList.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/TombstoneList.cpp b/src/cppcache/src/TombstoneList.cpp
index 56123cc..c884f76 100644
--- a/src/cppcache/src/TombstoneList.cpp
+++ b/src/cppcache/src/TombstoneList.cpp
@@ -42,8 +42,8 @@ long TombstoneList::getExpiryTask(TombstoneExpiryHandler** handler) {
uint32_t duration =
DistributedSystem::getSystemProperties()->tombstoneTimeoutInMSec() / 1000;
ACE_Time_Value currTime(ACE_OS::gettimeofday());
- TombstoneEntryPtr tombstoneEntryPtr = TombstoneEntryPtr(
- new TombstoneEntry(NULL, static_cast<int64_t>(currTime.get_msec())));
+ auto tombstoneEntryPtr = std::make_shared<TombstoneEntry>(
+ nullptr, static_cast<int64_t>(currTime.get_msec()));
*handler = new TombstoneExpiryHandler(tombstoneEntryPtr, this, duration);
tombstoneEntryPtr->setHandler(*handler);
long id =
@@ -51,7 +51,7 @@ long TombstoneList::getExpiryTask(TombstoneExpiryHandler** handler) {
return id;
}
-void TombstoneList::add(RegionInternal* rptr, MapEntryImpl* entry,
+void TombstoneList::add(RegionInternal* rptr, const MapEntryImplPtr& entry,
TombstoneExpiryHandler* handler, long taskid) {
// This function is not guarded as all functions of this class are called from
// MapSegment
@@ -59,8 +59,8 @@ void TombstoneList::add(RegionInternal* rptr, MapEntryImpl* entry,
// uint32_t duration =
// DistributedSystem::getSystemProperties()->tombstoneTimeoutInMSec()/1000;
ACE_Time_Value currTime(ACE_OS::gettimeofday());
- TombstoneEntryPtr tombstoneEntryPtr = TombstoneEntryPtr(
- new TombstoneEntry(entry, static_cast<int64_t>(currTime.get_msec())));
+ auto tombstoneEntryPtr = std::make_shared<TombstoneEntry>(
+ entry, static_cast<int64_t>(currTime.get_msec()));
// TombstoneExpiryHandler* handler = new
// TombstoneExpiryHandler(tombstoneEntryPtr, this, duration);
handler->setTombstoneEntry(tombstoneEntryPtr);
@@ -91,9 +91,8 @@ void TombstoneList::reapTombstones(std::map<uint16_t, int64_t>& gcVersions) {
// This function is not guarded as all functions of this class are called from
// MapSegment
std::unordered_set<CacheableKeyPtr> tobeDeleted;
- for (HashMapT<CacheableKeyPtr, TombstoneEntryPtr>::Iterator queIter =
- m_tombstoneMap.begin();
- queIter != m_tombstoneMap.end(); ++queIter) {
+ for (auto queIter = m_tombstoneMap.begin(); queIter != m_tombstoneMap.end();
+ ++queIter) {
std::map<uint16_t, int64_t>::iterator mapIter = gcVersions.find(
queIter.second()->getEntry()->getVersionStamp().getMemberId());
@@ -106,8 +105,7 @@ void TombstoneList::reapTombstones(std::map<uint16_t, int64_t>& gcVersions) {
tobeDeleted.insert(queIter.first());
}
}
- for (std::unordered_set<CacheableKeyPtr>::iterator itr = tobeDeleted.begin();
- itr != tobeDeleted.end(); itr++) {
+ for (auto itr = tobeDeleted.begin(); itr != tobeDeleted.end(); itr++) {
unguardedRemoveEntryFromMapSegment(*itr);
}
}
@@ -116,8 +114,8 @@ void TombstoneList::reapTombstones(std::map<uint16_t, int64_t>& gcVersions) {
void TombstoneList::reapTombstones(CacheableHashSetPtr removedKeys) {
// This function is not guarded as all functions of this class are called from
// MapSegment
- for (HashSetT<CacheableKeyPtr>::Iterator queIter = removedKeys->begin();
- queIter != removedKeys->end(); ++queIter) {
+ for (auto queIter = removedKeys->begin(); queIter != removedKeys->end();
+ ++queIter) {
unguardedRemoveEntryFromMapSegment(*queIter);
}
}
@@ -131,12 +129,12 @@ void TombstoneList::unguardedRemoveEntryFromMapSegment(CacheableKeyPtr key) {
m_mapSegment->unguardedRemoveActualEntry(key);
}
-void TombstoneList::eraseEntryFromTombstoneList(CacheableKeyPtr key,
+void TombstoneList::eraseEntryFromTombstoneList(const CacheableKeyPtr& key,
RegionInternal* region,
bool cancelTask) {
// This function is not guarded as all functions of this class are called from
// MapSegment
- bool exists = (key != NULLPTR) ? m_tombstoneMap.contains(key) : false;
+ bool exists = (key != nullptr) ? m_tombstoneMap.contains(key) : false;
if (cancelTask && exists) {
CacheImpl::expiryTaskManager->cancelTask(
static_cast<long>(m_tombstoneMap[key]->getExpiryTaskId()));
@@ -151,11 +149,11 @@ void TombstoneList::eraseEntryFromTombstoneList(CacheableKeyPtr key,
}
long TombstoneList::eraseEntryFromTombstoneListWithoutCancelTask(
- CacheableKeyPtr key, RegionInternal* region,
+ const CacheableKeyPtr& key, RegionInternal* region,
TombstoneExpiryHandler*& handler) {
// This function is not guarded as all functions of this class are called from
// MapSegment
- bool exists = (key != NULLPTR) ? m_tombstoneMap.contains(key) : false;
+ bool exists = (key != nullptr) ? m_tombstoneMap.contains(key) : false;
long taskid = -1;
if (exists) {
taskid = static_cast<long>(m_tombstoneMap[key]->getExpiryTaskId());
@@ -168,7 +166,8 @@ long TombstoneList::eraseEntryFromTombstoneListWithoutCancelTask(
return taskid;
}
-bool TombstoneList::getEntryFromTombstoneList(CacheableKeyPtr key) {
+bool TombstoneList::getEntryFromTombstoneList(
+ const CacheableKeyPtr& key) const {
// This function is not guarded as all functions of this class are called from
// MapSegment
return m_tombstoneMap.contains(key);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/TombstoneList.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/TombstoneList.hpp b/src/cppcache/src/TombstoneList.hpp
index e7ecc2d..5f45a17 100644
--- a/src/cppcache/src/TombstoneList.hpp
+++ b/src/cppcache/src/TombstoneList.hpp
@@ -36,7 +36,7 @@ class MapSegment;
class TombstoneExpiryHandler;
class TombstoneEntry : public SharedBase {
public:
- TombstoneEntry(MapEntryImpl* entry, int64_t tombstoneCreationTime)
+ TombstoneEntry(const MapEntryImplPtr& entry, int64_t tombstoneCreationTime)
: m_entry(entry),
m_tombstoneCreationTime(tombstoneCreationTime),
/* adongre
@@ -50,7 +50,7 @@ class TombstoneEntry : public SharedBase {
m_expiryTaskId(0),
m_handler(NULL) {}
virtual ~TombstoneEntry() {}
- MapEntryImpl* getEntry() { return m_entry; }
+ MapEntryImplPtr getEntry() { return m_entry; }
int64_t getTombstoneCreationTime() { return m_tombstoneCreationTime; }
int64_t getExpiryTaskId() { return m_expiryTaskId; }
void setExpiryTaskId(int64_t expiryTaskId) { m_expiryTaskId = expiryTaskId; }
@@ -58,7 +58,7 @@ class TombstoneEntry : public SharedBase {
void setHandler(TombstoneExpiryHandler* handler) { m_handler = handler; };
private:
- MapEntryImpl* m_entry;
+ MapEntryImplPtr m_entry;
int64_t m_tombstoneCreationTime;
int64_t m_expiryTaskId;
TombstoneExpiryHandler* m_handler;
@@ -69,7 +69,7 @@ class TombstoneList : public SharedBase {
public:
TombstoneList(MapSegment* mapSegment) { m_mapSegment = mapSegment; }
virtual ~TombstoneList() { cleanUp(); }
- void add(RegionInternal* rptr, MapEntryImpl* entry,
+ void add(RegionInternal* rptr, const MapEntryImplPtr& entry,
TombstoneExpiryHandler* handler, long taskID);
// Reaps the tombstones which have been gc'ed on server.
@@ -78,12 +78,13 @@ class TombstoneList : public SharedBase {
// value is passed as paramter
void reapTombstones(std::map<uint16_t, int64_t>& gcVersions);
void reapTombstones(CacheableHashSetPtr removedKeys);
- void eraseEntryFromTombstoneList(CacheableKeyPtr key, RegionInternal* region,
+ void eraseEntryFromTombstoneList(const CacheableKeyPtr& key,
+ RegionInternal* region,
bool cancelTask = true);
long eraseEntryFromTombstoneListWithoutCancelTask(
- CacheableKeyPtr key, RegionInternal* region,
+ const CacheableKeyPtr& key, RegionInternal* region,
TombstoneExpiryHandler*& handler);
- bool getEntryFromTombstoneList(CacheableKeyPtr key);
+ bool getEntryFromTombstoneList(const CacheableKeyPtr& key) const;
void cleanUp();
long getExpiryTask(TombstoneExpiryHandler** handler);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/TrackedMapEntry.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/TrackedMapEntry.hpp b/src/cppcache/src/TrackedMapEntry.hpp
index 8765cf2..35879d2 100644
--- a/src/cppcache/src/TrackedMapEntry.hpp
+++ b/src/cppcache/src/TrackedMapEntry.hpp
@@ -30,15 +30,15 @@ class TrackedMapEntry : public MapEntry {
public:
// Constructor should be invoked only when starting the tracking
// of a MapEntry, so m_trackingNumber is initialized with 1.
- inline TrackedMapEntry(const MapEntryImpl* entry, int trackingNumber,
+ inline TrackedMapEntry(const MapEntryImplPtr& entry, int trackingNumber,
int updateCount)
- : m_entry(entry),
+ : m_entry(const_cast<MapEntryImplPtr&>(entry)),
m_trackingNumber(trackingNumber),
m_updateCount(updateCount) {}
virtual ~TrackedMapEntry() {}
- virtual MapEntryImpl* getImplPtr() { return m_entry.ptr(); }
+ virtual MapEntryImplPtr getImplPtr() { return m_entry; }
virtual int addTracker(MapEntryPtr& newEntry) {
++m_trackingNumber;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/TransactionalOperation.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/TransactionalOperation.cpp b/src/cppcache/src/TransactionalOperation.cpp
index 7241f0e..3627077 100644
--- a/src/cppcache/src/TransactionalOperation.cpp
+++ b/src/cppcache/src/TransactionalOperation.cpp
@@ -42,7 +42,7 @@ TransactionalOperation::TransactionalOperation(ServerRegionOperation op,
TransactionalOperation::~TransactionalOperation() {}
CacheablePtr TransactionalOperation::replay(Cache* cache) {
- CacheablePtr result = NULLPTR;
+ CacheablePtr result = nullptr;
switch (m_operation) {
case GF_CONTAINS_KEY:
@@ -68,13 +68,18 @@ CacheablePtr TransactionalOperation::replay(Cache* cache) {
} else {
execution = FunctionService::onRegion(cache->getRegion(m_regionName));
}
- result =
+ // TODO shared_ptr no clear path between types.
+ result = std::dynamic_pointer_cast<Cacheable>(
execution->withArgs(m_arguments->at(0))
- ->withFilter(m_arguments->at(1))
- ->withCollector(m_arguments->at(2))
- ->execute(m_arguments->at(3)->toString()->asChar(),
- (static_cast<CacheableInt32Ptr>(m_arguments->at(4)))
- ->value());
+ ->withFilter(
+ std::static_pointer_cast<CacheableVector>(m_arguments->at(1)))
+ // TODO shared_ptr - no path between types?
+ ->withCollector(std::dynamic_pointer_cast<ResultCollector>(
+ m_arguments->at(2)))
+ ->execute(
+ m_arguments->at(3)->toString()->asChar(),
+ std::static_pointer_cast<CacheableInt32>(m_arguments->at(4))
+ ->value()));
} break;
case GF_GET:
result = cache->getRegion(m_regionName)->get(m_key, m_arguments->at(0));
@@ -86,9 +91,15 @@ CacheablePtr TransactionalOperation::replay(Cache* cache) {
case GF_GET_ALL:
cache->getRegion(m_regionName)
->getAll(
- *(static_cast<VectorOfCacheableKeyPtr>(m_arguments->at(0))).ptr(),
- m_arguments->at(1), m_arguments->at(2),
- (static_cast<CacheableBooleanPtr>(m_arguments->at(3)))->value());
+ // TODO shared_ptr - no path between types?
+ *std::dynamic_pointer_cast<VectorOfCacheableKey>(
+ m_arguments->at(0)),
+ // TODO shared_ptr - no path between types?
+ std::dynamic_pointer_cast<HashMapOfCacheable>(m_arguments->at(1)),
+ // TODO shared_ptr - no path between types?
+ std::dynamic_pointer_cast<HashMapOfException>(m_arguments->at(2)),
+ std::static_pointer_cast<CacheableBoolean>(m_arguments->at(3))
+ ->value());
break;
case GF_INVALIDATE:
cache->getRegion(m_regionName)->invalidate(m_key, m_arguments->at(0));
@@ -99,9 +110,9 @@ CacheablePtr TransactionalOperation::replay(Cache* cache) {
break;
case GF_KEY_SET:
cache->getRegion(m_regionName)
- ->serverKeys(
- *(static_cast<VectorOfCacheableKeyPtr>(m_arguments->at(0)))
- .ptr());
+ // TODO shared_ptr - no path between types?
+ ->serverKeys(*std::dynamic_pointer_cast<VectorOfCacheableKey>(
+ m_arguments->at(0)));
break;
case GF_CREATE: // includes PUT_IF_ABSENT
cache->getRegion(m_regionName)
@@ -113,9 +124,11 @@ CacheablePtr TransactionalOperation::replay(Cache* cache) {
break;
case GF_PUT_ALL:
cache->getRegion(m_regionName)
- ->putAll(
- *(static_cast<HashMapOfCacheablePtr>(m_arguments->at(0))).ptr(),
- (static_cast<CacheableInt32Ptr>(m_arguments->at(1)))->value());
+ // TODO shared_ptr - no path between types?
+ ->putAll(*std::dynamic_pointer_cast<HashMapOfCacheable>(
+ m_arguments->at(0)),
+ std::static_pointer_cast<CacheableInt32>(m_arguments->at(1))
+ ->value());
break;
default:
throw UnsupportedOperationException(
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/TssConnectionWrapper.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/TssConnectionWrapper.cpp b/src/cppcache/src/TssConnectionWrapper.cpp
index adb6e42..a30cc3d 100644
--- a/src/cppcache/src/TssConnectionWrapper.cpp
+++ b/src/cppcache/src/TssConnectionWrapper.cpp
@@ -20,7 +20,7 @@
using namespace apache::geode::client;
ACE_TSS<TssConnectionWrapper> TssConnectionWrapper::s_geodeTSSConn;
TssConnectionWrapper::TssConnectionWrapper() {
- PoolPtr p = NULLPTR;
+ PoolPtr p = nullptr;
m_pool = p;
m_tcrConn = NULL;
}
@@ -117,7 +117,7 @@ void PoolWrapper::releaseSHConnections(PoolPtr pool) {
iter != m_EpnameVsConnection.end(); iter++) {
TcrConnection* tmp = iter->second;
tmp->setAndGetBeingUsed(false, false); // now this can be used by next one
- ThinClientPoolDM* dm = dynamic_cast<ThinClientPoolDM*>(pool.ptr());
+ ThinClientPoolDM* dm = dynamic_cast<ThinClientPoolDM*>(pool.get());
if (dm != NULL) {
dm->put(tmp, false);
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/TssConnectionWrapper.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/TssConnectionWrapper.hpp b/src/cppcache/src/TssConnectionWrapper.hpp
index 43b97ff..e37d062 100644
--- a/src/cppcache/src/TssConnectionWrapper.hpp
+++ b/src/cppcache/src/TssConnectionWrapper.hpp
@@ -61,7 +61,7 @@ class TssConnectionWrapper {
static ACE_TSS<TssConnectionWrapper> s_geodeTSSConn;
TcrConnection* getConnection() { return m_tcrConn; }
TcrConnection* getSHConnection(TcrEndpoint* ep, const char* poolname);
- void setConnection(TcrConnection* conn, PoolPtr& pool) {
+ void setConnection(TcrConnection* conn, const PoolPtr& pool) {
m_tcrConn = conn;
m_pool = pool;
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/UserAttributes.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/UserAttributes.cpp b/src/cppcache/src/UserAttributes.cpp
index ae3b8af..43bb3fc 100644
--- a/src/cppcache/src/UserAttributes.cpp
+++ b/src/cppcache/src/UserAttributes.cpp
@@ -117,7 +117,7 @@ PropertiesPtr UserAttributes::getCredentials() {
if (m_proxyCache->isClosed()) {
throw IllegalStateException("User cache has been closed");
}
- if (m_credentials == NULLPTR) {
+ if (m_credentials == nullptr) {
LOGDEBUG("getCredentials");
} else {
LOGDEBUG("getCredentials not null ");
@@ -137,7 +137,7 @@ GuardUserAttribures::GuardUserAttribures(ProxyCachePtr proxyCache) {
void GuardUserAttribures::setProxyCache(ProxyCachePtr proxyCache) {
m_proxyCache = proxyCache;
LOGDEBUG("GuardUserAttribures::GuardUserAttribures:");
- if (m_proxyCache != NULLPTR && !proxyCache->isClosed()) {
+ if (m_proxyCache != nullptr && !proxyCache->isClosed()) {
TSSUserAttributesWrapper::s_geodeTSSUserAttributes->setUserAttributes(
proxyCache->m_userAttributes);
} else {
@@ -145,11 +145,11 @@ void GuardUserAttribures::setProxyCache(ProxyCachePtr proxyCache) {
}
}
-GuardUserAttribures::GuardUserAttribures() { m_proxyCache = NULLPTR; }
+GuardUserAttribures::GuardUserAttribures() { m_proxyCache = nullptr; }
GuardUserAttribures::~GuardUserAttribures() {
- if (m_proxyCache != NULLPTR) {
+ if (m_proxyCache != nullptr) {
TSSUserAttributesWrapper::s_geodeTSSUserAttributes->setUserAttributes(
- NULLPTR);
+ nullptr);
}
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/UserAttributes.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/UserAttributes.hpp b/src/cppcache/src/UserAttributes.hpp
index d5c939e..7193cee 100644
--- a/src/cppcache/src/UserAttributes.hpp
+++ b/src/cppcache/src/UserAttributes.hpp
@@ -102,7 +102,7 @@ class CPPCACHE_EXPORT UserAttributes : public SharedBase {
return m_connectionAttr;
}
- void unSetCredentials() { m_credentials = NULLPTR; }
+ void unSetCredentials() { m_credentials = nullptr; }
bool isEndpointAuthenticated(TcrEndpoint* ep);
@@ -134,7 +134,7 @@ class TSSUserAttributesWrapper {
void setUserAttributes(UserAttributesPtr userAttr) {
m_userAttribute = userAttr;
}
- TSSUserAttributesWrapper() : m_userAttribute(NULLPTR) {}
+ TSSUserAttributesWrapper() : m_userAttribute(nullptr) {}
~TSSUserAttributesWrapper() {}
};
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/Utils.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/Utils.hpp b/src/cppcache/src/Utils.hpp
index b6a7a17..4ebb78b 100644
--- a/src/cppcache/src/Utils.hpp
+++ b/src/cppcache/src/Utils.hpp
@@ -36,6 +36,8 @@
#include <typeinfo>
#include <string>
#include <unordered_set>
+#include <memory>
+
#ifdef __GNUC__
extern "C" {
#include <cxxabi.h>
@@ -108,7 +110,7 @@ class CPPCACHE_EXPORT Utils {
inline static CacheableStringPtr getCacheableKeyString(
const CacheableKeyPtr& key) {
CacheableStringPtr result;
- if (key != NULLPTR) {
+ if (key != nullptr) {
char* buf;
GF_NEW(buf, char[_GF_MSG_LIMIT + 1]);
key->logString(buf, _GF_MSG_LIMIT);
@@ -124,13 +126,12 @@ class CPPCACHE_EXPORT Utils {
}
static CacheableStringPtr getCacheableString(const CacheablePtr& val) {
- if (val != NULLPTR) {
- if (instanceOf<CacheableKeyPtr>(val)) {
- const CacheableKeyPtr& key = staticCast<CacheableKeyPtr>(val);
+ if (val != nullptr) {
+ if (const auto key = std::dynamic_pointer_cast<CacheableKey>(val)) {
return getCacheableKeyString(key);
} else {
const CacheableStringPtr& cStr = val->toString();
- if (cStr != NULLPTR) {
+ if (cStr != nullptr) {
if (cStr->isCString()) {
return cStr;
} else {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/VersionStamp.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/VersionStamp.cpp b/src/cppcache/src/VersionStamp.cpp
index 1bacef9..7abbb85 100644
--- a/src/cppcache/src/VersionStamp.cpp
+++ b/src/cppcache/src/VersionStamp.cpp
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
#include "VersionStamp.hpp"
#include <string>
#include "MemberListForVersionStamp.hpp"
@@ -22,7 +23,9 @@
#include "ThinClientRegion.hpp"
#include "ThinClientPoolDM.hpp"
-using namespace apache::geode::client;
+namespace apache {
+namespace geode {
+namespace client {
void VersionStamp::setVersions(VersionTagPtr versionTag) {
int32_t eVersion = versionTag->getEntryVersion();
@@ -40,11 +43,11 @@ void VersionStamp::setVersions(VersionStamp& versionStamp) {
m_regionVersionLowBytes = versionStamp.m_regionVersionLowBytes;
m_memberID = versionStamp.m_memberID;
}
-int32_t VersionStamp::getEntryVersion() {
+int32_t VersionStamp::getEntryVersion() const {
return (m_entryVersionHighByte << 16) | m_entryVersionLowBytes;
}
-int64_t VersionStamp::getRegionVersion() {
+int64_t VersionStamp::getRegionVersion() const {
return ((static_cast<int64_t>(m_regionVersionHighBytes)) << 32) |
m_regionVersionLowBytes;
}
@@ -57,14 +60,15 @@ uint16_t VersionStamp::getMemberId() const { return m_memberID; }
// This is based on the basicprocessVersionTag function of
// AbstractRegionEntry.java
// Any change to the java function should be reflected here as well.
-GfErrType VersionStamp::processVersionTag(RegionInternal* region,
- CacheableKeyPtr keyPtr,
- VersionTagPtr tag, bool deltaCheck) {
+GfErrType VersionStamp::processVersionTag(const RegionInternal* region,
+ const CacheableKeyPtr& keyPtr,
+ const VersionTagPtr& tag,
+ const bool deltaCheck) const {
char key[256];
int16_t keyLen = keyPtr->logString(key, 256);
std::string keystr(key, keyLen);
- if (tag.ptr() == NULL) {
+ if (nullptr == tag) {
LOGERROR("Cannot process version tag as it is NULL.");
return GF_CACHE_ILLEGAL_STATE_EXCEPTION;
}
@@ -72,9 +76,10 @@ GfErrType VersionStamp::processVersionTag(RegionInternal* region,
return checkForConflict(region, keystr, tag, deltaCheck);
}
-GfErrType VersionStamp::checkForConflict(RegionInternal* region,
- std::string keystr, VersionTagPtr tag,
- bool deltaCheck) {
+GfErrType VersionStamp::checkForConflict(const RegionInternal* region,
+ const std::string& keystr,
+ const VersionTagPtr& tag,
+ const bool deltaCheck) const {
if (getEntryVersion() == 0 && getRegionVersion() == 0 && getMemberId() == 0) {
LOGDEBUG(
"Version stamp on existing entry not found. applying change: key=%s",
@@ -90,8 +95,7 @@ GfErrType VersionStamp::checkForConflict(RegionInternal* region,
}
int64_t stampVersion = getEntryVersion() & 0xffffffffL;
int64_t tagVersion = tag->getEntryVersion() & 0xffffffffL;
- MemberListForVersionStampPtr memberList =
- region->getCacheImpl()->getMemberListForVersionStamp();
+ auto memberList = region->getCacheImpl()->getMemberListForVersionStamp();
bool apply = false;
if (stampVersion != 0) {
// check for int wraparound on the version number
@@ -109,7 +113,7 @@ GfErrType VersionStamp::checkForConflict(RegionInternal* region,
}
if (deltaCheck) {
- GfErrType err =
+ auto err =
checkForDeltaConflict(region, keystr, stampVersion, tagVersion, tag);
if (err != GF_NOERR) return err;
}
@@ -121,8 +125,8 @@ GfErrType VersionStamp::checkForConflict(RegionInternal* region,
LOGDEBUG("disallowing change: key=%s", keystr.c_str());
} else {
// compare member IDs
- DSMemberForVersionStampPtr stampID = memberList->getDSMember(getMemberId());
- if (stampID == NULLPTR && stampID.ptr() == NULL) {
+ auto stampID = memberList->getDSMember(getMemberId());
+ if (nullptr == stampID) {
// This scenario is not possible. But added for just in case
LOGERROR(
"MemberId of the version stamp could not be found. Disallowing a "
@@ -131,9 +135,8 @@ GfErrType VersionStamp::checkForConflict(RegionInternal* region,
// throw error
return GF_CACHE_ILLEGAL_STATE_EXCEPTION;
}
- DSMemberForVersionStampPtr tagID =
- memberList->getDSMember(tag->getInternalMemID());
- if (tagID == NULLPTR && tagID.ptr() == NULL) {
+ auto tagID = memberList->getDSMember(tag->getInternalMemID());
+ if (nullptr == tagID) {
// This scenario is not possible. But added for just in case
LOGERROR(
"MemberId of the version tag could not be found. Disallowing a "
@@ -147,7 +150,7 @@ GfErrType VersionStamp::checkForConflict(RegionInternal* region,
"comparing tagID %s with stampId %s for version comparison of key %s",
tagID->getHashKey().c_str(), stampID->getHashKey().c_str(),
keystr.c_str());
- int compare = stampID->compareTo(tagID);
+ int compare = stampID->compareTo(*tagID);
if (compare < 0) {
LOGDEBUG("applying change: key=%s", keystr.c_str());
apply = true;
@@ -171,15 +174,14 @@ GfErrType VersionStamp::checkForConflict(RegionInternal* region,
return GF_NOERR;
}
-GfErrType VersionStamp::checkForDeltaConflict(RegionInternal* region,
- std::string keystr,
- int64_t stampVersion,
- int64_t tagVersion,
- VersionTagPtr tag) {
- MemberListForVersionStampPtr memberList =
- region->getCacheImpl()->getMemberListForVersionStamp();
- ThinClientRegion* tcRegion = dynamic_cast<ThinClientRegion*>(region);
- ThinClientPoolDM* poolDM = NULL;
+GfErrType VersionStamp::checkForDeltaConflict(const RegionInternal* region,
+ const std::string& keystr,
+ const int64_t stampVersion,
+ const int64_t tagVersion,
+ const VersionTagPtr& tag) const {
+ auto memberList = region->getCacheImpl()->getMemberListForVersionStamp();
+ auto tcRegion = dynamic_cast<const ThinClientRegion*>(region);
+ ThinClientPoolDM* poolDM = nullptr;
if (tcRegion) {
poolDM = dynamic_cast<ThinClientPoolDM*>(tcRegion->getDistMgr());
}
@@ -195,8 +197,8 @@ GfErrType VersionStamp::checkForDeltaConflict(RegionInternal* region,
} else {
// make sure the tag was based on the value in this entry by checking the
// tag's previous-changer ID against this stamp's current ID
- DSMemberForVersionStampPtr stampID = memberList->getDSMember(getMemberId());
- if (stampID.ptr() == NULL) {
+ auto stampID = memberList->getDSMember(getMemberId());
+ if (nullptr == stampID) {
LOGERROR(
"MemberId of the version stamp could not be found. Requesting full "
"delta value. key=%s",
@@ -205,9 +207,8 @@ GfErrType VersionStamp::checkForDeltaConflict(RegionInternal* region,
return GF_INVALID_DELTA;
}
- DSMemberForVersionStampPtr tagID =
- memberList->getDSMember(tag->getPreviousMemID());
- if (tagID.ptr() == NULL) {
+ auto tagID = memberList->getDSMember(tag->getPreviousMemID());
+ if (nullptr == tagID) {
LOGERROR(
"Previous MemberId of the version tag could not be found. Requesting "
"full delta value. key=%s",
@@ -216,7 +217,7 @@ GfErrType VersionStamp::checkForDeltaConflict(RegionInternal* region,
return GF_INVALID_DELTA;
}
- if (tagID->compareTo(stampID) != 0) {
+ if (tagID->compareTo(*stampID) != 0) {
LOGDEBUG(
"delta requires full value due to version mismatch. key=%s. \
tag.previous=%s but stamp.current=%s",
@@ -229,3 +230,6 @@ GfErrType VersionStamp::checkForDeltaConflict(RegionInternal* region,
return GF_NOERR;
}
}
+} // namespace client
+} // namespace geode
+} // namespace apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/VersionStamp.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/VersionStamp.hpp b/src/cppcache/src/VersionStamp.hpp
index aad0c18..6855c00 100644
--- a/src/cppcache/src/VersionStamp.hpp
+++ b/src/cppcache/src/VersionStamp.hpp
@@ -50,8 +50,8 @@ class CPPCACHE_EXPORT VersionStamp {
virtual ~VersionStamp() {}
void setVersions(VersionTagPtr versionTag);
void setVersions(VersionStamp& versionStamp);
- int32_t getEntryVersion();
- int64_t getRegionVersion();
+ int32_t getEntryVersion() const;
+ int64_t getRegionVersion() const;
uint16_t getMemberId() const;
VersionStamp& operator=(const VersionStamp& rhs) {
@@ -63,8 +63,10 @@ class CPPCACHE_EXPORT VersionStamp {
this->m_regionVersionLowBytes = rhs.m_regionVersionLowBytes;
return *this;
}
- GfErrType processVersionTag(RegionInternal* region, CacheableKeyPtr keyPtr,
- VersionTagPtr tag, bool deltaCheck);
+ GfErrType processVersionTag(const RegionInternal* region,
+ const CacheableKeyPtr& keyPtr,
+ const VersionTagPtr& tag,
+ const bool deltaCheck) const;
private:
uint16_t m_memberID;
@@ -72,11 +74,15 @@ class CPPCACHE_EXPORT VersionStamp {
uint16_t m_entryVersionLowBytes;
uint16_t m_regionVersionHighBytes;
uint32_t m_regionVersionLowBytes;
- GfErrType checkForConflict(RegionInternal* region, std::string keystr,
- VersionTagPtr tag, bool deltaCheck);
- GfErrType checkForDeltaConflict(RegionInternal* region, std::string keystr,
- int64_t stampVersion, int64_t tagVersion,
- VersionTagPtr tag);
+ GfErrType checkForConflict(const RegionInternal* region,
+ const std::string& keystr,
+ const VersionTagPtr& tag,
+ const bool deltaCheck) const;
+ GfErrType checkForDeltaConflict(const RegionInternal* region,
+ const std::string& keystr,
+ const int64_t stampVersion,
+ const int64_t tagVersion,
+ const VersionTagPtr& tag) const;
};
typedef SharedPtr<VersionStamp> VersionStampPtr;
} // namespace client
[34/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from clicache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/RegionEvent.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/RegionEvent.cpp b/src/clicache/src/RegionEvent.cpp
index ff3bb9d..3ee64d2 100644
--- a/src/clicache/src/RegionEvent.cpp
+++ b/src/clicache/src/RegionEvent.cpp
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-//#include "geode_includes.hpp"
#include "RegionEvent.hpp"
#include "Region.hpp"
#include "IGeodeSerializable.hpp"
@@ -30,42 +29,23 @@ namespace Apache
{
generic<class TKey, class TValue>
- RegionEvent<TKey, TValue>::RegionEvent(Client::IRegion<TKey, TValue>^ region,
- Object^ aCallbackArgument, bool remoteOrigin)
- : UMWrap( )
- {
- //TODO:: do we neeed this
- /*if ( region == nullptr ) {
- throw gcnew IllegalArgumentException( "RegionEvent.ctor(): "
- "null region passed" );
- }
-
- apache::geode::client::UserDataPtr callbackptr(SafeMSerializableConvert(
- aCallbackArgument));
-
- SetPtr(new apache::geode::client::RegionEvent(apache::geode::client::RegionPtr(region->_NativePtr),
- callbackptr, remoteOrigin), true);*/
- }
-
- generic<class TKey, class TValue>
IRegion<TKey, TValue>^ RegionEvent<TKey, TValue>::Region::get( )
{
- apache::geode::client::RegionPtr& regionptr( NativePtr->getRegion( ) );
-
- return Client::Region<TKey, TValue>::Create( regionptr.ptr( ) );
+ auto regionptr = m_nativeptr->getRegion( );
+ return Client::Region<TKey, TValue>::Create( regionptr );
}
generic<class TKey, class TValue>
Object^ RegionEvent<TKey, TValue>::CallbackArgument::get()
{
- apache::geode::client::UserDataPtr& valptr(NativePtr->getCallbackArgument());
+ apache::geode::client::UserDataPtr& valptr(m_nativeptr->getCallbackArgument());
return Serializable::GetManagedValueGeneric<Object^>( valptr );
}
generic<class TKey, class TValue>
bool RegionEvent<TKey, TValue>::RemoteOrigin::get( )
{
- return NativePtr->remoteOrigin( );
+ return m_nativeptr->remoteOrigin( );
} // namespace Client
} // namespace Geode
} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/RegionEvent.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/RegionEvent.hpp b/src/clicache/src/RegionEvent.hpp
index 1d9f23d..7554c13 100644
--- a/src/clicache/src/RegionEvent.hpp
+++ b/src/clicache/src/RegionEvent.hpp
@@ -18,8 +18,10 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/RegionEvent.hpp>
-//#include "impl/NativeWrapper.hpp"
+#include "end_native.hpp"
+
#include "IGeodeSerializable.hpp"
#include "IRegion.hpp"
#include "Region.hpp"
@@ -32,6 +34,7 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
//ref class Region;
@@ -40,20 +43,10 @@ namespace Apache
/// </summary>
generic<class TKey, class TValue>
public ref class RegionEvent sealed
- : public Client::Internal::UMWrap<apache::geode::client::RegionEvent>
{
public:
/// <summary>
- /// Constructor to create a <c>RegionEvent</c> for a given region.
- /// </summary>
- /// <exception cref="IllegalArgumentException">
- /// if region is null
- /// </exception>
- RegionEvent(IRegion<TKey, TValue>^ region, Object^ aCallbackArgument,
- bool remoteOrigin);
-
- /// <summary>
/// Return the region this event occurred in.
/// </summary>
property IRegion<TKey, TValue>^ Region
@@ -82,13 +75,22 @@ namespace Apache
internal:
+ const native::RegionEvent* GetNative()
+ {
+ return m_nativeptr;
+ }
+
/// <summary>
/// Internal constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline Apache::Geode::Client::RegionEvent<TKey, TValue>( const apache::geode::client::RegionEvent* nativeptr )
- : Apache::Geode::Client::Internal::UMWrap<apache::geode::client::RegionEvent>(
- const_cast<apache::geode::client::RegionEvent*>( nativeptr ), false ) { }
+ inline Apache::Geode::Client::RegionEvent<TKey, TValue>( const native::RegionEvent* nativeptr )
+ : m_nativeptr( nativeptr )
+ {
+ }
+
+ private:
+ const native::RegionEvent* m_nativeptr;
};
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/RegionFactory.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/RegionFactory.cpp b/src/clicache/src/RegionFactory.cpp
index 93a5e7a..f662a7c 100644
--- a/src/clicache/src/RegionFactory.cpp
+++ b/src/clicache/src/RegionFactory.cpp
@@ -17,9 +17,7 @@
#pragma once
-//#include "geode_includes.hpp"
#include "RegionFactory.hpp"
-//#include "AttributesFactory.hpp"
#include "RegionAttributes.hpp"
#include "impl/SafeConvert.hpp"
@@ -49,6 +47,7 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
RegionFactory^ RegionFactory::SetCacheLoader( String^ libPath, String^ factoryFunctionName )
{
@@ -56,8 +55,14 @@ namespace Apache
ManagedString mg_libpath( libPath );
ManagedString mg_factoryFunctionName( factoryFunctionName );
- NativePtr->setCacheLoader( mg_libpath.CharPtr,
- mg_factoryFunctionName.CharPtr );
+ try
+ {
+ m_nativeptr->get()->setCacheLoader( mg_libpath.CharPtr, mg_factoryFunctionName.CharPtr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
}
@@ -67,8 +72,14 @@ namespace Apache
ManagedString mg_libpath( libPath );
ManagedString mg_factoryFunctionName( factoryFunctionName );
- NativePtr->setCacheWriter( mg_libpath.CharPtr,
- mg_factoryFunctionName.CharPtr );
+ try
+ {
+ m_nativeptr->get()->setCacheWriter( mg_libpath.CharPtr, mg_factoryFunctionName.CharPtr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
}
@@ -78,8 +89,14 @@ namespace Apache
ManagedString mg_libpath( libPath );
ManagedString mg_factoryFunctionName( factoryFunctionName );
- NativePtr->setCacheListener( mg_libpath.CharPtr,
- mg_factoryFunctionName.CharPtr );
+ try
+ {
+ m_nativeptr->get()->setCacheListener( mg_libpath.CharPtr, mg_factoryFunctionName.CharPtr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
}
@@ -89,8 +106,14 @@ namespace Apache
ManagedString mg_libpath( libPath );
ManagedString mg_factoryFunctionName( factoryFunctionName );
- NativePtr->setPartitionResolver( mg_libpath.CharPtr,
- mg_factoryFunctionName.CharPtr );
+ try
+ {
+ m_nativeptr->get()->setPartitionResolver( mg_libpath.CharPtr, mg_factoryFunctionName.CharPtr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
}
@@ -98,29 +121,53 @@ namespace Apache
RegionFactory^ RegionFactory::SetEntryIdleTimeout( ExpirationAction action, System::UInt32 idleTimeout )
{
- NativePtr->setEntryIdleTimeout(
- static_cast<apache::geode::client::ExpirationAction::Action>( action ), idleTimeout );
+ try
+ {
+ m_nativeptr->get()->setEntryIdleTimeout( static_cast<native::ExpirationAction::Action>( action ), idleTimeout );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
}
RegionFactory^ RegionFactory::SetEntryTimeToLive( ExpirationAction action, System::UInt32 timeToLive )
{
- NativePtr->setEntryTimeToLive(
- static_cast<apache::geode::client::ExpirationAction::Action>( action ), timeToLive );
+ try
+ {
+ m_nativeptr->get()->setEntryTimeToLive(static_cast<native::ExpirationAction::Action>( action ), timeToLive );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
}
RegionFactory^ RegionFactory::SetRegionIdleTimeout( ExpirationAction action, System::UInt32 idleTimeout )
{
- NativePtr->setRegionIdleTimeout(
- static_cast<apache::geode::client::ExpirationAction::Action>( action ), idleTimeout );
+ try
+ {
+ m_nativeptr->get()->setRegionIdleTimeout(static_cast<native::ExpirationAction::Action>( action ), idleTimeout );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
}
RegionFactory^ RegionFactory::SetRegionTimeToLive( ExpirationAction action, System::UInt32 timeToLive )
{
- NativePtr->setRegionTimeToLive(
- static_cast<apache::geode::client::ExpirationAction::Action>( action ), timeToLive );
+ try
+ {
+ m_nativeptr->get()->setRegionTimeToLive(static_cast<native::ExpirationAction::Action>( action ), timeToLive );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
}
@@ -130,15 +177,21 @@ namespace Apache
RegionFactory^ RegionFactory::SetPersistenceManager( Client::IPersistenceManager<TKey, TValue>^ persistenceManager,
Properties<String^, String^>^ config)
{
- apache::geode::client::PersistenceManagerPtr persistenceManagerptr;
+ native::PersistenceManagerPtr persistenceManagerptr;
if ( persistenceManager != nullptr ) {
PersistenceManagerGeneric<TKey, TValue>^ clg = gcnew PersistenceManagerGeneric<TKey, TValue>();
clg->SetPersistenceManager(persistenceManager);
- persistenceManagerptr = new apache::geode::client::ManagedPersistenceManagerGeneric( /*clg,*/ persistenceManager);
- ((apache::geode::client::ManagedPersistenceManagerGeneric*)persistenceManagerptr.get())->setptr(clg);
+ persistenceManagerptr = std::shared_ptr<native::ManagedPersistenceManagerGeneric>(new native::ManagedPersistenceManagerGeneric(persistenceManager));
+ ((native::ManagedPersistenceManagerGeneric*)persistenceManagerptr.get())->setptr(clg);
+ }
+ try
+ {
+ m_nativeptr->get()->setPersistenceManager( persistenceManagerptr, config->GetNative() );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
}
- apache::geode::client::PropertiesPtr configptr(GetNativePtr<apache::geode::client::Properties>( config ) );
- NativePtr->setPersistenceManager( persistenceManagerptr, configptr );
return this;
}
@@ -160,12 +213,15 @@ namespace Apache
{
ManagedString mg_libpath( libPath );
ManagedString mg_factoryFunctionName( factoryFunctionName );
- //TODO:split
- apache::geode::client::PropertiesPtr configptr(
- GetNativePtr<apache::geode::client::Properties>( config ) );
- NativePtr->setPersistenceManager( mg_libpath.CharPtr,
- mg_factoryFunctionName.CharPtr, configptr );
+ try
+ {
+ m_nativeptr->get()->setPersistenceManager( mg_libpath.CharPtr, mg_factoryFunctionName.CharPtr, config->GetNative() );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
}
@@ -173,7 +229,14 @@ namespace Apache
{
ManagedString mg_poolName( poolName );
- NativePtr->setPoolName( mg_poolName.CharPtr );
+ try
+ {
+ m_nativeptr->get()->setPoolName( mg_poolName.CharPtr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
}
@@ -183,7 +246,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- NativePtr->setInitialCapacity( initialCapacity );
+ try
+ {
+ m_nativeptr->get()->setInitialCapacity( initialCapacity );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
_GF_MG_EXCEPTION_CATCH_ALL2
@@ -193,7 +263,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- NativePtr->setLoadFactor( loadFactor );
+ try
+ {
+ m_nativeptr->get()->setLoadFactor( loadFactor );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
_GF_MG_EXCEPTION_CATCH_ALL2
@@ -203,7 +280,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- NativePtr->setConcurrencyLevel( concurrencyLevel );
+ try
+ {
+ m_nativeptr->get()->setConcurrencyLevel( concurrencyLevel );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
_GF_MG_EXCEPTION_CATCH_ALL2
@@ -211,32 +295,66 @@ namespace Apache
RegionFactory^ RegionFactory::SetLruEntriesLimit( System::UInt32 entriesLimit )
{
- NativePtr->setLruEntriesLimit( entriesLimit );
+ try
+ {
+ m_nativeptr->get()->setLruEntriesLimit( entriesLimit );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
}
RegionFactory^ RegionFactory::SetDiskPolicy( DiskPolicyType diskPolicy )
{
- NativePtr->setDiskPolicy(
- static_cast<apache::geode::client::DiskPolicyType::PolicyType>( diskPolicy ) );
+ try
+ {
+ m_nativeptr->get()->setDiskPolicy(static_cast<native::DiskPolicyType::PolicyType>( diskPolicy ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
}
RegionFactory^ RegionFactory::SetCachingEnabled( bool cachingEnabled )
{
- NativePtr->setCachingEnabled( cachingEnabled );
+ try
+ {
+ m_nativeptr->get()->setCachingEnabled( cachingEnabled );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
}
RegionFactory^ RegionFactory::SetCloningEnabled( bool cloningEnabled )
{
- NativePtr->setCloningEnabled( cloningEnabled );
+ try
+ {
+ m_nativeptr->get()->setCloningEnabled( cloningEnabled );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
}
RegionFactory^ RegionFactory::SetConcurrencyChecksEnabled( bool concurrencyChecksEnabled )
{
- NativePtr->setConcurrencyChecksEnabled( concurrencyChecksEnabled );
+ try
+ {
+ m_nativeptr->get()->setConcurrencyChecksEnabled( concurrencyChecksEnabled );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
}
// NEW GENERIC APIs:
@@ -246,11 +364,16 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- ManagedString mg_name( regionName );
-
- apache::geode::client::RegionPtr& nativeptr( NativePtr->create(
- mg_name.CharPtr ) );
- return Client::Region<TKey,TValue>::Create( nativeptr.ptr( ) );
+ try
+ {
+ ManagedString mg_name( regionName );
+ auto nativeptr = m_nativeptr->get()->create( mg_name.CharPtr );
+ return Client::Region<TKey,TValue>::Create( nativeptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -258,73 +381,101 @@ namespace Apache
generic <class TKey, class TValue>
RegionFactory^ RegionFactory::SetCacheLoader( Client::ICacheLoader<TKey, TValue>^ cacheLoader )
{
- apache::geode::client::CacheLoaderPtr loaderptr;
+ native::CacheLoaderPtr loaderptr;
if ( cacheLoader != nullptr ) {
CacheLoaderGeneric<TKey, TValue>^ clg = gcnew CacheLoaderGeneric<TKey, TValue>();
clg->SetCacheLoader(cacheLoader);
- loaderptr = new apache::geode::client::ManagedCacheLoaderGeneric( /*clg,*/ cacheLoader );
- ((apache::geode::client::ManagedCacheLoaderGeneric*)loaderptr.get())->setptr(clg);
+ loaderptr = std::shared_ptr<native::ManagedCacheLoaderGeneric>(new native::ManagedCacheLoaderGeneric(cacheLoader));
+ ((native::ManagedCacheLoaderGeneric*)loaderptr.get())->setptr(clg);
+ }
+ try
+ {
+ m_nativeptr->get()->setCacheLoader( loaderptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
}
- NativePtr->setCacheLoader( loaderptr );
return this;
}
generic <class TKey, class TValue>
RegionFactory^ RegionFactory::SetCacheWriter( Client::ICacheWriter<TKey, TValue>^ cacheWriter )
{
- apache::geode::client::CacheWriterPtr writerptr;
+ native::CacheWriterPtr writerptr;
if ( cacheWriter != nullptr ) {
CacheWriterGeneric<TKey, TValue>^ cwg = gcnew CacheWriterGeneric<TKey, TValue>();
cwg->SetCacheWriter(cacheWriter);
- writerptr = new apache::geode::client::ManagedCacheWriterGeneric( /*cwg,*/ cacheWriter );
- ((apache::geode::client::ManagedCacheWriterGeneric*)writerptr.get())->setptr(cwg);
+ writerptr = std::shared_ptr<native::ManagedCacheWriterGeneric>(new native::ManagedCacheWriterGeneric(cacheWriter));
+ ((native::ManagedCacheWriterGeneric*)writerptr.get())->setptr(cwg);
+ }
+ try
+ {
+ m_nativeptr->get()->setCacheWriter( writerptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
}
- NativePtr->setCacheWriter( writerptr );
return this;
}
generic <class TKey, class TValue>
RegionFactory^ RegionFactory::SetCacheListener( Client::ICacheListener<TKey, TValue>^ cacheListener )
{
- apache::geode::client::CacheListenerPtr listenerptr;
+ native::CacheListenerPtr listenerptr;
if ( cacheListener != nullptr ) {
CacheListenerGeneric<TKey, TValue>^ clg = gcnew CacheListenerGeneric<TKey, TValue>();
clg->SetCacheListener(cacheListener);
- listenerptr = new apache::geode::client::ManagedCacheListenerGeneric( /*clg,*/ cacheListener );
- ((apache::geode::client::ManagedCacheListenerGeneric*)listenerptr.get())->setptr(clg);
+ listenerptr = std::shared_ptr<native::ManagedCacheListenerGeneric>(new native::ManagedCacheListenerGeneric(cacheListener));
+ ((native::ManagedCacheListenerGeneric*)listenerptr.get())->setptr(clg);
/*
- listenerptr = new apache::geode::client::ManagedCacheListenerGeneric(
+ listenerptr = new native::ManagedCacheListenerGeneric(
(Client::ICacheListener<Object^, Object^>^)cacheListener);
*/
}
- NativePtr->setCacheListener( listenerptr );
+ try
+ {
+ m_nativeptr->get()->setCacheListener( listenerptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
}
generic <class TKey, class TValue>
- RegionFactory^ RegionFactory::SetPartitionResolver( Client::IPartitionResolver<TKey, TValue>^ partitionresolver )
+ RegionFactory^ RegionFactory::SetPartitionResolver(Client::IPartitionResolver<TKey, TValue>^ partitionresolver)
{
- apache::geode::client::PartitionResolverPtr resolverptr;
- if ( partitionresolver != nullptr ) {
- Client::IFixedPartitionResolver<TKey, TValue>^ resolver =
+ native::PartitionResolverPtr resolverptr;
+ if (partitionresolver != nullptr) {
+ Client::IFixedPartitionResolver<TKey, TValue>^ resolver =
dynamic_cast<Client::IFixedPartitionResolver<TKey, TValue>^>(partitionresolver);
- if (resolver != nullptr) {
+ if (resolver != nullptr) {
FixedPartitionResolverGeneric<TKey, TValue>^ prg = gcnew FixedPartitionResolverGeneric<TKey, TValue>();
prg->SetPartitionResolver(resolver);
- resolverptr = new apache::geode::client::ManagedFixedPartitionResolverGeneric( resolver );
- ((apache::geode::client::ManagedFixedPartitionResolverGeneric*)resolverptr.get())->setptr(prg);
+ resolverptr = std::shared_ptr<native::ManagedFixedPartitionResolverGeneric>(new native::ManagedFixedPartitionResolverGeneric(resolver));
+ ((native::ManagedFixedPartitionResolverGeneric*)resolverptr.get())->setptr(prg);
}
- else {
+ else {
PartitionResolverGeneric<TKey, TValue>^ prg = gcnew PartitionResolverGeneric<TKey, TValue>();
prg->SetPartitionResolver(partitionresolver);
- resolverptr = new apache::geode::client::ManagedPartitionResolverGeneric( partitionresolver );
- ((apache::geode::client::ManagedPartitionResolverGeneric*)resolverptr.get())->setptr(prg);
- }
+ resolverptr = std::shared_ptr<native::ManagedPartitionResolverGeneric>(new native::ManagedPartitionResolverGeneric(partitionresolver));
+ ((native::ManagedPartitionResolverGeneric*)resolverptr.get())->setptr(prg);
+ }
+ }
+ try
+ {
+ m_nativeptr->get()->setPartitionResolver(resolverptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
}
- NativePtr->setPartitionResolver( resolverptr );
return this;
+ }
} // namespace Client
} // namespace Geode
} // namespace Apache
-}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/RegionFactory.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/RegionFactory.hpp b/src/clicache/src/RegionFactory.hpp
index 337e2da..af79747 100644
--- a/src/clicache/src/RegionFactory.hpp
+++ b/src/clicache/src/RegionFactory.hpp
@@ -18,12 +18,18 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/AttributesFactory.hpp>
-//#include "impl/NativeWrapper.hpp"
+#include "end_native.hpp"
+
+
#include "ExpirationAction.hpp"
#include "DiskPolicyType.hpp"
//#include "ScopeType.hpp"
+#include "begin_native.hpp"
#include <geode/RegionFactory.hpp>
+#include "end_native.hpp"
+
#include "RegionShortcut.hpp"
#include "ICacheLoader.hpp"
@@ -46,12 +52,12 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
/// <summary>
/// This interface provides for the configuration and creation of instances of Region.
/// </summary>
public ref class RegionFactory sealed
- : public Internal::SBWrap<apache::geode::client::RegionFactory>
{
public:
/// <summary>
@@ -428,10 +434,15 @@ namespace Apache
/// <returns>
/// The managed wrapper object; null if the native pointer is null.
/// </returns>
- inline static RegionFactory^ Create( apache::geode::client::RegionFactory* nativeptr )
+ inline static RegionFactory^ Create(native::RegionFactoryPtr nativeptr )
{
- return ( nativeptr != nullptr ?
- gcnew RegionFactory( nativeptr ) : nullptr );
+ return __nullptr == nativeptr ? nullptr :
+ gcnew RegionFactory( nativeptr );
+ }
+
+ std::shared_ptr<native::RegionFactory> GetNative()
+ {
+ return m_nativeptr->get_shared_ptr();
}
private:
@@ -440,8 +451,12 @@ namespace Apache
/// Private constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline RegionFactory( apache::geode::client::RegionFactory* nativeptr )
- : Internal::SBWrap<apache::geode::client::RegionFactory>( nativeptr ) { }
+ inline RegionFactory(native::RegionFactoryPtr nativeptr )
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::RegionFactory>(nativeptr);
+ }
+
+ native_shared_ptr<native::RegionFactory>^ m_nativeptr;
};
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/ResultCollector.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/ResultCollector.cpp b/src/clicache/src/ResultCollector.cpp
index 13220eb..9b0e249 100644
--- a/src/clicache/src/ResultCollector.cpp
+++ b/src/clicache/src/ResultCollector.cpp
@@ -31,13 +31,22 @@ namespace Apache
namespace Client
{
+ namespace native = apache::geode::client;
+
generic<class TResult>
void ResultCollector<TResult>::AddResult( TResult rs )
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::Serializable * result = SafeGenericMSerializableConvert((IGeodeSerializable^)rs);
- NativePtr->addResult( result==NULL ? (nullptr) : (apache::geode::client::CacheablePtr(result)) );
+ try
+ {
+ auto result = std::shared_ptr<native::Cacheable>(SafeGenericMSerializableConvert((IGeodeSerializable^)rs));
+ m_nativeptr->get()->addResult(result);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -52,17 +61,22 @@ namespace Apache
System::Collections::Generic::ICollection<TResult>^ ResultCollector<TResult>::GetResult(UInt32 timeout)
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::CacheableVectorPtr results = NativePtr->getResult(timeout);
- array<TResult>^ rs =
- gcnew array<TResult>( results->size( ) );
- for( System::Int32 index = 0; index < results->size( ); index++ )
- {
- apache::geode::client::CacheablePtr& nativeptr(results->operator[](index));
-
- rs[ index] = Serializable::GetManagedValueGeneric<TResult>( nativeptr);
- }
- ICollection<TResult>^ collectionlist = (ICollection<TResult>^)rs;
- return collectionlist;
+ try
+ {
+ auto results = m_nativeptr->get()->getResult(timeout);
+ auto rs = gcnew array<TResult>(results->size());
+ for (System::Int32 index = 0; index < results->size(); index++)
+ {
+ auto nativeptr = results->operator[](index);
+ rs[index] = Serializable::GetManagedValueGeneric<TResult>(nativeptr);
+ }
+ auto collectionlist = (ICollection<TResult>^)rs;
+ return collectionlist;
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -71,7 +85,14 @@ namespace Apache
void ResultCollector<TResult>::EndResults()
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->endResults();
+ try
+ {
+ m_nativeptr->get()->endResults();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -79,10 +100,16 @@ namespace Apache
void ResultCollector<TResult>::ClearResults(/*bool*/)
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->clearResults();
+ try
+ {
+ m_nativeptr->get()->clearResults();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
} // namespace Client
} // namespace Geode
} // namespace Apache
-
-} //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/ResultCollector.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/ResultCollector.hpp b/src/clicache/src/ResultCollector.hpp
index 3b8067d..f75ffdc 100644
--- a/src/clicache/src/ResultCollector.hpp
+++ b/src/clicache/src/ResultCollector.hpp
@@ -20,8 +20,11 @@
#include "geode_defs.hpp"
#include "IResultCollector.hpp"
+#include "begin_native.hpp"
#include <geode/ResultCollector.hpp>
-#include "impl/NativeWrapper.hpp"
+#include "end_native.hpp"
+
+#include "native_shared_ptr.hpp"
using namespace System;
@@ -33,6 +36,7 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
generic<class TResult>
interface class IResultCollector;
@@ -42,7 +46,7 @@ namespace Apache
/// </summary>
generic<class TResult>
public ref class ResultCollector
- : public Internal::SBWrap<apache::geode::client::ResultCollector>, public IResultCollector<TResult>
+ : public IResultCollector<TResult>
{
public:
@@ -74,45 +78,15 @@ namespace Apache
internal:
/// <summary>
- /// Default constructor.
- /// </summary>
- inline ResultCollector( ):
- SBWrap( ){ }
-
- //~ResultCollector<TKey>( ) { }
-
- /// <summary>
/// Internal constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline ResultCollector( apache::geode::client::ResultCollector* nativeptr ):
- SBWrap( nativeptr ){ }
-
- /// <summary>
- /// Used to assign the native Serializable pointer to a new object.
- /// </summary>
- /// <remarks>
- /// Note the order of preserveSB() and releaseSB(). This handles the
- /// corner case when <c>m_nativeptr</c> is same as <c>nativeptr</c>.
- /// </remarks>
- inline void AssignSPGeneric( apache::geode::client::ResultCollector* nativeptr )
+ inline ResultCollector( native::ResultCollectorPtr nativeptr )
{
- AssignPtr( nativeptr );
+ m_nativeptr = gcnew native_shared_ptr<native::ResultCollector>(nativeptr);
}
- /// <summary>
- /// Used to assign the native CqListener pointer to a new object.
- /// </summary>
- inline void SetSPGeneric( apache::geode::client::ResultCollector* nativeptr )
- {
- if ( nativeptr != nullptr ) {
- nativeptr->preserveSB( );
- }
- _SetNativePtr( nativeptr );
- }
-
- //void Silence_LNK2022_BUG() { };
-
+ native_shared_ptr<native::ResultCollector>^ m_nativeptr;
};
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/ResultSet.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/ResultSet.cpp b/src/clicache/src/ResultSet.cpp
index d3a83e7..8e512cc 100644
--- a/src/clicache/src/ResultSet.cpp
+++ b/src/clicache/src/ResultSet.cpp
@@ -34,44 +34,67 @@ namespace Apache
generic<class TResult>
bool ResultSet<TResult>::IsModifiable::get( )
{
- return NativePtr->isModifiable( );
+ try
+ {
+ return m_nativeptr->get()->isModifiable( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TResult>
System::Int32 ResultSet<TResult>::Size::get( )
{
- return NativePtr->size( );
+ try
+ {
+ return m_nativeptr->get()->size( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TResult>
- /*IGeodeSerializable^*/TResult ResultSet<TResult>::default::get( size_t index )
+ TResult ResultSet<TResult>::default::get( size_t index )
{
- //return SafeUMSerializableConvertGeneric(NativePtr->operator[](static_cast<System::Int32>(index)).get());
- return (Serializable::GetManagedValueGeneric<TResult>(NativePtr->operator[](static_cast<System::Int32>(index))));
+ try
+ {
+ return (Serializable::GetManagedValueGeneric<TResult>(m_nativeptr->get()->operator[](static_cast<System::Int32>(index))));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TResult>
- SelectResultsIterator<TResult>^ ResultSet<TResult>::GetIterator( )
+ SelectResultsIterator<TResult>^ ResultSet<TResult>::GetIterator()
{
- apache::geode::client::SelectResultsIterator* nativeptr =
- new apache::geode::client::SelectResultsIterator( NativePtr->getIterator( ) );
-
- return SelectResultsIterator<TResult>::Create( nativeptr );
+ try
+ {
+ return SelectResultsIterator<TResult>::Create(std::make_unique<apache::geode::client::SelectResultsIterator>(
+ m_nativeptr->get()->getIterator()));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TResult>
- System::Collections::Generic::IEnumerator</*IGeodeSerializable^*/TResult>^
- ResultSet<TResult>::GetEnumerator( )
+ System::Collections::Generic::IEnumerator<TResult>^ ResultSet<TResult>::GetEnumerator( )
{
return GetIterator( );
}
generic<class TResult>
- System::Collections::IEnumerator^ ResultSet<TResult>::GetIEnumerator( )
+ System::Collections::IEnumerator^ ResultSet<TResult>::GetIEnumerator()
{
- return GetIterator( );
+ return GetIterator();
+ }
} // namespace Client
} // namespace Geode
} // namespace Apache
-
- } //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/ResultSet.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/ResultSet.hpp b/src/clicache/src/ResultSet.hpp
index e4990cc..bc64ede 100644
--- a/src/clicache/src/ResultSet.hpp
+++ b/src/clicache/src/ResultSet.hpp
@@ -18,8 +18,11 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/ResultSet.hpp>
-#include "impl/NativeWrapper.hpp"
+#include "end_native.hpp"
+
+#include "native_shared_ptr.hpp"
#include "ISelectResults.hpp"
@@ -31,6 +34,7 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
interface class IGeodeSerializable;
@@ -43,7 +47,7 @@ namespace Apache
/// </summary>
generic<class TResult>
public ref class ResultSet sealed
- : public Internal::SBWrap<apache::geode::client::ResultSet>, public ISelectResults<TResult>
+ : public ISelectResults<TResult>
{
public:
@@ -97,9 +101,10 @@ namespace Apache
/// <returns>
/// The managed wrapper object; null if the native pointer is null.
/// </returns>
- inline static ResultSet<TResult>^ Create(apache::geode::client::ResultSet* nativeptr)
+ inline static ResultSet<TResult>^ Create(native::ResultSetPtr nativeptr)
{
- return (nativeptr != nullptr ? gcnew ResultSet(nativeptr) : nullptr);
+ return __nullptr == nativeptr ? nullptr :
+ gcnew ResultSet<TResult>( nativeptr );
}
@@ -112,8 +117,12 @@ namespace Apache
/// Private constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline ResultSet(apache::geode::client::ResultSet* nativeptr)
- : SBWrap(nativeptr) { }
+ inline ResultSet(native::ResultSetPtr nativeptr)
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::ResultSet>(nativeptr);
+ }
+
+ native_shared_ptr<native::ResultSet>^ m_nativeptr;
};
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/SelectResultsIterator.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/SelectResultsIterator.cpp b/src/clicache/src/SelectResultsIterator.cpp
index 0a241e0..0ac7edc 100644
--- a/src/clicache/src/SelectResultsIterator.cpp
+++ b/src/clicache/src/SelectResultsIterator.cpp
@@ -15,51 +15,81 @@
* limitations under the License.
*/
-//#include "geode_includes.hpp"
#include "SelectResultsIterator.hpp"
-
#include "impl/SafeConvert.hpp"
-using namespace System;
namespace Apache
{
namespace Geode
{
namespace Client
{
+ using namespace System;
generic<class TResult>
- /*Apache::Geode::Client::IGeodeSerializable^*/TResult SelectResultsIterator<TResult>::Current::get( )
+ TResult SelectResultsIterator<TResult>::Current::get( )
{
- //return SafeUMSerializableConvertGeneric( NativePtr->current( ).ptr( ) );
- return Serializable::GetManagedValueGeneric<TResult>(NativePtr->current( ));
+ try
+ {
+ return Serializable::GetManagedValueGeneric<TResult>(m_nativeptr->get()->current( ));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TResult>
bool SelectResultsIterator<TResult>::MoveNext( )
{
- return NativePtr->moveNext( );
+ try
+ {
+ return m_nativeptr->get()->moveNext( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TResult>
void SelectResultsIterator<TResult>::Reset( )
{
- NativePtr->reset( );
+ try
+ {
+ m_nativeptr->get()->reset( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TResult>
- /*Apache::Geode::Client::IGeodeSerializable^*/TResult SelectResultsIterator<TResult>::Next( )
+ TResult SelectResultsIterator<TResult>::Next( )
{
- //return SafeUMSerializableConvertGeneric( NativePtr->next( ).ptr( ) );
- return Serializable::GetManagedValueGeneric<TResult>(NativePtr->next( ));
+ try
+ {
+ return Serializable::GetManagedValueGeneric<TResult>(m_nativeptr->get()->next( ));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TResult>
- bool SelectResultsIterator<TResult>::HasNext::get( )
+ bool SelectResultsIterator<TResult>::HasNext::get()
{
- return NativePtr->hasNext( );
+ try
+ {
+ return m_nativeptr->get()->hasNext();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
} // namespace Client
} // namespace Geode
} // namespace Apache
-
- } //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/SelectResultsIterator.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/SelectResultsIterator.hpp b/src/clicache/src/SelectResultsIterator.hpp
index 1784529..0bb6191 100644
--- a/src/clicache/src/SelectResultsIterator.hpp
+++ b/src/clicache/src/SelectResultsIterator.hpp
@@ -18,8 +18,11 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/SelectResultsIterator.hpp>
-#include "impl/NativeWrapper.hpp"
+#include "end_native.hpp"
+
+#include "native_unique_ptr.hpp"
using namespace System;
@@ -30,6 +33,7 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
interface class IGeodeSerializable;
@@ -38,8 +42,7 @@ namespace Apache
/// </summary>
generic<class TResult>
public ref class SelectResultsIterator sealed
- : public Internal::UMWrap<apache::geode::client::SelectResultsIterator>,
- public System::Collections::Generic::IEnumerator</*Apache::Geode::Client::IGeodeSerializable^*/TResult>
+ : public System::Collections::Generic::IEnumerator</*Apache::Geode::Client::IGeodeSerializable^*/TResult>
{
public:
@@ -85,6 +88,7 @@ namespace Apache
bool get( );
}
+ ~SelectResultsIterator() {};
internal:
@@ -97,10 +101,10 @@ namespace Apache
/// The managed wrapper object; null if the native pointer is null.
/// </returns>
inline static Apache::Geode::Client::SelectResultsIterator<TResult>^ Create(
- apache::geode::client::SelectResultsIterator* nativeptr )
+ std::unique_ptr<native::SelectResultsIterator> nativeptr )
{
return ( nativeptr != nullptr ?
- gcnew Apache::Geode::Client::SelectResultsIterator<TResult>( nativeptr ) : nullptr );
+ gcnew Apache::Geode::Client::SelectResultsIterator<TResult>( std::move(nativeptr) ) : nullptr );
}
@@ -120,8 +124,12 @@ namespace Apache
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
inline SelectResultsIterator(
- apache::geode::client::SelectResultsIterator* nativeptr )
- : UMWrap( nativeptr, true ) { }
+ std::unique_ptr<native::SelectResultsIterator> nativeptr )
+ {
+ m_nativeptr = gcnew native_unique_ptr<native::SelectResultsIterator>(std::move(nativeptr));
+ }
+
+ native_unique_ptr<native::SelectResultsIterator>^ m_nativeptr;
};
} // namespace Client
} // namespace Geode
[02/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from cppcache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/VersionedCacheableObjectPartList.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/VersionedCacheableObjectPartList.cpp b/src/cppcache/src/VersionedCacheableObjectPartList.cpp
index 8e386e1..3bbdfbc 100644
--- a/src/cppcache/src/VersionedCacheableObjectPartList.cpp
+++ b/src/cppcache/src/VersionedCacheableObjectPartList.cpp
@@ -55,15 +55,16 @@ void VersionedCacheableObjectPartList::readObjectPart(int32_t index,
input.advanceCursor(skipLen);
input.readNativeString(exMsgPtr); ////4.1
- if (m_exceptions != NULLPTR) {
+ if (m_exceptions != nullptr) {
const char* exMsg = exMsgPtr->asChar();
if (strstr(exMsg,
"org.apache.geode.security."
"NotAuthorizedException") != NULL) {
- ex = new NotAuthorizedException("Authorization exception at server:",
- exMsg);
+ ex = std::make_shared<NotAuthorizedException>(
+ "Authorization exception at server:", exMsg);
} else {
- ex = new CacheServerException("Exception at remote server:", exMsg);
+ ex = std::make_shared<CacheServerException>(
+ "Exception at remote server:", exMsg);
}
m_exceptions->insert(keyPtr, ex);
}
@@ -77,9 +78,7 @@ void VersionedCacheableObjectPartList::readObjectPart(int32_t index,
bytes = new uint8_t[skipLen];
input.readBytesOnly(bytes, skipLen);
}
- CacheableBytesPtr c = CacheableBytes::create(bytes, skipLen);
- value = dynCast<CacheablePtr>(c);
- m_values->insert(keyPtr, value);
+ m_values->insert(keyPtr, CacheableBytes::create(bytes, skipLen));
/* adongre
* CID 29377: Resource leak (RESOURCE_LEAK)Calling allocation function
@@ -89,11 +88,11 @@ void VersionedCacheableObjectPartList::readObjectPart(int32_t index,
GF_SAFE_DELETE_ARRAY(bytes);
} else {
- // set NULLPTR to indicate that there is no exception for the key on this
+ // set nullptr to indicate that there is no exception for the key on this
// index
// readObject
input.readObject(value);
- if (m_values != NULLPTR) m_values->insert(keyPtr, value);
+ if (m_values != nullptr) m_values->insert(keyPtr, value);
}
}
@@ -115,9 +114,8 @@ Serializable* VersionedCacheableObjectPartList::fromData(DataInput& input) {
int32_t keysOffset = (m_keysOffset != NULL ? *m_keysOffset : 0);
// bool readObjLen = false;
// int32_t lenOfObjects = 0;
- VectorOfCacheableKeyPtr localKeys(new VectorOfCacheableKey());
- if (m_values == NULLPTR) {
- GF_NEW(m_values, HashMapOfCacheable);
+ if (m_values == nullptr) {
+ m_values = std::make_shared<HashMapOfCacheable>();
valuesNULL = true;
}
@@ -128,6 +126,7 @@ Serializable* VersionedCacheableObjectPartList::fromData(DataInput& input) {
return NULL;
}
+ auto localKeys = std::make_shared<VectorOfCacheableKey>();
if (m_hasKeys) {
int64_t tempLen;
input.readUnsignedVL(&tempLen);
@@ -135,7 +134,7 @@ Serializable* VersionedCacheableObjectPartList::fromData(DataInput& input) {
for (int32_t index = 0; index < len; ++index) {
input.readObject(key, true);
- if (m_resultKeys != NULLPTR) {
+ if (m_resultKeys != nullptr) {
m_resultKeys->push_back(key);
}
m_tempKeys->push_back(key);
@@ -155,12 +154,12 @@ Serializable* VersionedCacheableObjectPartList::fromData(DataInput& input) {
readObjLen = true;
for (int32_t index = keysOffset; index < keysOffset + len; ++index) {
key = m_keys->at(index);
- if (m_resultKeys != NULLPTR) {
+ if (m_resultKeys != nullptr) {
m_resultKeys->push_back(key);
}
}*/
} else if (hasObjects) {
- if (m_keys == NULL && m_resultKeys == NULLPTR) {
+ if (m_keys == NULL && m_resultKeys == nullptr) {
LOGERROR(
"VersionedCacheableObjectPartList::fromData: Exception: hasObjects "
"is true and m_keys and m_resultKeys are also NULL");
@@ -186,7 +185,7 @@ Serializable* VersionedCacheableObjectPartList::fromData(DataInput& input) {
for (int32_t index = 0; index < len; ++index) {
if (m_keys != NULL && !m_hasKeys) {
readObjectPart(index, input, m_keys->at(index + keysOffset));
- } else /*if (m_resultKeys != NULLPTR && m_resultKeys->size() > 0)*/ {
+ } else /*if (m_resultKeys != nullptr && m_resultKeys->size() > 0)*/ {
readObjectPart(index, input, localKeys->at(index));
} /*else{
LOGERROR("VersionedCacheableObjectPartList::fromData: hasObjects = true
@@ -267,15 +266,15 @@ Serializable* VersionedCacheableObjectPartList::fromData(DataInput& input) {
for (int32_t index = 0; index < len; ++index) {
if (m_keys != NULL && !m_hasKeys) {
key = m_keys->at(index + keysOffset);
- } else /*if (m_resultKeys != NULLPTR && m_resultKeys->size() > 0)*/ {
+ } else /*if (m_resultKeys != nullptr && m_resultKeys->size() > 0)*/ {
key = localKeys->at(index);
} /*else{
LOGERROR("VersionedCacheableObjectPartList::fromData: hasObjects = true
- but m_keys is NULL AND m_resultKeys=NULLPTR or m_resultKeys->size=0" );
+ but m_keys is NULL AND m_resultKeys=nullptr or m_resultKeys->size=0" );
}*/
HashMapOfCacheable::Iterator iter = m_values->find(key);
- value = iter == m_values->end() ? NULLPTR : iter.second();
+ value = iter == m_values->end() ? nullptr : iter.second();
if (m_byteArray[index] != 3) { // 3 - key not found on server
CacheablePtr oldValue;
if (m_addToLocalCache) {
@@ -300,7 +299,7 @@ Serializable* VersionedCacheableObjectPartList::fromData(DataInput& input) {
m_region->getEntry(key, oldValue);
// if value has already been received via notification or put by
// another thread, then return that
- if (oldValue != NULLPTR && !CacheableToken::isInvalid(oldValue)) {
+ if (oldValue != nullptr && !CacheableToken::isInvalid(oldValue)) {
// erase the old value
m_values->erase(key);
// add the value with new value
@@ -311,7 +310,7 @@ Serializable* VersionedCacheableObjectPartList::fromData(DataInput& input) {
}
}
if (m_keysOffset != NULL) *m_keysOffset += len;
- if (valuesNULL) m_values = NULLPTR;
+ if (valuesNULL) m_values = nullptr;
return this;
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/VersionedCacheableObjectPartList.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/VersionedCacheableObjectPartList.hpp b/src/cppcache/src/VersionedCacheableObjectPartList.hpp
index 8db6010..7b6561f 100644
--- a/src/cppcache/src/VersionedCacheableObjectPartList.hpp
+++ b/src/cppcache/src/VersionedCacheableObjectPartList.hpp
@@ -104,11 +104,11 @@ class VersionedCacheableObjectPartList : public CacheableObjectPartList {
: CacheableObjectPartList(keys, keysOffset, values, exceptions,
resultKeys, region, trackerMap, destroyTracker,
addToLocalCache),
+ m_tempKeys(std::make_shared<VectorOfCacheableKey>()),
m_responseLock(responseLock) {
m_regionIsVersioned = false;
m_serializeValues = false;
m_endpointMemId = m_dsmemId;
- GF_NEW(m_tempKeys, VectorOfCacheableKey);
m_hasTags = false;
m_hasKeys = false;
}
@@ -116,25 +116,24 @@ class VersionedCacheableObjectPartList : public CacheableObjectPartList {
VersionedCacheableObjectPartList(VectorOfCacheableKey* keys,
int32_t totalMapSize,
ACE_Recursive_Thread_Mutex& responseLock)
- : m_responseLock(responseLock) {
+ : m_tempKeys(keys), m_responseLock(responseLock) {
m_regionIsVersioned = false;
m_serializeValues = false;
m_hasTags = false;
m_endpointMemId = 0;
m_versionTags.resize(totalMapSize);
this->m_hasKeys = false;
- this->m_tempKeys = VectorOfCacheableKeyPtr(keys);
+ ;
}
VersionedCacheableObjectPartList(VectorOfCacheableKey* keys,
ACE_Recursive_Thread_Mutex& responseLock)
- : m_responseLock(responseLock) {
+ : m_tempKeys(keys), m_responseLock(responseLock) {
m_regionIsVersioned = false;
m_serializeValues = false;
m_hasTags = false;
m_endpointMemId = 0;
this->m_hasKeys = false;
- this->m_tempKeys = VectorOfCacheableKeyPtr(keys);
}
VersionedCacheableObjectPartList(ACE_Recursive_Thread_Mutex& responseLock)
@@ -170,11 +169,11 @@ class VersionedCacheableObjectPartList : public CacheableObjectPartList {
inline VersionedCacheableObjectPartList(
uint16_t endpointMemId, ACE_Recursive_Thread_Mutex& responseLock)
- : m_responseLock(responseLock) {
+ : m_tempKeys(std::make_shared<VectorOfCacheableKey>()), m_responseLock(responseLock)
+ {
m_regionIsVersioned = false;
m_serializeValues = false;
m_endpointMemId = endpointMemId;
- GF_NEW(m_tempKeys, VectorOfCacheableKey);
m_hasTags = false;
m_hasKeys = false;
}
@@ -182,16 +181,16 @@ class VersionedCacheableObjectPartList : public CacheableObjectPartList {
void addAll(VersionedCacheableObjectPartListPtr other) {
// LOGDEBUG("DEBUG:: COPL.addAll called");
// ACE_Guard< ACE_Recursive_Thread_Mutex > guard( this->m_responseLock );
- if (other->m_tempKeys != NULLPTR) {
- if (this->m_tempKeys == NULLPTR) {
- this->m_tempKeys = new VectorOfCacheableKey();
+ if (other->m_tempKeys != nullptr) {
+ if (this->m_tempKeys == nullptr) {
+ this->m_tempKeys = std::make_shared<VectorOfCacheableKey>();
this->m_hasKeys = true;
int size = other->m_tempKeys->size();
for (int i = 0; i < size; i++) {
this->m_tempKeys->push_back(other->m_tempKeys->at(i));
}
} else {
- if (this->m_tempKeys != NULLPTR) {
+ if (this->m_tempKeys != nullptr) {
if (!this->m_hasKeys) {
LOGDEBUG(" VCOPL::addAll m_hasKeys should be true here");
this->m_hasKeys = true;
@@ -233,7 +232,7 @@ class VersionedCacheableObjectPartList : public CacheableObjectPartList {
void addAllKeys(VectorOfCacheableKeyPtr keySet) {
if (!this->m_hasKeys) {
this->m_hasKeys = true;
- this->m_tempKeys = new VectorOfCacheableKey(*keySet);
+ this->m_tempKeys = std::make_shared<VectorOfCacheableKey>(*keySet);
} else {
for (int i = 0; i < keySet->size(); i++) {
this->m_tempKeys->push_back(keySet->at(i));
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/statistics/HostStatSampler.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/statistics/HostStatSampler.cpp b/src/cppcache/src/statistics/HostStatSampler.cpp
index 64015ec..c5f5be2 100644
--- a/src/cppcache/src/statistics/HostStatSampler.cpp
+++ b/src/cppcache/src/statistics/HostStatSampler.cpp
@@ -529,7 +529,7 @@ void HostStatSampler::putStatsInAdminRegion() {
static bool initDone = false;
static std::string clientId = "";
AdminRegionPtr adminRgn = m_statMngr->getAdminRegion();
- if (adminRgn == NULLPTR) return;
+ if (adminRgn == nullptr) return;
TryReadGuard _guard(adminRgn->getRWLock(), adminRgn->isDestroyed());
if (!adminRgn->isDestroyed()) {
TcrConnectionManager* m_conn_man = adminRgn->getConnectionManager();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/statistics/PoolStatsSampler.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/statistics/PoolStatsSampler.cpp b/src/cppcache/src/statistics/PoolStatsSampler.cpp
index bb74448..77a3f7b 100644
--- a/src/cppcache/src/statistics/PoolStatsSampler.cpp
+++ b/src/cppcache/src/statistics/PoolStatsSampler.cpp
@@ -32,7 +32,7 @@ PoolStatsSampler::PoolStatsSampler(int64_t sampleRate, CacheImpl* cache,
: m_sampleRate(sampleRate), m_distMan(distMan) {
m_running = false;
m_stopRequested = false;
- m_adminRegion = new AdminRegion(cache, distMan);
+ m_adminRegion = AdminRegion::create(cache, distMan);
}
PoolStatsSampler::~PoolStatsSampler() {
@@ -117,11 +117,10 @@ void PoolStatsSampler::putStatsInAdminRegion() {
} catch (const AllConnectionsInUseException&) {
LOGDEBUG("All connection are in use, trying again.");
} catch (const NotConnectedException& ex) {
- try {
- ExceptionPtr exCause =
- dynCast<SharedPtr<NoAvailableLocatorsException> >(ex.getCause());
+ if (std::dynamic_pointer_cast<NoAvailableLocatorsException>(
+ ex.getCause())) {
LOGDEBUG("No locators available, trying again.");
- } catch (ClassCastException&) {
+ } else {
LOGDEBUG("Not connected to geode, trying again.");
}
} catch (...) {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/statistics/PoolStatsSampler.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/statistics/PoolStatsSampler.hpp b/src/cppcache/src/statistics/PoolStatsSampler.hpp
index d22f630..2ccf809 100644
--- a/src/cppcache/src/statistics/PoolStatsSampler.hpp
+++ b/src/cppcache/src/statistics/PoolStatsSampler.hpp
@@ -24,17 +24,19 @@
namespace apache {
namespace geode {
namespace client {
+
class CacheImpl;
class ThinClientBaseDM;
class AdminRegion;
class ThinClientPoolDM;
+
} // namespace client
-} // namespace geode
-} // namespace apache
-using namespace apache::geode::client;
-namespace apache {
-namespace geode {
namespace statistics {
+
+using client::CacheImpl;
+using client::ThinClientPoolDM;
+using client::AdminRegion;
+
class StatisticsManager;
class CPPCACHE_EXPORT PoolStatsSampler : public ACE_Task_Base {
public:
@@ -54,12 +56,12 @@ class CPPCACHE_EXPORT PoolStatsSampler : public ACE_Task_Base {
volatile bool m_running;
volatile bool m_stopRequested;
int64_t m_sampleRate;
- AdminRegion* m_adminRegion;
+ std::shared_ptr<AdminRegion> m_adminRegion;
ThinClientPoolDM* m_distMan;
ACE_Recursive_Thread_Mutex m_lock;
static const char* NC_PSS_Thread;
};
-} // namespace client
+} // namespace statistics
} // namespace geode
} // namespace apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/statistics/StatisticsManager.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/statistics/StatisticsManager.cpp b/src/cppcache/src/statistics/StatisticsManager.cpp
index 9a52177..8bfe46a 100644
--- a/src/cppcache/src/statistics/StatisticsManager.cpp
+++ b/src/cppcache/src/statistics/StatisticsManager.cpp
@@ -43,7 +43,7 @@ StatisticsManager* StatisticsManager::s_singleton = NULL;
StatisticsManager::StatisticsManager(const char* filePath, int64_t sampleInterval,
bool enabled, int64_t statFileLimit,
int64_t statDiskSpaceLimit)
- : m_sampler(NULL), m_adminRegion(NULLPTR) {
+ : m_sampler(NULL), m_adminRegion(nullptr) {
m_sampleIntervalMs =
static_cast<int32_t>(sampleInterval) * 1000; /* convert to millis */
m_newlyAddedStatsList.reserve(16); // Allocate initial sizes
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/test/DataInputTest.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/test/DataInputTest.cpp b/src/cppcache/test/DataInputTest.cpp
index 5a86bc4..40a63ba 100644
--- a/src/cppcache/test/DataInputTest.cpp
+++ b/src/cppcache/test/DataInputTest.cpp
@@ -664,7 +664,8 @@ TEST_F(DataInputTest, TestReadDirectObject) {
dataInput.readDirectObject(objptr);
EXPECT_STREQ(
(const char *)"You had me at meat tornado.",
- (const char *)(dynCast<SharedPtr<CacheableString> >(objptr))->toString())
+ (const char *)(std::dynamic_pointer_cast<CacheableString>(objptr))
+ ->toString())
<< "Correct const char *";
}
@@ -675,7 +676,8 @@ TEST_F(DataInputTest, TestReadObjectSerializablePtr) {
dataInput.readObject(objptr);
EXPECT_STREQ(
(const char *)"You had me at meat tornado.",
- (const char *)(dynCast<SharedPtr<CacheableString> >(objptr))->toString())
+ (const char *)(std::dynamic_pointer_cast<CacheableString>(objptr))
+ ->toString())
<< "Correct const char *";
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/test/PdxLocalReaderTest.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/test/PdxLocalReaderTest.cpp b/src/cppcache/test/PdxLocalReaderTest.cpp
index 5b63ad3..a424000 100644
--- a/src/cppcache/test/PdxLocalReaderTest.cpp
+++ b/src/cppcache/test/PdxLocalReaderTest.cpp
@@ -69,7 +69,7 @@ TEST(PdxLocalReaderTest, x) {
// C++ Client does not require pdxDomainClassName as it is only needed
// for reflection purposes, which we do not support in C++. We pass in
// getClassName() for consistency reasons only.
- PdxTypePtr pdx_type_ptr(new PdxType(expected.getClassName(), false));
+ auto pdx_type_ptr = std::make_shared<PdxType>(expected.getClassName(), false);
// TODO: Refactor static singleton patterns in PdxTypeRegistry so that
// tests will not interfere with each other.
@@ -77,13 +77,13 @@ TEST(PdxLocalReaderTest, x) {
// Here we construct a serialized stream of bytes representing MyPdxClass.
// The stream is later deserialization and validated for consistency.
- PdxLocalWriterPtr writer(new PdxLocalWriter(stream, pdx_type_ptr));
+ auto writer = std::make_shared<PdxLocalWriter>(stream, pdx_type_ptr);
expected.toData(writer);
writer->endObjectWriting();
uint8_t *raw_stream = writer->getPdxStream(length);
DataInput input(raw_stream, length);
- PdxLocalReaderPtr reader(new PdxLocalReader(input, pdx_type_ptr, length));
+ auto reader = std::make_shared<PdxLocalReader>(input, pdx_type_ptr, length);
actual.fromData(reader);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/test/SharedBaseTest.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/test/SharedBaseTest.cpp b/src/cppcache/test/SharedBaseTest.cpp
deleted file mode 100644
index d9a739f..0000000
--- a/src/cppcache/test/SharedBaseTest.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <gtest/gtest.h>
-
-#include <geode/SharedBase.hpp>
-
-using namespace apache::geode::client;
-
-namespace {
-class TestSharedBase : public SharedBase {
- public:
- explicit TestSharedBase(bool& destructed) : m_destructed(destructed) {
- // NOP
- }
-
- virtual ~TestSharedBase() { m_destructed = true; }
-
- private:
- bool& m_destructed;
-};
-} // namespace
-
-TEST(SharedBaseTest, ProperlyInitializedAfterConstructor) {
- bool destructed = false;
- SharedBase* obj = new TestSharedBase(destructed);
- EXPECT_EQ(0, obj->refCount());
-}
-
-TEST(SharedBaseTest, PreserveIncrementsCount) {
- bool destructed = false;
- SharedBase* obj = new TestSharedBase(destructed);
- obj->preserveSB();
- EXPECT_EQ(1, obj->refCount());
-}
-
-TEST(SharedBaseTest, ReleaseDecrementsCount) {
- bool destructed = false;
- SharedBase* obj = new TestSharedBase(destructed);
- obj->preserveSB();
- obj->releaseSB();
- // Because SharedBase::releaseSB() will take the reference count to
- // zero and thus delete the object, the reference count can no longer
- // safely be inspected as that memory may have already been reused.
- // Thus, inspect the destructed flag which have been set if and only
- // if the reference count went to zero.
- EXPECT_EQ(true, destructed);
-}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/test/SharedPtrTest.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/test/SharedPtrTest.cpp b/src/cppcache/test/SharedPtrTest.cpp
deleted file mode 100644
index 24e2546..0000000
--- a/src/cppcache/test/SharedPtrTest.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <functional>
-
-#include <gtest/gtest.h>
-
-#include <geode/SharedPtr.hpp>
-
-using namespace apache::geode::client;
-
-class NotifyOnDelete : public SharedBase {
- public:
- explicit NotifyOnDelete(bool &deleted) : deleted(deleted) {}
-
- ~NotifyOnDelete() { deleted = true; }
-
- private:
- bool &deleted;
-};
-
-TEST(SharedPtrTest, ASharedPtrToASharedBaseHasAnInitialReferenceCountOfOne) {
- SharedPtr<SharedBase> my_pointer = SharedPtr<SharedBase>(new SharedBase());
-
- EXPECT_EQ(1, my_pointer->refCount());
-}
-
-TEST(SharedPtrTest, ASharedBaseWithoutASharedPtrHasAReferenceCountOfZero) {
- SharedBase *my_object = new SharedBase();
-
- EXPECT_EQ(0, my_object->refCount());
-}
-
-TEST(SharedPtrTest, AddingReferenceToASharedPtrIncrementsReferenceCount) {
- SharedPtr<SharedBase> my_pointer = SharedPtr<SharedBase>(new SharedBase());
- SharedPtr<SharedBase> your_pointer = my_pointer;
-
- EXPECT_EQ(2, my_pointer->refCount());
- EXPECT_EQ(2, your_pointer->refCount());
-}
-
-TEST(SharedPtrTest, CreatingSharedPtrFromSharedPtrIncrementsReferenceCount) {
- SharedPtr<SharedBase> my_pointer = SharedPtr<SharedBase>(new SharedBase());
- SharedPtr<SharedBase> your_pointer = SharedPtr<SharedBase>(my_pointer);
-
- EXPECT_EQ(2, my_pointer->refCount());
- EXPECT_EQ(2, your_pointer->refCount());
-}
-
-TEST(SharedPtrTest, CallingImplicitDestructorWillDecrementReferenceCount) {
- SharedPtr<SharedBase> my_pointer = SharedPtr<SharedBase>(new SharedBase());
- {
- SharedPtr<SharedBase> your_pointer = SharedPtr<SharedBase>(my_pointer);
-
- // At following "}" your_pointer reference is destroyed
- EXPECT_EQ(2, my_pointer->refCount());
- }
-
- EXPECT_EQ(1, my_pointer->refCount());
-}
-
-TEST(SharedPtrTest, CallingExplicitDestructorWillDecrementReferenceCount) {
- SharedPtr<SharedBase> *my_pointer =
- new SharedPtr<SharedBase>(new SharedBase());
- SharedPtr<SharedBase> *your_pointer = new SharedPtr<SharedBase>(*my_pointer);
-
- EXPECT_EQ(2, (*my_pointer)->refCount());
- delete your_pointer;
-
- EXPECT_EQ(1, (*my_pointer)->refCount());
-}
-
-TEST(SharedPtrTest, SharedPtrIsDestroyedWhenReferenceCountIsZero) {
- bool is_shared_object_deleted = false;
-
- SharedPtr<NotifyOnDelete> *my_pointer = new SharedPtr<NotifyOnDelete>(
- new NotifyOnDelete(is_shared_object_deleted));
-
- delete my_pointer;
-
- EXPECT_TRUE(is_shared_object_deleted);
-}
-
-TEST(SharedPtrTest, SharedPtrIsNotDestroyedUntilReferenceCountIsZero) {
- bool is_shared_object_deleted = false;
- {
- SharedPtr<NotifyOnDelete> my_pointer =
- SharedPtr<NotifyOnDelete>(new NotifyOnDelete(is_shared_object_deleted));
-
- {
- SharedPtr<NotifyOnDelete> your_pointer = my_pointer;
-
- EXPECT_EQ(false, is_shared_object_deleted);
- }
-
- EXPECT_EQ(false, is_shared_object_deleted);
- }
-
- EXPECT_EQ(true, is_shared_object_deleted);
-}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/test/TcrMessage_unittest.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/test/TcrMessage_unittest.cpp b/src/cppcache/test/TcrMessage_unittest.cpp
index e6752ea..ed582a9 100644
--- a/src/cppcache/test/TcrMessage_unittest.cpp
+++ b/src/cppcache/test/TcrMessage_unittest.cpp
@@ -161,8 +161,8 @@ TEST_F(TcrMessageTest, testConstructorWithCONTAINS_KEY) {
TcrMessageContainsKey message(
static_cast<const Region *>(NULL),
CacheableString::create(
- "mykey"), // static_cast<const CacheableKeyPtr>(NULLPTR),
- static_cast<const UserDataPtr>(NULLPTR),
+ "mykey"), // static_cast<const CacheableKeyPtr>(nullptr),
+ static_cast<const UserDataPtr>(nullptr),
true, // isContainsKey
static_cast<ThinClientBaseDM *>(NULL));
EXPECT_EQ(TcrMessage::CONTAINS_KEY, message.getMessageType());
@@ -185,8 +185,8 @@ TEST_F(TcrMessageTest, testConstructor2WithREQUEST) {
TcrMessageRequest message(
static_cast<const Region *>(NULL),
CacheableString::create(
- "mykey"), // static_cast<const CacheableKeyPtr>(NULLPTR),
- static_cast<const UserDataPtr>(NULLPTR),
+ "mykey"), // static_cast<const CacheableKeyPtr>(nullptr),
+ static_cast<const UserDataPtr>(nullptr),
static_cast<ThinClientBaseDM *>(NULL));
EXPECT_EQ(TcrMessage::REQUEST, message.getMessageType());
@@ -200,8 +200,8 @@ TEST_F(TcrMessageTest, testConstructor2WithREQUEST) {
TEST_F(TcrMessageTest, testConstructor2WithDESTROY) {
TcrMessageDestroy message(static_cast<const Region *>(NULL),
CacheableString::create("mykey"),
- static_cast<const CacheableKeyPtr>(NULLPTR),
- static_cast<const UserDataPtr>(NULLPTR),
+ static_cast<const CacheableKeyPtr>(nullptr),
+ static_cast<const UserDataPtr>(nullptr),
static_cast<ThinClientBaseDM *>(NULL));
EXPECT_EQ(TcrMessage::DESTROY, message.getMessageType());
@@ -217,8 +217,8 @@ TEST_F(TcrMessageTest, testConstructor2WithINVALIDATE) {
TcrMessageInvalidate message(
static_cast<const Region *>(NULL),
CacheableString::create(
- "mykey"), // static_cast<const CacheableKeyPtr>(NULLPTR),
- static_cast<const UserDataPtr>(NULLPTR),
+ "mykey"), // static_cast<const CacheableKeyPtr>(nullptr),
+ static_cast<const UserDataPtr>(nullptr),
static_cast<ThinClientBaseDM *>(NULL));
EXPECT_EQ(TcrMessage::INVALIDATE, message.getMessageType());
@@ -234,7 +234,7 @@ TEST_F(TcrMessageTest, testConstructor3WithPUT) {
TcrMessagePut message(static_cast<const Region *>(NULL),
CacheableString::create("mykey"),
CacheableString::create("myvalue"),
- static_cast<const UserDataPtr>(NULLPTR),
+ static_cast<const UserDataPtr>(nullptr),
false, // isDelta
static_cast<ThinClientBaseDM *>(NULL),
false, // isMetaRegion
@@ -413,7 +413,7 @@ TEST_F(TcrMessageTest, testConstructorADD_PDX_TYPE) {
}
TEST_F(TcrMessageTest, testConstructorGET_PDX_ID_FOR_ENUM) {
- TcrMessageGetPdxIdForEnum message(static_cast<CacheablePtr>(NULLPTR),
+ TcrMessageGetPdxIdForEnum message(static_cast<CacheablePtr>(nullptr),
static_cast<ThinClientBaseDM *>(NULL), 42);
EXPECT_EQ(TcrMessage::GET_PDX_ID_FOR_ENUM, message.getMessageType());
@@ -423,7 +423,7 @@ TEST_F(TcrMessageTest, testConstructorGET_PDX_ID_FOR_ENUM) {
TEST_F(TcrMessageTest, testConstructorADD_PDX_ENUM) {
CacheablePtr myPtr(CacheableString::createDeserializable());
- TcrMessageAddPdxEnum message(static_cast<CacheablePtr>(NULLPTR),
+ TcrMessageAddPdxEnum message(static_cast<CacheablePtr>(nullptr),
static_cast<ThinClientBaseDM *>(NULL), 42);
EXPECT_EQ(TcrMessage::ADD_PDX_ENUM, message.getMessageType());
@@ -434,7 +434,7 @@ TEST_F(TcrMessageTest, testConstructorADD_PDX_ENUM) {
}
TEST_F(TcrMessageTest, testConstructorEventId) {
- TcrMessageRequestEventValue message(static_cast<EventIdPtr>(NULLPTR));
+ TcrMessageRequestEventValue message(static_cast<EventIdPtr>(nullptr));
EXPECT_EQ(TcrMessage::REQUEST_EVENT_VALUE, message.getMessageType());
@@ -457,7 +457,7 @@ TEST_F(TcrMessageTest, testConstructorREMOVE_USER_AUTH) {
}
TEST_F(TcrMessageTest, testConstructorUSER_CREDENTIAL_MESSAGE) {
- TcrMessageUserCredential message(static_cast<PropertiesPtr>(NULLPTR),
+ TcrMessageUserCredential message(static_cast<PropertiesPtr>(nullptr),
static_cast<ThinClientBaseDM *>(NULL));
EXPECT_EQ(TcrMessage::USER_CREDENTIAL_MESSAGE, message.getMessageType());
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/quickstart/cpp/CqQuery.cpp
----------------------------------------------------------------------
diff --git a/src/quickstart/cpp/CqQuery.cpp b/src/quickstart/cpp/CqQuery.cpp
index 4871b5b..07d85f8 100644
--- a/src/quickstart/cpp/CqQuery.cpp
+++ b/src/quickstart/cpp/CqQuery.cpp
@@ -46,8 +46,8 @@ class MyCqListener : public CqListener {
public:
void onEvent(const CqEvent& cqe) {
char* opStr = (char*)"Default";
- PortfolioPtr portfolio(dynamic_cast<Portfolio*>(cqe.getNewValue().ptr()));
- CacheableStringPtr key(dynamic_cast<CacheableString*>(cqe.getKey().ptr()));
+ PortfolioPtr portfolio(dynamic_cast<Portfolio*>(cqe.getNewValue().get()));
+ CacheableStringPtr key(dynamic_cast<CacheableString*>(cqe.getKey().get()));
switch (cqe.getQueryOperation()) {
case CqOperation::OP_TYPE_CREATE: {
opStr = (char*)"CREATE";
@@ -137,20 +137,20 @@ int main(int argc, char** argv) {
SelectResultsIterator iter = resultsPtr->getIterator();
while (iter.hasNext()) {
SerializablePtr ser = iter.next();
- if (ser != NULLPTR) {
+ if (ser != nullptr) {
LOGINFO(" query pulled object %s\n", ser->toString()->asChar());
- StructPtr stPtr(dynamic_cast<Struct*>(ser.ptr()));
- if (stPtr != NULLPTR) {
+ StructPtr stPtr(dynamic_cast<Struct*>(ser.get()));
+ if (stPtr != nullptr) {
LOGINFO(" got struct ptr ");
- SerializablePtr serKey = (*(stPtr.ptr()))["key"];
- if (serKey != NULLPTR) {
+ SerializablePtr serKey = (*(stPtr.get()))["key"];
+ if (serKey != nullptr) {
LOGINFO("got struct key %s\n", serKey->toString()->asChar());
}
- SerializablePtr serVal = (*(stPtr.ptr()))["value"];
+ SerializablePtr serVal = (*(stPtr.get()))["value"];
- if (serVal != NULLPTR) {
+ if (serVal != nullptr) {
LOGINFO(" got struct value %s\n", serVal->toString()->asChar());
}
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/quickstart/cpp/Delta.cpp
----------------------------------------------------------------------
diff --git a/src/quickstart/cpp/Delta.cpp b/src/quickstart/cpp/Delta.cpp
index 3c95f67..d31885f 100644
--- a/src/quickstart/cpp/Delta.cpp
+++ b/src/quickstart/cpp/Delta.cpp
@@ -82,7 +82,7 @@ int main(int argc, char** argv) {
regPtr->localInvalidate("Key1");
// Fetching the value from server.
- DeltaExamplePtr retVal = dynCast<DeltaExamplePtr>(regPtr->get("Key1"));
+ auto retVal = std::dynamic_pointer_cast<DeltaExample>(regPtr->get("Key1"));
// Verification
if (retVal->getField1() != 9)
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/quickstart/cpp/Exceptions.cpp
----------------------------------------------------------------------
diff --git a/src/quickstart/cpp/Exceptions.cpp b/src/quickstart/cpp/Exceptions.cpp
index 570322e..df714de 100644
--- a/src/quickstart/cpp/Exceptions.cpp
+++ b/src/quickstart/cpp/Exceptions.cpp
@@ -83,7 +83,7 @@ int main(int argc, char** argv) {
LOGINFO("Obtained the second Entry from the Region");
// Destroy exampleRegion2.
- UserDataPtr userDataPtr = NULLPTR;
+ UserDataPtr userDataPtr = nullptr;
regionPtr2->destroyRegion(userDataPtr);
try {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/quickstart/cpp/ExecuteFunctions.cpp
----------------------------------------------------------------------
diff --git a/src/quickstart/cpp/ExecuteFunctions.cpp b/src/quickstart/cpp/ExecuteFunctions.cpp
index f4ffbae..db9660f 100644
--- a/src/quickstart/cpp/ExecuteFunctions.cpp
+++ b/src/quickstart/cpp/ExecuteFunctions.cpp
@@ -87,11 +87,11 @@ int main(int argc, char** argv) {
ExecutionPtr exc = FunctionService::onServer((RegionServicePtr)cachePtr);
CacheableVectorPtr executeFunctionResult =
exc->withArgs(args)->execute(getFuncIName)->getResult();
- if (executeFunctionResult == NULLPTR) {
+ if (executeFunctionResult == nullptr) {
LOGINFO("get executeFunctionResult is NULL");
} else {
for (int32_t item = 0; item < executeFunctionResult->size(); item++) {
- CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>(
+ auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>(
executeFunctionResult->operator[](item));
for (int32_t pos = 0; pos < arrayList->size(); pos++) {
resultList->push_back(arrayList->operator[](pos));
@@ -102,7 +102,7 @@ int main(int argc, char** argv) {
for (int32_t i = 0; i < executeFunctionResult->size(); i++) {
sprintf(
buf, "get result[%d]=%s", i,
- dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar());
+ std::dynamic_pointer_cast<CacheableString>(resultList->operator[](i))->asChar());
LOGINFO(buf);
}
}
@@ -116,12 +116,12 @@ int main(int argc, char** argv) {
exc = FunctionService::onServers((RegionServicePtr)cachePtr);
executeFunctionResult =
exc->withArgs(args)->execute(getFuncIName)->getResult();
- if (executeFunctionResult == NULLPTR) {
+ if (executeFunctionResult == nullptr) {
LOGINFO("get executeFunctionResult is NULL");
} else {
resultList->clear();
for (int32_t item = 0; item < executeFunctionResult->size(); item++) {
- CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>(
+ auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>(
executeFunctionResult->operator[](item));
for (int32_t pos = 0; pos < arrayList->size(); pos++) {
resultList->push_back(arrayList->operator[](pos));
@@ -132,7 +132,7 @@ int main(int argc, char** argv) {
for (int32_t i = 0; i < executeFunctionResult->size(); i++) {
sprintf(
buf, "get result[%d]=%s", i,
- dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar());
+ std::dynamic_pointer_cast<CacheableString>(resultList->operator[](i))->asChar());
LOGINFO(buf);
}
}
@@ -148,14 +148,14 @@ int main(int argc, char** argv) {
->withArgs(args)
->execute(getFuncName)
->getResult();
- if (executeFunctionResult == NULLPTR) {
+ if (executeFunctionResult == nullptr) {
LOGINFO("execute on region: executeFunctionResult is NULL");
} else {
resultList->clear();
LOGINFO("Execute on Region: result count = %d",
executeFunctionResult->size());
for (int32_t i = 0; i < executeFunctionResult->size(); i++) {
- CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>(
+ auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>(
executeFunctionResult->operator[](i));
for (int32_t pos = 0; pos < arrayList->size(); pos++) {
resultList->push_back(arrayList->operator[](pos));
@@ -167,7 +167,7 @@ int main(int argc, char** argv) {
for (int32_t i = 0; i < resultList->size(); i++) {
sprintf(
buf, "Execute on Region: result[%d]=%s", i,
- dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar());
+ std::dynamic_pointer_cast<CacheableString>(resultList->operator[](i))->asChar());
LOGINFO(buf);
}
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/quickstart/cpp/HACache.cpp
----------------------------------------------------------------------
diff --git a/src/quickstart/cpp/HACache.cpp b/src/quickstart/cpp/HACache.cpp
index 7508fd1..bef557d 100644
--- a/src/quickstart/cpp/HACache.cpp
+++ b/src/quickstart/cpp/HACache.cpp
@@ -81,12 +81,12 @@ int main(int argc, char** argv) {
int count = 0;
- if (regionPtr->get(key1) == NULLPTR) {
+ if (regionPtr->get(key1) == nullptr) {
LOGINFO("Verified that key1 has been destroyed");
count++;
}
- if (regionPtr->get(key2) == NULLPTR) {
+ if (regionPtr->get(key2) == nullptr) {
LOGINFO("Verified that key2 has been destroyed");
count++;
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/quickstart/cpp/MultiuserSecurity.cpp
----------------------------------------------------------------------
diff --git a/src/quickstart/cpp/MultiuserSecurity.cpp b/src/quickstart/cpp/MultiuserSecurity.cpp
index 131b815..9aa240f 100644
--- a/src/quickstart/cpp/MultiuserSecurity.cpp
+++ b/src/quickstart/cpp/MultiuserSecurity.cpp
@@ -78,11 +78,11 @@ void runWithUserRoot(CachePtr cachePtr) {
CacheableVectorPtr executeFunctionResult =
exc->withArgs(args)->execute(getFuncIName, getResult)->getResult();
CacheableVectorPtr resultList = CacheableVector::create();
- if (executeFunctionResult == NULLPTR) {
+ if (executeFunctionResult == nullptr) {
LOGINFO("get executeFunctionResult is NULL");
} else {
for (int item = 0; item < executeFunctionResult->size(); item++) {
- CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>(
+ auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>(
executeFunctionResult->operator[](item));
for (int pos = 0; pos < arrayList->size(); pos++) {
resultList->push_back(arrayList->operator[](pos));
@@ -93,7 +93,7 @@ void runWithUserRoot(CachePtr cachePtr) {
for (int i = 0; i < resultList->size(); i++) {
sprintf(buf, "get result[%d]=%s", i,
- dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar());
+ std::dynamic_pointer_cast<CacheableString>(resultList->operator[](i))->asChar());
LOGINFO(buf);
}
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/quickstart/cpp/PdxRemoteQuery.cpp
----------------------------------------------------------------------
diff --git a/src/quickstart/cpp/PdxRemoteQuery.cpp b/src/quickstart/cpp/PdxRemoteQuery.cpp
index ebc9ec0..70038a9 100644
--- a/src/quickstart/cpp/PdxRemoteQuery.cpp
+++ b/src/quickstart/cpp/PdxRemoteQuery.cpp
@@ -105,7 +105,7 @@ int main(int argc, char** argv) {
SelectResultsIterator iter = resultsPtr->getIterator();
while (iter.hasNext()) {
rowCount++;
- Struct* psi = dynamic_cast<Struct*>(iter.next().ptr());
+ Struct* psi = dynamic_cast<Struct*>(iter.next().get());
LOGINFO("Row %d Column 1 is named %s, value is %s", rowCount,
psi->getFieldName(0), (*psi)[0]->toString()->asChar());
LOGINFO("Row %d Column 2 is named %s, value is %S", rowCount,
@@ -119,7 +119,7 @@ int main(int argc, char** argv) {
// Execute the Region selectValue() API.
SerializablePtr resultPtr = regionPtr->selectValue("ID = 3");
- PortfolioPdxPtr portPtr = dynCast<PortfolioPdxPtr>(resultPtr);
+ auto portPtr = std::dynamic_pointer_cast<PortfolioPdx>(resultPtr);
LOGINFO("Region selectValue() returned an item:\n %s",
portPtr->toString()->asChar());
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/quickstart/cpp/PdxSerializer.cpp
----------------------------------------------------------------------
diff --git a/src/quickstart/cpp/PdxSerializer.cpp b/src/quickstart/cpp/PdxSerializer.cpp
index 54ae8e7..1d76ad3 100644
--- a/src/quickstart/cpp/PdxSerializer.cpp
+++ b/src/quickstart/cpp/PdxSerializer.cpp
@@ -205,7 +205,7 @@ int main(int argc, char** argv) {
SelectResultsIterator iter = resultsPtr->getIterator();
while (iter.hasNext()) {
rowCount++;
- Struct* psi = dynamic_cast<Struct*>(iter.next().ptr());
+ Struct* psi = dynamic_cast<Struct*>(iter.next().get());
LOGINFO("Row %d Column 1 is named %s, value is %S", rowCount,
psi->getFieldName(0), (*psi)[0]->toString()->asWChar());
LOGINFO("Row %d Column 2 is named %s, value is %s", rowCount,
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/quickstart/cpp/PoolCqQuery.cpp
----------------------------------------------------------------------
diff --git a/src/quickstart/cpp/PoolCqQuery.cpp b/src/quickstart/cpp/PoolCqQuery.cpp
index 5936c76..cd91fcf 100644
--- a/src/quickstart/cpp/PoolCqQuery.cpp
+++ b/src/quickstart/cpp/PoolCqQuery.cpp
@@ -49,8 +49,8 @@ class MyCqListener : public CqListener {
public:
void onEvent(const CqEvent& cqe) {
char* opStr = (char*)"Default";
- PortfolioPtr portfolio(dynamic_cast<Portfolio*>(cqe.getNewValue().ptr()));
- CacheableStringPtr key(dynamic_cast<CacheableString*>(cqe.getKey().ptr()));
+ PortfolioPtr portfolio(dynamic_cast<Portfolio*>(cqe.getNewValue().get()));
+ CacheableStringPtr key(dynamic_cast<CacheableString*>(cqe.getKey().get()));
switch (cqe.getQueryOperation()) {
case CqOperation::OP_TYPE_CREATE: {
opStr = (char*)"CREATE";
@@ -147,19 +147,19 @@ int main(int argc, char** argv) {
SelectResultsIterator iter = resultsPtr->getIterator();
while (iter.hasNext()) {
SerializablePtr ser = iter.next();
- if (ser != NULLPTR) {
+ if (ser != nullptr) {
LOGINFO(" query pulled object %s\n", ser->toString()->asChar());
- StructPtr stPtr(dynamic_cast<Struct*>(ser.ptr()));
- if (stPtr != NULLPTR) {
+ StructPtr stPtr(dynamic_cast<Struct*>(ser.get()));
+ if (stPtr != nullptr) {
LOGINFO(" got struct ptr ");
- SerializablePtr serKey = (*(stPtr.ptr()))["key"];
- if (serKey != NULLPTR) {
+ SerializablePtr serKey = (*(stPtr.get()))["key"];
+ if (serKey != nullptr) {
LOGINFO("got struct key %s\n", serKey->toString()->asChar());
}
- SerializablePtr serVal = (*(stPtr.ptr()))["value"];
+ SerializablePtr serVal = (*(stPtr.get()))["value"];
- if (serVal != NULLPTR) {
+ if (serVal != nullptr) {
LOGINFO(" got struct value %s\n", serVal->toString()->asChar());
}
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/quickstart/cpp/PoolRemoteQuery.cpp
----------------------------------------------------------------------
diff --git a/src/quickstart/cpp/PoolRemoteQuery.cpp b/src/quickstart/cpp/PoolRemoteQuery.cpp
index 6bfefa1..57c7250 100644
--- a/src/quickstart/cpp/PoolRemoteQuery.cpp
+++ b/src/quickstart/cpp/PoolRemoteQuery.cpp
@@ -105,7 +105,7 @@ int main(int argc, char** argv) {
SelectResultsIterator iter = resultsPtr->getIterator();
while (iter.hasNext()) {
rowCount++;
- Struct* psi = dynamic_cast<Struct*>(iter.next().ptr());
+ Struct* psi = dynamic_cast<Struct*>(iter.next().get());
LOGINFO("Row %d Column 1 is named %s, value is %s", rowCount,
psi->getFieldName(0), (*psi)[0]->toString()->asChar());
LOGINFO("Row %d Column 2 is named %s, value is %s", rowCount,
@@ -119,7 +119,7 @@ int main(int argc, char** argv) {
// Execute the Region selectValue() API.
SerializablePtr resultPtr = regionPtr->selectValue("ID = 3");
- PortfolioPtr portPtr = dynCast<PortfolioPtr>(resultPtr);
+ auto portPtr = std::dynamic_pointer_cast<Portfolio>(resultPtr);
LOGINFO("Region selectValue() returned an item:\n %s",
portPtr->toString()->asChar());
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/quickstart/cpp/PutAllGetAllOperations.cpp
----------------------------------------------------------------------
diff --git a/src/quickstart/cpp/PutAllGetAllOperations.cpp b/src/quickstart/cpp/PutAllGetAllOperations.cpp
index 0d01b23..f79ed0b 100644
--- a/src/quickstart/cpp/PutAllGetAllOperations.cpp
+++ b/src/quickstart/cpp/PutAllGetAllOperations.cpp
@@ -75,7 +75,7 @@ int main(int argc, char** argv) {
}
HashMapOfCacheablePtr values(new HashMapOfCacheable());
- regionPtr->getAll(keys, values, NULLPTR, true);
+ regionPtr->getAll(keys, values, nullptr, true);
LOGINFO("Obtained 100 entries from the Region");
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/quickstart/cpp/RegisterInterest.cpp
----------------------------------------------------------------------
diff --git a/src/quickstart/cpp/RegisterInterest.cpp b/src/quickstart/cpp/RegisterInterest.cpp
index d816d97..d3f4807 100644
--- a/src/quickstart/cpp/RegisterInterest.cpp
+++ b/src/quickstart/cpp/RegisterInterest.cpp
@@ -86,7 +86,7 @@ int main(int argc, char** argv) {
// Register Interest on Region for All Keys with getInitialValues to
// populate the cache with values of all keys from the server.
regionPtr->registerAllKeys(
- false, NULLPTR, true); // Where the 3rd argument is getInitialValues.
+ false, nullptr, true); // Where the 3rd argument is getInitialValues.
// Unregister Interest on Region for All Keys.
regionPtr->unregisterAllKeys();
@@ -108,7 +108,7 @@ int main(int argc, char** argv) {
// Register and Unregister Interest on Region for Keys matching a Regular
// Expression with getInitialValues.
- regionPtr->registerRegex("Keys-*", false, NULLPTR, true);
+ regionPtr->registerRegex("Keys-*", false, nullptr, true);
regionPtr->unregisterRegex("Keys-*");
LOGINFO(
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/quickstart/cpp/RemoteQuery.cpp
----------------------------------------------------------------------
diff --git a/src/quickstart/cpp/RemoteQuery.cpp b/src/quickstart/cpp/RemoteQuery.cpp
index d54d252..ceed757 100644
--- a/src/quickstart/cpp/RemoteQuery.cpp
+++ b/src/quickstart/cpp/RemoteQuery.cpp
@@ -102,7 +102,7 @@ int main(int argc, char** argv) {
SelectResultsIterator iter = resultsPtr->getIterator();
while (iter.hasNext()) {
rowCount++;
- Struct* psi = dynamic_cast<Struct*>(iter.next().ptr());
+ Struct* psi = dynamic_cast<Struct*>(iter.next().get());
LOGINFO("Row %d Column 1 is named %s, value is %s", rowCount,
psi->getFieldName(0), (*psi)[0]->toString()->asChar());
LOGINFO("Row %d Column 2 is named %s, value is %s", rowCount,
@@ -116,7 +116,7 @@ int main(int argc, char** argv) {
// Execute the Region selectValue() API.
SerializablePtr resultPtr = regionPtr->selectValue("ID = 3");
- PortfolioPtr portPtr = dynCast<PortfolioPtr>(resultPtr);
+ auto portPtr = std::dynamic_pointer_cast<Portfolio>(resultPtr);
LOGINFO("Region selectValue() returned an item:\n %s",
portPtr->toString()->asChar());
@@ -145,7 +145,7 @@ int main(int argc, char** argv) {
SelectResultsIterator itr = pqresultsPtr->getIterator();
while (itr.hasNext()) {
rowCount++;
- Struct* pst = dynamic_cast<Struct*>(itr.next().ptr());
+ Struct* pst = dynamic_cast<Struct*>(itr.next().get());
LOGINFO("Row %d Column 1 is named %s, value is %s", rowCount,
pst->getFieldName(0), (*pst)[0]->toString()->asChar());
LOGINFO("Row %d Column 2 is named %s, value is %s", rowCount,
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/quickstart/cpp/plugins/DurableCacheListener.cpp
----------------------------------------------------------------------
diff --git a/src/quickstart/cpp/plugins/DurableCacheListener.cpp b/src/quickstart/cpp/plugins/DurableCacheListener.cpp
index 2716a27..5de4584 100644
--- a/src/quickstart/cpp/plugins/DurableCacheListener.cpp
+++ b/src/quickstart/cpp/plugins/DurableCacheListener.cpp
@@ -21,13 +21,13 @@ void DurableCacheListener::afterRegionLive(const RegionEvent& event) {
LOGINFO("DurableCacheListener: Got an afterRegionLive event.");
}
void DurableCacheListener::afterCreate(const EntryEvent& event) {
- CacheableStringPtr key = dynCast<CacheableStringPtr>(event.getKey());
+ auto key = std::dynamic_pointer_cast<CacheableString>(event.getKey());
LOGINFO("DurableCacheListener: Got an afterCreate event for key: %s ",
key->toString());
}
void DurableCacheListener::afterUpdate(const EntryEvent& event) {
- CacheableStringPtr key = dynCast<CacheableStringPtr>(event.getKey());
+ auto key = std::dynamic_pointer_cast<CacheableString>(event.getKey());
LOGINFO("DurableCacheListener: Got an afterUpdate event for key: %s ",
key->toString());
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/quickstart/cpp/queryobjects/Portfolio.cpp
----------------------------------------------------------------------
diff --git a/src/quickstart/cpp/queryobjects/Portfolio.cpp b/src/quickstart/cpp/queryobjects/Portfolio.cpp
index 9692a22..f9828eb 100644
--- a/src/quickstart/cpp/queryobjects/Portfolio.cpp
+++ b/src/quickstart/cpp/queryobjects/Portfolio.cpp
@@ -43,7 +43,7 @@ Portfolio::Portfolio(int32_t i, uint32_t size, CacheableStringArrayPtr nm)
position2 =
new Position(secIds[Position::cnt % numSecIds], Position::cnt * 1000);
} else {
- position2 = NULLPTR;
+ position2 = nullptr;
}
positions = CacheableHashMap::create();
positions->insert(CacheableString::create(secIds[Position::cnt % numSecIds]),
@@ -104,7 +104,7 @@ CacheableStringPtr Portfolio::toString() const {
char idbuf[1024];
sprintf(idbuf, "PortfolioObject: [ ID=%d", ID);
char pkidbuf[1024];
- if (pkid != NULLPTR) {
+ if (pkid != nullptr) {
sprintf(pkidbuf, " status=%s type=%s pkid=%s\n", this->status,
this->type->toString(), this->pkid->asChar());
} else {
@@ -112,19 +112,19 @@ CacheableStringPtr Portfolio::toString() const {
this->type->toString(), this->pkid->asChar());
}
char position1buf[2048];
- if (position1 != NULLPTR) {
+ if (position1 != nullptr) {
sprintf(position1buf, "\t\t\t P1: %s", position1->toString()->asChar());
} else {
sprintf(position1buf, "\t\t\t P1: %s", "NULL");
}
char position2buf[2048];
- if (position2 != NULLPTR) {
+ if (position2 != nullptr) {
sprintf(position2buf, " P2: %s", position2->toString()->asChar());
} else {
sprintf(position2buf, " P2: %s ]", "NULL");
}
char creationdatebuf[2048];
- if (creationDate != NULLPTR) {
+ if (creationDate != nullptr) {
sprintf(creationdatebuf, "creation Date %s",
creationDate->toString()->asChar());
} else {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/quickstart/cpp/queryobjects/Portfolio.hpp
----------------------------------------------------------------------
diff --git a/src/quickstart/cpp/queryobjects/Portfolio.hpp b/src/quickstart/cpp/queryobjects/Portfolio.hpp
index d7728b1..a0a46d5 100644
--- a/src/quickstart/cpp/queryobjects/Portfolio.hpp
+++ b/src/quickstart/cpp/queryobjects/Portfolio.hpp
@@ -47,21 +47,21 @@ class TESTOBJECT_EXPORT Portfolio : public Serializable {
uint8_t* arrayZeroSize;
inline uint32_t getObjectSize(const SerializablePtr& obj) const {
- return (obj == NULLPTR ? 0 : obj->objectSize());
+ return (obj == nullptr ? 0 : obj->objectSize());
}
public:
Portfolio()
: ID(0),
- pkid(NULLPTR),
- type(NULLPTR),
+ pkid(nullptr),
+ type(nullptr),
status(NULL),
newVal(NULL),
- creationDate(NULLPTR),
+ creationDate(nullptr),
arrayNull(NULL),
arrayZeroSize(NULL) {}
Portfolio(int32_t id, uint32_t size = 0,
- CacheableStringArrayPtr nm = NULLPTR);
+ CacheableStringArrayPtr nm = nullptr);
virtual ~Portfolio();
virtual uint32_t objectSize() const {
@@ -82,7 +82,7 @@ class TESTOBJECT_EXPORT Portfolio : public Serializable {
int32_t getID() { return ID; }
void showNames(const char* label) {
LOGINFO(label);
- if (names == NULLPTR) {
+ if (names == nullptr) {
LOGINFO("names is NULL");
return;
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/quickstart/cpp/queryobjects/PortfolioPdx.cpp
----------------------------------------------------------------------
diff --git a/src/quickstart/cpp/queryobjects/PortfolioPdx.cpp b/src/quickstart/cpp/queryobjects/PortfolioPdx.cpp
index 1f112f1..c505514 100644
--- a/src/quickstart/cpp/queryobjects/PortfolioPdx.cpp
+++ b/src/quickstart/cpp/queryobjects/PortfolioPdx.cpp
@@ -50,7 +50,7 @@ PortfolioPdx::PortfolioPdx(int32_t i, int32_t size, char** nm) : names(nm) {
position2 = new PositionPdx(secIds[PositionPdx::cnt % numSecIds],
PositionPdx::cnt * 1000);
} else {
- position2 = NULLPTR;
+ position2 = nullptr;
}
positions = CacheableHashMap::create();
positions->insert(
@@ -134,9 +134,9 @@ void PortfolioPdx::fromData(PdxReaderPtr pr) {
id = pr->readInt("ID");
pkid = pr->readString("pkid");
- position1 = dynCast<PositionPdxPtr>(pr->readObject("position1"));
- position2 = dynCast<PositionPdxPtr>(pr->readObject("position2"));
- positions = dynCast<CacheableHashMapPtr>(pr->readObject("positions"));
+ position1 = std::dynamic_pointer_cast<PositionPdx>(pr->readObject("position1"));
+ position2 = std::dynamic_pointer_cast<PositionPdx>(pr->readObject("position2"));
+ positions = std::dynamic_pointer_cast<CacheableHashMap>(pr->readObject("positions"));
type = pr->readString("type");
status = pr->readString("status");
@@ -165,19 +165,19 @@ CacheableStringPtr PortfolioPdx::toString() const {
this->pkid);
}
char position1buf[2048];
- if (position1 != NULLPTR) {
+ if (position1 != nullptr) {
sprintf(position1buf, "\t\t\t P1: %s", position1->toString()->asChar());
} else {
sprintf(position1buf, "\t\t\t P1: %s", "NULL");
}
char position2buf[2048];
- if (position2 != NULLPTR) {
+ if (position2 != nullptr) {
sprintf(position2buf, " P2: %s", position2->toString()->asChar());
} else {
sprintf(position2buf, " P2: %s ]", "NULL");
}
char creationdatebuf[2048];
- if (creationDate != NULLPTR) {
+ if (creationDate != nullptr) {
sprintf(creationdatebuf, "creation Date %s",
creationDate->toString()->asChar());
} else {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/quickstart/cpp/queryobjects/PortfolioPdx.hpp
----------------------------------------------------------------------
diff --git a/src/quickstart/cpp/queryobjects/PortfolioPdx.hpp b/src/quickstart/cpp/queryobjects/PortfolioPdx.hpp
index 06606a3..e82e8cb 100644
--- a/src/quickstart/cpp/queryobjects/PortfolioPdx.hpp
+++ b/src/quickstart/cpp/queryobjects/PortfolioPdx.hpp
@@ -54,7 +54,7 @@ class TESTOBJECT_EXPORT PortfolioPdx : public PdxSerializable {
type(NULL),
status(NULL),
newVal(NULL),
- creationDate(NULLPTR),
+ creationDate(nullptr),
arrayNull(NULL),
arrayZeroSize(NULL) {}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/quickstart/cpp/queryobjects/PortfolioPdxAuto.cpp
----------------------------------------------------------------------
diff --git a/src/quickstart/cpp/queryobjects/PortfolioPdxAuto.cpp b/src/quickstart/cpp/queryobjects/PortfolioPdxAuto.cpp
index 94a3617..38ba553 100644
--- a/src/quickstart/cpp/queryobjects/PortfolioPdxAuto.cpp
+++ b/src/quickstart/cpp/queryobjects/PortfolioPdxAuto.cpp
@@ -51,7 +51,7 @@ PortfolioPdxAuto::PortfolioPdxAuto(int32_t i, int32_t size,
position2 = new PositionPdxAuto(secIds[PositionPdxAuto::cnt % numSecIds],
PositionPdxAuto::cnt * 1000);
} else {
- position2 = NULLPTR;
+ position2 = nullptr;
}
positions = CacheableHashMap::create();
positions->insert(
@@ -112,19 +112,19 @@ CacheableStringPtr PortfolioPdxAuto::toString() const {
this->pkid);
}
char position1buf[2048];
- if (position1 != NULLPTR) {
+ if (position1 != nullptr) {
sprintf(position1buf, "\t\t\t P1: %s", position1->toString()->asChar());
} else {
sprintf(position1buf, "\t\t\t P1: %s", "NULL");
}
char position2buf[2048];
- if (position2 != NULLPTR) {
+ if (position2 != nullptr) {
sprintf(position2buf, " P2: %s", position2->toString()->asChar());
} else {
sprintf(position2buf, " P2: %s ]", "NULL");
}
char creationdatebuf[2048];
- if (creationDate != NULLPTR) {
+ if (creationDate != nullptr) {
sprintf(creationdatebuf, "creation Date %s",
creationDate->toString()->asChar());
} else {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/quickstart/cpp/queryobjects/PortfolioPdxAuto.hpp
----------------------------------------------------------------------
diff --git a/src/quickstart/cpp/queryobjects/PortfolioPdxAuto.hpp b/src/quickstart/cpp/queryobjects/PortfolioPdxAuto.hpp
index cf8dcc2..44decf9 100644
--- a/src/quickstart/cpp/queryobjects/PortfolioPdxAuto.hpp
+++ b/src/quickstart/cpp/queryobjects/PortfolioPdxAuto.hpp
@@ -58,7 +58,7 @@ class PortfolioPdxAuto : public apache::geode::client::PdxSerializable {
type(NULL),
status(NULL),
newVal(NULL),
- creationDate(NULLPTR),
+ creationDate(nullptr),
arrayNull(NULL),
arrayNullSize(0),
arrayZeroSize(NULL),
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/quickstart/cpp/queryobjects/Position.cpp
----------------------------------------------------------------------
diff --git a/src/quickstart/cpp/queryobjects/Position.cpp b/src/quickstart/cpp/queryobjects/Position.cpp
index 4614d79..b514068 100644
--- a/src/quickstart/cpp/queryobjects/Position.cpp
+++ b/src/quickstart/cpp/queryobjects/Position.cpp
@@ -45,19 +45,19 @@ Position::~Position() {
void Position::init() {
avg20DaysVol = 0;
- bondRating = NULLPTR;
+ bondRating = nullptr;
convRatio = 0.0;
- country = NULLPTR;
+ country = nullptr;
delta = 0.0;
industry = 0;
issuer = 0;
mktValue = 0.0;
qty = 0.0;
- secId = NULLPTR;
- secLinks = NULLPTR;
+ secId = nullptr;
+ secLinks = nullptr;
secType = NULL;
sharesOutstanding = 0;
- underlyer = NULLPTR;
+ underlyer = nullptr;
volatility = 0;
pid = 0;
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/sqliteimpl/SqLiteImpl.cpp
----------------------------------------------------------------------
diff --git a/src/sqliteimpl/SqLiteImpl.cpp b/src/sqliteimpl/SqLiteImpl.cpp
index e087ef5..24052c9 100644
--- a/src/sqliteimpl/SqLiteImpl.cpp
+++ b/src/sqliteimpl/SqLiteImpl.cpp
@@ -33,18 +33,18 @@ void SqLiteImpl::init(const RegionPtr& region, PropertiesPtr& diskProperties) {
int pageSize = 0;
m_persistanceDir = g_default_persistence_directory;
std::string regionName = region->getName();
- if (diskProperties != NULLPTR) {
+ if (diskProperties != nullptr) {
CacheableStringPtr maxPageCountPtr = diskProperties->find(MAX_PAGE_COUNT);
CacheableStringPtr pageSizePtr = diskProperties->find(PAGE_SIZE);
CacheableStringPtr persDir = diskProperties->find(PERSISTENCE_DIR);
- if (maxPageCountPtr != NULLPTR) {
+ if (maxPageCountPtr != nullptr) {
maxPageCount = atoi(maxPageCountPtr->asChar());
}
- if (pageSizePtr != NULLPTR) pageSize = atoi(pageSizePtr->asChar());
+ if (pageSizePtr != nullptr) pageSize = atoi(pageSizePtr->asChar());
- if (persDir != NULLPTR) m_persistanceDir = persDir->asChar();
+ if (persDir != nullptr) m_persistanceDir = persDir->asChar();
}
#ifndef _WIN32
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/templates/security/PkcsAuthInit.cpp
----------------------------------------------------------------------
diff --git a/src/templates/security/PkcsAuthInit.cpp b/src/templates/security/PkcsAuthInit.cpp
index f0c6052..a545990 100644
--- a/src/templates/security/PkcsAuthInit.cpp
+++ b/src/templates/security/PkcsAuthInit.cpp
@@ -97,7 +97,7 @@ PropertiesPtr PKCSAuthInit::getCredentials(PropertiesPtr& securityprops,
"PKCSAuthInit::getCredentials: "
"OpenSSL initialization failed.");
}
- if (securityprops == NULLPTR || securityprops->getSize() <= 0) {
+ if (securityprops == nullptr || securityprops->getSize() <= 0) {
throw AuthenticationRequiredException(
"PKCSAuthInit::getCredentials: "
"No security-* properties are set.");
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/templates/security/UserPasswordAuthInit.cpp
----------------------------------------------------------------------
diff --git a/src/templates/security/UserPasswordAuthInit.cpp b/src/templates/security/UserPasswordAuthInit.cpp
index 658c88e..8d4f4e9 100644
--- a/src/templates/security/UserPasswordAuthInit.cpp
+++ b/src/templates/security/UserPasswordAuthInit.cpp
@@ -37,8 +37,8 @@ PropertiesPtr UserPasswordAuthInit::getCredentials(PropertiesPtr& securityprops,
const char* server) {
// LOGDEBUG("UserPasswordAuthInit: inside userPassword::getCredentials");
CacheablePtr userName;
- if (securityprops == NULLPTR ||
- (userName = securityprops->find(SECURITY_USERNAME)) == NULLPTR) {
+ if (securityprops == nullptr ||
+ (userName = securityprops->find(SECURITY_USERNAME)) == nullptr) {
throw AuthenticationFailedException(
"UserPasswordAuthInit: user name "
"property [" SECURITY_USERNAME "] not set.");
@@ -48,7 +48,7 @@ PropertiesPtr UserPasswordAuthInit::getCredentials(PropertiesPtr& securityprops,
credentials->insert(SECURITY_USERNAME, userName->toString()->asChar());
CacheablePtr passwd = securityprops->find(SECURITY_PASSWORD);
// If password is not provided then use empty string as the password.
- if (passwd == NULLPTR) {
+ if (passwd == nullptr) {
passwd = CacheableString::create("");
}
credentials->insert(SECURITY_PASSWORD, passwd->toString()->asChar());
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cli/PkcsWrapper/PkcsAuthInitMN.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cli/PkcsWrapper/PkcsAuthInitMN.cpp b/src/tests/cli/PkcsWrapper/PkcsAuthInitMN.cpp
index 1300641..d2ebf45 100644
--- a/src/tests/cli/PkcsWrapper/PkcsAuthInitMN.cpp
+++ b/src/tests/cli/PkcsWrapper/PkcsAuthInitMN.cpp
@@ -43,12 +43,12 @@ PkcsAuthInit::GetCredentials(
Apache::Geode::Client::Properties<String^, String^> ^props, System::String ^server)
{
Apache::Geode::Client::ManagedString mg_server( server );
- apache::geode::client::PropertiesPtr propsPtr = NULLPTR;
+ apache::geode::client::PropertiesPtr propsPtr = nullptr;
if (props != nullptr) {
propsPtr = (apache::geode::client::Properties*)props->NativeIntPtr;
}
apache::geode::client::PKCSAuthInitInternal* nativeptr = new apache::geode::client::PKCSAuthInitInternal(true);
apache::geode::client::PropertiesPtr& newPropsPtr = nativeptr->getCredentials(propsPtr, mg_server.CharPtr);
return Apache::Geode::Client::Properties<String^, Object^>::
- CreateFromVoidPtr<String^, Object^>(newPropsPtr.ptr());
+ CreateFromVoidPtr<String^, Object^>(newPropsPtr.get());
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/fwk/UdpIpc.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/fwk/UdpIpc.cpp b/src/tests/cpp/fwk/UdpIpc.cpp
index d7efbd4..983df96 100644
--- a/src/tests/cpp/fwk/UdpIpc.cpp
+++ b/src/tests/cpp/fwk/UdpIpc.cpp
@@ -74,7 +74,7 @@ TESTTASK finalize() {
void UdpIpc::checkTest(const char *taskId) {
SpinLockGuard guard(m_lck);
setTask(taskId);
- if (m_cache == NULLPTR) {
+ if (m_cache == nullptr) {
PropertiesPtr pp = Properties::create();
cacheInitialize(pp);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/fwklib/FrameworkTest.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/fwklib/FrameworkTest.cpp b/src/tests/cpp/fwklib/FrameworkTest.cpp
index 9c3e642..75df49a 100644
--- a/src/tests/cpp/fwklib/FrameworkTest.cpp
+++ b/src/tests/cpp/fwklib/FrameworkTest.cpp
@@ -36,7 +36,7 @@ FrameworkTest::FrameworkTest(const char* initArgs) {
#ifdef WIN32
setNewAndDelete();
#endif
- txManager = NULLPTR;
+ txManager = nullptr;
// parse args into variables,
char xml[4096]; // xml file name
char addr[1024]; // ip address, host:port
@@ -70,7 +70,7 @@ FrameworkTest::~FrameworkTest() {
m_timeSync = NULL;
}
- if (m_cache != NULLPTR) {
+ if (m_cache != nullptr) {
cacheFinalize();
}
}
@@ -265,13 +265,13 @@ void FrameworkTest::cacheInitialize(PropertiesPtr& props,
txManager = m_cache->getCacheTransactionManager();
}
} catch (CacheExistsException ignore) {
- m_cache = NULLPTR;
+ m_cache = nullptr;
} catch (Exception e) {
FWKEXCEPTION(
"CacheFactory::create encountered Exception: " << e.getMessage());
}
- if (m_cache == NULLPTR) {
+ if (m_cache == nullptr) {
FWKEXCEPTION("FrameworkTest: Failed to initialize cache.");
}
}
@@ -279,7 +279,7 @@ void FrameworkTest::cacheInitialize(PropertiesPtr& props,
// ----------------------------------------------------------------------------
void FrameworkTest::cacheFinalize() {
- if (m_cache != NULLPTR) {
+ if (m_cache != nullptr) {
try {
destroyAllRegions();
m_cache->close();
@@ -291,7 +291,7 @@ void FrameworkTest::cacheFinalize() {
FWKSEVERE("Caught an unexpected unknown exception during cache close.");
}
}
- m_cache = NULLPTR;
+ m_cache = nullptr;
FWKINFO("Cache closed.");
}
@@ -401,23 +401,23 @@ void FrameworkTest::parseEndPoints(int32_t ep, std::string label,
int32_t redundancyLevel = getIntValue("redundancyLevel");
if (redundancyLevel > 0) pfPtr->setSubscriptionRedundancy(redundancyLevel);
// create tag specific pools
- PoolPtr pptr = NULLPTR;
+ PoolPtr pptr = nullptr;
if (!tag.empty()) {
poolName.append(tag);
// check if pool already exists
pptr = PoolManager::find(poolName.c_str());
- if (pptr == NULLPTR) {
+ if (pptr == nullptr) {
pptr = pfPtr->create(poolName.c_str());
}
}
// create default pool
else {
pptr = PoolManager::find(poolName.c_str());
- if (pptr == NULLPTR) {
+ if (pptr == nullptr) {
pptr = pfPtr->create(poolName.c_str());
}
}
- if (pptr != NULLPTR)
+ if (pptr != nullptr)
FWKINFO(" Region Created with following Pool attributes :"
<< poolAttributesToString(pptr));
}
@@ -525,17 +525,17 @@ std::string FrameworkTest::poolAttributesToString(PoolPtr& pool) {
sString += "\nPRSingleHopEnabled: ";
sString += pool->getPRSingleHopEnabled() ? "true" : "false";
sString += "\nLocator: ";
- CacheableStringArrayPtr str =
- dynamic_cast<CacheableStringArray*>(pool->getLocators().ptr());
- if (str != NULLPTR) {
+ auto str =
+ std::dynamic_pointer_cast<CacheableStringArray>(pool->getLocators());
+ if (str != nullptr) {
for (int32_t stri = 0; stri < str->length(); stri++) {
sString += str->operator[](stri)->asChar();
sString += ",";
}
}
sString += "\nServers: ";
- str = dynamic_cast<CacheableStringArray*>(pool->getServers().ptr());
- if (str != NULLPTR) {
+ str = std::dynamic_pointer_cast<CacheableStringArray>(pool->getServers());
+ if (str != nullptr) {
for (int32_t stri = 0; stri < str->length(); stri++) {
sString += str->operator[](stri)->asChar();
sString += ",";
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/fwklib/FrameworkTest.hpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/fwklib/FrameworkTest.hpp b/src/tests/cpp/fwklib/FrameworkTest.hpp
index cf5d2d7..d57c3e4 100644
--- a/src/tests/cpp/fwklib/FrameworkTest.hpp
+++ b/src/tests/cpp/fwklib/FrameworkTest.hpp
@@ -73,7 +73,7 @@ class FrameworkTest // Base class all test classes written for xml testing
int32_t finalize() { return FWK_SUCCESS; }
void cacheInitialize(PropertiesPtr& props,
- const CacheAttributesPtr& cAttrs = NULLPTR);
+ const CacheAttributesPtr& cAttrs = nullptr);
void cacheFinalize();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/fwklib/FwkObjects.hpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/fwklib/FwkObjects.hpp b/src/tests/cpp/fwklib/FwkObjects.hpp
index ccd0294..6068616 100644
--- a/src/tests/cpp/fwklib/FwkObjects.hpp
+++ b/src/tests/cpp/fwklib/FwkObjects.hpp
@@ -356,7 +356,7 @@ class PersistManager {
public:
PersistManager(const DOMNode* node);
- ~PersistManager() { m_properties = NULLPTR; }
+ ~PersistManager() { m_properties = nullptr; }
const char* getLibraryName() { return m_libraryName.c_str(); }
const char* getLibraryFunctionName() { return m_libraryFunctionName.c_str(); }
@@ -574,7 +574,7 @@ class FwkPool {
public:
FwkPool(const DOMNode* node);
~FwkPool() {
- if (m_poolFactory != NULLPTR) {
+ if (m_poolFactory != nullptr) {
// TODO:Close factory
}
}
@@ -608,7 +608,7 @@ class FwkPool {
} else {
return m_poolFactory->create(m_name.c_str());
}
- return NULLPTR;
+ return nullptr;
}
const std::string& getName() const { return m_name; }
void print() const { FWKINFO("FwkPool " << m_name); }
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/fwklib/PoolHelper.hpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/fwklib/PoolHelper.hpp b/src/tests/cpp/fwklib/PoolHelper.hpp
index daa89f0..17ef93e 100644
--- a/src/tests/cpp/fwklib/PoolHelper.hpp
+++ b/src/tests/cpp/fwklib/PoolHelper.hpp
@@ -107,16 +107,16 @@ class PoolHelper {
sString += pool->getPRSingleHopEnabled() ? "true" : "false";
sString += "\nLocator: ";
CacheableStringArrayPtr str =
- dynamic_cast<CacheableStringArray*>(pool->getLocators().ptr());
- if (pool->getLocators() != NULLPTR && pool->getLocators()->length() > 0) {
+ dynamic_cast<CacheableStringArray*>(pool->getLocators().get());
+ if (pool->getLocators() != nullptr && pool->getLocators()->length() > 0) {
for (int32_t stri = 0; stri < str->length(); stri++) {
sString += str->operator[](stri)->asChar();
sString += ",";
}
}
sString += "\nServers: ";
- str = dynamic_cast<CacheableStringArray*>(pool->getServers().ptr());
- if (pool->getServers() != NULLPTR && pool->getServers()->length() > 0) {
+ str = dynamic_cast<CacheableStringArray*>(pool->getServers().get());
+ if (pool->getServers() != nullptr && pool->getServers()->length() > 0) {
for (int32_t stri = 0; stri < str->length(); stri++) {
sString += str->operator[](stri)->asChar();
sString += ",";
@@ -129,7 +129,7 @@ class PoolHelper {
PoolPtr createPool() {
const char* poolName = m_pool->getName().c_str();
PoolPtr pptr = PoolManager::find(poolName);
- if (pptr == NULLPTR) {
+ if (pptr == nullptr) {
pptr = m_pool->createPool();
}
FWKINFO(" Following are Pool attributes :" << poolAttributesToString(pptr));
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/fwklib/QueryHelper.hpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/fwklib/QueryHelper.hpp b/src/tests/cpp/fwklib/QueryHelper.hpp
index 329b36b..8127973 100644
--- a/src/tests/cpp/fwklib/QueryHelper.hpp
+++ b/src/tests/cpp/fwklib/QueryHelper.hpp
@@ -788,7 +788,7 @@ QueryHelper* QueryHelper::singleton = NULL;
void QueryHelper::populateRangePositionData(RegionPtr& rptr, int start,
int end) {
for (int i = start; i <= end; i++) {
- CacheablePtr pos(new Position(i));
+ auto pos = std::make_shared<Position>(i);
char key[100];
ACE_OS::sprintf(key, "pos%d", i);
CacheableKeyPtr keyptr = CacheableKey::create(key);
@@ -798,8 +798,8 @@ void QueryHelper::populateRangePositionData(RegionPtr& rptr, int start,
bool QueryHelper::compareTwoPositionObjects(SerializablePtr pos1,
SerializablePtr pos2) {
- Position* p1 = dynamic_cast<Position*>(pos1.ptr());
- Position* p2 = dynamic_cast<Position*>(pos2.ptr());
+ Position* p1 = dynamic_cast<Position*>(pos1.get());
+ Position* p2 = dynamic_cast<Position*>(pos2.get());
if (p1 == NULL || p2 == NULL) {
printf("ERROR: The object(s) passed are not of Portflio type\n");
@@ -829,16 +829,15 @@ bool QueryHelper::compareTwoPositionObjects(SerializablePtr pos1,
}
SerializablePtr QueryHelper::getExactPositionObject(int iForExactPosObject) {
- CacheablePtr pos(new Position(iForExactPosObject));
- return pos;
+ return std::make_shared<Position>(iForExactPosObject);
}
void QueryHelper::putExactPositionObject(RegionPtr& rptr,
int iForExactPosObject) {
char key[100];
ACE_OS::sprintf(key, "pos%d", iForExactPosObject);
- CacheableKeyPtr keyptr = CacheableKey::create(key);
- CacheablePtr pos(new Position(iForExactPosObject));
+ auto keyptr = CacheableKey::create(key);
+ auto pos = std::make_shared<Position>(iForExactPosObject);
rptr->put(keyptr, pos);
}
@@ -846,7 +845,7 @@ SerializablePtr QueryHelper::getCachedPositionObject(RegionPtr& rptr,
int iForExactPosObject) {
char key[100];
ACE_OS::sprintf(key, "pos%d", iForExactPosObject);
- CacheableKeyPtr keyptr = CacheableKey::create(key);
+ auto keyptr = CacheableKey::create(key);
return rptr->get(keyptr);
}
@@ -860,7 +859,7 @@ void QueryHelper::populatePortfolioData(RegionPtr& rptr, int setSize,
CacheableKeyPtr keyport;
for (int set = 1; set <= numSets; set++) {
for (int current = 1; current <= setSize; current++) {
- port = new Portfolio(current, objSize);
+ port = std::make_shared<Portfolio>(current, objSize);
char portname[100] = {0};
ACE_OS::sprintf(portname, "port%d-%d", set, current);
@@ -879,7 +878,7 @@ void QueryHelper::populatePortfolio(RegionPtr& rptr, int maxKey,
CacheablePtr port;
CacheableKeyPtr keyport;
for (int current = 0; current <= maxKey; current++) {
- port = new Portfolio(current, objSize);
+ port = std::make_shared<Portfolio>(current, objSize);
char portname[1024] = {0};
ACE_OS::sprintf(portname, "port%d-%d", current, current);
@@ -956,7 +955,8 @@ void QueryHelper::populatePositionData(RegionPtr& rptr, int setSize,
CacheablePtr pos;
for (int set = 1; set <= numSets; set++) {
for (int current = 1; current <= setSize; current++) {
- pos = new Position(secIds[current % numSecIds], current * 100);
+ pos = std::make_shared<Position>(secIds[current % numSecIds],
+ current * 100);
char posname[100] = {0};
ACE_OS::sprintf(posname, "pos%d-%d", set, current);
@@ -975,7 +975,7 @@ void QueryHelper::populatePortfolioPdxData(RegionPtr& rptr, int setSize,
for (int set = 1; set <= numSets; set++) {
for (int current = 1; current <= setSize; current++) {
- CacheablePtr port(new testobject::PortfolioPdx(current, objSize));
+ auto port = std::make_shared<testobject::PortfolioPdx>(current, objSize);
char portname[100] = {0};
ACE_OS::sprintf(portname, "port%d-%d", set, current);
@@ -999,8 +999,8 @@ void QueryHelper::populatePositionPdxData(RegionPtr& rptr, int setSize,
for (int set = 1; set <= numSets; set++) {
for (int current = 1; current <= setSize; current++) {
- CacheablePtr pos(new testobject::PositionPdx(secIds[current % numSecIds],
- current * 100));
+ auto pos = std::make_shared<testobject::PositionPdx>(
+ secIds[current % numSecIds], current * 100);
char posname[100] = {0};
ACE_OS::sprintf(posname, "pos%d-%d", set, current);
@@ -1014,11 +1014,11 @@ void QueryHelper::populatePositionPdxData(RegionPtr& rptr, int setSize,
// positionSetSize = setSize; positionNumSets = numSets;
}
bool QueryHelper::verifyRS(SelectResultsPtr& resultSet, int expectedRows) {
- if (!instanceOf<ResultSetPtr>(resultSet)) {
+ if (!std::dynamic_pointer_cast<ResultSet>(resultSet)) {
return false;
}
- ResultSetPtr rsptr = staticCast<ResultSetPtr>(resultSet);
+ ResultSetPtr rsptr = std::static_pointer_cast<GF_UNWRAP_SP(ResultSetPtr)>(resultSet);
int foundRows = 0;
@@ -1040,7 +1040,7 @@ bool QueryHelper::verifySS(SelectResultsPtr& structSet, int expectedRows,
FWKINFO("QueryHelper::verifySS : expectedRows = "
<< expectedRows << " ,expectedFields = " << expectedFields);
- if (!instanceOf<StructSetPtr>(structSet)) {
+ if (!std::dynamic_pointer_cast<StructSet>(structSet)) {
if (expectedRows == 0 && expectedFields == 0) {
return true; // quite possible we got a null set back.
}
@@ -1048,7 +1048,7 @@ bool QueryHelper::verifySS(SelectResultsPtr& structSet, int expectedRows,
return false;
}
- StructSetPtr ssptr = staticCast<StructSetPtr>(structSet);
+ StructSetPtr ssptr = std::static_pointer_cast<GF_UNWRAP_SP(StructSetPtr)>(structSet);
int foundRows = 0;
@@ -1058,7 +1058,7 @@ bool QueryHelper::verifySS(SelectResultsPtr& structSet, int expectedRows,
SerializablePtr ser = (*ssptr)[rows]; // iter.next();
foundRows++;
- Struct* siptr = dynamic_cast<Struct*>(ser.ptr());
+ Struct* siptr = dynamic_cast<Struct*>(ser.get());
if (siptr == NULL) {
LOGINFO("siptr is NULL \n\n");
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/fwklib/RegionHelper.hpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/fwklib/RegionHelper.hpp b/src/tests/cpp/fwklib/RegionHelper.hpp
index e664336..f0c08fb 100644
--- a/src/tests/cpp/fwklib/RegionHelper.hpp
+++ b/src/tests/cpp/fwklib/RegionHelper.hpp
@@ -79,7 +79,7 @@ class RegionHelper {
std::string sString;
sString += attr->getCachingEnabled() ? "Caching" : "NoCache";
- sString += (attr->getCacheListener() == NULLPTR) ? "Nlstnr" : "Lstnr";
+ sString += (attr->getCacheListener() == nullptr) ? "Nlstnr" : "Lstnr";
return sString;
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/security/PkcsAuthInit.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/security/PkcsAuthInit.cpp b/src/tests/cpp/security/PkcsAuthInit.cpp
index b1aa9c8..f77de9b 100644
--- a/src/tests/cpp/security/PkcsAuthInit.cpp
+++ b/src/tests/cpp/security/PkcsAuthInit.cpp
@@ -116,7 +116,7 @@ PropertiesPtr PKCSAuthInitInternal::getCredentials(PropertiesPtr& securityprops,
"PKCSAuthInit::getCredentials: "
"OpenSSL initialization failed.");
}
- if (securityprops == NULLPTR || securityprops->getSize() <= 0) {
+ if (securityprops == nullptr || securityprops->getSize() <= 0) {
throw AuthenticationRequiredException(
"PKCSAuthInit::getCredentials: "
"No security-* properties are set.");
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/security/Security.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/security/Security.cpp b/src/tests/cpp/security/Security.cpp
index 0f4d850..57013b0 100644
--- a/src/tests/cpp/security/Security.cpp
+++ b/src/tests/cpp/security/Security.cpp
@@ -117,7 +117,7 @@ void Security::getClientSecurityParams(PropertiesPtr prop,
}
FWKINFO("security scheme : " << sc);
- if (prop == NULLPTR) prop = Properties::create();
+ if (prop == nullptr) prop = Properties::create();
CredentialGeneratorPtr cg = CredentialGenerator::create(sc);
cg->getAuthInit(prop);
@@ -158,7 +158,7 @@ void Security::getClientSecurityParams(PropertiesPtr prop,
void Security::checkTest(const char *taskId) {
SpinLockGuard guard(m_lck);
setTask(taskId);
- if (m_cache == NULLPTR || m_cache->isClosed()) {
+ if (m_cache == nullptr || m_cache->isClosed()) {
PropertiesPtr pp = Properties::create();
getClientSecurityParams(pp, getStringValue("credentials"));
@@ -354,7 +354,7 @@ server reports " << keys << " keys." );
void Security::clearKeys() {
if (m_KeysA != NULL) {
for (int32_t i = 0; i < m_MaxKeys; i++) {
- m_KeysA[i] = NULLPTR;
+ m_KeysA[i] = nullptr;
}
delete[] m_KeysA;
m_KeysA = NULL;
@@ -431,7 +431,7 @@ int32_t Security::initValues(int32_t numKeys, int32_t siz, bool useDefault) {
if (m_CValue != NULL) {
for (int32_t i = 0; i < m_MaxValues; i++) {
- m_CValue[i] = NULLPTR;
+ m_CValue[i] = nullptr;
}
delete[] m_CValue;
}
@@ -502,7 +502,7 @@ int32_t Security::verifyInterestList()
for(int32_t i = 0; i < (int32_t) keys.size(); i++)
{
keyPtr = keys.at(i);
- valuePtr = dynCast<CacheableBytesPtr>( region->get(keyPtr) );
+ valuePtr = std::dynamic_pointer_cast<CacheableBytes>( region->get(keyPtr) );
valueSize = valuePtr->length();
if( (int32_t)valueSize == payload )
@@ -598,7 +598,7 @@ int32_t Security::registerInterestList() {
initStrKeys(low, high, keyBase);
for (int j = low; j < high; j++) {
- if (m_KeysA[j - low] != NULLPTR) {
+ if (m_KeysA[j - low] != nullptr) {
registerKeyList.push_back(m_KeysA[j - low]);
} else
FWKINFO("Security::registerInterestList key is NULL");
@@ -709,7 +709,7 @@ int32_t Security::checkValues() {
int32_t updates = 0;
int32_t unknowns = 0;
for (int32_t i = 0; i < vals.size(); i++) {
- CacheableBytesPtr valStr = dynCast<CacheableBytesPtr>(vals.at(i));
+ auto valStr = std::dynamic_pointer_cast<CacheableBytes>(vals.at(i));
if (strncmp("Create", reinterpret_cast<const char *>(valStr->value()),
6) == 0) {
creates++;
@@ -771,12 +771,12 @@ RegionPtr Security::getRegionPtr(const char *reg) {
region = rootRegionVector.at(GsRandom::random(size));
} else {
FWKINFO("Getting region: " << name);
- if (m_cache == NULLPTR) {
+ if (m_cache == nullptr) {
FWKEXCEPTION("Failed to get region: " << name
<< " cache ptr is null.");
}
region = m_cache->getRegion(name.c_str());
- if (region == NULLPTR) {
+ if (region == nullptr) {
FWKEXCEPTION("Failed to get region: " << name);
}
}
@@ -816,7 +816,7 @@ bool Security::checkReady(int32_t numClients) {
}
//----------------------------------------------------------------------------
CacheablePtr Security::getUserObject(const std::string &objType) {
- CacheablePtr usrObj = NULLPTR;
+ CacheablePtr usrObj = nullptr;
resetValue("entryCount");
int numOfKeys =
getIntValue("entryCount"); // number of key should be multiple of 20
@@ -828,12 +828,13 @@ CacheablePtr Security::getUserObject(const std::string &objType) {
if (objType == "Portfolio") {
setSize = qh->getPortfolioSetSize();
numSet = numOfKeys / setSize;
- usrObj = new Portfolio(GsRandom::random(setSize), objSize);
+ usrObj = std::make_shared<Portfolio>(GsRandom::random(setSize), objSize);
} else if (objType == "Position") {
setSize = qh->getPositionSetSize();
numSet = numOfKeys / setSize;
int numSecIds = sizeof(secIds) / sizeof(char *);
- usrObj = new Position(secIds[setSize % numSecIds], setSize * 100);
+ usrObj =
+ std::make_shared<Position>(secIds[setSize % numSecIds], setSize * 100);
}
return usrObj;
}
@@ -973,7 +974,7 @@ int32_t Security::doEntryOperations() {
int32_t creates = 0, puts = 0, gets = 0, dests = 0, invals = 0, query = 0;
RegionPtr regionPtr = getRegionPtr();
- if (regionPtr == NULLPTR) {
+ if (regionPtr == nullptr) {
fwkResult = FWK_SEVERE;
FWKSEVERE(
"CacheServerTest::doEntryOperations(): No region to perform operations "
@@ -1014,12 +1015,12 @@ int32_t Security::doEntryOperations() {
reinterpret_cast<const unsigned char *>(valBuf),
static_cast<int32_t>(strlen(valBuf)));
int32_t *val =
- (int32_t *)(dynCast<CacheableBytesPtr>(tmpValue)->value());
+ (int32_t *)(std::dynamic_pointer_cast<CacheableBytes>(tmpValue)->value());
*val = (*val == keyVal) ? keyVal + 1
: keyVal; // alternate the value so that it
// can be validated later.
int64_t *adjNow =
- (int64_t *)(dynCast<CacheableBytesPtr>(tmpValue)->value() + 4);
+ (int64_t *)(std::dynamic_pointer_cast<CacheableBytes>(tmpValue)->value() + 4);
*adjNow = getAdjustedNowMicros();
}
regionPtr->put(keyPtr, tmpValue);
@@ -1065,8 +1066,8 @@ int32_t Security::doEntryOperations() {
meter.checkPace();
now = ACE_OS::gettimeofday();
}
- keyPtr = NULLPTR;
- valuePtr = NULLPTR;
+ keyPtr = nullptr;
+ valuePtr = nullptr;
delete[] valBuf;
FWKINFO("doEntryOperations did "
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/security/XmlAuthzCredentialGenerator.hpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/security/XmlAuthzCredentialGenerator.hpp b/src/tests/cpp/security/XmlAuthzCredentialGenerator.hpp
index 70ebdaf..57cab72 100644
--- a/src/tests/cpp/security/XmlAuthzCredentialGenerator.hpp
+++ b/src/tests/cpp/security/XmlAuthzCredentialGenerator.hpp
@@ -189,7 +189,7 @@ class XmlAuthzCredentialGenerator : public SharedBase {
FWKINFO("inserted " << validity << " dummy security-username "
<< (*m_prop)->find("security-username")->asChar()
<< " password "
- << ((*m_prop)->find("security-password") != NULLPTR
+ << ((*m_prop)->find("security-password") != nullptr
? (*m_prop)->find("security-password")->asChar()
: "not set"));
}
@@ -242,7 +242,7 @@ class XmlAuthzCredentialGenerator : public SharedBase {
FWKINFO("inserted ldap security-username "
<< (*m_prop)->find("security-username")->asChar() << " password "
- << ((*m_prop)->find("security-password") != NULLPTR
+ << ((*m_prop)->find("security-password") != nullptr
? (*m_prop)->find("security-password")->asChar()
: "not set"));
}
@@ -254,7 +254,7 @@ class XmlAuthzCredentialGenerator : public SharedBase {
FWKINFO("inserted PKCS security-alias"
<< (*m_prop)->find("security-alias")->asChar() << " password "
- << ((*m_prop)->find("security-keystorepass") != NULLPTR
+ << ((*m_prop)->find("security-keystorepass") != nullptr
? (*m_prop)->find("security-keystorepass")->asChar()
: "not set"));
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/tests/cpp/testobject/ArrayOfByte.hpp
----------------------------------------------------------------------
diff --git a/src/tests/cpp/testobject/ArrayOfByte.hpp b/src/tests/cpp/testobject/ArrayOfByte.hpp
index 804ef67..58fe730 100644
--- a/src/tests/cpp/testobject/ArrayOfByte.hpp
+++ b/src/tests/cpp/testobject/ArrayOfByte.hpp
@@ -77,7 +77,7 @@ class TESTOBJECT_EXPORT ArrayOfByte {
}
static int64_t getTimestamp(CacheableBytesPtr bytes) {
- if (bytes == NULLPTR) {
+ if (bytes == nullptr) {
throw apache::geode::client::IllegalArgumentException(
"the bytes arg was null");
}
[13/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from cppcache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientRemoveOps.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientRemoveOps.cpp b/src/cppcache/integration-test/testThinClientRemoveOps.cpp
index a79162c..5f6e3b9 100644
--- a/src/cppcache/integration-test/testThinClientRemoveOps.cpp
+++ b/src/cppcache/integration-test/testThinClientRemoveOps.cpp
@@ -99,7 +99,7 @@ void _verifyEntry(const char* name, const char* key, const char* val,
free(buf);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
CacheableKeyPtr keyPtr = createKey(key);
@@ -137,10 +137,10 @@ void _verifyEntry(const char* name, const char* key, const char* val,
}
if (val != NULL) {
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
+ auto checkPtr =
+ std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
- ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null.");
+ ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
sprintf(buf, "In verify loop, get returned %s for key %s",
checkPtr->asChar(), key);
@@ -194,8 +194,8 @@ void createRegion(const char* name, bool ackMode,
fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
fflush(stdout);
RegionPtr regPtr = getHelper()->createRegion(
- name, ackMode, cachingEnable, NULLPTR, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ name, ackMode, cachingEnable, nullptr, clientNotificationEnabled);
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
@@ -209,7 +209,7 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators,
RegionPtr regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
@@ -223,7 +223,7 @@ void putEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
@@ -247,7 +247,7 @@ void localPutEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
regPtr->localPut(keyPtr, valPtr);
LOG("LocalPut entry done.");
@@ -289,7 +289,7 @@ void updateEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
ASSERT(regPtr->containsValueForKey(keyPtr),
@@ -314,12 +314,12 @@ void doGetAgain(const char* name, const char* key, const char* value) {
RegionPtr regPtr = getHelper()->getRegion(name);
fprintf(stdout, "get region name%s\n", regPtr->getName());
fflush(stdout);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); // force a netsearch
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(
+ regPtr->get(keyPtr)); // force a netsearch
- if (checkPtr != NULLPTR) {
+ if (checkPtr != nullptr) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In doGetAgain, get returned %s for key %s",
@@ -346,7 +346,7 @@ void doNetsearch(const char* name, const char* key, const char* value) {
RegionPtr regPtr = getHelper()->getRegion(name);
fprintf(stdout, "netsearch region %s\n", regPtr->getName());
fflush(stdout);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
if (count == 0) {
ASSERT(!regPtr->containsKey(keyPtr),
@@ -355,10 +355,10 @@ void doNetsearch(const char* name, const char* key, const char* value) {
"Value should not have been found in region.");
count++;
}
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); // force a netsearch
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(
+ regPtr->get(keyPtr)); // force a netsearch
- if (checkPtr != NULLPTR) {
+ if (checkPtr != nullptr) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
@@ -637,10 +637,10 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepSix)
putEntry(regionNames[1], keys[3], vals[3]);
reg0->localInvalidate(keys[1]);
reg1->localInvalidate(keys[3]);
- ASSERT(reg0->remove(keys[1], (CacheablePtr)NULLPTR) == false,
+ ASSERT(reg0->remove(keys[1], (CacheablePtr)nullptr) == false,
"Result of remove should be false, as this value is not present "
"locally, but present only on server.");
- ASSERT(reg1->remove(keys[3], (CacheablePtr)NULLPTR) == false,
+ ASSERT(reg1->remove(keys[3], (CacheablePtr)nullptr) == false,
"Result of remove should be false, as this value is not present "
"locally, but present only on server.");
ASSERT(reg0->containsKey(keys[1]) == true, "containsKey should be true");
@@ -673,10 +673,10 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepSix)
// Try removing a entry with a null value, which is not present on client as
// well as server, result should be false.
- ASSERT(reg0->remove("NewKey1", (CacheablePtr)NULLPTR) == false,
+ ASSERT(reg0->remove("NewKey1", (CacheablePtr)nullptr) == false,
"Result of remove should be false, as this value is not present "
"locally, and not present on server.");
- ASSERT(reg1->remove("NewKey3", (CacheablePtr)NULLPTR) == false,
+ ASSERT(reg1->remove("NewKey3", (CacheablePtr)nullptr) == false,
"Result of remove should be false, as this value is not present "
"locally, and not present on server.");
ASSERT(reg0->containsKey("NewKey1") == false,
@@ -715,10 +715,10 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepSix)
putEntry(regionNames[1], keys[3], nvals[3]);
reg0->destroy(keys[1]);
reg1->destroy(keys[3]);
- ASSERT(reg0->remove(keys[1], (CacheablePtr)NULLPTR) == false,
+ ASSERT(reg0->remove(keys[1], (CacheablePtr)nullptr) == false,
"Result of remove should be false, as this value does not exist "
"locally, but exists on server.");
- ASSERT(reg1->remove(keys[3], (CacheablePtr)NULLPTR) == false,
+ ASSERT(reg1->remove(keys[3], (CacheablePtr)nullptr) == false,
"Result of remove should be false, as this value does not exist "
"locally, but exists on server.");
ASSERT(reg0->containsKey(keys[1]) == false, "containsKey should be false");
@@ -840,10 +840,10 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepSix)
reg1->localPut(keys[3], vals[3]);
reg0->invalidate(keys[1]);
reg1->invalidate(keys[3]);
- ASSERT(reg0->localRemove(keys[1], (CacheablePtr)NULLPTR) == true,
+ ASSERT(reg0->localRemove(keys[1], (CacheablePtr)nullptr) == true,
"Result of remove should be true, as this value does not exists "
"locally.");
- ASSERT(reg1->localRemove(keys[3], (CacheablePtr)NULLPTR) == true,
+ ASSERT(reg1->localRemove(keys[3], (CacheablePtr)nullptr) == true,
"Result of remove should be true, as this value does not exists "
"locally.");
ASSERT(reg0->containsKey(keys[1]) == false, "containsKey should be false");
@@ -853,10 +853,10 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepSix)
// Try locally removing an entry (value) with a NULL.
reg0->localPut(keys[1], vals[1]);
reg1->localPut(keys[3], vals[3]);
- ASSERT(reg0->localRemove(keys[1], (CacheablePtr)NULLPTR) == false,
+ ASSERT(reg0->localRemove(keys[1], (CacheablePtr)nullptr) == false,
"Result of remove should be false, as this value does not exists "
"locally.");
- ASSERT(reg1->localRemove(keys[3], (CacheablePtr)NULLPTR) == false,
+ ASSERT(reg1->localRemove(keys[3], (CacheablePtr)nullptr) == false,
"Result of remove should be false, as this value does not exists "
"locally.");
ASSERT(reg0->containsKey(keys[1]) == true, "containsKey should be true");
@@ -883,10 +883,10 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepSix)
reg1->localPut(keys[3], vals[3]);
reg0->localDestroy(keys[1]);
reg1->localDestroy(keys[3]);
- ASSERT(reg0->localRemove(keys[1], (CacheablePtr)NULLPTR) == false,
+ ASSERT(reg0->localRemove(keys[1], (CacheablePtr)nullptr) == false,
"Result of remove should be false, as this value does not exists "
"locally.");
- ASSERT(reg1->localRemove(keys[3], (CacheablePtr)NULLPTR) == false,
+ ASSERT(reg1->localRemove(keys[3], (CacheablePtr)nullptr) == false,
"Result of remove should be false, as this value does not exists "
"locally.");
ASSERT(reg0->containsKey(keys[1]) == false, "containsKey should be false");
@@ -973,10 +973,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepEight)
reg->localDestroy(keys[0]);
reg->localDestroy(keys[1]);
SLEEP(10000); // This is for expiration on server to execute.
- ASSERT(reg->remove(keys[0], (CacheablePtr)NULLPTR) == true,
+ ASSERT(reg->remove(keys[0], (CacheablePtr)nullptr) == true,
"Result of remove should be true, as this value is not present "
"locally, & not present on server.");
- ASSERT(reg->remove(keys[1], (CacheablePtr)NULLPTR) == true,
+ ASSERT(reg->remove(keys[1], (CacheablePtr)nullptr) == true,
"Result of remove should be true, as this value is not present "
"locally, & not present on server.");
ASSERT(reg->containsKeyOnServer(keyPtr) == false,
@@ -1012,11 +1012,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepEight)
putEntry(regionNames[2], keys[1], nvals[1]);
SLEEP(10000); // This is for expiration on server to execute.
ASSERT(
- reg->remove(keys[0], (CacheablePtr)NULLPTR) == false,
+ reg->remove(keys[0], (CacheablePtr)nullptr) == false,
"Result of remove should be false, as this value is present locally, "
"& not present on server.");
ASSERT(
- reg->remove(keys[1], (CacheablePtr)NULLPTR) == false,
+ reg->remove(keys[1], (CacheablePtr)nullptr) == false,
"Result of remove should be false, as this value is present locally, "
"& not present on server.");
ASSERT(reg->containsKey(keys[0]) == true, "containsKey should be true");
@@ -1037,10 +1037,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepEight)
reg->invalidate(keys[0]);
reg->invalidate(keys[1]);
SLEEP(10000); // This is for expiration on server to execute.
- ASSERT(reg->remove(keys[0], (CacheablePtr)NULLPTR) == true,
+ ASSERT(reg->remove(keys[0], (CacheablePtr)nullptr) == true,
"Result of remove should be true, as this value is not present "
"locally, & not present on server.");
- ASSERT(reg->remove(keys[1], (CacheablePtr)NULLPTR) == true,
+ ASSERT(reg->remove(keys[1], (CacheablePtr)nullptr) == true,
"Result of remove should be true, as this value is not present "
"locally, & not present on server.");
ASSERT(reg->containsKey(keys[0]) == false, "containsKey should be false");
@@ -1179,17 +1179,17 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwelve)
int intKey = 1;
int intVal = 1;
regPtr0->localCreate(intKey, CacheableInt32::create(intVal));
- CacheableInt32Ptr vInt = dynCast<CacheableInt32Ptr>(regPtr0->get(intKey));
+ auto vInt = std::dynamic_pointer_cast<CacheableInt32>(regPtr0->get(intKey));
ASSERT(vInt->value() == 1, "Int Key Int Val Mismatch.");
regPtr0->localInvalidate(intKey);
- vInt = dynCast<CacheableInt32Ptr>(regPtr0->get(intKey));
- ASSERT(vInt == NULLPTR, "valueshould not be found from sever");
+ vInt = std::dynamic_pointer_cast<CacheableInt32>(regPtr0->get(intKey));
+ ASSERT(vInt == nullptr, "valueshould not be found from sever");
intKey = 2;
const char* strVal = "IntKeyStringValue";
regPtr0->localCreate(intKey, strVal);
- CacheableStringPtr vString =
- dynCast<CacheableStringPtr>(regPtr0->get(intKey));
+ auto vString =
+ std::dynamic_pointer_cast<CacheableString>(regPtr0->get(intKey));
ASSERT(strcmp(vString->asChar(), strVal) == 0,
"Int Key and String Value Mismatch");
@@ -1198,7 +1198,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwelve)
try {
regPtr0->localCreate(CacheableInt32::create(key1),
CacheableInt32::create(val1));
- CacheableInt32Ptr vall = dynCast<CacheableInt32Ptr>(regPtr0->get(key1));
+ auto vall = std::dynamic_pointer_cast<CacheableInt32>(regPtr0->get(key1));
FAIL("Expected EntryExistException here");
} catch (EntryExistsException e) {
LOG(" Expected EntryExistsException exception thrown by localCreate");
@@ -1208,21 +1208,21 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwelve)
int64_t longVal = 200;
regPtr0->localCreate(CacheableInt64::create(longKey),
CacheableInt64::create(longVal));
- CacheableInt64Ptr vLong = dynCast<CacheableInt64Ptr>(
+ auto vLong = std::dynamic_pointer_cast<CacheableInt64>(
regPtr0->get(CacheableInt64::create(longKey)));
ASSERT(vLong->value() == 200, "Long Key Long Val Mismatch.");
const char* strKey = "StrKeyIntValueKey";
intVal = 1234;
regPtr0->localCreate(strKey, CacheableInt32::create(intVal));
- CacheableInt32Ptr vIntPtr =
- dynCast<CacheableInt32Ptr>(regPtr0->get(strKey));
+ auto vIntPtr =
+ std::dynamic_pointer_cast<CacheableInt32>(regPtr0->get(strKey));
ASSERT(vIntPtr->value() == 1234, "String Key Int Val Mismatch.");
longKey = 1111;
strVal = "LongKeyStringValue";
regPtr0->localCreate(CacheableInt64::create(longKey), strVal);
- CacheableStringPtr vStr = dynCast<CacheableStringPtr>(
+ auto vStr = std::dynamic_pointer_cast<CacheableString>(
regPtr0->get(CacheableInt64::create(longKey)));
ASSERT(strcmp(vStr->asChar(), strVal) == 0,
"Long Key and String Value Mismatch");
@@ -1230,21 +1230,21 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwelve)
strKey = "StringKey1";
strVal = "StringKeyStringValue";
regPtr0->localCreate(strKey, strVal);
- CacheableStringPtr v = dynCast<CacheableStringPtr>(regPtr0->get(strKey));
+ auto v = std::dynamic_pointer_cast<CacheableString>(regPtr0->get(strKey));
ASSERT(strcmp(v->asChar(), strVal) == 0,
"String Key and String Value Mismatch");
int i = 1234;
regPtr0->localCreate(CacheableInt32::create(i), CacheableInt32::create(i));
- CacheableInt32Ptr result =
- dynCast<CacheableInt32Ptr>(regPtr0->get(CacheableInt32::create(i)));
+ auto result = std::dynamic_pointer_cast<CacheableInt32>(
+ regPtr0->get(CacheableInt32::create(i)));
ASSERT(result->value() == i,
"localcreate new entry with cacheableInt key and cacheableInt value "
"Fail");
regPtr0->localCreate(CacheableInt32::create(12345),
CacheableString::create("abced"));
- CacheableStringPtr resultString = dynCast<CacheableStringPtr>(
+ auto resultString = std::dynamic_pointer_cast<CacheableString>(
regPtr0->get(CacheableInt32::create(12345)));
ASSERT(strcmp(resultString->asChar(), "abced") == 0,
"localcreate new with entry cacheableInt key and cacheablestring "
@@ -1252,8 +1252,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwelve)
regPtr0->localCreate(CacheableString::create("X"),
CacheableString::create("Y"));
- CacheableStringPtr resultStringY =
- dynCast<CacheableStringPtr>(regPtr0->get(CacheableString::create("X")));
+ auto resultStringY = std::dynamic_pointer_cast<CacheableString>(
+ regPtr0->get(CacheableString::create("X")));
ASSERT(strcmp(resultStringY->asChar(), "Y") == 0,
"localcreate new with entry cacheablestring key and cacheablestring "
"value");
@@ -1270,8 +1270,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwelve)
}
regPtr0->localDestroy(CacheableString::create("X"));
- if (dynCast<CacheableStringPtr>(
- regPtr0->get(CacheableString::create("X"))) != NULLPTR) {
+ if (std::dynamic_pointer_cast<CacheableString>(
+ regPtr0->get(CacheableString::create("X"))) != nullptr) {
LOG("Expected : localDestroy should have failed.");
}
@@ -1321,13 +1321,13 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwelve)
LOGINFO("Expected IllegalArgumentException : %s", ex.getMessage());
}
- CacheableKeyPtr keyObject1(new PdxTests::PdxType());
+ auto keyObject1 = std::make_shared<PdxTests::PdxType>();
regPtr0->localCreate(keyObject1, x);
CacheablePtr retVal = regPtr0->get(keyObject1);
ASSERT(retVal == x, "retVal and x should match.");
regPtr0->localInvalidate(keyObject1);
retVal = regPtr0->get(keyObject1);
- ASSERT(retVal == NULLPTR, "value should not be found");
+ ASSERT(retVal == nullptr, "value should not be found");
ASSERT(regPtr0->localRemove(keyObject1, x) == true,
"Result of remove should be true, as this value nullptr exists "
"locally.");
@@ -1346,7 +1346,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwelve)
try {
// retVal = regPtr0->get(keyObject1);
retVal = regPtr0->get(x);
- ASSERT(retVal == NULLPTR, "value should not be found");
+ ASSERT(retVal == nullptr, "value should not be found");
FAIL("Expected IllegalArgumentException here for get");
} catch (Exception) {
LOG(" Expected exception thrown by get");
@@ -1362,7 +1362,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwelve)
regPtr0->localPut(keyObject1, 1);
regPtr0->localInvalidate(keyObject1);
retVal = regPtr0->get(keyObject1);
- ASSERT(retVal == NULLPTR, "value should not be found");
+ ASSERT(retVal == nullptr, "value should not be found");
ASSERT(regPtr0->localRemove(keyObject1, 1) == false,
"Result of remove should be false, as this value does not exists "
"locally.");
@@ -1373,15 +1373,17 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwelve)
"Result of remove should be true, as this value exists locally.");
ASSERT(regPtr0->containsKey(keyObject1) == false,
"containsKey should be false");
- CacheableKeyPtr keyObject2(new PdxTests::PdxType());
+ auto keyObject2 = std::make_shared<PdxTests::PdxType>();
regPtr0->localCreate(keyObject2, 1);
- CacheableInt32Ptr intVal1 = regPtr0->get(keyObject2);
+ auto intVal1 =
+ std::dynamic_pointer_cast<CacheableInt32>(regPtr0->get(keyObject2));
ASSERT(intVal1->value() == 1, "intVal should be 1.");
regPtr0->invalidate(keyObject2);
- intVal1 = dynCast<CacheableInt32Ptr>(regPtr0->get(keyObject2));
- ASSERT(intVal1 == NULLPTR, "intVal should be null.");
+ intVal1 =
+ std::dynamic_pointer_cast<CacheableInt32>(regPtr0->get(keyObject2));
+ ASSERT(intVal1 == nullptr, "intVal should be null.");
- CacheableKeyPtr keyObject3(new PdxTests::PdxType());
+ auto keyObject3 = std::make_shared<PdxTests::PdxType>();
regPtr0->localCreate(keyObject3, "testString");
if (regPtr0->containsKey(keyObject3)) {
CacheablePtr strVal1 = regPtr0->get(keyObject3);
@@ -1397,15 +1399,16 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwelve)
LOG(" Expected EntryExistsException exception thrown by localCreate");
}
- CacheableKeyPtr keyObject4(new PdxTests::PdxType());
- PdxTests::PdxTypePtr valObject1(new PdxTests::PdxType());
+ auto keyObject4 = std::make_shared<PdxTests::PdxType>();
+ auto valObject1 = std::make_shared<PdxTests::PdxType>();
regPtr0->localCreate(keyObject4, valObject1);
PdxTests::PdxTypePtr objVal1 =
- dynCast<PdxTests::PdxTypePtr>(regPtr0->get(keyObject4));
+ std::dynamic_pointer_cast<PdxTests::PdxType>(regPtr0->get(keyObject4));
ASSERT(valObject1 == objVal1, "valObject and objVal should match.");
regPtr0->localInvalidate(keyObject4);
- objVal1 = dynCast<PdxTests::PdxTypePtr>(regPtr0->get(keyObject4));
- ASSERT(objVal1 == NULLPTR, "valueshould not be found");
+ objVal1 =
+ std::dynamic_pointer_cast<PdxTests::PdxType>(regPtr0->get(keyObject4));
+ ASSERT(objVal1 == nullptr, "valueshould not be found");
ASSERT(regPtr0->localRemove(keyObject4, valObject1) == false,
"Result of remove should be false, as this value does not exists "
"locally.");
@@ -1424,7 +1427,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwelve)
regPtr0->localPut(keyObject4, valObject1);
regPtr0->localDestroy(keyObject4);
/*try {
- objVal1 = dynCast<PdxTests::PdxTypePtr>(regPtr0->get(keyObject4));;//
+ objVal1 = std::dynamic_pointer_cast<PdxTests::PdxType>(regPtr0->get(keyObject4));;//
need to verify that if entry is deleted then some exception should be thrown
FAIL("Expected EntryExistException here for get");
}catch (Exception)
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientSSLAuthCorrupt.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientSSLAuthCorrupt.cpp b/src/cppcache/integration-test/testThinClientSSLAuthCorrupt.cpp
index 3920f6f..867ac80 100644
--- a/src/cppcache/integration-test/testThinClientSSLAuthCorrupt.cpp
+++ b/src/cppcache/integration-test/testThinClientSSLAuthCorrupt.cpp
@@ -72,10 +72,10 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators,
LOG("createRegion_Pool() entered.");
fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
fflush(stdout);
- RegionPtr regPtr =
+ auto regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
@@ -85,11 +85,11 @@ void createEntry(const char* name, const char* key, const char* value) {
value, name);
fflush(stdout);
// Create entry, verify entry is correct
- CacheableKeyPtr keyPtr = createKey(key);
- CacheableStringPtr valPtr = CacheableString::create(value);
+ auto keyPtr = createKey(key);
+ auto valPtr = CacheableString::create(value);
- RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ auto regPtr = getHelper()->getRegion(name);
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
@@ -144,7 +144,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CreateRegions1_PoolLocators)
createPooledRegion(regionNames[1], NO_ACK, locatorsG, "__TESTPOOL1_", true);
RegionPtr regPtr = getHelper()->getRegion(regionNames[0]);
try {
- regPtr->registerAllKeys(false, NULLPTR, false, false);
+ regPtr->registerAllKeys(false, nullptr, false, false);
FAIL("Should have got NotConnectedException during registerAllKeys");
}
catch (NotConnectedException exp) {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientSSLAuthFail.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientSSLAuthFail.cpp b/src/cppcache/integration-test/testThinClientSSLAuthFail.cpp
index e6282f4..53ebc9f 100644
--- a/src/cppcache/integration-test/testThinClientSSLAuthFail.cpp
+++ b/src/cppcache/integration-test/testThinClientSSLAuthFail.cpp
@@ -75,7 +75,7 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators,
RegionPtr regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
@@ -89,7 +89,7 @@ void createEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
@@ -144,7 +144,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CreateRegions1_PoolLocators)
createPooledRegion(regionNames[1], NO_ACK, locatorsG, "__TESTPOOL1_", true);
RegionPtr regPtr = getHelper()->getRegion(regionNames[0]);
try {
- regPtr->registerAllKeys(false, NULLPTR, false, false);
+ regPtr->registerAllKeys(false, nullptr, false, false);
FAIL("Should have got NotConnectedException during registerAllKeys");
}
catch (NotConnectedException exp) {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientSSLAuthUntrusted.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientSSLAuthUntrusted.cpp b/src/cppcache/integration-test/testThinClientSSLAuthUntrusted.cpp
index 26214d9..402c5e3 100644
--- a/src/cppcache/integration-test/testThinClientSSLAuthUntrusted.cpp
+++ b/src/cppcache/integration-test/testThinClientSSLAuthUntrusted.cpp
@@ -73,10 +73,10 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators,
LOG("createRegion_Pool() entered.");
fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
fflush(stdout);
- RegionPtr regPtr =
+ auto regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
@@ -86,11 +86,11 @@ void createEntry(const char* name, const char* key, const char* value) {
value, name);
fflush(stdout);
// Create entry, verify entry is correct
- CacheableKeyPtr keyPtr = createKey(key);
- CacheableStringPtr valPtr = CacheableString::create(value);
+ auto keyPtr = createKey(key);
+ auto valPtr = CacheableString::create(value);
- RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ auto regPtr = getHelper()->getRegion(name);
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
@@ -145,7 +145,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CreateRegions1_PoolLocators)
createPooledRegion(regionNames[1], NO_ACK, locatorsG, "__TESTPOOL1_", true);
RegionPtr regPtr = getHelper()->getRegion(regionNames[0]);
try {
- regPtr->registerAllKeys(false, NULLPTR, false, false);
+ regPtr->registerAllKeys(false, nullptr, false, false);
FAIL("Should have got NotConnectedException during registerAllKeys");
}
catch (NotConnectedException exp) {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientSSLWithSecurityAuthz.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientSSLWithSecurityAuthz.cpp b/src/cppcache/integration-test/testThinClientSSLWithSecurityAuthz.cpp
index ac01544..e91ddbf 100644
--- a/src/cppcache/integration-test/testThinClientSSLWithSecurityAuthz.cpp
+++ b/src/cppcache/integration-test/testThinClientSSLWithSecurityAuthz.cpp
@@ -64,7 +64,7 @@ void initCredentialGenerator() {
}
}
- if (credentialGeneratorHandler == NULLPTR) {
+ if (credentialGeneratorHandler == nullptr) {
FAIL("credentialGeneratorHandler is NULL");
}
@@ -137,20 +137,20 @@ void initClientAuth(char UserType) {
break;
}
- CacheableStringPtr alias(config->find("security-alias"));
- CacheableStringPtr uname(config->find("security-username"));
- CacheableStringPtr passwd(config->find("security-password"));
+ auto alias = config->find("security-alias");
+ auto uname = config->find("security-username");
+ auto passwd = config->find("security-password");
char msgAlias[100];
char msgUname[100];
char msgPasswd[100];
sprintf(msgAlias, "PKCS alias is %s",
- alias == NULLPTR ? "null" : alias->asChar());
+ alias == nullptr ? "null" : alias->asChar());
sprintf(msgUname, "username is %s",
- uname == NULLPTR ? "null" : uname->asChar());
+ uname == nullptr ? "null" : uname->asChar());
sprintf(msgPasswd, "password is %s",
- passwd == NULLPTR ? "null" : passwd->asChar());
+ passwd == nullptr ? "null" : passwd->asChar());
LOG(msgAlias);
LOG(msgUname);
@@ -239,9 +239,9 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne)
for (int i = 0; i < 5; i++) {
entrykeys.push_back(CacheableKey::create(i));
}
- HashMapOfCacheablePtr valuesMap(new HashMapOfCacheable());
+ auto valuesMap = std::make_shared<HashMapOfCacheable>();
valuesMap->clear();
- regPtr->getAll(entrykeys, valuesMap, NULLPTR, false);
+ regPtr->getAll(entrykeys, valuesMap, nullptr, false);
if (valuesMap->size() > 0) {
LOG("GetAll completed successfully");
} else {
@@ -251,7 +251,7 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne)
LOG("Query completed successfully");
PoolPtr pool = PoolManager::find(regionNamesAuth[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
// Using region name as pool name
qs = pool->getQueryService();
} else {
@@ -260,11 +260,11 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne)
char queryString[100];
sprintf(queryString, "select * from /%s", regionNamesAuth[0]);
CqAttributesFactory cqFac;
- CqAttributesPtr cqAttrs(cqFac.create());
+ auto cqAttrs = cqFac.create();
CqQueryPtr qry = qs->newCq("cq_security", queryString, cqAttrs);
qs->executeCqs();
LOG("CQ completed successfully");
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
FunctionService::onServer(pool)
->execute("securityTest", true)
->getResult();
@@ -288,7 +288,7 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne)
createEntry(regionNamesAuth[0], keys[2], vals[2]);
LOG("Entry created successfully");
RegionPtr regPtr0 = getHelper()->getRegion(regionNamesAuth[0]);
- if (regPtr0 != NULLPTR) {
+ if (regPtr0 != nullptr) {
LOG("Going to do registerAllKeys");
regPtr0->registerAllKeys();
LOG("Going to do unregisterAllKeys");
@@ -338,9 +338,9 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo)
try {
RegionPtr regPtr0 = getHelper()->getRegion(regionNamesAuth[0]);
CacheableKeyPtr keyPtr = CacheableKey::create(keys[2]);
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr0->get(keyPtr));
- if (checkPtr != NULLPTR) {
+ auto checkPtr =
+ std::dynamic_pointer_cast<CacheableString>(regPtr0->get(keyPtr));
+ if (checkPtr != nullptr) {
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
checkPtr->asChar(), keys[2]);
@@ -367,9 +367,9 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo)
for (int i = 0; i < 5; i++) {
entrykeys.push_back(CacheableKey::create(i));
}
- HashMapOfCacheablePtr valuesMap(new HashMapOfCacheable());
+ auto valuesMap = std::make_shared<HashMapOfCacheable>();
valuesMap->clear();
- regPtr0->getAll(entrykeys, valuesMap, NULLPTR, false);
+ regPtr0->getAll(entrykeys, valuesMap, nullptr, false);
if (valuesMap->size() > 0) {
FAIL("GetAll should not have completed successfully");
}
@@ -386,7 +386,7 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo)
try {
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
// Using region name as pool name
qs = pool->getQueryService();
} else {
@@ -395,7 +395,7 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo)
char queryString[100];
sprintf(queryString, "select * from /%s", regionNamesAuth[0]);
CqAttributesFactory cqFac;
- CqAttributesPtr cqAttrs(cqFac.create());
+ auto cqAttrs = cqFac.create();
CqQueryPtr qry = qs->newCq("cq_security", queryString, cqAttrs);
qs->executeCqs();
FAIL("CQ should not have completed successfully");
@@ -403,7 +403,7 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo)
HANDLE_NOT_AUTHORIZED_EXCEPTION
try {
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
FunctionService::onServer(pool)
->execute("securityTest", true)
->getResult();
@@ -467,9 +467,9 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree)
try {
RegionPtr regPtr0 = getHelper()->getRegion(regionNamesAuth[0]);
CacheableKeyPtr keyPtr = CacheableKey::create(keys[2]);
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr0->get(keyPtr));
- if (checkPtr != NULLPTR) {
+ auto checkPtr =
+ std::dynamic_pointer_cast<CacheableString>(regPtr0->get(keyPtr));
+ if (checkPtr != nullptr) {
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
checkPtr->asChar(), keys[2]);
@@ -481,7 +481,7 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree)
HANDLE_NO_NOT_AUTHORIZED_EXCEPTION
RegionPtr regPtr0 = getHelper()->getRegion(regionNamesAuth[0]);
- if (regPtr0 != NULLPTR) {
+ if (regPtr0 != nullptr) {
try {
LOG("Going to do registerAllKeys");
regPtr0->registerAllKeys();
@@ -507,9 +507,9 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree)
for (int i = 0; i < 5; i++) {
entrykeys.push_back(CacheableKey::create(i));
}
- HashMapOfCacheablePtr valuesMap(new HashMapOfCacheable());
+ auto valuesMap = std::make_shared<HashMapOfCacheable>();
valuesMap->clear();
- regPtr0->getAll(entrykeys, valuesMap, NULLPTR, false);
+ regPtr0->getAll(entrykeys, valuesMap, nullptr, false);
if (valuesMap->size() > 0) {
LOG("GetAll completed successfully");
} else {
@@ -528,7 +528,7 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree)
try {
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
// Using region name as pool name
qs = pool->getQueryService();
} else {
@@ -537,7 +537,7 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree)
char queryString[100];
sprintf(queryString, "select * from /%s", regionNamesAuth[0]);
CqAttributesFactory cqFac;
- CqAttributesPtr cqAttrs(cqFac.create());
+ auto cqAttrs = cqFac.create();
CqQueryPtr qry = qs->newCq("cq_security", queryString, cqAttrs);
qs->executeCqs();
// FAIL("CQ should not have completed successfully");
@@ -545,7 +545,7 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree)
HANDLE_NOT_AUTHORIZED_EXCEPTION
try {
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
FunctionService::onServer(pool)
->execute("securityTest", true)
->getResult();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientSecurityAuthentication.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientSecurityAuthentication.cpp b/src/cppcache/integration-test/testThinClientSecurityAuthentication.cpp
index a5b4285..3de9f27 100644
--- a/src/cppcache/integration-test/testThinClientSecurityAuthentication.cpp
+++ b/src/cppcache/integration-test/testThinClientSecurityAuthentication.cpp
@@ -63,7 +63,7 @@ void initCredentialGenerator() {
}
}
- if (credentialGeneratorHandler == NULLPTR) {
+ if (credentialGeneratorHandler == nullptr) {
FAIL("credentialGeneratorHandler is NULL");
}
@@ -73,7 +73,7 @@ void initCredentialGenerator() {
void initClientAuth(char credentialsType) {
PropertiesPtr config = Properties::create();
- if (credentialGeneratorHandler == NULLPTR) {
+ if (credentialGeneratorHandler == nullptr) {
FAIL("credentialGeneratorHandler is NULL");
}
bool insertAuthInit = true;
@@ -128,7 +128,7 @@ DUNIT_TASK_DEFINITION(LOCATORSERVER, CreateServer1)
{
initCredentialGenerator();
std::string cmdServerAuthenticator;
- if (credentialGeneratorHandler == NULLPTR) {
+ if (credentialGeneratorHandler == nullptr) {
FAIL("credentialGeneratorHandler is NULL");
}
@@ -257,9 +257,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepFive)
createRegionForSecurity(regionNamesAuth[1], USE_ACK, true);
RegionPtr regPtr0 = getHelper()->getRegion(regionNamesAuth[0]);
CacheableKeyPtr keyPtr = CacheableKey::create(keys[0]);
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr0->get(keyPtr));
- if (checkPtr != NULLPTR && !strcmp(nvals[0], checkPtr->asChar())) {
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr0->get(keyPtr));
+ if (checkPtr != nullptr && !strcmp(nvals[0], checkPtr->asChar())) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
@@ -306,7 +305,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepSeven)
CacheHelper::setJavaConnectionPoolSize(0);
SLEEP(500);
try {
- createRegionForSecurity(regionNamesAuth[0], USE_ACK, true, NULLPTR, true,
+ createRegionForSecurity(regionNamesAuth[0], USE_ACK, true, nullptr, true,
0);
FAIL("Should have thrown AuthenticationFailedException.");
} catch (
@@ -332,7 +331,7 @@ void createEntryTx(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
// ASSERT( !regPtr->containsKey( keyPtr ), "Key should not have been found in
// region." );
@@ -357,7 +356,7 @@ void updateEntryTx(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
ASSERT(regPtr->containsValueForKey(keyPtr),
@@ -387,12 +386,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepEight)
LOG("txManager commit done");
CacheableKeyPtr keyPtr = CacheableKey::create("TxKey");
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr0->get(keyPtr));
- ASSERT(checkPtr != NULLPTR, "Value not found.");
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr0->get(keyPtr));
+ ASSERT(checkPtr != nullptr, "Value not found.");
LOGINFO("checkPtr->asChar() = %s ", checkPtr->asChar());
ASSERT(strcmp("TxValue", checkPtr->asChar()) == 0, "Value not correct.");
- if (checkPtr != NULLPTR && !strcmp("TxValue", checkPtr->asChar())) {
+ if (checkPtr != nullptr && !strcmp("TxValue", checkPtr->asChar())) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
@@ -409,10 +407,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepEight)
txManager->rollback();
LOG("txManager rollback done");
- checkPtr = dynCast<CacheableStringPtr>(regPtr0->get(keyPtr));
- ASSERT(checkPtr != NULLPTR, "Value not found.");
+ checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr0->get(keyPtr));
+ ASSERT(checkPtr != nullptr, "Value not found.");
ASSERT(strcmp("TxValue", checkPtr->asChar()) == 0, "Value not correct.");
- if (checkPtr != NULLPTR && !strcmp("TxValue", checkPtr->asChar())) {
+ if (checkPtr != nullptr && !strcmp("TxValue", checkPtr->asChar())) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientSecurityAuthenticationMU.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientSecurityAuthenticationMU.cpp b/src/cppcache/integration-test/testThinClientSecurityAuthenticationMU.cpp
index 1604efc..ea2c85e 100644
--- a/src/cppcache/integration-test/testThinClientSecurityAuthenticationMU.cpp
+++ b/src/cppcache/integration-test/testThinClientSecurityAuthenticationMU.cpp
@@ -66,7 +66,7 @@ void initCredentialGenerator() {
}
}
- if (credentialGeneratorHandler == NULLPTR) {
+ if (credentialGeneratorHandler == nullptr) {
FAIL("credentialGeneratorHandler is NULL");
}
@@ -78,7 +78,7 @@ void initClientAuth(char credentialsType) {
printf(" in initclientAuth 0 = %c ", credentialsType);
userCreds = Properties::create();
PropertiesPtr config = Properties::create();
- if (credentialGeneratorHandler == NULLPTR) {
+ if (credentialGeneratorHandler == nullptr) {
FAIL("credentialGeneratorHandler is NULL");
}
bool insertAuthInit = true;
@@ -135,7 +135,7 @@ DUNIT_TASK_DEFINITION(LOCATORSERVER, CreateServer1)
{
initCredentialGenerator();
std::string cmdServerAuthenticator;
- if (credentialGeneratorHandler == NULLPTR) {
+ if (credentialGeneratorHandler == nullptr) {
FAIL("credentialGeneratorHandler is NULL");
}
@@ -185,13 +185,13 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepOne)
try {
LOG(" 4");
- createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, NULLPTR,
+ createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, nullptr,
false, -1, true, 0);
LOG(" 5");
// need to insure pool name
PoolPtr pool = getPool(regionNamesAuth[0]);
LOG(" 6");
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
LOG(" 7");
RegionServicePtr virtualCache = getVirtualCache(userCreds, pool);
LOG(" 8");
@@ -218,12 +218,12 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwo)
{
initClientAuth(CORRECT_CREDENTIALS);
try {
- createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, NULLPTR,
+ createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, nullptr,
false, -1, true, 0);
char buff[128] = {'\0'};
sprintf(buff, "%s_0", regionNamesAuth[0]);
PoolPtr pool = getPool(regionNamesAuth[0]);
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
RegionServicePtr virtualCache = getVirtualCache(userCreds, pool);
RegionPtr virtualRegion = virtualCache->getRegion(regionNamesAuth[0]);
virtualRegion->create(keys[0], vals[0]);
@@ -248,11 +248,11 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepThree)
initCredentialGenerator();
initClientAuth(CORRECT_CREDENTIALS);
try {
- createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, NULLPTR,
+ createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, nullptr,
false, -1, true, 0);
// need to insure pool name
PoolPtr pool = getPool(regionNamesAuth[0]);
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
RegionServicePtr virtualCache = getVirtualCache(userCreds, pool);
virtualCache->getRegion(regionNamesAuth[0])->put(keys[0], vals[0]);
} else {
@@ -279,11 +279,11 @@ DUNIT_TASK_DEFINITION(CLIENT3, StepFour)
}
try {
- createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, NULLPTR,
+ createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, nullptr,
false, -1, true, 0);
// need to insure pool name
PoolPtr pool = getPool(regionNamesAuth[0]);
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
RegionServicePtr virtualCache = getVirtualCache(userCreds, pool);
virtualCache->getRegion(regionNamesAuth[0])->put(keys[0], vals[0]);
} else {
@@ -311,13 +311,13 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepFive)
{
SLEEP(80);
try {
- createRegionForSecurity(regionNamesAuth[1], USE_ACK, false, NULLPTR,
+ createRegionForSecurity(regionNamesAuth[1], USE_ACK, false, nullptr,
false, -1, true, 0);
// need to insure pool name
PoolPtr pool = getPool(regionNamesAuth[1]);
RegionServicePtr virtualCache;
RegionPtr virtualRegion;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
virtualCache = getVirtualCache(userCreds, pool);
virtualRegion = virtualCache->getRegion(regionNamesAuth[1]);
} else {
@@ -325,9 +325,9 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepFive)
}
CacheableKeyPtr keyPtr = CacheableKey::create(keys[0]);
LOG("before get");
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(virtualRegion->get(keyPtr));
- if (checkPtr != NULLPTR && !strcmp(nvals[0], checkPtr->asChar())) {
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(
+ virtualRegion->get(keyPtr));
+ if (checkPtr != nullptr && !strcmp(nvals[0], checkPtr->asChar())) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
@@ -349,12 +349,12 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSix)
{
initClientAuth(CORRECT_CREDENTIALS);
try {
- createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, NULLPTR,
+ createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, nullptr,
false, -1, true, 0);
char buff[128] = {'\0'};
sprintf(buff, "%s_1", regionNamesAuth[0]);
PoolPtr pool = getPool(regionNamesAuth[0]);
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
RegionServicePtr virtualCache = getVirtualCache(userCreds, pool);
RegionPtr virtualRegion = virtualCache->getRegion(regionNamesAuth[0]);
virtualRegion->create(keys[0], vals[0]);
@@ -385,12 +385,12 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepSeven)
CacheHelper::setJavaConnectionPoolSize(0);
SLEEP(500);
try {
- createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, NULLPTR,
+ createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, nullptr,
false, -1, true, 0);
char buff[128] = {'\0'};
sprintf(buff, "%s_0", regionNamesAuth[0]);
PoolPtr pool = getPool(regionNamesAuth[0]);
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
RegionServicePtr virtualCache = getVirtualCache(userCreds, pool);
RegionPtr virtualRegion = virtualCache->getRegion(regionNamesAuth[0]);
virtualRegion->create(keys[0], vals[0]);
@@ -417,13 +417,13 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepEight)
{
initClientAuth(CORRECT_CREDENTIALS);
try {
- createRegionForSecurity(regionNamesAuth[1], USE_ACK, false, NULLPTR,
+ createRegionForSecurity(regionNamesAuth[1], USE_ACK, false, nullptr,
false, -1, true, 0);
// need to insure pool name
PoolPtr pool = getPool(regionNamesAuth[1]);
RegionServicePtr virtualCache;
RegionPtr virtualRegion;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
virtualCache = getVirtualCache(userCreds, pool);
virtualRegion = virtualCache->getRegion(regionNamesAuth[1]);
} else {
@@ -440,12 +440,12 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepEight)
txManager->commit();
LOG("txManager commit done");
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(virtualRegion->get("TxKey"));
- ASSERT(checkPtr != NULLPTR, "Value not found.");
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(
+ virtualRegion->get("TxKey"));
+ ASSERT(checkPtr != nullptr, "Value not found.");
LOGINFO("checkPtr->asChar() = %s ", checkPtr->asChar());
ASSERT(strcmp("TxValue", checkPtr->asChar()) == 0, "Value not correct.");
- if (checkPtr != NULLPTR && !strcmp("TxValue", checkPtr->asChar())) {
+ if (checkPtr != nullptr && !strcmp("TxValue", checkPtr->asChar())) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
@@ -462,10 +462,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepEight)
txManager->rollback();
LOG("txManager rollback done");
- checkPtr = dynCast<CacheableStringPtr>(virtualRegion->get("TxKey"));
- ASSERT(checkPtr != NULLPTR, "Value not found.");
+ checkPtr = std::dynamic_pointer_cast<CacheableString>(
+ virtualRegion->get("TxKey"));
+ ASSERT(checkPtr != nullptr, "Value not found.");
ASSERT(strcmp("TxValue", checkPtr->asChar()) == 0, "Value not correct.");
- if (checkPtr != NULLPTR && !strcmp("TxValue", checkPtr->asChar())) {
+ if (checkPtr != nullptr && !strcmp("TxValue", checkPtr->asChar())) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientSecurityAuthorization.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientSecurityAuthorization.cpp b/src/cppcache/integration-test/testThinClientSecurityAuthorization.cpp
index bba4893..6049dec 100644
--- a/src/cppcache/integration-test/testThinClientSecurityAuthorization.cpp
+++ b/src/cppcache/integration-test/testThinClientSecurityAuthorization.cpp
@@ -62,7 +62,7 @@ void initCredentialGenerator() {
}
}
- if (credentialGeneratorHandler == NULLPTR) {
+ if (credentialGeneratorHandler == nullptr) {
FAIL("credentialGeneratorHandler is NULL");
}
@@ -135,20 +135,20 @@ void initClientAuth(char UserType) {
break;
}
- CacheableStringPtr alias(config->find("security-alias"));
- CacheableStringPtr uname(config->find("security-username"));
- CacheableStringPtr passwd(config->find("security-password"));
+ auto alias = config->find("security-alias");
+ auto uname = config->find("security-username");
+ auto passwd = config->find("security-password");
char msgAlias[100];
char msgUname[100];
char msgPasswd[100];
sprintf(msgAlias, "PKCS alias is %s",
- alias == NULLPTR ? "null" : alias->asChar());
+ alias == nullptr ? "null" : alias->asChar());
sprintf(msgUname, "username is %s",
- uname == NULLPTR ? "null" : uname->asChar());
+ uname == nullptr ? "null" : uname->asChar());
sprintf(msgPasswd, "password is %s",
- passwd == NULLPTR ? "null" : passwd->asChar());
+ passwd == nullptr ? "null" : passwd->asChar());
LOG(msgAlias);
LOG(msgUname);
@@ -218,7 +218,7 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne)
regPtr->clear();
CacheablePtr getVal = regPtr->get(1);
- if (getVal == NULLPTR) {
+ if (getVal == nullptr) {
LOG("Get completed after region.clear successfully");
} else {
FAIL("Get did not complete successfully");
@@ -245,9 +245,9 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne)
for (int i = 0; i < 5; i++) {
entrykeys.push_back(CacheableKey::create(i));
}
- HashMapOfCacheablePtr valuesMap(new HashMapOfCacheable());
+ auto valuesMap = std::make_shared<HashMapOfCacheable>();
valuesMap->clear();
- regPtr->getAll(entrykeys, valuesMap, NULLPTR, false);
+ regPtr->getAll(entrykeys, valuesMap, nullptr, false);
if (valuesMap->size() > 0) {
LOG("GetAll completed successfully");
} else {
@@ -263,7 +263,7 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne)
LOG("Query completed successfully");
PoolPtr pool = PoolManager::find(regionNamesAuth[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
// Using region name as pool name
qs = pool->getQueryService();
} else {
@@ -272,12 +272,12 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne)
char queryString[100];
sprintf(queryString, "select * from /%s", regionNamesAuth[0]);
CqAttributesFactory cqFac;
- CqAttributesPtr cqAttrs(cqFac.create());
+ auto cqAttrs = cqFac.create();
CqQueryPtr qry = qs->newCq("cq_security", queryString, cqAttrs);
qs->executeCqs();
qs->closeCqs();
LOG("CQ completed successfully");
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
// TODO:
FunctionService::onServer(pool)
->execute("securityTest", true)
@@ -312,7 +312,7 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne)
createEntry(regionNamesAuth[0], keys[2], vals[2]);
LOG("Entry created successfully");
RegionPtr regPtr0 = getHelper()->getRegion(regionNamesAuth[0]);
- if (regPtr0 != NULLPTR) {
+ if (regPtr0 != nullptr) {
LOG("Going to do registerAllKeys");
regPtr0->registerAllKeys();
LOG("Going to do unregisterAllKeys");
@@ -371,9 +371,8 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo)
try {
RegionPtr regPtr0 = getHelper()->getRegion(regionNamesAuth[0]);
CacheableKeyPtr keyPtr = CacheableKey::create(keys[2]);
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr0->get(keyPtr));
- if (checkPtr != NULLPTR) {
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr0->get(keyPtr));
+ if (checkPtr != nullptr) {
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
checkPtr->asChar(), keys[2]);
@@ -400,9 +399,9 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo)
for (int i = 0; i < 5; i++) {
entrykeys.push_back(CacheableKey::create(i));
}
- HashMapOfCacheablePtr valuesMap(new HashMapOfCacheable());
+ auto valuesMap = std::make_shared<HashMapOfCacheable>();
valuesMap->clear();
- regPtr0->getAll(entrykeys, valuesMap, NULLPTR, false);
+ regPtr0->getAll(entrykeys, valuesMap, nullptr, false);
if (valuesMap->size() > 0) {
FAIL("GetAll should not have completed successfully");
}
@@ -419,7 +418,7 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo)
try {
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
// Using region name as pool name
qs = pool->getQueryService();
} else {
@@ -428,7 +427,7 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo)
char queryString[100];
sprintf(queryString, "select * from /%s", regionNamesAuth[0]);
CqAttributesFactory cqFac;
- CqAttributesPtr cqAttrs(cqFac.create());
+ auto cqAttrs = cqFac.create();
CqQueryPtr qry = qs->newCq("cq_security", queryString, cqAttrs);
qs->executeCqs();
FAIL("CQ should not have completed successfully");
@@ -503,9 +502,8 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree)
try {
RegionPtr regPtr0 = getHelper()->getRegion(regionNamesAuth[0]);
CacheableKeyPtr keyPtr = CacheableKey::create(keys[2]);
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr0->get(keyPtr));
- if (checkPtr != NULLPTR) {
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr0->get(keyPtr));
+ if (checkPtr != nullptr) {
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
checkPtr->asChar(), keys[2]);
@@ -525,7 +523,7 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree)
HANDLE_NOT_AUTHORIZED_EXCEPTION
RegionPtr regPtr0 = getHelper()->getRegion(regionNamesAuth[0]);
- if (regPtr0 != NULLPTR) {
+ if (regPtr0 != nullptr) {
try {
LOG("Going to do registerAllKeys");
regPtr0->registerAllKeys();
@@ -559,9 +557,9 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree)
for (int i = 0; i < 5; i++) {
entrykeys.push_back(CacheableKey::create(i));
}
- HashMapOfCacheablePtr valuesMap(new HashMapOfCacheable());
+ auto valuesMap = std::make_shared<HashMapOfCacheable>();
valuesMap->clear();
- regPtr0->getAll(entrykeys, valuesMap, NULLPTR, false);
+ regPtr0->getAll(entrykeys, valuesMap, nullptr, false);
if (valuesMap->size() > 0) {
LOG("GetAll completed successfully");
} else {
@@ -580,7 +578,7 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree)
try {
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
// Using region name as pool name
qs = pool->getQueryService();
} else {
@@ -589,7 +587,7 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree)
char queryString[100];
sprintf(queryString, "select * from /%s", regionNamesAuth[0]);
CqAttributesFactory cqFac;
- CqAttributesPtr cqAttrs(cqFac.create());
+ auto cqAttrs = cqFac.create();
CqQueryPtr qry = qs->newCq("cq_security", queryString, cqAttrs);
qs->executeCqs();
// FAIL("CQ should not have completed successfully");
@@ -599,7 +597,7 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree)
pool = PoolManager::find(regionNamesAuth[0]);
try {
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
FunctionService::onServer(pool)
->execute("securityTest", true)
->getResult();
@@ -611,7 +609,7 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree)
HANDLE_NOT_AUTHORIZED_EXCEPTION
try {
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
FunctionService::onServer(pool)
->execute("securityTest", true)
->getResult();
@@ -623,7 +621,7 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree)
HANDLE_NOT_AUTHORIZED_EXCEPTION
try {
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
FunctionService::onServers(pool)
->execute("securityTest", true)
->getResult();
@@ -635,7 +633,7 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree)
HANDLE_NOT_AUTHORIZED_EXCEPTION
try {
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
RegionPtr regPtr0 = getHelper()->getRegion(regionNamesAuth[0]);
FunctionService::onRegion(regPtr0)
->execute("securityTest", true)
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientSecurityAuthorizationMU.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientSecurityAuthorizationMU.cpp b/src/cppcache/integration-test/testThinClientSecurityAuthorizationMU.cpp
index 67fbf0b..e4ab9d6 100644
--- a/src/cppcache/integration-test/testThinClientSecurityAuthorizationMU.cpp
+++ b/src/cppcache/integration-test/testThinClientSecurityAuthorizationMU.cpp
@@ -65,7 +65,7 @@ void initCredentialGenerator() {
}
}
- if (credentialGeneratorHandler == NULLPTR) {
+ if (credentialGeneratorHandler == nullptr) {
FAIL("credentialGeneratorHandler is NULL");
}
@@ -143,20 +143,20 @@ void initClientAuth(char UserType) {
break;
}
- CacheableStringPtr alias(userCreds->find("security-alias"));
- CacheableStringPtr uname(userCreds->find("security-username"));
- CacheableStringPtr passwd(userCreds->find("security-password"));
+ auto alias = userCreds->find("security-alias");
+ auto uname = userCreds->find("security-username");
+ auto passwd = userCreds->find("security-password");
char msgAlias[100];
char msgUname[100];
char msgPasswd[100];
sprintf(msgAlias, "PKCS alias is %s",
- alias == NULLPTR ? "null" : alias->asChar());
+ alias == nullptr ? "null" : alias->asChar());
sprintf(msgUname, "username is %s",
- uname == NULLPTR ? "null" : uname->asChar());
+ uname == nullptr ? "null" : uname->asChar());
sprintf(msgPasswd, "password is %s",
- passwd == NULLPTR ? "null" : passwd->asChar());
+ passwd == nullptr ? "null" : passwd->asChar());
LOG(msgAlias);
LOG(msgUname);
@@ -216,7 +216,7 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne)
initClientAuth('A');
try {
LOG("Tying Region creation");
- createRegionForSecurity(regionNamesAuth[0], USE_ACK, true, NULLPTR, false,
+ createRegionForSecurity(regionNamesAuth[0], USE_ACK, true, nullptr, false,
-1, true, 0);
LOG("Region created successfully");
LOG("Tying Entry creation");
@@ -224,7 +224,7 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne)
RegionPtr regionPtr;
PoolPtr pool = getPool(regionNamesAuth[0]);
LOG(" 6");
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
LOG(" 7");
virtualCache = getVirtualCache(userCreds, pool);
LOG(" 8");
@@ -239,7 +239,7 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne)
regionPtr->clear();
CacheablePtr getVal = regionPtr->get(1);
- if (getVal == NULLPTR) {
+ if (getVal == nullptr) {
LOG("Get completed after region.clear successfully");
} else {
FAIL("Get did not complete successfully");
@@ -274,9 +274,9 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne)
for (int i = 0; i < 5; i++) {
entrykeys.push_back(CacheableKey::create(i));
}
- HashMapOfCacheablePtr valuesMap(new HashMapOfCacheable());
+ auto valuesMap = std::make_shared<HashMapOfCacheable>();
valuesMap->clear();
- regionPtr->getAll(entrykeys, valuesMap, NULLPTR, false);
+ regionPtr->getAll(entrykeys, valuesMap, nullptr, false);
if (valuesMap->size() > 0) {
LOG("GetAll completed successfully");
} else {
@@ -312,13 +312,13 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne)
sprintf(queryString, "select * from /%s", regionNamesAuth[0]);
CqAttributesFactory cqFac;
- CqAttributesPtr cqAttrs(cqFac.create());
+ auto cqAttrs = cqFac.create();
CqQueryPtr cqQry = qs->newCq("cq_security", queryString, cqAttrs);
cqQry->execute();
cqQry->close();
LOG("CQ completed successfully");
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
// TODO:
// FunctionService::onServer(pool)->execute("securityTest",
// true)->getResult();
@@ -345,7 +345,7 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne)
LOG("Function execution with sendException");
char buf[128];
for (int i = 1; i <= 200; i++) {
- CacheablePtr value(CacheableInt32::create(i));
+ auto value = CacheableInt32::create(i);
sprintf(buf, "execKey-%d", i);
CacheableKeyPtr key = CacheableKey::create(buf);
@@ -357,14 +357,14 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne)
CacheableArrayListPtr arrList = CacheableArrayList::create();
for (int i = 100; i < 120; i++) {
sprintf(buf, "execKey-%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
+ auto key = CacheableKey::create(buf);
arrList->push_back(key);
}
CacheableVectorPtr filter = CacheableVector::create();
for (int i = 100; i < 120; i++) {
sprintf(buf, "execKey-%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
+ auto key = CacheableKey::create(buf);
filter->push_back(key);
}
LOG("Adding filter done.");
@@ -373,24 +373,24 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne)
// UNUSED bool getResult = true;
ExecutionPtr funcExec = FunctionService::onRegion(regionPtr);
- ASSERT(funcExec != NULLPTR, "onRegion Returned NULL");
+ ASSERT(funcExec != nullptr, "onRegion Returned NULL");
ResultCollectorPtr collector =
funcExec->withArgs(args)->withFilter(filter)->execute(
exFuncNameSendException, 15);
- ASSERT(collector != NULLPTR, "onRegion collector NULL");
+ ASSERT(collector != nullptr, "onRegion collector NULL");
CacheableVectorPtr result = collector->getResult();
- if (result == NULLPTR) {
+ if (result == nullptr) {
ASSERT(false, "echo String : result is NULL");
} else {
try {
for (int i = 0; i < result->size(); i++) {
- UserFunctionExecutionExceptionPtr uFEPtr =
- dynCast<UserFunctionExecutionExceptionPtr>(
+ auto uFEPtr =
+ std::dynamic_pointer_cast<UserFunctionExecutionException>(
result->operator[](i));
- ASSERT(uFEPtr != NULLPTR, "uFEPtr exception is NULL");
+ ASSERT(uFEPtr != nullptr, "uFEPtr exception is NULL");
LOGINFO("Done casting to uFEPtr");
LOGINFO("Read expected uFEPtr exception %s ",
uFEPtr->getMessage()->asChar());
@@ -416,7 +416,7 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne)
collector = funcExec->withArgs(arrList)->withFilter(filter)->execute(
exFuncNameSendException, 15);
- ASSERT(collector != NULLPTR, "onRegion collector for arrList NULL");
+ ASSERT(collector != nullptr, "onRegion collector for arrList NULL");
result = collector->getResult();
ASSERT(result->size() == arrList->size() + 1,
@@ -425,9 +425,9 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne)
for (int i = 0; i < result->size(); i++) {
try {
- CacheableInt32Ptr intValue =
- dynCast<CacheableInt32Ptr>(result->operator[](i));
- ASSERT(intValue != NULLPTR, "int value is NULL");
+ auto intValue = std::dynamic_pointer_cast<CacheableInt32>(
+ result->operator[](i));
+ ASSERT(intValue != nullptr, "int value is NULL");
LOGINFO("intValue is %d ", intValue->value());
} catch (ClassCastException& ex) {
LOG("exFuncNameSendException casting to int for arrayList "
@@ -439,10 +439,10 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne)
logmsg += ex.getMessage();
LOG(logmsg.c_str());
ex.printStackTrace();
- UserFunctionExecutionExceptionPtr uFEPtr =
- dynCast<UserFunctionExecutionExceptionPtr>(
+ auto uFEPtr =
+ std::dynamic_pointer_cast<UserFunctionExecutionException>(
result->operator[](i));
- ASSERT(uFEPtr != NULLPTR, "uFEPtr exception is NULL");
+ ASSERT(uFEPtr != nullptr, "uFEPtr exception is NULL");
LOGINFO("Done casting to uFEPtr");
LOGINFO("Read expected uFEPtr exception %s ",
uFEPtr->getMessage()->asChar());
@@ -474,14 +474,14 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne)
destroyRegion(regionNamesAuth[0]);
LOG("Region destroy successfully");
LOG("Tying Region creation");
- createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, NULLPTR,
+ createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, nullptr,
false, -1, true, 0);
char buf[100] = {'\0'};
static int indexForPool = 0;
sprintf(buf, "%s_%d", regionNamesAuth[0], indexForPool++);
pool = getPool(buf);
LOG(" 6");
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
LOG(" 7");
virtualCache = getVirtualCache(userCreds, pool);
LOG(" 8");
@@ -498,7 +498,7 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne)
virtualCache->close();
LOG("Cache close successfully");
// RegionPtr regPtr0 = getHelper()->getRegion( regionNamesAuth[0] );
- /*if (regPtr != NULLPTR ) {
+ /*if (regPtr != nullptr ) {
LOG("Going to do registerAllKeys");
// regPtr->registerAllKeys();
LOG("Going to do unregisterAllKeys");
@@ -523,14 +523,14 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo)
initCredentialGenerator();
initClientAuth('W');
try {
- createRegionForSecurity(regionNamesAuth[0], USE_ACK, true, NULLPTR, false,
+ createRegionForSecurity(regionNamesAuth[0], USE_ACK, true, nullptr, false,
-1, true, 0);
LOG("Region created successfully");
RegionServicePtr virtualCache;
RegionPtr regionPtr;
PoolPtr pool = getPool(regionNamesAuth[0]);
LOG(" 6");
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
LOG(" 7");
virtualCache = getVirtualCache(userCreds, pool);
LOG(" 8");
@@ -578,7 +578,7 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo)
RegionServicePtr virtualCache;
RegionPtr regionPtr;
PoolPtr pool = getPool(regionNamesAuth[0]);
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
virtualCache = getVirtualCache(userCreds, pool);
regionPtr = virtualCache->getRegion(regionNamesAuth[0]);
} else {
@@ -598,7 +598,7 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo)
RegionPtr regionPtr;
PoolPtr pool = getPool(regionNamesAuth[0]);
LOG(" 6");
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
LOG(" 7");
virtualCache = getVirtualCache(userCreds, pool);
LOG(" 8");
@@ -608,9 +608,9 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo)
LOG("Pool is NULL");
}
CacheableKeyPtr keyPtr = CacheableKey::create(keys[2]);
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regionPtr->get(keyPtr));
- if (checkPtr != NULLPTR) {
+ auto checkPtr =
+ std::dynamic_pointer_cast<CacheableString>(regionPtr->get(keyPtr));
+ if (checkPtr != nullptr) {
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
checkPtr->asChar(), keys[2]);
@@ -635,7 +635,7 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo)
RegionPtr regionPtr;
PoolPtr pool = getPool(regionNamesAuth[0]);
LOG(" 6");
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
LOG(" 7");
virtualCache = getVirtualCache(userCreds, pool);
LOG(" 8");
@@ -652,9 +652,9 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo)
for (int i = 0; i < 5; i++) {
entrykeys.push_back(CacheableKey::create(i));
}
- HashMapOfCacheablePtr valuesMap(new HashMapOfCacheable());
+ auto valuesMap = std::make_shared<HashMapOfCacheable>();
valuesMap->clear();
- regionPtr->getAll(entrykeys, valuesMap, NULLPTR, false);
+ regionPtr->getAll(entrykeys, valuesMap, nullptr, false);
if (valuesMap->size() > 0) {
FAIL("GetAll should not have completed successfully");
}
@@ -666,7 +666,7 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo)
RegionPtr regionPtr;
PoolPtr pool = getPool(regionNamesAuth[0]);
LOG(" 6");
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
LOG(" 7");
virtualCache = getVirtualCache(userCreds, pool);
LOG(" 8");
@@ -691,7 +691,7 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo)
char queryString[100];
sprintf(queryString, "select * from /%s", regionNamesAuth[0]);
CqAttributesFactory cqFac;
- CqAttributesPtr cqAttrs(cqFac.create());
+ auto cqAttrs = cqFac.create();
CqQueryPtr qry = qs->newCq("cq_security", queryString, cqAttrs);
qs->executeCqs();
FAIL("CQ should not have completed successfully");
@@ -741,7 +741,7 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo)
"exception");
char buf[128];
for (int i = 1; i <= 200; i++) {
- CacheablePtr value(CacheableInt32::create(i));
+ auto value = CacheableInt32::create(i);
sprintf(buf, "execKey-%d", i);
CacheableKeyPtr key = CacheableKey::create(buf);
@@ -753,14 +753,14 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo)
CacheableArrayListPtr arrList = CacheableArrayList::create();
for (int i = 100; i < 120; i++) {
sprintf(buf, "execKey-%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
+ auto key = CacheableKey::create(buf);
arrList->push_back(key);
}
CacheableVectorPtr filter = CacheableVector::create();
for (int i = 100; i < 120; i++) {
sprintf(buf, "execKey-%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
+ auto key = CacheableKey::create(buf);
filter->push_back(key);
}
LOG("Adding filter done.");
@@ -808,7 +808,7 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo)
"exception with onRegion");
char buf[128];
for (int i = 1; i <= 200; i++) {
- CacheablePtr value(CacheableInt32::create(i));
+ auto value = CacheableInt32::create(i);
sprintf(buf, "execKey-%d", i);
CacheableKeyPtr key = CacheableKey::create(buf);
@@ -820,14 +820,14 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo)
CacheableArrayListPtr arrList = CacheableArrayList::create();
for (int i = 100; i < 120; i++) {
sprintf(buf, "execKey-%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
+ auto key = CacheableKey::create(buf);
arrList->push_back(key);
}
CacheableVectorPtr filter = CacheableVector::create();
for (int i = 100; i < 120; i++) {
sprintf(buf, "execKey-%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
+ auto key = CacheableKey::create(buf);
filter->push_back(key);
}
LOG("Adding filter done.");
@@ -857,7 +857,7 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo)
RegionPtr regionPtr;
PoolPtr pool = getPool(regionNamesAuth[0]);
LOG(" 6");
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
LOG(" 7");
virtualCache = getVirtualCache(userCreds, pool);
LOG(" 8");
@@ -882,13 +882,13 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree)
char buf[100];
int i = 102;
- createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, NULLPTR, false,
+ createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, nullptr, false,
-1, true, 0);
RegionServicePtr virtualCache;
RegionPtr rptr;
PoolPtr pool = getPool(regionNamesAuth[0]);
LOG(" 6");
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
LOG(" 7");
virtualCache = getVirtualCache(userCreds, pool);
LOG(" 8");
@@ -944,9 +944,9 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree)
try {
// RegionPtr regPtr0 = getHelper()->getRegion(regionNamesAuth[0]);
CacheableKeyPtr keyPtr = CacheableKey::create(keys[2]);
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(rptr->get(keyPtr));
- if (checkPtr != NULLPTR) {
+ auto checkPtr =
+ std::dynamic_pointer_cast<CacheableString>(rptr->get(keyPtr));
+ if (checkPtr != nullptr) {
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
checkPtr->asChar(), keys[2]);
@@ -958,7 +958,7 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree)
HANDLE_NO_NOT_AUTHORIZED_EXCEPTION
// RegionPtr regPtr0 = getHelper()->getRegion( regionNamesAuth[0] );
- if (rptr != NULLPTR) {
+ if (rptr != nullptr) {
try {
LOG("Going to do registerAllKeys");
// rptr->registerAllKeys();
@@ -992,9 +992,9 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree)
for (int i = 0; i < 5; i++) {
entrykeys.push_back(CacheableKey::create(i));
}
- HashMapOfCacheablePtr valuesMap(new HashMapOfCacheable());
+ auto valuesMap = std::make_shared<HashMapOfCacheable>();
valuesMap->clear();
- rptr->getAll(entrykeys, valuesMap, NULLPTR, false);
+ rptr->getAll(entrykeys, valuesMap, nullptr, false);
if (valuesMap->size() > 0) {
LOG("GetAll completed successfully");
} else {
@@ -1014,7 +1014,7 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree)
try {
/*QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
// Using region name as pool name
qs = pool->getQueryService();
} else {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientSecurityCQAuthorization.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientSecurityCQAuthorization.cpp b/src/cppcache/integration-test/testThinClientSecurityCQAuthorization.cpp
index 3bf7b8b..14cccc9 100644
--- a/src/cppcache/integration-test/testThinClientSecurityCQAuthorization.cpp
+++ b/src/cppcache/integration-test/testThinClientSecurityCQAuthorization.cpp
@@ -140,7 +140,7 @@ std::string getXmlPath() {
void initCredentialGenerator() {
credentialGeneratorHandler = CredentialGenerator::create("DUMMY3");
- if (credentialGeneratorHandler == NULLPTR) {
+ if (credentialGeneratorHandler == nullptr) {
FAIL("credentialGeneratorHandler is NULL");
}
}
@@ -239,7 +239,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
PoolPtr pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
// Using region name as pool name as in ThinClientCq.hpp
qs = pool->getQueryService();
} else {
@@ -247,7 +247,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
}
CqAttributesFactory cqFac;
for (i = 0; i < MAX_LISTNER; i++) {
- CqListenerPtr cqLstner(new MyCqListener(i));
+ auto cqLstner = std::make_shared<MyCqListener>(i);
cqFac.addCqListener(cqLstner);
CqAttributesPtr cqAttr = cqFac.create();
CqQueryPtr qry = qs->newCq(cqNames[i], queryStrings[i], cqAttr);
@@ -282,7 +282,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepTwo2)
qh->populatePortfolioData(regPtr0, 3, 2, 1);
qh->populatePositionData(subregPtr0, 3, 2);
for (int i = 1; i < 3; i++) {
- CacheablePtr port(new Portfolio(i, 2));
+ auto port = std::make_shared<Portfolio>(i, 2);
CacheableKeyPtr keyport = CacheableKey::create("port1-1");
regPtr0->put(keyport, port);
@@ -296,11 +296,11 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
{
- QueryHelper* qh ATTR_UNUSED = &QueryHelper::getHelper();
+ auto qh ATTR_UNUSED = &QueryHelper::getHelper();
- PoolPtr pool = PoolManager::find(regionNamesCq[0]);
+ auto pool = PoolManager::find(regionNamesCq[0]);
QueryServicePtr qs;
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
// Using region name as pool name as in ThinClientCq.hpp
qs = pool->getQueryService();
} else {
@@ -326,8 +326,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
for (i = 0; i < MAX_LISTNER; i++) {
sprintf(buf, "get info for cq[%s]:", cqNames[i]);
LOG(buf);
- CqQueryPtr cqy = qs->getCq(cqNames[i]);
- CqStatisticsPtr cqStats = cqy->getStatistics();
+ auto cqy = qs->getCq(cqNames[i]);
+ auto cqStats = cqy->getStatistics();
sprintf(buf,
"Cq[%s]From CqStatistics: numInserts[%d], numDeletes[%d], "
"numUpdates[%d], numEvents[%d]",
@@ -340,21 +340,21 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
deletes[j] += cqStats->numDeletes();
events[j] += cqStats->numEvents();
}
- CqAttributesPtr cqAttr = cqy->getCqAttributes();
- VectorOfCqListener vl;
+ auto cqAttr = cqy->getCqAttributes();
+ std::vector<CqListenerPtr> vl;
cqAttr->getCqListeners(vl);
- sprintf(buf, "number of listeners for cq[%s] is %d", cqNames[i],
+ sprintf(buf, "number of listeners for cq[%s] is %zd", cqNames[i],
vl.size());
LOG(buf);
ASSERT(vl.size() == i + 1, "incorrect number of listeners");
if (i == (MAX_LISTNER - 1)) {
MyCqListener* myLl[MAX_LISTNER];
for (int k = 0; k < MAX_LISTNER; k++) {
- MyCqListener* ml = dynamic_cast<MyCqListener*>(vl[k].ptr());
+ MyCqListener* ml = dynamic_cast<MyCqListener*>(vl[k].get());
myLl[ml->getId()] = ml;
}
for (j = 0; j < MAX_LISTNER; j++) {
- MyCqListener* ml = myLl[j];
+ auto ml = myLl[j];
sprintf(buf,
"MyCount for Listener[%d]: numInserts[%d], numDeletes[%d], "
"numUpdates[%d], numEvents[%d]",
@@ -376,18 +376,18 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
"accumulative events count incorrect");
}
LOG("removing listener");
- CqAttributesMutatorPtr cqAttrMtor = cqy->getCqAttributesMutator();
- CqListenerPtr ptr = vl[0];
+ auto cqAttrMtor = cqy->getCqAttributesMutator();
+ auto ptr = vl[0];
cqAttrMtor->removeCqListener(ptr);
cqAttr->getCqListeners(vl);
- sprintf(buf, "number of listeners for cq[%s] is %d", cqNames[i],
+ sprintf(buf, "number of listeners for cq[%s] is %zd", cqNames[i],
vl.size());
LOG(buf);
ASSERT(vl.size() == i, "incorrect number of listeners");
}
}
try {
- CqQueryPtr cqy = qs->getCq(cqNames[1]);
+ auto cqy = qs->getCq(cqNames[1]);
cqy->stop();
cqy = qs->getCq(cqNames[6]);
@@ -421,7 +421,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
cqy = qs->getCq(cqNames[2]);
sprintf(buf, "cq[%s] should have been removed after close!", cqNames[2]);
- ASSERT(cqy == NULLPTR, buf);
+ ASSERT(cqy == nullptr, buf);
} catch (Exception& excp) {
std::string failmsg = "";
failmsg += excp.getName();
@@ -431,8 +431,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
FAIL(failmsg.c_str());
excp.printStackTrace();
}
- CqServiceStatisticsPtr serviceStats = qs->getCqServiceStatistics();
- ASSERT(serviceStats != NULLPTR, "serviceStats is NULL");
+ auto serviceStats = qs->getCqServiceStatistics();
+ ASSERT(serviceStats != nullptr, "serviceStats is NULL");
sprintf(buf,
"numCqsActive=%d, numCqsCreated=%d, "
"numCqsClosed=%d,numCqsStopped=%d, numCqsOnClient=%d",
@@ -504,7 +504,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
ASSERT(serviceStats->numCqsOnClient() == 0, "cq count incorrect!");
i = 0;
- CqListenerPtr cqLstner(new MyCqListener(i));
+ auto cqLstner = std::make_shared<MyCqListener>(i);
cqFac.addCqListener(cqLstner);
CqAttributesPtr cqAttr = cqFac.create();
try {
[41/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from clicache
Posted by jb...@apache.org.
GEODE-2741: Remove custom shared pointer from clicache
Project: http://git-wip-us.apache.org/repos/asf/geode-native/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode-native/commit/6027574a
Tree: http://git-wip-us.apache.org/repos/asf/geode-native/tree/6027574a
Diff: http://git-wip-us.apache.org/repos/asf/geode-native/diff/6027574a
Branch: refs/heads/develop
Commit: 6027574a2078b35fadcef450020af775415f1c36
Parents: c009812
Author: Jacob Barrett <jb...@pivotal.io>
Authored: Fri Apr 21 22:59:27 2017 +0000
Committer: David Kimura <dk...@pivotal.io>
Committed: Mon May 15 11:43:09 2017 -0700
----------------------------------------------------------------------
src/clicache/CMakeLists.txt | 1 +
.../integration-test/SystemPropertiesTestsN.cs | 103 ---
.../integration-test/UnitTests.csproj.in | 1 -
src/clicache/src/AttributesFactory.cpp | 283 ++++--
src/clicache/src/AttributesFactory.hpp | 22 +-
src/clicache/src/AttributesMutator.cpp | 169 ++--
src/clicache/src/AttributesMutator.hpp | 21 +-
src/clicache/src/Cache.cpp | 195 +++--
src/clicache/src/Cache.hpp | 28 +-
src/clicache/src/CacheFactory.cpp | 270 ++++--
src/clicache/src/CacheFactory.hpp | 17 +-
src/clicache/src/CacheStatistics.cpp | 26 +-
src/clicache/src/CacheStatistics.hpp | 20 +-
src/clicache/src/CacheTransactionManager.cpp | 119 ++-
src/clicache/src/CacheTransactionManager.hpp | 62 +-
src/clicache/src/CacheableBuiltins.hpp | 108 ++-
src/clicache/src/CacheableDate.cpp | 4 -
src/clicache/src/CacheableDate.hpp | 3 -
src/clicache/src/CacheableHashSet.hpp | 189 ++--
src/clicache/src/CacheableKey.cpp | 39 +-
src/clicache/src/CacheableKey.hpp | 6 +-
src/clicache/src/CacheableObjectArray.cpp | 18 +-
src/clicache/src/CacheableStack.cpp | 3 +-
src/clicache/src/CacheableString.cpp | 8 +-
src/clicache/src/CacheableString.hpp | 7 +-
src/clicache/src/CacheableStringArray.hpp | 7 +-
src/clicache/src/CqAttributes.cpp | 49 +-
src/clicache/src/CqAttributes.hpp | 28 +-
src/clicache/src/CqAttributesFactory.cpp | 72 +-
src/clicache/src/CqAttributesFactory.hpp | 26 +-
src/clicache/src/CqAttributesMutator.cpp | 108 ++-
src/clicache/src/CqAttributesMutator.hpp | 25 +-
src/clicache/src/CqEvent.cpp | 17 +-
src/clicache/src/CqEvent.hpp | 25 +-
src/clicache/src/CqListener.hpp | 112 ---
src/clicache/src/CqOperation.hpp | 31 +-
src/clicache/src/CqQuery.cpp | 174 +++-
src/clicache/src/CqQuery.hpp | 24 +-
src/clicache/src/CqServiceStatistics.cpp | 78 +-
src/clicache/src/CqServiceStatistics.hpp | 24 +-
src/clicache/src/CqState.cpp | 58 +-
src/clicache/src/CqState.hpp | 29 +-
src/clicache/src/CqStatistics.cpp | 64 +-
src/clicache/src/CqStatistics.hpp | 24 +-
src/clicache/src/DataInput.cpp | 105 ++-
src/clicache/src/DataInput.hpp | 91 +-
src/clicache/src/DataOutput.cpp | 76 +-
src/clicache/src/DataOutput.hpp | 107 ++-
src/clicache/src/DiskPolicyType.hpp | 3 +
src/clicache/src/DistributedSystem.cpp | 413 ++++-----
src/clicache/src/DistributedSystem.hpp | 20 +-
src/clicache/src/EntryEvent.cpp | 38 +-
src/clicache/src/EntryEvent.hpp | 30 +-
src/clicache/src/ExceptionTypes.cpp | 1 -
src/clicache/src/ExceptionTypes.hpp | 15 +-
src/clicache/src/Execution.cpp | 68 +-
src/clicache/src/Execution.hpp | 25 +-
src/clicache/src/ExpirationAction.hpp | 3 +
src/clicache/src/FunctionService.cpp | 95 +-
src/clicache/src/FunctionService.hpp | 25 +-
src/clicache/src/GeodeClassIds.hpp | 3 +
src/clicache/src/ICacheLoader.hpp | 3 +
src/clicache/src/ICacheableKey.hpp | 1 -
src/clicache/src/ICqResults.hpp | 5 +-
src/clicache/src/IGeodeSerializable.hpp | 4 +-
src/clicache/src/IRegion.hpp | 3 +
src/clicache/src/ISelectResults.hpp | 5 +-
src/clicache/src/ISubscriptionService.hpp | 3 +-
src/clicache/src/LocalRegion.cpp | 548 ++++++++----
src/clicache/src/LocalRegion.hpp | 28 +-
src/clicache/src/Log.hpp | 3 +
src/clicache/src/Pool.cpp | 413 +++++++--
src/clicache/src/Pool.hpp | 29 +-
src/clicache/src/PoolFactory.cpp | 310 +++++--
src/clicache/src/PoolFactory.hpp | 27 +-
src/clicache/src/PoolManager.cpp | 48 +-
src/clicache/src/PoolManager.hpp | 5 +-
src/clicache/src/Properties.cpp | 497 +++--------
src/clicache/src/Properties.hpp | 81 +-
src/clicache/src/Query.cpp | 103 ++-
src/clicache/src/Query.hpp | 23 +-
src/clicache/src/QueryService.cpp | 97 +-
src/clicache/src/QueryService.hpp | 22 +-
src/clicache/src/Region.cpp | 874 ++++++++++++-------
src/clicache/src/Region.hpp | 38 +-
src/clicache/src/RegionAttributes.cpp | 433 +++++++--
src/clicache/src/RegionAttributes.hpp | 31 +-
src/clicache/src/RegionEntry.cpp | 60 +-
src/clicache/src/RegionEntry.hpp | 21 +-
src/clicache/src/RegionEvent.cpp | 28 +-
src/clicache/src/RegionEvent.hpp | 30 +-
src/clicache/src/RegionFactory.cpp | 289 ++++--
src/clicache/src/RegionFactory.hpp | 29 +-
src/clicache/src/ResultCollector.cpp | 61 +-
src/clicache/src/ResultCollector.hpp | 44 +-
src/clicache/src/ResultSet.cpp | 55 +-
src/clicache/src/ResultSet.hpp | 21 +-
src/clicache/src/SelectResultsIterator.cpp | 60 +-
src/clicache/src/SelectResultsIterator.hpp | 22 +-
src/clicache/src/Serializable.cpp | 637 +++++++-------
src/clicache/src/Serializable.hpp | 181 ++--
src/clicache/src/StatisticDescriptor.cpp | 18 +-
src/clicache/src/StatisticDescriptor.hpp | 21 +-
src/clicache/src/Statistics.cpp | 76 +-
src/clicache/src/Statistics.hpp | 21 +-
src/clicache/src/StatisticsFactory.cpp | 42 +-
src/clicache/src/StatisticsFactory.hpp | 16 +-
src/clicache/src/StatisticsType.cpp | 16 +-
src/clicache/src/StatisticsType.hpp | 27 +-
src/clicache/src/Struct.cpp | 94 +-
src/clicache/src/Struct.hpp | 9 +-
src/clicache/src/StructSet.cpp | 67 +-
src/clicache/src/StructSet.hpp | 21 +-
src/clicache/src/SystemProperties.cpp | 100 +--
src/clicache/src/SystemProperties.hpp | 39 +-
src/clicache/src/TransactionEvent.cpp | 6 +-
src/clicache/src/TransactionEvent.hpp | 2 +-
src/clicache/src/TransactionId.hpp | 26 +-
.../src/UserFunctionExecutionException.cpp | 80 +-
.../src/UserFunctionExecutionException.hpp | 18 +-
src/clicache/src/Utils.cpp | 3 +-
src/clicache/src/begin_native.hpp | 22 +
src/clicache/src/end_native.hpp | 6 +
src/clicache/src/geode_defs.hpp | 3 -
src/clicache/src/impl/AppDomainContext.hpp | 2 +
src/clicache/src/impl/AssemblyInfo.cpp.in | 1 +
src/clicache/src/impl/AuthenticatedCache.cpp | 67 +-
src/clicache/src/impl/AuthenticatedCache.hpp | 33 +-
src/clicache/src/impl/CacheListener.hpp | 26 +-
src/clicache/src/impl/CacheLoader.hpp | 4 +-
src/clicache/src/impl/CacheWriter.hpp | 13 +-
src/clicache/src/impl/CqListenerProxy.hpp | 4 +-
src/clicache/src/impl/CqStatusListenerProxy.hpp | 4 +-
src/clicache/src/impl/ManagedAuthInitialize.cpp | 5 +-
src/clicache/src/impl/ManagedAuthInitialize.hpp | 3 +
src/clicache/src/impl/ManagedCacheListener.cpp | 4 +-
src/clicache/src/impl/ManagedCacheListener.hpp | 3 +
src/clicache/src/impl/ManagedCacheLoader.cpp | 15 +-
src/clicache/src/impl/ManagedCacheLoader.hpp | 3 +
src/clicache/src/impl/ManagedCacheWriter.cpp | 2 +-
src/clicache/src/impl/ManagedCacheWriter.hpp | 3 +
src/clicache/src/impl/ManagedCacheableDelta.cpp | 8 +-
src/clicache/src/impl/ManagedCacheableDelta.hpp | 3 +
.../src/impl/ManagedCacheableDeltaBytes.cpp | 14 +-
.../src/impl/ManagedCacheableDeltaBytes.hpp | 9 +-
src/clicache/src/impl/ManagedCacheableKey.cpp | 8 +-
src/clicache/src/impl/ManagedCacheableKey.hpp | 3 +
.../src/impl/ManagedCacheableKeyBytes.cpp | 10 +-
.../src/impl/ManagedCacheableKeyBytes.hpp | 5 +-
src/clicache/src/impl/ManagedCqListener.hpp | 3 +
.../src/impl/ManagedCqStatusListener.hpp | 3 +
.../src/impl/ManagedFixedPartitionResolver.hpp | 3 +
.../src/impl/ManagedPartitionResolver.hpp | 3 +
.../src/impl/ManagedPersistenceManager.hpp | 3 +
.../src/impl/ManagedResultCollector.cpp | 2 -
.../src/impl/ManagedResultCollector.hpp | 3 +
src/clicache/src/impl/ManagedVisitor.cpp | 4 +-
src/clicache/src/impl/ManagedVisitor.hpp | 3 +
src/clicache/src/impl/MemoryPressureHandler.cpp | 7 +-
src/clicache/src/impl/MemoryPressureHandler.hpp | 2 +
src/clicache/src/impl/NativeWrapper.hpp | 528 -----------
src/clicache/src/impl/PdxFieldType.cpp | 3 +
src/clicache/src/impl/PdxHelper.cpp | 10 +-
src/clicache/src/impl/PdxHelper.hpp | 3 +
src/clicache/src/impl/PdxInstanceImpl.cpp | 11 +-
.../src/impl/PdxManagedCacheableKey.cpp | 8 +-
.../src/impl/PdxManagedCacheableKey.hpp | 11 +-
.../src/impl/PdxManagedCacheableKeyBytes.cpp | 14 +-
.../src/impl/PdxManagedCacheableKeyBytes.hpp | 8 +-
.../src/impl/PdxReaderWithTypeCollector.cpp | 3 +
.../src/impl/PdxWriterWithTypeCollector.cpp | 3 +
.../src/impl/PersistenceManagerProxy.hpp | 4 +-
src/clicache/src/impl/RegionImpl.hpp | 5 +-
src/clicache/src/impl/SafeConvert.hpp | 288 +++---
.../src/native_conditional_unique_ptr.hpp | 42 +
src/clicache/src/native_shared_ptr.hpp | 39 +
src/clicache/src/native_unique_ptr.hpp | 35 +
src/clicache/test/AssemblyInfo.cpp.in | 32 +
src/clicache/test/CMakeLists.txt | 72 ++
src/clicache/test/Utils.hpp | 14 +
.../test/native_conditional_unqiue_ptrTests.cpp | 229 +++++
src/clicache/test/native_shared_ptrTests.cpp | 189 ++++
src/clicache/test/native_unique_ptrTests.cpp | 178 ++++
src/cppcache/include/geode/CacheFactory.hpp | 1 -
src/cppcache/include/geode/RegionEntry.hpp | 8 +-
src/cppcache/include/geode/TransactionId.hpp | 10 +-
src/cppcache/include/geode/geode_base.hpp | 10 +-
src/cppcache/src/CacheFactory.cpp | 5 +-
src/cppcache/src/CacheImpl.cpp | 2 +
src/cppcache/src/PdxTypeRegistry.cpp | 2 +
src/cppcache/src/PooledBase.cpp | 55 --
src/cppcache/src/PooledBase.hpp | 64 --
src/cppcache/src/PooledBasePool.hpp | 85 --
src/cppcache/src/RegionEntry.cpp | 18 +-
src/cppcache/src/RegionInternal.cpp | 2 +-
src/tests/cli/PkcsWrapper/PkcsAuthInitMN.cpp | 21 +-
src/tests/cli/PkcsWrapper/PkcsAuthInitMN.hpp | 15 +-
src/tests/cli/QueryHelper/QueryStringsM.cpp | 33 +-
src/tests/cli/QueryHelper/QueryStringsM.hpp | 12 +-
199 files changed, 7161 insertions(+), 4919 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/clicache/CMakeLists.txt b/src/clicache/CMakeLists.txt
index 1424afa..9ea4f82 100644
--- a/src/clicache/CMakeLists.txt
+++ b/src/clicache/CMakeLists.txt
@@ -16,4 +16,5 @@ cmake_minimum_required(VERSION 3.4)
project(clicache_src)
add_subdirectory(src)
+add_subdirectory(test)
add_subdirectory(integration-test)
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/integration-test/SystemPropertiesTestsN.cs
----------------------------------------------------------------------
diff --git a/src/clicache/integration-test/SystemPropertiesTestsN.cs b/src/clicache/integration-test/SystemPropertiesTestsN.cs
deleted file mode 100644
index c903be9..0000000
--- a/src/clicache/integration-test/SystemPropertiesTestsN.cs
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-using System;
-using System.IO;
-
-namespace Apache.Geode.Client.UnitTests
-{
- using NUnit.Framework;
- using Apache.Geode.DUnitFramework;
- using Apache.Geode.Client;
-
- [TestFixture]
- [Category("group3")]
- [Category("unicast_only")]
- [Category("generics")]
-
- public class SystemPropertiesTests : UnitTests
- {
- protected override ClientBase[] GetClients()
- {
- return null;
- }
-
- [Test]
- public void Default()
- {
- SystemProperties sp = new SystemProperties(null, '.' +
- Path.DirectorySeparatorChar + "non-existent");
- Assert.AreEqual(1, sp.StatisticsSampleInterval);
- Assert.IsTrue(sp.StatisticsEnabled);
- Assert.AreEqual("statArchive.gfs", sp.StatisticsArchiveFile);
- Assert.AreEqual(LogLevel.Config, sp.GFLogLevel);
- Util.Log("Default: ReadTimeoutUnitInMillis = {0} ", sp.ReadTimeoutUnitInMillis);
- Assert.AreEqual(false, sp.ReadTimeoutUnitInMillis);
- }
-
- [Test]
- public void Config()
- {
- // create a file for alternate properties...
- //StreamWriter sw = new StreamWriter("test.properties");
- //sw.WriteLine("gf.transport.config=./gfconfig");
- //sw.WriteLine("statistics.sample.interval=2000");
- //sw.WriteLine("statistics.enabled=false");
- //sw.WriteLine("statistics.archive.file=./stats.gfs");
- //sw.WriteLine("log.level=error");
- //sw.Close();
-
- SystemProperties sp = new SystemProperties(null, "test.properties");
- Assert.AreEqual(1, sp.StatisticsSampleInterval);
- Assert.IsTrue(sp.StatisticsEnabled);
- Assert.AreEqual("statArchive.gfs", sp.StatisticsArchiveFile);
- Assert.AreEqual(LogLevel.Config, sp.GFLogLevel);
- Assert.AreEqual(LogLevel.Config, sp.GFLogLevel);
- Assert.IsFalse(sp.OnClientDisconnectClearPdxTypeIds);
- }
-
- [Test]
- public void NewConfig()
- {
- // When the tests are run from the build script the environment variable
- // TESTSRC is set.
- string filePath = CacheHelper.TestDir + Path.DirectorySeparatorChar + "system.properties";
-
- SystemProperties sp = new SystemProperties(null, filePath);
-
- Assert.AreEqual(700, sp.StatisticsSampleInterval);
- Assert.IsFalse(sp.StatisticsEnabled);
- Assert.AreEqual("stats.gfs", sp.StatisticsArchiveFile);
- Assert.AreEqual("gfcpp.log", sp.LogFileName);
- Assert.AreEqual(LogLevel.Debug, sp.GFLogLevel);
- Assert.AreEqual("system", sp.Name);
- Assert.AreEqual("cache.xml", sp.CacheXmlFile);
- Assert.AreEqual(1024000000, sp.LogFileSizeLimit);
- Assert.AreEqual(1024000000, sp.StatsFileSizeLimit);
- Assert.AreEqual(123, sp.PingInterval);
- Assert.AreEqual(345, sp.ConnectTimeout);
- Assert.AreEqual(456, sp.RedundancyMonitorInterval);
- Assert.AreEqual(123, sp.HeapLRULimit);
- Assert.AreEqual(45, sp.HeapLRUDelta);
- Assert.AreEqual(1234, sp.NotifyAckInterval);
- Assert.AreEqual(5678, sp.NotifyDupCheckLife);
- Util.Log("NewConfig: ReadTimeoutUnitInMillis = {0} ", sp.ReadTimeoutUnitInMillis);
- Assert.IsTrue(sp.ReadTimeoutUnitInMillis);
- Assert.IsTrue(sp.OnClientDisconnectClearPdxTypeIds);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/integration-test/UnitTests.csproj.in
----------------------------------------------------------------------
diff --git a/src/clicache/integration-test/UnitTests.csproj.in b/src/clicache/integration-test/UnitTests.csproj.in
index 328c1ab..b505388 100644
--- a/src/clicache/integration-test/UnitTests.csproj.in
+++ b/src/clicache/integration-test/UnitTests.csproj.in
@@ -197,7 +197,6 @@
<Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ExpirationTestsN.cs" />
<Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\OverflowTestsN.cs" />
<Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\SerializationTestsN.cs" />
- <Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\SystemPropertiesTestsN.cs" />
<Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientConflationTestsN.cs" />
<Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientCqIRTestsN.cs" />
<Compile Include="$(CMAKE_CURRENT_SOURCE_DIR)\ThinClientCqTestsN.cs" />
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/AttributesFactory.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/AttributesFactory.cpp b/src/clicache/src/AttributesFactory.cpp
index 67c4d97..90a34b6 100644
--- a/src/clicache/src/AttributesFactory.cpp
+++ b/src/clicache/src/AttributesFactory.cpp
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-//#include "geode_includes.hpp"
#include "AttributesFactory.hpp"
#include "Region.hpp"
#include "impl/ManagedCacheLoader.hpp"
@@ -38,8 +37,7 @@
#include "impl/SafeConvert.hpp"
#include "ExceptionTypes.hpp"
-using namespace System;
-using namespace System::Collections::Generic;
+#include <memory>
namespace Apache
{
@@ -47,14 +45,16 @@ namespace Apache
{
namespace Client
{
+ using namespace System;
+ using namespace System::Collections::Generic;
+
+ namespace native = apache::geode::client;
generic<class TKey, class TValue>
AttributesFactory<TKey, TValue>::AttributesFactory( Apache::Geode::Client::RegionAttributes<TKey, TValue>^ regionAttributes )
- : UMWrap( )
{
- apache::geode::client::RegionAttributesPtr attribptr(
- GetNativePtrFromSBWrapGeneric<apache::geode::client::RegionAttributes>( regionAttributes ) );
- SetPtr( new apache::geode::client::AttributesFactory( attribptr ), true );
+ auto attribptr = regionAttributes->GetNative();
+ m_nativeptr = gcnew native_unique_ptr<native::AttributesFactory>(std::make_unique<native::AttributesFactory>(attribptr));
}
// CALLBACKS
@@ -62,64 +62,91 @@ namespace Apache
generic<class TKey, class TValue>
void AttributesFactory<TKey, TValue>::SetCacheLoader( ICacheLoader<TKey, TValue>^ cacheLoader )
{
- apache::geode::client::CacheLoaderPtr loaderptr;
+ native::CacheLoaderPtr loaderptr;
if ( cacheLoader != nullptr ) {
CacheLoaderGeneric<TKey, TValue>^ clg = gcnew CacheLoaderGeneric<TKey, TValue>();
clg->SetCacheLoader(cacheLoader);
- loaderptr = new apache::geode::client::ManagedCacheLoaderGeneric( /*clg,*/ cacheLoader );
- ((apache::geode::client::ManagedCacheLoaderGeneric*)loaderptr.get())->setptr(clg);
+ loaderptr = std::shared_ptr<native::ManagedCacheLoaderGeneric>(new native::ManagedCacheLoaderGeneric(cacheLoader));
+ ((native::ManagedCacheLoaderGeneric*)loaderptr.get())->setptr(clg);
+ }
+ try
+ {
+ m_nativeptr->get()->setCacheLoader( loaderptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
}
- NativePtr->setCacheLoader( loaderptr );
}
generic<class TKey, class TValue>
void AttributesFactory<TKey, TValue>::SetCacheWriter( ICacheWriter<TKey, TValue>^ cacheWriter )
{
- apache::geode::client::CacheWriterPtr writerptr;
+ native::CacheWriterPtr writerptr;
if ( cacheWriter != nullptr ) {
CacheWriterGeneric<TKey, TValue>^ cwg = gcnew CacheWriterGeneric<TKey, TValue>();
cwg->SetCacheWriter(cacheWriter);
- writerptr = new apache::geode::client::ManagedCacheWriterGeneric( /*cwg,*/ cacheWriter );
- ((apache::geode::client::ManagedCacheWriterGeneric*)writerptr.get())->setptr(cwg);
+ writerptr = std::shared_ptr<native::ManagedCacheWriterGeneric>(new native::ManagedCacheWriterGeneric(cacheWriter));
+ ((native::ManagedCacheWriterGeneric*)writerptr.get())->setptr(cwg);
+ }
+ try
+ {
+ m_nativeptr->get()->setCacheWriter( writerptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
}
- NativePtr->setCacheWriter( writerptr );
}
generic<class TKey, class TValue>
void AttributesFactory<TKey, TValue>::SetCacheListener( ICacheListener<TKey, TValue>^ cacheListener )
{
- apache::geode::client::CacheListenerPtr listenerptr;
+ native::CacheListenerPtr listenerptr;
if ( cacheListener != nullptr ) {
CacheListenerGeneric<TKey, TValue>^ clg = gcnew CacheListenerGeneric<TKey, TValue>();
clg->SetCacheListener(cacheListener);
- //listenerptr = new apache::geode::client::ManagedCacheListenerGeneric( (ICacheListener<Object^, Object^>^)cacheListener );
- listenerptr = new apache::geode::client::ManagedCacheListenerGeneric( /*clg,*/ cacheListener );
- ((apache::geode::client::ManagedCacheListenerGeneric*)listenerptr.get())->setptr(clg);
+ listenerptr = std::shared_ptr<native::ManagedCacheListenerGeneric>(new native::ManagedCacheListenerGeneric(cacheListener));
+ ((native::ManagedCacheListenerGeneric*)listenerptr.get())->setptr(clg);
+ }
+ try
+ {
+ m_nativeptr->get()->setCacheListener( listenerptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
}
- NativePtr->setCacheListener( listenerptr );
}
generic<class TKey, class TValue>
void AttributesFactory<TKey, TValue>::SetPartitionResolver( IPartitionResolver<TKey, TValue>^ partitionresolver )
{
- apache::geode::client::PartitionResolverPtr resolverptr;
+ native::PartitionResolverPtr resolverptr;
if ( partitionresolver != nullptr ) {
Client::IFixedPartitionResolver<TKey, TValue>^ resolver =
dynamic_cast<Client::IFixedPartitionResolver<TKey, TValue>^>(partitionresolver);
if (resolver != nullptr) {
FixedPartitionResolverGeneric<TKey, TValue>^ prg = gcnew FixedPartitionResolverGeneric<TKey, TValue>();
prg->SetPartitionResolver(partitionresolver);
- resolverptr = new apache::geode::client::ManagedFixedPartitionResolverGeneric( partitionresolver );
- ((apache::geode::client::ManagedFixedPartitionResolverGeneric*)resolverptr.get())->setptr(prg);
+ resolverptr = std::shared_ptr<native::ManagedFixedPartitionResolverGeneric>(new native::ManagedFixedPartitionResolverGeneric(partitionresolver));
+ ((native::ManagedFixedPartitionResolverGeneric*)resolverptr.get())->setptr(prg);
}
else {
PartitionResolverGeneric<TKey, TValue>^ prg = gcnew PartitionResolverGeneric<TKey, TValue>();
prg->SetPartitionResolver(partitionresolver);
- resolverptr = new apache::geode::client::ManagedPartitionResolverGeneric( partitionresolver );
- ((apache::geode::client::ManagedPartitionResolverGeneric*)resolverptr.get())->setptr(prg);
+ resolverptr = std::shared_ptr<native::ManagedPartitionResolverGeneric>(new native::ManagedPartitionResolverGeneric(partitionresolver));
+ ((native::ManagedPartitionResolverGeneric*)resolverptr.get())->setptr(prg);
}
}
- NativePtr->setPartitionResolver( resolverptr );
+ try
+ {
+ m_nativeptr->get()->setPartitionResolver( resolverptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TValue>
@@ -129,8 +156,14 @@ namespace Apache
ManagedString mg_libpath( libPath );
ManagedString mg_factoryFunctionName( factoryFunctionName );
- NativePtr->setCacheLoader( mg_libpath.CharPtr,
- mg_factoryFunctionName.CharPtr );
+ try
+ {
+ m_nativeptr->get()->setCacheLoader( mg_libpath.CharPtr, mg_factoryFunctionName.CharPtr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TValue>
@@ -140,8 +173,14 @@ namespace Apache
ManagedString mg_libpath( libPath );
ManagedString mg_factoryFunctionName( factoryFunctionName );
- NativePtr->setCacheWriter( mg_libpath.CharPtr,
- mg_factoryFunctionName.CharPtr );
+ try
+ {
+ m_nativeptr->get()->setCacheWriter( mg_libpath.CharPtr, mg_factoryFunctionName.CharPtr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TValue>
@@ -151,8 +190,14 @@ namespace Apache
ManagedString mg_libpath( libPath );
ManagedString mg_factoryFunctionName( factoryFunctionName );
- NativePtr->setCacheListener( mg_libpath.CharPtr,
- mg_factoryFunctionName.CharPtr );
+ try
+ {
+ m_nativeptr->get()->setCacheListener( mg_libpath.CharPtr, mg_factoryFunctionName.CharPtr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TValue>
@@ -162,8 +207,14 @@ namespace Apache
ManagedString mg_libpath( libPath );
ManagedString mg_factoryFunctionName( factoryFunctionName );
- NativePtr->setPartitionResolver( mg_libpath.CharPtr,
- mg_factoryFunctionName.CharPtr );
+ try
+ {
+ m_nativeptr->get()->setPartitionResolver( mg_libpath.CharPtr, mg_factoryFunctionName.CharPtr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
// EXPIRATION ATTRIBUTES
@@ -171,44 +222,74 @@ namespace Apache
generic<class TKey, class TValue>
void AttributesFactory<TKey, TValue>::SetEntryIdleTimeout( ExpirationAction action, System::UInt32 idleTimeout )
{
- NativePtr->setEntryIdleTimeout(
- static_cast<apache::geode::client::ExpirationAction::Action>( action ), idleTimeout );
+ try
+ {
+ m_nativeptr->get()->setEntryIdleTimeout(static_cast<native::ExpirationAction::Action>( action ), idleTimeout );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TValue>
void AttributesFactory<TKey, TValue>::SetEntryTimeToLive( ExpirationAction action, System::UInt32 timeToLive )
{
- NativePtr->setEntryTimeToLive(
- static_cast<apache::geode::client::ExpirationAction::Action>( action ), timeToLive );
+ try
+ {
+ m_nativeptr->get()->setEntryTimeToLive( static_cast<native::ExpirationAction::Action>( action ), timeToLive );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TValue>
void AttributesFactory<TKey, TValue>::SetRegionIdleTimeout( ExpirationAction action, System::UInt32 idleTimeout )
{
- NativePtr->setRegionIdleTimeout(
- static_cast<apache::geode::client::ExpirationAction::Action>( action ), idleTimeout );
+ try
+ {
+ m_nativeptr->get()->setRegionIdleTimeout( static_cast<native::ExpirationAction::Action>( action ), idleTimeout );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TValue>
void AttributesFactory<TKey, TValue>::SetRegionTimeToLive( ExpirationAction action, System::UInt32 timeToLive )
{
- NativePtr->setRegionTimeToLive(
- static_cast<apache::geode::client::ExpirationAction::Action>( action ), timeToLive );
+ try
+ {
+ m_nativeptr->get()->setRegionTimeToLive( static_cast<native::ExpirationAction::Action>( action ), timeToLive );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
// PERSISTENCE
generic<class TKey, class TValue>
void AttributesFactory<TKey, TValue>::SetPersistenceManager(IPersistenceManager<TKey, TValue>^ persistenceManager, Properties<String^, String^>^ config )
{
- apache::geode::client::PersistenceManagerPtr persistenceManagerptr;
+ native::PersistenceManagerPtr persistenceManagerptr;
if ( persistenceManager != nullptr ) {
PersistenceManagerGeneric<TKey, TValue>^ clg = gcnew PersistenceManagerGeneric<TKey, TValue>();
clg->SetPersistenceManager(persistenceManager);
- persistenceManagerptr = new apache::geode::client::ManagedPersistenceManagerGeneric( /*clg,*/ persistenceManager );
- ((apache::geode::client::ManagedPersistenceManagerGeneric*)persistenceManagerptr.get())->setptr(clg);
+ persistenceManagerptr = std::shared_ptr<native::ManagedPersistenceManagerGeneric>(new native::ManagedPersistenceManagerGeneric(persistenceManager));
+ ((native::ManagedPersistenceManagerGeneric*)persistenceManagerptr.get())->setptr(clg);
}
- apache::geode::client::PropertiesPtr configptr(GetNativePtr<apache::geode::client::Properties>( config ) );
- NativePtr->setPersistenceManager( persistenceManagerptr, configptr );
+ try
+ {
+ m_nativeptr->get()->setPersistenceManager( persistenceManagerptr, config->GetNative() );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TValue>
@@ -230,13 +311,15 @@ namespace Apache
{
ManagedString mg_libpath( libPath );
ManagedString mg_factoryFunctionName( factoryFunctionName );
- // TODO:
- //TODO::split
- apache::geode::client::PropertiesPtr configptr(
- GetNativePtr<apache::geode::client::Properties>( config ) );
- NativePtr->setPersistenceManager( mg_libpath.CharPtr,
- mg_factoryFunctionName.CharPtr, configptr );
+ try
+ {
+ m_nativeptr->get()->setPersistenceManager(mg_libpath.CharPtr, mg_factoryFunctionName.CharPtr, config->GetNative());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
@@ -247,7 +330,14 @@ namespace Apache
{
ManagedString mg_poolName( poolName );
- NativePtr->setPoolName( mg_poolName.CharPtr );
+ try
+ {
+ m_nativeptr->get()->setPoolName( mg_poolName.CharPtr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
// MAP ATTRIBUTES
@@ -257,7 +347,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->setInitialCapacity( initialCapacity );
+ try
+ {
+ m_nativeptr->get()->setInitialCapacity( initialCapacity );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -267,7 +364,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->setLoadFactor( loadFactor );
+ try
+ {
+ m_nativeptr->get()->setLoadFactor( loadFactor );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -277,7 +381,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->setConcurrencyLevel( concurrencyLevel );
+ try
+ {
+ m_nativeptr->get()->setConcurrencyLevel( concurrencyLevel );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -285,32 +396,66 @@ namespace Apache
generic<class TKey, class TValue>
void AttributesFactory<TKey, TValue>::SetLruEntriesLimit( System::UInt32 entriesLimit )
{
- NativePtr->setLruEntriesLimit( entriesLimit );
+ try
+ {
+ m_nativeptr->get()->setLruEntriesLimit( entriesLimit );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TValue>
void AttributesFactory<TKey, TValue>::SetDiskPolicy( DiskPolicyType diskPolicy )
{
- NativePtr->setDiskPolicy(
- static_cast<apache::geode::client::DiskPolicyType::PolicyType>( diskPolicy ) );
+ try
+ {
+ m_nativeptr->get()->setDiskPolicy(static_cast<native::DiskPolicyType::PolicyType>( diskPolicy ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TValue>
void AttributesFactory<TKey, TValue>::SetCachingEnabled( bool cachingEnabled )
{
- NativePtr->setCachingEnabled( cachingEnabled );
+ try
+ {
+ m_nativeptr->get()->setCachingEnabled( cachingEnabled );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TValue>
void AttributesFactory<TKey, TValue>::SetCloningEnabled( bool cloningEnabled )
{
- NativePtr->setCloningEnabled( cloningEnabled );
+ try
+ {
+ m_nativeptr->get()->setCloningEnabled( cloningEnabled );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TValue>
void AttributesFactory<TKey, TValue>::SetConcurrencyChecksEnabled( bool concurrencyChecksEnabled )
{
- NativePtr->setConcurrencyChecksEnabled( concurrencyChecksEnabled );
+ try
+ {
+ m_nativeptr->get()->setConcurrencyChecksEnabled( concurrencyChecksEnabled );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
// FACTORY METHOD
@@ -319,9 +464,15 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::RegionAttributesPtr& nativeptr(
- NativePtr->createRegionAttributes());
- return Apache::Geode::Client::RegionAttributes<TKey, TValue>::Create(nativeptr.get());
+ try
+ {
+ native::RegionAttributesPtr nativeptr = m_nativeptr->get()->createRegionAttributes();
+ return Apache::Geode::Client::RegionAttributes<TKey, TValue>::Create(nativeptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/AttributesFactory.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/AttributesFactory.hpp b/src/clicache/src/AttributesFactory.hpp
index 870ceae..608c372 100644
--- a/src/clicache/src/AttributesFactory.hpp
+++ b/src/clicache/src/AttributesFactory.hpp
@@ -18,8 +18,10 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/AttributesFactory.hpp>
-//#include "impl/NativeWrapper.hpp"
+#include "end_native.hpp"
+
#include "ExpirationAction.hpp"
#include "DiskPolicyType.hpp"
@@ -31,6 +33,7 @@
#include "IPersistenceManager.hpp"
#include "RegionAttributes.hpp"
#include "RegionAttributes.hpp"
+#include "native_unique_ptr.hpp"
using namespace System;
@@ -42,14 +45,7 @@ namespace Apache
{
namespace Client
{
-
- //ref class RegionAttributes;
- //interface class ICacheLoader;
- //interface class ICacheWriter;
- //interface class ICacheListener;
- //interface class IPartitionResolver;
- //interface class IFixedPartitionResolver;
-
+ namespace native = apache::geode::client;
/// <summary>
/// Factory class to create instances of <see cref="RegionAttributes" />.
@@ -156,7 +152,6 @@ namespace Apache
/// <seealso cref="Region.CreateSubRegion" />
generic<class TKey, class TValue>
public ref class AttributesFactory sealed
- : public Internal::UMWrap<apache::geode::client::AttributesFactory>
{
public:
@@ -165,7 +160,9 @@ namespace Apache
/// a <c>RegionAttributes</c> with default settings.
/// </summary>
inline AttributesFactory<TKey, TValue>( )
- : UMWrap( new apache::geode::client::AttributesFactory( ), true ) { }
+ {
+ m_nativeptr = gcnew native_unique_ptr<native::AttributesFactory>(std::make_unique<native::AttributesFactory>());
+ }
/// <summary>
/// Creates a new instance of <c>AttributesFactory</c> ready to create
@@ -506,6 +503,9 @@ namespace Apache
/// compatibility rules.
/// </exception>
RegionAttributes<TKey, TValue>^ CreateRegionAttributes( );
+
+ private:
+ native_unique_ptr<native::AttributesFactory>^ m_nativeptr;
};
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/AttributesMutator.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/AttributesMutator.cpp b/src/clicache/src/AttributesMutator.cpp
index 081dccb..9702ae3 100644
--- a/src/clicache/src/AttributesMutator.cpp
+++ b/src/clicache/src/AttributesMutator.cpp
@@ -15,9 +15,8 @@
* limitations under the License.
*/
-//#include "geode_includes.hpp"
#include "AttributesMutator.hpp"
-//#include "Region.hpp"
+
#include "impl/ManagedCacheListener.hpp"
#include "impl/ManagedCacheLoader.hpp"
#include "impl/ManagedCacheWriter.hpp"
@@ -33,85 +32,156 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
generic<class TKey, class TValue>
System::Int32 AttributesMutator<TKey, TValue>::SetEntryIdleTimeout( System::Int32 idleTimeout )
{
- return NativePtr->setEntryIdleTimeout( idleTimeout );
+ try
+ {
+ return m_nativeptr->get()->setEntryIdleTimeout( idleTimeout );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TValue>
ExpirationAction AttributesMutator<TKey, TValue>::SetEntryIdleTimeoutAction(
ExpirationAction action )
{
- return static_cast<ExpirationAction>(
- NativePtr->setEntryIdleTimeoutAction(
- static_cast<apache::geode::client::ExpirationAction::Action>( action ) ) );
+ try
+ {
+ return static_cast<ExpirationAction>(
+ m_nativeptr->get()->setEntryIdleTimeoutAction(
+ static_cast<native::ExpirationAction::Action>(action)));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TValue>
System::Int32 AttributesMutator<TKey, TValue>::SetEntryTimeToLive( System::Int32 timeToLive )
{
- return NativePtr->setEntryTimeToLive( timeToLive );
+ try
+ {
+ return m_nativeptr->get()->setEntryTimeToLive( timeToLive );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TValue>
ExpirationAction AttributesMutator<TKey, TValue>::SetEntryTimeToLiveAction(
ExpirationAction action )
{
- return static_cast<ExpirationAction>(
- NativePtr->setEntryTimeToLiveAction(
- static_cast<apache::geode::client::ExpirationAction::Action>( action ) ) );
- }
+ try
+ {
+ return static_cast<ExpirationAction>(
+ m_nativeptr->get()->setEntryTimeToLiveAction(
+ static_cast<native::ExpirationAction::Action>(action)));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
generic<class TKey, class TValue>
System::Int32 AttributesMutator<TKey, TValue>::SetRegionIdleTimeout( System::Int32 idleTimeout )
{
- return NativePtr->setRegionIdleTimeout( idleTimeout );
+ try
+ {
+ return m_nativeptr->get()->setRegionIdleTimeout( idleTimeout );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TValue>
ExpirationAction AttributesMutator<TKey, TValue>::SetRegionIdleTimeoutAction(
ExpirationAction action )
{
- return static_cast<ExpirationAction>(
- NativePtr->setRegionIdleTimeoutAction(
- static_cast<apache::geode::client::ExpirationAction::Action>( action ) ) );
+ try
+ {
+ return static_cast<ExpirationAction>(
+ m_nativeptr->get()->setRegionIdleTimeoutAction(
+ static_cast<native::ExpirationAction::Action>(action)));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TValue>
System::Int32 AttributesMutator<TKey, TValue>::SetRegionTimeToLive( System::Int32 timeToLive )
{
- return NativePtr->setRegionTimeToLive( timeToLive );
+ try
+ {
+ return m_nativeptr->get()->setRegionTimeToLive( timeToLive );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TValue>
ExpirationAction AttributesMutator<TKey, TValue>::SetRegionTimeToLiveAction(
ExpirationAction action )
{
- return static_cast<ExpirationAction>(
- NativePtr->setRegionTimeToLiveAction(
- static_cast<apache::geode::client::ExpirationAction::Action>( action ) ) );
+ try
+ {
+ return static_cast<ExpirationAction>(
+ m_nativeptr->get()->setRegionTimeToLiveAction(
+ static_cast<native::ExpirationAction::Action>(action)));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TValue>
System::UInt32 AttributesMutator<TKey, TValue>::SetLruEntriesLimit( System::UInt32 entriesLimit )
{
- return NativePtr->setLruEntriesLimit( entriesLimit );
+ try
+ {
+ return m_nativeptr->get()->setLruEntriesLimit( entriesLimit );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TValue>
void AttributesMutator<TKey, TValue>::SetCacheListener( ICacheListener<TKey, TValue>^ cacheListener )
{
- apache::geode::client::CacheListenerPtr listenerptr;
+ native::CacheListenerPtr listenerptr;
if (cacheListener != nullptr)
{
- CacheListenerGeneric<TKey, TValue>^ clg = gcnew CacheListenerGeneric<TKey, TValue>();
+ auto clg = gcnew CacheListenerGeneric<TKey, TValue>();
clg->SetCacheListener(cacheListener);
- listenerptr = new apache::geode::client::ManagedCacheListenerGeneric( /*clg,*/ cacheListener );
- ((apache::geode::client::ManagedCacheListenerGeneric*)listenerptr.get())->setptr(clg);
+ listenerptr = std::shared_ptr<native::ManagedCacheListenerGeneric>( new native::ManagedCacheListenerGeneric(cacheListener) );
+ ((native::ManagedCacheListenerGeneric*)listenerptr.get())->setptr(clg);
+ }
+ try
+ {
+ m_nativeptr->get()->setCacheListener( listenerptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
}
- NativePtr->setCacheListener( listenerptr );
}
generic<class TKey, class TValue>
@@ -119,25 +189,27 @@ namespace Apache
String^ factoryFunctionName )
{
throw gcnew System::NotSupportedException;
- ManagedString mg_libpath( libPath );
- ManagedString mg_factoryFunctionName( factoryFunctionName );
-
- NativePtr->setCacheListener( mg_libpath.CharPtr,
- mg_factoryFunctionName.CharPtr );
}
generic<class TKey, class TValue>
void AttributesMutator<TKey, TValue>::SetCacheLoader( ICacheLoader<TKey, TValue>^ cacheLoader )
{
- apache::geode::client::CacheLoaderPtr loaderptr;
+ native::CacheLoaderPtr loaderptr;
if (cacheLoader != nullptr)
{
- CacheLoaderGeneric<TKey, TValue>^ clg = gcnew CacheLoaderGeneric<TKey, TValue>();
+ auto clg = gcnew CacheLoaderGeneric<TKey, TValue>();
clg->SetCacheLoader(cacheLoader);
- loaderptr = new apache::geode::client::ManagedCacheLoaderGeneric( /*clg,*/ cacheLoader );
- ((apache::geode::client::ManagedCacheLoaderGeneric*)loaderptr.get())->setptr(clg);
+ loaderptr = std::shared_ptr<native::ManagedCacheLoaderGeneric>( new native::ManagedCacheLoaderGeneric(cacheLoader) );
+ ((native::ManagedCacheLoaderGeneric*)loaderptr.get())->setptr(clg);
+ }
+ try
+ {
+ m_nativeptr->get()->setCacheLoader( loaderptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
}
- NativePtr->setCacheLoader( loaderptr );
}
generic<class TKey, class TValue>
@@ -145,25 +217,27 @@ namespace Apache
String^ factoryFunctionName )
{
throw gcnew System::NotSupportedException;
- ManagedString mg_libpath( libPath );
- ManagedString mg_factoryFunctionName( factoryFunctionName );
-
- NativePtr->setCacheLoader( mg_libpath.CharPtr,
- mg_factoryFunctionName.CharPtr );
}
generic<class TKey, class TValue>
void AttributesMutator<TKey, TValue>::SetCacheWriter( ICacheWriter<TKey, TValue>^ cacheWriter )
{
- apache::geode::client::CacheWriterPtr writerptr;
+ native::CacheWriterPtr writerptr;
if (cacheWriter != nullptr)
{
- CacheWriterGeneric<TKey, TValue>^ cwg = gcnew CacheWriterGeneric<TKey, TValue>();
+ auto cwg = gcnew CacheWriterGeneric<TKey, TValue>();
cwg->SetCacheWriter(cacheWriter);
- writerptr = new apache::geode::client::ManagedCacheWriterGeneric( /*cwg,*/ cacheWriter );
- ((apache::geode::client::ManagedCacheWriterGeneric*)writerptr.get())->setptr(cwg);
+ writerptr = std::shared_ptr<native::ManagedCacheWriterGeneric>( new native::ManagedCacheWriterGeneric(cacheWriter) );
+ ((native::ManagedCacheWriterGeneric*)writerptr.get())->setptr(cwg);
+ }
+ try
+ {
+ m_nativeptr->get()->setCacheWriter( writerptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
}
- NativePtr->setCacheWriter( writerptr );
}
generic<class TKey, class TValue>
@@ -171,11 +245,6 @@ namespace Apache
String^ factoryFunctionName )
{
throw gcnew System::NotSupportedException;
- ManagedString mg_libpath( libPath );
- ManagedString mg_factoryFunctionName( factoryFunctionName );
-
- NativePtr->setCacheWriter( mg_libpath.CharPtr,
- mg_factoryFunctionName.CharPtr );
}
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/AttributesMutator.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/AttributesMutator.hpp b/src/clicache/src/AttributesMutator.hpp
index 43ce638..db0bd62 100644
--- a/src/clicache/src/AttributesMutator.hpp
+++ b/src/clicache/src/AttributesMutator.hpp
@@ -18,8 +18,11 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/AttributesMutator.hpp>
-//#include "impl/NativeWrapper.hpp"
+#include "end_native.hpp"
+
+#include "native_shared_ptr.hpp"
#include "ExpirationAction.hpp"
#include "ICacheListener.hpp"
#include "ICacheLoader.hpp"
@@ -34,6 +37,7 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
/// <summary>
/// Supports modification of certain region attributes after the region
@@ -54,7 +58,6 @@ namespace Apache
/// <seealso cref="AttributesFactory" />
generic<class TKey, class TValue>
public ref class AttributesMutator sealed
- : public Internal::SBWrap<apache::geode::client::AttributesMutator>
{
public:
@@ -242,10 +245,10 @@ namespace Apache
/// <returns>
/// The managed wrapper object; null if the native pointer is null.
/// </returns>
- inline static AttributesMutator<TKey, TValue>^ Create( apache::geode::client::AttributesMutator* nativeptr )
+ inline static AttributesMutator<TKey, TValue>^ Create( native::AttributesMutatorPtr nativeptr )
{
- return ( nativeptr != nullptr ?
- gcnew AttributesMutator<TKey, TValue>( nativeptr ) : nullptr );
+ return __nullptr == nativeptr ? nullptr :
+ gcnew AttributesMutator<TKey, TValue>( nativeptr );
}
@@ -255,8 +258,12 @@ namespace Apache
/// Private constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline AttributesMutator<TKey, TValue>( apache::geode::client::AttributesMutator* nativeptr )
- : SBWrap( nativeptr ) { }
+ inline AttributesMutator<TKey, TValue>( native::AttributesMutatorPtr nativeptr )
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::AttributesMutator>(nativeptr);
+ }
+
+ native_shared_ptr<native::AttributesMutator>^ m_nativeptr;
};
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/Cache.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/Cache.cpp b/src/clicache/src/Cache.cpp
index 1906830..e900f76 100644
--- a/src/clicache/src/Cache.cpp
+++ b/src/clicache/src/Cache.cpp
@@ -41,33 +41,57 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
String^ Cache::Name::get( )
{
- return ManagedString::Get( NativePtr->getName( ) );
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getName( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
bool Cache::IsClosed::get( )
{
- return NativePtr->isClosed( );
+ try
+ {
+ return m_nativeptr->get()->isClosed( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
DistributedSystem^ Cache::DistributedSystem::get( )
{
- apache::geode::client::DistributedSystemPtr& nativeptr(
- NativePtr->getDistributedSystem( ) );
-
- return Apache::Geode::Client::DistributedSystem::Create(
- nativeptr.ptr( ) );
+ try
+ {
+ return Client::DistributedSystem::Create(m_nativeptr->get()->getDistributedSystem());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
CacheTransactionManager^ Cache::CacheTransactionManager::get( )
{
- apache::geode::client::InternalCacheTransactionManager2PCPtr& nativeptr = static_cast<InternalCacheTransactionManager2PCPtr>(
- NativePtr->getCacheTransactionManager( ) );
-
- return Apache::Geode::Client::CacheTransactionManager::Create(
- nativeptr.ptr( ) );
+ // TODO shared_ptr this should be checking the return type for which tx mgr
+ try
+ {
+ auto nativeptr = std::dynamic_pointer_cast<InternalCacheTransactionManager2PC>(
+ m_nativeptr->get()->getCacheTransactionManager());
+ return Apache::Geode::Client::CacheTransactionManager::Create(nativeptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
void Cache::Close( )
@@ -81,10 +105,17 @@ namespace Apache
Apache::Geode::Client::DistributedSystem::acquireDisconnectLock();
- Apache::Geode::Client::DistributedSystem::disconnectInstance();
+ Apache::Geode::Client::DistributedSystem::disconnectInstance();
CacheFactory::m_connected = false;
- NativePtr->close( keepalive );
+ try
+ {
+ m_nativeptr->get()->close( keepalive );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
// If DS automatically disconnected due to the new bootstrap API, then cleanup the C++/CLI side
//if (!apache::geode::client::DistributedSystem::isConnected())
@@ -106,7 +137,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- NativePtr->readyForEvents( );
+ try
+ {
+ m_nativeptr->get()->readyForEvents( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -117,10 +155,14 @@ namespace Apache
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
ManagedString mg_path( path );
- apache::geode::client::RegionPtr& nativeptr(
- NativePtr->getRegion( mg_path.CharPtr ) );
-
- return Client::Region<TKey,TValue>::Create( nativeptr.ptr( ) );
+ try
+ {
+ return Client::Region<TKey, TValue>::Create(m_nativeptr->get()->getRegion(mg_path.CharPtr));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -129,14 +171,21 @@ namespace Apache
array<Client::IRegion<TKey, TValue>^>^ Cache::RootRegions( )
{
apache::geode::client::VectorOfRegion vrr;
- NativePtr->rootRegions( vrr );
+ try
+ {
+ m_nativeptr->get()->rootRegions( vrr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
array<Client::IRegion<TKey, TValue>^>^ rootRegions =
gcnew array<Client::IRegion<TKey, TValue>^>( vrr.size( ) );
for( System::Int32 index = 0; index < vrr.size( ); index++ )
{
apache::geode::client::RegionPtr& nativeptr( vrr[ index ] );
- rootRegions[ index ] = Client::Region<TKey, TValue>::Create( nativeptr.ptr( ) );
+ rootRegions[ index ] = Client::Region<TKey, TValue>::Create( nativeptr );
}
return rootRegions;
}
@@ -146,7 +195,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- return Client::QueryService<TKey, TResult>::Create( NativePtr->getQueryService( ).ptr( ) );
+ try
+ {
+ return Client::QueryService<TKey, TResult>::Create(m_nativeptr->get()->getQueryService());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -157,7 +213,14 @@ namespace Apache
_GF_MG_EXCEPTION_TRY2
ManagedString mg_poolName( poolName );
- return QueryService<TKey, TResult>::Create( NativePtr->getQueryService(mg_poolName.CharPtr).ptr( ) );
+ try
+ {
+ return QueryService<TKey, TResult>::Create(m_nativeptr->get()->getQueryService(mg_poolName.CharPtr));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -187,26 +250,30 @@ namespace Apache
break;
}
- return RegionFactory::Create(NativePtr->createRegionFactory(preDefineRegionAttr).get());
+ try
+ {
+ return RegionFactory::Create(m_nativeptr->get()->createRegionFactory(preDefineRegionAttr));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2
}
IRegionService^ Cache::CreateAuthenticatedView(Properties<String^, Object^>^ credentials)
- {
- // TODO:
- //TODO::split
- apache::geode::client::Properties* prop = NULL;
-
- if (credentials != nullptr)
- prop = GetNativePtr<apache::geode::client::Properties>( credentials );
-
- apache::geode::client::PropertiesPtr credPtr(prop);
-
-
+ {
_GF_MG_EXCEPTION_TRY2
- return AuthenticatedCache::Create( (NativePtr->createAuthenticatedView(credPtr)).get());
+ try
+ {
+ return AuthenticatedCache::Create((m_nativeptr->get()->createAuthenticatedView(credentials->GetNative())));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -215,7 +282,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- return NativePtr->getPdxIgnoreUnreadFields();
+ try
+ {
+ return m_nativeptr->get()->getPdxIgnoreUnreadFields();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -224,28 +298,32 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- return NativePtr->getPdxReadSerialized();
+ try
+ {
+ return m_nativeptr->get()->getPdxReadSerialized();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2
}
IRegionService^ Cache::CreateAuthenticatedView(Properties<String^, Object^>^ credentials, String^ poolName)
{
- // TODO:
- //TODO::split
- apache::geode::client::Properties* prop = NULL;
-
- if (credentials != nullptr)
- prop = GetNativePtr<apache::geode::client::Properties>( credentials );
-
- apache::geode::client::PropertiesPtr credPtr(prop);
-
ManagedString mg_poolName( poolName );
-
-
+
_GF_MG_EXCEPTION_TRY2
- return AuthenticatedCache::Create( (NativePtr->createAuthenticatedView(credPtr, mg_poolName.CharPtr)).get());
+ try
+ {
+ return AuthenticatedCache::Create( (m_nativeptr->get()->createAuthenticatedView(credentials->GetNative(), mg_poolName.CharPtr)));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -253,14 +331,21 @@ namespace Apache
void Cache::InitializeDeclarativeCache( String^ cacheXml )
{
ManagedString mg_cacheXml( cacheXml );
- NativePtr->initializeDeclarativeCache( mg_cacheXml.CharPtr );
+ try
+ {
+ m_nativeptr->get()->initializeDeclarativeCache( mg_cacheXml.CharPtr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
- IPdxInstanceFactory^ Cache::CreatePdxInstanceFactory(String^ className)
- {
- return gcnew Internal::PdxInstanceFactoryImpl(className);
+ IPdxInstanceFactory^ Cache::CreatePdxInstanceFactory(String^ className)
+ {
+ return gcnew Internal::PdxInstanceFactoryImpl(className);
+ }
} // namespace Client
} // namespace Geode
} // namespace Apache
-}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/Cache.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/Cache.hpp b/src/clicache/src/Cache.hpp
index 67bd11c..889faaf 100644
--- a/src/clicache/src/Cache.hpp
+++ b/src/clicache/src/Cache.hpp
@@ -18,16 +18,9 @@
#pragma once
#include "geode_defs.hpp"
-//#include <geode/Cache.hpp>
-//#include "impl/NativeWrapper.hpp"
#include "RegionShortcut.hpp"
-//#include "RegionFactory.hpp"
#include "IGeodeCache.hpp"
-//#include "IRegionService.hpp"
#include "IRegion.hpp"
-//#include "QueryService.hpp"
-
-
#include "RegionAttributes.hpp"
using namespace System;
@@ -38,6 +31,7 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
generic<class TKey, class TResult>
ref class QueryService;
@@ -63,7 +57,7 @@ namespace Apache
/// </para>
/// </remarks>
public ref class Cache sealed
- : public IGeodeCache, Internal::SBWrap<apache::geode::client::Cache>
+ : public IGeodeCache
{
public:
@@ -268,12 +262,16 @@ namespace Apache
/// <returns>
/// The managed wrapper object; null if the native pointer is null.
/// </returns>
- inline static Cache^ Create(apache::geode::client::Cache* nativeptr)
+ inline static Cache^ Create(native::CachePtr nativeptr)
{
- return (nativeptr != nullptr ?
- gcnew Cache(nativeptr) : nullptr);
+ return __nullptr == nativeptr ? nullptr :
+ gcnew Cache( nativeptr );
}
+ std::shared_ptr<native::Cache> GetNative()
+ {
+ return m_nativeptr->get_shared_ptr();
+ }
private:
@@ -281,8 +279,12 @@ namespace Apache
/// Private constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline Cache(apache::geode::client::Cache* nativeptr)
- : SBWrap(nativeptr) { }
+ inline Cache(native::CachePtr nativeptr)
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::Cache>(nativeptr);
+ }
+
+ native_shared_ptr<native::Cache>^ m_nativeptr;
};
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/CacheFactory.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CacheFactory.cpp b/src/clicache/src/CacheFactory.cpp
index 8c71107..6bdda46 100644
--- a/src/clicache/src/CacheFactory.cpp
+++ b/src/clicache/src/CacheFactory.cpp
@@ -39,6 +39,8 @@ namespace Apache
namespace Client
{
+ namespace native = apache::geode::client;
+
CacheFactory^ CacheFactory::CreateCacheFactory()
{
return CacheFactory::CreateCacheFactory(Properties<String^, String^>::Create<String^, String^>());
@@ -48,16 +50,13 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- apache::geode::client::PropertiesPtr nativepropsptr(
- GetNativePtr<apache::geode::client::Properties>(dsProps));
-
- apache::geode::client::CacheFactoryPtr& nativeptr( apache::geode::client::CacheFactory::createCacheFactory( nativepropsptr) );
- if (nativeptr.get() != nullptr)
- return gcnew CacheFactory( nativeptr.get(), dsProps );
+ auto nativeCacheFactory = native::CacheFactory::createCacheFactory(dsProps->GetNative());
+ if (nativeCacheFactory)
+ return gcnew CacheFactory( nativeCacheFactory, dsProps );
return nullptr;
- _GF_MG_EXCEPTION_CATCH_ALL2
+ _GF_MG_EXCEPTION_CATCH_ALL2
}
Cache^ CacheFactory::Create()
@@ -71,28 +70,26 @@ namespace Apache
if(!m_connected)
{
- apache::geode::client::PropertiesPtr nativepropsptr(
- GetNativePtr<apache::geode::client::Properties>(m_dsProps));
- DistributedSystem::AppDomainInstanceInitialization(nativepropsptr);
+ DistributedSystem::AppDomainInstanceInitialization(m_dsProps->GetNative());
}
- apache::geode::client::CachePtr& nativeptr( NativePtr->create( ) );
- pdxIgnoreUnreadFields = nativeptr->getPdxIgnoreUnreadFields();
- pdxReadSerialized = nativeptr->getPdxReadSerialized();
+ auto nativeCache = m_nativeptr->get()->create( );
+ pdxIgnoreUnreadFields = nativeCache->getPdxIgnoreUnreadFields();
+ pdxReadSerialized = nativeCache->getPdxReadSerialized();
appDomainEnable = DistributedSystem::SystemProperties->AppDomainEnabled;
- Log::SetLogLevel(static_cast<LogLevel>(apache::geode::client::Log::logLevel( )));
+ Log::SetLogLevel(static_cast<LogLevel>(native::Log::logLevel( )));
//TODO::split
SafeConvertClassGeneric::SetAppDomainEnabled(appDomainEnable);
if (appDomainEnable)
{
// Register managed AppDomain context with unmanaged.
- apache::geode::client::createAppDomainContext = &Apache::Geode::Client::createAppDomainContext;
+ native::createAppDomainContext = &Apache::Geode::Client::createAppDomainContext;
}
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::PdxType,
+ native::GeodeTypeIds::PdxType,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::Internal::PdxType::CreateDeserializable),
nullptr);
@@ -106,9 +103,10 @@ namespace Apache
m_connected = true;
- return Cache::Create( nativeptr.ptr( ) );
+ return Cache::Create( nativeCache );
_GF_MG_EXCEPTION_CATCH_ALL2
finally {
+ GC::KeepAlive(m_nativeptr);
DistributedSystem::registerCliCallback();
Serializable::RegisterPDXManagedCacheableKey(appDomainEnable);
Apache::Geode::Client::Internal::PdxTypeRegistry::PdxIgnoreUnreadFields = pdxIgnoreUnreadFields;
@@ -121,12 +119,7 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- apache::geode::client::DistributedSystemPtr p_system(
- GetNativePtr<apache::geode::client::DistributedSystem>( system ) );
- apache::geode::client::CachePtr& nativeptr(
- apache::geode::client::CacheFactory::getInstance( p_system ) );
-
- return Cache::Create( nativeptr.ptr( ) );
+ return Cache::Create( native::CacheFactory::getInstance( system->GetNative() ) );
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -135,12 +128,7 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- apache::geode::client::DistributedSystemPtr p_system(
- GetNativePtr<apache::geode::client::DistributedSystem>( system ) );
- apache::geode::client::CachePtr& nativeptr(
- apache::geode::client::CacheFactory::getInstanceCloseOk( p_system ) );
-
- return Cache::Create( nativeptr.ptr( ) );
+ return Cache::Create( native::CacheFactory::getInstanceCloseOk( system->GetNative() ) );
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -149,22 +137,20 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- apache::geode::client::CachePtr& nativeptr(
- apache::geode::client::CacheFactory::getAnyInstance( ) );
- return Cache::Create( nativeptr.ptr( ) );
+ return Cache::Create( native::CacheFactory::getAnyInstance( ) );
_GF_MG_EXCEPTION_CATCH_ALL2
}
String^ CacheFactory::Version::get( )
{
- return ManagedString::Get( apache::geode::client::CacheFactory::getVersion( ) );
+ return ManagedString::Get( native::CacheFactory::getVersion( ) );
}
String^ CacheFactory::ProductDescription::get( )
{
return ManagedString::Get(
- apache::geode::client::CacheFactory::getProductDescription( ) );
+ native::CacheFactory::getProductDescription( ) );
}
@@ -172,7 +158,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- NativePtr->setFreeConnectionTimeout( connectionTimeout );
+ try
+ {
+ m_nativeptr->get()->setFreeConnectionTimeout( connectionTimeout );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
@@ -183,7 +176,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- NativePtr->setLoadConditioningInterval( loadConditioningInterval );
+ try
+ {
+ m_nativeptr->get()->setLoadConditioningInterval( loadConditioningInterval );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
_GF_MG_EXCEPTION_CATCH_ALL2
@@ -193,7 +193,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- NativePtr->setSocketBufferSize( bufferSize );
+ try
+ {
+ m_nativeptr->get()->setSocketBufferSize( bufferSize );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
_GF_MG_EXCEPTION_CATCH_ALL2
@@ -203,7 +210,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- NativePtr->setReadTimeout( timeout );
+ try
+ {
+ m_nativeptr->get()->setReadTimeout( timeout );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
_GF_MG_EXCEPTION_CATCH_ALL2
@@ -213,7 +227,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- NativePtr->setMinConnections( minConnections );
+ try
+ {
+ m_nativeptr->get()->setMinConnections( minConnections );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
_GF_MG_EXCEPTION_CATCH_ALL2
@@ -223,7 +244,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- NativePtr->setMaxConnections( maxConnections );
+ try
+ {
+ m_nativeptr->get()->setMaxConnections( maxConnections );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
_GF_MG_EXCEPTION_CATCH_ALL2
@@ -233,7 +261,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- NativePtr->setIdleTimeout( idleTimeout );
+ try
+ {
+ m_nativeptr->get()->setIdleTimeout( idleTimeout );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
_GF_MG_EXCEPTION_CATCH_ALL2
@@ -243,7 +278,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- NativePtr->setRetryAttempts( retryAttempts );
+ try
+ {
+ m_nativeptr->get()->setRetryAttempts( retryAttempts );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
_GF_MG_EXCEPTION_CATCH_ALL2
@@ -253,7 +295,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- NativePtr->setPingInterval( pingInterval );
+ try
+ {
+ m_nativeptr->get()->setPingInterval( pingInterval );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
_GF_MG_EXCEPTION_CATCH_ALL2
@@ -263,7 +312,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- NativePtr->setUpdateLocatorListInterval( updateLocatorListInterval );
+ try
+ {
+ m_nativeptr->get()->setUpdateLocatorListInterval( updateLocatorListInterval );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
_GF_MG_EXCEPTION_CATCH_ALL2
@@ -273,7 +329,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- NativePtr->setStatisticInterval( statisticInterval );
+ try
+ {
+ m_nativeptr->get()->setStatisticInterval( statisticInterval );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
_GF_MG_EXCEPTION_CATCH_ALL2
@@ -284,7 +347,14 @@ namespace Apache
_GF_MG_EXCEPTION_TRY2
ManagedString mg_servergroup( group );
- NativePtr->setServerGroup( mg_servergroup.CharPtr );
+ try
+ {
+ m_nativeptr->get()->setServerGroup( mg_servergroup.CharPtr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
_GF_MG_EXCEPTION_CATCH_ALL2
@@ -295,7 +365,14 @@ namespace Apache
_GF_MG_EXCEPTION_TRY2
ManagedString mg_host( host );
- NativePtr->addLocator( mg_host.CharPtr, port );
+ try
+ {
+ m_nativeptr->get()->addLocator( mg_host.CharPtr, port );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
_GF_MG_EXCEPTION_CATCH_ALL2
@@ -306,7 +383,14 @@ namespace Apache
_GF_MG_EXCEPTION_TRY2
ManagedString mg_host( host );
- NativePtr->addServer( mg_host.CharPtr, port );
+ try
+ {
+ m_nativeptr->get()->addServer( mg_host.CharPtr, port );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
_GF_MG_EXCEPTION_CATCH_ALL2
@@ -316,7 +400,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- NativePtr->setSubscriptionEnabled( enabled );
+ try
+ {
+ m_nativeptr->get()->setSubscriptionEnabled( enabled );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
_GF_MG_EXCEPTION_CATCH_ALL2
@@ -326,7 +417,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- NativePtr->setPRSingleHopEnabled(enabled);
+ try
+ {
+ m_nativeptr->get()->setPRSingleHopEnabled(enabled);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
_GF_MG_EXCEPTION_CATCH_ALL2
@@ -336,7 +434,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- NativePtr->setSubscriptionRedundancy( redundancy );
+ try
+ {
+ m_nativeptr->get()->setSubscriptionRedundancy( redundancy );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
_GF_MG_EXCEPTION_CATCH_ALL2
@@ -346,7 +451,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- NativePtr->setSubscriptionMessageTrackingTimeout( messageTrackingTimeout );
+ try
+ {
+ m_nativeptr->get()->setSubscriptionMessageTrackingTimeout( messageTrackingTimeout );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
_GF_MG_EXCEPTION_CATCH_ALL2
@@ -356,7 +468,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- NativePtr->setSubscriptionAckInterval( ackInterval );
+ try
+ {
+ m_nativeptr->get()->setSubscriptionAckInterval( ackInterval );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
_GF_MG_EXCEPTION_CATCH_ALL2
@@ -366,7 +485,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- NativePtr->setThreadLocalConnections( enabled );
+ try
+ {
+ m_nativeptr->get()->setThreadLocalConnections( enabled );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2
@@ -377,7 +503,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- NativePtr->setMultiuserAuthentication( multiuserAuthentication );
+ try
+ {
+ m_nativeptr->get()->setMultiuserAuthentication( multiuserAuthentication );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
_GF_MG_EXCEPTION_CATCH_ALL2
@@ -387,7 +520,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- NativePtr->setPdxIgnoreUnreadFields( ignore );
+ try
+ {
+ m_nativeptr->get()->setPdxIgnoreUnreadFields( ignore );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
_GF_MG_EXCEPTION_CATCH_ALL2
@@ -397,7 +537,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- NativePtr->setPdxReadSerialized( pdxReadSerialized );
+ try
+ {
+ m_nativeptr->get()->setPdxReadSerialized( pdxReadSerialized );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
_GF_MG_EXCEPTION_CATCH_ALL2
@@ -408,7 +555,14 @@ namespace Apache
_GF_MG_EXCEPTION_TRY2
ManagedString mg_name( name );
ManagedString mg_value( value );
- NativePtr->set( mg_name.CharPtr, mg_value.CharPtr );
+ try
+ {
+ m_nativeptr->get()->set( mg_name.CharPtr, mg_value.CharPtr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
return this;
_GF_MG_EXCEPTION_CATCH_ALL2
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/CacheFactory.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CacheFactory.hpp b/src/clicache/src/CacheFactory.hpp
index acaca31..5133681 100644
--- a/src/clicache/src/CacheFactory.hpp
+++ b/src/clicache/src/CacheFactory.hpp
@@ -18,11 +18,13 @@
#pragma once
#include "geode_defs.hpp"
-#include "impl/NativeWrapper.hpp"
+#include "begin_native.hpp"
#include <geode/CacheFactory.hpp>
+#include "end_native.hpp"
+
+#include "native_shared_ptr.hpp"
#include "Properties.hpp"
-//using namespace System;
using namespace System::Collections::Generic;
namespace Apache
@@ -31,6 +33,7 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
ref class Cache;
ref class CacheAttributes;
@@ -45,7 +48,7 @@ namespace Apache
/// To get an existing unclosed cache instance, use <see cref="CacheFactory.GetInstance" />.
/// </para>
/// </remarks>
- public ref class CacheFactory :public Internal::SBWrap<apache::geode::client::CacheFactory>
+ public ref class CacheFactory
{
public:
@@ -127,7 +130,7 @@ namespace Apache
/// </summary>
static void SetNewAndDelete()
{
- apache::geode::client::setNewAndDelete(&operator new, &operator delete);
+ native::setNewAndDelete(&operator new, &operator delete);
}
/// <summary>
@@ -591,9 +594,9 @@ namespace Apache
/// Private constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline CacheFactory(apache::geode::client::CacheFactory* nativeptr, Properties<String^, String^>^ dsProps)
- : SBWrap(nativeptr)
+ inline CacheFactory(native::CacheFactoryPtr nativeptr, Properties<String^, String^>^ dsProps)
{
+ m_nativeptr = gcnew native_shared_ptr<native::CacheFactory>(nativeptr);
m_dsProps = dsProps;
}
@@ -601,6 +604,8 @@ namespace Apache
static System::Object^ m_singletonSync = gcnew System::Object();
+ native_shared_ptr<native::CacheFactory>^ m_nativeptr;
+
internal:
static bool m_connected = false;
};
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/CacheStatistics.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CacheStatistics.cpp b/src/clicache/src/CacheStatistics.cpp
index 7edaeeb..4259246 100644
--- a/src/clicache/src/CacheStatistics.cpp
+++ b/src/clicache/src/CacheStatistics.cpp
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-//#include "geode_includes.hpp"
#include "CacheStatistics.hpp"
@@ -26,16 +25,31 @@ namespace Apache
namespace Client
{
+ using namespace System;
+
System::UInt32 CacheStatistics::LastModifiedTime::get( )
{
- return NativePtr->getLastModifiedTime( );
+ try
+ {
+ return m_nativeptr->get()->getLastModifiedTime( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
- System::UInt32 CacheStatistics::LastAccessedTime::get( )
+ System::UInt32 CacheStatistics::LastAccessedTime::get()
{
- return NativePtr->getLastAccessedTime( );
+ try
+ {
+ return m_nativeptr->get()->getLastAccessedTime();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
} // namespace Client
} // namespace Geode
} // namespace Apache
-
- } //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/CacheStatistics.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CacheStatistics.hpp b/src/clicache/src/CacheStatistics.hpp
index d91f1d5..ec006ac 100644
--- a/src/clicache/src/CacheStatistics.hpp
+++ b/src/clicache/src/CacheStatistics.hpp
@@ -18,8 +18,11 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/CacheStatistics.hpp>
-#include "impl/NativeWrapper.hpp"
+#include "end_native.hpp"
+
+#include "native_shared_ptr.hpp"
namespace Apache
@@ -28,6 +31,7 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
/// <summary>
/// Defines common statistical information for both the region and its entries.
@@ -39,7 +43,6 @@ namespace Apache
/// <seealso cref="Region.Statistics" />
/// <seealso cref="RegionEntry.Statistics" />
public ref class CacheStatistics sealed
- : public Internal::SBWrap<apache::geode::client::CacheStatistics>
{
public:
@@ -131,10 +134,10 @@ namespace Apache
/// <returns>
/// The managed wrapper object; null if the native pointer is null.
/// </returns>
- inline static CacheStatistics^ Create( apache::geode::client::CacheStatistics* nativeptr )
+ inline static CacheStatistics^ Create( apache::geode::client::CacheStatisticsPtr nativeptr )
{
- return ( nativeptr != nullptr ?
- gcnew CacheStatistics( nativeptr ) : nullptr );
+ return __nullptr == nativeptr ? nullptr :
+ gcnew CacheStatistics( nativeptr );
}
@@ -144,8 +147,11 @@ namespace Apache
/// Private constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline CacheStatistics( apache::geode::client::CacheStatistics* nativeptr )
- : SBWrap( nativeptr ) { }
+ inline CacheStatistics( apache::geode::client::CacheStatisticsPtr nativeptr )
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::CacheStatistics>(nativeptr);
+ }
+ native_shared_ptr<native::CacheStatistics>^ m_nativeptr;
};
} // namespace Client
} // namespace Geode
[19/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from cppcache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientHAFailoverRegex.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientHAFailoverRegex.cpp b/src/cppcache/integration-test/testThinClientHAFailoverRegex.cpp
index 8a23711..1fbaf57 100644
--- a/src/cppcache/integration-test/testThinClientHAFailoverRegex.cpp
+++ b/src/cppcache/integration-test/testThinClientHAFailoverRegex.cpp
@@ -85,7 +85,7 @@ void _verifyEntry(const char* name, const char* key, const char* val,
free(buf);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
CacheableKeyPtr keyPtr = createKey(key);
@@ -135,10 +135,9 @@ void _verifyEntry(const char* name, const char* key, const char* val,
}
if (val != NULL) {
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
- ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null.");
+ ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
sprintf(buf, "In verify loop, get returned %s for key %s",
checkPtr->asChar(), key);
@@ -182,9 +181,9 @@ void createRegion(const char* name, bool ackMode,
fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
fflush(stdout);
// ack, caching
- RegionPtr regPtr = getHelper()->createRegion(name, ackMode, true, NULLPTR,
+ RegionPtr regPtr = getHelper()->createRegion(name, ackMode, true, nullptr,
clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
@@ -198,7 +197,7 @@ void createEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
@@ -223,7 +222,7 @@ void updateEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
// ASSERT( regPtr->containsValueForKey( keyPtr ), "Value should have been
@@ -249,17 +248,16 @@ void doNetsearch(const char* name, const char* key, const char* value) {
RegionPtr regPtr = getHelper()->getRegion(name);
fprintf(stdout, "netsearch region %s\n", regPtr->getName());
fflush(stdout);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
// ASSERT( !regPtr->containsKey( keyPtr ), "Key should not have been found in
// region." );
// ASSERT( !regPtr->containsValueForKey( keyPtr ), "Value should not have been
// found in region." );
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); // force a netsearch
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr)); // force a netsearch
- if (checkPtr != NULLPTR) {
+ if (checkPtr != nullptr) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientHAMixedRedundancy.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientHAMixedRedundancy.cpp b/src/cppcache/integration-test/testThinClientHAMixedRedundancy.cpp
index e3da2a8..3f7e36b 100644
--- a/src/cppcache/integration-test/testThinClientHAMixedRedundancy.cpp
+++ b/src/cppcache/integration-test/testThinClientHAMixedRedundancy.cpp
@@ -90,7 +90,7 @@ void _verifyEntry(const char* name, const char* key, const char* val,
free(buf);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
CacheableKeyPtr keyPtr = createKey(key);
@@ -140,10 +140,9 @@ void _verifyEntry(const char* name, const char* key, const char* val,
}
if (val != NULL) {
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
- ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null.");
+ ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
sprintf(buf, "In verify loop, get returned %s for key %s",
checkPtr->asChar(), key);
@@ -189,8 +188,8 @@ void createRegion(const char* name, bool ackMode,
char* endpoints = NULL;
// ack, caching
RegionPtr regPtr = getHelper()->createRegion(
- name, ackMode, true, NULLPTR, endpoints, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ name, ackMode, true, nullptr, endpoints, clientNotificationEnabled);
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
@@ -204,7 +203,7 @@ void createEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
@@ -229,7 +228,7 @@ void updateEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
// ASSERT( regPtr->containsValueForKey( keyPtr ), "Value should have been
@@ -255,17 +254,16 @@ void doNetsearch(const char* name, const char* key, const char* value) {
RegionPtr regPtr = getHelper()->getRegion(name);
fprintf(stdout, "netsearch region %s\n", regPtr->getName());
fflush(stdout);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
// ASSERT( !regPtr->containsKey( keyPtr ), "Key should not have been found in
// region." );
// ASSERT( !regPtr->containsValueForKey( keyPtr ), "Value should not have been
// found in region." );
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); // force a netsearch
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr)); // force a netsearch
- if (checkPtr != NULLPTR) {
+ if (checkPtr != nullptr) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientHAPeriodicAck.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientHAPeriodicAck.cpp b/src/cppcache/integration-test/testThinClientHAPeriodicAck.cpp
index 6b4a82a..103fbac 100644
--- a/src/cppcache/integration-test/testThinClientHAPeriodicAck.cpp
+++ b/src/cppcache/integration-test/testThinClientHAPeriodicAck.cpp
@@ -37,12 +37,12 @@ class DupChecker : public CacheListener {
m_ops++;
CacheableKeyPtr key = event.getKey();
- CacheableInt32Ptr value = dynCast<CacheableInt32Ptr>(event.getNewValue());
+ auto value = std::dynamic_pointer_cast<CacheableInt32>(event.getNewValue());
HashMapOfCacheable::Iterator item = m_map.find(key);
if (item != m_map.end()) {
- CacheableInt32Ptr check = dynCast<CacheableInt32Ptr>(item.second());
+ auto check = std::dynamic_pointer_cast<CacheableInt32>(item.second());
ASSERT(check->value() + 1 == value->value(),
"Duplicate or older value received");
m_map.update(key, value);
@@ -62,7 +62,7 @@ class DupChecker : public CacheListener {
for (HashMapOfCacheable::Iterator item = m_map.begin(); item != m_map.end();
item++) {
- CacheableInt32Ptr check = dynCast<CacheableInt32Ptr>(item.second());
+ auto check = std::dynamic_pointer_cast<CacheableInt32>(item.second());
ASSERT(check->value() == 100, "Expected final value to be 100");
}
}
@@ -151,7 +151,7 @@ void _verifyEntry(const char* name, const char* key, const char* val,
free(buf);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
CacheableKeyPtr keyPtr = createKey(key);
@@ -201,10 +201,9 @@ void _verifyEntry(const char* name, const char* key, const char* val,
}
if (val != NULL) {
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
- ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null.");
+ ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
sprintf(buf, "In verify loop, get returned %s for key %s",
checkPtr->asChar(), key);
@@ -242,7 +241,7 @@ void _verifyIntEntry(const char* name, const char* key, const int val,
free(buf);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
CacheableKeyPtr keyPtr = createKey(key);
@@ -292,10 +291,9 @@ void _verifyIntEntry(const char* name, const char* key, const int val,
}
if (val != 0) {
- CacheableInt32Ptr checkPtr =
- dynCast<CacheableInt32Ptr>(regPtr->get(keyPtr));
+ auto checkPtr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(keyPtr));
- ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null.");
+ ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
sprintf(buf, "In verify loop, get returned %d for key %s",
checkPtr->value(), key);
@@ -353,8 +351,8 @@ void createRegion(const char* name, bool ackMode,
char* endpoints = NULL;
// ack, caching
RegionPtr regPtr = getHelper()->createRegion(
- name, ackMode, true, NULLPTR, endpoints, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ name, ackMode, true, nullptr, endpoints, clientNotificationEnabled);
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
@@ -368,7 +366,7 @@ void createEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
@@ -393,7 +391,7 @@ void createIntEntry(const char* name, const char* key, const int value) {
CacheableInt32Ptr valPtr = CacheableInt32::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
// ASSERT( !regPtr->containsKey( keyPtr ), "Key should not have been found in
// region." );
@@ -472,8 +470,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, InitClient2_R1)
initClientAndRegion(1);
LOG("Initialized client with redundancy level 1.");
- checker1 = new DupChecker();
- checker2 = new DupChecker();
+ checker1 = std::make_shared<DupChecker>();
+ checker2 = std::make_shared<DupChecker>();
setCacheListener(regionNames[0], checker1);
setCacheListener(regionNames[1], checker2);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientHAQueryFailover.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientHAQueryFailover.cpp b/src/cppcache/integration-test/testThinClientHAQueryFailover.cpp
index 39fbdd4..b1ac86f 100644
--- a/src/cppcache/integration-test/testThinClientHAQueryFailover.cpp
+++ b/src/cppcache/integration-test/testThinClientHAQueryFailover.cpp
@@ -122,8 +122,8 @@ void createRegion(const char* name, bool ackMode,
fflush(stdout);
char* endpoints = NULL;
RegionPtr regPtr = getHelper()->createRegion(
- name, ackMode, false, NULLPTR, endpoints, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ name, ackMode, false, nullptr, endpoints, clientNotificationEnabled);
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
@@ -165,10 +165,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepOne)
RegionPtr rptr = getHelper()->cachePtr->getRegion(regionNames[0]);
- CacheablePtr port1(new Portfolio(1, 100));
- CacheablePtr port2(new Portfolio(2, 200));
- CacheablePtr port3(new Portfolio(3, 300));
- CacheablePtr port4(new Portfolio(4, 400));
+ auto port1 = std::make_shared<Portfolio>(1, 100);
+ auto port2 = std::make_shared<Portfolio>(2, 200);
+ auto port3 = std::make_shared<Portfolio>(3, 300);
+ auto port4 = std::make_shared<Portfolio>(4, 400);
rptr->put("1", port1);
rptr->put("2", port2);
@@ -193,7 +193,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
try {
kst = new KillServerThread();
- QueryServicePtr qs = NULLPTR;
+ QueryServicePtr qs = nullptr;
PoolPtr pool = PoolManager::find("__TESTPOOL1_");
qs = pool->getQueryService();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientHeapLRU.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientHeapLRU.cpp b/src/cppcache/integration-test/testThinClientHeapLRU.cpp
index 0a36c0d..d14f882 100644
--- a/src/cppcache/integration-test/testThinClientHeapLRU.cpp
+++ b/src/cppcache/integration-test/testThinClientHeapLRU.cpp
@@ -49,9 +49,9 @@ void createOnekEntries() {
CacheableWrapperFactory::createInstance(GeodeTypeIds::CacheableBytes);
tmpkey->initKey(i, 32);
tmpval->initRandomValue(1024);
- ASSERT(tmpkey->getCacheable() != NULLPTR, "tmpkey->getCacheable() is NULL");
- ASSERT(tmpval->getCacheable() != NULLPTR, "tmpval->getCacheable() is NULL");
- dataReg->put(dynCast<CacheableKeyPtr>(tmpkey->getCacheable()),
+ ASSERT(tmpkey->getCacheable() != nullptr, "tmpkey->getCacheable() is NULL");
+ ASSERT(tmpval->getCacheable() != nullptr, "tmpval->getCacheable() is NULL");
+ dataReg->put(std::dynamic_pointer_cast<CacheableKey>(tmpkey->getCacheable()),
tmpval->getCacheable());
// delete tmpkey;
// delete tmpval;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientIntResPolKeysInv.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientIntResPolKeysInv.cpp b/src/cppcache/integration-test/testThinClientIntResPolKeysInv.cpp
index 52666e1..8a8af97 100644
--- a/src/cppcache/integration-test/testThinClientIntResPolKeysInv.cpp
+++ b/src/cppcache/integration-test/testThinClientIntResPolKeysInv.cpp
@@ -40,7 +40,7 @@ CacheHelper *cacheHelper = NULL;
void initClient(const bool isthinClient) {
if (cacheHelper == NULL) {
cacheHelper = new CacheHelper(isthinClient, "__TEST_POOL1__", locatorsG,
- "ServerGroup1", NULLPTR, 0, true);
+ "ServerGroup1", nullptr, 0, true);
}
ASSERT(cacheHelper, "Failed to create a CacheHelper client instance.");
}
@@ -78,7 +78,7 @@ void _verifyEntry(const char *name, const char *key, const char *val,
free(buf);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
CacheableKeyPtr keyPtr = createKey(key);
@@ -127,10 +127,9 @@ void _verifyEntry(const char *name, const char *key, const char *val,
}
if (val != NULL) {
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
- ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null.");
+ ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
sprintf(buf, "In verify loop, get returned %s for key %s",
checkPtr->asChar(), key);
@@ -194,8 +193,8 @@ void createRegion(const char *name, bool ackMode, const char *endpoints,
fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
fflush(stdout);
RegionPtr regPtr = getHelper()->createRegion(
- name, ackMode, true, NULLPTR, endpoints, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ name, ackMode, true, nullptr, endpoints, clientNotificationEnabled);
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
void createEntry(const char *name, const char *key, const char *value = NULL) {
@@ -211,7 +210,7 @@ void createEntry(const char *name, const char *key, const char *value = NULL) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
@@ -236,7 +235,7 @@ void updateEntry(const char *name, const char *key, const char *value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
ASSERT(regPtr->containsValueForKey(keyPtr),
@@ -262,17 +261,16 @@ void doNetsearch(const char *name, const char *key, const char *value) {
RegionPtr regPtr = getHelper()->getRegion(name);
fprintf(stdout, "netsearch region %s\n", regPtr->getName());
fflush(stdout);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
ASSERT(!regPtr->containsValueForKey(keyPtr),
"Value should not have been found in region.");
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); // force a netsearch
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr)); // force a netsearch
- if (checkPtr != NULLPTR) {
+ if (checkPtr != nullptr) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientInterest1Cacheless.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientInterest1Cacheless.cpp b/src/cppcache/integration-test/testThinClientInterest1Cacheless.cpp
index 41e4dc8..a534389 100644
--- a/src/cppcache/integration-test/testThinClientInterest1Cacheless.cpp
+++ b/src/cppcache/integration-test/testThinClientInterest1Cacheless.cpp
@@ -40,11 +40,10 @@ class MyListener : public CacheListener {
for (int i = 0; i < 5; i++) m_gotit[i] = 0;
}
inline void checkEntry(const EntryEvent& event) {
- CacheableStringPtr keyPtr = dynCast<CacheableStringPtr>(event.getKey());
+ auto keyPtr = std::dynamic_pointer_cast<CacheableString>(event.getKey());
for (int i = 0; i < 5; i++) {
if (!ACE_OS::strcmp(keys[i], keyPtr->asChar())) {
- CacheableStringPtr valPtr =
- dynCast<CacheableStringPtr>(event.getNewValue());
+ auto valPtr = std::dynamic_pointer_cast<CacheableString>(event.getNewValue());
if (!ACE_OS::strcmp(vals[i], valPtr->asChar())) m_gotit[i] = 1;
break;
}
@@ -60,7 +59,7 @@ class MyListener : public CacheListener {
}
};
-MyListenerPtr mylistner = NULLPTR;
+MyListenerPtr mylistner = nullptr;
void setCacheListener(const char* regName, MyListenerPtr regListener) {
RegionPtr reg = getHelper()->getRegion(regName);
@@ -82,7 +81,7 @@ END_TASK(StartServer)
DUNIT_TASK(CLIENT1, SetupClient1)
{
initClientWithPool(true, "__TEST_POOL1__", locatorsG, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
getHelper()->createPooledRegion(regionNames[0], false, locatorsG,
"__TEST_POOL1__", true, true);
}
@@ -91,13 +90,13 @@ END_TASK(SetupClient1)
DUNIT_TASK(CLIENT2, setupClient2)
{
initClientWithPool(true, "__TEST_POOL1__", locatorsG, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
getHelper()->createPooledRegion(regionNames[0], false, locatorsG,
"__TEST_POOL1__", true, true);
- mylistner = new MyListener();
+ mylistner = std::make_shared<MyListener>();
setCacheListener(regionNames[0], mylistner);
RegionPtr regPtr = getHelper()->getRegion(regionNames[0]);
- regPtr->registerAllKeys(false, NULLPTR, true);
+ regPtr->registerAllKeys(false, nullptr, true);
}
END_TASK(setupClient2)
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientInterest1_Bug1001.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientInterest1_Bug1001.cpp b/src/cppcache/integration-test/testThinClientInterest1_Bug1001.cpp
index cff214a..fe225e3 100644
--- a/src/cppcache/integration-test/testThinClientInterest1_Bug1001.cpp
+++ b/src/cppcache/integration-test/testThinClientInterest1_Bug1001.cpp
@@ -49,7 +49,7 @@ CacheableStringPtr getUAString(int index) {
DUNIT_TASK_DEFINITION(CLIENT1, SetupClient1)
{
initClientWithPool(true, "__TEST_POOL1__", locatorsG, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
getHelper()->createPooledRegion(regionNames[0], false, locatorsG,
"__TEST_POOL1__", true, true);
}
@@ -69,11 +69,11 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT2, setupClient2)
{
initClientWithPool(true, "__TEST_POOL1__", locatorsG, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
getHelper()->createPooledRegion(regionNames[0], false, locatorsG,
"__TEST_POOL1__", true, true);
RegionPtr regPtr = getHelper()->getRegion(regionNames[0]);
- regPtr->registerAllKeys(false, NULLPTR, true);
+ regPtr->registerAllKeys(false, nullptr, true);
}
END_TASK_DEFINITION
@@ -108,8 +108,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, verifyUpdates)
char buf[1024];
sprintf(buf, "key[%s] should have been found", keys[index]);
ASSERT(regPtr->containsKey(keyPtr), buf);
- CacheableStringPtr val =
- dynCast<CacheableStringPtr>(regPtr->getEntry(keyPtr)->getValue());
+ auto val = std::dynamic_pointer_cast<CacheableString>(regPtr->getEntry(keyPtr)->getValue());
ASSERT(strcmp(val->asChar(), nvals[index]) == 0,
"Incorrect value for key");
}
@@ -133,8 +132,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, GetUnicodeStrings)
RegionPtr reg0 = getHelper()->getRegion(regionNames[0]);
for (int index = 0; index < 5; ++index) {
CacheableStringPtr key = getUString(index);
- CacheableInt32Ptr val = dynCast<CacheableInt32Ptr>(reg0->get(key));
- ASSERT(val != NULLPTR, "expected non-null value in get");
+ auto val = std::dynamic_pointer_cast<CacheableInt32>(reg0->get(key));
+ ASSERT(val != nullptr, "expected non-null value in get");
ASSERT(val->value() == (index + 100), "unexpected value in get");
}
reg0->unregisterAllKeys();
@@ -166,9 +165,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, CheckUpdateUnicodeStrings)
RegionPtr reg0 = getHelper()->getRegion(regionNames[0]);
for (int index = 0; index < 5; ++index) {
CacheableStringPtr key = getUString(index);
- CacheableFloatPtr val =
- dynCast<CacheableFloatPtr>(reg0->getEntry(key)->getValue());
- ASSERT(val != NULLPTR, "expected non-null value in get");
+ auto val = std::dynamic_pointer_cast<CacheableFloat>(reg0->getEntry(key)->getValue());
+ ASSERT(val != nullptr, "expected non-null value in get");
ASSERT(val->value() == (index + 20.0F), "unexpected value in get");
}
LOG("CheckUpdateUnicodeStrings complete.");
@@ -192,12 +190,12 @@ DUNIT_TASK_DEFINITION(CLIENT2, GetASCIIAsWideStrings)
RegionPtr reg0 = getHelper()->getRegion(regionNames[0]);
for (int index = 0; index < 5; ++index) {
CacheableStringPtr key = getUAString(index);
- CacheableStringPtr val = dynCast<CacheableStringPtr>(reg0->get(key));
+ auto val = std::dynamic_pointer_cast<CacheableString>(reg0->get(key));
CacheableStringPtr expectedVal = getUString(index + 20);
- ASSERT(val != NULLPTR, "expected non-null value in get");
+ ASSERT(val != nullptr, "expected non-null value in get");
ASSERT(wcscmp(val->asWChar(), expectedVal->asWChar()) == 0,
"unexpected value in get");
- ASSERT(*val.ptr() == *expectedVal.ptr(), "unexpected value in get");
+ ASSERT(*val.get() == *expectedVal.get(), "unexpected value in get");
}
VectorOfCacheableKey vec;
for (int index = 0; index < 5; ++index) {
@@ -227,10 +225,10 @@ DUNIT_TASK_DEFINITION(CLIENT2, CheckUpdateASCIIAsWideStrings)
RegionPtr reg0 = getHelper()->getRegion(regionNames[0]);
for (int index = 0; index < 5; ++index) {
CacheableStringPtr key = getUAString(index);
- CacheableStringPtr val = dynCast<CacheableStringPtr>(reg0->get(key));
+ auto val = std::dynamic_pointer_cast<CacheableString>(reg0->get(key));
CacheableStringPtr expectedVal = getUAString(index + 10);
- ASSERT(val != NULLPTR, "expected non-null value in get");
- ASSERT(*val.ptr() == *expectedVal.ptr(), "unexpected value in get");
+ ASSERT(val != nullptr, "expected non-null value in get");
+ ASSERT(*val.get() == *expectedVal.get(), "unexpected value in get");
}
LOG("CheckUpdateASCIIAsWideStrings complete.");
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientInterestNotify.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientInterestNotify.cpp b/src/cppcache/integration-test/testThinClientInterestNotify.cpp
index af925d2..fcf5073 100644
--- a/src/cppcache/integration-test/testThinClientInterestNotify.cpp
+++ b/src/cppcache/integration-test/testThinClientInterestNotify.cpp
@@ -47,14 +47,13 @@ class EventListener : public CacheListener {
char buf[256] = {'\0'};
try {
- CacheableStringPtr keyPtr = dynCast<CacheableStringPtr>(event.getKey());
- CacheableInt32Ptr valuePtr =
- dynCast<CacheableInt32Ptr>(event.getNewValue());
+ auto keyPtr = std::dynamic_pointer_cast<CacheableString>(event.getKey());
+ auto valuePtr = std::dynamic_pointer_cast<CacheableInt32>(event.getNewValue());
sprintf(
buf, "%s: %s: Key = %s, NewValue = %s", m_name.c_str(), eventType,
keyPtr->asChar(),
- (valuePtr == NULLPTR ? "NULLPTR" : valuePtr->toString()->asChar()));
+ (valuePtr == nullptr ? "nullptr" : valuePtr->toString()->asChar()));
LOG(buf);
} catch (const Exception& excp) {
sprintf(buf, "%s: %s: %s: %s", m_name.c_str(), eventType, excp.getName(),
@@ -137,16 +136,16 @@ void setCacheListener(const char* regName, EventListenerPtr monitor) {
// RegionOther means no interest registered so no events should arrive except
// invalidates when NBS == false.
-EventListenerPtr clientTrueRegionTrue = NULLPTR;
-EventListenerPtr clientTrueRegionFalse = NULLPTR;
-EventListenerPtr clientTrueRegionOther = NULLPTR;
+EventListenerPtr clientTrueRegionTrue = nullptr;
+EventListenerPtr clientTrueRegionFalse = nullptr;
+EventListenerPtr clientTrueRegionOther = nullptr;
/*
-EventListenerPtr clientFalseRegionTrue = NULLPTR;
-EventListenerPtr clientFalseRegionFalse = NULLPTR;
-EventListenerPtr clientFalseRegionOther = NULLPTR;
-EventListenerPtr clientDefaultRegionTrue = NULLPTR;
-EventListenerPtr clientDefaultRegionFalse = NULLPTR;
-EventListenerPtr clientDefaultRegionOther = NULLPTR;
+EventListenerPtr clientFalseRegionTrue = nullptr;
+EventListenerPtr clientFalseRegionFalse = nullptr;
+EventListenerPtr clientFalseRegionOther = nullptr;
+EventListenerPtr clientDefaultRegionTrue = nullptr;
+EventListenerPtr clientDefaultRegionFalse = nullptr;
+EventListenerPtr clientDefaultRegionOther = nullptr;
*/
const char* regions[] = {"RegionTrue", "RegionFalse", "RegionOther"};
@@ -181,9 +180,9 @@ void initClientForInterestNotify(EventListenerPtr& mon1, EventListenerPtr& mon2,
name3 += regions[2];
// Recreate listeners
- mon1 = new EventListener(name1.c_str());
- mon2 = new EventListener(name2.c_str());
- mon3 = new EventListener(name3.c_str());
+ mon1 = std::make_shared<EventListener>(name1.c_str());
+ mon2 = std::make_shared<EventListener>(name2.c_str());
+ mon3 = std::make_shared<EventListener>(name3.c_str());
setCacheListener(regions[0], mon1);
setCacheListener(regions[1], mon2);
@@ -234,7 +233,7 @@ void registerInterests(const char* region, bool durable, bool receiveValues) {
regionPtr->registerKeys(keysVector, durable, true, receiveValues);
- regionPtr->registerRegex("key-regex.*", durable, NULLPTR, true,
+ regionPtr->registerRegex("key-regex.*", durable, nullptr, true,
receiveValues);
}
@@ -270,7 +269,7 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(SERVER_AND_FEEDER, FeederUpAndFeed)
{
initClientWithPool(true, "__TEST_POOL1__", locatorsG, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
getHelper()->createPooledRegion(regions[0], USE_ACK, locatorsG,
"__TEST_POOL1__", true, true);
getHelper()->createPooledRegion(regions[1], USE_ACK, locatorsG,
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientLRUExpiration.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientLRUExpiration.cpp b/src/cppcache/integration-test/testThinClientLRUExpiration.cpp
index 4d7afd9..63371d0 100644
--- a/src/cppcache/integration-test/testThinClientLRUExpiration.cpp
+++ b/src/cppcache/integration-test/testThinClientLRUExpiration.cpp
@@ -109,7 +109,7 @@ void getRegionAttr(const char* name) {
void ValidateDestroyRegion(const char* name) {
RegionPtr rptr = getHelper()->getRegion(name);
- if (rptr == NULLPTR) {
+ if (rptr == nullptr) {
return;
}
try {
@@ -138,8 +138,8 @@ void createRegion(const char* name, bool ackMode, int ettl, int eit, int rttl,
// );
getHelper()->createRegionAndAttachPool(name, ackMode, "LRUPool", true,
ettl, eit, rttl, rit, lel, action);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
- if (registerKey) regPtr->registerAllKeys(false, NULLPTR, false, false);
+ ASSERT(regPtr != nullptr, "Failed to create region.");
+ if (registerKey) regPtr->registerAllKeys(false, nullptr, false, false);
LOG("Region created.");
}
@@ -151,10 +151,10 @@ void doRgnOperations(const char* name, int n, int rgnOpt = 0) {
buf[15] = '\0';
memcpy(buf, "Value - ", 8);
value = CacheableString::create(buf);
- ASSERT(value != NULLPTR, "Failed to create value.");
+ ASSERT(value != nullptr, "Failed to create value.");
}
RegionPtr rptr = getHelper()->getRegion(name);
- ASSERT(rptr != NULLPTR, "Region not found.");
+ ASSERT(rptr != nullptr, "Region not found.");
for (int i = 0; i < n; i++) {
sprintf(buf, "KeyA - %d", i + 1);
CacheableKeyPtr key = CacheableKey::create(buf);
@@ -184,7 +184,7 @@ void doRgnOperations(const char* name, int n, int rgnOpt = 0) {
void dumpCounters(const char* regName) {
RegionPtr rptr = getHelper()->getRegion(regName);
printf("Region size: %d\n", rptr->size());
- if (regListener != NULLPTR) {
+ if (regListener != nullptr) {
printf("counts:: creates: %d, updates: %d, invalidates: %d, destroys: %d\n",
regListener->getCreates(), regListener->getUpdates(),
regListener->getInvalidates(), regListener->getDestroys());
@@ -911,8 +911,8 @@ DUNIT_TASK(CLIENT1, StepOneCase11)
// [put-0/get-5/destroy-3] ,destroyRgn - [true/false]
// ,clientNotificationEnabled - [true/false] ,ExpirationAction::Action
createThinClientRegion(regionNames[4], 4, 0, 0, 0, 5, 0, 6, false);
- regListener = new TallyListener();
- regWriter = new TallyWriter();
+ regListener = std::make_shared<TallyListener>();
+ regWriter = std::make_shared<TallyWriter>();
setCacheListener(regionNames[4], regListener);
setCacheWriter(regionNames[4], regWriter);
}
@@ -924,8 +924,8 @@ DUNIT_TASK(CLIENT2, StepTwoCase11)
// [put-0/get-5/destroy-3] ,destroyRgn - [true/false]
// ,clientNotificationEnabled - [true/false] ,ExpirationAction::Action
createThinClientRegion(regionNames[4], 0, 0, 0, 0, 0, 0, 6, false);
- regListener = new TallyListener();
- regWriter = new TallyWriter();
+ regListener = std::make_shared<TallyListener>();
+ regWriter = std::make_shared<TallyWriter>();
setCacheListener(regionNames[4], regListener);
setCacheWriter(regionNames[4], regWriter);
}
@@ -1046,8 +1046,8 @@ DUNIT_TASK(CLIENT1, StepOneCase12)
// [put-0/get-5/destroy-3] ,destroyRgn - [true/false]
// ,clientNotificationEnabled - [true/false] ,ExpirationAction::Action
createThinClientRegion(regionNames[5], 4, 0, 0, 0, 5, 0, 6, false);
- regListener = new TallyListener();
- regWriter = new TallyWriter();
+ regListener = std::make_shared<TallyListener>();
+ regWriter = std::make_shared<TallyWriter>();
setCacheListener(regionNames[5], regListener);
setCacheWriter(regionNames[5], regWriter);
}
@@ -1059,8 +1059,8 @@ DUNIT_TASK(CLIENT2, StepTwoCase12)
// [put-0/get-5/destroy-3] ,destroyRgn - [true/false]
// ,clientNotificationEnabled - [true/false] ,ExpirationAction::Action
createThinClientRegion(regionNames[5], 0, 0, 0, 0, 0, 0, 6, false);
- regListener = new TallyListener();
- regWriter = new TallyWriter();
+ regListener = std::make_shared<TallyListener>();
+ regWriter = std::make_shared<TallyWriter>();
setCacheListener(regionNames[5], regListener);
setCacheWriter(regionNames[5], regWriter);
}
@@ -1142,8 +1142,8 @@ DUNIT_TASK(CLIENT1, StepOneCase13)
initClient(true);
getHelper()->createPoolWithLocators("LRUPool", locatorsG, true);
createThinClientRegion(regionNames[5], 4, 0, 0, 0, 5, 0, 6, false);
- regListener = new TallyListener();
- regWriter = new TallyWriter();
+ regListener = std::make_shared<TallyListener>();
+ regWriter = std::make_shared<TallyWriter>();
setCacheListener(regionNames[5], regListener);
setCacheWriter(regionNames[5], regWriter);
}
@@ -1157,8 +1157,8 @@ DUNIT_TASK(CLIENT2, StepTwoCase13)
initClient(true);
getHelper()->createPoolWithLocators("LRUPool", locatorsG, true);
createThinClientRegion(regionNames[5], 0, 0, 0, 0, 0, 0, 6, false);
- regListener = new TallyListener();
- regWriter = new TallyWriter();
+ regListener = std::make_shared<TallyListener>();
+ regWriter = std::make_shared<TallyWriter>();
setCacheListener(regionNames[5], regListener);
setCacheWriter(regionNames[5], regWriter);
RegionPtr regPtr0 = getHelper()->getRegion(regionNames[5]);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientListenerCallbackArgTest.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientListenerCallbackArgTest.cpp b/src/cppcache/integration-test/testThinClientListenerCallbackArgTest.cpp
index 4ec2549..a2fc966 100644
--- a/src/cppcache/integration-test/testThinClientListenerCallbackArgTest.cpp
+++ b/src/cppcache/integration-test/testThinClientListenerCallbackArgTest.cpp
@@ -69,7 +69,7 @@ class CallbackListener : public CacheListener {
m_regionInvalidate(0),
m_regionDestroy(0),
m_regionClear(0),
- m_callbackArg(NULLPTR) {
+ m_callbackArg(nullptr) {
LOG("CallbackListener contructor called");
}
@@ -88,11 +88,11 @@ class CallbackListener : public CacheListener {
}
void check(CacheablePtr eventCallback, int& updateEvent) {
- if (m_callbackArg != NULLPTR) {
+ if (m_callbackArg != nullptr) {
try {
- PortfolioPtr mCallbkArg = dynCast<PortfolioPtr>(m_callbackArg);
+ auto mCallbkArg = std::dynamic_pointer_cast<Portfolio>(m_callbackArg);
- PortfolioPtr callbkArg = dynCast<PortfolioPtr>(eventCallback);
+ auto callbkArg = std::dynamic_pointer_cast<Portfolio>(eventCallback);
CacheableStringPtr fromCallback = callbkArg->getPkid();
CacheableStringPtr mCallback = mCallbkArg->getPkid();
@@ -100,7 +100,7 @@ class CallbackListener : public CacheListener {
LOGFINE(" values are %s === %s ", fromCallback->asChar(),
mCallback->asChar());
- if (*(fromCallback.ptr()) == *(mCallback.ptr())) {
+ if (*(fromCallback.get()) == *(mCallback.get())) {
LOGFINE("values are same");
updateEvent++;
} else {
@@ -109,15 +109,13 @@ class CallbackListener : public CacheListener {
} catch (const ClassCastException& ex) {
LOGFINE(" in class cast exception %s ", ex.getMessage());
try {
- CacheableStringPtr fromCallback =
- dynCast<CacheableStringPtr>(eventCallback);
- CacheableStringPtr mCallback =
- dynCast<CacheableStringPtr>(m_callbackArg);
+ auto fromCallback = std::dynamic_pointer_cast<CacheableString>(eventCallback);
+ auto mCallback = std::dynamic_pointer_cast<CacheableString>(m_callbackArg);
LOGFINE(" values are %s === %s ", fromCallback->asChar(),
mCallback->asChar());
- if (*(fromCallback.ptr()) == *(mCallback.ptr())) {
+ if (*(fromCallback.get()) == *(mCallback.get())) {
LOGFINE("values are same");
updateEvent++;
} else {
@@ -167,7 +165,7 @@ class CallbackListener : public CacheListener {
};
//---------------------------------------------------------------------------------
-CallbackListenerPtr reg1Listener1 = NULLPTR;
+CallbackListenerPtr reg1Listener1 = nullptr;
CacheableStringPtr callBackStrPtr;
CacheablePtr callBackPortFolioPtr;
@@ -225,8 +223,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, SetupClient1_Pool_Locator)
Serializable::registerType(Portfolio::createDeserializable);
Serializable::registerType(Position::createDeserializable);
- reg1Listener1 = new CallbackListener();
- callBackPortFolioPtr = new Portfolio(1, 0, NULLPTR);
+ reg1Listener1 = std::make_shared<CallbackListener>();
+ callBackPortFolioPtr = std::make_shared<Portfolio>(1, 0, nullptr);
reg1Listener1->setCallBackArg(callBackPortFolioPtr);
setCacheListener(regionNames[0], reg1Listener1);
@@ -250,7 +248,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, testCreatesAndUpdates)
{
RegionPtr regPtr = getHelper()->getRegion(regionNames[0]);
- callBackPortFolioPtr = new Portfolio(1, 0, NULLPTR);
+ callBackPortFolioPtr = std::make_shared<Portfolio>(1, 0, nullptr);
regPtr->create("aaa", "bbb", callBackPortFolioPtr);
regPtr->create(keys[1], vals[1], callBackPortFolioPtr);
regPtr->put(keys[1], nvals[1], callBackPortFolioPtr);
@@ -261,7 +259,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, testInvalidates)
{
RegionPtr regPtr = getHelper()->getRegion(regionNames[0]);
- callBackPortFolioPtr = new Portfolio(1, 0, NULLPTR);
+ callBackPortFolioPtr = std::make_shared<Portfolio>(1, 0, nullptr);
regPtr->localCreate(1234, 1234, callBackPortFolioPtr);
regPtr->localCreate(12345, 12345, callBackPortFolioPtr);
regPtr->localCreate(12346, 12346, callBackPortFolioPtr);
@@ -282,7 +280,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, testDestroy)
{
RegionPtr regPtr = getHelper()->getRegion(regionNames[0]);
- callBackPortFolioPtr = new Portfolio(1, 0, NULLPTR);
+ callBackPortFolioPtr = std::make_shared<Portfolio>(1, 0, nullptr);
regPtr->destroy(keys[1], callBackPortFolioPtr);
ASSERT(regPtr->removeEx("aaa", callBackPortFolioPtr) == true,
"Result of remove should be true, as this value exists.");
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientListenerEvents.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientListenerEvents.cpp b/src/cppcache/integration-test/testThinClientListenerEvents.cpp
index 8455fde..8d2ee3f 100644
--- a/src/cppcache/integration-test/testThinClientListenerEvents.cpp
+++ b/src/cppcache/integration-test/testThinClientListenerEvents.cpp
@@ -81,7 +81,7 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, SetupClient1)
{
initClientWithPool(true, "__TEST_POOL1__", locatorsG, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
getHelper()->createPooledRegion(regionNames[0], false, locatorsG,
"__TEST_POOL1__", true, true);
}
@@ -92,7 +92,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, doRemoteGet)
RegionPtr regionPtr = getHelper()->getRegion(regionNames[0]);
AttributesMutatorPtr attrMutatorPtr = regionPtr->getAttributesMutator();
- SimpleCacheListenerPtr regListener1(new SimpleCacheListener());
+ auto regListener1 = std::make_shared<SimpleCacheListener>();
attrMutatorPtr->setCacheListener(regListener1);
// Put 3 Entries into the Region.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientLocator.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientLocator.cpp b/src/cppcache/integration-test/testThinClientLocator.cpp
index bff52a1..ee5f879 100644
--- a/src/cppcache/integration-test/testThinClientLocator.cpp
+++ b/src/cppcache/integration-test/testThinClientLocator.cpp
@@ -46,7 +46,7 @@ DUNIT_TASK(CLIENT1, StepOne)
{
// starting client 1
initClientWithPool(true, "__TEST_POOL1__", locHostPort, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
getHelper()->createPooledRegion(regionNames[0], USE_ACK, locHostPort,
"__TEST_POOL1__", true, true);
getHelper()->createPooledRegion(regionNames[1], NO_ACK, locHostPort,
@@ -57,7 +57,7 @@ END_TASK(StepOne)
DUNIT_TASK(CLIENT2, StepTwo)
{
initClientWithPool(true, "__TEST_POOL1__", locHostPort, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
getHelper()->createPooledRegion(regionNames[0], USE_ACK, locHostPort,
"__TEST_POOL1__", true, true);
getHelper()->createPooledRegion(regionNames[1], NO_ACK, locHostPort,
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientLocatorFailover.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientLocatorFailover.cpp b/src/cppcache/integration-test/testThinClientLocatorFailover.cpp
index 5deac4b..c746d39 100644
--- a/src/cppcache/integration-test/testThinClientLocatorFailover.cpp
+++ b/src/cppcache/integration-test/testThinClientLocatorFailover.cpp
@@ -214,20 +214,13 @@ DUNIT_TASK(CLIENT1, AgainAgainFailoverC1_All)
"No locator exception should "
"have been raised");
} catch (const NotConnectedException& ex) {
- try {
- ExceptionPtr exCause =
- dynCast<SharedPtr<NoAvailableLocatorsException> >(ex.getCause());
- LOG("Expected "
- "NoAvailableLocatorsExcepti"
- "on");
- } catch (ClassCastException&) {
- FAIL(
- "NotConnectedException "
- "with cause "
- "NoAvailableLocatorsExcepti"
- "on should have been "
- "raised");
- }
+ ASSERT(std::dynamic_pointer_cast<NoAvailableLocatorsException>(
+ ex.getCause()),
+ "NotConnectedException "
+ "with cause "
+ "NoAvailableLocatorsExcepti"
+ "on should have been "
+ "raised");
}
}
END_TASK(AgainAgainFailoverC1_All)
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientMultiDS.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientMultiDS.cpp b/src/cppcache/integration-test/testThinClientMultiDS.cpp
index d97d4e1..0951f59 100644
--- a/src/cppcache/integration-test/testThinClientMultiDS.cpp
+++ b/src/cppcache/integration-test/testThinClientMultiDS.cpp
@@ -170,12 +170,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepOne_1)
try {
RegionPtr regPtr0 = getHelper()->getRegion(regionNames[0]);
RegionPtr regPtr1 = getHelper()->getRegion(regionNames[1]);
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr0->get(keys[2]));
- ASSERT(checkPtr == NULLPTR, "checkPtr should be null");
- CacheableStringPtr checkPtr1 =
- dynCast<CacheableStringPtr>(regPtr0->get(keys[0]));
- ASSERT(checkPtr1 != NULLPTR, "checkPtr1 should not be null");
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr0->get(keys[2]));
+ ASSERT(checkPtr == nullptr, "checkPtr should be null");
+ auto checkPtr1 = std::dynamic_pointer_cast<CacheableString>(regPtr0->get(keys[0]));
+ ASSERT(checkPtr1 != nullptr, "checkPtr1 should not be null");
} catch (Exception& excp) {
LOG(excp.getMessage());
ASSERT(false, "Got unexpected exception");
@@ -341,12 +339,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepOne_secureclient1)
try {
RegionPtr regPtr0 = getHelper()->getRegion(regionNames[0]);
RegionPtr regPtr1 = getHelper()->getRegion(regionNames[1]);
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr0->get(keys[2]));
- ASSERT(checkPtr == NULLPTR, "checkPtr should be null");
- CacheableStringPtr checkPtr1 =
- dynCast<CacheableStringPtr>(regPtr0->get(keys[0]));
- ASSERT(checkPtr1 != NULLPTR, "checkPtr1 should not be null");
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr0->get(keys[2]));
+ ASSERT(checkPtr == nullptr, "checkPtr should be null");
+ auto checkPtr1 = std::dynamic_pointer_cast<CacheableString>(regPtr0->get(keys[0]));
+ ASSERT(checkPtr1 != nullptr, "checkPtr1 should not be null");
} catch (Exception& excp) {
LOG(excp.getMessage());
ASSERT(false, "Got unexpected exception");
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientNotificationWithDeltaWithoutcache.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientNotificationWithDeltaWithoutcache.cpp b/src/cppcache/integration-test/testThinClientNotificationWithDeltaWithoutcache.cpp
index 65609b1..c27b24e 100644
--- a/src/cppcache/integration-test/testThinClientNotificationWithDeltaWithoutcache.cpp
+++ b/src/cppcache/integration-test/testThinClientNotificationWithDeltaWithoutcache.cpp
@@ -76,7 +76,7 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators,
RegionPtr regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
@@ -86,9 +86,9 @@ void createRegionCachingDisabled(const char* name, bool ackMode,
fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
fflush(stdout);
// ack, caching
- RegionPtr regPtr = getHelper()->createRegion(name, ackMode, false, NULLPTR,
+ RegionPtr regPtr = getHelper()->createRegion(name, ackMode, false, nullptr,
clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientPRPutAllFailover.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientPRPutAllFailover.cpp b/src/cppcache/integration-test/testThinClientPRPutAllFailover.cpp
index 6b9f9a6..4ee95b1 100644
--- a/src/cppcache/integration-test/testThinClientPRPutAllFailover.cpp
+++ b/src/cppcache/integration-test/testThinClientPRPutAllFailover.cpp
@@ -83,7 +83,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepOne_Pooled_Locator_Client1)
getHelper()->createRegionAndAttachPool(regionNames[1], NO_ACK,
"__TEST_POOL1__");
- reg1Listener1 = new TallyListener();
+ reg1Listener1 = std::make_shared<TallyListener>();
setCacheListener(regionNames[0], reg1Listener1);
LOG("StepOne_Pooled_Locator_Client1 complete.");
}
@@ -99,7 +99,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepOne_Pooled_Locator_Client2)
getHelper()->createRegionAndAttachPool(regionNames[1], NO_ACK,
"__TEST_POOL1__");
- reg1Listener1 = new TallyListener();
+ reg1Listener1 = std::make_shared<TallyListener>();
setCacheListener(regionNames[0], reg1Listener1);
LOG("StepOne_Pooled_Locator_Client2 complete.");
}
@@ -256,7 +256,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyAllPutAllTask)
LOG("VerifyAllPutAllTask started.");
RegionPtr dataReg = getHelper()->getRegion(regionNames[0]);
- ASSERT(dataReg != NULLPTR, "Region not found.");
+ ASSERT(dataReg != nullptr, "Region not found.");
LOGINFO("dataregion size is %d: ", dataReg->size());
LOGINFO("dataregion getCreates is %d: ", reg1Listener1->getCreates());
ASSERT(reg1Listener1->getCreates() == 4000,
@@ -270,9 +270,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyAllPutAllTask)
sprintf(value, "%d", item);
LOGDEBUG("CPPTEST:VerifyAllPutAllTask Doing get on key using: = %s: ",
key);
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(dataReg->get(CacheableKey::create(key)));
- ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null.");
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(dataReg->get(CacheableKey::create(key)));
+ ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
LOGDEBUG("CPPTEST:VerifyAllPutAllTask value is: = %s: ",
checkPtr->asChar());
ASSERT(atoi(checkPtr->asChar()) == item, "Value did not match.");
@@ -433,7 +432,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, VerifyAllRemoveAllTask)
LOG("VerifyAllRemoveAllTask started.");
RegionPtr dataReg = getHelper()->getRegion(regionNames[0]);
- ASSERT(dataReg != NULLPTR, "Region not found.");
+ ASSERT(dataReg != nullptr, "Region not found.");
LOGINFO("dataregion size is %d: ", dataReg->size());
LOGINFO("dataregion getDestroys is %d: ", reg1Listener1->getDestroys());
ASSERT(reg1Listener1->getDestroys() == 4000,
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientPRSingleHop.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientPRSingleHop.cpp b/src/cppcache/integration-test/testThinClientPRSingleHop.cpp
index 43e6966..b71aa0a 100644
--- a/src/cppcache/integration-test/testThinClientPRSingleHop.cpp
+++ b/src/cppcache/integration-test/testThinClientPRSingleHop.cpp
@@ -119,10 +119,10 @@ class putThread : public ACE_Task_Base {
if (!m_isWarmUpTask) {
unsigned int seed = i;
rand = ACE_OS::rand_r(&seed);
- keyPtr = dynCast<CacheableKeyPtr>(CacheableInt32::create(rand));
+ keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(rand));
LOGDEBUG("svc: putting key %d ", rand);
} else {
- keyPtr = dynCast<CacheableKeyPtr>(CacheableInt32::create(i));
+ keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
LOGDEBUG("svc: putting key %d ", i);
}
try {
@@ -270,11 +270,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepOne_Pooled_LocatorTL)
RegionPtr regPtr = getHelper()->createPooledRegionStickySingleHop(
regionNames[0], USE_ACK, NULL, locatorsG, "__TEST_POOL1__", false,
false);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
regPtr = getHelper()->createPooledRegionStickySingleHop(
regionNames[1], NO_ACK, NULL, locatorsG, "__TEST_POOL1__", false,
false);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("StepOne_Pooled_LocatorTL complete.");
}
@@ -289,8 +289,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, WarmUpTask)
// This is to get MetaDataService going.
for (int i = 0; i < 2000; i++) {
- CacheableKeyPtr keyPtr =
- dynCast<CacheableKeyPtr>(CacheableInt32::create(i));
+ auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
try {
LOGDEBUG("CPPTEST: put item %d", i);
dataReg->put(keyPtr, keyPtr->hashcode());
@@ -370,8 +369,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, WarmUpTask3)
// This is to get MetaDataService going.
for (int i = 0; i < 2000; i++) {
- CacheableKeyPtr keyPtr =
- dynCast<CacheableKeyPtr>(CacheableInt32::create(i));
+ auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
try {
LOGDEBUG("CPPTEST: put item %d", i);
dataReg->put(keyPtr, keyPtr->hashcode());
@@ -504,9 +502,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForAllKeysTask)
CacheableWrapper* tmpkey =
CacheableWrapperFactory::createInstance(keyTypeId);
tmpkey->initKey(i, KEYSIZE);
- CacheableKeyPtr keyPtr = dynCast<CacheableKeyPtr>(tmpkey->getCacheable());
+ auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(tmpkey->getCacheable());
- ASSERT(tmpkey->getCacheable() != NULLPTR,
+ ASSERT(tmpkey->getCacheable() != nullptr,
"tmpkey->getCacheable() is NULL");
char logmsg[KEYSIZE * 4 + 100] = {0};
@@ -624,8 +622,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask2)
RegionPtr dataReg = getHelper()->getRegion(regionNames[0]);
for (int i = 2000; i < 3000; i++) {
- CacheableKeyPtr keyPtr =
- dynCast<CacheableKeyPtr>(CacheableInt32::create(i));
+ auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
try {
LOGDEBUG("CPPTEST: Putting key %d with hashcode %d", i,
@@ -741,8 +738,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask2)
LOG("CheckPrSingleHopForIntKeysTask2 put completed.");
for (int i = 0; i < 1000; i++) {
- CacheableKeyPtr keyPtr =
- dynCast<CacheableKeyPtr>(CacheableInt32::create(i));
+ auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
try {
LOGDEBUG("CPPTEST: getting key %d with hashcode %d", i,
@@ -808,8 +804,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask2)
keys.push_back(CacheableInt32::create(j));
}
- HashMapOfCacheablePtr values(new HashMapOfCacheable());
- HashMapOfExceptionPtr exceptions(new HashMapOfException());
+ auto values = std::make_shared<HashMapOfCacheable>();
+ auto exceptions = std::make_shared<HashMapOfException>();
try {
// LOGINFO("CPPTEST: getting key %d with hashcode %d", i,
@@ -864,18 +860,17 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForGetAllTask)
{
RegionPtr dataReg = getHelper()->getRegion(regionNames[0]);
VectorOfCacheableKey keys;
- HashMapOfCacheablePtr valuesMap(new HashMapOfCacheable());
+ auto valuesMap = std::make_shared<HashMapOfCacheable>();
for (int i = 0; i < 100; i++) {
- CacheableKeyPtr keyPtr =
- dynCast<CacheableKeyPtr>(CacheableInt32::create(i));
+ auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
dataReg->put(keyPtr, keyPtr->hashcode());
keys.push_back(keyPtr);
}
- dataReg->getAll(keys, valuesMap, NULLPTR, true);
+ dataReg->getAll(keys, valuesMap, nullptr, true);
ASSERT(valuesMap->size() == 100, "GetAll returns wrong number of values");
- dataReg->getAll(keys, valuesMap, NULLPTR, true,
+ dataReg->getAll(keys, valuesMap, nullptr, true,
CacheableInt32::create(1000));
ASSERT(valuesMap->size() == 100,
"GetAllWithCallBack returns wrong number of values");
@@ -891,8 +886,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask)
RegionPtr dataReg = getHelper()->getRegion(regionNames[0]);
for (int i = 2000; i < 3000; i++) {
- CacheableKeyPtr keyPtr =
- dynCast<CacheableKeyPtr>(CacheableInt32::create(i));
+ auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
try {
LOGDEBUG("CPPTEST: Putting key %d with hashcode %d", i,
@@ -995,8 +989,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask)
LOG("CheckPrSingleHopForIntKeysTask put completed.");
for (int i = 0; i < 1000; i++) {
- CacheableKeyPtr keyPtr =
- dynCast<CacheableKeyPtr>(CacheableInt32::create(i));
+ auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
try {
LOGDEBUG("CPPTEST: getting key %d with hashcode %d", i,
@@ -1054,8 +1047,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask)
keys.push_back(CacheableInt32::create(j));
}
- HashMapOfCacheablePtr values(new HashMapOfCacheable());
- HashMapOfExceptionPtr exceptions(new HashMapOfException());
+ auto values = std::make_shared<HashMapOfCacheable>();
+ auto exceptions = std::make_shared<HashMapOfException>();
try {
// LOGINFO("CPPTEST: getting key %d with hashcode %d", i,
@@ -1241,23 +1234,22 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckGetAllTask)
{
RegionPtr dataReg = getHelper()->getRegion(regionNames[0]);
VectorOfCacheableKey keys;
- HashMapOfCacheablePtr valuesMap(new HashMapOfCacheable());
+ auto valuesMap = std::make_shared<HashMapOfCacheable>();
for (int i = 0; i < 100000; i++) {
- CacheableKeyPtr keyPtr =
- dynCast<CacheableKeyPtr>(CacheableInt32::create(i));
+ auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
dataReg->put(keyPtr, keyPtr->hashcode());
keys.push_back(keyPtr);
}
ACE_Time_Value startTime = ACE_OS::gettimeofday();
- dataReg->getAll(keys, valuesMap, NULLPTR, true);
+ dataReg->getAll(keys, valuesMap, nullptr, true);
ACE_Time_Value interval = ACE_OS::gettimeofday() - startTime;
LOGDEBUG("NILKANTH: Time taken to execute getALL sec = %d and MSec = %d ",
interval.sec(), interval.usec());
ASSERT(valuesMap->size() == 100000,
"GetAll returns wrong number of values");
- dataReg->getAll(keys, valuesMap, NULLPTR, true,
+ dataReg->getAll(keys, valuesMap, nullptr, true,
CacheableInt32::create(10000));
ASSERT(valuesMap->size() == 100000,
"GetAllWithCallBack returns wrong number of values");
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientPRSingleHopServerGroup.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientPRSingleHopServerGroup.cpp b/src/cppcache/integration-test/testThinClientPRSingleHopServerGroup.cpp
index 8dbcc89..469bed4 100644
--- a/src/cppcache/integration-test/testThinClientPRSingleHopServerGroup.cpp
+++ b/src/cppcache/integration-test/testThinClientPRSingleHopServerGroup.cpp
@@ -97,8 +97,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask_CLIENT1)
RegionPtr dataReg = getHelper()->getRegion(regionNames[0]);
for (int i = 0; i < 1000; i++) {
- CacheableKeyPtr keyPtr =
- dynCast<CacheableKeyPtr>(CacheableInt32::create(i));
+ auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
try {
LOGINFO("CPPTEST: Putting key %d with hashcode %d", i,
@@ -160,8 +159,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask_CLIENT1)
LOG("CheckPrSingleHopForIntKeysTask_CLIENT1 put completed.");
for (int i = 0; i < 1000; i++) {
- CacheableKeyPtr keyPtr =
- dynCast<CacheableKeyPtr>(CacheableInt32::create(i));
+ auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
try {
LOGINFO("CPPTEST: getting key %d with hashcode %d", i,
@@ -208,8 +206,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask_CLIENT1)
keys.push_back(CacheableInt32::create(j));
}
- HashMapOfCacheablePtr values(new HashMapOfCacheable());
- HashMapOfExceptionPtr exceptions(new HashMapOfException());
+ auto values = std::make_shared<HashMapOfCacheable>();
+ auto exceptions = std::make_shared<HashMapOfException>();
try {
dataReg->getAll(keys, values, exceptions, false);
@@ -249,8 +247,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CheckPrSingleHopForIntKeysTask_CLIENT1)
LOG("CheckPrSingleHopForIntKeysTask_CLIENT1 getAll completed.");
for (int i = 0; i < 1000; i++) {
- CacheableKeyPtr keyPtr =
- dynCast<CacheableKeyPtr>(CacheableInt32::create(i));
+ auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
try {
LOGINFO("CPPTEST: destroying key %d with hashcode %d", i,
@@ -302,8 +299,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, CheckPrSingleHopForIntKeysTask_CLIENT2)
RegionPtr dataReg = getHelper()->getRegion(regionNames[0]);
for (int i = 0; i < 1000; i++) {
- CacheableKeyPtr keyPtr =
- dynCast<CacheableKeyPtr>(CacheableInt32::create(i));
+ auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
try {
LOGINFO("CPPTEST: Putting key %d with hashcode %d", i,
@@ -364,8 +360,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, CheckPrSingleHopForIntKeysTask_CLIENT2)
LOG("CheckPrSingleHopForIntKeysTask_CLIENT2 put completed.");
for (int i = 0; i < 1000; i++) {
- CacheableKeyPtr keyPtr =
- dynCast<CacheableKeyPtr>(CacheableInt32::create(i));
+ auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
try {
LOGINFO("CPPTEST: getting key %d with hashcode %d", i,
@@ -407,8 +402,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, CheckPrSingleHopForIntKeysTask_CLIENT2)
keys.push_back(CacheableInt32::create(j));
}
- HashMapOfCacheablePtr values(new HashMapOfCacheable());
- HashMapOfExceptionPtr exceptions(new HashMapOfException());
+ auto values = std::make_shared<HashMapOfCacheable>();
+ auto exceptions = std::make_shared<HashMapOfException>();
try {
dataReg->getAll(keys, values, exceptions, false);
@@ -446,8 +441,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, CheckPrSingleHopForIntKeysTask_CLIENT2)
LOG("CheckPrSingleHopForIntKeysTask_CLIENT2 getAll completed.");
for (int i = 0; i < 1000; i++) {
- CacheableKeyPtr keyPtr =
- dynCast<CacheableKeyPtr>(CacheableInt32::create(i));
+ auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
try {
LOGINFO("CPPTEST: destroying key %d with hashcode %d", i,
@@ -494,8 +488,7 @@ DUNIT_TASK_DEFINITION(CLIENT3, CheckPrSingleHopForIntKeysTask_CLIENT3)
RegionPtr dataReg = getHelper()->getRegion(regionNames[0]);
for (int i = 0; i < 1000; i++) {
- CacheableKeyPtr keyPtr =
- dynCast<CacheableKeyPtr>(CacheableInt32::create(i));
+ auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
try {
LOGINFO("CPPTEST: Putting key %d with hashcode %d", i,
@@ -556,8 +549,7 @@ DUNIT_TASK_DEFINITION(CLIENT3, CheckPrSingleHopForIntKeysTask_CLIENT3)
LOG("CheckPrSingleHopForIntKeysTask_CLIENT3 put completed.");
for (int i = 0; i < 1000; i++) {
- CacheableKeyPtr keyPtr =
- dynCast<CacheableKeyPtr>(CacheableInt32::create(i));
+ auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
try {
LOGINFO("CPPTEST: getting key %d with hashcode %d", i,
@@ -599,8 +591,8 @@ DUNIT_TASK_DEFINITION(CLIENT3, CheckPrSingleHopForIntKeysTask_CLIENT3)
keys.push_back(CacheableInt32::create(j));
}
- HashMapOfCacheablePtr values(new HashMapOfCacheable());
- HashMapOfExceptionPtr exceptions(new HashMapOfException());
+ auto values = std::make_shared<HashMapOfCacheable>();
+ auto exceptions = std::make_shared<HashMapOfException>();
try {
dataReg->getAll(keys, values, exceptions, false);
@@ -635,8 +627,7 @@ DUNIT_TASK_DEFINITION(CLIENT3, CheckPrSingleHopForIntKeysTask_CLIENT3)
LOG("CheckPrSingleHopForIntKeysTask_CLIENT3 getAll completed.");
for (int i = 0; i < 1000; i++) {
- CacheableKeyPtr keyPtr =
- dynCast<CacheableKeyPtr>(CacheableInt32::create(i));
+ auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
try {
LOGINFO("CPPTEST: destroying key %d with hashcode %d", i,
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientPartitionResolver.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientPartitionResolver.cpp b/src/cppcache/integration-test/testThinClientPartitionResolver.cpp
index cf89b10..d31a244 100644
--- a/src/cppcache/integration-test/testThinClientPartitionResolver.cpp
+++ b/src/cppcache/integration-test/testThinClientPartitionResolver.cpp
@@ -121,8 +121,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutThroughPartitionResolver)
for (int i = 0; i < 100; i++) {
// RegionPtr dataReg = getHelper()->getRegion("LocalRegion");
RegionPtr dataReg = getHelper()->getRegion(regionNames[0]);
- CacheableKeyPtr keyPtr =
- dynCast<CacheableKeyPtr>(CacheableInt32::create(i));
+ auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(CacheableInt32::create(i));
dataReg->put(keyPtr, keyPtr->hashcode());
}
SLEEP(5000);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientPdxDeltaWithNotification.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientPdxDeltaWithNotification.cpp b/src/cppcache/integration-test/testThinClientPdxDeltaWithNotification.cpp
index 925a978..56f56ef 100644
--- a/src/cppcache/integration-test/testThinClientPdxDeltaWithNotification.cpp
+++ b/src/cppcache/integration-test/testThinClientPdxDeltaWithNotification.cpp
@@ -85,7 +85,7 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators,
RegionPtr regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
@@ -114,9 +114,9 @@ void createRegion(const char* name, bool ackMode,
fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
fflush(stdout);
// ack, caching
- RegionPtr regPtr = getHelper()->createRegion(name, ackMode, true, NULLPTR,
+ RegionPtr regPtr = getHelper()->createRegion(name, ackMode, true, nullptr,
clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
@@ -223,7 +223,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1_PdxPut)
{
CacheableKeyPtr keyPtr = createKey(keys[0]);
PdxDeltaEx* ptr = new PdxDeltaEx();
- // CacheablePtr pdxobj(new PdxDeltaEx());
+ // auto pdxobj = std::make_shared<PdxDeltaEx>();
CacheablePtr valPtr(ptr);
RegionPtr regPtr = getHelper()->getRegion(regionNames[0]);
regPtr->put(keyPtr, valPtr);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientPdxEnum.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientPdxEnum.cpp b/src/cppcache/integration-test/testThinClientPdxEnum.cpp
index 48ebe87..8e957c2 100644
--- a/src/cppcache/integration-test/testThinClientPdxEnum.cpp
+++ b/src/cppcache/integration-test/testThinClientPdxEnum.cpp
@@ -80,9 +80,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, putPdxWithEnum)
LOG("putPdxWithEnum started ");
// Creating objects of type PdxEnumTestClass
- PdxEnumTestClassPtr pdxobj1(new PdxEnumTestClass(0));
- PdxEnumTestClassPtr pdxobj2(new PdxEnumTestClass(1));
- PdxEnumTestClassPtr pdxobj3(new PdxEnumTestClass(2));
+ auto pdxobj1 = std::make_shared<PdxEnumTestClass>(0);
+ auto pdxobj2 = std::make_shared<PdxEnumTestClass>(1);
+ auto pdxobj3 = std::make_shared<PdxEnumTestClass>(2);
RegionPtr rptr = getHelper()->getRegion("DistRegionAck");
@@ -114,25 +114,25 @@ DUNIT_TASK_DEFINITION(CLIENT1, pdxEnumQuery)
RegionPtr rptr = getHelper()->getRegion("DistRegionAck");
SelectResultsPtr results = rptr->query("m_enumid.name = 'id2'");
ASSERT(results->size() == 1, "query result should have one item");
- ResultSetPtr rsptr = dynCast<ResultSetPtr>(results);
+ auto rsptr = std::dynamic_pointer_cast<ResultSet>(results);
SelectResultsIterator iter = rsptr->getIterator();
while (iter.moveNext()) {
- PdxEnumTestClassPtr re = dynCast<PdxEnumTestClassPtr>(iter.current());
+ auto re = std::dynamic_pointer_cast<PdxEnumTestClass>(iter.current());
ASSERT(re->getID() == 1, "query should have return id 1");
}
QueryHelper* qh ATTR_UNUSED = &QueryHelper::getHelper();
- QueryServicePtr qs = NULLPTR;
+ QueryServicePtr qs = nullptr;
PoolPtr pool1 = findPool("__TEST_POOL1__");
qs = pool1->getQueryService();
QueryPtr qry = qs->newQuery(
"select distinct * from /DistRegionAck this where m_enumid.name = "
"'id3'");
results = qry->execute();
- rsptr = dynCast<ResultSetPtr>(results);
+ rsptr = std::dynamic_pointer_cast<ResultSet>(results);
SelectResultsIterator iter1 = rsptr->getIterator();
while (iter1.moveNext()) {
- PdxEnumTestClassPtr re = dynCast<PdxEnumTestClassPtr>(iter1.current());
+ auto re = std::dynamic_pointer_cast<PdxEnumTestClass>(iter1.current());
ASSERT(re->getID() == 2, "query should have return id 0");
}
[21/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from cppcache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testLRUList.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testLRUList.cpp b/src/cppcache/integration-test/testLRUList.cpp
index 8e24bd2..4bd3d83 100644
--- a/src/cppcache/integration-test/testLRUList.cpp
+++ b/src/cppcache/integration-test/testLRUList.cpp
@@ -37,7 +37,7 @@ using namespace test;
class MyNode : public SharedBase, public LRUEntryProperties {
public:
- static MyNode* create(const CacheableKeyPtr& key = NULLPTR) {
+ static MyNode* create(const CacheableKeyPtr& key = nullptr) {
return new MyNode();
}
virtual ~MyNode() {}
@@ -63,11 +63,11 @@ BEGIN_TEST(LRUListTest)
MyNodePtr* tenNodes = new MyNodePtr[10];
for (int i = 0; i < 10; i++) {
- tenNodes[i] = MyNode::create();
+ tenNodes[i] = std::shared_ptr<MyNode>(MyNode::create());
tenNodes[i]->setValue(i);
// add each node to list
lruList.appendEntry(tenNodes[i]);
- MyNodePtr myPtr = dynCast<MyNodePtr>(tenNodes[i]);
+ auto myPtr = std::dynamic_pointer_cast<MyNode>(tenNodes[i]);
cout << " appendEntry( " << myPtr->getValue() << " )" << endl;
}
@@ -111,18 +111,18 @@ BEGIN_TEST(TestEndOfList)
MyNodePtr nodePtr;
lruList.getLRUEntry(nodePtr);
sprintf(msgbuf, "expected node %d", k);
- ASSERT(dynCast<MyNodePtr>(nodePtr)->getValue() == k, msgbuf);
+ ASSERT(std::dynamic_pointer_cast<MyNode>(nodePtr)->getValue() == k, msgbuf);
k++;
}
// now list should be empty...
MyNodePtr emptyPtr;
lruList.getLRUEntry(emptyPtr);
- ASSERT(emptyPtr == NULLPTR, "expected NULL");
+ ASSERT(emptyPtr == nullptr, "expected NULL");
// do it again...
- emptyPtr = NULLPTR;
- ASSERT(emptyPtr == NULLPTR, "expected NULL");
+ emptyPtr = nullptr;
+ ASSERT(emptyPtr == nullptr, "expected NULL");
lruList.getLRUEntry(emptyPtr);
- ASSERT(emptyPtr == NULLPTR, "expected NULL");
+ ASSERT(emptyPtr == nullptr, "expected NULL");
// now add something to the list... and retest...
{
MyNodePtr tmp(MyNode::create());
@@ -131,11 +131,11 @@ BEGIN_TEST(TestEndOfList)
}
MyNodePtr hundredPtr;
lruList.getLRUEntry(hundredPtr);
- ASSERT(hundredPtr != NULLPTR, "expected to not be NULL");
- ASSERT(dynCast<MyNodePtr>(hundredPtr)->getValue() == 100,
+ ASSERT(hundredPtr != nullptr, "expected to not be NULL");
+ ASSERT(std::dynamic_pointer_cast<MyNode>(hundredPtr)->getValue() == 100,
"expected value of 100");
lruList.getLRUEntry(emptyPtr);
- ASSERT(emptyPtr == NULLPTR, "expected NULL");
+ ASSERT(emptyPtr == nullptr, "expected NULL");
}
END_TEST(TestEndOfList)
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testOverflowPutGetSqLite.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testOverflowPutGetSqLite.cpp b/src/cppcache/integration-test/testOverflowPutGetSqLite.cpp
index 8655796..a700a98 100644
--- a/src/cppcache/integration-test/testOverflowPutGetSqLite.cpp
+++ b/src/cppcache/integration-test/testOverflowPutGetSqLite.cpp
@@ -99,7 +99,7 @@ void checkOverflowTokenValues(RegionPtr& regionPtr, uint32_t num) {
nonoverflowCount++;
}
- valuePtr = NULLPTR;
+ valuePtr = nullptr;
}
ASSERT(count == 0, "No of overflowed entries should be zero");
ASSERT(nonoverflowCount == v.size(),
@@ -128,10 +128,10 @@ void checkOverflowToken(RegionPtr& regionPtr, uint32_t lruLimit) {
invalidCount++;
} else if (CacheableToken::isDestroyed(valuePtr)) {
destoyedCount++;
- } else if (valuePtr != NULLPTR) {
+ } else if (valuePtr != nullptr) {
normalCount++;
}
- valuePtr = NULLPTR;
+ valuePtr = nullptr;
}
printf("Keys vector size is %d\n", v.size());
printf("Normal entries count is %d\n", normalCount);
@@ -181,9 +181,8 @@ uint32_t doNgetLargeData(RegionPtr& regionPtr, int num) {
for (int i = 0; i < num; i++) {
printf("Getting key = %d\n", i);
- CacheableStringPtr valuePtr =
- dynCast<CacheableStringPtr>(regionPtr->get(i));
- if (valuePtr == NULLPTR) {
+ auto valuePtr = std::dynamic_pointer_cast<CacheableString>(regionPtr->get(i));
+ if (valuePtr == nullptr) {
countNotFound++;
} else {
countFound++;
@@ -201,10 +200,9 @@ uint32_t doNget(RegionPtr& regionPtr, uint32_t num, uint32_t start = 0) {
for (uint32_t i = start; i < num; i++) {
char keybuf[100];
sprintf(keybuf, "key-%d", i);
- CacheableStringPtr valuePtr =
- dynCast<CacheableStringPtr>(regionPtr->get(keybuf));
+ auto valuePtr = std::dynamic_pointer_cast<CacheableString>(regionPtr->get(keybuf));
printf("Getting key = %s\n", keybuf);
- if (valuePtr == NULLPTR) {
+ if (valuePtr == nullptr) {
countNotFound++;
} else {
countFound++;
@@ -286,16 +284,16 @@ void verifyGetAll(RegionPtr region, int startIndex) {
for (int i = 0; i <= 100; i++) keysVector.push_back(CacheableKey::create(i));
// keysVector.push_back(CacheableKey::create(101)); //key not there
- HashMapOfCacheablePtr valuesMap(new HashMapOfCacheable());
+ auto valuesMap = std::make_shared<HashMapOfCacheable>();
valuesMap->clear();
- region->getAll(keysVector, valuesMap, NULLPTR, false);
+ region->getAll(keysVector, valuesMap, nullptr, false);
if (valuesMap->size() == keysVector.size()) {
int i = startIndex;
for (HashMapOfCacheable::Iterator iter = valuesMap->begin();
iter != valuesMap->end(); iter++, i++) {
- CacheableKeyPtr key = dynCast<CacheableKeyPtr>(iter.first());
+ auto key = std::dynamic_pointer_cast<CacheableKey>(iter.first());
CacheablePtr mVal = iter.second();
- if (mVal != NULLPTR) {
+ if (mVal != nullptr) {
int val = atoi(mVal->toString()->asChar());
ASSERT(val == i, "value not matched");
}
@@ -308,7 +306,7 @@ void createRegion(RegionPtr& regionPtr, const char* regionName,
CacheFactoryPtr cacheFactoryPtr =
CacheFactory::createCacheFactory(cacheProps);
CachePtr cachePtr = CacheFactory::createCacheFactory()->create();
- ASSERT(cachePtr != NULLPTR, "Expected cache to be NON-NULL");
+ ASSERT(cachePtr != nullptr, "Expected cache to be NON-NULL");
RegionFactoryPtr regionFactoryPtr = cachePtr->createRegionFactory(LOCAL);
regionFactoryPtr->setCachingEnabled(true);
regionFactoryPtr->setLruEntriesLimit(10);
@@ -317,7 +315,7 @@ void createRegion(RegionPtr& regionPtr, const char* regionName,
regionFactoryPtr->setPersistenceManager("SqLiteImpl", "createSqLiteInstance",
sqLiteProps);
regionPtr = regionFactoryPtr->create(regionName);
- ASSERT(regionPtr != NULLPTR, "Expected regionPtr to be NON-NULL");
+ ASSERT(regionPtr != nullptr, "Expected regionPtr to be NON-NULL");
}
void setSqLiteProperties(PropertiesPtr& sqliteProperties,
@@ -327,7 +325,7 @@ void setSqLiteProperties(PropertiesPtr& sqliteProperties,
sqliteProperties->insert(MAX_PAGE_COUNT, maxPageCount);
sqliteProperties->insert(PAGE_SIZE, pageSize);
sqliteProperties->insert(PERSISTENCE_DIR, pDir.c_str());
- ASSERT(sqliteProperties != NULLPTR,
+ ASSERT(sqliteProperties != nullptr,
"Expected sqlite properties to be NON-NULL");
}
// creation of subregion.
@@ -337,7 +335,7 @@ void createSubRegion(RegionPtr& regionPtr, RegionPtr& subRegion,
RegionAttributesPtr regionAttributesPtr;
setAttributes(regionAttributesPtr, pDir);
subRegion = regionPtr->createSubregion(regionName, regionAttributesPtr);
- ASSERT(subRegion != NULLPTR, "Expected region to be NON-NULL");
+ ASSERT(subRegion != nullptr, "Expected region to be NON-NULL");
char fileName[512];
sprintf(fileName, "%s/%s/%s.db", pDir.c_str(), regionName, regionName);
ACE_stat fileStat;
@@ -356,7 +354,7 @@ BEGIN_TEST(OverFlowTest)
RegionPtr regionPtr;
createRegion(regionPtr, "OverFlowRegion", cacheProperties,
sqliteProperties);
- ASSERT(regionPtr != NULLPTR, "Expected regionPtr to be NON-NULL");
+ ASSERT(regionPtr != nullptr, "Expected regionPtr to be NON-NULL");
validateAttribute(regionPtr);
/** put some values into the cache. */
doNput(regionPtr, 50);
@@ -384,12 +382,12 @@ BEGIN_TEST(OverFlowTest)
RegionPtr subRegion;
for (int i = 0; i < 10; i++) {
createSubRegion(regionPtr, subRegion, "SubRegion");
- ASSERT(subRegion != NULLPTR, "Expected region to be NON-NULL");
+ ASSERT(subRegion != nullptr, "Expected region to be NON-NULL");
checkOverflowToken(subRegion,
10); // check the overflow count for each reion
subRegion->destroyRegion();
ASSERT(subRegion->isDestroyed(), "Expected region is not destroyed ");
- subRegion = NULLPTR;
+ subRegion = nullptr;
ACE_TCHAR hname[MAXHOSTNAMELEN];
ACE_OS::hostname(hname, sizeof(hname) - 1);
char sqliteDirSubRgn[512];
@@ -421,7 +419,7 @@ BEGIN_TEST(OverFlowTest_absPath)
RegionPtr regionPtr;
createRegion(regionPtr, "OverFlowRegion", cacheProperties,
sqliteProperties);
- ASSERT(regionPtr != NULLPTR, "Expected regionPtr to be NON-NULL");
+ ASSERT(regionPtr != nullptr, "Expected regionPtr to be NON-NULL");
validateAttribute(regionPtr);
/** put some values into the cache. */
@@ -449,10 +447,10 @@ BEGIN_TEST(OverFlowTest_absPath)
RegionPtr subRegion;
for (int i = 0; i < 10; i++) {
createSubRegion(regionPtr, subRegion, "SubRegion", absPersistenceDir);
- ASSERT(subRegion != NULLPTR, "Expected region to be NON-NULL");
+ ASSERT(subRegion != nullptr, "Expected region to be NON-NULL");
subRegion->destroyRegion();
ASSERT(subRegion->isDestroyed(), "Expected region is not destroyed ");
- subRegion = NULLPTR;
+ subRegion = nullptr;
char fileName[512];
sprintf(fileName, "%s/%s/%s.db", absPersistenceDir.c_str(), "SubRegion",
"SubRegion");
@@ -469,7 +467,7 @@ BEGIN_TEST(OverFlowTest_SqLiteFull)
{
CacheFactoryPtr cacheFactoryPtr = CacheFactory::createCacheFactory();
CachePtr cachePtr = CacheFactory::createCacheFactory()->create();
- ASSERT(cachePtr != NULLPTR, "Expected cache to be NON-NULL");
+ ASSERT(cachePtr != nullptr, "Expected cache to be NON-NULL");
RegionFactoryPtr regionFactoryPtr = cachePtr->createRegionFactory(LOCAL);
regionFactoryPtr->setCachingEnabled(true);
regionFactoryPtr->setLruEntriesLimit(1);
@@ -483,7 +481,7 @@ BEGIN_TEST(OverFlowTest_SqLiteFull)
regionFactoryPtr->setPersistenceManager(
"SqLiteImpl", "createSqLiteInstance", sqliteProperties);
RegionPtr regionPtr = regionFactoryPtr->create("OverFlowRegion");
- ASSERT(regionPtr != NULLPTR, "Expected regionPtr to be NON-NULL");
+ ASSERT(regionPtr != nullptr, "Expected regionPtr to be NON-NULL");
try {
doNput(regionPtr, 100);
@@ -514,8 +512,8 @@ END_TEST(OverFlowTest_SqLiteFull)
// CachePtr cachePtr ;
// PropertiesPtr pp = Properties::create();
// startDSandCreateCache(dsysPtr, cachePtr, pp);
-// ASSERT(dsysPtr != NULLPTR, "Expected dsys to be NON-NULL");
-// ASSERT(cachePtr != NULLPTR, "Expected cache to be NON-NULL");
+// ASSERT(dsysPtr != nullptr, "Expected dsys to be NON-NULL");
+// ASSERT(cachePtr != nullptr, "Expected cache to be NON-NULL");
//
// RegionAttributesPtr attrsPtr;
// AttributesFactory attrsFact;
@@ -531,11 +529,11 @@ END_TEST(OverFlowTest_SqLiteFull)
// attrsFact.setPersistenceManager("SqLiteImpl","createSqLiteInstance",sqliteProperties);
//
// attrsPtr = attrsFact.createRegionAttributes( );
-// ASSERT(attrsPtr != NULLPTR, "Expected region attributes to be NON-NULL");
+// ASSERT(attrsPtr != nullptr, "Expected region attributes to be NON-NULL");
//
// /** Create a region with caching and LRU. */
// RegionPtr regionPtr = cachePtr->createRegion( "OverFlowRegion", attrsPtr );
-// ASSERT(regionPtr != NULLPTR, "Expected regionPtr to be NON-NULL");
+// ASSERT(regionPtr != nullptr, "Expected regionPtr to be NON-NULL");
//
// /** put one million values into the cache. to test the large data values*/
// doNputLargeData(regionPtr, 1024 * 1); //arround 100 GB data
@@ -552,10 +550,10 @@ END_TEST(OverFlowTest_SqLiteFull)
// for(int i = 0; i<10; i++)
// {
// createSubRegion(regionPtr,subRegion,attrsPtr,"SubRegion");
-// ASSERT(subRegion != NULLPTR, "Expected region to be NON-NULL");
+// ASSERT(subRegion != nullptr, "Expected region to be NON-NULL");
// subRegion->destroyRegion();
// ASSERT(subRegion->isDestroyed(), "Expected region is not destroyed ");
-// subRegion = NULLPTR;
+// subRegion = nullptr;
// ACE_TCHAR hname[MAXHOSTNAMELEN];
// ACE_OS::hostname( hname, sizeof(hname)-1);
// char sqliteDirSubRgn[512];
@@ -582,7 +580,7 @@ BEGIN_TEST(OverFlowTest_HeapLRU)
pp->insert("heap-lru-delta", 10);
CacheFactoryPtr cacheFactoryPtr = CacheFactory::createCacheFactory(pp);
CachePtr cachePtr = CacheFactory::createCacheFactory()->create();
- ASSERT(cachePtr != NULLPTR, "Expected cache to be NON-NULL");
+ ASSERT(cachePtr != nullptr, "Expected cache to be NON-NULL");
RegionFactoryPtr regionFactoryPtr = cachePtr->createRegionFactory(LOCAL);
regionFactoryPtr->setCachingEnabled(true);
regionFactoryPtr->setLruEntriesLimit(1024 * 10);
@@ -597,7 +595,7 @@ BEGIN_TEST(OverFlowTest_HeapLRU)
regionFactoryPtr->setPersistenceManager(
"SqLiteImpl", "createSqLiteInstance", sqliteProperties);
RegionPtr regionPtr = regionFactoryPtr->create("OverFlowRegion");
- ASSERT(regionPtr != NULLPTR, "Expected regionPtr to be NON-NULL");
+ ASSERT(regionPtr != nullptr, "Expected regionPtr to be NON-NULL");
validateAttribute(regionPtr);
/** put some values into the cache. */
@@ -619,7 +617,7 @@ BEGIN_TEST(OverFlowTest_HeapLRU)
RegionAttributesPtr regionAttributesPtr;
setAttributes(regionAttributesPtr);
subRegion = regionPtr->createSubregion("SubRegion", regionAttributesPtr);
- ASSERT(subRegion != NULLPTR, "Expected region to be NON-NULL");
+ ASSERT(subRegion != nullptr, "Expected region to be NON-NULL");
char fileName[512];
sprintf(fileName, "%s/%s/%s.db", sqlite_dir.c_str(), "SubRegion",
"SubRegion");
@@ -630,7 +628,7 @@ BEGIN_TEST(OverFlowTest_HeapLRU)
doNget(subRegion, 50);
subRegion->destroyRegion();
ASSERT(subRegion->isDestroyed(), "Expected region is not destroyed ");
- subRegion = NULLPTR;
+ subRegion = nullptr;
ASSERT(ACE_OS::stat(fileName, &fileStat) == -1,
"persistence file still present");
}
@@ -643,17 +641,17 @@ BEGIN_TEST(OverFlowTest_MultiThreaded)
{
/** Creating a cache to manage regions. */
CachePtr cachePtr = CacheFactory::createCacheFactory()->create();
- ASSERT(cachePtr != NULLPTR, "Expected cache to be NON-NULL");
+ ASSERT(cachePtr != nullptr, "Expected cache to be NON-NULL");
RegionAttributesPtr attrsPtr;
setAttributes(attrsPtr);
- ASSERT(attrsPtr != NULLPTR, "Expected region attributes to be NON-NULL");
+ ASSERT(attrsPtr != nullptr, "Expected region attributes to be NON-NULL");
/** Create a region with caching and LRU. */
RegionPtr regionPtr;
- CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cachePtr.ptr());
+ CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cachePtr.get());
cacheImpl->createRegion("OverFlowRegion", attrsPtr, regionPtr);
- ASSERT(regionPtr != NULLPTR, "Expected regionPtr to be NON-NULL");
+ ASSERT(regionPtr != nullptr, "Expected regionPtr to be NON-NULL");
validateAttribute(regionPtr);
/** test to verify same region repeatedly to ensure that the persistece
@@ -684,17 +682,17 @@ BEGIN_TEST(OverFlowTest_PutGetAll)
{
/** Creating a cache to manage regions. */
CachePtr cachePtr = CacheFactory::createCacheFactory()->create();
- ASSERT(cachePtr != NULLPTR, "Expected cache to be NON-NULL");
+ ASSERT(cachePtr != nullptr, "Expected cache to be NON-NULL");
RegionAttributesPtr attrsPtr;
setAttributes(attrsPtr);
- ASSERT(attrsPtr != NULLPTR, "Expected region attributes to be NON-NULL");
+ ASSERT(attrsPtr != nullptr, "Expected region attributes to be NON-NULL");
/** Create a region with caching and LRU. */
RegionPtr regionPtr;
- CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cachePtr.ptr());
+ CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cachePtr.get());
cacheImpl->createRegion("OverFlowRegion", attrsPtr, regionPtr);
- ASSERT(regionPtr != NULLPTR, "Expected regionPtr to be NON-NULL");
+ ASSERT(regionPtr != nullptr, "Expected regionPtr to be NON-NULL");
validateAttribute(regionPtr);
// putAll some entries
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testRegionAccessThreadSafe.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testRegionAccessThreadSafe.cpp b/src/cppcache/integration-test/testRegionAccessThreadSafe.cpp
index 35fdc8f..1b5af27 100644
--- a/src/cppcache/integration-test/testRegionAccessThreadSafe.cpp
+++ b/src/cppcache/integration-test/testRegionAccessThreadSafe.cpp
@@ -42,7 +42,7 @@ class GetRegionThread : public ACE_Task_Base {
SLEEP(40);
try {
RegionPtr rptr = getHelper()->getRegion(m_path.c_str());
- if (rptr != NULLPTR) {
+ if (rptr != nullptr) {
ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_mutex);
ASSERT(m_regionCreateDone == true, "regionCreate Not Done");
}
@@ -58,7 +58,7 @@ class GetRegionThread : public ACE_Task_Base {
}
try {
RegionPtr rptr = getHelper()->getRegion(m_subPath.c_str());
- if (rptr != NULLPTR) {
+ if (rptr != nullptr) {
ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_mutex);
ASSERT(m_subRegionCreateDone == true, "subRegionCreate Not Done");
return 0;
@@ -111,7 +111,7 @@ ENDTASK
DUNIT_TASK(s2p2, CreateNormalRegion)
{
initClientWithPool(true, "__TEST_POOL1__", locHostPort, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
LOG("create normal region");
getThread =
new GetRegionThread("DistRegionAck", "DistRegionAck/AuthSubregion");
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testRegionMap.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testRegionMap.cpp b/src/cppcache/integration-test/testRegionMap.cpp
index c3c4255..df268b2 100644
--- a/src/cppcache/integration-test/testRegionMap.cpp
+++ b/src/cppcache/integration-test/testRegionMap.cpp
@@ -70,7 +70,7 @@ BEGIN_TEST(TestRegionLRULastTen)
int total = 0;
for (int k = 10; k < 20; k++) {
expected += k;
- CacheableStringPtr key = dynCast<CacheableStringPtr>(vecKeys.back());
+ auto key = std::dynamic_pointer_cast<CacheableString>(vecKeys.back());
vecKeys.pop_back();
total += atoi(key->asChar());
}
@@ -151,8 +151,8 @@ BEGIN_TEST(TestRecentlyUsedBit)
sprintf(buf, "%d", 15);
CacheableStringPtr value2Ptr;
CacheableKeyPtr key2 = CacheableKey::create(buf);
- value2Ptr = dynCast<CacheableStringPtr>(regionPtr->get(key2));
- ASSERT(value2Ptr != NULLPTR, "expected to find key 15 in cache.");
+ value2Ptr = std::dynamic_pointer_cast<CacheableString>(regionPtr->get(key2));
+ ASSERT(value2Ptr != nullptr, "expected to find key 15 in cache.");
for (i = 20; i < 35; i++) {
sprintf(buf, "%d", i);
CacheableKeyPtr key = CacheableKey::create(buf);
@@ -201,7 +201,7 @@ BEGIN_TEST(TestEmptiedMap)
sprintf(buf, "%d", i);
CacheableKeyPtr key = CacheableKey::create(buf);
regionPtr->destroy(key);
- cout << "removed key " << dynCast<CacheableStringPtr>(key)->asChar()
+ cout << "removed key " << std::dynamic_pointer_cast<CacheableString>(key)->asChar()
<< endl;
}
VectorOfCacheableKey vecKeys;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testRegionTemplateArgs.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testRegionTemplateArgs.cpp b/src/cppcache/integration-test/testRegionTemplateArgs.cpp
index 523f80e..457825c 100644
--- a/src/cppcache/integration-test/testRegionTemplateArgs.cpp
+++ b/src/cppcache/integration-test/testRegionTemplateArgs.cpp
@@ -24,7 +24,7 @@
using namespace apache::geode::client;
bool CheckBytesEqual(CacheableBytesPtr result, CacheablePtr expected) {
- CacheableBytesPtr expectedPtr = dynCast<CacheableBytesPtr>(expected);
+ auto expectedPtr = std::dynamic_pointer_cast<CacheableBytes>(expected);
// Assume that the bytes are really a char*
return (strcmp((char*)result->value(), (char*)expectedPtr->value()) == 0);
}
@@ -39,7 +39,7 @@ BEGIN_TEST(CheckTemplates)
AttributesFactory afact;
RegionAttributesPtr attrs = afact.createRegionAttributes();
RegionPtr regPtr;
- CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cache.ptr());
+ CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cache.get());
cacheImpl->createRegion("TestRegion", attrs, regPtr);
const char charKey[] = "test key";
@@ -74,19 +74,19 @@ BEGIN_TEST(CheckTemplates)
regPtr->put(charKey, valPtr);
regPtr->put(intKey, valPtr);
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(keyPtr));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(keyPtr));
ASSERT(CheckBytesEqual(resValPtr, valPtr),
"put/get:: incorrect valPtr value");
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(stringPtr));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(stringPtr));
ASSERT(CheckBytesEqual(resValPtr, valPtr),
"put/get:: incorrect valPtr value");
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(int32Ptr));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(int32Ptr));
ASSERT(CheckBytesEqual(resValPtr, valPtr),
"put/get:: incorrect valPtr value");
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(intKey));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(intKey));
ASSERT(CheckBytesEqual(resValPtr, valPtr),
"put/get:: incorrect valPtr value");
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(charKey));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(charKey));
ASSERT(CheckBytesEqual(resValPtr, valPtr),
"put/get:: incorrect valPtr value");
@@ -100,19 +100,19 @@ BEGIN_TEST(CheckTemplates)
regPtr->put(charKey, bytesPtr);
regPtr->put(intKey, bytesPtr);
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(keyPtr));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(keyPtr));
ASSERT(CheckBytesEqual(resValPtr, bytesPtr),
"put/get:: incorrect bytesPtr value");
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(stringPtr));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(stringPtr));
ASSERT(CheckBytesEqual(resValPtr, bytesPtr),
"put/get:: incorrect bytesPtr value");
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(int32Ptr));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(int32Ptr));
ASSERT(CheckBytesEqual(resValPtr, bytesPtr),
"put/get:: incorrect bytesPtr value");
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(intKey));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(intKey));
ASSERT(CheckBytesEqual(resValPtr, bytesPtr),
"put/get:: incorrect bytesPtr value");
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(charKey));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(charKey));
ASSERT(CheckBytesEqual(resValPtr, bytesPtr),
"put/get:: incorrect bytesPtr value");
@@ -126,20 +126,20 @@ BEGIN_TEST(CheckTemplates)
regPtr->put(charKey, stringPtr);
regPtr->put(intKey, stringPtr);
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
- ASSERT(resStringPtr.ptr() == stringPtr.ptr(),
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
+ ASSERT(resStringPtr.get() == stringPtr.get(),
"put/get:: incorrect stringPtr value");
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(stringPtr));
- ASSERT(resStringPtr.ptr() == stringPtr.ptr(),
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(stringPtr));
+ ASSERT(resStringPtr.get() == stringPtr.get(),
"put/get:: incorrect stringPtr value");
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(int32Ptr));
- ASSERT(resStringPtr.ptr() == stringPtr.ptr(),
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(int32Ptr));
+ ASSERT(resStringPtr.get() == stringPtr.get(),
"put/get:: incorrect stringPtr value");
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(intKey));
- ASSERT(resStringPtr.ptr() == stringPtr.ptr(),
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(intKey));
+ ASSERT(resStringPtr.get() == stringPtr.get(),
"put/get:: incorrect stringPtr value");
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(charKey));
- ASSERT(resStringPtr.ptr() == stringPtr.ptr(),
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(charKey));
+ ASSERT(resStringPtr.get() == stringPtr.get(),
"put/get:: incorrect stringPtr value");
// End with stringPtr
@@ -152,20 +152,20 @@ BEGIN_TEST(CheckTemplates)
regPtr->put(charKey, int32Ptr);
regPtr->put(intKey, int32Ptr);
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(keyPtr));
- ASSERT(resInt32Ptr.ptr() == int32Ptr.ptr(),
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(keyPtr));
+ ASSERT(resInt32Ptr.get() == int32Ptr.get(),
"put/get:: incorrect int32Ptr value");
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(stringPtr));
- ASSERT(resInt32Ptr.ptr() == int32Ptr.ptr(),
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(stringPtr));
+ ASSERT(resInt32Ptr.get() == int32Ptr.get(),
"put/get:: incorrect int32Ptr value");
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(int32Ptr));
- ASSERT(resInt32Ptr.ptr() == int32Ptr.ptr(),
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(int32Ptr));
+ ASSERT(resInt32Ptr.get() == int32Ptr.get(),
"put/get:: incorrect int32Ptr value");
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(intKey));
- ASSERT(resInt32Ptr.ptr() == int32Ptr.ptr(),
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(intKey));
+ ASSERT(resInt32Ptr.get() == int32Ptr.get(),
"put/get:: incorrect int32Ptr value");
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(charKey));
- ASSERT(resInt32Ptr.ptr() == int32Ptr.ptr(),
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(charKey));
+ ASSERT(resInt32Ptr.get() == int32Ptr.get(),
"put/get:: incorrect int32Ptr value");
// End with int32Ptr
@@ -178,19 +178,19 @@ BEGIN_TEST(CheckTemplates)
regPtr->put(charKey, charVal);
regPtr->put(intKey, charVal);
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
ASSERT(strcmp(resStringPtr->asChar(), charVal) == 0,
"put/get:: incorrect charVal value");
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(stringPtr));
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(stringPtr));
ASSERT(strcmp(resStringPtr->asChar(), charVal) == 0,
"put/get:: incorrect charVal value");
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(int32Ptr));
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(int32Ptr));
ASSERT(strcmp(resStringPtr->asChar(), charVal) == 0,
"put/get:: incorrect charVal value");
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(intKey));
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(intKey));
ASSERT(strcmp(resStringPtr->asChar(), charVal) == 0,
"put/get:: incorrect charVal value");
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(charKey));
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(charKey));
ASSERT(strcmp(resStringPtr->asChar(), charVal) == 0,
"put/get:: incorrect charVal value");
@@ -204,15 +204,15 @@ BEGIN_TEST(CheckTemplates)
regPtr->put(charKey, intVal);
regPtr->put(intKey, intVal);
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(keyPtr));
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(keyPtr));
ASSERT(resInt32Ptr->value() == intVal, "put/get:: incorrect intVal value");
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(stringPtr));
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(stringPtr));
ASSERT(resInt32Ptr->value() == intVal, "put/get:: incorrect intVal value");
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(int32Ptr));
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(int32Ptr));
ASSERT(resInt32Ptr->value() == intVal, "put/get:: incorrect intVal value");
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(intKey));
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(intKey));
ASSERT(resInt32Ptr->value() == intVal, "put/get:: incorrect intVal value");
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(charKey));
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(charKey));
ASSERT(resInt32Ptr->value() == intVal, "put/get:: incorrect intVal value");
// End with intVal
@@ -236,19 +236,19 @@ BEGIN_TEST(CheckTemplates)
regPtr->create(charKey, valPtr);
regPtr->create(intKey, valPtr);
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(keyPtr));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(keyPtr));
ASSERT(CheckBytesEqual(resValPtr, valPtr),
"create/get/localDestroy:: incorrect valPtr value");
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(stringPtr));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(stringPtr));
ASSERT(CheckBytesEqual(resValPtr, valPtr),
"create/get/localDestroy:: incorrect valPtr value");
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(int32Ptr));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(int32Ptr));
ASSERT(CheckBytesEqual(resValPtr, valPtr),
"create/get/localDestroy:: incorrect valPtr value");
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(intKey));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(intKey));
ASSERT(CheckBytesEqual(resValPtr, valPtr),
"create/get/localDestroy:: incorrect valPtr value");
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(charKey));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(charKey));
ASSERT(CheckBytesEqual(resValPtr, valPtr),
"create/get/localDestroy:: incorrect valPtr value");
@@ -303,19 +303,19 @@ BEGIN_TEST(CheckTemplates)
regPtr->create(charKey, bytesPtr);
regPtr->create(intKey, bytesPtr);
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(keyPtr));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(keyPtr));
ASSERT(CheckBytesEqual(resValPtr, bytesPtr),
"create/get/localDestroy:: incorrect bytesPtr value");
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(stringPtr));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(stringPtr));
ASSERT(CheckBytesEqual(resValPtr, bytesPtr),
"create/get/localDestroy:: incorrect bytesPtr value");
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(int32Ptr));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(int32Ptr));
ASSERT(CheckBytesEqual(resValPtr, bytesPtr),
"create/get/localDestroy:: incorrect bytesPtr value");
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(intKey));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(intKey));
ASSERT(CheckBytesEqual(resValPtr, bytesPtr),
"create/get/localDestroy:: incorrect bytesPtr value");
- resValPtr = dynCast<CacheableBytesPtr>(regPtr->get(charKey));
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(charKey));
ASSERT(CheckBytesEqual(resValPtr, bytesPtr),
"create/get/localDestroy:: incorrect bytesPtr value");
@@ -370,20 +370,20 @@ BEGIN_TEST(CheckTemplates)
regPtr->create(charKey, stringPtr);
regPtr->create(intKey, stringPtr);
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
- ASSERT(resStringPtr.ptr() == stringPtr.ptr(),
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
+ ASSERT(resStringPtr.get() == stringPtr.get(),
"create/get/localDestroy:: incorrect stringPtr value");
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(stringPtr));
- ASSERT(resStringPtr.ptr() == stringPtr.ptr(),
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(stringPtr));
+ ASSERT(resStringPtr.get() == stringPtr.get(),
"create/get/localDestroy:: incorrect stringPtr value");
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(int32Ptr));
- ASSERT(resStringPtr.ptr() == stringPtr.ptr(),
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(int32Ptr));
+ ASSERT(resStringPtr.get() == stringPtr.get(),
"create/get/localDestroy:: incorrect stringPtr value");
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(intKey));
- ASSERT(resStringPtr.ptr() == stringPtr.ptr(),
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(intKey));
+ ASSERT(resStringPtr.get() == stringPtr.get(),
"create/get/localDestroy:: incorrect stringPtr value");
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(charKey));
- ASSERT(resStringPtr.ptr() == stringPtr.ptr(),
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(charKey));
+ ASSERT(resStringPtr.get() == stringPtr.get(),
"create/get/localDestroy:: incorrect stringPtr value");
regPtr->localInvalidate(keyPtr);
@@ -437,20 +437,20 @@ BEGIN_TEST(CheckTemplates)
regPtr->create(charKey, int32Ptr);
regPtr->create(intKey, int32Ptr);
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(keyPtr));
- ASSERT(resInt32Ptr.ptr() == int32Ptr.ptr(),
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(keyPtr));
+ ASSERT(resInt32Ptr.get() == int32Ptr.get(),
"create/get/localDestroy:: incorrect int32Ptr value");
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(stringPtr));
- ASSERT(resInt32Ptr.ptr() == int32Ptr.ptr(),
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(stringPtr));
+ ASSERT(resInt32Ptr.get() == int32Ptr.get(),
"create/get/localDestroy:: incorrect int32Ptr value");
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(int32Ptr));
- ASSERT(resInt32Ptr.ptr() == int32Ptr.ptr(),
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(int32Ptr));
+ ASSERT(resInt32Ptr.get() == int32Ptr.get(),
"create/get/localDestroy:: incorrect int32Ptr value");
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(intKey));
- ASSERT(resInt32Ptr.ptr() == int32Ptr.ptr(),
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(intKey));
+ ASSERT(resInt32Ptr.get() == int32Ptr.get(),
"create/get/localDestroy:: incorrect int32Ptr value");
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(charKey));
- ASSERT(resInt32Ptr.ptr() == int32Ptr.ptr(),
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(charKey));
+ ASSERT(resInt32Ptr.get() == int32Ptr.get(),
"create/get/localDestroy:: incorrect int32Ptr value");
regPtr->localInvalidate(keyPtr);
@@ -504,19 +504,19 @@ BEGIN_TEST(CheckTemplates)
regPtr->create(charKey, charVal);
regPtr->create(intKey, charVal);
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
ASSERT(strcmp(resStringPtr->asChar(), charVal) == 0,
"create/get/localDestroy:: incorrect charVal value");
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(stringPtr));
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(stringPtr));
ASSERT(strcmp(resStringPtr->asChar(), charVal) == 0,
"create/get/localDestroy:: incorrect charVal value");
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(int32Ptr));
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(int32Ptr));
ASSERT(strcmp(resStringPtr->asChar(), charVal) == 0,
"create/get/localDestroy:: incorrect charVal value");
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(intKey));
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(intKey));
ASSERT(strcmp(resStringPtr->asChar(), charVal) == 0,
"create/get/localDestroy:: incorrect charVal value");
- resStringPtr = dynCast<CacheableStringPtr>(regPtr->get(charKey));
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(charKey));
ASSERT(strcmp(resStringPtr->asChar(), charVal) == 0,
"create/get/localDestroy:: incorrect charVal value");
@@ -571,19 +571,19 @@ BEGIN_TEST(CheckTemplates)
regPtr->create(charKey, intVal);
regPtr->create(intKey, intVal);
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(keyPtr));
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(keyPtr));
ASSERT(resInt32Ptr->value() == intVal,
"create/get/localDestroy:: incorrect intVal value");
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(stringPtr));
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(stringPtr));
ASSERT(resInt32Ptr->value() == intVal,
"create/get/localDestroy:: incorrect intVal value");
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(int32Ptr));
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(int32Ptr));
ASSERT(resInt32Ptr->value() == intVal,
"create/get/localDestroy:: incorrect intVal value");
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(intKey));
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(intKey));
ASSERT(resInt32Ptr->value() == intVal,
"create/get/localDestroy:: incorrect intVal value");
- resInt32Ptr = dynCast<CacheableInt32Ptr>(regPtr->get(charKey));
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(charKey));
ASSERT(resInt32Ptr->value() == intVal,
"create/get/localDestroy:: incorrect intVal value");
@@ -644,23 +644,23 @@ BEGIN_TEST(CheckTemplates)
regPtr->create(intKey, valPtr);
resEntryPtr = regPtr->getEntry(keyPtr);
- resValPtr = dynCast<CacheableBytesPtr>(resEntryPtr->getValue());
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(resEntryPtr->getValue());
ASSERT(CheckBytesEqual(resValPtr, valPtr),
"create/getEntry/destroy:: incorrect valPtr value");
resEntryPtr = regPtr->getEntry(stringPtr);
- resValPtr = dynCast<CacheableBytesPtr>(resEntryPtr->getValue());
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(resEntryPtr->getValue());
ASSERT(CheckBytesEqual(resValPtr, valPtr),
"create/getEntry/destroy:: incorrect valPtr value");
resEntryPtr = regPtr->getEntry(int32Ptr);
- resValPtr = dynCast<CacheableBytesPtr>(resEntryPtr->getValue());
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(resEntryPtr->getValue());
ASSERT(CheckBytesEqual(resValPtr, valPtr),
"create/getEntry/destroy:: incorrect valPtr value");
resEntryPtr = regPtr->getEntry(charKey);
- resValPtr = dynCast<CacheableBytesPtr>(resEntryPtr->getValue());
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(resEntryPtr->getValue());
ASSERT(CheckBytesEqual(resValPtr, valPtr),
"create/getEntry/destroy:: incorrect valPtr value");
resEntryPtr = regPtr->getEntry(intKey);
- resValPtr = dynCast<CacheableBytesPtr>(resEntryPtr->getValue());
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(resEntryPtr->getValue());
ASSERT(CheckBytesEqual(resValPtr, valPtr),
"create/getEntry/destroy:: incorrect valPtr value");
@@ -716,23 +716,23 @@ BEGIN_TEST(CheckTemplates)
regPtr->create(intKey, bytesPtr);
resEntryPtr = regPtr->getEntry(keyPtr);
- resValPtr = dynCast<CacheableBytesPtr>(resEntryPtr->getValue());
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(resEntryPtr->getValue());
ASSERT(CheckBytesEqual(resValPtr, bytesPtr),
"create/getEntry/destroy:: incorrect bytesPtr value");
resEntryPtr = regPtr->getEntry(stringPtr);
- resValPtr = dynCast<CacheableBytesPtr>(resEntryPtr->getValue());
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(resEntryPtr->getValue());
ASSERT(CheckBytesEqual(resValPtr, bytesPtr),
"create/getEntry/destroy:: incorrect bytesPtr value");
resEntryPtr = regPtr->getEntry(int32Ptr);
- resValPtr = dynCast<CacheableBytesPtr>(resEntryPtr->getValue());
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(resEntryPtr->getValue());
ASSERT(CheckBytesEqual(resValPtr, bytesPtr),
"create/getEntry/destroy:: incorrect bytesPtr value");
resEntryPtr = regPtr->getEntry(charKey);
- resValPtr = dynCast<CacheableBytesPtr>(resEntryPtr->getValue());
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(resEntryPtr->getValue());
ASSERT(CheckBytesEqual(resValPtr, bytesPtr),
"create/getEntry/destroy:: incorrect bytesPtr value");
resEntryPtr = regPtr->getEntry(intKey);
- resValPtr = dynCast<CacheableBytesPtr>(resEntryPtr->getValue());
+ resValPtr = std::dynamic_pointer_cast<CacheableBytes>(resEntryPtr->getValue());
ASSERT(CheckBytesEqual(resValPtr, bytesPtr),
"create/getEntry/destroy:: incorrect bytesPtr value");
@@ -788,24 +788,24 @@ BEGIN_TEST(CheckTemplates)
regPtr->create(intKey, stringPtr);
resEntryPtr = regPtr->getEntry(keyPtr);
- resStringPtr = dynCast<CacheableStringPtr>(resEntryPtr->getValue());
- ASSERT(resStringPtr.ptr() == stringPtr.ptr(),
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(resEntryPtr->getValue());
+ ASSERT(resStringPtr.get() == stringPtr.get(),
"create/getEntry/destroy:: incorrect stringPtr value");
resEntryPtr = regPtr->getEntry(stringPtr);
- resStringPtr = dynCast<CacheableStringPtr>(resEntryPtr->getValue());
- ASSERT(resStringPtr.ptr() == stringPtr.ptr(),
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(resEntryPtr->getValue());
+ ASSERT(resStringPtr.get() == stringPtr.get(),
"create/getEntry/destroy:: incorrect stringPtr value");
resEntryPtr = regPtr->getEntry(int32Ptr);
- resStringPtr = dynCast<CacheableStringPtr>(resEntryPtr->getValue());
- ASSERT(resStringPtr.ptr() == stringPtr.ptr(),
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(resEntryPtr->getValue());
+ ASSERT(resStringPtr.get() == stringPtr.get(),
"create/getEntry/destroy:: incorrect stringPtr value");
resEntryPtr = regPtr->getEntry(intKey);
- resStringPtr = dynCast<CacheableStringPtr>(resEntryPtr->getValue());
- ASSERT(resStringPtr.ptr() == stringPtr.ptr(),
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(resEntryPtr->getValue());
+ ASSERT(resStringPtr.get() == stringPtr.get(),
"create/getEntry/destroy:: incorrect stringPtr value");
resEntryPtr = regPtr->getEntry(charKey);
- resStringPtr = dynCast<CacheableStringPtr>(resEntryPtr->getValue());
- ASSERT(resStringPtr.ptr() == stringPtr.ptr(),
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(resEntryPtr->getValue());
+ ASSERT(resStringPtr.get() == stringPtr.get(),
"create/getEntry/destroy:: incorrect stringPtr value");
regPtr->invalidate(keyPtr);
@@ -860,24 +860,24 @@ BEGIN_TEST(CheckTemplates)
regPtr->create(intKey, int32Ptr);
resEntryPtr = regPtr->getEntry(keyPtr);
- resInt32Ptr = dynCast<CacheableInt32Ptr>(resEntryPtr->getValue());
- ASSERT(resInt32Ptr.ptr() == int32Ptr.ptr(),
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(resEntryPtr->getValue());
+ ASSERT(resInt32Ptr.get() == int32Ptr.get(),
"create/getEntry/destroy:: incorrect int32Ptr value");
resEntryPtr = regPtr->getEntry(stringPtr);
- resInt32Ptr = dynCast<CacheableInt32Ptr>(resEntryPtr->getValue());
- ASSERT(resInt32Ptr.ptr() == int32Ptr.ptr(),
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(resEntryPtr->getValue());
+ ASSERT(resInt32Ptr.get() == int32Ptr.get(),
"create/getEntry/destroy:: incorrect int32Ptr value");
resEntryPtr = regPtr->getEntry(int32Ptr);
- resInt32Ptr = dynCast<CacheableInt32Ptr>(resEntryPtr->getValue());
- ASSERT(resInt32Ptr.ptr() == int32Ptr.ptr(),
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(resEntryPtr->getValue());
+ ASSERT(resInt32Ptr.get() == int32Ptr.get(),
"create/getEntry/destroy:: incorrect int32Ptr value");
resEntryPtr = regPtr->getEntry(intKey);
- resInt32Ptr = dynCast<CacheableInt32Ptr>(resEntryPtr->getValue());
- ASSERT(resInt32Ptr.ptr() == int32Ptr.ptr(),
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(resEntryPtr->getValue());
+ ASSERT(resInt32Ptr.get() == int32Ptr.get(),
"create/getEntry/destroy:: incorrect int32Ptr value");
resEntryPtr = regPtr->getEntry(charKey);
- resInt32Ptr = dynCast<CacheableInt32Ptr>(resEntryPtr->getValue());
- ASSERT(resInt32Ptr.ptr() == int32Ptr.ptr(),
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(resEntryPtr->getValue());
+ ASSERT(resInt32Ptr.get() == int32Ptr.get(),
"create/getEntry/destroy:: incorrect int32Ptr value");
regPtr->invalidate(keyPtr);
@@ -932,23 +932,23 @@ BEGIN_TEST(CheckTemplates)
regPtr->create(intKey, charVal);
resEntryPtr = regPtr->getEntry(keyPtr);
- resStringPtr = dynCast<CacheableStringPtr>(resEntryPtr->getValue());
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(resEntryPtr->getValue());
ASSERT(strcmp(resStringPtr->asChar(), charVal) == 0,
"create/getEntry/destroy:: incorrect charVal value");
resEntryPtr = regPtr->getEntry(stringPtr);
- resStringPtr = dynCast<CacheableStringPtr>(resEntryPtr->getValue());
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(resEntryPtr->getValue());
ASSERT(strcmp(resStringPtr->asChar(), charVal) == 0,
"create/getEntry/destroy:: incorrect charVal value");
resEntryPtr = regPtr->getEntry(int32Ptr);
- resStringPtr = dynCast<CacheableStringPtr>(resEntryPtr->getValue());
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(resEntryPtr->getValue());
ASSERT(strcmp(resStringPtr->asChar(), charVal) == 0,
"create/getEntry/destroy:: incorrect charVal value");
resEntryPtr = regPtr->getEntry(intKey);
- resStringPtr = dynCast<CacheableStringPtr>(resEntryPtr->getValue());
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(resEntryPtr->getValue());
ASSERT(strcmp(resStringPtr->asChar(), charVal) == 0,
"create/getEntry/destroy:: incorrect charVal value");
resEntryPtr = regPtr->getEntry(charKey);
- resStringPtr = dynCast<CacheableStringPtr>(resEntryPtr->getValue());
+ resStringPtr = std::dynamic_pointer_cast<CacheableString>(resEntryPtr->getValue());
ASSERT(strcmp(resStringPtr->asChar(), charVal) == 0,
"create/getEntry/destroy:: incorrect charVal value");
@@ -1004,23 +1004,23 @@ BEGIN_TEST(CheckTemplates)
regPtr->create(intKey, intVal);
resEntryPtr = regPtr->getEntry(keyPtr);
- resInt32Ptr = dynCast<CacheableInt32Ptr>(resEntryPtr->getValue());
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(resEntryPtr->getValue());
ASSERT(resInt32Ptr->value() == intVal,
"create/getEntry/destroy:: incorrect intVal value");
resEntryPtr = regPtr->getEntry(stringPtr);
- resInt32Ptr = dynCast<CacheableInt32Ptr>(resEntryPtr->getValue());
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(resEntryPtr->getValue());
ASSERT(resInt32Ptr->value() == intVal,
"create/getEntry/destroy:: incorrect intVal value");
resEntryPtr = regPtr->getEntry(int32Ptr);
- resInt32Ptr = dynCast<CacheableInt32Ptr>(resEntryPtr->getValue());
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(resEntryPtr->getValue());
ASSERT(resInt32Ptr->value() == intVal,
"create/getEntry/destroy:: incorrect intVal value");
resEntryPtr = regPtr->getEntry(intKey);
- resInt32Ptr = dynCast<CacheableInt32Ptr>(resEntryPtr->getValue());
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(resEntryPtr->getValue());
ASSERT(resInt32Ptr->value() == intVal,
"create/getEntry/destroy:: incorrect intVal value");
resEntryPtr = regPtr->getEntry(charKey);
- resInt32Ptr = dynCast<CacheableInt32Ptr>(resEntryPtr->getValue());
+ resInt32Ptr = std::dynamic_pointer_cast<CacheableInt32>(resEntryPtr->getValue());
ASSERT(resInt32Ptr->value() == intVal,
"create/getEntry/destroy:: incorrect intVal value");
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testSerialization.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testSerialization.cpp b/src/cppcache/integration-test/testSerialization.cpp
index 07782e9..608ccb8 100644
--- a/src/cppcache/integration-test/testSerialization.cpp
+++ b/src/cppcache/integration-test/testSerialization.cpp
@@ -32,6 +32,7 @@
#include <CppCacheLibrary.hpp>
#include "CacheHelper.hpp"
+#include <memory>
using namespace apache::geode::client;
@@ -51,7 +52,7 @@ SharedPtr<T> duplicate(const SharedPtr<T>& orig) {
uint32_t length = 0;
const uint8_t* buffer = dout.getBuffer(&length);
DataInput din(buffer, length);
- result = static_cast<T*>(SerializationRegistry::deserialize(din).ptr());
+ result = std::static_pointer_cast<T>(SerializationRegistry::deserialize(din));
// din.readObject(result);
return result;
@@ -129,8 +130,8 @@ class OtherType : public Serializable {
char logmsg[1000];
sprintf(logmsg, "validateCT for %d", i);
LOG(logmsg);
- XASSERT(otPtr != NULLPTR);
- OtherType* ot = static_cast<OtherType*>(otPtr.ptr());
+ XASSERT(otPtr != nullptr);
+ OtherType* ot = static_cast<OtherType*>(otPtr.get());
XASSERT(ot != NULL);
printf("Validating OtherType: %d, %s, %c, %e\n", ot->m_struct.a,
@@ -163,7 +164,7 @@ DUNIT_TASK(NoDist, SerializeInMemory)
str = CacheableString::create("");
copy = duplicate(str);
- ASSERT(copy != NULLPTR, "error null copy.");
+ ASSERT(copy != nullptr, "error null copy.");
ASSERT(copy->length() == 0, "expected 0 length.");
CacheableInt32Ptr intkey = CacheableInt32::create(1);
@@ -241,7 +242,7 @@ DUNIT_TASK(Sender, SetupAndPutInts)
Serializable::registerType(OtherType::createDeserializable2);
Serializable::registerType(OtherType::createDeserializable4);
initClientWithPool(true, "__TEST_POOL1__", locatorsG, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
getHelper()->createPooledRegion("DistRegionAck", USE_ACK, locatorsG,
"__TEST_POOL1__", true, true);
LOG("SenderInit complete.");
@@ -286,7 +287,7 @@ ENDTASK
DUNIT_TASK(Sender, CloseCacheS)
{
- regionPtr = NULLPTR;
+ regionPtr = nullptr;
cleanProc();
}
ENDTASK
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testSharedPtr.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testSharedPtr.cpp b/src/cppcache/integration-test/testSharedPtr.cpp
deleted file mode 100644
index a8753ad..0000000
--- a/src/cppcache/integration-test/testSharedPtr.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#define ROOT_NAME "testSharedPtr"
-
-#include "fw_dunit.hpp"
-#include <geode/GeodeCppCache.hpp>
-
-#include <HostAsm.hpp>
-
-using namespace apache::geode::client;
-
-// Test some HostAsm code first..
-DUNIT_TASK(s1p1, HostAsm)
- {
- volatile int32_t counter = 0;
- XASSERT(counter == 0);
- HostAsm::atomicAdd(counter, 1);
- XASSERT(counter == 1);
- HostAsm::atomicAdd(counter, 3);
- XASSERT(counter == 4);
-
- HostAsm::atomicAdd(counter, -1);
- XASSERT(counter == 3);
- }
-END_TASK(HostAsm)
-
-// Test Or and And.
-DUNIT_TASK(s1p1, AndOr)
- {
- volatile uint32_t bits = 0;
- uint32_t mask1 = 0x00000001ul;
- uint32_t mask2 = 0x00000002ul;
-
- HostAsm::atomicOr(bits, mask1);
- XASSERT(bits == 1);
- HostAsm::atomicAnd(bits, ~mask1);
- XASSERT(bits == 0);
- HostAsm::atomicOr(bits, mask1);
- HostAsm::atomicOr(bits, mask2);
- XASSERT(bits == 3);
- HostAsm::atomicAnd(bits, ~mask1);
- XASSERT(bits == 2);
- HostAsm::atomicAnd(bits, ~mask2);
- XASSERT(bits == 0);
- }
-END_TASK(AndOr)
-
-bool deleted = false;
-
-class TestObj : public SharedBase {
- public:
- TestObj() : SharedBase() {}
-
- ~TestObj() { deleted = true; }
-};
-
-typedef SharedPtr<TestObj> TestObjPtr;
-
-DUNIT_TASK(s1p1, A)
- {
- char logmsg[1024];
- deleted = false;
- TestObj* obj = new TestObj();
- sprintf(logmsg, "TestObj->refCount(): %d\n", obj->refCount());
- LOG(logmsg);
- ASSERT(obj->refCount() == 0, "refcount should be 0, no ptrs yet.");
- TestObjPtr* ptr = new TestObjPtr(obj);
- sprintf(logmsg, "TestObj->refCount(): %d\n", obj->refCount());
- LOG(logmsg);
- ASSERT((*ptr)->refCount() == 1, "Expected refCount == 1");
- delete ptr;
- ASSERT(deleted == true, "Expected destruction.");
- }
-END_TASK(A)
-
-DUNIT_TASK(s1p1, B)
- {
- deleted = false;
- TestObjPtr* heapPtr = new TestObjPtr();
- {
- TestObjPtr ptr(new TestObj());
- ASSERT(ptr->refCount() == 1, "Expected refCount == 1");
- *heapPtr = ptr;
- ASSERT(ptr->refCount() == 2, "Expected refCount == 2");
- }
- ASSERT(deleted == false, "Only one reference went away, should be alive.");
- ASSERT((*heapPtr)->refCount() == 1, "Expected refCount == 1");
- delete heapPtr;
- ASSERT(deleted == true,
- "Now last reference is gone, so TestObj should be deleted.");
- LOG("Finished successfully.");
- }
-END_TASK(B)
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testSystemProperties.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testSystemProperties.cpp b/src/cppcache/integration-test/testSystemProperties.cpp
index 4ed4582..0d0659c 100644
--- a/src/cppcache/integration-test/testSystemProperties.cpp
+++ b/src/cppcache/integration-test/testSystemProperties.cpp
@@ -35,7 +35,7 @@ const bool checkSecurityProperties(PropertiesPtr securityProperties,
return false;
}
CacheableStringPtr tempValue = securityProperties->find(key);
- if (tempValue == NULLPTR) {
+ if (tempValue == nullptr) {
return (false);
}
flag = strcmp(tempValue->asChar(), value);
@@ -44,7 +44,7 @@ const bool checkSecurityProperties(PropertiesPtr securityProperties,
BEGIN_TEST(DEFAULT)
{
- SystemProperties* sp = new SystemProperties(NULLPTR, "./non-existent");
+ SystemProperties* sp = new SystemProperties(nullptr, "./non-existent");
ASSERT(sp->statisticsSampleInterval() == 1, "expected 1");
ASSERT(sp->statisticsEnabled() == true, "expected true");
LOG(sp->statisticsArchiveFile());
@@ -77,7 +77,7 @@ BEGIN_TEST(CONFIG)
// Make sure product can at least log to stdout.
Log::init(Log::Config, NULL, 0);
- SystemProperties* sp = new SystemProperties(NULLPTR, "test.properties");
+ SystemProperties* sp = new SystemProperties(nullptr, "test.properties");
ASSERT(sp->statisticsSampleInterval() == 1, "expected 1");
ASSERT(sp->statisticsEnabled() == true, "expected true");
const char* safname = sp->statisticsArchiveFile();
@@ -99,7 +99,7 @@ BEGIN_TEST(NEW_CONFIG)
// Make sure product can at least log to stdout.
Log::init(Log::Config, NULL, 0);
- SystemProperties* sp = new SystemProperties(NULLPTR, filePath.c_str());
+ SystemProperties* sp = new SystemProperties(nullptr, filePath.c_str());
ASSERT(sp->statisticsSampleInterval() == 700, "expected 700");
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientAfterRegionLive.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientAfterRegionLive.cpp b/src/cppcache/integration-test/testThinClientAfterRegionLive.cpp
index 5a9fdc5..ececb02 100644
--- a/src/cppcache/integration-test/testThinClientAfterRegionLive.cpp
+++ b/src/cppcache/integration-test/testThinClientAfterRegionLive.cpp
@@ -50,10 +50,10 @@ class DisconnectCacheListioner : public CacheListener {
}
};
-CacheListenerPtr cptr1(new DisconnectCacheListioner(0));
-CacheListenerPtr cptr2(new DisconnectCacheListioner(1));
-CacheListenerPtr cptr3(new DisconnectCacheListioner(2));
-CacheListenerPtr cptr4(new DisconnectCacheListioner(3));
+auto cptr1 = std::make_shared<DisconnectCacheListioner>(0);
+auto cptr2 = std::make_shared<DisconnectCacheListioner>(1);
+auto cptr3 = std::make_shared<DisconnectCacheListioner>(2);
+auto cptr4 = std::make_shared<DisconnectCacheListioner>(3);
#include "LocatorHelper.hpp"
@@ -62,7 +62,7 @@ void createPooledRegionMine(bool callReadyForEventsAPI = false) {
poolFacPtr->setSubscriptionEnabled(true);
getHelper()->addServerLocatorEPs(locatorsG, poolFacPtr);
if ((PoolManager::find("__TEST_POOL1__")) ==
- NULLPTR) { // Pool does not exist with the same name.
+ nullptr) { // Pool does not exist with the same name.
PoolPtr pptr = poolFacPtr->create("__TEST_POOL1__");
}
SLEEP(10000);
@@ -85,7 +85,7 @@ void createPooledRegionMine(bool callReadyForEventsAPI = false) {
af.setCacheListener(cptr4);
RegionAttributesPtr rattrsPtr4 = af.createRegionAttributes();
CacheImpl* cacheImpl =
- CacheRegionHelper::getCacheImpl(getHelper()->cachePtr.ptr());
+ CacheRegionHelper::getCacheImpl(getHelper()->cachePtr.get());
RegionPtr region1;
cacheImpl->createRegion(regionNames[0], rattrsPtr1, region1);
RegionPtr region2;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientBigValue.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientBigValue.cpp b/src/cppcache/integration-test/testThinClientBigValue.cpp
index 987aed6..e072c1c 100644
--- a/src/cppcache/integration-test/testThinClientBigValue.cpp
+++ b/src/cppcache/integration-test/testThinClientBigValue.cpp
@@ -61,11 +61,11 @@ void putSize(RegionPtr& rptr, const char* buf, int size) {
void verify(CacheableBytesPtr& valuePtr, int size) {
char msg[200];
sprintf(msg, "verifying value of size %d", size);
- ASSERT(size == 0 || valuePtr != NULLPTR, msg);
+ ASSERT(size == 0 || valuePtr != nullptr, msg);
sprintf(msg, "value size is not %d", size);
int tryCnt = 0;
bool notIt = true;
- int valSize = (valuePtr != NULLPTR ? valuePtr->length() : 0);
+ int valSize = (valuePtr != nullptr ? valuePtr->length() : 0);
while ((notIt == true) && (tryCnt++ < 10)) {
notIt = (valSize != size);
SLEEP(100);
@@ -109,7 +109,7 @@ END_TASK(StartServer)
DUNIT_TASK(CLIENT1, SetupClient1)
{
initClientWithPool(true, "__TEST_POOL1__", locHostPort, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
getHelper()->createPooledRegion(regionNames[0], false, locHostPort,
"__TEST_POOL1__", true, true);
}
@@ -118,7 +118,7 @@ END_TASK(SetupClient1)
DUNIT_TASK(CLIENT2, SetupClient2)
{
initClientWithPool(true, "__TEST_POOL1__", locHostPort, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
getHelper()->createPooledRegion(regionNames[0], false, locHostPort,
"__TEST_POOL1__", true, true);
}
@@ -155,11 +155,11 @@ DUNIT_TASK(CLIENT2, VerifyPuts)
sprintf(keybuf, "key%010d", i);
CacheableKeyPtr keyPtr = CacheableKey::create(keybuf);
CacheableBytesPtr valPtr =
- dynCast<CacheableBytesPtr>(regPtr->get(keyPtr));
+ std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(keyPtr));
int ntry = 20;
- while ((ntry-- > 0) && (valPtr == NULLPTR)) {
+ while ((ntry-- > 0) && (valPtr == nullptr)) {
SLEEP(200);
- valPtr = dynCast<CacheableBytesPtr>(regPtr->get(keyPtr));
+ valPtr = std::dynamic_pointer_cast<CacheableBytes>(regPtr->get(keyPtr));
}
LOG("from VerifyPuts");
verify(valPtr, i);
@@ -195,9 +195,8 @@ DUNIT_TASK(CLIENT2, VerifyManyPuts)
char keybuf[100];
for (int index = 0; index < entriesExpected; ++index) {
sprintf(keybuf, "keys1%010d", index);
- CacheableStringPtr valPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keybuf));
- ASSERT(valPtr != NULLPTR, "expected non-null value");
+ auto valPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keybuf));
+ ASSERT(valPtr != nullptr, "expected non-null value");
ASSERT(valPtr->length() == 107, "unexpected size of value in verify");
}
LOG("On client Found all entries with correct size via get.");
@@ -231,9 +230,8 @@ DUNIT_TASK(CLIENT2, VerifyOldManyPuts)
char keybuf[100];
for (int index = 0; index < entriesExpected; ++index) {
sprintf(keybuf, "keys1%010d", index);
- CacheableStringPtr valPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keybuf));
- ASSERT(valPtr != NULLPTR, "expected non-null value");
+ auto valPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keybuf));
+ ASSERT(valPtr != nullptr, "expected non-null value");
ASSERT(valPtr->length() == 107, "unexpected size of value in verify");
}
LOG("On client Found all entries with correct size via "
@@ -252,9 +250,8 @@ DUNIT_TASK(CLIENT2, VerifyUpdatedManyPuts)
char keybuf[100];
for (int index = 0; index < entriesExpected; ++index) {
sprintf(keybuf, "keys1%010d", index);
- CacheableStringPtr valPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keybuf));
- ASSERT(valPtr != NULLPTR, "expected non-null value");
+ auto valPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keybuf));
+ ASSERT(valPtr != nullptr, "expected non-null value");
ASSERT(valPtr->length() == 1007, "unexpected size of value in verify");
}
LOG("On client Found all entries with correct size via "
@@ -277,20 +274,19 @@ DUNIT_TASK(CLIENT2, VerifyUpdatedManyPutsGetAll)
vec.push_back(CacheableKey::create(keybuf));
}
try {
- regPtr->getAll(vec, NULLPTR, NULLPTR, false);
+ regPtr->getAll(vec, nullptr, nullptr, false);
FAIL(
"Expected IllegalArgumentException when nothing "
"is being fetched");
} catch (const IllegalArgumentException&) {
LOG("Got expected IllegalArgumentException");
}
- regPtr->getAll(vec, NULLPTR, NULLPTR, true);
+ regPtr->getAll(vec, nullptr, nullptr, true);
LOG("On client getAll for entries completed.");
for (int index = 0; index < entriesExpected; ++index) {
sprintf(keybuf, "keys1%010d", index);
- CacheableStringPtr valPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keybuf));
- ASSERT(valPtr != NULLPTR, "expected non-null value");
+ auto valPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keybuf));
+ ASSERT(valPtr != nullptr, "expected non-null value");
ASSERT(valPtr->length() == 1007, "unexpected size of value in verify");
}
LOG("On client Found all entries with correct size via "
@@ -324,10 +320,9 @@ DUNIT_TASK(CLIENT2, VerifyManyPutsInt64)
for (int64_t index = 0; index < entriesExpected; ++index) {
int64_t key = index * index * index;
// CacheableStringPtr valPtr =
- // dynCast<CacheableStringPtr>(regPtr->get(key));
- CacheableStringPtr valPtr =
- dynCast<CacheableStringPtr>(regPtr->get(CacheableInt64::create(key)));
- ASSERT(valPtr != NULLPTR, "expected non-null value");
+ // std::dynamic_pointer_cast<CacheableString>(regPtr->get(key));
+ auto valPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(CacheableInt64::create(key)));
+ ASSERT(valPtr != nullptr, "expected non-null value");
ASSERT(valPtr->length() == 207, "unexpected size of value in verify");
}
LOG("On client Found all int64 entries with "
@@ -338,10 +333,9 @@ DUNIT_TASK(CLIENT2, VerifyManyPutsInt64)
// * index * index));
CacheableKeyPtr key = CacheableInt64::create(index * index * index);
RegionEntryPtr entry = regPtr->getEntry(key);
- ASSERT(entry != NULLPTR, "expected non-null entry");
- CacheableStringPtr valPtr =
- dynCast<CacheableStringPtr>(entry->getValue());
- ASSERT(valPtr != NULLPTR, "expected non-null value");
+ ASSERT(entry != nullptr, "expected non-null entry");
+ auto valPtr = std::dynamic_pointer_cast<CacheableString>(entry->getValue());
+ ASSERT(valPtr != nullptr, "expected non-null value");
ASSERT(valPtr->length() == 207, "unexpected size of value in verify");
}
LOG("On client Found all int64 entries with "
@@ -365,29 +359,28 @@ DUNIT_TASK(CLIENT2, VerifyUpdatedManyPutsInt64GetAll)
vec.push_back(CacheableInt64::create(key));
}
try {
- regPtr->getAll(vec, NULLPTR, NULLPTR, false);
+ regPtr->getAll(vec, nullptr, nullptr, false);
FAIL(
"Expected IllegalArgumentException when "
"nothing is being fetched");
} catch (const IllegalArgumentException&) {
LOG("Got expected IllegalArgumentException");
}
- HashMapOfCacheablePtr valuesMap(new HashMapOfCacheable());
- regPtr->getAll(vec, valuesMap, NULLPTR, true);
+ auto valuesMap = std::make_shared<HashMapOfCacheable>();
+ regPtr->getAll(vec, valuesMap, nullptr, true);
LOG("On client getAll for int64 entries "
"completed.");
for (int32_t index = 0; index < entriesExpected; ++index) {
CacheableKeyPtr key = vec[index];
RegionEntryPtr entry = regPtr->getEntry(key);
- ASSERT(entry != NULLPTR, "expected non-null entry");
- CacheableStringPtr valPtr =
- dynCast<CacheableStringPtr>(entry->getValue());
- ASSERT(valPtr != NULLPTR, "expected non-null value");
+ ASSERT(entry != nullptr, "expected non-null entry");
+ auto valPtr = std::dynamic_pointer_cast<CacheableString>(entry->getValue());
+ ASSERT(valPtr != nullptr, "expected non-null value");
ASSERT(valPtr->length() == 207, "unexpected size of value in verify");
HashMapOfCacheable::Iterator iter = valuesMap->find(key);
ASSERT(iter != valuesMap->end(), "expected to find key in map");
- valPtr = dynCast<CacheableStringPtr>(iter.second());
- ASSERT(valPtr != NULLPTR, "expected non-null value");
+ valPtr = std::dynamic_pointer_cast<CacheableString>(iter.second());
+ ASSERT(valPtr != nullptr, "expected non-null value");
ASSERT(valPtr->length() == 207, "unexpected size of value in verify");
}
LOG("On client Found all int64 entries with "
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientCacheableStringArray.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientCacheableStringArray.cpp b/src/cppcache/integration-test/testThinClientCacheableStringArray.cpp
index f0b3ab7..5e621b3 100644
--- a/src/cppcache/integration-test/testThinClientCacheableStringArray.cpp
+++ b/src/cppcache/integration-test/testThinClientCacheableStringArray.cpp
@@ -67,7 +67,7 @@ DUNIT_TASK(CLIENT1, StepOne)
Serializable::registerType(Portfolio::createDeserializable);
initClientWithPool(true, "__TEST_POOL1__", locHostPort, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
RegionPtr regptr = getHelper()->createPooledRegion(
_regionNames[0], USE_ACK, locHostPort, "__TEST_POOL1__", true, true);
RegionAttributesPtr lattribPtr = regptr->getAttributes();
@@ -106,22 +106,22 @@ DUNIT_TASK(CLIENT1, StepThree)
while (iter.hasNext()) {
count--;
SerializablePtr ser = iter.next();
- PortfolioPtr portfolio(dynamic_cast<Portfolio*>(ser.ptr()));
- PositionPtr position(dynamic_cast<Position*>(ser.ptr()));
+ PortfolioPtr portfolio = std::dynamic_pointer_cast<Portfolio>(ser);
+ PositionPtr position = std::dynamic_pointer_cast<Position>(ser);
- if (portfolio != NULLPTR) {
+ if (portfolio != nullptr) {
printf(" query pulled portfolio object ID %d, pkid %s\n",
portfolio->getID(), portfolio->getPkid()->asChar());
}
- else if (position != NULLPTR) {
+ else if (position != nullptr) {
printf(" query pulled position object secId %s, shares %d\n",
position->getSecId()->asChar(),
position->getSharesOutstanding());
}
else {
- if (ser != NULLPTR) {
+ if (ser != nullptr) {
printf(" query pulled object %s\n", ser->toString()->asChar());
} else {
printf(" query pulled bad object\n");
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientCacheables.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientCacheables.cpp b/src/cppcache/integration-test/testThinClientCacheables.cpp
index 0ca8d06..30b332b 100644
--- a/src/cppcache/integration-test/testThinClientCacheables.cpp
+++ b/src/cppcache/integration-test/testThinClientCacheables.cpp
@@ -71,9 +71,9 @@ void createRegion(const char* name, bool ackMode,
LOG("createRegion() entered.");
fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
fflush(stdout);
- RegionPtr regPtr = getHelper()->createRegion(name, ackMode, true, NULLPTR,
+ RegionPtr regPtr = getHelper()->createRegion(name, ackMode, true, nullptr,
clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
@@ -87,16 +87,16 @@ void checkGets(int maxKeys, int8_t keyTypeId, int8_t valTypeId,
CacheableWrapperFactory::createInstance(valTypeId);
ASSERT(tmpval != NULL, "tmpval is NULL");
tmpkey->initKey(i, KEYSIZE);
- CacheableKeyPtr key = dynCast<CacheableKeyPtr>(tmpkey->getCacheable());
+ auto key = std::dynamic_pointer_cast<CacheableKey>(tmpkey->getCacheable());
CacheablePtr val = dataReg->get(key);
// also check that value is in local cache
RegionEntryPtr entry = dataReg->getEntry(key);
- ASSERT(entry != NULLPTR, "entry is NULL");
+ ASSERT(entry != nullptr, "entry is NULL");
CacheablePtr localVal = entry->getValue();
uint32_t keychksum = tmpkey->getCheckSum();
- CacheableInt32Ptr int32val = dynCast<CacheableInt32Ptr>(
+ auto int32val = std::dynamic_pointer_cast<CacheableInt32>(
verifyReg->get(static_cast<int32_t>(keychksum)));
- if (int32val == NULLPTR) {
+ if (int32val == nullptr) {
printf("GetsTask::keychksum: %u, key: %s\n", keychksum,
Utils::getCacheableKeyString(key)->asChar());
FAIL("Could not find the checksum for the given key.");
@@ -179,19 +179,19 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutsTask)
CacheableWrapperFactory::createInstance(valTypeId);
tmpkey->initKey(i, KEYSIZE);
tmpval->initRandomValue(CacheableHelper::random(VALUESIZE) + 1);
- ASSERT(tmpkey->getCacheable() != NULLPTR,
+ ASSERT(tmpkey->getCacheable() != nullptr,
"tmpkey->getCacheable() is NULL");
// we can have NULL values now after fix for bug #294
- if (tmpval->getCacheable() != NULLPTR) {
- dataReg->put(dynCast<CacheableKeyPtr>(tmpkey->getCacheable()),
+ if (tmpval->getCacheable() != nullptr) {
+ dataReg->put(std::dynamic_pointer_cast<CacheableKey>(tmpkey->getCacheable()),
tmpval->getCacheable());
} else {
try {
- dataReg->destroy(dynCast<CacheableKeyPtr>(tmpkey->getCacheable()));
+ dataReg->destroy(std::dynamic_pointer_cast<CacheableKey>(tmpkey->getCacheable()));
} catch (const EntryNotFoundException&) {
// expected
}
- dataReg->create(dynCast<CacheableKeyPtr>(tmpkey->getCacheable()),
+ dataReg->create(std::dynamic_pointer_cast<CacheableKey>(tmpkey->getCacheable()),
tmpval->getCacheable());
}
uint32_t keychksum = tmpkey->getCheckSum();
@@ -200,9 +200,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutsTask)
static_cast<int32_t>(valchksum));
// also check that value is in local cache
RegionEntryPtr entry =
- dataReg->getEntry(dynCast<CacheableKeyPtr>(tmpkey->getCacheable()));
+ dataReg->getEntry(std::dynamic_pointer_cast<CacheableKey>(tmpkey->getCacheable()));
CacheablePtr localVal;
- if (entry != NULLPTR) {
+ if (entry != nullptr) {
localVal = entry->getValue();
}
uint32_t localValChkSum = tmpval->getCheckSum(localVal);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientCacheablesLimits.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientCacheablesLimits.cpp b/src/cppcache/integration-test/testThinClientCacheablesLimits.cpp
index 3931fe0..081bf1b 100644
--- a/src/cppcache/integration-test/testThinClientCacheablesLimits.cpp
+++ b/src/cppcache/integration-test/testThinClientCacheablesLimits.cpp
@@ -64,9 +64,9 @@ void createRegion(const char* name, bool ackMode,
LOG("createRegion() entered.");
fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
fflush(stdout);
- RegionPtr regPtr = getHelper()->createRegion(name, ackMode, false, NULLPTR,
+ RegionPtr regPtr = getHelper()->createRegion(name, ackMode, false, nullptr,
clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
uint8_t* createRandByteArray(int size) {
@@ -91,7 +91,7 @@ const char* _regionNames[] = {"DistRegionAck", "DistRegionNoAck"};
DUNIT_TASK_DEFINITION(CLIENT1, StepOne)
{
initClientWithPool(true, "__TEST_POOL1__", locatorsG, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
getHelper()->createPooledRegion(_regionNames[1], NO_ACK, locatorsG,
"__TEST_POOL1__", false, false);
LOG("StepOne complete.");
@@ -129,16 +129,13 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutsTask)
ASSERT(!verifyReg->containsValueForKey(KEY_EMPTY_BYTESARR),
"Contains value key failed for empty bytes array");
- CacheableBytesPtr bytePtrReturn =
- dynCast<CacheableBytesPtr>(verifyReg->get(KEY_BYTE));
- CacheableStringPtr stringPtrReturn =
- dynCast<CacheableStringPtr>(verifyReg->get(KEY_STRING));
- CacheableBytesPtr emptyBytesArrReturn =
- dynCast<CacheableBytesPtr>(verifyReg->get(KEY_EMPTY_BYTESARR));
+ auto bytePtrReturn = std::dynamic_pointer_cast<CacheableBytes>(verifyReg->get(KEY_BYTE));
+ auto stringPtrReturn = std::dynamic_pointer_cast<CacheableString>(verifyReg->get(KEY_STRING));
+ auto emptyBytesArrReturn = std::dynamic_pointer_cast<CacheableBytes>(verifyReg->get(KEY_EMPTY_BYTESARR));
- ASSERT(bytePtrReturn != NULLPTR, "Byte val is NULL");
- ASSERT(stringPtrReturn != NULLPTR, "String val is NULL");
- ASSERT(emptyBytesArrReturn != NULLPTR, "Empty Bytes Array ptr is NULL");
+ ASSERT(bytePtrReturn != nullptr, "Byte val is NULL");
+ ASSERT(stringPtrReturn != nullptr, "String val is NULL");
+ ASSERT(emptyBytesArrReturn != nullptr, "Empty Bytes Array ptr is NULL");
bool isSameBytes = (bytePtrReturn->length() == bytePtrSent->length() &&
!memcmp(bytePtrReturn->value(), bytePtrSent->value(),
@@ -167,9 +164,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutsTask)
ASSERT(!verifyReg->containsValueForKey(KEY_EMPTY_BYTESARR),
"Contains value key failed for empty bytes array");
- CacheableBytesPtr emptyBytesArrReturn1 =
- dynCast<CacheableBytesPtr>(verifyReg->get(KEY_EMPTY_BYTESARR));
- ASSERT(emptyBytesArrReturn1 != NULLPTR, "Empty Bytes Array ptr is NULL");
+ auto emptyBytesArrReturn1 = std::dynamic_pointer_cast<CacheableBytes>(verifyReg->get(KEY_EMPTY_BYTESARR));
+ ASSERT(emptyBytesArrReturn1 != nullptr, "Empty Bytes Array ptr is NULL");
ASSERT(emptyBytesArrReturn1->length() == 0,
"Empty Bytes Array length is not 0.");
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientClearRegion.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientClearRegion.cpp b/src/cppcache/integration-test/testThinClientClearRegion.cpp
index cdb6cf2..480af07 100644
--- a/src/cppcache/integration-test/testThinClientClearRegion.cpp
+++ b/src/cppcache/integration-test/testThinClientClearRegion.cpp
@@ -68,13 +68,13 @@ END_TASK(StartServer)
DUNIT_TASK(CLIENT1, SetupClient1)
{
initClientWithPool(true, "__TEST_POOL1__", locHostPort, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
getHelper()->createPooledRegion(regionNames[0], false, locHostPort,
"__TEST_POOL1__", true, true);
RegionPtr regPtr = getHelper()->getRegion(regionNames[0]);
AttributesMutatorPtr mtor = regPtr->getAttributesMutator();
- CacheListenerPtr lster(new MyCacheListener());
- CacheWriterPtr wter(new MyCacheWriter());
+ auto lster = std::make_shared<MyCacheListener>();
+ auto wter = std::make_shared<MyCacheWriter>();
mtor->setCacheListener(lster);
mtor->setCacheWriter(wter);
regPtr->registerAllKeys();
@@ -84,7 +84,7 @@ END_TASK(SetupClient1)
DUNIT_TASK(CLIENT2, SetupClient2)
{
initClientWithPool(true, "__TEST_POOL1__", locHostPort, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
getHelper()->createPooledRegion(regionNames[0], false, locHostPort,
"__TEST_POOL1__", true, true);
RegionPtr regPtr = getHelper()->getRegion(regionNames[0]);
@@ -131,13 +131,13 @@ DUNIT_TASK(CLIENT1, VerifyClear1)
ASSERT(regPtr->containsKeyOnServer(keyPtr), "key should be there");
RegionAttributesPtr attr = regPtr->getAttributes();
CacheListenerPtr clp = attr->getCacheListener();
- MyCacheListener* mcl = dynamic_cast<MyCacheListener*>(clp.ptr());
+ MyCacheListener* mcl = dynamic_cast<MyCacheListener*>(clp.get());
char buf[1024];
sprintf(buf, "listener clear count=%d", mcl->getClearCnt());
LOG(buf);
ASSERT(mcl->getClearCnt() == 2, buf);
CacheWriterPtr cwp = attr->getCacheWriter();
- MyCacheWriter* mcw = dynamic_cast<MyCacheWriter*>(cwp.ptr());
+ MyCacheWriter* mcw = dynamic_cast<MyCacheWriter*>(cwp.get());
sprintf(buf, "writer clear count=%d", mcw->getClearCnt());
LOG(buf);
ASSERT(mcw->getClearCnt() == 2, buf);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientConflation.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientConflation.cpp b/src/cppcache/integration-test/testThinClientConflation.cpp
index 7b0a08a..0fbe6de 100644
--- a/src/cppcache/integration-test/testThinClientConflation.cpp
+++ b/src/cppcache/integration-test/testThinClientConflation.cpp
@@ -42,11 +42,10 @@ class OperMonitor : public CacheListener {
void check(const EntryEvent& event) {
char buf[256] = {'\0'};
m_events++;
- CacheableStringPtr keyPtr = dynCast<CacheableStringPtr>(event.getKey());
- CacheableInt32Ptr valuePtr =
- dynCast<CacheableInt32Ptr>(event.getNewValue());
+ auto keyPtr = std::dynamic_pointer_cast<CacheableString>(event.getKey());
+ auto valuePtr = std::dynamic_pointer_cast<CacheableInt32>(event.getNewValue());
- if (valuePtr != NULLPTR) {
+ if (valuePtr != nullptr) {
m_value = valuePtr->value();
}
sprintf(buf, "Key = %s, Value = %d", keyPtr->toString(), valuePtr->value());
@@ -85,10 +84,10 @@ void setCacheListener(const char* regName, OperMonitorPtr monitor) {
attrMutator->setCacheListener(monitor);
}
-OperMonitorPtr mon1C1 = NULLPTR;
-OperMonitorPtr mon2C1 = NULLPTR;
-OperMonitorPtr mon1C2 = NULLPTR;
-OperMonitorPtr mon2C2 = NULLPTR;
+OperMonitorPtr mon1C1 = nullptr;
+OperMonitorPtr mon2C1 = nullptr;
+OperMonitorPtr mon1C2 = nullptr;
+OperMonitorPtr mon2C2 = nullptr;
const char* regions[] = {"ConflatedRegion", "NonConflatedRegion"};
@@ -101,8 +100,8 @@ void initClientCache(OperMonitorPtr& mon1, OperMonitorPtr& mon2, int durableIdx,
initClientAndTwoRegions(durableIdx, 0, 300, conflation, regions);
// Recreate listener
- mon1 = new OperMonitor();
- mon2 = new OperMonitor();
+ mon1 = std::make_shared<OperMonitor>();
+ mon2 = std::make_shared<OperMonitor>();
setCacheListener(regions[0], mon1);
setCacheListener(regions[1], mon2);
@@ -162,7 +161,7 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(FEEDER, CreateRegionsAndFirstFeederUpdate)
{
initClientWithPool(true, "__TEST_POOL1__", locatorsG, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
getHelper()->createPooledRegion(regions[0], USE_ACK, locatorsG,
"__TEST_POOL1__", true, true);
getHelper()->createPooledRegion(regions[1], USE_ACK, locatorsG,
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientContainsKeyOnServer.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientContainsKeyOnServer.cpp b/src/cppcache/integration-test/testThinClientContainsKeyOnServer.cpp
index 5ff29bc..a9ab4fb 100644
--- a/src/cppcache/integration-test/testThinClientContainsKeyOnServer.cpp
+++ b/src/cppcache/integration-test/testThinClientContainsKeyOnServer.cpp
@@ -41,7 +41,7 @@ END_TASK(StartServer)
DUNIT_TASK(CLIENT1, SetupClient1)
{
initClientWithPool(true, "__TEST_POOL1__", locatorsG, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
getHelper()->createPooledRegion(regionNames[0], false, locatorsG,
"__TEST_POOL1__", true, true);
RegionPtr regPtr = getHelper()->getRegion(regionNames[0]);
@@ -53,7 +53,7 @@ END_TASK(SetupClient1)
DUNIT_TASK(CLIENT2, SetupClient2)
{
initClientWithPool(true, "__TEST_POOL1__", locatorsG, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
getHelper()->createPooledRegion(regionNames[0], false, locatorsG,
"__TEST_POOL1__", true, true);
RegionPtr regPtr = getHelper()->getRegion(regionNames[0]);
[30/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from clicache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/test/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/clicache/test/CMakeLists.txt b/src/clicache/test/CMakeLists.txt
new file mode 100644
index 0000000..d590078
--- /dev/null
+++ b/src/clicache/test/CMakeLists.txt
@@ -0,0 +1,72 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+cmake_minimum_required(VERSION 3.4)
+project(Apache.Geode.Test)
+
+file(GLOB SOURCES "*.cpp")
+
+if(NOT "${STRONG_NAME_PUBLIC_KEY}" STREQUAL "")
+ set(STRONG_NAME_PUBLIC_KEY_ATTRIBUTE ", PublicKey=${STRONG_NAME_PUBLIC_KEY}")
+endif()
+list(APPEND CONFIGURE_IN_FILES ${CMAKE_CURRENT_SOURCE_DIR}/AssemblyInfo.cpp.in)
+list(APPEND CONFIGURE_OUT_FILES ${CMAKE_CURRENT_BINARY_DIR}/AssemblyInfo.cpp)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/AssemblyInfo.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/AssemblyInfo.cpp)
+
+set_source_files_properties(${CONFIGURE_OUT_FILES} PROPERTIES GENERATED TRUE)
+
+add_library(${PROJECT_NAME} MODULE
+ ${SOURCES}
+ ${CONFIGURE_IN_FILES}
+ ${CONFIGURE_OUT_FILES}
+ ${RESOURCES}
+)
+#add_dependencies(unit-tests ${PROJECT_NAME})
+
+add_definitions(-DUNICODE -D_UNICODE)
+target_compile_definitions(${PROJECT_NAME}
+ PUBLIC
+ -DUNICODE -D_UNICODE
+)
+
+target_link_libraries(${PROJECT_NAME}
+ PRIVATE
+ Apache.Geode
+ PUBLIC
+ c++11
+)
+
+set_target_properties(${PROJECT_NAME} PROPERTIES
+ COMPILE_FLAGS "/clr"
+ VS_GLOBAL_CLRSupport "true"
+ VS_GLOBAL_KEYWORD "ManagedCProj"
+ VS_GLOBAL_ROOTNAMESPACE ${PROJECT_NAME}
+ VS_DOTNET_TARGET_FRAMEWORK_VERSION "v4.5.2"
+ VS_DOTNET_REFERENCES "System;System.Xml;Microsoft.VisualStudio.QualityTools.UnitTestFramework"
+)
+
+string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
+set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${SHARED_LINKER_FLAGS_STRONG_KEY}")
+
+include_directories(${CMAKE_SOURCE_DIR}/clicache/src)
+include_directories(${CMAKE_SOURCE_DIR}/cppcache/src)
+#PCH issues
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+
+# For Visual Studio organization
+source_group("Header Files" REGULAR_EXPRESSION "\.(hpp|inl)$")
+source_group("Configure In Files" FILES ${CONFIGURE_IN_FILES})
+source_group("Configure Out Files" FILES ${CONFIGURE_OUT_FILES})
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/test/Utils.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/test/Utils.hpp b/src/clicache/test/Utils.hpp
new file mode 100644
index 0000000..6388398
--- /dev/null
+++ b/src/clicache/test/Utils.hpp
@@ -0,0 +1,14 @@
+#pragma once
+
+using namespace System;
+
+namespace cliunittests
+{
+ private ref class Utils {
+ internal:
+ static void GCCollectAndWait() {
+ GC::Collect();
+ GC::WaitForPendingFinalizers();
+ }
+ };
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/test/native_conditional_unqiue_ptrTests.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/test/native_conditional_unqiue_ptrTests.cpp b/src/clicache/test/native_conditional_unqiue_ptrTests.cpp
new file mode 100644
index 0000000..74cdf34
--- /dev/null
+++ b/src/clicache/test/native_conditional_unqiue_ptrTests.cpp
@@ -0,0 +1,229 @@
+#include <memory>
+#include <functional>
+#include <native_conditional_unique_ptr.hpp>
+#include "Utils.hpp"
+
+using namespace System;
+using namespace System::Text;
+using namespace System::Collections::Generic;
+using namespace Microsoft::VisualStudio::TestTools::UnitTesting;
+
+using namespace Apache::Geode::Client;
+
+namespace cliunittests
+{
+
+ class NativeTestClass {
+ public:
+ int i;
+ NativeTestClass(int i) : i(i) {};
+ };
+
+ class UniqueDestructNativeTestClass {
+ public:
+ int i;
+ UniqueDestructNativeTestClass(int i, bool& destructorCalled) : i(i), destructorCalled(destructorCalled) {};
+ ~UniqueDestructNativeTestClass() { destructorCalled = true; }
+ void GCCollectAndAssertDestructorCalledEquals(bool expected, const bool& destructorCalled)
+ {
+ Utils::GCCollectAndWait();
+ Assert::AreEqual(expected, destructorCalled);
+ }
+
+
+ private:
+ bool& destructorCalled;
+ };
+
+
+ [TestClass]
+ public ref class native_conditional_unique_ptrTests
+ {
+ private:
+ TestContext^ testContextInstance;
+
+ public:
+ /// <summary>
+ ///Gets or sets the test context which provides
+ ///information about and functionality for the current test run.
+ ///</summary>
+ property Microsoft::VisualStudio::TestTools::UnitTesting::TestContext^ TestContext
+ {
+ Microsoft::VisualStudio::TestTools::UnitTesting::TestContext^ get()
+ {
+ return testContextInstance;
+ }
+ System::Void set(Microsoft::VisualStudio::TestTools::UnitTesting::TestContext^ value)
+ {
+ testContextInstance = value;
+ }
+ };
+
+ #pragma region Additional test attributes
+ //
+ //You can use the following additional attributes as you write your tests:
+ //
+ //Use ClassInitialize to run code before running the first test in the class
+ //[ClassInitialize()]
+ //static void MyClassInitialize(TestContext^ testContext) {};
+ //
+ //Use ClassCleanup to run code after all tests in a class have run
+ //[ClassCleanup()]
+ //static void MyClassCleanup() {};
+ //
+ //Use TestInitialize to run code before running each test
+ //[TestInitialize()]
+ //void MyTestInitialize() {};
+ //
+ //Use TestCleanup to run code after each test has run
+ //[TestCleanup()]
+ //void MyTestCleanup() {};
+ //
+ #pragma endregion
+
+ [TestMethod]
+ void NullptrInstance()
+ {
+ auto p = gcnew native_conditional_unique_ptr<NativeTestClass>(std::unique_ptr<NativeTestClass>(__nullptr));
+
+ Assert::IsNotNull(p);
+ Assert::IsTrue(__nullptr == p->get());
+ };
+
+ [TestMethod]
+ void NullptrInstanceUnowned()
+ {
+ auto p = gcnew native_conditional_unique_ptr<NativeTestClass>(__nullptr);
+
+ Assert::IsNotNull(p);
+ Assert::IsTrue(__nullptr == p->get());
+ };
+
+ [TestMethod]
+ void AnInstance()
+ {
+ auto n = std::make_unique<NativeTestClass>(1);
+ auto p = gcnew native_conditional_unique_ptr<NativeTestClass>(std::move(n));
+
+ Assert::IsTrue(__nullptr == n);
+ Assert::IsNotNull(p);
+ Assert::IsFalse(__nullptr == p->get());
+ Assert::AreEqual(1, p->get()->i);
+ };
+
+ [TestMethod]
+ void AnInstanceUnowned()
+ {
+ auto n = new NativeTestClass(1);
+ try
+ {
+ auto p = gcnew native_conditional_unique_ptr<NativeTestClass>(n);
+
+ Assert::IsNotNull(p);
+ Assert::IsFalse(__nullptr == p->get());
+ Assert::AreEqual(1, p->get()->i);
+ }
+ finally
+ {
+ delete n;
+ }
+ };
+
+
+ [TestMethod]
+ void DestructorCalledAfterGC()
+ {
+ bool destructorCalled = false;
+ auto p = gcnew native_conditional_unique_ptr<UniqueDestructNativeTestClass>(std::make_unique<UniqueDestructNativeTestClass>(1, destructorCalled));
+
+ // p eligible for GC
+ Utils::GCCollectAndWait();
+
+ Assert::IsTrue(destructorCalled);
+ }
+
+ [TestMethod]
+ void DestructorNotCalledAfterGC()
+ {
+ bool destructorCalled = false;
+ auto n = new UniqueDestructNativeTestClass(1, destructorCalled);
+ try
+ {
+ auto p = gcnew native_conditional_unique_ptr<UniqueDestructNativeTestClass>(n);
+ auto w = gcnew WeakReference(p);
+
+ // p eligible for GC
+ Utils::GCCollectAndWait();
+
+ Assert::IsFalse(w->IsAlive);
+ Assert::IsFalse(destructorCalled);
+ }
+ finally
+ {
+ delete n;
+ Assert::IsTrue(destructorCalled);
+ }
+ }
+
+ [TestMethod]
+ void DestructorCalledAfterNativeUniquePtrIsDestructed()
+ {
+ bool destructorCalled = false;
+ auto n = std::make_unique<UniqueDestructNativeTestClass>(1, destructorCalled);
+ auto p = gcnew native_conditional_unique_ptr<UniqueDestructNativeTestClass>(std::move(n));
+
+ // p eligible for GC
+ Utils::GCCollectAndWait();
+
+ // n does not have a ref on our native pointer, so native not deleted
+ Assert::IsTrue(destructorCalled);
+ }
+
+
+ [TestMethod]
+ void DestructorCalledAfterAllReferencesReleased()
+ {
+ bool destructorCalled = false;
+ auto p = gcnew native_conditional_unique_ptr<UniqueDestructNativeTestClass>(std::make_unique<UniqueDestructNativeTestClass>(1, destructorCalled));
+ auto q = p;
+
+ // only p eligible for collection
+ Utils::GCCollectAndWait();
+
+ Assert::IsFalse(destructorCalled);
+
+ // keeps q ineligible for collection
+ GC::KeepAlive(q);
+
+ // q eligible for collection
+ Utils::GCCollectAndWait();
+
+ Assert::IsTrue(destructorCalled);
+ }
+
+ [TestMethod]
+ void GCCollectsWhileExecutingOnNativeClass()
+ {
+ bool destructorCalled = false;
+ auto p = gcnew native_conditional_unique_ptr<UniqueDestructNativeTestClass>(std::make_unique<UniqueDestructNativeTestClass>(1, destructorCalled));
+
+ p->get()->GCCollectAndAssertDestructorCalledEquals(true, destructorCalled);
+ }
+
+ [TestMethod]
+ void GCCollectsAfterExecutingOnNativeClass()
+ {
+ bool destructorCalled = false;
+ auto p = gcnew native_conditional_unique_ptr<UniqueDestructNativeTestClass>(std::make_unique<UniqueDestructNativeTestClass>(1, destructorCalled));
+
+ p->get()->GCCollectAndAssertDestructorCalledEquals(false, destructorCalled);
+ // keeps p ineligible for collection
+ GC::KeepAlive(p);
+
+ // p eligible for collection
+ Utils::GCCollectAndWait();
+ Assert::IsTrue(destructorCalled);
+ }
+
+ };
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/test/native_shared_ptrTests.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/test/native_shared_ptrTests.cpp b/src/clicache/test/native_shared_ptrTests.cpp
new file mode 100644
index 0000000..6cddd97
--- /dev/null
+++ b/src/clicache/test/native_shared_ptrTests.cpp
@@ -0,0 +1,189 @@
+#include <memory>
+#include <functional>
+#include <native_shared_ptr.hpp>
+#include "Utils.hpp"
+
+using namespace System;
+using namespace System::Text;
+using namespace System::Collections::Generic;
+using namespace Microsoft::VisualStudio::TestTools::UnitTesting;
+
+using namespace Apache::Geode::Client;
+
+namespace cliunittests
+{
+
+ class NativeTestClass {
+ public:
+ int i;
+ NativeTestClass(int i) : i(i) {};
+ };
+
+ class DestructNativeTestClass {
+ public:
+ int i;
+ DestructNativeTestClass(int i, bool& destructorCalled) : i(i), destructorCalled(destructorCalled) {};
+ ~DestructNativeTestClass() { destructorCalled = true; }
+ void GCCollectAndAssertDestructorCalledEquals(bool expected, const bool& destructorCalled)
+ {
+ Utils::GCCollectAndWait();
+ Assert::AreEqual(expected, destructorCalled);
+ }
+
+
+ private:
+ bool& destructorCalled;
+ };
+
+
+ [TestClass]
+ public ref class native_shared_ptrTests
+ {
+ private:
+ TestContext^ testContextInstance;
+
+ public:
+ /// <summary>
+ ///Gets or sets the test context which provides
+ ///information about and functionality for the current test run.
+ ///</summary>
+ property Microsoft::VisualStudio::TestTools::UnitTesting::TestContext^ TestContext
+ {
+ Microsoft::VisualStudio::TestTools::UnitTesting::TestContext^ get()
+ {
+ return testContextInstance;
+ }
+ System::Void set(Microsoft::VisualStudio::TestTools::UnitTesting::TestContext^ value)
+ {
+ testContextInstance = value;
+ }
+ };
+
+ #pragma region Additional test attributes
+ //
+ //You can use the following additional attributes as you write your tests:
+ //
+ //Use ClassInitialize to run code before running the first test in the class
+ //[ClassInitialize()]
+ //static void MyClassInitialize(TestContext^ testContext) {};
+ //
+ //Use ClassCleanup to run code after all tests in a class have run
+ //[ClassCleanup()]
+ //static void MyClassCleanup() {};
+ //
+ //Use TestInitialize to run code before running each test
+ //[TestInitialize()]
+ //void MyTestInitialize() {};
+ //
+ //Use TestCleanup to run code after each test has run
+ //[TestCleanup()]
+ //void MyTestCleanup() {};
+ //
+ #pragma endregion
+
+ [TestMethod]
+ void NullptrInstance()
+ {
+ auto p = gcnew native_shared_ptr<NativeTestClass>(__nullptr);
+
+ Assert::IsNotNull(p);
+ Assert::IsTrue(__nullptr == p->get());
+ };
+
+ [TestMethod]
+ void AnInstance()
+ {
+ auto n = std::make_shared<NativeTestClass>(1);
+ auto p = gcnew native_shared_ptr<NativeTestClass>(n);
+
+ Assert::IsNotNull(p);
+ Assert::IsFalse(__nullptr == p->get());
+ Assert::AreEqual(1, p->get()->i);
+
+ auto x = p->get_shared_ptr();
+ Assert::IsTrue(x == n);
+ };
+
+ [TestMethod]
+ void DestructorCalledAfterGC()
+ {
+ bool destructorCalled = false;
+ auto p = gcnew native_shared_ptr<DestructNativeTestClass>(std::make_shared<DestructNativeTestClass>(1, destructorCalled));
+
+ // p eligible for GC
+ Utils::GCCollectAndWait();
+
+ Assert::IsTrue(destructorCalled);
+ }
+
+ [TestMethod]
+ void DestructorCalledAfterAllSharedPtrDescopesButNotAfterNativeSharePtrIsDestructed()
+ {
+ bool destructorCalled = false;
+ {
+ auto n = std::make_shared<DestructNativeTestClass>(1, destructorCalled);
+ auto p = gcnew native_shared_ptr<DestructNativeTestClass>(n);
+
+ // p eligible for GC
+ Utils::GCCollectAndWait();
+
+ // n should still have a ref on our native pointer, so native not deleted
+ Assert::IsFalse(destructorCalled);
+ }
+
+ // n has descoped so ref on native pointer is zero, should be deleted
+ Assert::IsTrue(destructorCalled);
+ }
+
+
+ [TestMethod]
+ void DestructorCalledAfterAllReferencesReleased()
+ {
+ bool destructorCalled = false;
+ auto p = gcnew native_shared_ptr<DestructNativeTestClass>(std::make_shared<DestructNativeTestClass>(1, destructorCalled));
+ auto q = p;
+
+ // only p eligible for collection
+ Utils::GCCollectAndWait();
+
+ Assert::IsFalse(destructorCalled);
+
+ // keeps q ineligible for collection
+ GC::KeepAlive(q);
+
+ // q eligible for collection
+ Utils::GCCollectAndWait();
+
+ Assert::IsTrue(destructorCalled);
+ }
+
+ native_shared_ptr<DestructNativeTestClass>^ make_shared(int i, bool& destructorCalled) {
+ return gcnew native_shared_ptr<DestructNativeTestClass>(std::make_shared<DestructNativeTestClass>(1, destructorCalled));
+ }
+
+ [TestMethod]
+ void GCCollectsWhileExecutingOnNativeClass()
+ {
+ bool destructorCalled = false;
+ auto p = make_shared(1, destructorCalled);
+
+ p->get()->GCCollectAndAssertDestructorCalledEquals(true, destructorCalled);
+ }
+
+ [TestMethod]
+ void GCCollectsAfterExecutingOnNativeClass()
+ {
+ bool destructorCalled = false;
+ auto p = make_shared(1, destructorCalled);
+
+ p->get()->GCCollectAndAssertDestructorCalledEquals(false, destructorCalled);
+ // keeps p ineligible for collection
+ GC::KeepAlive(p);
+
+ // p eligible for collection
+ Utils::GCCollectAndWait();
+ Assert::IsTrue(destructorCalled);
+ }
+
+ };
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/test/native_unique_ptrTests.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/test/native_unique_ptrTests.cpp b/src/clicache/test/native_unique_ptrTests.cpp
new file mode 100644
index 0000000..393aed5
--- /dev/null
+++ b/src/clicache/test/native_unique_ptrTests.cpp
@@ -0,0 +1,178 @@
+#include <memory>
+#include <functional>
+#include <native_unique_ptr.hpp>
+#include "Utils.hpp"
+
+using namespace System;
+using namespace System::Text;
+using namespace System::Collections::Generic;
+using namespace Microsoft::VisualStudio::TestTools::UnitTesting;
+
+using namespace Apache::Geode::Client;
+
+namespace cliunittests
+{
+
+ class NativeTestClass {
+ public:
+ int i;
+ NativeTestClass(int i) : i(i) {};
+ };
+
+ class UniqueDestructNativeTestClass {
+ public:
+ int i;
+ UniqueDestructNativeTestClass(int i, bool& destructorCalled) : i(i), destructorCalled(destructorCalled) {};
+ ~UniqueDestructNativeTestClass() { destructorCalled = true; }
+ void GCCollectAndAssertDestructorCalledEquals(bool expected, const bool& destructorCalled)
+ {
+ Utils::GCCollectAndWait();
+ Assert::AreEqual(expected, destructorCalled);
+ }
+
+
+ private:
+ bool& destructorCalled;
+ };
+
+
+ [TestClass]
+ public ref class native_unique_ptrTests
+ {
+ private:
+ TestContext^ testContextInstance;
+
+ public:
+ /// <summary>
+ ///Gets or sets the test context which provides
+ ///information about and functionality for the current test run.
+ ///</summary>
+ property Microsoft::VisualStudio::TestTools::UnitTesting::TestContext^ TestContext
+ {
+ Microsoft::VisualStudio::TestTools::UnitTesting::TestContext^ get()
+ {
+ return testContextInstance;
+ }
+ System::Void set(Microsoft::VisualStudio::TestTools::UnitTesting::TestContext^ value)
+ {
+ testContextInstance = value;
+ }
+ };
+
+ #pragma region Additional test attributes
+ //
+ //You can use the following additional attributes as you write your tests:
+ //
+ //Use ClassInitialize to run code before running the first test in the class
+ //[ClassInitialize()]
+ //static void MyClassInitialize(TestContext^ testContext) {};
+ //
+ //Use ClassCleanup to run code after all tests in a class have run
+ //[ClassCleanup()]
+ //static void MyClassCleanup() {};
+ //
+ //Use TestInitialize to run code before running each test
+ //[TestInitialize()]
+ //void MyTestInitialize() {};
+ //
+ //Use TestCleanup to run code after each test has run
+ //[TestCleanup()]
+ //void MyTestCleanup() {};
+ //
+ #pragma endregion
+
+ [TestMethod]
+ void NullptrInstance()
+ {
+ auto p = gcnew native_unique_ptr<NativeTestClass>(__nullptr);
+
+ Assert::IsNotNull(p);
+ Assert::IsTrue(__nullptr == p->get());
+ };
+
+ [TestMethod]
+ void AnInstance()
+ {
+ auto n = std::make_unique<NativeTestClass>(1);
+ auto p = gcnew native_unique_ptr<NativeTestClass>(std::move(n));
+
+ Assert::IsTrue(__nullptr == n);
+ Assert::IsNotNull(p);
+ Assert::IsFalse(__nullptr == p->get());
+ Assert::AreEqual(1, p->get()->i);
+ };
+
+ [TestMethod]
+ void DestructorCalledAfterGC()
+ {
+ bool destructorCalled = false;
+ auto p = gcnew native_unique_ptr<UniqueDestructNativeTestClass>(std::make_unique<UniqueDestructNativeTestClass>(1, destructorCalled));
+
+ // p eligible for GC
+ Utils::GCCollectAndWait();
+
+ Assert::IsTrue(destructorCalled);
+ }
+
+ [TestMethod]
+ void DestructorCalledAfterNativeUniquePtrIsDestructed()
+ {
+ bool destructorCalled = false;
+ auto n = std::make_unique<UniqueDestructNativeTestClass>(1, destructorCalled);
+ auto p = gcnew native_unique_ptr<UniqueDestructNativeTestClass>(std::move(n));
+
+ // p eligible for GC
+ Utils::GCCollectAndWait();
+
+ // n does not have a ref on our native pointer, so native not deleted
+ Assert::IsTrue(destructorCalled);
+ }
+
+
+ [TestMethod]
+ void DestructorCalledAfterAllReferencesReleased()
+ {
+ bool destructorCalled = false;
+ auto p = gcnew native_unique_ptr<UniqueDestructNativeTestClass>(std::make_unique<UniqueDestructNativeTestClass>(1, destructorCalled));
+ auto q = p;
+
+ // only p eligible for collection
+ Utils::GCCollectAndWait();
+
+ Assert::IsFalse(destructorCalled);
+
+ // keeps q ineligible for collection
+ GC::KeepAlive(q);
+
+ // q eligible for collection
+ Utils::GCCollectAndWait();
+
+ Assert::IsTrue(destructorCalled);
+ }
+
+ [TestMethod]
+ void GCCollectsWhileExecutingOnNativeClass()
+ {
+ bool destructorCalled = false;
+ auto p = gcnew native_unique_ptr<UniqueDestructNativeTestClass>(std::make_unique<UniqueDestructNativeTestClass>(1, destructorCalled));
+
+ p->get()->GCCollectAndAssertDestructorCalledEquals(true, destructorCalled);
+ }
+
+ [TestMethod]
+ void GCCollectsAfterExecutingOnNativeClass()
+ {
+ bool destructorCalled = false;
+ auto p = gcnew native_unique_ptr<UniqueDestructNativeTestClass>(std::make_unique<UniqueDestructNativeTestClass>(1, destructorCalled));
+
+ p->get()->GCCollectAndAssertDestructorCalledEquals(false, destructorCalled);
+ // keeps p ineligible for collection
+ GC::KeepAlive(p);
+
+ // p eligible for collection
+ Utils::GCCollectAndWait();
+ Assert::IsTrue(destructorCalled);
+ }
+
+ };
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/cppcache/include/geode/CacheFactory.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/CacheFactory.hpp b/src/cppcache/include/geode/CacheFactory.hpp
index 5d519bb..ab3cbe0 100644
--- a/src/cppcache/include/geode/CacheFactory.hpp
+++ b/src/cppcache/include/geode/CacheFactory.hpp
@@ -494,7 +494,6 @@ class CPPCACHE_EXPORT CacheFactory
bool closeOk, CachePtr& cptr);
// Set very first time some creates cache
- static CacheFactoryPtr default_CacheFactory;
static PoolPtr createOrGetDefaultPool();
static void* m_cacheMap;
static void init();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/cppcache/include/geode/RegionEntry.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/RegionEntry.hpp b/src/cppcache/include/geode/RegionEntry.hpp
index 0f50951..b6f2443 100644
--- a/src/cppcache/include/geode/RegionEntry.hpp
+++ b/src/cppcache/include/geode/RegionEntry.hpp
@@ -67,7 +67,7 @@ class CPPCACHE_EXPORT RegionEntry : public SharedBase {
*
* @return the Region that contains this entry
*/
- void getRegion(Region* region);
+ RegionPtr getRegion();
/** Returns the statistics for this entry.
*
@@ -95,14 +95,16 @@ class CPPCACHE_EXPORT RegionEntry : public SharedBase {
* @brief constructors
* created by region
*/
- RegionEntry(Region* region, const CacheableKeyPtr& key,
+ RegionEntry(const RegionPtr& region, const CacheableKeyPtr& key,
const CacheablePtr& value);
- Region* m_region;
+ RegionPtr m_region;
CacheableKeyPtr m_key;
CacheablePtr m_value;
CacheStatisticsPtr m_statistics;
bool m_destroyed;
friend class RegionInternal;
+
+ FRIEND_STD_SHARED_PTR(RegionEntry)
};
} // namespace client
} // namespace geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/cppcache/include/geode/TransactionId.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/TransactionId.hpp b/src/cppcache/include/geode/TransactionId.hpp
index 7723668..63a4c14 100644
--- a/src/cppcache/include/geode/TransactionId.hpp
+++ b/src/cppcache/include/geode/TransactionId.hpp
@@ -19,12 +19,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/*
- * TransactionId.h
- *
- * Created on: 04-Feb-2011
- * Author: ankurs
- */
+
+#include <memory>
#include "SharedBase.hpp"
@@ -41,6 +37,8 @@ class CPPCACHE_EXPORT TransactionId : public apache::geode::client::SharedBase {
protected:
TransactionId();
virtual ~TransactionId();
+
+ FRIEND_STD_SHARED_PTR(TransactionId)
};
} // namespace client
} // namespace geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/cppcache/include/geode/geode_base.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/geode_base.hpp b/src/cppcache/include/geode/geode_base.hpp
index 369f830..dc0bc80 100644
--- a/src/cppcache/include/geode/geode_base.hpp
+++ b/src/cppcache/include/geode/geode_base.hpp
@@ -325,9 +325,17 @@ void operator delete[](void *p);
#define FRIEND_STD_SHARED_PTR(_T) \
friend __gnu_cxx::new_allocator<_T>;
#elif defined(_MSC_VER)
+#if defined(_MANAGED)
#define FRIEND_STD_SHARED_PTR(_T) \
friend std::_Ref_count_obj<_T>; \
- friend std::default_delete<_T>;
+ friend std::_Ref_count<_T>; \
+ friend std::_Ptr_base<_T>; \
+ friend std::default_delete<_T>; \
+ friend std::shared_ptr<_T>;
+#else
+#define FRIEND_STD_SHARED_PTR(_T) \
+ friend std::_Ref_count_obj<_T>;
+#endif
#else
#define FRIEND_STD_SHARED_PTR(_T)
#endif
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/cppcache/src/CacheFactory.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CacheFactory.cpp b/src/cppcache/src/CacheFactory.cpp
index ec332e5..43da0d0 100644
--- a/src/cppcache/src/CacheFactory.cpp
+++ b/src/cppcache/src/CacheFactory.cpp
@@ -55,7 +55,8 @@ typedef std::map<std::string, CachePtr> StringToCachePtrMap;
void* CacheFactory::m_cacheMap = (void*)NULL;
-CacheFactoryPtr CacheFactory::default_CacheFactory = nullptr;
+// TODO: Why can't this be a shared_ptr?
+CacheFactory* default_CacheFactory = nullptr;
PoolPtr CacheFactory::createOrGetDefaultPool() {
ACE_Guard<ACE_Recursive_Thread_Mutex> connectGuard(*g_disconnectLock);
@@ -225,7 +226,7 @@ CachePtr CacheFactory::create() {
cache = getAnyInstance(false);
if (cache == nullptr) {
- default_CacheFactory = shared_from_this();
+ default_CacheFactory = this;
Cache_CreatedFromCacheFactory = true;
cache = create(DEFAULT_CACHE_NAME, dsPtr,
dsPtr->getSystemProperties()->cacheXMLFile(), nullptr);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/cppcache/src/CacheImpl.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CacheImpl.cpp b/src/cppcache/src/CacheImpl.cpp
index abfab22..40f0cc9 100644
--- a/src/cppcache/src/CacheImpl.cpp
+++ b/src/cppcache/src/CacheImpl.cpp
@@ -365,6 +365,8 @@ void CacheImpl::close(bool keepalive) {
m_adminRegion = nullptr;
}
+ CacheImpl::s_versionStampMemIdList = nullptr;
+
// The TCCM gets destroyed when CacheImpl is destroyed, but after that there
// is still a window for the ping related registered task to get activated
// because expiryTaskManager is closed in DS::disconnect. If this happens
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/cppcache/src/PdxTypeRegistry.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxTypeRegistry.cpp b/src/cppcache/src/PdxTypeRegistry.cpp
index 6f34b9f..0efbb3a 100644
--- a/src/cppcache/src/PdxTypeRegistry.cpp
+++ b/src/cppcache/src/PdxTypeRegistry.cpp
@@ -80,6 +80,8 @@ void PdxTypeRegistry::cleanup() {
GF_SAFE_DELETE(remoteTypeIdToMergedPdxType);
GF_SAFE_DELETE(localTypeToPdxType);
GF_SAFE_DELETE(pdxTypeToTypeIdMap);
+ intToEnum = nullptr;
+ enumToInt = nullptr;
// GF_SAFE_DELETE(preserveData);
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/cppcache/src/PooledBase.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PooledBase.cpp b/src/cppcache/src/PooledBase.cpp
deleted file mode 100644
index c892eb3..0000000
--- a/src/cppcache/src/PooledBase.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-
-
-// util/PooledBase.cpp -*- mode: c++ -*-
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "PooledBase.hpp"
-#include "HostAsm.hpp"
-#include "PooledBasePool.hpp"
-
-#include <typeinfo>
-
-namespace apache {
-namespace geode {
-namespace client {
-
-PooledBase::PooledBase(PooledBasePool* pool) : m_refCount(0), m_pool(pool) {
- GF_D_ASSERT(m_pool != NULL);
-}
-
-PooledBase::~PooledBase() { m_pool = NULL; }
-
-void PooledBase::preserveSB() const {
- PooledBase* self = const_cast<PooledBase*>(this);
- HostAsm::atomicAdd(self->m_refCount, 1);
-}
-
-void PooledBase::releaseSB() const {
- PooledBase* self = const_cast<PooledBase*>(this);
- if (HostAsm::atomicAdd(self->m_refCount, -1) == 0) {
- m_pool->returnToPool(self);
- }
-}
-
-void PooledBase::prePool() {}
-
-void PooledBase::postPool() {}
-} // namespace client
-} // namespace geode
-} // namespace apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/cppcache/src/PooledBase.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PooledBase.hpp b/src/cppcache/src/PooledBase.hpp
deleted file mode 100644
index efdb7f4..0000000
--- a/src/cppcache/src/PooledBase.hpp
+++ /dev/null
@@ -1,64 +0,0 @@
-#pragma once
-
-#ifndef GEODE_POOLEDBASE_H_
-#define GEODE_POOLEDBASE_H_
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <geode/geode_globals.hpp>
-
-namespace apache {
-namespace geode {
-namespace client {
-
-class PooledBasePool;
-
-/**
- * @class PooledBase PooledBase.hpp
- *
- * This abstract base class is the base class of all user objects
- * that have the shared capability of reference counting.
- */
-class CPPCACHE_EXPORT PooledBase {
- public:
- PooledBase(PooledBasePool* pool);
-
- void preserveSB() const;
- void releaseSB() const;
-
- inline int32_t refCount() { return m_refCount; }
-
- virtual ~PooledBase();
-
- /** called just prior to inserting an object back into the pool. */
- virtual void prePool();
-
- /** called just after removing an object from the pool. */
- virtual void postPool();
-
- private:
- volatile int32_t m_refCount;
- PooledBasePool* m_pool;
-
- void operator=(const PooledBase& rhs);
-};
-} // namespace client
-} // namespace geode
-} // namespace apache
-
-#endif // GEODE_POOLEDBASE_H_
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/cppcache/src/PooledBasePool.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PooledBasePool.hpp b/src/cppcache/src/PooledBasePool.hpp
deleted file mode 100644
index f065cb1..0000000
--- a/src/cppcache/src/PooledBasePool.hpp
+++ /dev/null
@@ -1,85 +0,0 @@
-#pragma once
-
-#ifndef GEODE_POOLEDBASEPOOL_H_
-#define GEODE_POOLEDBASEPOOL_H_
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <geode/geode_globals.hpp>
-#include <geode/SharedPtr.hpp>
-#include "SpinLock.hpp"
-#include "PooledBase.hpp"
-#include <deque>
-
-namespace apache {
-namespace geode {
-namespace client {
-
-class CPPCACHE_EXPORT PooledBasePool {
- SpinLock m_poolLock;
- std::deque<PooledBase*> m_pooldata;
-
- public:
- PooledBasePool() : m_poolLock(), m_pooldata() {}
-
- ~PooledBasePool() {
- SpinLockGuard guard(m_poolLock);
- while (!m_pooldata.empty()) {
- PooledBase* item = m_pooldata.front();
- m_pooldata.pop_front();
- delete item;
- }
- }
-
- inline void returnToPool(PooledBase* poolable) {
- poolable->prePool();
- {
- SpinLockGuard guard(m_poolLock);
- m_pooldata.push_back(const_cast<PooledBase*>(poolable));
- }
- }
-
- inline PooledBase* takeFromPool() {
- PooledBase* result = NULL;
- {
- SpinLockGuard guard(m_poolLock);
- if (!m_pooldata.empty()) {
- result = m_pooldata.front();
- m_pooldata.pop_front();
- }
- }
- if (result != NULL) {
- result->postPool();
- }
- return result;
- }
-
- inline void clear() {
- SpinLockGuard guard(m_poolLock);
- while (!m_pooldata.empty()) {
- PooledBase* item = m_pooldata.front();
- m_pooldata.pop_front();
- delete item;
- }
- }
-};
-} // namespace client
-} // namespace geode
-} // namespace apache
-
-#endif // GEODE_POOLEDBASEPOOL_H_
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/cppcache/src/RegionEntry.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/RegionEntry.cpp b/src/cppcache/src/RegionEntry.cpp
index fbf6246..6f52986 100644
--- a/src/cppcache/src/RegionEntry.cpp
+++ b/src/cppcache/src/RegionEntry.cpp
@@ -19,18 +19,30 @@
#include <geode/CacheableKey.hpp>
#include <CacheableToken.hpp>
-using namespace apache::geode::client;
+namespace apache {
+namespace geode {
+namespace client {
-RegionEntry::RegionEntry(Region* region, const CacheableKeyPtr& key,
+RegionEntry::RegionEntry(const RegionPtr& region, const CacheableKeyPtr& key,
const CacheablePtr& value)
: m_region(region), m_key(key), m_value(value), m_destroyed(false) {}
+
RegionEntry::~RegionEntry() {}
+
CacheableKeyPtr RegionEntry::getKey() { return m_key; }
+
CacheablePtr RegionEntry::getValue() {
return CacheableToken::isInvalid(m_value) ? nullptr : m_value;
}
-void RegionEntry::getRegion(Region* region) { region = m_region; }
+
+RegionPtr RegionEntry::getRegion() { return m_region; }
+
void RegionEntry::getStatistics(CacheStatisticsPtr& csptr) {
csptr = m_statistics;
}
+
bool RegionEntry::isDestroyed() const { return m_destroyed; }
+
+} // namespace client
+} // namespace geode
+} // namespace apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/cppcache/src/RegionInternal.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/RegionInternal.cpp b/src/cppcache/src/RegionInternal.cpp
index 512cf1d..0dc47cb 100644
--- a/src/cppcache/src/RegionInternal.cpp
+++ b/src/cppcache/src/RegionInternal.cpp
@@ -105,7 +105,7 @@ TombstoneListPtr RegionInternal::getTombstoneList() {
RegionEntryPtr RegionInternal::createRegionEntry(const CacheableKeyPtr& key,
const CacheablePtr& value) {
- return RegionEntryPtr(new RegionEntry(this, key, value));
+ return std::make_shared<RegionEntry>(shared_from_this(), key, value);
}
void RegionInternal::setLruEntriesLimit(uint32_t limit) {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/tests/cli/PkcsWrapper/PkcsAuthInitMN.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cli/PkcsWrapper/PkcsAuthInitMN.cpp b/src/tests/cli/PkcsWrapper/PkcsAuthInitMN.cpp
index d2ebf45..b5fbac8 100644
--- a/src/tests/cli/PkcsWrapper/PkcsAuthInitMN.cpp
+++ b/src/tests/cli/PkcsWrapper/PkcsAuthInitMN.cpp
@@ -16,7 +16,9 @@
*/
#include "PkcsAuthInitMN.hpp"
+#include "begin_native.hpp"
#include <geode/Properties.hpp>
+#include "end_native.hpp"
#include "impl/ManagedString.hpp"
using namespace System;
@@ -42,13 +44,14 @@ Apache::Geode::Client::Properties<String^, Object^>^
PkcsAuthInit::GetCredentials(
Apache::Geode::Client::Properties<String^, String^> ^props, System::String ^server)
{
- Apache::Geode::Client::ManagedString mg_server( server );
- apache::geode::client::PropertiesPtr propsPtr = nullptr;
- if (props != nullptr) {
- propsPtr = (apache::geode::client::Properties*)props->NativeIntPtr;
- }
- apache::geode::client::PKCSAuthInitInternal* nativeptr = new apache::geode::client::PKCSAuthInitInternal(true);
- apache::geode::client::PropertiesPtr& newPropsPtr = nativeptr->getCredentials(propsPtr, mg_server.CharPtr);
- return Apache::Geode::Client::Properties<String^, Object^>::
- CreateFromVoidPtr<String^, Object^>(newPropsPtr.get());
+ throw gcnew System::NotImplementedException();
+ //Apache::Geode::Client::ManagedString mg_server( server );
+ //apache::geode::client::PropertiesPtr propsPtr = __nullptr;
+ //if (props != nullptr) {
+ // propsPtr = props->GetNative();
+ //}
+ //apache::geode::client::PKCSAuthInitInternal* nativeptr = new apache::geode::client::PKCSAuthInitInternal(true);
+ //apache::geode::client::PropertiesPtr& newPropsPtr = nativeptr->getCredentials(propsPtr, mg_server.CharPtr);
+ //return Apache::Geode::Client::Properties<String^, Object^>::
+ // CreateFromVoidPtr<String^, Object^>(newPropsPtr.get());
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/tests/cli/PkcsWrapper/PkcsAuthInitMN.hpp
----------------------------------------------------------------------
diff --git a/src/tests/cli/PkcsWrapper/PkcsAuthInitMN.hpp b/src/tests/cli/PkcsWrapper/PkcsAuthInitMN.hpp
index 1a9d00f..249863a 100644
--- a/src/tests/cli/PkcsWrapper/PkcsAuthInitMN.hpp
+++ b/src/tests/cli/PkcsWrapper/PkcsAuthInitMN.hpp
@@ -17,8 +17,9 @@
#pragma once
+#include <memory>
+#include "native_shared_ptr.hpp"
#include "PkcsAuthInit.hpp"
-#include "impl/NativeWrapper.hpp"
using namespace System;
@@ -33,8 +34,7 @@ namespace Apache
namespace Tests
{
public ref class PkcsAuthInit sealed
- : public Internal::SBWrap<apache::geode::client::PKCSAuthInitInternal>,
- public Apache::Geode::Client::IAuthInitialize/*<String^, Object^>*/
+ : public Apache::Geode::Client::IAuthInitialize
{
public:
@@ -50,8 +50,13 @@ namespace Apache
virtual void Close();
internal:
- PkcsAuthInit(apache::geode::client::PKCSAuthInitInternal* nativeptr)
- : SBWrap(nativeptr) { }
+ PkcsAuthInit(const std::shared_ptr<apache::geode::client::PKCSAuthInitInternal>& nativeptr)
+ {
+ m_nativeptr = gcnew native_shared_ptr<apache::geode::client::PKCSAuthInitInternal>(nativeptr);
+ }
+
+ private:
+ native_shared_ptr<apache::geode::client::PKCSAuthInitInternal>^ m_nativeptr;
};
}
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/tests/cli/QueryHelper/QueryStringsM.cpp
----------------------------------------------------------------------
diff --git a/src/tests/cli/QueryHelper/QueryStringsM.cpp b/src/tests/cli/QueryHelper/QueryStringsM.cpp
index ae7f1cf..da40374 100644
--- a/src/tests/cli/QueryHelper/QueryStringsM.cpp
+++ b/src/tests/cli/QueryHelper/QueryStringsM.cpp
@@ -25,7 +25,7 @@ namespace Apache
{
namespace Client
{
-namespace Tests
+ namespace Tests
{
// Region: QueryStrings method definitions
@@ -35,10 +35,10 @@ namespace Tests
{
Apache::Geode::Client::ManagedString mg_pquery( pquery );
- testData::QueryStrings* nativeptr = new testData::QueryStrings(
+ auto nativeptr = std::make_unique<testData::QueryStrings>(
static_cast<testData::queryCategory>( pcategory ),
mg_pquery.CharPtr, pisLargeResultset );
- SetPtr( nativeptr, true );
+ m_nativeptr = gcnew native_conditional_unique_ptr<testData::QueryStrings>(std::move(nativeptr));
}
Int32 QueryStrings::RSsize::get( )
@@ -73,17 +73,38 @@ namespace Tests
QueryCategory QueryStrings::Category::get()
{
- return static_cast<QueryCategory>( NativePtr->category );
+ try
+ {
+ return static_cast<QueryCategory>( m_nativeptr->get()->category );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
String^ QueryStrings::Query::get( )
{
- return Apache::Geode::Client::ManagedString::Get( NativePtr->query( ) );
+ try
+ {
+ return Apache::Geode::Client::ManagedString::Get( m_nativeptr->get()->query( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
bool QueryStrings::IsLargeResultset::get( )
{
- return NativePtr->haveLargeResultset;
+ try
+ {
+ return m_nativeptr->get()->haveLargeResultset;
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
// End Region: QueryStrings method definitions
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/tests/cli/QueryHelper/QueryStringsM.hpp
----------------------------------------------------------------------
diff --git a/src/tests/cli/QueryHelper/QueryStringsM.hpp b/src/tests/cli/QueryHelper/QueryStringsM.hpp
index e4004b2..e43eb9f 100644
--- a/src/tests/cli/QueryHelper/QueryStringsM.hpp
+++ b/src/tests/cli/QueryHelper/QueryStringsM.hpp
@@ -18,7 +18,7 @@
#pragma once
#include "QueryStrings.hpp"
-#include "impl/NativeWrapper.hpp"
+#include "native_conditional_unique_ptr.hpp"
using namespace System;
@@ -29,7 +29,7 @@ namespace Apache
{
namespace Client
{
-namespace Tests
+ namespace Tests
{
/// <summary>
@@ -60,7 +60,6 @@ namespace Tests
/// Encapsulates a query string.
/// </summary>
public ref class QueryStrings sealed
- : public Apache::Geode::Client::Internal::UMWrap<testData::QueryStrings>
{
public:
@@ -125,6 +124,7 @@ namespace Tests
void Init( QueryCategory pcategory, String^ pquery,
Boolean pisLargeResultset );
+ native_conditional_unique_ptr<testData::QueryStrings>^ m_nativeptr;
internal:
@@ -132,8 +132,10 @@ namespace Tests
/// Internal constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline QueryStrings( testData::QueryStrings* nativeptr )
- : UMWrap( nativeptr, false ) { }
+ inline QueryStrings(testData::QueryStrings* nativeptr)
+ {
+ m_nativeptr = gcnew native_conditional_unique_ptr<testData::QueryStrings>(nativeptr);
+ }
};
/// <summary>
[38/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from clicache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/DistributedSystem.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/DistributedSystem.cpp b/src/clicache/src/DistributedSystem.cpp
index bd29a91..239d7e2 100644
--- a/src/clicache/src/DistributedSystem.cpp
+++ b/src/clicache/src/DistributedSystem.cpp
@@ -15,8 +15,19 @@
* limitations under the License.
*/
-//#include "geode_includes.hpp"
-#include "version.h"
+#include "begin_native.hpp"
+#include <version.h>
+#include <geode/CacheLoader.hpp>
+#include <geode/CacheListener.hpp>
+#include <geode/FixedPartitionResolver.hpp>
+#include <geode/CacheWriter.hpp>
+#include <geode/GeodeTypeIds.hpp>
+#include <CacheImpl.hpp>
+#include <CacheXmlParser.hpp>
+#include <DistributedSystemImpl.hpp>
+#include <ace/Process.h> // Added to get rid of unresolved token warning
+#include "end_native.hpp"
+
#include "Serializable.hpp"
#include "DistributedSystem.hpp"
#include "SystemProperties.hpp"
@@ -40,16 +51,7 @@
#include "Log.hpp"
#include "Struct.hpp"
#include "impl/MemoryPressureHandler.hpp"
-#include <geode/CacheLoader.hpp>
-#include <geode/CacheListener.hpp>
-#include <geode/FixedPartitionResolver.hpp>
-#include <geode/CacheWriter.hpp>
-#include <geode/GeodeTypeIds.hpp>
-#include <CacheImpl.hpp>
-#include <PooledBasePool.hpp>
-#include <CacheXmlParser.hpp>
#include "impl/SafeConvert.hpp"
-#include <DistributedSystemImpl.hpp>
#include "impl/PdxType.hpp"
#include "impl/EnumInfo.hpp"
#include "impl/ManagedPersistenceManager.hpp"
@@ -58,7 +60,6 @@
#pragma warning(disable:4091)
#include <msclr/lock.h>
#pragma warning(default:4091)
-#include <ace/Process.h> // Added to get rid of unresolved token warning
using namespace System;
@@ -127,6 +128,8 @@ namespace Apache
namespace Client
{
+ namespace native = apache::geode::client;
+
DistributedSystem^ DistributedSystem::Connect(String^ name)
{
return DistributedSystem::Connect(name, nullptr);
@@ -134,130 +137,53 @@ namespace Apache
DistributedSystem^ DistributedSystem::Connect(String^ name, Properties<String^, String^>^ config)
{
- apache::geode::client::DistributedSystemImpl::acquireDisconnectLock();
+ native::DistributedSystemImpl::acquireDisconnectLock();
_GF_MG_EXCEPTION_TRY2
ManagedString mg_name(name);
- apache::geode::client::PropertiesPtr nativepropsptr(
- GetNativePtr<apache::geode::client::Properties>(config));
-
- // apache::geode::client::PropertiesPtr nativepropsptr;
- DistributedSystem::AppDomainInstanceInitialization(nativepropsptr);
+ DistributedSystem::AppDomainInstanceInitialization(config->GetNative());
// this we are calling after all .NET initialization required in
// each AppDomain
- apache::geode::client::DistributedSystemPtr& nativeptr(
- apache::geode::client::DistributedSystem::connect(mg_name.CharPtr,
- nativepropsptr));
+ auto nativeptr = native::DistributedSystem::connect(mg_name.CharPtr,
+ config->GetNative());
ManagedPostConnect();
- // DistributedSystem::AppDomainInstancePostInitialization();
-
- return Create(nativeptr.get());
+ return Create(nativeptr);
_GF_MG_EXCEPTION_CATCH_ALL2
finally {
- apache::geode::client::DistributedSystemImpl::releaseDisconnectLock();
+ native::DistributedSystemImpl::releaseDisconnectLock();
}
}
void DistributedSystem::Disconnect()
{
- apache::geode::client::DistributedSystemImpl::acquireDisconnectLock();
+ native::DistributedSystemImpl::acquireDisconnectLock();
_GF_MG_EXCEPTION_TRY2
- if (apache::geode::client::DistributedSystem::isConnected()) {
- // apache::geode::client::CacheImpl::expiryTaskManager->cancelTask(
+ if (native::DistributedSystem::isConnected()) {
+ // native::CacheImpl::expiryTaskManager->cancelTask(
// s_memoryPressureTaskID);
Serializable::UnregisterNativesGeneric();
DistributedSystem::UnregisterBuiltinManagedTypes();
}
- apache::geode::client::DistributedSystem::disconnect();
+ native::DistributedSystem::disconnect();
_GF_MG_EXCEPTION_CATCH_ALL2
finally {
- apache::geode::client::DistributedSystemImpl::releaseDisconnectLock();
+ native::DistributedSystemImpl::releaseDisconnectLock();
}
}
-
- /* DistributedSystem^ DistributedSystem::ConnectOrGetInstance(String^ name)
- {
- return DistributedSystem::ConnectOrGetInstance(name, nullptr);
- }
-
- DistributedSystem^ DistributedSystem::ConnectOrGetInstance(String^ name,
- Properties^ config)
- {
- apache::geode::client::DistributedSystemImpl::acquireDisconnectLock();
-
- _GF_MG_EXCEPTION_TRY
-
- ManagedString mg_name(name);
- apache::geode::client::PropertiesPtr nativepropsptr(
- GetNativePtr<apache::geode::client::Properties>(config));
- DistributedSystem::AppDomainInstanceInitialization(nativepropsptr);
-
- // this we are calling after all .NET initialization required in
- // each AppDomain
- apache::geode::client::DistributedSystemPtr& nativeptr(
- apache::geode::client::DistributedSystem::connectOrGetInstance(mg_name.CharPtr,
- nativepropsptr));
-
- if (apache::geode::client::DistributedSystem::currentInstances() == 1) {
- // stuff to be done only for the first connect
- ManagedPostConnect();
- }
-
- DistributedSystem::AppDomainInstancePostInitialization();
-
- return Create(nativeptr.get());
-
- _GF_MG_EXCEPTION_CATCH_ALL
-
- finally {
- apache::geode::client::DistributedSystemImpl::releaseDisconnectLock();
- }
- }
- */
- /* int DistributedSystem::DisconnectInstance()
- {
- apache::geode::client::DistributedSystemImpl::acquireDisconnectLock();
-
- _GF_MG_EXCEPTION_TRY
-
- int remainingInstances =
- apache::geode::client::DistributedSystem::currentInstances();
- if (remainingInstances <= 0) {
- throw gcnew NotConnectedException("DistributedSystem."
- "DisconnectInstance: no remaining instance connections");
- }
-
- //apache::geode::client::CacheImpl::expiryTaskManager->cancelTask(
- //s_memoryPressureTaskID);
- Serializable::UnregisterNatives();
-
- if (remainingInstances == 1) { // last instance
- DistributedSystem::UnregisterBuiltinManagedTypes();
- }
- return apache::geode::client::DistributedSystem::disconnectInstance();
-
- _GF_MG_EXCEPTION_CATCH_ALL
-
- finally {
- apache::geode::client::DistributedSystemImpl::releaseDisconnectLock();
- }
- }
- */
-
void DistributedSystem::AppDomainInstanceInitialization(
- const apache::geode::client::PropertiesPtr& nativepropsptr)
+ const native::PropertiesPtr& nativepropsptr)
{
_GF_MG_EXCEPTION_TRY2
@@ -266,128 +192,128 @@ namespace Apache
/*
Serializable::RegisterWrapperGeneric(
gcnew WrapperDelegateGeneric(Apache::Geode::Client::CacheableHashSet::Create),
- apache::geode::client::GeodeTypeIds::CacheableHashSet);
+ native::GeodeTypeIds::CacheableHashSet);
Serializable::RegisterWrapperGeneric(
gcnew WrapperDelegateGeneric(Apache::Geode::Client::CacheableLinkedHashSet::Create),
- apache::geode::client::GeodeTypeIds::CacheableLinkedHashSet);
+ native::GeodeTypeIds::CacheableLinkedHashSet);
Serializable::RegisterWrapperGeneric(
gcnew WrapperDelegateGeneric(Apache::Geode::Client::Struct::Create),
- apache::geode::client::GeodeTypeIds::Struct);
+ native::GeodeTypeIds::Struct);
Serializable::RegisterWrapperGeneric(
gcnew WrapperDelegateGeneric(Apache::Geode::Client::Properties::CreateDeserializable),
- apache::geode::client::GeodeTypeIds::Properties);
+ native::GeodeTypeIds::Properties);
// End register wrapper types for built-in types
// Register with cpp using unmanaged Cacheablekey wrapper
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableByte,
+ native::GeodeTypeIds::CacheableByte,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::CacheableByte::CreateDeserializable));
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableBoolean,
+ native::GeodeTypeIds::CacheableBoolean,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::CacheableBoolean::CreateDeserializable));
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableBytes,
+ native::GeodeTypeIds::CacheableBytes,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::CacheableBytes::CreateDeserializable));
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::BooleanArray,
+ native::GeodeTypeIds::BooleanArray,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::BooleanArray::CreateDeserializable));
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableWideChar,
+ native::GeodeTypeIds::CacheableWideChar,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::CacheableCharacter::CreateDeserializable));
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CharArray,
+ native::GeodeTypeIds::CharArray,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::CharArray::CreateDeserializable));
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableDouble,
+ native::GeodeTypeIds::CacheableDouble,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::CacheableDouble::CreateDeserializable));
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableDoubleArray,
+ native::GeodeTypeIds::CacheableDoubleArray,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::CacheableDoubleArray::CreateDeserializable));
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableFloat,
+ native::GeodeTypeIds::CacheableFloat,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::CacheableFloat::CreateDeserializable));
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableFloatArray,
+ native::GeodeTypeIds::CacheableFloatArray,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::CacheableFloatArray::CreateDeserializable));
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableHashSet,
+ native::GeodeTypeIds::CacheableHashSet,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::CacheableHashSet::CreateDeserializable));
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableLinkedHashSet,
+ native::GeodeTypeIds::CacheableLinkedHashSet,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::CacheableLinkedHashSet::CreateDeserializable));
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableInt16,
+ native::GeodeTypeIds::CacheableInt16,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::CacheableInt16::CreateDeserializable));
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableInt16Array,
+ native::GeodeTypeIds::CacheableInt16Array,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::CacheableInt16Array::CreateDeserializable));
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableInt32,
+ native::GeodeTypeIds::CacheableInt32,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::CacheableInt32::CreateDeserializable));
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableInt32Array,
+ native::GeodeTypeIds::CacheableInt32Array,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::CacheableInt32Array::CreateDeserializable));
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableInt64,
+ native::GeodeTypeIds::CacheableInt64,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::CacheableInt64::CreateDeserializable));
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableInt64Array,
+ native::GeodeTypeIds::CacheableInt64Array,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::CacheableInt64Array::CreateDeserializable));
*/
/*Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableASCIIString,
+ native::GeodeTypeIds::CacheableASCIIString,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::CacheableString::CreateDeserializable));
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableASCIIStringHuge,
+ native::GeodeTypeIds::CacheableASCIIStringHuge,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::CacheableString::createDeserializableHuge));
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableString,
+ native::GeodeTypeIds::CacheableString,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::CacheableString::createUTFDeserializable));
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableStringHuge,
+ native::GeodeTypeIds::CacheableStringHuge,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::CacheableString::createUTFDeserializableHuge));*/
/*
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableNullString,
+ native::GeodeTypeIds::CacheableNullString,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::CacheableString::CreateDeserializable));
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableStringArray,
+ native::GeodeTypeIds::CacheableStringArray,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::CacheableStringArray::CreateDeserializable));
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::Struct,
+ native::GeodeTypeIds::Struct,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::Struct::CreateDeserializable));
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::Properties,
+ native::GeodeTypeIds::Properties,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::Properties::CreateDeserializable));
*/
@@ -399,209 +325,209 @@ namespace Apache
/* Serializable::RegisterWrapperGeneric(
gcnew WrapperDelegateGeneric(CacheableByte::Create),
- apache::geode::client::GeodeTypeIds::CacheableByte, Byte::typeid);*/
+ native::GeodeTypeIds::CacheableByte, Byte::typeid);*/
Serializable::RegisterWrapperGeneric(
gcnew WrapperDelegateGeneric(CacheableByte::Create),
- apache::geode::client::GeodeTypeIds::CacheableByte, SByte::typeid);
+ native::GeodeTypeIds::CacheableByte, SByte::typeid);
//boolean
Serializable::RegisterWrapperGeneric(
gcnew WrapperDelegateGeneric(CacheableBoolean::Create),
- apache::geode::client::GeodeTypeIds::CacheableBoolean, Boolean::typeid);
+ native::GeodeTypeIds::CacheableBoolean, Boolean::typeid);
//wide char
Serializable::RegisterWrapperGeneric(
gcnew WrapperDelegateGeneric(CacheableCharacter::Create),
- apache::geode::client::GeodeTypeIds::CacheableWideChar, Char::typeid);
+ native::GeodeTypeIds::CacheableWideChar, Char::typeid);
//double
Serializable::RegisterWrapperGeneric(
gcnew WrapperDelegateGeneric(CacheableDouble::Create),
- apache::geode::client::GeodeTypeIds::CacheableDouble, Double::typeid);
+ native::GeodeTypeIds::CacheableDouble, Double::typeid);
//ascii string
Serializable::RegisterWrapperGeneric(
gcnew WrapperDelegateGeneric(CacheableString::Create),
- apache::geode::client::GeodeTypeIds::CacheableASCIIString, String::typeid);
+ native::GeodeTypeIds::CacheableASCIIString, String::typeid);
//TODO:
////ascii string huge
//Serializable::RegisterWrapperGeneric(
// gcnew WrapperDelegateGeneric(CacheableString::Create),
- // apache::geode::client::GeodeTypeIds::CacheableASCIIStringHuge, String::typeid);
+ // native::GeodeTypeIds::CacheableASCIIStringHuge, String::typeid);
////string
//Serializable::RegisterWrapperGeneric(
// gcnew WrapperDelegateGeneric(CacheableString::Create),
- // apache::geode::client::GeodeTypeIds::CacheableString, String::typeid);
+ // native::GeodeTypeIds::CacheableString, String::typeid);
////string huge
//Serializable::RegisterWrapperGeneric(
// gcnew WrapperDelegateGeneric(CacheableString::Create),
- // apache::geode::client::GeodeTypeIds::CacheableStringHuge, String::typeid);
+ // native::GeodeTypeIds::CacheableStringHuge, String::typeid);
//float
Serializable::RegisterWrapperGeneric(
gcnew WrapperDelegateGeneric(CacheableFloat::Create),
- apache::geode::client::GeodeTypeIds::CacheableFloat, float::typeid);
+ native::GeodeTypeIds::CacheableFloat, float::typeid);
//int 16
Serializable::RegisterWrapperGeneric(
gcnew WrapperDelegateGeneric(CacheableInt16::Create),
- apache::geode::client::GeodeTypeIds::CacheableInt16, Int16::typeid);
+ native::GeodeTypeIds::CacheableInt16, Int16::typeid);
//int32
Serializable::RegisterWrapperGeneric(
gcnew WrapperDelegateGeneric(CacheableInt32::Create),
- apache::geode::client::GeodeTypeIds::CacheableInt32, Int32::typeid);
+ native::GeodeTypeIds::CacheableInt32, Int32::typeid);
//int64
Serializable::RegisterWrapperGeneric(
gcnew WrapperDelegateGeneric(CacheableInt64::Create),
- apache::geode::client::GeodeTypeIds::CacheableInt64, Int64::typeid);
+ native::GeodeTypeIds::CacheableInt64, Int64::typeid);
////uint16
//Serializable::RegisterWrapperGeneric(
// gcnew WrapperDelegateGeneric(CacheableInt16::Create),
- // apache::geode::client::GeodeTypeIds::CacheableInt16, UInt16::typeid);
+ // native::GeodeTypeIds::CacheableInt16, UInt16::typeid);
////uint32
//Serializable::RegisterWrapperGeneric(
// gcnew WrapperDelegateGeneric(CacheableInt32::Create),
- // apache::geode::client::GeodeTypeIds::CacheableInt32, UInt32::typeid);
+ // native::GeodeTypeIds::CacheableInt32, UInt32::typeid);
////uint64
//Serializable::RegisterWrapperGeneric(
// gcnew WrapperDelegateGeneric(CacheableInt64::Create),
- // apache::geode::client::GeodeTypeIds::CacheableInt64, UInt64::typeid);
+ // native::GeodeTypeIds::CacheableInt64, UInt64::typeid);
//=======================================================================
//Now onwards all will be wrap in managed cacheable key..
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableBytes,
+ native::GeodeTypeIds::CacheableBytes,
gcnew TypeFactoryMethodGeneric(CacheableBytes::CreateDeserializable),
Type::GetType("System.Byte[]"));
/* Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableBytes,
+ native::GeodeTypeIds::CacheableBytes,
gcnew TypeFactoryMethodGeneric(CacheableBytes::CreateDeserializable),
Type::GetType("System.SByte[]"));*/
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableDoubleArray,
+ native::GeodeTypeIds::CacheableDoubleArray,
gcnew TypeFactoryMethodGeneric(CacheableDoubleArray::CreateDeserializable),
Type::GetType("System.Double[]"));
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableFloatArray,
+ native::GeodeTypeIds::CacheableFloatArray,
gcnew TypeFactoryMethodGeneric(CacheableFloatArray::CreateDeserializable),
Type::GetType("System.Single[]"));
//TODO:
//as it is
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableHashSet,
+ native::GeodeTypeIds::CacheableHashSet,
gcnew TypeFactoryMethodGeneric(CacheableHashSet::CreateDeserializable),
nullptr);
//as it is
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableLinkedHashSet,
+ native::GeodeTypeIds::CacheableLinkedHashSet,
gcnew TypeFactoryMethodGeneric(CacheableLinkedHashSet::CreateDeserializable),
nullptr);
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableInt16Array,
+ native::GeodeTypeIds::CacheableInt16Array,
gcnew TypeFactoryMethodGeneric(CacheableInt16Array::CreateDeserializable),
Type::GetType("System.Int16[]"));
/* Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableInt16Array,
+ native::GeodeTypeIds::CacheableInt16Array,
gcnew TypeFactoryMethodGeneric(CacheableInt16Array::CreateDeserializable),
Type::GetType("System.UInt16[]"));*/
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableInt32Array,
+ native::GeodeTypeIds::CacheableInt32Array,
gcnew TypeFactoryMethodGeneric(CacheableInt32Array::CreateDeserializable),
Type::GetType("System.Int32[]"));
/* Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableInt32Array,
+ native::GeodeTypeIds::CacheableInt32Array,
gcnew TypeFactoryMethodGeneric(CacheableInt32Array::CreateDeserializable),
Type::GetType("System.UInt32[]"));*/
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableInt64Array,
+ native::GeodeTypeIds::CacheableInt64Array,
gcnew TypeFactoryMethodGeneric(CacheableInt64Array::CreateDeserializable),
Type::GetType("System.Int64[]"));
/* Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableInt64Array,
+ native::GeodeTypeIds::CacheableInt64Array,
gcnew TypeFactoryMethodGeneric(CacheableInt64Array::CreateDeserializable),
Type::GetType("System.UInt64[]"));*/
//TODO:;split
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::BooleanArray,
+ native::GeodeTypeIds::BooleanArray,
gcnew TypeFactoryMethodGeneric(BooleanArray::CreateDeserializable),
Type::GetType("System.Boolean[]"));
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CharArray,
+ native::GeodeTypeIds::CharArray,
gcnew TypeFactoryMethodGeneric(CharArray::CreateDeserializable),
Type::GetType("System.Char[]"));
//TODO::
//Serializable::RegisterTypeGeneric(
- // apache::geode::client::GeodeTypeIds::CacheableNullString,
+ // native::GeodeTypeIds::CacheableNullString,
// gcnew TypeFactoryMethodNew(Apache::Geode::Client::CacheableString::CreateDeserializable));
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableStringArray,
+ native::GeodeTypeIds::CacheableStringArray,
gcnew TypeFactoryMethodGeneric(CacheableStringArray::CreateDeserializable),
Type::GetType("System.String[]"));
//as it is
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::Struct,
+ native::GeodeTypeIds::Struct,
gcnew TypeFactoryMethodGeneric(Struct::CreateDeserializable),
nullptr);
//as it is
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::Properties,
+ native::GeodeTypeIds::Properties,
gcnew TypeFactoryMethodGeneric(Properties<String^, String^>::CreateDeserializable),
nullptr);
/* Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::PdxType,
+ native::GeodeTypeIds::PdxType,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::Internal::PdxType::CreateDeserializable),
nullptr);*/
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::EnumInfo,
+ native::GeodeTypeIds::EnumInfo,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::Internal::EnumInfo::CreateDeserializable),
nullptr);
// End register generic wrapper types for built-in types
- if (!apache::geode::client::DistributedSystem::isConnected())
+ if (!native::DistributedSystem::isConnected())
{
// Set the Generic ManagedAuthInitialize factory function
- apache::geode::client::SystemProperties::managedAuthInitializeFn =
- apache::geode::client::ManagedAuthInitializeGeneric::create;
+ native::SystemProperties::managedAuthInitializeFn =
+ native::ManagedAuthInitializeGeneric::create;
// Set the Generic ManagedCacheLoader/Listener/Writer factory functions.
- apache::geode::client::CacheXmlParser::managedCacheLoaderFn =
- apache::geode::client::ManagedCacheLoaderGeneric::create;
- apache::geode::client::CacheXmlParser::managedCacheListenerFn =
- apache::geode::client::ManagedCacheListenerGeneric::create;
- apache::geode::client::CacheXmlParser::managedCacheWriterFn =
- apache::geode::client::ManagedCacheWriterGeneric::create;
+ native::CacheXmlParser::managedCacheLoaderFn =
+ native::ManagedCacheLoaderGeneric::create;
+ native::CacheXmlParser::managedCacheListenerFn =
+ native::ManagedCacheListenerGeneric::create;
+ native::CacheXmlParser::managedCacheWriterFn =
+ native::ManagedCacheWriterGeneric::create;
// Set the Generic ManagedPartitionResolver factory function
- apache::geode::client::CacheXmlParser::managedPartitionResolverFn =
- apache::geode::client::ManagedFixedPartitionResolverGeneric::create;
+ native::CacheXmlParser::managedPartitionResolverFn =
+ native::ManagedFixedPartitionResolverGeneric::create;
// Set the Generic ManagedPersistanceManager factory function
- apache::geode::client::CacheXmlParser::managedPersistenceManagerFn =
- apache::geode::client::ManagedPersistenceManagerGeneric::create;
+ native::CacheXmlParser::managedPersistenceManagerFn =
+ native::ManagedPersistenceManagerGeneric::create;
}
_GF_MG_EXCEPTION_CATCH_ALL2
@@ -615,36 +541,36 @@ namespace Apache
// Register other built-in types
/*
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableDate,
+ native::GeodeTypeIds::CacheableDate,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::CacheableDate::CreateDeserializable));
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableFileName,
+ native::GeodeTypeIds::CacheableFileName,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::CacheableFileName::CreateDeserializable));
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableHashMap,
+ native::GeodeTypeIds::CacheableHashMap,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::CacheableHashMap::CreateDeserializable));
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableHashTable,
+ native::GeodeTypeIds::CacheableHashTable,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::CacheableHashTable::CreateDeserializable));
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableIdentityHashMap,
+ native::GeodeTypeIds::CacheableIdentityHashMap,
gcnew TypeFactoryMethodGeneric(
Apache::Geode::Client::CacheableIdentityHashMap::CreateDeserializable));
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableUndefined,
+ native::GeodeTypeIds::CacheableUndefined,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::CacheableUndefined::CreateDeserializable));
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableVector,
+ native::GeodeTypeIds::CacheableVector,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::CacheableVector::CreateDeserializable));
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableObjectArray,
+ native::GeodeTypeIds::CacheableObjectArray,
gcnew TypeFactoryMethodGeneric(
Apache::Geode::Client::CacheableObjectArray::CreateDeserializable));
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableArrayList,
+ native::GeodeTypeIds::CacheableArrayList,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::CacheableArrayList::CreateDeserializable));
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableStack,
+ native::GeodeTypeIds::CacheableStack,
gcnew TypeFactoryMethodGeneric(Apache::Geode::Client::CacheableStack::CreateDeserializable));
Serializable::RegisterTypeGeneric(
GeodeClassIds::CacheableManagedObject - 0x80000000,
@@ -659,63 +585,63 @@ namespace Apache
//c# datatime
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableDate,
+ native::GeodeTypeIds::CacheableDate,
gcnew TypeFactoryMethodGeneric(CacheableDate::CreateDeserializable),
Type::GetType("System.DateTime"));
//as it is
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableFileName,
+ native::GeodeTypeIds::CacheableFileName,
gcnew TypeFactoryMethodGeneric(CacheableFileName::CreateDeserializable),
nullptr);
//for generic dictionary define its type in static constructor of Serializable.hpp
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableHashMap,
+ native::GeodeTypeIds::CacheableHashMap,
gcnew TypeFactoryMethodGeneric(CacheableHashMap::CreateDeserializable),
nullptr);
//c# hashtable
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableHashTable,
+ native::GeodeTypeIds::CacheableHashTable,
gcnew TypeFactoryMethodGeneric(CacheableHashTable::CreateDeserializable),
Type::GetType("System.Collections.Hashtable"));
//Need to keep public as no counterpart in c#
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableIdentityHashMap,
+ native::GeodeTypeIds::CacheableIdentityHashMap,
gcnew TypeFactoryMethodGeneric(
CacheableIdentityHashMap::CreateDeserializable),
nullptr);
//keep as it is
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableUndefined,
+ native::GeodeTypeIds::CacheableUndefined,
gcnew TypeFactoryMethodGeneric(CacheableUndefined::CreateDeserializable),
nullptr);
//c# arraylist
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableVector,
+ native::GeodeTypeIds::CacheableVector,
gcnew TypeFactoryMethodGeneric(CacheableVector::CreateDeserializable),
nullptr);
//as it is
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableObjectArray,
+ native::GeodeTypeIds::CacheableObjectArray,
gcnew TypeFactoryMethodGeneric(
CacheableObjectArray::CreateDeserializable),
nullptr);
//Generic::List
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableArrayList,
+ native::GeodeTypeIds::CacheableArrayList,
gcnew TypeFactoryMethodGeneric(CacheableArrayList::CreateDeserializable),
nullptr);
//c# generic stack
Serializable::RegisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableStack,
+ native::GeodeTypeIds::CacheableStack,
gcnew TypeFactoryMethodGeneric(CacheableStack::CreateDeserializable),
nullptr);
@@ -750,41 +676,41 @@ namespace Apache
void DistributedSystem::AppDomainInstancePostInitialization()
{
//to create .net memory pressure handler
- Create(apache::geode::client::DistributedSystem::getInstance().get());
+ Create(native::DistributedSystem::getInstance());
}
void DistributedSystem::UnregisterBuiltinManagedTypes()
{
_GF_MG_EXCEPTION_TRY2
- apache::geode::client::DistributedSystemImpl::acquireDisconnectLock();
+ native::DistributedSystemImpl::acquireDisconnectLock();
Serializable::UnregisterNativesGeneric();
int remainingInstances =
- apache::geode::client::DistributedSystemImpl::currentInstances();
+ native::DistributedSystemImpl::currentInstances();
if (remainingInstances == 0) { // last instance
Serializable::UnregisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableDate);
+ native::GeodeTypeIds::CacheableDate);
Serializable::UnregisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableFileName);
+ native::GeodeTypeIds::CacheableFileName);
Serializable::UnregisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableHashMap);
+ native::GeodeTypeIds::CacheableHashMap);
Serializable::UnregisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableHashTable);
+ native::GeodeTypeIds::CacheableHashTable);
Serializable::UnregisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableIdentityHashMap);
+ native::GeodeTypeIds::CacheableIdentityHashMap);
Serializable::UnregisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableVector);
+ native::GeodeTypeIds::CacheableVector);
Serializable::UnregisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableObjectArray);
+ native::GeodeTypeIds::CacheableObjectArray);
Serializable::UnregisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableArrayList);
+ native::GeodeTypeIds::CacheableArrayList);
Serializable::UnregisterTypeGeneric(
- apache::geode::client::GeodeTypeIds::CacheableStack);
+ native::GeodeTypeIds::CacheableStack);
Serializable::UnregisterTypeGeneric(
GeodeClassIds::CacheableManagedObject - 0x80000000);
Serializable::UnregisterTypeGeneric(
@@ -795,7 +721,7 @@ namespace Apache
_GF_MG_EXCEPTION_CATCH_ALL2
finally {
- apache::geode::client::DistributedSystemImpl::releaseDisconnectLock();
+ native::DistributedSystemImpl::releaseDisconnectLock();
}
}
@@ -803,30 +729,32 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- // TODO
return Apache::Geode::Client::SystemProperties::Create(
- apache::geode::client::DistributedSystem::getSystemProperties());
-
- //return nullptr;
+ native::DistributedSystem::getSystemProperties());
_GF_MG_EXCEPTION_CATCH_ALL2
}
String^ DistributedSystem::Name::get()
{
- return ManagedString::Get(NativePtr->getName());
+ try
+ {
+ return ManagedString::Get(m_nativeptr->get()->getName());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
bool DistributedSystem::IsConnected::get()
{
- return apache::geode::client::DistributedSystem::isConnected();
+ return native::DistributedSystem::isConnected();
}
DistributedSystem^ DistributedSystem::GetInstance()
{
- apache::geode::client::DistributedSystemPtr& nativeptr(
- apache::geode::client::DistributedSystem::getInstance());
- return Create(nativeptr.get());
+ return Create(native::DistributedSystem::getInstance());
}
void DistributedSystem::HandleMemoryPressure(System::Object^ state)
@@ -836,25 +764,23 @@ namespace Apache
handler.handle_timeout(dummy, nullptr);
}
- DistributedSystem^ DistributedSystem::Create(
- apache::geode::client::DistributedSystem* nativeptr)
+ DistributedSystem^ DistributedSystem::Create(native::DistributedSystemPtr nativeptr)
{
if (m_instance == nullptr) {
msclr::lock lockInstance(m_singletonSync);
if (m_instance == nullptr) {
- m_instance = (nativeptr != nullptr
- ? gcnew DistributedSystem(nativeptr) : nullptr);
+ m_instance = __nullptr == nativeptr ? nullptr :
+ gcnew DistributedSystem(nativeptr);
}
}
- DistributedSystem^ instance = (DistributedSystem^)m_instance;
+ auto instance = (DistributedSystem^)m_instance;
return instance;
}
- DistributedSystem::DistributedSystem(apache::geode::client::DistributedSystem* nativeptr)
- : SBWrap(nativeptr)
+ DistributedSystem::DistributedSystem(native::DistributedSystemPtr nativeptr)
{
- System::Threading::TimerCallback^ timerCallback = gcnew System::
- Threading::TimerCallback(&DistributedSystem::HandleMemoryPressure);
+ m_nativeptr = gcnew native_shared_ptr<native::DistributedSystem>(nativeptr);
+ auto timerCallback = gcnew System::Threading::TimerCallback(&DistributedSystem::HandleMemoryPressure);
m_memoryPressureHandler = gcnew System::Threading::Timer(
timerCallback, "MemoryPressureHandler", 3 * 60000, 3 * 60000);
}
@@ -866,42 +792,41 @@ namespace Apache
void DistributedSystem::acquireDisconnectLock()
{
- apache::geode::client::DistributedSystemImpl::acquireDisconnectLock();
+ native::DistributedSystemImpl::acquireDisconnectLock();
}
void DistributedSystem::disconnectInstance()
{
- apache::geode::client::DistributedSystemImpl::disconnectInstance();
+ native::DistributedSystemImpl::disconnectInstance();
}
void DistributedSystem::releaseDisconnectLock()
{
- apache::geode::client::DistributedSystemImpl::releaseDisconnectLock();
+ native::DistributedSystemImpl::releaseDisconnectLock();
}
void DistributedSystem::connectInstance()
{
- apache::geode::client::DistributedSystemImpl::connectInstance();
+ native::DistributedSystemImpl::connectInstance();
}
void DistributedSystem::registerCliCallback()
{
m_cliCallBackObj = gcnew CliCallbackDelegate();
- cliCallback^ nativeCallback =
+ auto nativeCallback =
gcnew cliCallback(m_cliCallBackObj,
&CliCallbackDelegate::Callback);
- apache::geode::client::DistributedSystemImpl::registerCliCallback(System::Threading::Thread::GetDomainID(),
- (apache::geode::client::CliCallbackMethod)System::Runtime::InteropServices::
+ native::DistributedSystemImpl::registerCliCallback(System::Threading::Thread::GetDomainID(),
+ (native::CliCallbackMethod)System::Runtime::InteropServices::
Marshal::GetFunctionPointerForDelegate(
nativeCallback).ToPointer());
}
void DistributedSystem::unregisterCliCallback()
{
- apache::geode::client::DistributedSystemImpl::unregisterCliCallback(System::Threading::Thread::GetDomainID());
- } // namespace Client
- } // namespace Geode
- } // namespace Apache
-
-}
+ native::DistributedSystemImpl::unregisterCliCallback(System::Threading::Thread::GetDomainID());
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/DistributedSystem.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/DistributedSystem.hpp b/src/clicache/src/DistributedSystem.hpp
index af95be1..65e8be8 100644
--- a/src/clicache/src/DistributedSystem.hpp
+++ b/src/clicache/src/DistributedSystem.hpp
@@ -18,8 +18,11 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/DistributedSystem.hpp>
-//#include "impl/NativeWrapper.hpp"
+#include "end_native.hpp"
+
+#include "native_shared_ptr.hpp"
#include "SystemProperties.hpp"
#include "Properties.hpp"
#include "impl/CliCallbackDelgate.hpp"
@@ -33,6 +36,8 @@ namespace Apache
namespace Client
{
+ namespace native = apache::geode::client;
+
/// <summary>
/// DistributedSystem encapsulates this applications "connection" into the
/// Geode Java servers.
@@ -43,7 +48,6 @@ namespace Apache
/// DistributedSystem.
/// </remarks>
public ref class DistributedSystem sealed
- : public Client::Internal::SBWrap<apache::geode::client::DistributedSystem>
{
public:
@@ -130,7 +134,7 @@ namespace Apache
/// <returns>
/// The managed wrapper object; null if the native pointer is null.
/// </returns>
- static DistributedSystem^ Create(apache::geode::client::DistributedSystem* nativeptr);
+ static DistributedSystem^ Create(native::DistributedSystemPtr nativeptr);
static void acquireDisconnectLock();
@@ -149,7 +153,7 @@ namespace Apache
/// Stuff that needs to be done for Connect in each AppDomain.
/// </summary>
static void AppDomainInstanceInitialization(
- const apache::geode::client::PropertiesPtr& nativepropsptr);
+ const native::PropertiesPtr& nativepropsptr);
/// <summary>
/// Managed registrations and other stuff to be done for the manage
@@ -168,6 +172,11 @@ namespace Apache
/// </summary>
static void UnregisterBuiltinManagedTypes();
+ std::shared_ptr<native::DistributedSystem> GetNative()
+ {
+ return m_nativeptr->get_shared_ptr();
+ }
+
private:
///// <summary>
@@ -180,13 +189,14 @@ namespace Apache
/// Private constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- DistributedSystem(apache::geode::client::DistributedSystem* nativeptr);
+ DistributedSystem(native::DistributedSystemPtr nativeptr);
/// <summary>
/// Finalizer for the singleton instance of this class.
/// </summary>
~DistributedSystem();
+ native_shared_ptr<native::DistributedSystem>^ m_nativeptr;
/// <summary>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/EntryEvent.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/EntryEvent.cpp b/src/clicache/src/EntryEvent.cpp
index 49869f5..51a0ef5 100644
--- a/src/clicache/src/EntryEvent.cpp
+++ b/src/clicache/src/EntryEvent.cpp
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-//#include "geode_includes.hpp"
#include "EntryEvent.hpp"
#include "Region.hpp"
#include "impl/SafeConvert.hpp"
@@ -30,65 +29,46 @@ namespace Apache
{
generic<class TKey, class TValue>
- EntryEvent<TKey, TValue>::EntryEvent(IRegion<TKey, TValue>^ region,
- TKey key, TValue oldValue,
- TValue newValue, Object^ aCallbackArgument,
- bool remoteOrigin)
- : UMWrap( )
- {
- //TODO:: from where this gets called
- /*apache::geode::client::RegionPtr regionptr( GetNativePtr<apache::geode::client::Region>( region ) );
- apache::geode::client::CacheableKeyPtr keyptr( SafeMKeyConvert( key ) );
- apache::geode::client::CacheablePtr oldptr( SafeMSerializableConvert( oldValue ) );
- apache::geode::client::CacheablePtr newptr( SafeMSerializableConvert( newValue ) );
- apache::geode::client::UserDataPtr callbackptr(SafeMSerializableConvert(
- aCallbackArgument));
-
- SetPtr(new apache::geode::client::EntryEvent(regionptr, keyptr,
- oldptr, newptr, callbackptr, remoteOrigin), true);*/
- }
-
- generic<class TKey, class TValue>
IRegion<TKey, TValue>^ EntryEvent<TKey, TValue>::Region::get( )
{
- apache::geode::client::RegionPtr& regionptr( NativePtr->getRegion( ) );
- return Client::Region<TKey, TValue>::Create( regionptr.ptr( ) );
+ apache::geode::client::RegionPtr regionptr = m_nativeptr->getRegion();
+ return Client::Region<TKey, TValue>::Create( regionptr );
}
generic<class TKey, class TValue>
TKey EntryEvent<TKey, TValue>::Key::get( )
{
- apache::geode::client::CacheableKeyPtr& keyptr( NativePtr->getKey( ) );
+ apache::geode::client::CacheableKeyPtr& keyptr( m_nativeptr->getKey( ) );
return Serializable::GetManagedValueGeneric<TKey>( keyptr );
}
generic<class TKey, class TValue>
TValue EntryEvent<TKey, TValue>::OldValue::get( )
{
- apache::geode::client::CacheablePtr& valptr( NativePtr->getOldValue( ) );
+ apache::geode::client::CacheablePtr& valptr( m_nativeptr->getOldValue( ) );
return Serializable::GetManagedValueGeneric<TValue>( valptr );
}
generic<class TKey, class TValue>
TValue EntryEvent<TKey, TValue>::NewValue::get( )
{
- apache::geode::client::CacheablePtr& valptr( NativePtr->getNewValue( ) );
+ apache::geode::client::CacheablePtr& valptr( m_nativeptr->getNewValue( ) );
return Serializable::GetManagedValueGeneric<TValue>( valptr );
}
generic<class TKey, class TValue>
Object^ EntryEvent<TKey, TValue>::CallbackArgument::get()
{
- apache::geode::client::UserDataPtr& valptr(NativePtr->getCallbackArgument());
+ apache::geode::client::UserDataPtr& valptr(m_nativeptr->getCallbackArgument());
return Serializable::GetManagedValueGeneric<Object^>( valptr );
}
generic<class TKey, class TValue>
- bool EntryEvent<TKey, TValue>::RemoteOrigin::get( )
+ bool EntryEvent<TKey, TValue>::RemoteOrigin::get()
{
- return NativePtr->remoteOrigin( );
+ return m_nativeptr->remoteOrigin();
+ }
} // namespace Client
} // namespace Geode
} // namespace Apache
- } //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/EntryEvent.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/EntryEvent.hpp b/src/clicache/src/EntryEvent.hpp
index 644fbbb..36008ea 100644
--- a/src/clicache/src/EntryEvent.hpp
+++ b/src/clicache/src/EntryEvent.hpp
@@ -18,10 +18,11 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/EntryEvent.hpp>
-#include "impl/NativeWrapper.hpp"
+#include "end_native.hpp"
+
#include "IRegion.hpp"
-//#include "Region.hpp"
using namespace System;
@@ -31,8 +32,9 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
- interface class IGeodeSerializable;
+ interface class IGeodeSerializable;
// ref class Region;
//interface class ICacheableKey;
@@ -42,18 +44,10 @@ namespace Apache
/// </summary>
generic<class TKey, class TValue>
public ref class EntryEvent sealed
- : public Internal::UMWrap<apache::geode::client::EntryEvent>
{
public:
/// <summary>
- /// Constructor to create an <c>EntryEvent</c> for the given region.
- /// </summary>
- EntryEvent(IRegion<TKey, TValue>^ region, TKey key, TValue oldValue,
- TValue newValue, Object^ aCallbackArgument,
- bool remoteOrigin );
-
- /// <summary>
/// Return the region this event occurred in.
/// </summary>
property IRegion<TKey, TValue>^ Region
@@ -106,16 +100,22 @@ namespace Apache
bool get( );
}
-
internal:
+ const native::EntryEvent* GetNative()
+ {
+ return m_nativeptr;
+ }
/// <summary>
/// Private constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline EntryEvent<TKey, TValue>( const apache::geode::client::EntryEvent* nativeptr )
- : Internal::UMWrap<apache::geode::client::EntryEvent>(
- const_cast<apache::geode::client::EntryEvent*>( nativeptr ), false ) { }
+ inline EntryEvent<TKey, TValue>( const native::EntryEvent* nativeptr )
+ : m_nativeptr( nativeptr )
+ {
+ }
+ private:
+ const native::EntryEvent* m_nativeptr;
};
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/ExceptionTypes.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/ExceptionTypes.cpp b/src/clicache/src/ExceptionTypes.cpp
index 9388670..e8eeb0c 100644
--- a/src/clicache/src/ExceptionTypes.cpp
+++ b/src/clicache/src/ExceptionTypes.cpp
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-//#include "geode_includes.hpp"
#include "ExceptionTypes.hpp"
#include <cstdlib>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/ExceptionTypes.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/ExceptionTypes.hpp b/src/clicache/src/ExceptionTypes.hpp
index 8f25654..491dfcb 100644
--- a/src/clicache/src/ExceptionTypes.hpp
+++ b/src/clicache/src/ExceptionTypes.hpp
@@ -18,7 +18,10 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/ExceptionTypes.hpp>
+#include "end_native.hpp"
+
#include "impl/ManagedString.hpp"
@@ -162,8 +165,8 @@ namespace Apache
cause = GeodeException::GetNative(ex->InnerException);
}
ManagedString mg_exStr(MgSysExPrefix + ex->ToString());
- return apache::geode::client::ExceptionPtr(new apache::geode::client::Exception(
- mg_exStr.CharPtr, NULL, false, cause));
+ return std::make_shared<apache::geode::client::Exception>(
+ mg_exStr.CharPtr, __nullptr, false, cause);
}
}
return nullptr;
@@ -181,8 +184,8 @@ namespace Apache
if (this->InnerException != nullptr) {
cause = GeodeException::GetNative(this->InnerException);
}
- return apache::geode::client::ExceptionPtr(new apache::geode::client::Exception(mg_msg.CharPtr,
- NULL, false, cause));
+ return std::make_shared<apache::geode::client::Exception>(mg_msg.CharPtr,
+ __nullptr, false, cause);
}
/// <summary>
@@ -355,8 +358,8 @@ namespace Apache
if (this->InnerException != nullptr) { \
cause = GeodeException::GetNative(this->InnerException); \
} \
- return apache::geode::client::ExceptionPtr(new apache::geode::client::y(mg_msg.CharPtr, \
- NULL, false, cause)); \
+ return std::make_shared<apache::geode::client::y>(mg_msg.CharPtr, \
+ __nullptr, false, cause); \
} \
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/Execution.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/Execution.cpp b/src/clicache/src/Execution.cpp
index 6037299..0a43e9b 100644
--- a/src/clicache/src/Execution.cpp
+++ b/src/clicache/src/Execution.cpp
@@ -18,7 +18,10 @@
//#include "geode_includes.hpp"
#include "Execution.hpp"
+#include "begin_native.hpp"
#include <geode/Execution.hpp>
+#include "end_native.hpp"
+
#include "ResultCollector.hpp"
#include "impl/ManagedResultCollector.hpp"
@@ -34,6 +37,7 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
generic<class TResult>
generic<class TFilter>
@@ -41,14 +45,21 @@ namespace Apache
{
if (routingObj != nullptr) {
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::CacheableVectorPtr rsptr = apache::geode::client::CacheableVector::create();
+ auto rsptr = native::CacheableVector::create();
for each(TFilter item in routingObj)
{
rsptr->push_back(Serializable::GetUnmanagedValueGeneric<TFilter>( item ));
}
- return Execution<TResult>::Create(NativePtr->withFilter(rsptr).get(), this->m_rc);
+ try
+ {
+ return Execution<TResult>::Create(m_nativeptr->get()->withFilter(rsptr), this->m_rc);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
else {
@@ -61,9 +72,15 @@ namespace Apache
Execution<TResult>^ Execution<TResult>::WithArgs( TArgs args )
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
-
- apache::geode::client::CacheablePtr argsptr( Serializable::GetUnmanagedValueGeneric<TArgs>( args ) );
- return Execution<TResult>::Create(NativePtr->withArgs(argsptr).get(), this->m_rc);
+ try
+ {
+ auto argsptr = Serializable::GetUnmanagedValueGeneric<TArgs>( args );
+ return Execution<TResult>::Create(m_nativeptr->get()->withArgs(argsptr), this->m_rc);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -71,15 +88,20 @@ namespace Apache
Execution<TResult>^ Execution<TResult>::WithCollector(Client::IResultCollector<TResult>^ rc)
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::ResultCollectorPtr rcptr;
+ native::ResultCollectorPtr rcptr;
if ( rc != nullptr ) {
- ResultCollectorGeneric<TResult>^ rcg = gcnew ResultCollectorGeneric<TResult>();
- rcg->SetResultCollector(rc);
-
- rcptr = new apache::geode::client::ManagedResultCollectorGeneric( rcg );
- //((apache::geode::client::ManagedResultCollectorGeneric*)rcptr.get())->setptr(rcg);
+ auto rcg = gcnew ResultCollectorGeneric<TResult>();
+ rcg->SetResultCollector(rc);
+ rcptr = std::shared_ptr<native::ManagedResultCollectorGeneric>(new native::ManagedResultCollectorGeneric(rcg));
+ }
+ try
+ {
+ return Execution<TResult>::Create( m_nativeptr->get()->withCollector(rcptr), rc);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
}
- return Execution<TResult>::Create( NativePtr->withCollector(rcptr).get(), rc);
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -87,12 +109,19 @@ namespace Apache
IResultCollector<TResult>^ Execution<TResult>::Execute(String^ func, UInt32 timeout)
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- ManagedString mg_function( func );
- apache::geode::client::ResultCollectorPtr rc = NativePtr->execute(mg_function.CharPtr, timeout);
- if(m_rc == nullptr)
- return gcnew ResultCollector<TResult>(rc.get());
- else
- return m_rc;
+ try
+ {
+ ManagedString mg_function(func);
+ auto rc = m_nativeptr->get()->execute(mg_function.CharPtr, timeout);
+ if (m_rc == nullptr)
+ return gcnew ResultCollector<TResult>(rc);
+ else
+ return m_rc;
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -100,8 +129,7 @@ namespace Apache
IResultCollector<TResult>^ Execution<TResult>::Execute(String^ func)
{
return Execute(func, DEFAULT_QUERY_RESPONSE_TIMEOUT);
+ }
} // namespace Client
} // namespace Geode
} // namespace Apache
-
-} //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/Execution.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/Execution.hpp b/src/clicache/src/Execution.hpp
index f45a5db..44fcf44 100644
--- a/src/clicache/src/Execution.hpp
+++ b/src/clicache/src/Execution.hpp
@@ -18,9 +18,11 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/Execution.hpp>
-#include "impl/NativeWrapper.hpp"
-//#include "impl/ResultCollectorProxy.hpp"
+#include "end_native.hpp"
+
+#include "native_shared_ptr.hpp"
using namespace System;
@@ -30,6 +32,7 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
generic<class TResult>
interface class IResultCollector;
@@ -42,7 +45,6 @@ namespace Apache
/// </summary>
generic<class TResult>
public ref class Execution sealed
- : public Internal::SBWrap<apache::geode::client::Execution>
{
public:
/// <summary>
@@ -88,20 +90,25 @@ namespace Apache
/// <returns>
/// The managed wrapper object; null if the native pointer is null.
/// </returns>
- inline static Execution<TResult>^ Create( apache::geode::client::Execution* nativeptr, IResultCollector<TResult>^ rc )
+ inline static Execution<TResult>^ Create( native::ExecutionPtr nativeptr, IResultCollector<TResult>^ rc )
{
- return ( nativeptr != nullptr ?
- gcnew Execution<TResult>( nativeptr, rc ) : nullptr );
- }
+ return __nullptr == nativeptr ? nullptr :
+ gcnew Execution<TResult>( nativeptr, rc );
+ }
/// <summary>
/// Private constructor to wrap a native object pointer.
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline Execution( apache::geode::client::Execution* nativeptr, IResultCollector<TResult>^ rc )
- : SBWrap( nativeptr ) { m_rc = rc;}
+ inline Execution( native::ExecutionPtr nativeptr, IResultCollector<TResult>^ rc )
+ {
+ m_rc = rc;
+ m_nativeptr = gcnew native_shared_ptr<native::Execution>(nativeptr);
+ }
private:
IResultCollector<TResult>^ m_rc;
+
+ native_shared_ptr<native::Execution>^ m_nativeptr;
};
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/ExpirationAction.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/ExpirationAction.hpp b/src/clicache/src/ExpirationAction.hpp
index 25c0564..c8a12bf 100644
--- a/src/clicache/src/ExpirationAction.hpp
+++ b/src/clicache/src/ExpirationAction.hpp
@@ -20,7 +20,10 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/ExpirationAction.hpp>
+#include "end_native.hpp"
+
using namespace System;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/FunctionService.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/FunctionService.cpp b/src/clicache/src/FunctionService.cpp
index 4f3a3ed..456f2e5 100644
--- a/src/clicache/src/FunctionService.cpp
+++ b/src/clicache/src/FunctionService.cpp
@@ -15,14 +15,17 @@
* limitations under the License.
*/
-//#include "geode_includes.hpp"
+#include "begin_native.hpp"
+#include <geode/RegionService.hpp>
+#include "end_native.hpp"
+
#include "FunctionService.hpp"
#include "Pool.hpp"
#include "Region.hpp"
#include "Execution.hpp"
-#include <geode/RegionService.hpp>
+
#include "impl/AuthenticatedCache.hpp"
-#include "impl/SafeConvert.hpp"
+
using namespace System;
namespace Apache
@@ -31,6 +34,7 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
generic <class TResult>
generic <class TKey, class TValue>
@@ -38,40 +42,31 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- IRegion<TKey, TValue>^ regImpl = safe_cast<IRegion<TKey, TValue>^>( rg);
-
- apache::geode::client::RegionPtr regionptr(GetNativePtrFromSBWrapGeneric((Client::Region<TKey, TValue>^)regImpl));
-
- apache::geode::client::ExecutionPtr& nativeptr( apache::geode::client::FunctionService::onRegion(
- regionptr ) );
- return Execution<TResult>::Create( nativeptr.ptr( ), nullptr );
+ auto nativeRegion = ((Region<TKey, TValue>^)rg)->GetNative();
+ auto execution = native::FunctionService::onRegion(nativeRegion);
+ return Execution<TResult>::Create( execution, nullptr );
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
generic <class TResult>
- Execution<TResult>^ FunctionService<TResult>::OnServer( Pool/*<TKey, TValue>*/^ pl )
+ Execution<TResult>^ FunctionService<TResult>::OnServer( Pool^ pl )
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::PoolPtr poolptr(GetNativePtrFromSBWrapGeneric<apache::geode::client::Pool>( pl ) );
-
- apache::geode::client::ExecutionPtr& nativeptr( apache::geode::client::FunctionService::onServer(
- poolptr ) );
- return Execution<TResult>::Create( nativeptr.ptr( ) , nullptr);
+ auto nativeptr = native::FunctionService::onServer(pl->GetNative());
+ return Execution<TResult>::Create( nativeptr , nullptr);
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
generic <class TResult>
- Execution<TResult>^ FunctionService<TResult>::OnServers( Pool/*<TKey, TValue>*/^ pl )
+ Execution<TResult>^ FunctionService<TResult>::OnServers( Pool^ pl )
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::PoolPtr poolptr(GetNativePtrFromSBWrapGeneric<apache::geode::client::Pool>( pl ) );
- apache::geode::client::ExecutionPtr& nativeptr( apache::geode::client::FunctionService::onServers(
- poolptr ) );
- return Execution<TResult>::Create( nativeptr.ptr( ) , nullptr);
+ auto nativeptr = native::FunctionService::onServers(pl->GetNative());
+ return Execution<TResult>::Create( nativeptr , nullptr);
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -81,28 +76,17 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- Apache::Geode::Client::Cache^ realCache =
- dynamic_cast<Apache::Geode::Client::Cache^>(cache);
-
- if(realCache != nullptr)
- {
- apache::geode::client::RegionServicePtr cacheptr(GetNativePtr<apache::geode::client::RegionService>( realCache ) );
-
- apache::geode::client::ExecutionPtr& nativeptr( apache::geode::client::FunctionService::onServer(
- cacheptr ) );
- return Execution<TResult>::Create( nativeptr.ptr( ), nullptr );
- }
- else
- {
- Apache::Geode::Client::AuthenticatedCache^ authCache =
- dynamic_cast<Apache::Geode::Client::AuthenticatedCache^>(cache);
- apache::geode::client::RegionServicePtr cacheptr(GetNativePtr<apache::geode::client::RegionService>( authCache ) );
-
- apache::geode::client::ExecutionPtr& nativeptr( apache::geode::client::FunctionService::onServer(
- cacheptr ) );
- return Execution<TResult>::Create( nativeptr.ptr( ), nullptr );
- }
-
+ if(auto realCache = dynamic_cast<Cache^>(cache))
+ {
+ auto nativeptr = native::FunctionService::onServer(realCache->GetNative());
+ return Execution<TResult>::Create( nativeptr, nullptr );
+ }
+ else
+ {
+ auto authCache = dynamic_cast<AuthenticatedCache^>(cache);
+ auto nativeptr = native::FunctionService::onServer(authCache->GetNative());
+ return Execution<TResult>::Create( nativeptr, nullptr );
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -112,31 +96,20 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- Apache::Geode::Client::Cache^ realCache =
- dynamic_cast<Apache::Geode::Client::Cache^>(cache);
-
- if(realCache != nullptr)
+ if(auto realCache = dynamic_cast<Cache^>(cache))
{
- apache::geode::client::RegionServicePtr cacheptr(GetNativePtr<apache::geode::client::RegionService>( realCache ) );
-
- apache::geode::client::ExecutionPtr& nativeptr( apache::geode::client::FunctionService::onServers(
- cacheptr ) );
- return Execution<TResult>::Create( nativeptr.ptr( ), nullptr );
+ auto nativeptr = native::FunctionService::onServers(realCache->GetNative());
+ return Execution<TResult>::Create( nativeptr, nullptr );
}
else
{
- Apache::Geode::Client::AuthenticatedCache^ authCache =
- dynamic_cast<Apache::Geode::Client::AuthenticatedCache^>(cache);
- apache::geode::client::RegionServicePtr cacheptr(GetNativePtr<apache::geode::client::RegionService>( authCache ) );
-
- apache::geode::client::ExecutionPtr& nativeptr( apache::geode::client::FunctionService::onServers(
- cacheptr ) );
- return Execution<TResult>::Create( nativeptr.ptr( ) , nullptr);
+ auto authCache = dynamic_cast<AuthenticatedCache^>(cache);
+ auto nativeptr = native::FunctionService::onServers(authCache->GetNative());
+ return Execution<TResult>::Create( nativeptr, nullptr );
}
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
} // namespace Client
} // namespace Geode
} // namespace Apache
-
- } //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/FunctionService.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/FunctionService.hpp b/src/clicache/src/FunctionService.hpp
index 923a625..7af9bc8 100644
--- a/src/clicache/src/FunctionService.hpp
+++ b/src/clicache/src/FunctionService.hpp
@@ -18,10 +18,11 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/FunctionService.hpp>
-#include "Cache.hpp"
-//#include "impl/NativeWrapper.hpp"
+#include "end_native.hpp"
+#include "Cache.hpp"
using namespace System;
@@ -43,8 +44,7 @@ namespace Apache
/// </summary>
/// <remarks>
generic<class TResult>
- public ref class FunctionService
- : public Internal::SBWrap<apache::geode::client::FunctionService>
+ public ref class FunctionService
{
public:
@@ -63,8 +63,7 @@ namespace Apache
/// <remarks>
/// </remarks>
/// <exception cref="UnsupportedOperationException">unsupported operation exception, when Pool is in multiusersecure mode.</exception>
- //generic<class TKey, class TValue>
- static Execution<TResult>^ OnServer( Pool/*<TKey, TValue>*/^ pl );
+ static Execution<TResult>^ OnServer( Pool^ pl );
/// <summary>
/// Creates a new Execution object on all servers in the pool
@@ -72,8 +71,7 @@ namespace Apache
/// <remarks>
/// </remarks>
/// <exception cref="UnsupportedOperationException">unsupported operation exception, when Pool is in multiusersecure mode.</exception>
- //generic<class TKey, class TValue>
- static Execution<TResult>^ OnServers( Pool/*<TKey, TValue>*/^ pl );
+ static Execution<TResult>^ OnServers( Pool^ pl );
/// <summary>
/// Creates a new Execution object on one server.
@@ -81,7 +79,6 @@ namespace Apache
/// <remarks>
/// </remarks>
/// <exception cref="IllegalStateException">when Pool has been closed.</exception>
- //generic<class TResult>
static Execution<TResult>^ OnServer( IRegionService^ cache );
/// <summary>
@@ -90,18 +87,8 @@ namespace Apache
/// <remarks>
/// </remarks>
/// <exception cref="IllegalStateException">when Pool has been closed.</exception>
- //generic<class TResult>
static Execution<TResult>^ OnServers( IRegionService^ cache );
- internal:
-
- /// <summary>
- /// Private constructor to wrap a native object pointer
- /// </summary>
- /// <param name="nativeptr">The native object pointer</param>
- inline FunctionService( apache::geode::client::FunctionService* nativeptr )
- : SBWrap( nativeptr ) { }
-
};
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/GeodeClassIds.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/GeodeClassIds.hpp b/src/clicache/src/GeodeClassIds.hpp
index 0ab567a..9d6eebd 100644
--- a/src/clicache/src/GeodeClassIds.hpp
+++ b/src/clicache/src/GeodeClassIds.hpp
@@ -20,7 +20,10 @@
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/GeodeTypeIds.hpp>
+#include "end_native.hpp"
+
namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/ICacheLoader.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/ICacheLoader.hpp b/src/clicache/src/ICacheLoader.hpp
index 76b2f19..e5b1a8e 100644
--- a/src/clicache/src/ICacheLoader.hpp
+++ b/src/clicache/src/ICacheLoader.hpp
@@ -18,7 +18,10 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/CacheLoader.hpp>
+#include "end_native.hpp"
+
#include "IRegion.hpp"
//#include "Region.hpp"
//#include "ICacheableKey.hpp"
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/ICacheableKey.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/ICacheableKey.hpp b/src/clicache/src/ICacheableKey.hpp
index 1578207..3ca9514 100644
--- a/src/clicache/src/ICacheableKey.hpp
+++ b/src/clicache/src/ICacheableKey.hpp
@@ -20,7 +20,6 @@
#include "geode_defs.hpp"
#include "IGeodeSerializable.hpp"
-
using namespace System;
namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/ICqResults.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/ICqResults.hpp b/src/clicache/src/ICqResults.hpp
index b0d5970..f8d737f 100644
--- a/src/clicache/src/ICqResults.hpp
+++ b/src/clicache/src/ICqResults.hpp
@@ -18,8 +18,11 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/SelectResults.hpp>
-//#include "impl/NativeWrapper.hpp"
+#include "end_native.hpp"
+
+
#include "ISelectResults.hpp"
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/IGeodeSerializable.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/IGeodeSerializable.hpp b/src/clicache/src/IGeodeSerializable.hpp
index 311601b..c21946f 100644
--- a/src/clicache/src/IGeodeSerializable.hpp
+++ b/src/clicache/src/IGeodeSerializable.hpp
@@ -18,7 +18,9 @@
#pragma once
#include "geode_defs.hpp"
-#include "geode/geode_types.hpp"
+#include "begin_native.hpp"
+#include <geode/geode_types.hpp>
+#include "end_native.hpp"
using namespace System;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/IRegion.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/IRegion.hpp b/src/clicache/src/IRegion.hpp
index 8c17d2f..cbbf2eb 100644
--- a/src/clicache/src/IRegion.hpp
+++ b/src/clicache/src/IRegion.hpp
@@ -19,7 +19,10 @@
#include "geode_defs.hpp"
#include "ISubscriptionService.hpp"
+#include "begin_native.hpp"
#include <geode/DataOutput.hpp>
+#include "end_native.hpp"
+
//#include "ExceptionTypes.hpp"
using namespace System;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/ISelectResults.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/ISelectResults.hpp b/src/clicache/src/ISelectResults.hpp
index e53e17c..68feff8 100644
--- a/src/clicache/src/ISelectResults.hpp
+++ b/src/clicache/src/ISelectResults.hpp
@@ -18,8 +18,11 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/SelectResults.hpp>
-//#include "impl/NativeWrapper.hpp"
+#include "end_native.hpp"
+
+
#include "IGeodeSerializable.hpp"
using namespace System;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/ISubscriptionService.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/ISubscriptionService.hpp b/src/clicache/src/ISubscriptionService.hpp
index ec1d041..1c91efd 100644
--- a/src/clicache/src/ISubscriptionService.hpp
+++ b/src/clicache/src/ISubscriptionService.hpp
@@ -18,7 +18,8 @@
#pragma once
#include "geode_defs.hpp"
-//#include "ExceptionTypes.hpp"
+#include "ExceptionTypes.hpp"
+
using namespace System;
namespace Apache
{
[15/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from cppcache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientPoolExecuteFunctionPrSHOP.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientPoolExecuteFunctionPrSHOP.cpp b/src/cppcache/integration-test/testThinClientPoolExecuteFunctionPrSHOP.cpp
index 8eb0b07..c0a5333 100644
--- a/src/cppcache/integration-test/testThinClientPoolExecuteFunctionPrSHOP.cpp
+++ b/src/cppcache/integration-test/testThinClientPoolExecuteFunctionPrSHOP.cpp
@@ -53,42 +53,48 @@ char* FEOnRegionPrSHOP_OptimizeForWrite =
(char*)"FEOnRegionPrSHOP_OptimizeForWrite";
char* FETimeOut = (char*)"FunctionExecutionTimeOut";
-#define verifyGetResults() \
- bool found = false; \
- for (int j = 0; j < 34; j++) { \
- if (j % 2 == 0) continue; \
- sprintf(buf, "VALUE--%d", j); \
- if (strcmp(buf, dynCast<CacheableStringPtr>(resultList->operator[](i)) \
- ->asChar()) == 0) { \
- LOGINFO( \
- "buf = %s " \
- "dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar() " \
- "= %s ", \
- buf, \
- dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar()); \
- found = true; \
- break; \
- } \
- } \
+#define verifyGetResults() \
+ bool found = false; \
+ for (int j = 0; j < 34; j++) { \
+ if (j % 2 == 0) continue; \
+ sprintf(buf, "VALUE--%d", j); \
+ if (strcmp(buf, std::dynamic_pointer_cast<CacheableString>( \
+ resultList->operator[](i)) \
+ ->asChar()) == 0) { \
+ LOGINFO( \
+ "buf = %s " \
+ "std::dynamic_pointer_cast<CacheableString>(resultList->operator[](" \
+ "i))->asChar() " \
+ "= %s ", \
+ buf, std::dynamic_pointer_cast<CacheableString>( \
+ resultList->operator[](i)) \
+ ->asChar()); \
+ found = true; \
+ break; \
+ } \
+ } \
ASSERT(found, "this returned value is invalid");
-#define verifyGetKeyResults() \
- bool found = false; \
- for (int j = 0; j < 34; j++) { \
- if (j % 2 == 0) continue; \
- sprintf(buf, "KEY--%d", j); \
- if (strcmp(buf, dynCast<CacheableStringPtr>(resultList->operator[](i)) \
- ->asChar()) == 0) { \
- LOGINFO( \
- "buf = %s " \
- "dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar() " \
- "= %s ", \
- buf, \
- dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar()); \
- found = true; \
- break; \
- } \
- } \
+#define verifyGetKeyResults() \
+ bool found = false; \
+ for (int j = 0; j < 34; j++) { \
+ if (j % 2 == 0) continue; \
+ sprintf(buf, "KEY--%d", j); \
+ if (strcmp(buf, std::dynamic_pointer_cast<CacheableString>( \
+ resultList->operator[](i)) \
+ ->asChar()) == 0) { \
+ LOGINFO( \
+ "buf = %s " \
+ "std::dynamic_pointer_cast<CacheableString>(resultList->operator[](" \
+ "i))->asChar() " \
+ "= %s ", \
+ buf, std::dynamic_pointer_cast<CacheableString>( \
+ resultList->operator[](i)) \
+ ->asChar()); \
+ found = true; \
+ break; \
+ } \
+ } \
ASSERT(found, "this returned KEY is invalid");
#define verifyPutResults() \
@@ -128,18 +134,18 @@ class MyResultCollector : public ResultCollector {
void addResult(CacheablePtr& resultItem) {
m_addResultCount++;
- if (resultItem == NULLPTR) {
+ if (resultItem == nullptr) {
return;
}
- try {
- CacheableArrayListPtr result = dynCast<CacheableArrayListPtr>(resultItem);
+ if (auto result =
+ std::dynamic_pointer_cast<CacheableArrayList>(resultItem)) {
for (int32_t i = 0; i < result->size(); i++) {
m_resultList->push_back(result->operator[](i));
}
- } catch (ClassCastException) {
- UserFunctionExecutionExceptionPtr result =
- dynCast<UserFunctionExecutionExceptionPtr>(resultItem);
- m_resultList->push_back(result);
+ } else {
+ auto ex =
+ std::dynamic_pointer_cast<UserFunctionExecutionException>(resultItem);
+ m_resultList->push_back(ex);
}
}
void endResults() {
@@ -157,7 +163,50 @@ class MyResultCollector : public ResultCollector {
uint32_t m_addResultCount;
uint32_t m_getResultCount;
};
-typedef SharedPtr<MyResultCollector> MyResultCollectorPtr;
+_GF_PTR_DEF_(MyResultCollector, MyResultCollectorPtr)
+
+template <class _T>
+bool validateResultTypeAndAllowUserFunctionExecutionException(
+ const int32_t index, const CacheablePtr& result) {
+ if (auto intValue = std::dynamic_pointer_cast<_T>(result)) {
+ LOGINFO("%s is %d ", typeid(_T).name(), intValue->value());
+ return true;
+ } else {
+ if (auto uFEPtr =
+ std::dynamic_pointer_cast<UserFunctionExecutionException>(result)) {
+ LOGINFO("Done casting to uFEPtr");
+ LOGINFO("Read expected uFEPtr exception %s ",
+ uFEPtr->getMessage()->asChar());
+ return true;
+ } else {
+ LOGINFO("Unexpected result type %s for index %d.",
+ result->toString()->asChar(), index);
+ }
+ }
+
+ return false;
+}
+
+bool validateResultTypeIsUserFunctionExecutionException(
+ const int32_t index, const CacheablePtr& result) {
+ if (auto uFEPtr =
+ std::dynamic_pointer_cast<UserFunctionExecutionException>(result)) {
+ LOGINFO("Done casting to uFEPtr");
+ LOGINFO("Read expected uFEPtr exception %s ",
+ uFEPtr->getMessage()->asChar());
+ return true;
+ } else {
+ LOGINFO("Unexpected result type %s for index %d.",
+ result->toString()->asChar(), index);
+ }
+
+ return false;
+}
+
+template <class _T>
+bool validateResultType(const int32_t index, const CacheablePtr& result) {
+ return false;
+}
DUNIT_TASK_DEFINITION(LOCATOR1, StartLocator1)
{
@@ -184,16 +233,11 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, StartC1)
{
- // initClient(true);
- initClientWithPool(true, NULL, locHostPort, serverGroup, NULLPTR, 0, true,
+ initClientWithPool(true, NULL, locHostPort, serverGroup, nullptr, 0, true,
-1, -1, 60000, /*singlehop*/ true,
/*threadLocal*/ true);
- // createPool(poolName, locHostPort,serverGroup, NULL, 0, true );
- // createRegionAndAttachPool(poolRegNames[0],USE_ACK, poolName);
- RegionPtr regPtr0 =
- createRegionAndAttachPool(poolRegNames[0], USE_ACK, NULL);
- ; // getHelper()->createRegion( poolRegNames[0], USE_ACK);
+ auto regPtr0 = createRegionAndAttachPool(poolRegNames[0], USE_ACK, NULL);
regPtr0->registerAllKeys();
LOG("Clnt1Init complete.");
@@ -202,65 +246,53 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
{
- RegionPtr regPtr0 = getHelper()->getRegion(poolRegNames[0]);
+ auto regPtr0 = getHelper()->getRegion(poolRegNames[0]);
char buf[128];
for (int i = 0; i < 34; i++) {
sprintf(buf, "VALUE--%d", i);
- CacheablePtr value(CacheableString::create(buf));
+ auto value = CacheableString::create(buf);
sprintf(buf, "KEY--%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
+ auto key = CacheableKey::create(buf);
regPtr0->put(key, value);
}
SLEEP(10000); // let the put finish
try {
CacheablePtr args = CacheableBoolean::create(1);
bool getResult = true;
- CacheableVectorPtr routingObj = CacheableVector::create();
+ auto routingObj = CacheableVector::create();
for (int i = 0; i < 34; i++) {
if (i % 2 == 0) continue;
sprintf(buf, "KEY--%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
+ auto key = CacheableKey::create(buf);
routingObj->push_back(key);
}
// test data dependant function
// test get function with result
- ExecutionPtr exc = FunctionService::onRegion(regPtr0);
- ASSERT(exc != NULLPTR, "onRegion Returned NULL");
+ auto exc = FunctionService::onRegion(regPtr0);
+ ASSERT(exc != nullptr, "onRegion Returned NULL");
args = CacheableKey::create("echoString");
CacheablePtr args1 = CacheableKey::create("echoBoolean");
- ExecutionPtr exe1 = exc->withArgs(args);
- ExecutionPtr exe2 = exe1->withArgs(args1);
+ auto exe1 = exc->withArgs(args);
+ auto exe2 = exe1->withArgs(args1);
- CacheableVectorPtr resultList = CacheableVector::create();
- CacheableVectorPtr executeFunctionResult =
- exe1->execute(rjFuncName, 15)->getResult();
- if (executeFunctionResult == NULLPTR) {
+ auto resultList = CacheableVector::create();
+ auto executeFunctionResult = exe1->execute(rjFuncName, 15)->getResult();
+ if (executeFunctionResult == nullptr) {
ASSERT(false, "echo String : executeFunctionResult is NULL");
} else {
sprintf(buf, "echo String : result count = %d",
executeFunctionResult->size());
LOG(buf);
- try {
- CacheableStringPtr csp =
- dynCast<CacheableStringPtr>(executeFunctionResult->operator[](0));
+ if (auto csp = std::dynamic_pointer_cast<CacheableString>(
+ executeFunctionResult->operator[](0))) {
sprintf(buf, "echo String : cast successful, echoed string= %s",
csp->asChar());
LOG(buf);
- } catch (ClassCastException& ex) {
- std::string logmsg = "";
- logmsg += ex.getName();
- logmsg += ": ";
- logmsg += ex.getMessage();
- LOG(logmsg.c_str());
- ex.printStackTrace();
- LOG("cast to string failed, now cast to boolean:");
- bool b ATTR_UNUSED =
- dynCast<CacheableBooleanPtr>(executeFunctionResult->operator[](0))
- ->value();
- ASSERT(false, "echo String : wrong argument type");
+ } else {
+ FAIL("echo String : wrong argument type");
}
}
executeFunctionResult = exc->withFilter(routingObj)
@@ -272,15 +304,15 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
->withArgs(args)
->execute(rjFuncName, 15)
->getResult();
- if (executeFunctionResult == NULLPTR) {
+ if (executeFunctionResult == nullptr) {
ASSERT(false, "echo String : executeFunctionResult is NULL");
} else {
sprintf(buf, "echo String : result count = %d",
executeFunctionResult->size());
LOG(buf);
- const char* str =
- dynCast<CacheableStringPtr>(executeFunctionResult->operator[](0))
- ->asChar();
+ const char* str = std::dynamic_pointer_cast<CacheableString>(
+ executeFunctionResult->operator[](0))
+ ->asChar();
LOG(str);
ASSERT(strcmp("echoString", str) == 0, "echoString is not eched back");
}
@@ -289,15 +321,15 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
->withArgs(args)
->execute(rjFuncName, 15)
->getResult();
- if (executeFunctionResult == NULLPTR) {
+ if (executeFunctionResult == nullptr) {
ASSERT(false, "echo Boolean: executeFunctionResult is NULL");
} else {
sprintf(buf, "echo Boolean: result count = %d",
executeFunctionResult->size());
LOG(buf);
- bool b =
- dynCast<CacheableBooleanPtr>(executeFunctionResult->operator[](0))
- ->value();
+ bool b = std::dynamic_pointer_cast<CacheableBoolean>(
+ executeFunctionResult->operator[](0))
+ ->value();
LOG(b == true ? "true" : "false");
ASSERT(b == true, "true is not eched back");
}
@@ -309,20 +341,20 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
/****
**decomposed from above long expression:
exc = exc->withFilter(routingObj);
- ASSERT(exc!=NULLPTR, "withFilter Returned NULL");
+ ASSERT(exc!=nullptr, "withFilter Returned NULL");
exc = exc->withArgs(args);
- ASSERT(exc!=NULLPTR, "withArgs Returned NULL");
+ ASSERT(exc!=nullptr, "withArgs Returned NULL");
ResultCollectorPtr rc = exc->execute(getFuncName, getResult);
- ASSERT(rc!=NULLPTR, "execute Returned NULL");
+ ASSERT(rc!=nullptr, "execute Returned NULL");
CacheableVectorPtr executeFunctionResult = rc->getResult();
*/
- if (executeFunctionResult == NULLPTR) {
+ if (executeFunctionResult == nullptr) {
ASSERT(false, "region get: executeFunctionResult is NULL");
} else {
for (unsigned item = 0;
item < static_cast<uint32_t>(executeFunctionResult->size());
item++) {
- CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>(
+ auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>(
executeFunctionResult->operator[](item));
for (unsigned pos = 0; pos < static_cast<uint32_t>(arrayList->size());
pos++) {
@@ -334,18 +366,19 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
ASSERT(resultList->size() == 34,
"region get: resultList count is not 34");
for (int32_t i = 0; i < resultList->size(); i++) {
- CacheableStringPtr csPtr =
- dynCast<CacheableStringPtr>(resultList->operator[](i));
+ auto csPtr = std::dynamic_pointer_cast<CacheableString>(
+ resultList->operator[](i));
// printf(" in csPtr = %u \n",csPtr);
- if (csPtr != NULLPTR) {
+ if (csPtr != nullptr) {
sprintf(buf, "Region get: result[%d]=%s", i,
- dynCast<CacheableStringPtr>(resultList->operator[](i))
+ std::dynamic_pointer_cast<CacheableString>(
+ resultList->operator[](i))
->asChar());
LOG(buf);
verifyGetResults()
} else {
CacheablePtr tmp = resultList->operator[](i);
- if (tmp != NULLPTR) {
+ if (tmp != nullptr) {
printf(" in typeid = %d \n", tmp->typeId());
} else {
@@ -355,7 +388,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
}
}
// test get function with customer collector
- MyResultCollectorPtr myRC(new MyResultCollector());
+ auto myRC = std::make_shared<MyResultCollector>();
executeFunctionResult = exc->withFilter(routingObj)
->withArgs(args)
->withCollector(myRC)
@@ -367,7 +400,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
LOG(buf);
sprintf(buf, "get result count = %d", myRC->getGetResultCount());
LOG(buf);
- if (executeFunctionResult == NULLPTR) {
+ if (executeFunctionResult == nullptr) {
ASSERT(false,
"region get new collector: executeFunctionResult is NULL");
} else {
@@ -387,25 +420,24 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
executeFunctionResult->size() == resultList->size(),
"region get new collector: executeFunctionResult count is not 34");
for (int32_t i = 0; i < executeFunctionResult->size(); i++) {
- sprintf(
- buf, "Region get new collector: result[%d]=%s", i,
- dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar());
+ sprintf(buf, "Region get new collector: result[%d]=%s", i,
+ std::dynamic_pointer_cast<CacheableString>(
+ resultList->operator[](i))
+ ->asChar());
LOG(buf);
verifyGetResults()
}
}
- LOG("Done.................");
// test put function without result
getResult = false;
exc->withFilter(routingObj)->withArgs(args)->execute(putFuncName, 15);
- LOG("Done.................2");
SLEEP(10000); // let the put finish
for (int i = 0; i < 34; i++) {
if (i % 2 == 0) continue;
sprintf(buf, "KEY--%d", i);
CacheableKeyPtr key = CacheableKey::create(buf);
- CacheableStringPtr value =
- dynCast<CacheableStringPtr>(regPtr0->get(key));
+ auto value =
+ std::dynamic_pointer_cast<CacheableString>(regPtr0->get(key));
sprintf(buf, "Region put: result[%d]=%s", i, value->asChar());
LOG(buf);
verifyPutResults()
@@ -418,7 +450,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
->execute(getFuncName, 15)
->getResult();
- if (executeFunctionResult == NULLPTR) {
+ if (executeFunctionResult == nullptr) {
ASSERT(false, "get executeFunctionResult is NULL");
} else {
sprintf(buf, "echo String : result count = %d",
@@ -429,7 +461,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
for (unsigned item = 0;
item < static_cast<uint32_t>(executeFunctionResult->size());
item++) {
- CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>(
+ auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>(
executeFunctionResult->operator[](item));
for (unsigned pos = 0; pos < static_cast<uint32_t>(arrayList->size());
pos++) {
@@ -442,10 +474,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
"get executeFunctionResult count is not 34");
for (int32_t i = 0; i < resultList->size(); i++) {
sprintf(buf, "result[%d] is null\n", i);
- ASSERT(resultList->operator[](i) != NULLPTR, buf);
- sprintf(
- buf, "get result[%d]=%s", i,
- dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar());
+ ASSERT(resultList->operator[](i) != nullptr, buf);
+ sprintf(buf, "get result[%d]=%s", i,
+ std::dynamic_pointer_cast<CacheableString>(
+ resultList->operator[](i))
+ ->asChar());
LOGINFO(buf);
verifyGetKeyResults()
}
@@ -454,26 +487,26 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
//-----------------------Test with sendException
// onRegion-------------------------------//
for (int i = 1; i <= 200; i++) {
- CacheablePtr value(CacheableInt32::create(i));
+ auto value = CacheableInt32::create(i);
sprintf(buf, "execKey-%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
+ auto key = CacheableKey::create(buf);
regPtr0->put(key, value);
}
LOG("Put for execKey's on region complete.");
LOG("Adding filter");
- CacheableArrayListPtr arrList = CacheableArrayList::create();
+ auto arrList = CacheableArrayList::create();
for (int i = 100; i < 120; i++) {
sprintf(buf, "execKey-%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
+ auto key = CacheableKey::create(buf);
arrList->push_back(key);
}
- CacheableVectorPtr filter = CacheableVector::create();
+ auto filter = CacheableVector::create();
for (int i = 100; i < 120; i++) {
sprintf(buf, "execKey-%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
+ auto key = CacheableKey::create(buf);
filter->push_back(key);
}
LOG("Adding filter done.");
@@ -481,51 +514,30 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
args = CacheableBoolean::create(1);
getResult = true;
- ExecutionPtr funcExec = FunctionService::onRegion(regPtr0);
- ASSERT(funcExec != NULLPTR, "onRegion Returned NULL");
+ auto funcExec = FunctionService::onRegion(regPtr0);
+ ASSERT(funcExec != nullptr, "onRegion Returned NULL");
- ResultCollectorPtr collector =
- funcExec->withArgs(args)->withFilter(filter)->execute(
- exFuncNameSendException, 15);
- ASSERT(collector != NULLPTR, "onRegion collector NULL");
+ auto collector = funcExec->withArgs(args)->withFilter(filter)->execute(
+ exFuncNameSendException, 15);
+ ASSERT(collector != nullptr, "onRegion collector NULL");
- CacheableVectorPtr result = collector->getResult();
+ auto result = collector->getResult();
- if (result == NULLPTR) {
+ if (result == nullptr) {
ASSERT(false, "echo String : result is NULL");
} else {
- try {
- for (int i = 0; i < result->size(); i++) {
- UserFunctionExecutionExceptionPtr uFEPtr =
- dynCast<UserFunctionExecutionExceptionPtr>(
- result->operator[](i));
- ASSERT(uFEPtr != NULLPTR, "uFEPtr exception is NULL");
- LOGINFO("Done casting to uFEPtr");
- LOGINFO("Read expected uFEPtr exception %s ",
- uFEPtr->getMessage()->asChar());
- }
- } catch (ClassCastException& ex) {
- std::string logmsg = "";
- logmsg += ex.getName();
- logmsg += ": ";
- logmsg += ex.getMessage();
- LOG(logmsg.c_str());
- ex.printStackTrace();
- FAIL(
- "exFuncNameSendException casting to string for bool arguement "
- "exception.");
- } catch (...) {
- FAIL(
- "exFuncNameSendException casting to string for bool arguement "
- "Unknown exception.");
+ for (int i = 0; i < result->size(); i++) {
+ ASSERT(validateResultTypeIsUserFunctionExecutionException(
+ i, result->operator[](i)),
+ "exFuncNameSendException casting to string for bool "
+ "arguement exception.");
}
}
-
LOG("exFuncNameSendException done for bool arguement.");
collector = funcExec->withArgs(arrList)->withFilter(filter)->execute(
exFuncNameSendException, 15);
- ASSERT(collector != NULLPTR, "onRegion collector for arrList NULL");
+ ASSERT(collector != nullptr, "onRegion collector for arrList NULL");
result = collector->getResult();
LOGINFO("result->size() = %d & arrList->size() = %d ", result->size(),
@@ -535,34 +547,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
"region get: resultList count is not as arrayList count + exception");
for (int i = 0; i < result->size(); i++) {
- try {
- CacheableInt32Ptr intValue =
- dynCast<CacheableInt32Ptr>(result->operator[](i));
- ASSERT(intValue != NULLPTR, "int value is NULL");
- LOGINFO("intValue is %d ", intValue->value());
- } catch (ClassCastException& ex) {
- LOG("exFuncNameSendException casting to int for arrayList arguement "
- "exception.");
- std::string logmsg = "";
- logmsg += ex.getName();
- logmsg += ": ";
- logmsg += ex.getMessage();
- LOG(logmsg.c_str());
- ex.printStackTrace();
- LOG("exFuncNameSendException now casting to "
- "UserFunctionExecutionExceptionPtr for arrayList arguement "
- "exception.");
- UserFunctionExecutionExceptionPtr uFEPtr =
- dynCast<UserFunctionExecutionExceptionPtr>(result->operator[](i));
- ASSERT(uFEPtr != NULLPTR, "uFEPtr exception is NULL");
- LOGINFO("Done casting to uFEPtr");
- LOGINFO("Read expected uFEPtr exception %s ",
- uFEPtr->getMessage()->asChar());
- } catch (...) {
- FAIL(
- "exFuncNameSendException casting to string for bool arguement "
- "Unknown exception.");
- }
+ ASSERT(validateResultTypeAndAllowUserFunctionExecutionException<
+ CacheableInt32>(i, result->operator[](i)),
+ "Unexpected result type.");
}
LOG("exFuncNameSendException done for arrayList arguement.");
@@ -572,38 +559,20 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
args = CacheableString::create("Multiple");
collector = funcExec->withArgs(args)->withFilter(filter)->execute(
exFuncNameSendException, 15);
- ASSERT(collector != NULLPTR, "onRegion collector for string NULL");
+ ASSERT(collector != nullptr, "onRegion collector for string NULL");
result = collector->getResult();
LOGINFO("result->size() for Multiple String = %d ", result->size());
ASSERT(result->size() == 1,
"region get: resultList count is not as string exception");
- try {
- for (int i = 0; i < result->size(); i++) {
- LOG("exFuncNameSendException now casting to "
- "UserFunctionExecutionExceptionPtr for arrayList arguement "
- "exception.");
- UserFunctionExecutionExceptionPtr uFEPtr =
- dynCast<UserFunctionExecutionExceptionPtr>(result->operator[](i));
- ASSERT(uFEPtr != NULLPTR, "uFEPtr exception is NULL");
- LOGINFO("Done casting to uFEPtr");
- LOGINFO("Read expected uFEPtr exception %s ",
- uFEPtr->getMessage()->asChar());
- }
- } catch (ClassCastException& ex) {
- std::string logmsg = "";
- logmsg += ex.getName();
- logmsg += ": ";
- logmsg += ex.getMessage();
- LOG(logmsg.c_str());
- ex.printStackTrace();
- FAIL(
- "exFuncNameSendException casting to string for string arguement "
+ for (int i = 0; i < result->size(); i++) {
+ LOG("exFuncNameSendException now casting to "
+ "UserFunctionExecutionExceptionPtr for arrayList arguement "
"exception.");
- } catch (...) {
- FAIL(
- "exFuncNameSendException casting to string for string arguement "
- "Unknown exception.");
+ ASSERT(validateResultTypeIsUserFunctionExecutionException(
+ i, result->operator[](i)),
+ "exFuncNameSendException casting to string for string "
+ "arguement exception.");
}
LOG("exFuncNameSendException for string arguement done.");
@@ -612,7 +581,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
"test exFuncNameSendException function with customer collector with "
"bool as arguement using onRegion.");
- MyResultCollectorPtr myRC1(new MyResultCollector());
+ auto myRC1 = std::make_shared<MyResultCollector>();
result = funcExec->withArgs(args)
->withFilter(filter)
->withCollector(myRC1)
@@ -624,7 +593,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
ASSERT(1 == myRC1->getAddResultCount(), "add result count is not 1");
ASSERT(1 == myRC1->getEndResultCount(), "end result count is not 1");
ASSERT(1 == myRC1->getGetResultCount(), "get result count is not 1");
- if (result == NULLPTR) {
+ if (result == nullptr) {
ASSERT(false, "region get new collector: result is NULL");
} else {
LOGINFO("Region get new collector: result count = %d", result->size());
@@ -642,10 +611,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
// restore the data set
for (int i = 0; i < 34; i++) {
sprintf(buf, "VALUE--%d", i);
- CacheablePtr value(CacheableString::create(buf));
+ auto value = CacheableString::create(buf);
sprintf(buf, "KEY--%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
+ auto key = CacheableKey::create(buf);
regPtr0->put(key, value);
}
@@ -654,21 +623,21 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
getResult = true;
// PoolPtr pptr = PoolManager::find(poolName);
args = routingObj;
- // ExecutionPtr exc=NULLPTR;
- // CacheableVectorPtr executeFunctionResult = NULLPTR;
+ // ExecutionPtr exc=nullptr;
+ // CacheableVectorPtr executeFunctionResult = nullptr;
// test data independant function on one server
LOG("test data independant get function on one server");
exc = FunctionService::onServer(getHelper()->cachePtr);
executeFunctionResult =
exc->withArgs(args)->execute(getFuncIName, getResult)->getResult();
- if (executeFunctionResult == NULLPTR) {
+ if (executeFunctionResult == nullptr) {
ASSERT(false, "get executeFunctionResult is NULL");
} else {
resultList->clear();
for (unsigned item = 0;
item < static_cast<uint32_t>(executeFunctionResult->size());
item++) {
- CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>(
+ auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>(
executeFunctionResult->operator[](item));
for (unsigned pos = 0; pos < static_cast<uint32_t>(arrayList->size());
pos++) {
@@ -681,10 +650,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
"get executeFunctionResult count is not 17");
for (int32_t i = 0; i < resultList->size(); i++) {
sprintf(buf, "result[%d] is null\n", i);
- ASSERT(resultList->operator[](i) != NULLPTR, buf);
- sprintf(
- buf, "get result[%d]=%s", i,
- dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar());
+ ASSERT(resultList->operator[](i) != nullptr, buf);
+ sprintf(buf, "get result[%d]=%s", i,
+ std::dynamic_pointer_cast<CacheableString>(
+ resultList->operator[](i))
+ ->asChar());
LOG(buf);
verifyGetResults()
}
@@ -697,9 +667,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
for (int i = 0; i < 34; i++) {
if (i % 2 == 0) continue;
sprintf(buf, "KEY--%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
- CacheableStringPtr value =
- dynCast<CacheableStringPtr>(regPtr0->get(key));
+ auto key = CacheableKey::create(buf);
+ auto value =
+ std::dynamic_pointer_cast<CacheableString>(regPtr0->get(key));
sprintf(buf, "put: result[%d]=%s", i, value->asChar());
LOG(buf);
verifyPutResults()
@@ -719,40 +689,40 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
// ignore exception
}
- PdxTypes8Ptr pdxobj(new PdxTests::PdxTypes8());
+ auto pdxobj = std::make_shared<PdxTests::PdxTypes8>();
for (int i = 0; i < 34; i++) {
sprintf(buf, "KEY--pdx%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
+ auto key = CacheableKey::create(buf);
regPtr0->put(key, pdxobj);
}
LOGINFO("put on pdxObject done");
- CacheableVectorPtr pdxRoutingObj = CacheableVector::create();
+ auto pdxRoutingObj = CacheableVector::create();
for (int i = 0; i < 34; i++) {
if (i % 2 == 0) continue;
sprintf(buf, "KEY--pdx%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
+ auto key = CacheableKey::create(buf);
pdxRoutingObj->push_back(key);
}
- ExecutionPtr pdxExc = FunctionService::onServers(getHelper()->cachePtr);
- CacheableVectorPtr executeFunctionResultPdx =
+ auto pdxExc = FunctionService::onServers(getHelper()->cachePtr);
+ auto executeFunctionResultPdx =
pdxExc->withArgs(pdxRoutingObj)
->execute(exFuncNamePdxType, getResult)
->getResult();
LOGINFO("FE on pdxObject done");
- if (executeFunctionResultPdx == NULLPTR) {
+ if (executeFunctionResultPdx == nullptr) {
ASSERT(false, "get executeFunctionResultPdx is NULL");
} else {
LOGINFO("executeFunctionResultPdx size for PdxObject = %d ",
executeFunctionResultPdx->size());
ASSERT(2 == executeFunctionResultPdx->size(),
"executeFunctionResultPdx->size() is not 2");
- CacheableVectorPtr resultListPdx = CacheableVector::create();
+ auto resultListPdx = CacheableVector::create();
for (unsigned item = 0;
item < static_cast<uint32_t>(executeFunctionResultPdx->size());
item++) {
- CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>(
+ auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>(
executeFunctionResultPdx->operator[](item));
for (unsigned pos = 0; pos < static_cast<uint32_t>(arrayList->size());
pos++) {
@@ -762,23 +732,22 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
LOGINFO("resultlistPdx size: %d", resultListPdx->size());
for (int32_t i = 0; i < resultListPdx->size(); i++) {
sprintf(buf, "result[%d] is null\n", i);
- ASSERT(resultListPdx->operator[](i) != NULLPTR, buf);
+ ASSERT(resultListPdx->operator[](i) != nullptr, buf);
LOG("resultPdx item is not null");
- LOGINFO("get result[%d]=%s", i,
- dynCast<PdxTypes8Ptr>(resultListPdx->operator[](i))
- ->toString()
- ->asChar());
- PdxTypes8Ptr pdxObj2 =
- dynCast<PdxTypes8Ptr>(resultListPdx->operator[](i));
+ LOGINFO("get result[%d]=%s", i, std::dynamic_pointer_cast<PdxTypes8>(
+ resultListPdx->operator[](i))
+ ->toString()
+ ->asChar());
+ auto pdxObj2 = std::dynamic_pointer_cast<PdxTypes8>(
+ resultListPdx->operator[](i));
ASSERT(pdxobj->equals(pdxObj2) == true,
"Pdx Object not equals original object.");
}
}
LOG("test pdx data function on all servers done");
- PdxInstanceFactoryPtr pifPtr =
- cacheHelper->getCache()->createPdxInstanceFactory(
- "PdxTests.PdxTypes8");
+ auto pifPtr = cacheHelper->getCache()->createPdxInstanceFactory(
+ "PdxTests.PdxTypes8");
LOG("PdxInstanceFactoryPtr created....");
pifPtr->writeInt("i1", 1);
@@ -788,7 +757,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
pifPtr->writeInt("i3", 3);
pifPtr->writeInt("i4", 4);
- PdxInstancePtr ret = pifPtr->create();
+ auto ret = pifPtr->create();
LOG("PdxInstancePtr created");
for (int i = 0; i < 34; i++) {
@@ -798,7 +767,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
}
LOGINFO("put on pdxObject done");
- CacheableVectorPtr pdxInstanceRoutingObj = CacheableVector::create();
+ auto pdxInstanceRoutingObj = CacheableVector::create();
for (int i = 0; i < 34; i++) {
if (i % 2 == 0) continue;
sprintf(buf, "KEY--pdx%d", i);
@@ -806,26 +775,25 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
pdxInstanceRoutingObj->push_back(key);
}
- ExecutionPtr pdxInstanceExc =
- FunctionService::onServers(getHelper()->cachePtr);
- CacheableVectorPtr executeFunctionResultPdxInstance =
+ auto pdxInstanceExc = FunctionService::onServers(getHelper()->cachePtr);
+ auto executeFunctionResultPdxInstance =
pdxInstanceExc->withArgs(pdxInstanceRoutingObj)
->execute(exFuncNamePdxType, getResult)
->getResult();
LOGINFO("FE on pdxObject done");
- if (executeFunctionResultPdxInstance == NULLPTR) {
+ if (executeFunctionResultPdxInstance == nullptr) {
ASSERT(false, "get executeFunctionResultPdxInstance is NULL");
} else {
LOGINFO("executeFunctionResultPdxInstance size for PdxObject = %d ",
executeFunctionResultPdxInstance->size());
ASSERT(2 == executeFunctionResultPdx->size(),
"executeFunctionResultPdxInstance->size() is not 2");
- CacheableVectorPtr resultListPdxInstance = CacheableVector::create();
+ auto resultListPdxInstance = CacheableVector::create();
for (unsigned item = 0;
item <
static_cast<uint32_t>(executeFunctionResultPdxInstance->size());
item++) {
- CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>(
+ auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>(
executeFunctionResultPdxInstance->operator[](item));
for (unsigned pos = 0; pos < static_cast<uint32_t>(arrayList->size());
pos++) {
@@ -836,14 +804,15 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
resultListPdxInstance->size());
for (int32_t i = 0; i < resultListPdxInstance->size(); i++) {
sprintf(buf, "result[%d] is null\n", i);
- ASSERT(resultListPdxInstance->operator[](i) != NULLPTR, buf);
+ ASSERT(resultListPdxInstance->operator[](i) != nullptr, buf);
LOG("resultPdx item is not null");
LOGINFO("get result[%d]=%s", i,
- dynCast<PdxTypes8Ptr>(resultListPdxInstance->operator[](i))
+ std::dynamic_pointer_cast<PdxTypes8>(
+ resultListPdxInstance->operator[](i))
->toString()
->asChar());
- PdxTypes8Ptr pdxObj2 =
- dynCast<PdxTypes8Ptr>(resultListPdxInstance->operator[](i));
+ auto pdxObj2 = std::dynamic_pointer_cast<PdxTypes8>(
+ resultListPdxInstance->operator[](i));
ASSERT(pdxobj->equals(pdxObj2) == true,
"Pdx Object not equals original object.");
@@ -857,10 +826,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
// repopulate with the original values
for (int i = 0; i < 34; i++) {
sprintf(buf, "VALUE--%d", i);
- CacheablePtr value(CacheableString::create(buf));
+ auto value = CacheableString::create(buf);
sprintf(buf, "KEY--%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
+ auto key = CacheableKey::create(buf);
regPtr0->put(key, value);
}
SLEEP(10000); // let the put finish
@@ -874,6 +843,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
if (isLocalServer) {
CacheHelper::initServer(3, "func_cacheserver3_pool.xml", lhp);
}
+ LOGINFO("Sleeping for 60s...");
SLEEP(60000); // let this servers gets all the data
//---------------------------------------------------------------------
@@ -881,14 +851,14 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
exc = FunctionService::onServers(getHelper()->cachePtr);
executeFunctionResult =
exc->withArgs(args)->execute(getFuncIName, getResult)->getResult();
- if (executeFunctionResult == NULLPTR) {
+ if (executeFunctionResult == nullptr) {
ASSERT(false, "get executeFunctionResult is NULL");
} else {
resultList->clear();
for (unsigned item = 0;
item < static_cast<uint32_t>(executeFunctionResult->size());
item++) {
- CacheableArrayListPtr arrayList = dynCast<CacheableArrayListPtr>(
+ auto arrayList = std::dynamic_pointer_cast<CacheableArrayList>(
executeFunctionResult->operator[](item));
for (unsigned pos = 0; pos < static_cast<uint32_t>(arrayList->size());
pos++) {
@@ -902,10 +872,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
"get executeFunctionResult on all servers count is not 51");
for (int32_t i = 0; i < resultList->size(); i++) {
sprintf(buf, "result[%d] is null\n", i);
- ASSERT(resultList->operator[](i) != NULLPTR, buf);
- sprintf(
- buf, "get result[%d]=%s", i,
- dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar());
+ ASSERT(resultList->operator[](i) != nullptr, buf);
+ sprintf(buf, "get result[%d]=%s", i,
+ std::dynamic_pointer_cast<CacheableString>(
+ resultList->operator[](i))
+ ->asChar());
LOG(buf);
verifyGetResults()
}
@@ -919,9 +890,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
for (int i = 0; i < 34; i++) {
if (i % 2 == 0) continue;
sprintf(buf, "KEY--%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
- CacheableStringPtr value =
- dynCast<CacheableStringPtr>(regPtr0->get(key));
+ auto key = CacheableKey::create(buf);
+ auto value =
+ std::dynamic_pointer_cast<CacheableString>(regPtr0->get(key));
sprintf(buf, "put: result[%d]=%s", i, value->asChar());
LOG(buf);
verifyPutResults()
@@ -935,44 +906,25 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
collector =
funcExec->withArgs(args)->execute(exFuncNameSendException, 15);
- ASSERT(collector != NULLPTR, "onServers collector for bool NULL");
+ ASSERT(collector != nullptr, "onServers collector for bool NULL");
result = collector->getResult();
ASSERT(result->size() == 3,
"Should have got 3 exception strings for sendException.");
- if (result == NULLPTR) {
+ if (result == nullptr) {
ASSERT(false, "echo String : result is NULL");
} else {
- try {
- for (int i = 0; i < result->size(); i++) {
- UserFunctionExecutionExceptionPtr uFEPtr =
- dynCast<UserFunctionExecutionExceptionPtr>(
- result->operator[](i));
- ASSERT(uFEPtr != NULLPTR, "uFEPtr exception is NULL");
- LOGINFO("Done casting to uFEPtr");
- LOGINFO("Read expected uFEPtr exception %s ",
- uFEPtr->getMessage()->asChar());
- }
- } catch (ClassCastException& ex) {
- std::string logmsg = "";
- logmsg += ex.getName();
- logmsg += ": ";
- logmsg += ex.getMessage();
- LOG(logmsg.c_str());
- ex.printStackTrace();
- FAIL(
- "exFuncNameSendException casting to string for bool arguement "
- "exception.");
- } catch (...) {
- FAIL(
- "exFuncNameSendException casting to string for bool arguement "
- "Unknown exception.");
+ for (int i = 0; i < result->size(); i++) {
+ ASSERT(validateResultTypeIsUserFunctionExecutionException(
+ i, result->operator[](i)),
+ "exFuncNameSendException casting to string for bool arguement "
+ "Unknown exception.");
}
}
collector =
funcExec->withArgs(arrList)->execute(exFuncNameSendException, 15);
- ASSERT(collector != NULLPTR, "onServers collector for arrList NULL");
+ ASSERT(collector != nullptr, "onServers collector for arrList NULL");
result = collector->getResult();
ASSERT(result->size() == (arrList->size() + 1) * 3,
@@ -982,60 +934,16 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
LOG("Printing only string exception results for onServers with "
"sendException");
for (int i = 0; i < result->size(); i++) {
- try {
- CacheableInt32Ptr intValue =
- dynCast<CacheableInt32Ptr>(result->operator[](i));
- ASSERT(intValue != NULLPTR, "int value is NULL");
- LOGINFO("intValue is %d ", intValue->value());
- } catch (ClassCastException& ex) {
- std::string logmsg = "";
- logmsg += ex.getName();
- logmsg += ": ";
- logmsg += ex.getMessage();
- LOG(logmsg.c_str());
- ex.printStackTrace();
- UserFunctionExecutionExceptionPtr uFEPtr =
- dynCast<UserFunctionExecutionExceptionPtr>(result->operator[](i));
- ASSERT(uFEPtr != NULLPTR, "uFEPtr exception is NULL");
- LOGINFO("Done casting to uFEPtr");
- LOGINFO("Read expected uFEPtr exception %s ",
- uFEPtr->getMessage()->asChar());
- } catch (...) {
- FAIL(
- "exFuncNameSendException casting to string for arrList arguement "
- "for onServers Unknown exception.");
- }
+ ASSERT(validateResultTypeAndAllowUserFunctionExecutionException<
+ CacheableInt32>(i, result->operator[](i)),
+ "Unexpected result type.");
}
LOG("Printing all results for onServers with sendException");
for (int i = 0; i < result->size(); i++) {
- try {
- CacheableInt32Ptr intValue =
- dynCast<CacheableInt32Ptr>(result->operator[](i));
- ASSERT(intValue != NULLPTR, "int value is NULL");
- LOGINFO("intValue is %d ", intValue->value());
- } catch (ClassCastException& ex) {
- LOG("exFuncNameSendException casting to int for arrayList arguement "
- "exception.");
- std::string logmsg = "";
- logmsg += ex.getName();
- logmsg += ": ";
- logmsg += ex.getMessage();
- LOG(logmsg.c_str());
- ex.printStackTrace();
- LOG("exFuncNameSendException now casting to string for arrayList "
- "arguement exception.");
- UserFunctionExecutionExceptionPtr uFEPtr =
- dynCast<UserFunctionExecutionExceptionPtr>(result->operator[](i));
- ASSERT(uFEPtr != NULLPTR, "uFEPtr exception is NULL");
- LOGINFO("Done casting to uFEPtr");
- LOGINFO("Read expected uFEPtr exception %s ",
- uFEPtr->getMessage()->asChar());
- } catch (...) {
- FAIL(
- "exFuncNameSendException casting to string for bool arguement "
- "Unknown exception.");
- }
+ ASSERT(validateResultTypeAndAllowUserFunctionExecutionException<
+ CacheableInt32>(i, result->operator[](i)),
+ "Unexpected result type.");
}
LOG("exFuncNameSendException for string arguement.");
@@ -1043,35 +951,17 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
args = CacheableString::create("Multiple");
collector =
funcExec->withArgs(args)->execute(exFuncNameSendException, 15);
- ASSERT(collector != NULLPTR, "onServers collector for string NULL");
+ ASSERT(collector != nullptr, "onServers collector for string NULL");
result = collector->getResult();
ASSERT(result->size() == 3,
"region get: resultList count is not as string exception");
- try {
- for (int i = 0; i < result->size(); i++) {
- UserFunctionExecutionExceptionPtr uFEPtr =
- dynCast<UserFunctionExecutionExceptionPtr>(result->operator[](i));
- ASSERT(uFEPtr != NULLPTR, "uFEPtr exception is NULL");
- LOGINFO("Done casting to uFEPtr");
- LOGINFO("Read expected uFEPtr exception %s ",
- uFEPtr->getMessage()->asChar());
- }
- } catch (ClassCastException& ex) {
- std::string logmsg = "";
- logmsg += ex.getName();
- logmsg += ": ";
- logmsg += ex.getMessage();
- LOG(logmsg.c_str());
- ex.printStackTrace();
- FAIL(
- "exFuncNameSendException casting to string for string arguement "
- "exception.");
- } catch (...) {
- FAIL(
- "exFuncNameSendException casting to string for string arguement "
- "Unknown exception.");
+ for (int i = 0; i < result->size(); i++) {
+ ASSERT(validateResultTypeIsUserFunctionExecutionException(
+ i, result->operator[](i)),
+ "exFuncNameSendException casting to string for string arguement "
+ "exception.");
}
LOG("exFuncNameSendException for string arguement done.");
@@ -1080,7 +970,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
"test exFuncNameSendException function with customer collector with "
"bool as arguement using onServers.");
- MyResultCollectorPtr myRC2(new MyResultCollector());
+ auto myRC2 = std::make_shared<MyResultCollector>();
result = funcExec->withArgs(args)
->withCollector(myRC2)
->execute(exFuncNameSendException, getResult)
@@ -1091,7 +981,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
LOGINFO("add result count = %d", myRC2->getAddResultCount());
LOGINFO("end result count = %d", myRC2->getEndResultCount());
LOGINFO("get result count = %d", myRC2->getGetResultCount());
- if (result == NULLPTR) {
+ if (result == nullptr) {
ASSERT(false, "region get new collector: result is NULL");
} else {
LOGINFO("Region get new collector: result count = %d", result->size());
@@ -1112,20 +1002,20 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
// onRegion-------------------------------//
for (int i = 0; i < 230; i++) {
sprintf(buf, "VALUE--%d", i);
- CacheablePtr value(CacheableString::create(buf));
+ auto value = CacheableString::create(buf);
regPtr0->put(i, value);
}
LOGINFO("Put done.");
getResult = true;
for (int i = 0; i < 230; i++) {
- CacheableVectorPtr fil = CacheableVector::create();
+ auto fil = CacheableVector::create();
fil->push_back(CacheableInt32::create(i));
- ExecutionPtr exe = FunctionService::onRegion(regPtr0);
- CacheableVectorPtr executeFunctionResult2 =
+ auto exe = FunctionService::onRegion(regPtr0);
+ auto executeFunctionResult2 =
exe->withFilter(fil)->execute(FEOnRegionPrSHOP, 15)->getResult();
- if (executeFunctionResult2 == NULLPTR) {
- ASSERT(false, "executeFunctionResult2 is NULLPTR");
+ if (executeFunctionResult2 == nullptr) {
+ ASSERT(false, "executeFunctionResult2 is nullptr");
} else {
sprintf(buf, "executeFunctionResult2 count = %d",
executeFunctionResult2->size());
@@ -1133,7 +1023,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
ASSERT(1 == executeFunctionResult2->size(),
"executeFunctionResult2->size() is not 1");
for (int i = 0; i < executeFunctionResult2->size(); i++) {
- bool b = dynCast<CacheableBooleanPtr>(
+ bool b = std::dynamic_pointer_cast<CacheableBoolean>(
executeFunctionResult2->operator[](i))
->value();
LOGINFO(b == true ? "true" : "false");
@@ -1143,19 +1033,20 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
executeFunctionResult2->clear();
LOGINFO("FEOnRegionPrSHOP without Filter done");
- CacheableVectorPtr functionResult =
+ auto functionResult =
exe->withFilter(fil)
->execute(FEOnRegionPrSHOP_OptimizeForWrite, 15)
->getResult();
- if (functionResult == NULLPTR) {
- ASSERT(false, "functionResult is NULLPTR");
+ if (functionResult == nullptr) {
+ ASSERT(false, "functionResult is nullptr");
} else {
sprintf(buf, "result count = %d", functionResult->size());
LOGINFO(buf);
ASSERT(1 == functionResult->size(),
"functionResult->size() is not 1");
for (int i = 0; i < functionResult->size(); i++) {
- bool b = dynCast<CacheableBooleanPtr>(functionResult->operator[](i))
+ bool b = std::dynamic_pointer_cast<CacheableBoolean>(
+ functionResult->operator[](i))
->value();
LOGINFO(b == true ? "true" : "false");
ASSERT(b == true, "true is not eched back");
@@ -1168,19 +1059,20 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
//////////////////////OnRegion TimeOut ///////////////////////////
LOGINFO("FETimeOut begin onRegion");
- ExecutionPtr RexecutionPtr = FunctionService::onRegion(regPtr0);
- CacheableVectorPtr fe =
- RexecutionPtr->withArgs(CacheableInt32::create(5000 * 1000))
- ->execute(FETimeOut, 5000)
- ->getResult();
- if (fe == NULLPTR) {
+ auto RexecutionPtr = FunctionService::onRegion(regPtr0);
+ auto fe = RexecutionPtr->withArgs(CacheableInt32::create(5000 * 1000))
+ ->execute(FETimeOut, 5000)
+ ->getResult();
+ if (fe == nullptr) {
ASSERT(false, "functionResult is NULL");
} else {
sprintf(buf, "result count = %d", fe->size());
LOG(buf);
// ASSERT(2 == fe->size(), "FunctionResult->size() is not 2");
for (int i = 0; i < fe->size(); i++) {
- bool b = dynCast<CacheableBooleanPtr>(fe->operator[](i))->value();
+ bool b =
+ std::dynamic_pointer_cast<CacheableBoolean>(fe->operator[](i))
+ ->value();
LOG(b == true ? "true" : "false");
ASSERT(b == true, "true is not eched back");
}
@@ -1189,19 +1081,20 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
//////////////////////OnRegion TimeOut Done///////////////////////////
LOGINFO("FETimeOut begin onServer");
- ExecutionPtr serverExc = FunctionService::onServer(getHelper()->cachePtr);
- CacheableVectorPtr vec =
- serverExc->withArgs(CacheableInt32::create(5000 * 1000))
- ->execute(FETimeOut, 5000)
- ->getResult();
- if (vec == NULLPTR) {
+ auto serverExc = FunctionService::onServer(getHelper()->cachePtr);
+ auto vec = serverExc->withArgs(CacheableInt32::create(5000 * 1000))
+ ->execute(FETimeOut, 5000)
+ ->getResult();
+ if (vec == nullptr) {
ASSERT(false, "functionResult is NULL");
} else {
sprintf(buf, "result count = %d", vec->size());
LOG(buf);
ASSERT(1 == vec->size(), "FunctionResult->size() is not 1");
for (int i = 0; i < vec->size(); i++) {
- bool b = dynCast<CacheableBooleanPtr>(vec->operator[](i))->value();
+ bool b =
+ std::dynamic_pointer_cast<CacheableBoolean>(vec->operator[](i))
+ ->value();
LOG(b == true ? "true" : "false");
ASSERT(b == true, "true is not eched back");
}
@@ -1209,20 +1102,20 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
LOGINFO("FETimeOut done onServer");
LOGINFO("FETimeOut begin onServers");
- ExecutionPtr serversExc =
- FunctionService::onServers(getHelper()->cachePtr);
- CacheableVectorPtr vecs =
- serversExc->withArgs(CacheableInt32::create(5000 * 1000))
- ->execute(FETimeOut, 5000)
- ->getResult();
- if (vecs == NULLPTR) {
+ auto serversExc = FunctionService::onServers(getHelper()->cachePtr);
+ auto vecs = serversExc->withArgs(CacheableInt32::create(5000 * 1000))
+ ->execute(FETimeOut, 5000)
+ ->getResult();
+ if (vecs == nullptr) {
ASSERT(false, "functionResult is NULL");
} else {
sprintf(buf, "result count = %d", vecs->size());
LOG(buf);
ASSERT(3 == vecs->size(), "FunctionResult->size() is not 3");
for (int i = 0; i < vecs->size(); i++) {
- bool b = dynCast<CacheableBooleanPtr>(vecs->operator[](i))->value();
+ bool b =
+ std::dynamic_pointer_cast<CacheableBoolean>(vecs->operator[](i))
+ ->value();
LOG(b == true ? "true" : "false");
ASSERT(b == true, "true is not eched back");
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientPoolExecuteFunctionThrowsException.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientPoolExecuteFunctionThrowsException.cpp b/src/cppcache/integration-test/testThinClientPoolExecuteFunctionThrowsException.cpp
index 177da82..6220c9e 100644
--- a/src/cppcache/integration-test/testThinClientPoolExecuteFunctionThrowsException.cpp
+++ b/src/cppcache/integration-test/testThinClientPoolExecuteFunctionThrowsException.cpp
@@ -57,62 +57,62 @@ char* FEOnRegionPrSHOP_OptimizeForWrite =
char* FETimeOut = (char*)"FunctionExecutionTimeOut";
#define verifyGetResults() \
- bool found = false; \
- for (int j = 0; j < 34; j++) { \
- if (j % 2 == 0) continue; \
- sprintf(buf, "VALUE--%d", j); \
- if (strcmp(buf, dynCast<CacheableStringPtr>(resultList->operator[](i)) \
- ->asChar()) == 0) { \
- LOGINFO( \
- "buf = %s " \
- "dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar() " \
- "= %s ", \
- buf, \
- dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar()); \
- found = true; \
- break; \
- } \
- } \
- ASSERT(found, "this returned value is invalid");
+ bool found = false; \
+ for (int j = 0; j < 34; j++) { \
+ if (j % 2 == 0) continue; \
+ sprintf(buf, "VALUE--%d", j); \
+ if (strcmp(buf, dynCast<CacheableStringPtr>(resultList->operator[](i)) \
+ ->asChar()) == 0) { \
+ LOGINFO( \
+ "buf = %s " \
+ "dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar() " \
+ "= %s ", \
+ buf, \
+ dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar()); \
+ found = true; \
+ break; \
+ } \
+ } \
+ ASSERT(found, "this returned value is invalid");
#define verifyGetKeyResults() \
- bool found = false; \
- for (int j = 0; j < 34; j++) { \
- if (j % 2 == 0) continue; \
- sprintf(buf, "KEY--%d", j); \
- if (strcmp(buf, dynCast<CacheableStringPtr>(resultList->operator[](i)) \
- ->asChar()) == 0) { \
- LOGINFO( \
- "buf = %s " \
- "dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar() " \
- "= %s ", \
- buf, \
- dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar()); \
- found = true; \
- break; \
- } \
- } \
- ASSERT(found, "this returned KEY is invalid");
+ bool found = false; \
+ for (int j = 0; j < 34; j++) { \
+ if (j % 2 == 0) continue; \
+ sprintf(buf, "KEY--%d", j); \
+ if (strcmp(buf, dynCast<CacheableStringPtr>(resultList->operator[](i)) \
+ ->asChar()) == 0) { \
+ LOGINFO( \
+ "buf = %s " \
+ "dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar() " \
+ "= %s ", \
+ buf, \
+ dynCast<CacheableStringPtr>(resultList->operator[](i))->asChar()); \
+ found = true; \
+ break; \
+ } \
+ } \
+ ASSERT(found, "this returned KEY is invalid");
#define verifyPutResults() \
- bool found = false; \
- for (int j = 0; j < 34; j++) { \
- if (j % 2 == 0) continue; \
- sprintf(buf, "KEY--%d", j); \
- if (strcmp(buf, value->asChar()) == 0) { \
- found = true; \
- break; \
- } \
- } \
- ASSERT(found, "this returned value is invalid");
+ bool found = false; \
+ for (int j = 0; j < 34; j++) { \
+ if (j % 2 == 0) continue; \
+ sprintf(buf, "KEY--%d", j); \
+ if (strcmp(buf, value->asChar()) == 0) { \
+ found = true; \
+ break; \
+ } \
+ } \
+ ASSERT(found, "this returned value is invalid");
class MyResultCollector : public ResultCollector {
public:
MyResultCollector()
- : m_resultList(CacheableVector::create()),
- m_isResultReady(false),
- m_endResultCount(0),
- m_addResultCount(0),
- m_getResultCount(0) {}
+ : m_resultList(CacheableVector::create()),
+ m_isResultReady(false),
+ m_endResultCount(0),
+ m_addResultCount(0),
+ m_getResultCount(0) {}
~MyResultCollector() {}
CacheableVectorPtr getResult(uint32_t timeout) {
m_getResultCount++;
@@ -131,18 +131,18 @@ class MyResultCollector : public ResultCollector {
void addResult(CacheablePtr& resultItem) {
m_addResultCount++;
- if (resultItem == NULLPTR) {
+ if (resultItem == nullptr) {
return;
}
- try {
- CacheableArrayListPtr result = dynCast<CacheableArrayListPtr>(resultItem);
+ if (auto result =
+ std::dynamic_pointer_cast<CacheableArrayList>(resultItem)) {
for (int32_t i = 0; i < result->size(); i++) {
m_resultList->push_back(result->operator[](i));
}
- } catch (ClassCastException) {
- UserFunctionExecutionExceptionPtr result =
- dynCast<UserFunctionExecutionExceptionPtr>(resultItem);
- m_resultList->push_back(result);
+ } else {
+ auto ex =
+ std::dynamic_pointer_cast<UserFunctionExecutionException>(resultItem);
+ m_resultList->push_back(ex);
}
}
void endResults() {
@@ -163,60 +163,61 @@ class MyResultCollector : public ResultCollector {
typedef SharedPtr<MyResultCollector> MyResultCollectorPtr;
DUNIT_TASK_DEFINITION(LOCATOR1, StartLocator1)
-{
- // starting locator
- if (isLocator) {
- CacheHelper::initLocator(1);
- LOG("Locator1 started");
+ {
+ // starting locator
+ if (isLocator) {
+ CacheHelper::initLocator(1);
+ LOG("Locator1 started");
+ }
}
-}
END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(SERVER, StartS12)
-{
- const char* lhp = NULL;
- if (!isPoolWithEndpoint) lhp = locHostPort;
- if (isLocalServer) {
- CacheHelper::initServer(1, "func_cacheserver1_pool.xml", lhp);
- }
- if (isLocalServer) {
- CacheHelper::initServer(2, "func_cacheserver2_pool.xml", lhp);
+ {
+ const char* lhp = NULL;
+ if (!isPoolWithEndpoint) lhp = locHostPort;
+ if (isLocalServer) {
+ CacheHelper::initServer(1, "func_cacheserver1_pool.xml", lhp);
+ }
+ if (isLocalServer) {
+ CacheHelper::initServer(2, "func_cacheserver2_pool.xml", lhp);
+ }
}
-}
END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, StartC1)
-{
- // initClient(true);
- initClientWithPool(true, NULL, locHostPort, serverGroup, NULLPTR, 0, true,
- -1, -1, 60000, /*singlehop*/ true,
- /*threadLocal*/ true);
- // createPool(poolName, locHostPort,serverGroup, NULL, 0, true );
- // createRegionAndAttachPool(poolRegNames[0],USE_ACK, poolName);
-
- RegionPtr regPtr0 =
- createRegionAndAttachPool(poolRegNames[0], USE_ACK, NULL);
- ; // getHelper()->createRegion( poolRegNames[0], USE_ACK);
- regPtr0->registerAllKeys();
-
- LOG("Clnt1Init complete.");
-}
+ {
+ // initClient(true);
+ initClientWithPool(true, NULL, locHostPort, serverGroup, nullptr, 0, true,
+ -1, -1, 60000, /*singlehop*/ true,
+ /*threadLocal*/ true);
+ // createPool(poolName, locHostPort,serverGroup, NULL, 0, true );
+ // createRegionAndAttachPool(poolRegNames[0],USE_ACK, poolName);
+
+ RegionPtr regPtr0 =
+ createRegionAndAttachPool(poolRegNames[0], USE_ACK, NULL);
+ ; // getHelper()->createRegion( poolRegNames[0], USE_ACK);
+ regPtr0->registerAllKeys();
+
+ LOG("Clnt1Init complete.");
+ }
END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
-{
- RegionPtr regPtr0 = getHelper()->getRegion(poolRegNames[0]);
- char buf[128];
+ {
+ RegionPtr regPtr0 = getHelper()->getRegion(poolRegNames[0]);
+ char buf[128];
- for (int i = 0; i < 34; i++) {
- sprintf(buf, "VALUE--%d", i);
- CacheablePtr value(CacheableString::create(buf));
+ for (int i = 0; i < 34; i++) {
+ sprintf(buf, "VALUE--%d", i);
+ CacheablePtr value(CacheableString::create(buf));
- sprintf(buf, "KEY--%d", i);
- CacheableKeyPtr key = CacheableKey::create(buf);
- regPtr0->put(key, value);
- }
- std::this_thread::sleep_for(std::chrono::seconds(10)); // let the put finish
+ sprintf(buf, "KEY--%d", i);
+ CacheableKeyPtr key = CacheableKey::create(buf);
+ regPtr0->put(key, value);
+ }
+ std::this_thread::sleep_for(
+ std::chrono::seconds(10)); // let the put finish
//-----------------------Test with sendException
// onRegion-------------------------------//
@@ -249,42 +250,30 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
CacheablePtr args = CacheableBoolean::create(1);
ExecutionPtr funcExec = FunctionService::onRegion(regPtr0);
- ASSERT(funcExec != NULLPTR, "onRegion Returned NULL");
+ ASSERT(funcExec != nullptr, "onRegion Returned NULL");
ResultCollectorPtr collector =
funcExec->withArgs(args)->withFilter(filter)->execute(
exFuncNameSendException, 15);
- ASSERT(collector != NULLPTR, "onRegion collector NULL");
+ ASSERT(collector != nullptr, "onRegion collector NULL");
CacheableVectorPtr result = collector->getResult();
- if (result == NULLPTR) {
+ if (result == nullptr) {
ASSERT(false, "echo String : result is NULL");
} else {
- try {
- for (int i = 0; i < result->size(); i++) {
- UserFunctionExecutionExceptionPtr uFEPtr =
- dynCast<UserFunctionExecutionExceptionPtr>(
- result->operator[](i));
- ASSERT(uFEPtr != NULLPTR, "uFEPtr exception is NULL");
+ for (int i = 0; i < result->size(); i++) {
+ if (auto uFEPtr =
+ std::dynamic_pointer_cast<UserFunctionExecutionException>(
+ result->operator[](i))) {
LOGINFO("Done casting to uFEPtr");
LOGINFO("Read expected uFEPtr exception %s ",
uFEPtr->getMessage()->asChar());
+ } else {
+ FAIL(
+ "exFuncNameSendException casting to string for bool argument "
+ "exception.");
}
- } catch (ClassCastException& ex) {
- std::string logmsg = "";
- logmsg += ex.getName();
- logmsg += ": ";
- logmsg += ex.getMessage();
- LOG(logmsg.c_str());
- ex.printStackTrace();
- FAIL(
- "exFuncNameSendException casting to string for bool argument "
- "exception.");
- } catch (...) {
- FAIL(
- "exFuncNameSendException casting to string for bool argument "
- "Unknown exception.");
}
}
@@ -292,60 +281,61 @@ DUNIT_TASK_DEFINITION(CLIENT1, Client1OpTest)
collector = funcExec->withArgs(arrList)->withFilter(filter)->execute(
exFuncNameSendException, 15);
- ASSERT(collector != NULLPTR, "onRegion collector for arrList NULL");
+ ASSERT(collector != nullptr, "onRegion collector for arrList NULL");
std::this_thread::sleep_for(std::chrono::seconds(2));
-
+
try {
- CacheableVectorPtr fil = CacheableVector::create();
- fil->push_back(CacheableInt32::create(1));
- ExecutionPtr exe = FunctionService::onRegion(regPtr0);
-
- LOGINFO("Executing the exception test it is expected to throw.");
- CacheableVectorPtr executeFunctionResult3 =
- funcExec->withArgs(arrList)->withFilter(filter)->execute("ThinClientRegionExceptionTest", 15)->getResult();
- FAIL("Failed to throw expected exception.");
+ CacheableVectorPtr fil = CacheableVector::create();
+ fil->push_back(CacheableInt32::create(1));
+ ExecutionPtr exe = FunctionService::onRegion(regPtr0);
+
+ LOGINFO("Executing the exception test it is expected to throw.");
+ CacheableVectorPtr executeFunctionResult3 =
+ funcExec->withArgs(arrList)
+ ->withFilter(filter)
+ ->execute("ThinClientRegionExceptionTest", 15)
+ ->getResult();
+ FAIL("Failed to throw expected exception.");
} catch (...) {
- LOGINFO("Finished Executing the exception test Successfully");
-
+ LOGINFO("Finished Executing the exception test Successfully");
}
-
-}
+ }
END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, StopC1)
-{
- cleanProc();
- LOG("Clnt1Down complete: Keepalive = True");
-}
+ {
+ cleanProc();
+ LOG("Clnt1Down complete: Keepalive = True");
+ }
END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(SERVER, CloseServers)
-{
- // stop servers
- if (isLocalServer) {
- CacheHelper::closeServer(1);
- LOG("SERVER1 stopped");
- }
- if (isLocalServer) {
- CacheHelper::closeServer(2);
- LOG("SERVER2 stopped");
- }
- if (isLocalServer) {
- CacheHelper::closeServer(3);
- LOG("SERVER3 stopped");
+ {
+ // stop servers
+ if (isLocalServer) {
+ CacheHelper::closeServer(1);
+ LOG("SERVER1 stopped");
+ }
+ if (isLocalServer) {
+ CacheHelper::closeServer(2);
+ LOG("SERVER2 stopped");
+ }
+ if (isLocalServer) {
+ CacheHelper::closeServer(3);
+ LOG("SERVER3 stopped");
+ }
+ isPoolWithEndpoint = true;
}
- isPoolWithEndpoint = true;
-}
END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(LOCATOR1, CloseLocator1)
-{
- // stop locator
- if (isLocator) {
- CacheHelper::closeLocator(1);
- LOG("Locator1 stopped");
+ {
+ // stop locator
+ if (isLocator) {
+ CacheHelper::closeLocator(1);
+ LOG("Locator1 stopped");
+ }
}
-}
END_TASK_DEFINITION
void runFunctionExecution() {
@@ -359,5 +349,5 @@ void runFunctionExecution() {
}
DUNIT_MAIN
-{ runFunctionExecution(); }
+ { runFunctionExecution(); }
END_MAIN
[07/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from cppcache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/PdxInstanceImpl.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxInstanceImpl.cpp b/src/cppcache/src/PdxInstanceImpl.cpp
index b8ac1a0..075b366 100644
--- a/src/cppcache/src/PdxInstanceImpl.cpp
+++ b/src/cppcache/src/PdxInstanceImpl.cpp
@@ -38,7 +38,7 @@
*/
#define VERIFY_PDX_INSTANCE_FIELD_THROW \
- if (pft == NULLPTR) { \
+ if (pft == nullptr) { \
char excpStr[256] = {0}; \
ACE_OS::snprintf(excpStr, 256, "PdxInstance doesn't has field %s ", \
fieldname); \
@@ -91,12 +91,13 @@ PdxInstanceImpl::PdxInstanceImpl(
// apache::geode::client::DataOutput* output =
// apache::geode::client::DataOutput::getDataOutput();
- DataOutput output;
- PdxHelper::serializePdx(output, *this);
+ // TODO shared_ptr - what is the purpose of this?
+// DataOutput output;
+// PdxHelper::serializePdx(output, *this);
}
PdxInstanceImpl::PdxInstanceImpl() {
- m_pdxType = NULLPTR;
+ m_pdxType = nullptr;
m_buffer = NULL;
m_bufferLength = 0;
m_typeId = 0;
@@ -106,14 +107,14 @@ void PdxInstanceImpl::writeField(PdxWriterPtr writer, const char* fieldName,
int typeId, CacheablePtr value) {
switch (typeId) {
case PdxFieldTypes::INT: {
- CacheableInt32* val = dynamic_cast<CacheableInt32*>(value.ptr());
+ CacheableInt32* val = dynamic_cast<CacheableInt32*>(value.get());
if (val != NULL) {
writer->writeInt(fieldName, val->value());
}
break;
}
case PdxFieldTypes::STRING: {
- CacheableString* val = dynamic_cast<CacheableString*>(value.ptr());
+ CacheableString* val = dynamic_cast<CacheableString*>(value.get());
if (val != NULL) {
if (val->isWideString()) {
writer->writeWideString(fieldName, val->asWChar());
@@ -124,56 +125,56 @@ void PdxInstanceImpl::writeField(PdxWriterPtr writer, const char* fieldName,
break;
}
case PdxFieldTypes::BOOLEAN: {
- CacheableBoolean* val = dynamic_cast<CacheableBoolean*>(value.ptr());
+ CacheableBoolean* val = dynamic_cast<CacheableBoolean*>(value.get());
if (val != NULL) {
writer->writeBoolean(fieldName, val->value());
}
break;
}
case PdxFieldTypes::FLOAT: {
- CacheableFloat* val = dynamic_cast<CacheableFloat*>(value.ptr());
+ CacheableFloat* val = dynamic_cast<CacheableFloat*>(value.get());
if (val != NULL) {
writer->writeFloat(fieldName, val->value());
}
break;
}
case PdxFieldTypes::DOUBLE: {
- CacheableDouble* val = dynamic_cast<CacheableDouble*>(value.ptr());
+ CacheableDouble* val = dynamic_cast<CacheableDouble*>(value.get());
if (val != NULL) {
writer->writeDouble(fieldName, val->value());
}
break;
}
case PdxFieldTypes::CHAR: {
- CacheableWideChar* val = dynamic_cast<CacheableWideChar*>(value.ptr());
+ CacheableWideChar* val = dynamic_cast<CacheableWideChar*>(value.get());
if (val != NULL) {
writer->writeChar(fieldName, static_cast<char>(val->value()));
}
break;
}
case PdxFieldTypes::BYTE: {
- CacheableByte* val = dynamic_cast<CacheableByte*>(value.ptr());
+ CacheableByte* val = dynamic_cast<CacheableByte*>(value.get());
if (val != NULL) {
writer->writeByte(fieldName, val->value());
}
break;
}
case PdxFieldTypes::SHORT: {
- CacheableInt16* val = dynamic_cast<CacheableInt16*>(value.ptr());
+ CacheableInt16* val = dynamic_cast<CacheableInt16*>(value.get());
if (val != NULL) {
writer->writeShort(fieldName, val->value());
}
break;
}
case PdxFieldTypes::LONG: {
- CacheableInt64* val = dynamic_cast<CacheableInt64*>(value.ptr());
+ CacheableInt64* val = dynamic_cast<CacheableInt64*>(value.get());
if (val != NULL) {
writer->writeLong(fieldName, val->value());
}
break;
}
case PdxFieldTypes::BYTE_ARRAY: {
- CacheableBytes* val = dynamic_cast<CacheableBytes*>(value.ptr());
+ CacheableBytes* val = dynamic_cast<CacheableBytes*>(value.get());
if (val != NULL) {
writer->writeByteArray(fieldName, (int8_t*)val->value(), val->length());
}
@@ -181,7 +182,7 @@ void PdxInstanceImpl::writeField(PdxWriterPtr writer, const char* fieldName,
}
case PdxFieldTypes::DOUBLE_ARRAY: {
CacheableDoubleArray* val =
- dynamic_cast<CacheableDoubleArray*>(value.ptr());
+ dynamic_cast<CacheableDoubleArray*>(value.get());
if (val != NULL) {
writer->writeDoubleArray(fieldName, const_cast<double*>(val->value()),
val->length());
@@ -190,7 +191,7 @@ void PdxInstanceImpl::writeField(PdxWriterPtr writer, const char* fieldName,
}
case PdxFieldTypes::FLOAT_ARRAY: {
CacheableFloatArray* val =
- dynamic_cast<CacheableFloatArray*>(value.ptr());
+ dynamic_cast<CacheableFloatArray*>(value.get());
if (val != NULL) {
writer->writeFloatArray(fieldName, const_cast<float*>(val->value()),
val->length());
@@ -199,7 +200,7 @@ void PdxInstanceImpl::writeField(PdxWriterPtr writer, const char* fieldName,
}
case PdxFieldTypes::SHORT_ARRAY: {
CacheableInt16Array* val =
- dynamic_cast<CacheableInt16Array*>(value.ptr());
+ dynamic_cast<CacheableInt16Array*>(value.get());
if (val != NULL) {
writer->writeShortArray(fieldName, const_cast<int16_t*>(val->value()),
val->length());
@@ -208,7 +209,7 @@ void PdxInstanceImpl::writeField(PdxWriterPtr writer, const char* fieldName,
}
case PdxFieldTypes::INT_ARRAY: {
CacheableInt32Array* val =
- dynamic_cast<CacheableInt32Array*>(value.ptr());
+ dynamic_cast<CacheableInt32Array*>(value.get());
if (val != NULL) {
writer->writeIntArray(fieldName, const_cast<int32_t*>(val->value()),
val->length());
@@ -217,7 +218,7 @@ void PdxInstanceImpl::writeField(PdxWriterPtr writer, const char* fieldName,
}
case PdxFieldTypes::LONG_ARRAY: {
CacheableInt64Array* val =
- dynamic_cast<CacheableInt64Array*>(value.ptr());
+ dynamic_cast<CacheableInt64Array*>(value.get());
if (val != NULL) {
writer->writeLongArray(fieldName, const_cast<int64_t*>(val->value()),
val->length());
@@ -225,7 +226,7 @@ void PdxInstanceImpl::writeField(PdxWriterPtr writer, const char* fieldName,
break;
}
case PdxFieldTypes::BOOLEAN_ARRAY: {
- BooleanArray* val = dynamic_cast<BooleanArray*>(value.ptr());
+ BooleanArray* val = dynamic_cast<BooleanArray*>(value.get());
if (val != NULL) {
writer->writeBooleanArray(fieldName, const_cast<bool*>(val->value()),
val->length());
@@ -233,7 +234,7 @@ void PdxInstanceImpl::writeField(PdxWriterPtr writer, const char* fieldName,
break;
}
case PdxFieldTypes::CHAR_ARRAY: {
- CharArray* val = dynamic_cast<CharArray*>(value.ptr());
+ CharArray* val = dynamic_cast<CharArray*>(value.get());
if (val != NULL) {
writer->writeWideCharArray(
fieldName, const_cast<wchar_t*>(val->value()), val->length());
@@ -242,7 +243,7 @@ void PdxInstanceImpl::writeField(PdxWriterPtr writer, const char* fieldName,
}
case PdxFieldTypes::STRING_ARRAY: {
CacheableStringArray* val =
- dynamic_cast<CacheableStringArray*>(value.ptr());
+ dynamic_cast<CacheableStringArray*>(value.get());
if (val != NULL) {
int size = val->length();
if (val->operator[](0)->isCString()) {
@@ -265,14 +266,15 @@ void PdxInstanceImpl::writeField(PdxWriterPtr writer, const char* fieldName,
break;
}
case PdxFieldTypes::DATE: {
- CacheableDatePtr date = dynCast<CacheableDatePtr>(value);
- if (date != NULLPTR) {
+ CacheableDatePtr date = std::dynamic_pointer_cast<CacheableDate>(value);
+ if (date != nullptr) {
writer->writeDate(fieldName, date);
}
break;
}
case PdxFieldTypes::ARRAY_OF_BYTE_ARRAYS: {
- CacheableVector* vector = dynamic_cast<CacheableVector*>(value.ptr());
+ CacheableVectorPtr vector =
+ std::dynamic_pointer_cast<CacheableVector>(value);
if (vector != NULL) {
int size = vector->size();
@@ -280,7 +282,7 @@ void PdxInstanceImpl::writeField(PdxWriterPtr writer, const char* fieldName,
int* lengths = new int[size];
for (int i = 0; i < size; i++) {
CacheableBytes* val =
- dynamic_cast<CacheableBytes*>(vector->at(i).ptr());
+ dynamic_cast<CacheableBytes*>(vector->at(i).get());
if (val != NULL) {
values[i] = (int8_t*)val->value();
lengths[i] = val->length();
@@ -294,8 +296,8 @@ void PdxInstanceImpl::writeField(PdxWriterPtr writer, const char* fieldName,
}
case PdxFieldTypes::OBJECT_ARRAY: {
CacheableObjectArrayPtr objArray =
- dynCast<CacheableObjectArrayPtr>(value);
- if (objArray != NULLPTR) {
+ std::dynamic_pointer_cast<CacheableObjectArray>(value);
+ if (objArray != nullptr) {
writer->writeObjectArray(fieldName, objArray);
}
break;
@@ -307,19 +309,18 @@ void PdxInstanceImpl::writeField(PdxWriterPtr writer, const char* fieldName,
WritablePdxInstancePtr PdxInstanceImpl::createWriter() {
LOGDEBUG("PdxInstanceImpl::createWriter m_bufferLength = %d m_typeId = %d ",
m_bufferLength, m_typeId);
- WritablePdxInstancePtr wlr(
- new PdxInstanceImpl(m_buffer, m_bufferLength,
- m_typeId)); // need to create duplicate byte stream);
- return wlr;
+ return std::make_shared<PdxInstanceImpl>(
+ m_buffer, m_bufferLength,
+ m_typeId); // need to create duplicate byte stream);
}
bool PdxInstanceImpl::enumerateObjectArrayEquals(
CacheableObjectArrayPtr Obj, CacheableObjectArrayPtr OtherObj) {
- if (Obj == NULLPTR && OtherObj == NULLPTR) {
+ if (Obj == nullptr && OtherObj == nullptr) {
return true;
- } else if (Obj == NULLPTR && OtherObj != NULLPTR) {
+ } else if (Obj == nullptr && OtherObj != nullptr) {
return false;
- } else if (Obj != NULLPTR && OtherObj == NULLPTR) {
+ } else if (Obj != nullptr && OtherObj == nullptr) {
return false;
}
@@ -337,11 +338,11 @@ bool PdxInstanceImpl::enumerateObjectArrayEquals(
bool PdxInstanceImpl::enumerateVectorEquals(CacheableVectorPtr Obj,
CacheableVectorPtr OtherObj) {
- if (Obj == NULLPTR && OtherObj == NULLPTR) {
+ if (Obj == nullptr && OtherObj == nullptr) {
return true;
- } else if (Obj == NULLPTR && OtherObj != NULLPTR) {
+ } else if (Obj == nullptr && OtherObj != nullptr) {
return false;
- } else if (Obj != NULLPTR && OtherObj == NULLPTR) {
+ } else if (Obj != nullptr && OtherObj == nullptr) {
return false;
}
@@ -359,11 +360,11 @@ bool PdxInstanceImpl::enumerateVectorEquals(CacheableVectorPtr Obj,
bool PdxInstanceImpl::enumerateArrayListEquals(CacheableArrayListPtr Obj,
CacheableArrayListPtr OtherObj) {
- if (Obj == NULLPTR && OtherObj == NULLPTR) {
+ if (Obj == nullptr && OtherObj == nullptr) {
return true;
- } else if (Obj == NULLPTR && OtherObj != NULLPTR) {
+ } else if (Obj == nullptr && OtherObj != nullptr) {
return false;
- } else if (Obj != NULLPTR && OtherObj == NULLPTR) {
+ } else if (Obj != nullptr && OtherObj == nullptr) {
return false;
}
@@ -381,11 +382,11 @@ bool PdxInstanceImpl::enumerateArrayListEquals(CacheableArrayListPtr Obj,
bool PdxInstanceImpl::enumerateMapEquals(CacheableHashMapPtr Obj,
CacheableHashMapPtr OtherObj) {
- if (Obj == NULLPTR && OtherObj == NULLPTR) {
+ if (Obj == nullptr && OtherObj == nullptr) {
return true;
- } else if (Obj == NULLPTR && OtherObj != NULLPTR) {
+ } else if (Obj == nullptr && OtherObj != nullptr) {
return false;
- } else if (Obj != NULLPTR && OtherObj == NULLPTR) {
+ } else if (Obj != nullptr && OtherObj == nullptr) {
return false;
}
@@ -411,11 +412,11 @@ bool PdxInstanceImpl::enumerateMapEquals(CacheableHashMapPtr Obj,
bool PdxInstanceImpl::enumerateHashTableEquals(CacheableHashTablePtr Obj,
CacheableHashTablePtr OtherObj) {
- if (Obj == NULLPTR && OtherObj == NULLPTR) {
+ if (Obj == nullptr && OtherObj == nullptr) {
return true;
- } else if (Obj == NULLPTR && OtherObj != NULLPTR) {
+ } else if (Obj == nullptr && OtherObj != nullptr) {
return false;
- } else if (Obj != NULLPTR && OtherObj == NULLPTR) {
+ } else if (Obj != nullptr && OtherObj == nullptr) {
return false;
}
@@ -441,11 +442,11 @@ bool PdxInstanceImpl::enumerateHashTableEquals(CacheableHashTablePtr Obj,
bool PdxInstanceImpl::enumerateSetEquals(CacheableHashSetPtr Obj,
CacheableHashSetPtr OtherObj) {
- if (Obj == NULLPTR && OtherObj == NULLPTR) {
+ if (Obj == nullptr && OtherObj == nullptr) {
return true;
- } else if (Obj == NULLPTR && OtherObj != NULLPTR) {
+ } else if (Obj == nullptr && OtherObj != nullptr) {
return false;
- } else if (Obj != NULLPTR && OtherObj == NULLPTR) {
+ } else if (Obj != nullptr && OtherObj == nullptr) {
return false;
}
@@ -463,11 +464,11 @@ bool PdxInstanceImpl::enumerateSetEquals(CacheableHashSetPtr Obj,
bool PdxInstanceImpl::enumerateLinkedSetEquals(
CacheableLinkedHashSetPtr Obj, CacheableLinkedHashSetPtr OtherObj) {
- if (Obj == NULLPTR && OtherObj == NULLPTR) {
+ if (Obj == nullptr && OtherObj == nullptr) {
return true;
- } else if (Obj == NULLPTR && OtherObj != NULLPTR) {
+ } else if (Obj == nullptr && OtherObj != nullptr) {
return false;
- } else if (Obj != NULLPTR && OtherObj == NULLPTR) {
+ } else if (Obj != nullptr && OtherObj == nullptr) {
return false;
}
@@ -484,80 +485,67 @@ bool PdxInstanceImpl::enumerateLinkedSetEquals(
}
bool PdxInstanceImpl::deepArrayEquals(CacheablePtr obj, CacheablePtr otherObj) {
- if (obj == NULLPTR && otherObj == NULLPTR) {
+ if (obj == nullptr && otherObj == nullptr) {
return true;
- } else if (obj == NULLPTR && otherObj != NULLPTR) {
+ } else if (obj == nullptr && otherObj != nullptr) {
return false;
- } else if (obj != NULLPTR && otherObj == NULLPTR) {
+ } else if (obj != nullptr && otherObj == nullptr) {
return false;
}
int8_t typeId = obj->typeId();
switch (typeId) {
case GeodeTypeIds::CacheableObjectArray: {
- CacheableObjectArrayPtr objArrayPtr =
- dynCast<CacheableObjectArrayPtr>(obj);
- CacheableObjectArrayPtr otherObjArrayPtr =
- dynCast<CacheableObjectArrayPtr>(otherObj);
+ auto objArrayPtr = std::dynamic_pointer_cast<CacheableObjectArray>(obj);
+ auto otherObjArrayPtr =
+ std::dynamic_pointer_cast<CacheableObjectArray>(otherObj);
return enumerateObjectArrayEquals(objArrayPtr, otherObjArrayPtr);
}
case GeodeTypeIds::CacheableVector: {
- CacheableVectorPtr vec = dynCast<CacheableVectorPtr>(obj);
- CacheableVectorPtr otherVec = dynCast<CacheableVectorPtr>(otherObj);
+ auto vec = std::dynamic_pointer_cast<CacheableVector>(obj);
+ auto otherVec = std::dynamic_pointer_cast<CacheableVector>(otherObj);
return enumerateVectorEquals(vec, otherVec);
}
case GeodeTypeIds::CacheableArrayList: {
- CacheableArrayListPtr arrList = dynCast<CacheableArrayListPtr>(obj);
- CacheableArrayListPtr otherArrList =
- dynCast<CacheableArrayListPtr>(otherObj);
+ auto arrList = std::dynamic_pointer_cast<CacheableArrayList>(obj);
+ auto otherArrList =
+ std::dynamic_pointer_cast<CacheableArrayList>(otherObj);
return enumerateArrayListEquals(arrList, otherArrList);
}
case GeodeTypeIds::CacheableHashMap: {
- CacheableHashMapPtr map = dynCast<CacheableHashMapPtr>(obj);
- CacheableHashMapPtr otherMap = dynCast<CacheableHashMapPtr>(otherObj);
+ auto map = std::dynamic_pointer_cast<CacheableHashMap>(obj);
+ auto otherMap = std::dynamic_pointer_cast<CacheableHashMap>(otherObj);
return enumerateMapEquals(map, otherMap);
}
case GeodeTypeIds::CacheableHashSet: {
- CacheableHashSetPtr hashset = dynCast<CacheableHashSetPtr>(obj);
- CacheableHashSetPtr otherHashset = dynCast<CacheableHashSetPtr>(otherObj);
+ auto hashset = std::dynamic_pointer_cast<CacheableHashSet>(obj);
+ auto otherHashset = std::dynamic_pointer_cast<CacheableHashSet>(otherObj);
return enumerateSetEquals(hashset, otherHashset);
}
case GeodeTypeIds::CacheableLinkedHashSet: {
- CacheableLinkedHashSetPtr linkedHashset =
- dynCast<CacheableLinkedHashSetPtr>(obj);
- CacheableLinkedHashSetPtr otherLinkedHashset =
- dynCast<CacheableLinkedHashSetPtr>(otherObj);
+ auto linkedHashset =
+ std::dynamic_pointer_cast<CacheableLinkedHashSet>(obj);
+ auto otherLinkedHashset =
+ std::dynamic_pointer_cast<CacheableLinkedHashSet>(otherObj);
return enumerateLinkedSetEquals(linkedHashset, otherLinkedHashset);
}
case GeodeTypeIds::CacheableHashTable: {
- CacheableHashTablePtr hashTable = dynCast<CacheableHashTablePtr>(obj);
- CacheableHashTablePtr otherhashTable =
- dynCast<CacheableHashTablePtr>(otherObj);
+ auto hashTable = std::dynamic_pointer_cast<CacheableHashTable>(obj);
+ auto otherhashTable =
+ std::dynamic_pointer_cast<CacheableHashTable>(otherObj);
return enumerateHashTableEquals(hashTable, otherhashTable);
}
default: {
- PdxInstancePtr pdxInstPtr = NULLPTR;
- PdxInstancePtr otherPdxInstPtr = NULLPTR;
- try {
- pdxInstPtr = dynCast<PdxInstancePtr>(obj);
- otherPdxInstPtr = dynCast<PdxInstancePtr>(otherObj);
- } catch (ClassCastException& /*ex*/) {
- // ignore
- }
- if (pdxInstPtr != NULLPTR && otherPdxInstPtr != NULLPTR) {
- return (*pdxInstPtr.ptr() == *otherPdxInstPtr.ptr());
+ auto pdxInstPtr = std::dynamic_pointer_cast<PdxInstance>(obj);
+ auto otherPdxInstPtr = std::dynamic_pointer_cast<PdxInstance>(otherObj);
+ if (pdxInstPtr != nullptr && otherPdxInstPtr != nullptr) {
+ return (*pdxInstPtr.get() == *otherPdxInstPtr.get());
}
// Chk if it is of CacheableKeyPtr type, eg: CacheableInt32
else {
- CacheableKey* keyType = NULL;
- CacheableKey* otherKeyType = NULL;
- try {
- keyType = dynamic_cast<CacheableKey*>(obj.ptr());
- otherKeyType = dynamic_cast<CacheableKey*>(otherObj.ptr());
- } catch (ClassCastException&) {
- // ignore
- }
- if (keyType != NULL && otherKeyType != NULL) {
+ auto keyType = std::dynamic_pointer_cast<CacheableKey>(obj);
+ auto otherKeyType = std::dynamic_pointer_cast<CacheableKey>(otherObj);
+ if (keyType != nullptr && otherKeyType != nullptr) {
return keyType->operator==(*otherKeyType);
}
}
@@ -587,7 +575,7 @@ int PdxInstanceImpl::enumerateMapHashCode(CacheableHashMapPtr map) {
for (CacheableHashMap::Iterator itr = map->begin(); itr != map->end();
itr++) {
h = h + ((deepArrayHashCode(itr.first())) ^
- ((itr.second() != NULLPTR) ? deepArrayHashCode(itr.second()) : 0));
+ ((itr.second() != nullptr) ? deepArrayHashCode(itr.second()) : 0));
}
return h;
}
@@ -615,7 +603,7 @@ int PdxInstanceImpl::enumerateHashTableCode(CacheableHashTablePtr hashTable) {
for (CacheableHashTable::Iterator itr = hashTable->begin();
itr != hashTable->end(); itr++) {
h = h + ((deepArrayHashCode(itr.first())) ^
- ((itr.second() != NULLPTR) ? deepArrayHashCode(itr.second()) : 0));
+ ((itr.second() != nullptr) ? deepArrayHashCode(itr.second()) : 0));
}
return h;
}
@@ -655,65 +643,54 @@ int PdxInstanceImpl::enumerateLinkedListHashCode(
}
int PdxInstanceImpl::deepArrayHashCode(CacheablePtr obj) {
- if (obj == NULLPTR) {
+ if (obj == nullptr) {
return 0;
}
int8_t typeId = obj->typeId();
switch (typeId) {
case GeodeTypeIds::CacheableObjectArray: {
- CacheableObjectArrayPtr objArrayPtr =
- dynCast<CacheableObjectArrayPtr>(obj);
- return enumerateObjectArrayHashCode(objArrayPtr);
+ return enumerateObjectArrayHashCode(
+ std::dynamic_pointer_cast<CacheableObjectArray>(obj));
}
case GeodeTypeIds::CacheableVector: {
- CacheableVectorPtr vec = dynCast<CacheableVectorPtr>(obj);
- return enumerateVectorHashCode(vec);
+ return enumerateVectorHashCode(
+ std::dynamic_pointer_cast<CacheableVector>(obj));
}
case GeodeTypeIds::CacheableArrayList: {
- CacheableArrayListPtr arrList = dynCast<CacheableArrayListPtr>(obj);
- return enumerateArrayListHashCode(arrList);
+ return enumerateArrayListHashCode(
+ std::dynamic_pointer_cast<CacheableArrayList>(obj));
}
case GeodeTypeIds::CacheableLinkedList: {
- CacheableLinkedListPtr linkedList = dynCast<CacheableLinkedListPtr>(obj);
- return enumerateLinkedListHashCode(linkedList);
+ return enumerateLinkedListHashCode(
+ std::dynamic_pointer_cast<CacheableLinkedList>(obj));
}
case GeodeTypeIds::CacheableHashMap: {
- CacheableHashMapPtr map = dynCast<CacheableHashMapPtr>(obj);
- return enumerateMapHashCode(map);
+ return enumerateMapHashCode(
+ std::dynamic_pointer_cast<CacheableHashMap>(obj));
}
case GeodeTypeIds::CacheableHashSet: {
- CacheableHashSetPtr hashset = dynCast<CacheableHashSetPtr>(obj);
- return enumerateSetHashCode(hashset);
+ return enumerateSetHashCode(
+ std::dynamic_pointer_cast<CacheableHashSet>(obj));
}
case GeodeTypeIds::CacheableLinkedHashSet: {
CacheableLinkedHashSetPtr linkedHashSet =
- dynCast<CacheableLinkedHashSetPtr>(obj);
+ std::dynamic_pointer_cast<CacheableLinkedHashSet>(obj);
return enumerateLinkedSetHashCode(linkedHashSet);
}
case GeodeTypeIds::CacheableHashTable: {
- CacheableHashTablePtr hashTable = dynCast<CacheableHashTablePtr>(obj);
- return enumerateHashTableCode(hashTable);
+ return enumerateHashTableCode(
+ std::dynamic_pointer_cast<CacheableHashTable>(obj));
}
default: {
- PdxInstancePtr pdxInstPtr = NULLPTR;
- try {
- pdxInstPtr = dynCast<PdxInstancePtr>(obj);
- } catch (ClassCastException& /*ex*/) {
- // ignore
- }
- if (pdxInstPtr != NULLPTR) {
+ auto pdxInstPtr = std::dynamic_pointer_cast<PdxInstance>(obj);
+ if (pdxInstPtr != nullptr) {
return pdxInstPtr->hashcode();
}
- // Chk if it is of CacheableKeyPtr type, eg: CacheableInt32
else {
- CacheableKeyPtr keyType = NULLPTR;
- try {
- keyType = dynCast<CacheableKeyPtr>(obj);
- } catch (ClassCastException&) {
- // ignore
- }
- if (keyType != NULLPTR) {
+ // Chk if it is of CacheableKeyPtr type, eg: CacheableInt32
+ auto keyType = std::dynamic_pointer_cast<CacheableKey>(obj);
+ if (keyType != nullptr) {
return keyType->hashcode();
}
}
@@ -780,9 +757,9 @@ int32_t PdxInstanceImpl::hashcode() const {
}
case PdxFieldTypes::OBJECT: {
setOffsetForObject(dataInput, pt, pField->getSequenceId());
- CacheablePtr object = NULLPTR;
+ CacheablePtr object = nullptr;
dataInput.readObject(object);
- if (object != NULLPTR) {
+ if (object != nullptr) {
hashCode = 31 * hashCode + deepArrayHashCode(object);
}
break;
@@ -793,7 +770,7 @@ int32_t PdxInstanceImpl::hashcode() const {
objectArray->fromData(dataInput);
hashCode =
31 * hashCode +
- ((objectArray != NULLPTR) ? deepArrayHashCode(objectArray) : 0);
+ ((objectArray != nullptr) ? deepArrayHashCode(objectArray) : 0);
break;
}
default: {
@@ -824,7 +801,7 @@ void PdxInstanceImpl::updatePdxStream(uint8_t* newPdxStream, int len) {
PdxTypePtr PdxInstanceImpl::getPdxType() const {
if (m_typeId == 0) {
- if (m_pdxType == NULLPTR) {
+ if (m_pdxType == nullptr) {
throw IllegalStateException("PdxType should not be null..");
}
return m_pdxType;
@@ -836,7 +813,7 @@ PdxTypePtr PdxInstanceImpl::getPdxType() const {
bool PdxInstanceImpl::isIdentityField(const char* fieldname) {
PdxTypePtr pt = getPdxType();
PdxFieldTypePtr pft = pt->getPdxField(fieldname);
- if (pft != NULLPTR) {
+ if (pft != nullptr) {
return pft->getIdentityField();
}
return false;
@@ -845,7 +822,7 @@ bool PdxInstanceImpl::isIdentityField(const char* fieldname) {
bool PdxInstanceImpl::hasField(const char* fieldname) {
PdxTypePtr pf = getPdxType();
PdxFieldTypePtr pft = pf->getPdxField(fieldname);
- return (pft != NULLPTR);
+ return (pft != nullptr);
}
void PdxInstanceImpl::getField(const char* fieldname, bool& value) const {
@@ -1400,9 +1377,9 @@ CacheableStringPtr PdxInstanceImpl::toString() const {
break;
}
case PdxFieldTypes::DATE: {
- CacheableDatePtr value = NULLPTR;
+ CacheableDatePtr value = nullptr;
getField(identityFields.at(i)->getFieldName(), value);
- if (value != NULLPTR) {
+ if (value != nullptr) {
ACE_OS::snprintf(buf, 2048, "%s", value->toString()->asChar());
toString += buf;
}
@@ -1440,7 +1417,7 @@ CacheableStringPtr PdxInstanceImpl::toString() const {
case PdxFieldTypes::OBJECT_ARRAY: {
CacheableObjectArrayPtr value;
getField(identityFields.at(i)->getFieldName(), value);
- if (value != NULLPTR) {
+ if (value != nullptr) {
ACE_OS::snprintf(buf, 2048, "%s\t", value->toString()->asChar());
toString += buf;
}
@@ -1449,7 +1426,7 @@ CacheableStringPtr PdxInstanceImpl::toString() const {
default: {
CacheablePtr value;
getField(identityFields.at(i)->getFieldName(), value);
- if (value != NULLPTR) {
+ if (value != nullptr) {
ACE_OS::snprintf(buf, 2048, "%s\t", value->toString()->asChar());
toString += buf;
}
@@ -1468,14 +1445,14 @@ PdxSerializablePtr PdxInstanceImpl::getObject() {
PdxSerializablePtr ret =
PdxHelper::deserializePdx(dataInput, true, m_typeId, m_bufferLength);
CachePtr cache = CacheFactory::getAnyInstance();
- if (cache == NULLPTR) {
+ if (cache == nullptr) {
throw IllegalStateException("cache has not been created yet.");
;
}
if (cache->isClosed()) {
throw IllegalStateException("cache has been closed. ");
}
- CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cache.ptr());
+ CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cache.get());
if (cacheImpl != NULL) {
Utils::updateStatOpTime(
cacheImpl->m_cacheStats->getStat(),
@@ -1593,8 +1570,8 @@ bool PdxInstanceImpl::operator==(const CacheableKey& other) const {
break;
}
case PdxFieldTypes::OBJECT: {
- CacheablePtr object = NULLPTR;
- CacheablePtr otherObject = NULLPTR;
+ CacheablePtr object = nullptr;
+ CacheablePtr otherObject = nullptr;
if (!myPFT->equals(m_DefaultPdxFieldType)) {
setOffsetForObject(myDataInput, myPdxType, myPFT->getSequenceId());
myDataInput.readObject(object);
@@ -1606,11 +1583,11 @@ bool PdxInstanceImpl::operator==(const CacheableKey& other) const {
otherDataInput.readObject(otherObject);
}
- if (object != NULLPTR) {
+ if (object != nullptr) {
if (!deepArrayEquals(object, otherObject)) {
return false;
}
- } else if (otherObject != NULLPTR) {
+ } else if (otherObject != nullptr) {
return false;
}
break;
@@ -1723,7 +1700,7 @@ CacheableStringArrayPtr PdxInstanceImpl::getFieldNames() {
if (size > 0) {
return CacheableStringArray::createNoCopy(ptrArr, size);
}
- return NULLPTR;
+ return nullptr;
}
PdxFieldTypes::PdxFieldType PdxInstanceImpl::getFieldType(
@@ -1760,28 +1737,28 @@ void PdxInstanceImpl::toData(PdxWriterPtr writer) /*const*/ {
PdxFieldTypePtr currPf = pdxFieldList->at(i);
LOGDEBUG("toData filedname = %s , isVarLengthType = %d ",
currPf->getFieldName(), currPf->IsVariableLengthType());
- CacheablePtr value = NULLPTR;
+ CacheablePtr value = nullptr;
FieldVsValues::iterator iter =
m_updatedFields.find(currPf->getFieldName());
if (iter != m_updatedFields.end()) {
value = ((*iter).second);
} else {
- value = NULLPTR;
+ value = nullptr;
}
- if (value != NULLPTR) {
+ if (value != nullptr) {
writeField(writer, currPf->getFieldName(), currPf->getTypeId(), value);
position = getNextFieldPosition(dataInput, static_cast<int>(i) + 1, pt);
} else {
if (currPf->IsVariableLengthType()) {
// need to add offset
- (static_cast<PdxLocalWriterPtr>(writer))->addOffset();
+ (std::static_pointer_cast<PdxLocalWriter>(writer))->addOffset();
}
// write raw byte array...
nextFieldPosition =
getNextFieldPosition(dataInput, static_cast<int>(i) + 1, pt);
writeUnmodifieldField(dataInput, position, nextFieldPosition,
- static_cast<PdxLocalWriterPtr>(writer));
+ std::static_pointer_cast<PdxLocalWriter>(writer));
position = nextFieldPosition; // mark next field;
}
}
@@ -1806,7 +1783,7 @@ void PdxInstanceImpl::fromData(PdxReaderPtr input) {
const char* PdxInstanceImpl::getClassName() const {
if (m_typeId != 0) {
PdxTypePtr pdxtype = PdxTypeRegistry::getPdxType(m_typeId);
- if (pdxtype == NULLPTR) {
+ if (pdxtype == nullptr) {
char excpStr[256] = {0};
ACE_OS::snprintf(excpStr, 256,
"PdxType is not defined for PdxInstance: %d ", m_typeId);
@@ -1821,7 +1798,7 @@ const char* PdxInstanceImpl::getClassName() const {
void PdxInstanceImpl::setPdxId(int32_t typeId) {
if (m_typeId == 0) {
m_typeId = typeId;
- m_pdxType = NULLPTR;
+ m_pdxType = nullptr;
} else {
throw IllegalStateException("PdxInstance's typeId is already set.");
}
@@ -2029,7 +2006,7 @@ void PdxInstanceImpl::setField(const char* fieldName, bool value) {
PdxTypePtr pt = getPdxType();
PdxFieldTypePtr pft = pt->getPdxField(fieldName);
- if (pft != NULLPTR && pft->getTypeId() != PdxFieldTypes::BOOLEAN) {
+ if (pft != nullptr && pft->getTypeId() != PdxFieldTypes::BOOLEAN) {
char excpStr[256] = {0};
/* adongre - Coverity II
* CID 29233: Calling risky function (SECURE_CODING)[VERY RISKY]. Using
@@ -2044,7 +2021,7 @@ void PdxInstanceImpl::setField(const char* fieldName, bool value) {
ACE_OS::snprintf(
excpStr, 256,
"PdxInstance doesn't has field %s or type of field not matched %s ",
- fieldName, (pft != NULLPTR ? pft->toString()->asChar() : ""));
+ fieldName, (pft != nullptr ? pft->toString()->asChar() : ""));
throw IllegalStateException(excpStr);
}
CacheablePtr cacheableObject = CacheableBoolean::create(value);
@@ -2055,7 +2032,7 @@ void PdxInstanceImpl::setField(const char* fieldName, signed char value) {
PdxTypePtr pt = getPdxType();
PdxFieldTypePtr pft = pt->getPdxField(fieldName);
- if (pft != NULLPTR && pft->getTypeId() != PdxFieldTypes::BYTE) {
+ if (pft != nullptr && pft->getTypeId() != PdxFieldTypes::BYTE) {
char excpStr[256] = {0};
/* adongre - Coverity II
* CID 29233: Calling risky function (SECURE_CODING)[VERY RISKY]. Using
@@ -2070,7 +2047,7 @@ void PdxInstanceImpl::setField(const char* fieldName, signed char value) {
ACE_OS::snprintf(
excpStr, 256,
"PdxInstance doesn't has field %s or type of field not matched %s ",
- fieldName, (pft != NULLPTR ? pft->toString()->asChar() : ""));
+ fieldName, (pft != nullptr ? pft->toString()->asChar() : ""));
throw IllegalStateException(excpStr);
}
CacheablePtr cacheableObject = CacheableByte::create(value);
@@ -2081,7 +2058,7 @@ void PdxInstanceImpl::setField(const char* fieldName, unsigned char value) {
PdxTypePtr pt = getPdxType();
PdxFieldTypePtr pft = pt->getPdxField(fieldName);
- if (pft != NULLPTR && pft->getTypeId() != PdxFieldTypes::BYTE) {
+ if (pft != nullptr && pft->getTypeId() != PdxFieldTypes::BYTE) {
char excpStr[256] = {0};
/* adongre - Coverity II
* CID 29236: Calling risky function (SECURE_CODING)[VERY RISKY]. Using
@@ -2096,7 +2073,7 @@ void PdxInstanceImpl::setField(const char* fieldName, unsigned char value) {
ACE_OS::snprintf(
excpStr, 256,
"PdxInstance doesn't has field %s or type of field not matched %s ",
- fieldName, (pft != NULLPTR ? pft->toString()->asChar() : ""));
+ fieldName, (pft != nullptr ? pft->toString()->asChar() : ""));
throw IllegalStateException(excpStr);
}
CacheablePtr cacheableObject = CacheableByte::create(value);
@@ -2107,12 +2084,12 @@ void PdxInstanceImpl::setField(const char* fieldName, int16_t value) {
PdxTypePtr pt = getPdxType();
PdxFieldTypePtr pft = pt->getPdxField(fieldName);
- if (pft != NULLPTR && pft->getTypeId() != PdxFieldTypes::SHORT) {
+ if (pft != nullptr && pft->getTypeId() != PdxFieldTypes::SHORT) {
char excpStr[256] = {0};
ACE_OS::snprintf(
excpStr, 256,
"PdxInstance doesn't has field %s or type of field not matched %s ",
- fieldName, (pft != NULLPTR ? pft->toString()->asChar() : ""));
+ fieldName, (pft != nullptr ? pft->toString()->asChar() : ""));
throw IllegalStateException(excpStr);
}
CacheablePtr cacheableObject = CacheableInt16::create(value);
@@ -2123,7 +2100,7 @@ void PdxInstanceImpl::setField(const char* fieldName, int32_t value) {
PdxTypePtr pt = getPdxType();
PdxFieldTypePtr pft = pt->getPdxField(fieldName);
- if (pft != NULLPTR && pft->getTypeId() != PdxFieldTypes::INT) {
+ if (pft != nullptr && pft->getTypeId() != PdxFieldTypes::INT) {
char excpStr[256] = {0};
/* adongre - Coverity II
* CID 29234: Calling risky function (SECURE_CODING)[VERY RISKY]. Using
@@ -2138,7 +2115,7 @@ void PdxInstanceImpl::setField(const char* fieldName, int32_t value) {
ACE_OS::snprintf(
excpStr, 256,
"PdxInstance doesn't has field %s or type of field not matched %s ",
- fieldName, (pft != NULLPTR ? pft->toString()->asChar() : ""));
+ fieldName, (pft != nullptr ? pft->toString()->asChar() : ""));
throw IllegalStateException(excpStr);
}
CacheablePtr cacheableObject = CacheableInt32::create(value);
@@ -2149,7 +2126,7 @@ void PdxInstanceImpl::setField(const char* fieldName, int64_t value) {
PdxTypePtr pt = getPdxType();
PdxFieldTypePtr pft = pt->getPdxField(fieldName);
- if (pft != NULLPTR && pft->getTypeId() != PdxFieldTypes::LONG) {
+ if (pft != nullptr && pft->getTypeId() != PdxFieldTypes::LONG) {
char excpStr[256] = {0};
/* adongre - Coverity II
* CID 29235: Calling risky function (SECURE_CODING)[VERY RISKY]. Using
@@ -2164,7 +2141,7 @@ void PdxInstanceImpl::setField(const char* fieldName, int64_t value) {
ACE_OS::snprintf(
excpStr, 256,
"PdxInstance doesn't has field %s or type of field not matched %s ",
- fieldName, (pft != NULLPTR ? pft->toString()->asChar() : ""));
+ fieldName, (pft != nullptr ? pft->toString()->asChar() : ""));
throw IllegalStateException(excpStr);
}
CacheablePtr cacheableObject = CacheableInt64::create(value);
@@ -2175,7 +2152,7 @@ void PdxInstanceImpl::setField(const char* fieldName, float value) {
PdxTypePtr pt = getPdxType();
PdxFieldTypePtr pft = pt->getPdxField(fieldName);
- if (pft != NULLPTR && pft->getTypeId() != PdxFieldTypes::FLOAT) {
+ if (pft != nullptr && pft->getTypeId() != PdxFieldTypes::FLOAT) {
char excpStr[256] = {0};
/* adongre - Coverity II
* CID 29232: Calling risky function (SECURE_CODING)[VERY RISKY]. Using
@@ -2190,7 +2167,7 @@ void PdxInstanceImpl::setField(const char* fieldName, float value) {
ACE_OS::snprintf(
excpStr, 256,
"PdxInstance doesn't has field %s or type of field not matched %s ",
- fieldName, (pft != NULLPTR ? pft->toString()->asChar() : ""));
+ fieldName, (pft != nullptr ? pft->toString()->asChar() : ""));
throw IllegalStateException(excpStr);
}
CacheablePtr cacheableObject = CacheableFloat::create(value);
@@ -2201,7 +2178,7 @@ void PdxInstanceImpl::setField(const char* fieldName, double value) {
PdxTypePtr pt = getPdxType();
PdxFieldTypePtr pft = pt->getPdxField(fieldName);
- if (pft != NULLPTR && pft->getTypeId() != PdxFieldTypes::DOUBLE) {
+ if (pft != nullptr && pft->getTypeId() != PdxFieldTypes::DOUBLE) {
char excpStr[256] = {0};
/* adongre - Coverity II
* CID 29231: Calling risky function (SECURE_CODING)[VERY RISKY]. Using
@@ -2216,7 +2193,7 @@ void PdxInstanceImpl::setField(const char* fieldName, double value) {
ACE_OS::snprintf(
excpStr, 256,
"PdxInstance doesn't has field %s or type of field not matched %s ",
- fieldName, (pft != NULLPTR ? pft->toString()->asChar() : ""));
+ fieldName, (pft != nullptr ? pft->toString()->asChar() : ""));
throw IllegalStateException(excpStr);
}
CacheablePtr cacheableObject = CacheableDouble::create(value);
@@ -2227,7 +2204,7 @@ void PdxInstanceImpl::setField(const char* fieldName, wchar_t value) {
PdxTypePtr pt = getPdxType();
PdxFieldTypePtr pft = pt->getPdxField(fieldName);
- if (pft != NULLPTR && pft->getTypeId() != PdxFieldTypes::CHAR) {
+ if (pft != nullptr && pft->getTypeId() != PdxFieldTypes::CHAR) {
char excpStr[256] = {0};
/* adongre - Coverity II
* CID 29237: Calling risky function (SECURE_CODING)[VERY RISKY]. Using
@@ -2242,7 +2219,7 @@ void PdxInstanceImpl::setField(const char* fieldName, wchar_t value) {
ACE_OS::snprintf(
excpStr, 256,
"PdxInstance doesn't has field %s or type of field not matched %s ",
- fieldName, (pft != NULLPTR ? pft->toString()->asChar() : ""));
+ fieldName, (pft != nullptr ? pft->toString()->asChar() : ""));
throw IllegalStateException(excpStr);
}
CacheablePtr cacheableObject = CacheableWideChar::create(value);
@@ -2253,7 +2230,7 @@ void PdxInstanceImpl::setField(const char* fieldName, char value) {
PdxTypePtr pt = getPdxType();
PdxFieldTypePtr pft = pt->getPdxField(fieldName);
- if (pft != NULLPTR && pft->getTypeId() != PdxFieldTypes::CHAR) {
+ if (pft != nullptr && pft->getTypeId() != PdxFieldTypes::CHAR) {
char excpStr[256] = {0};
/* adongre - Coverity II
* CID 29230: Calling risky function (SECURE_CODING)[VERY RISKY]. Using
@@ -2268,7 +2245,7 @@ void PdxInstanceImpl::setField(const char* fieldName, char value) {
ACE_OS::snprintf(
excpStr, 256,
"PdxInstance doesn't has field %s or type of field not matched %s ",
- fieldName, (pft != NULLPTR ? pft->toString()->asChar() : ""));
+ fieldName, (pft != nullptr ? pft->toString()->asChar() : ""));
throw IllegalStateException(excpStr);
}
wchar_t tempWideChar = static_cast<wchar_t>(value);
@@ -2280,12 +2257,12 @@ void PdxInstanceImpl::setField(const char* fieldName, CacheableDatePtr value) {
PdxTypePtr pt = getPdxType();
PdxFieldTypePtr pft = pt->getPdxField(fieldName);
- if (pft != NULLPTR && pft->getTypeId() != PdxFieldTypes::DATE) {
+ if (pft != nullptr && pft->getTypeId() != PdxFieldTypes::DATE) {
char excpStr[256] = {0};
ACE_OS::snprintf(
excpStr, 256,
"PdxInstance doesn't has field %s or type of field not matched %s ",
- fieldName, (pft != NULLPTR ? pft->toString()->asChar() : ""));
+ fieldName, (pft != nullptr ? pft->toString()->asChar() : ""));
throw IllegalStateException(excpStr);
}
CacheablePtr cacheableObject = value;
@@ -2296,7 +2273,7 @@ void PdxInstanceImpl::setField(const char* fieldName, CacheablePtr value) {
PdxTypePtr pt = getPdxType();
PdxFieldTypePtr pft = pt->getPdxField(fieldName);
- if (pft != NULLPTR && pft->getTypeId() != PdxFieldTypes::OBJECT) {
+ if (pft != nullptr && pft->getTypeId() != PdxFieldTypes::OBJECT) {
char excpStr[256] = {0};
/* adongre - Coverity II
* CID 29212: Calling risky function (SECURE_CODING)[VERY RISKY]. Using
@@ -2311,7 +2288,7 @@ void PdxInstanceImpl::setField(const char* fieldName, CacheablePtr value) {
ACE_OS::snprintf(
excpStr, 256,
"PdxInstance doesn't has field %s or type of field not matched %s ",
- fieldName, (pft != NULLPTR ? pft->toString()->asChar() : ""));
+ fieldName, (pft != nullptr ? pft->toString()->asChar() : ""));
throw IllegalStateException(excpStr);
}
m_updatedFields[fieldName] = value;
@@ -2322,12 +2299,12 @@ void PdxInstanceImpl::setField(const char* fieldName,
PdxTypePtr pt = getPdxType();
PdxFieldTypePtr pft = pt->getPdxField(fieldName);
- if (pft != NULLPTR && pft->getTypeId() != PdxFieldTypes::OBJECT_ARRAY) {
+ if (pft != nullptr && pft->getTypeId() != PdxFieldTypes::OBJECT_ARRAY) {
char excpStr[256] = {0};
ACE_OS::snprintf(
excpStr, 256,
"PdxInstance doesn't has field %s or type of field not matched %s ",
- fieldName, (pft != NULLPTR ? pft->toString()->asChar() : ""));
+ fieldName, (pft != nullptr ? pft->toString()->asChar() : ""));
throw IllegalStateException(excpStr);
}
m_updatedFields[fieldName] = value;
@@ -2338,7 +2315,7 @@ void PdxInstanceImpl::setField(const char* fieldName, bool* value,
PdxTypePtr pt = getPdxType();
PdxFieldTypePtr pft = pt->getPdxField(fieldName);
- if (pft != NULLPTR && pft->getTypeId() != PdxFieldTypes::BOOLEAN_ARRAY) {
+ if (pft != nullptr && pft->getTypeId() != PdxFieldTypes::BOOLEAN_ARRAY) {
char excpStr[256] = {0};
/* adongre - Coverity II
* CID 29218: Calling risky function (SECURE_CODING)[VERY RISKY]. Using
@@ -2353,7 +2330,7 @@ void PdxInstanceImpl::setField(const char* fieldName, bool* value,
ACE_OS::snprintf(
excpStr, 256,
"PdxInstance doesn't has field %s or type of field not matched %s ",
- fieldName, (pft != NULLPTR ? pft->toString()->asChar() : ""));
+ fieldName, (pft != nullptr ? pft->toString()->asChar() : ""));
throw IllegalStateException(excpStr);
}
CacheablePtr cacheableObject = BooleanArray::create(value, length);
@@ -2365,7 +2342,7 @@ void PdxInstanceImpl::setField(const char* fieldName, signed char* value,
PdxTypePtr pt = getPdxType();
PdxFieldTypePtr pft = pt->getPdxField(fieldName);
- if (pft != NULLPTR && pft->getTypeId() != PdxFieldTypes::BYTE_ARRAY) {
+ if (pft != nullptr && pft->getTypeId() != PdxFieldTypes::BYTE_ARRAY) {
char excpStr[256] = {0};
/* adongre - Coverity II
* CID 29217: Calling risky function (SECURE_CODING)[VERY RISKY]. Using
@@ -2380,7 +2357,7 @@ void PdxInstanceImpl::setField(const char* fieldName, signed char* value,
ACE_OS::snprintf(
excpStr, 256,
"PdxInstance doesn't has field %s or type of field not matched %s ",
- fieldName, (pft != NULLPTR ? pft->toString()->asChar() : ""));
+ fieldName, (pft != nullptr ? pft->toString()->asChar() : ""));
throw IllegalStateException(excpStr);
}
CacheablePtr cacheableObject =
@@ -2393,7 +2370,7 @@ void PdxInstanceImpl::setField(const char* fieldName, unsigned char* value,
PdxTypePtr pt = getPdxType();
PdxFieldTypePtr pft = pt->getPdxField(fieldName);
- if (pft != NULLPTR && pft->getTypeId() != PdxFieldTypes::BYTE_ARRAY) {
+ if (pft != nullptr && pft->getTypeId() != PdxFieldTypes::BYTE_ARRAY) {
char excpStr[256] = {0};
/* adongre - Coverity II
* CID 29222: Calling risky function (SECURE_CODING)[VERY RISKY]. Using
@@ -2408,7 +2385,7 @@ void PdxInstanceImpl::setField(const char* fieldName, unsigned char* value,
ACE_OS::snprintf(
excpStr, 256,
"PdxInstance doesn't has field %s or type of field not matched %s ",
- fieldName, (pft != NULLPTR ? pft->toString()->asChar() : ""));
+ fieldName, (pft != nullptr ? pft->toString()->asChar() : ""));
throw IllegalStateException(excpStr);
}
CacheablePtr cacheableObject =
@@ -2421,7 +2398,7 @@ void PdxInstanceImpl::setField(const char* fieldName, int16_t* value,
PdxTypePtr pt = getPdxType();
PdxFieldTypePtr pft = pt->getPdxField(fieldName);
- if (pft != NULLPTR && pft->getTypeId() != PdxFieldTypes::SHORT_ARRAY) {
+ if (pft != nullptr && pft->getTypeId() != PdxFieldTypes::SHORT_ARRAY) {
char excpStr[256] = {0};
/* adongre - Coverity II
* CID 29225: Calling risky function (SECURE_CODING)[VERY RISKY]. Using
@@ -2436,7 +2413,7 @@ void PdxInstanceImpl::setField(const char* fieldName, int16_t* value,
ACE_OS::snprintf(
excpStr, 256,
"PdxInstance doesn't has field %s or type of field not matched %s ",
- fieldName, (pft != NULLPTR ? pft->toString()->asChar() : ""));
+ fieldName, (pft != nullptr ? pft->toString()->asChar() : ""));
throw IllegalStateException(excpStr);
}
CacheablePtr cacheableObject = CacheableInt16Array::create(value, length);
@@ -2448,7 +2425,7 @@ void PdxInstanceImpl::setField(const char* fieldName, int32_t* value,
PdxTypePtr pt = getPdxType();
PdxFieldTypePtr pft = pt->getPdxField(fieldName);
- if (pft != NULLPTR && pft->getTypeId() != PdxFieldTypes::INT_ARRAY) {
+ if (pft != nullptr && pft->getTypeId() != PdxFieldTypes::INT_ARRAY) {
char excpStr[256] = {0};
/* adongre - Coverity II
* CID 29223: Calling risky function (SECURE_CODING)[VERY RISKY]. Using
@@ -2463,7 +2440,7 @@ void PdxInstanceImpl::setField(const char* fieldName, int32_t* value,
ACE_OS::snprintf(
excpStr, 256,
"PdxInstance doesn't has field %s or type of field not matched %s ",
- fieldName, (pft != NULLPTR ? pft->toString()->asChar() : ""));
+ fieldName, (pft != nullptr ? pft->toString()->asChar() : ""));
throw IllegalStateException(excpStr);
}
CacheablePtr cacheableObject = CacheableInt32Array::create(value, length);
@@ -2475,7 +2452,7 @@ void PdxInstanceImpl::setField(const char* fieldName, int64_t* value,
PdxTypePtr pt = getPdxType();
PdxFieldTypePtr pft = pt->getPdxField(fieldName);
- if (pft != NULLPTR && pft->getTypeId() != PdxFieldTypes::LONG_ARRAY) {
+ if (pft != nullptr && pft->getTypeId() != PdxFieldTypes::LONG_ARRAY) {
char excpStr[256] = {0};
/* adongre - Coverity II
* CID 29224: Calling risky function (SECURE_CODING)[VERY RISKY]. Using
@@ -2490,7 +2467,7 @@ void PdxInstanceImpl::setField(const char* fieldName, int64_t* value,
ACE_OS::snprintf(
excpStr, 256,
"PdxInstance doesn't has field %s or type of field not matched %s ",
- fieldName, (pft != NULLPTR ? pft->toString()->asChar() : ""));
+ fieldName, (pft != nullptr ? pft->toString()->asChar() : ""));
throw IllegalStateException(excpStr);
}
CacheablePtr cacheableObject = CacheableInt64Array::create(value, length);
@@ -2502,7 +2479,7 @@ void PdxInstanceImpl::setField(const char* fieldName, float* value,
PdxTypePtr pt = getPdxType();
PdxFieldTypePtr pft = pt->getPdxField(fieldName);
- if (pft != NULLPTR && pft->getTypeId() != PdxFieldTypes::FLOAT_ARRAY) {
+ if (pft != nullptr && pft->getTypeId() != PdxFieldTypes::FLOAT_ARRAY) {
char excpStr[256] = {0};
/* adongre - Coverity II
* CID 29221: Calling risky function (SECURE_CODING)[VERY RISKY]. Using
@@ -2517,7 +2494,7 @@ void PdxInstanceImpl::setField(const char* fieldName, float* value,
ACE_OS::snprintf(
excpStr, 256,
"PdxInstance doesn't has field %s or type of field not matched %s ",
- fieldName, (pft != NULLPTR ? pft->toString()->asChar() : ""));
+ fieldName, (pft != nullptr ? pft->toString()->asChar() : ""));
throw IllegalStateException(excpStr);
}
CacheablePtr cacheableObject = CacheableFloatArray::create(value, length);
@@ -2529,7 +2506,7 @@ void PdxInstanceImpl::setField(const char* fieldName, double* value,
PdxTypePtr pt = getPdxType();
PdxFieldTypePtr pft = pt->getPdxField(fieldName);
- if (pft != NULLPTR && pft->getTypeId() != PdxFieldTypes::DOUBLE_ARRAY) {
+ if (pft != nullptr && pft->getTypeId() != PdxFieldTypes::DOUBLE_ARRAY) {
char excpStr[256] = {0};
/* adongre - Coverity II
* CID 29220: Calling risky function (SECURE_CODING)[VERY RISKY]. Using
@@ -2544,7 +2521,7 @@ void PdxInstanceImpl::setField(const char* fieldName, double* value,
ACE_OS::snprintf(
excpStr, 256,
"PdxInstance doesn't has field %s or type of field not matched %s ",
- fieldName, (pft != NULLPTR ? pft->toString()->asChar() : ""));
+ fieldName, (pft != nullptr ? pft->toString()->asChar() : ""));
throw IllegalStateException(excpStr);
}
CacheablePtr cacheableObject = CacheableDoubleArray::create(value, length);
@@ -2556,7 +2533,7 @@ void PdxInstanceImpl::setField(const char* fieldName, wchar_t* value,
PdxTypePtr pt = getPdxType();
PdxFieldTypePtr pft = pt->getPdxField(fieldName);
- if (pft != NULLPTR && pft->getTypeId() != PdxFieldTypes::CHAR_ARRAY) {
+ if (pft != nullptr && pft->getTypeId() != PdxFieldTypes::CHAR_ARRAY) {
char excpStr[256] = {0};
/* adongre - Coverity II
* CID 29226: Calling risky function (SECURE_CODING)[VERY RISKY]. Using
@@ -2571,7 +2548,7 @@ void PdxInstanceImpl::setField(const char* fieldName, wchar_t* value,
ACE_OS::snprintf(
excpStr, 256,
"PdxInstance doesn't has field %s or type of field not matched %s ",
- fieldName, (pft != NULLPTR ? pft->toString()->asChar() : ""));
+ fieldName, (pft != nullptr ? pft->toString()->asChar() : ""));
throw IllegalStateException(excpStr);
}
CacheablePtr ptr = CharArray::create(value, length);
@@ -2583,7 +2560,7 @@ void PdxInstanceImpl::setField(const char* fieldName, char* value,
PdxTypePtr pt = getPdxType();
PdxFieldTypePtr pft = pt->getPdxField(fieldName);
- if (pft != NULLPTR && pft->getTypeId() != PdxFieldTypes::CHAR_ARRAY) {
+ if (pft != nullptr && pft->getTypeId() != PdxFieldTypes::CHAR_ARRAY) {
char excpStr[256] = {0};
/* adongre - Coverity II
* CID 29219: Calling risky function (SECURE_CODING)[VERY RISKY]. Using
@@ -2598,7 +2575,7 @@ void PdxInstanceImpl::setField(const char* fieldName, char* value,
ACE_OS::snprintf(
excpStr, 256,
"PdxInstance doesn't has field %s or type of field not matched %s ",
- fieldName, (pft != NULLPTR ? pft->toString()->asChar() : ""));
+ fieldName, (pft != nullptr ? pft->toString()->asChar() : ""));
throw IllegalStateException(excpStr);
}
size_t size = strlen(value) + 1;
@@ -2613,7 +2590,7 @@ void PdxInstanceImpl::setField(const char* fieldName, const wchar_t* value) {
PdxTypePtr pt = getPdxType();
PdxFieldTypePtr pft = pt->getPdxField(fieldName);
- if (pft != NULLPTR && pft->getTypeId() != PdxFieldTypes::STRING) {
+ if (pft != nullptr && pft->getTypeId() != PdxFieldTypes::STRING) {
char excpStr[256] = {0};
/* adongre - Coverity II
* CID 29213: Calling risky function (SECURE_CODING)[VERY RISKY]. Using
@@ -2628,7 +2605,7 @@ void PdxInstanceImpl::setField(const char* fieldName, const wchar_t* value) {
ACE_OS::snprintf(
excpStr, 256,
"PdxInstance doesn't has field %s or type of field not matched %s ",
- fieldName, (pft != NULLPTR ? pft->toString()->asChar() : ""));
+ fieldName, (pft != nullptr ? pft->toString()->asChar() : ""));
throw IllegalStateException(excpStr);
}
CacheablePtr ptr = CacheableString::create(value);
@@ -2639,7 +2616,7 @@ void PdxInstanceImpl::setField(const char* fieldName, const char* value) {
PdxTypePtr pt = getPdxType();
PdxFieldTypePtr pft = pt->getPdxField(fieldName);
- if (pft != NULLPTR && pft->getTypeId() != PdxFieldTypes::STRING) {
+ if (pft != nullptr && pft->getTypeId() != PdxFieldTypes::STRING) {
char excpStr[256] = {0};
/* adongre - Coverity II
* CID 29227: Calling risky function (SECURE_CODING)[VERY RISKY]. Using
@@ -2654,7 +2631,7 @@ void PdxInstanceImpl::setField(const char* fieldName, const char* value) {
ACE_OS::snprintf(
excpStr, 256,
"PdxInstance doesn't has field %s or type of field not matched %s ",
- fieldName, (pft != NULLPTR ? pft->toString()->asChar() : ""));
+ fieldName, (pft != nullptr ? pft->toString()->asChar() : ""));
throw IllegalStateException(excpStr);
}
CacheablePtr ptr = CacheableString::create(value);
@@ -2666,7 +2643,7 @@ void PdxInstanceImpl::setField(const char* fieldName, int8_t** value,
PdxTypePtr pt = getPdxType();
PdxFieldTypePtr pft = pt->getPdxField(fieldName);
- if (pft != NULLPTR &&
+ if (pft != nullptr &&
pft->getTypeId() != PdxFieldTypes::ARRAY_OF_BYTE_ARRAYS) {
char excpStr[256] = {0};
/* adongre - Coverity II
@@ -2682,7 +2659,7 @@ void PdxInstanceImpl::setField(const char* fieldName, int8_t** value,
ACE_OS::snprintf(
excpStr, 256,
"PdxInstance doesn't has field %s or type of field not matched %s ",
- fieldName, (pft != NULLPTR ? pft->toString()->asChar() : ""));
+ fieldName, (pft != nullptr ? pft->toString()->asChar() : ""));
throw IllegalStateException(excpStr);
}
CacheableVectorPtr cacheableObject = CacheableVector::create();
@@ -2699,7 +2676,7 @@ void PdxInstanceImpl::setField(const char* fieldName, wchar_t** value,
PdxTypePtr pt = getPdxType();
PdxFieldTypePtr pft = pt->getPdxField(fieldName);
- if (pft != NULLPTR && pft->getTypeId() != PdxFieldTypes::STRING_ARRAY) {
+ if (pft != nullptr && pft->getTypeId() != PdxFieldTypes::STRING_ARRAY) {
char excpStr[256] = {0};
/* adongre - Coverity II
* CID 29216: Calling risky function (SECURE_CODING)[VERY RISKY]. Using
@@ -2714,7 +2691,7 @@ void PdxInstanceImpl::setField(const char* fieldName, wchar_t** value,
ACE_OS::snprintf(
excpStr, 256,
"PdxInstance doesn't has field %s or type of field not matched %s ",
- fieldName, (pft != NULLPTR ? pft->toString()->asChar() : ""));
+ fieldName, (pft != nullptr ? pft->toString()->asChar() : ""));
throw IllegalStateException(excpStr);
}
CacheableStringPtr* ptrArr = NULL;
@@ -2742,7 +2719,7 @@ void PdxInstanceImpl::setField(const char* fieldName, char** value,
PdxTypePtr pt = getPdxType();
PdxFieldTypePtr pft = pt->getPdxField(fieldName);
- if (pft != NULLPTR && pft->getTypeId() != PdxFieldTypes::STRING_ARRAY) {
+ if (pft != nullptr && pft->getTypeId() != PdxFieldTypes::STRING_ARRAY) {
char excpStr[256] = {0};
/* adongre - Coverity II
* CID 29215: Calling risky function (SECURE_CODING)[VERY RISKY]. Using
@@ -2757,7 +2734,7 @@ void PdxInstanceImpl::setField(const char* fieldName, char** value,
ACE_OS::snprintf(
excpStr, 256,
"PdxInstance doesn't has field %s or type of field not matched %s ",
- fieldName, (pft != NULLPTR ? pft->toString()->asChar() : ""));
+ fieldName, (pft != nullptr ? pft->toString()->asChar() : ""));
throw IllegalStateException(excpStr);
}
CacheableStringPtr* ptrArr = NULL;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/PdxInstanceImpl.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxInstanceImpl.hpp b/src/cppcache/src/PdxInstanceImpl.hpp
index 0eadd38..751d8c9 100644
--- a/src/cppcache/src/PdxInstanceImpl.hpp
+++ b/src/cppcache/src/PdxInstanceImpl.hpp
@@ -1054,7 +1054,7 @@ class CPPCACHE_EXPORT PdxInstanceImpl : public WritablePdxInstance {
m_bufferLength = length;
LOGDEBUG("PdxInstanceImpl::m_bufferLength = %d ", m_bufferLength);
m_typeId = typeId;
- m_pdxType = NULLPTR;
+ m_pdxType = nullptr;
}
PdxInstanceImpl(FieldVsValues fieldVsValue, PdxTypePtr pdxType);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/PdxInstantiator.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxInstantiator.cpp b/src/cppcache/src/PdxInstantiator.cpp
index 73d9ae7..e4a5958 100644
--- a/src/cppcache/src/PdxInstantiator.cpp
+++ b/src/cppcache/src/PdxInstantiator.cpp
@@ -47,7 +47,7 @@ void PdxInstantiator::toData(DataOutput& output) const {
Serializable* PdxInstantiator::fromData(DataInput& input) {
m_userObject = PdxHelper::deserializePdx(input, false);
- return m_userObject.ptr();
+ return m_userObject.get();
}
CacheableStringPtr PdxInstantiator::toString() const {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/PdxLocalReader.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxLocalReader.cpp b/src/cppcache/src/PdxLocalReader.cpp
index 7e464ba..6290272 100644
--- a/src/cppcache/src/PdxLocalReader.cpp
+++ b/src/cppcache/src/PdxLocalReader.cpp
@@ -50,7 +50,7 @@ PdxLocalReader::PdxLocalReader(DataInput& input, PdxTypePtr remoteType,
m_remoteToLocalMap = remoteType->getRemoteToLocalMap();
m_remoteToLocalMapSize = remoteType->getTotalFields();
- m_pdxRemotePreserveData = new PdxRemotePreservedData();
+ m_pdxRemotePreserveData = std::make_shared<PdxRemotePreservedData>();
m_isDataNeedToPreserve = true;
initialize();
}
@@ -178,10 +178,10 @@ SerializablePtr PdxLocalReader::readObject(const char* fieldName) {
checkEmptyFieldName(fieldName);
SerializablePtr ptr;
m_dataInput->readObject(ptr);
- if (ptr != NULLPTR) {
+ if (ptr != nullptr) {
return ptr;
} else {
- return NULLPTR;
+ return nullptr;
}
}
@@ -276,7 +276,7 @@ CacheableObjectArrayPtr PdxLocalReader::readObjectArray(const char* fieldName) {
coa->fromData(*m_dataInput);
LOGDEBUG("PdxLocalReader::readObjectArray coa->size() = %d", coa->size());
if (coa->size() <= 0) {
- coa = NULLPTR;
+ coa = nullptr;
}
return coa;
}
@@ -306,7 +306,7 @@ PdxRemotePreservedDataPtr PdxLocalReader::getPreservedData(
nFieldExtra, PdxTypeRegistry::getPdxIgnoreUnreadFields());
if (nFieldExtra > 0 && PdxTypeRegistry::getPdxIgnoreUnreadFields() == false) {
m_pdxRemotePreserveData->initialize(
- m_pdxType != NULLPTR ? m_pdxType->getTypeId() : 0,
+ m_pdxType != nullptr ? m_pdxType->getTypeId() : 0,
mergedVersion->getTypeId(), nFieldExtra, pdxObject);
LOGDEBUG("PdxLocalReader::getPreservedData - 1");
@@ -355,16 +355,16 @@ PdxRemotePreservedDataPtr PdxLocalReader::getPreservedData(
"PdxLocalReader::GetPreservedData m_isDataNeedToPreserve is false");
}
}
- return NULLPTR;
+ return nullptr;
}
bool PdxLocalReader::hasField(const char* fieldName) {
- return m_pdxType->getPdxField(fieldName) != NULLPTR;
+ return m_pdxType->getPdxField(fieldName) != nullptr;
}
bool PdxLocalReader::isIdentityField(const char* fieldName) {
PdxFieldTypePtr pft = m_pdxType->getPdxField(fieldName);
- return (pft != NULLPTR) && (pft->getIdentityField());
+ return (pft != nullptr) && (pft->getIdentityField());
}
void PdxLocalReader::readCollection(const char* fieldName,
@@ -375,7 +375,7 @@ void PdxLocalReader::readCollection(const char* fieldName,
PdxUnreadFieldsPtr PdxLocalReader::readUnreadFields() {
LOGDEBUG("readUnreadFields:: %d ignore property %d", m_isDataNeedToPreserve,
PdxTypeRegistry::getPdxIgnoreUnreadFields());
- if (PdxTypeRegistry::getPdxIgnoreUnreadFields() == true) return NULLPTR;
+ if (PdxTypeRegistry::getPdxIgnoreUnreadFields() == true) return nullptr;
m_isDataNeedToPreserve = false;
return m_pdxRemotePreserveData;
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/PdxLocalWriter.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxLocalWriter.cpp b/src/cppcache/src/PdxLocalWriter.cpp
index 7a865a4..e09ce0b 100644
--- a/src/cppcache/src/PdxLocalWriter.cpp
+++ b/src/cppcache/src/PdxLocalWriter.cpp
@@ -39,23 +39,23 @@ namespace client {
*/
PdxLocalWriter::PdxLocalWriter()
: m_dataOutput(NULL),
- m_pdxType(NULLPTR),
+ m_pdxType(nullptr),
m_startPosition(NULL),
m_startPositionOffset(0),
m_domainClassName(NULL),
m_currentOffsetIndex(0),
m_pdxClassName(NULL) { // COVERITY --> 29282 Uninitialized pointer field
// m_dataOutput = NULL;
- // m_pdxType =NULLPTR;
+ // m_pdxType =nullptr;
}
PdxLocalWriter::PdxLocalWriter(DataOutput& output, PdxTypePtr pdxType) {
m_dataOutput = &output;
m_pdxType = pdxType;
m_currentOffsetIndex = 0;
- m_preserveData = NULLPTR;
+ m_preserveData = nullptr;
m_pdxClassName = NULL;
- if (pdxType != NULLPTR) m_pdxClassName = pdxType->getPdxClassName();
+ if (pdxType != nullptr) m_pdxClassName = pdxType->getPdxClassName();
;
initialize();
/* adongre - Coverity II
@@ -72,7 +72,7 @@ PdxLocalWriter::PdxLocalWriter(DataOutput& dataOutput, PdxTypePtr pdxType,
m_dataOutput = &dataOutput;
m_pdxType = pdxType;
m_currentOffsetIndex = 0;
- m_preserveData = NULLPTR;
+ m_preserveData = nullptr;
m_pdxClassName = pdxClassName;
initialize();
/* adongre - Coverity II
@@ -102,7 +102,7 @@ PdxLocalWriter::~PdxLocalWriter() {
}
void PdxLocalWriter::initialize() {
- if (m_pdxType != NULLPTR) {
+ if (m_pdxType != nullptr) {
m_currentOffsetIndex = 0;
}
@@ -166,12 +166,12 @@ PdxWriterPtr PdxLocalWriter::writeUnreadFields(PdxUnreadFieldsPtr unread) {
"written.");
}
- if (unread != NULLPTR) {
- m_preserveData = dynCast<PdxRemotePreservedDataPtr>(unread);
- if (m_preserveData != NULLPTR) {
+ if (unread != nullptr) {
+ m_preserveData = std::dynamic_pointer_cast<PdxRemotePreservedData>(unread);
+ if (m_preserveData != nullptr) {
m_pdxType =
PdxTypeRegistry::getPdxType(m_preserveData->getMergedTypeId());
- if (m_pdxType == NULLPTR) {
+ if (m_pdxType == nullptr) {
// its local type
// this needs to fix for IPdxTypemapper
m_pdxType = PdxTypeRegistry::getLocalPdxType(m_pdxClassName);
@@ -182,7 +182,7 @@ PdxWriterPtr PdxLocalWriter::writeUnreadFields(PdxUnreadFieldsPtr unread) {
"NULL");
}
}
- return PdxWriterPtr(this);
+ return shared_from_this();
}
int32_t PdxLocalWriter::calculateLenWithOffsets() {
@@ -207,59 +207,59 @@ bool PdxLocalWriter::isFieldWritingStarted() { return true; }
PdxWriterPtr PdxLocalWriter::writeChar(const char* fieldName, char value) {
m_dataOutput->writeChar(static_cast<uint16_t>(value));
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxLocalWriter::writeWideChar(const char* fieldName,
wchar_t value) {
m_dataOutput->writeChar(static_cast<uint16_t>(value));
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxLocalWriter::writeBoolean(const char* fieldName, bool value) {
m_dataOutput->writeBoolean(value);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxLocalWriter::writeByte(const char* fieldName, int8_t value) {
m_dataOutput->write(value);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxLocalWriter::writeShort(const char* fieldName, int16_t value) {
m_dataOutput->writeInt(value);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxLocalWriter::writeInt(const char* fieldName, int32_t value) {
m_dataOutput->writeInt(value);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxLocalWriter::writeLong(const char* fieldName, int64_t value) {
m_dataOutput->writeInt(value);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxLocalWriter::writeFloat(const char* fieldName, float value) {
m_dataOutput->writeFloat(value);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxLocalWriter::writeDouble(const char* fieldName, double value) {
m_dataOutput->writeDouble(value);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxLocalWriter::writeDate(const char* fieldName,
CacheableDatePtr date) {
- // m_dataOutput->writeObject(date.ptr());
- if (date != NULLPTR) {
+ // m_dataOutput->writeObject(date.get());
+ if (date != nullptr) {
date->toData(*m_dataOutput);
} else {
m_dataOutput->writeInt(static_cast<uint64_t>(-1L));
}
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxLocalWriter::writeString(const char* fieldName,
@@ -280,7 +280,7 @@ PdxWriterPtr PdxLocalWriter::writeString(const char* fieldName,
m_dataOutput->writeUTF(value);
}
}
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxLocalWriter::writeWideString(const char* fieldName,
@@ -301,7 +301,7 @@ PdxWriterPtr PdxLocalWriter::writeWideString(const char* fieldName,
m_dataOutput->writeUTF(value);
}
}
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxLocalWriter::writeStringwithoutOffset(const char* value) {
@@ -320,7 +320,7 @@ PdxWriterPtr PdxLocalWriter::writeStringwithoutOffset(const char* value) {
m_dataOutput->writeUTF(value);
}
}
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxLocalWriter::writeWideStringwithoutOffset(
@@ -340,7 +340,7 @@ PdxWriterPtr PdxLocalWriter::writeWideStringwithoutOffset(
m_dataOutput->writeUTF(value);
}
}
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxLocalWriter::writeStringArray(const char* fieldName,
@@ -355,7 +355,7 @@ PdxWriterPtr PdxLocalWriter::writeStringArray(const char* fieldName,
writeStringwithoutOffset(array[i]);
}
}
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxLocalWriter::writeWideStringArray(const char* fieldName,
@@ -369,41 +369,42 @@ PdxWriterPtr PdxLocalWriter::writeWideStringArray(const char* fieldName,
writeWideStringwithoutOffset(array[i]);
}
}
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxLocalWriter::writeObject(const char* fieldName,
SerializablePtr value) {
addOffset();
- CacheableEnumPtr enumValPtr = NULLPTR;
- CacheableObjectArrayPtr objArrPtr = NULLPTR;
- /*if (value != NULLPTR) {
+ CacheableEnumPtr enumValPtr = nullptr;
+ CacheableObjectArrayPtr objArrPtr = nullptr;
+ /*if (value != nullptr) {
try {
- enumValPtr = dynCast<CacheableEnumPtr>(value);
+ enumValPtr = std::dynamic_pointer_cast<CacheableEnum>(value);
}
catch (const ClassCastException&) {
//ignore
}
}*/
- if (value != NULLPTR &&
+ if (value != nullptr &&
value->typeId() == static_cast<int8_t>(GeodeTypeIds::CacheableEnum)) {
- enumValPtr = dynCast<CacheableEnumPtr>(value);
+ enumValPtr = std::dynamic_pointer_cast<CacheableEnum>(value);
}
- if (enumValPtr != NULLPTR) {
+ if (enumValPtr != nullptr) {
enumValPtr->toData(*m_dataOutput);
} else {
- if (value != NULLPTR &&
+ if (value != nullptr &&
value->typeId() == GeodeTypeIds::CacheableObjectArray) {
- objArrPtr = dynCast<CacheableObjectArrayPtr>(value);
+ objArrPtr = std::dynamic_pointer_cast<CacheableObjectArray>(value);
m_dataOutput->write(
static_cast<int8_t>(GeodeTypeIds::CacheableObjectArray));
m_dataOutput->writeArrayLen(objArrPtr->length());
m_dataOutput->write(static_cast<int8_t>(GeodeTypeIdsImpl::Class));
_VectorOfCacheable::Iterator iter = objArrPtr->begin();
- PdxSerializablePtr actualObjPtr = dynCast<PdxSerializablePtr>(*iter);
+ PdxSerializablePtr actualObjPtr =
+ std::dynamic_pointer_cast<PdxSerializable>(*iter);
m_dataOutput->write(
static_cast<int8_t>(GeodeTypeIds::CacheableASCIIString));
@@ -416,81 +417,81 @@ PdxWriterPtr PdxLocalWriter::writeObject(const char* fieldName,
m_dataOutput->writeObject(value);
}
}
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxLocalWriter::writeBooleanArray(const char* fieldName,
bool* array, int length) {
addOffset();
writeObject(array, length);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxLocalWriter::writeCharArray(const char* fieldName, char* array,
int length) {
addOffset();
writePdxCharArray(array, length);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxLocalWriter::writeWideCharArray(const char* fieldName,
wchar_t* array, int length) {
addOffset();
writeObject(array, length);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxLocalWriter::writeByteArray(const char* fieldName,
int8_t* array, int length) {
addOffset();
writeObject(array, length);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxLocalWriter::writeShortArray(const char* fieldName,
int16_t* array, int length) {
addOffset();
writeObject(array, length);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxLocalWriter::writeIntArray(const char* fieldName,
int32_t* array, int length) {
addOffset();
writeObject(array, length);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxLocalWriter::writeLongArray(const char* fieldName,
int64_t* array, int length) {
addOffset();
writeObject(array, length);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxLocalWriter::writeFloatArray(const char* fieldName,
float* array, int length) {
addOffset();
writeObject(array, length);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxLocalWriter::writeDoubleArray(const char* fieldName,
double* array, int length) {
addOffset();
writeObject(array, length);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxLocalWriter::writeObjectArray(const char* fieldName,
CacheableObjectArrayPtr array) {
addOffset();
- if (array != NULLPTR) {
+ if (array != nullptr) {
array->toData(*m_dataOutput);
} else {
m_dataOutput->write(static_cast<int8_t>(-1));
}
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxLocalWriter::writeArrayOfByteArrays(const char* fieldName,
@@ -507,11 +508,11 @@ PdxWriterPtr PdxLocalWriter::writeArrayOfByteArrays(const char* fieldName,
m_dataOutput->write(static_cast<int8_t>(-1));
}
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxLocalWriter::markIdentityField(const char* fieldName) {
- return PdxWriterPtr(this);
+ return shared_from_this();
}
uint8_t* PdxLocalWriter::getPdxStream(int& pdxLen) {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/PdxLocalWriter.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxLocalWriter.hpp b/src/cppcache/src/PdxLocalWriter.hpp
index 705b169..bfaa86c 100644
--- a/src/cppcache/src/PdxLocalWriter.hpp
+++ b/src/cppcache/src/PdxLocalWriter.hpp
@@ -31,7 +31,8 @@ namespace apache {
namespace geode {
namespace client {
-class PdxLocalWriter : public PdxWriter {
+class PdxLocalWriter : public PdxWriter,
+ public std::enable_shared_from_this<PdxLocalWriter> {
protected:
DataOutput* m_dataOutput;
PdxTypePtr m_pdxType;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/PdxReaderWithTypeCollector.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxReaderWithTypeCollector.cpp b/src/cppcache/src/PdxReaderWithTypeCollector.cpp
index 630e542..e5c0821 100644
--- a/src/cppcache/src/PdxReaderWithTypeCollector.cpp
+++ b/src/cppcache/src/PdxReaderWithTypeCollector.cpp
@@ -34,7 +34,7 @@ PdxReaderWithTypeCollector::PdxReaderWithTypeCollector(DataInput& dataInput,
PdxTypePtr pdxType,
int32_t pdxlen)
: PdxLocalReader(dataInput, pdxType, pdxlen) {
- m_newPdxType = new PdxType(pdxType->getPdxClassName(), true);
+ m_newPdxType = std::make_shared<PdxType>(pdxType->getPdxClassName(), true);
}
PdxReaderWithTypeCollector::PdxReaderWithTypeCollector() {}
@@ -49,7 +49,7 @@ void PdxReaderWithTypeCollector::checkType(const char* fieldName, int8_t typeId,
}
PdxFieldTypePtr pft = m_pdxType->getPdxField(fieldName);
- if (pft != NULLPTR) {
+ if (pft != nullptr) {
if (typeId != pft->getTypeId()) {
char excpStr[128] = {0};
ACE_OS::snprintf(
@@ -288,7 +288,7 @@ SerializablePtr PdxReaderWithTypeCollector::readObject(const char* fieldName) {
startLoc = NULL;
return ptr;
} else {
- return NULLPTR;
+ return nullptr;
}
}
@@ -574,7 +574,7 @@ CacheableObjectArrayPtr PdxReaderWithTypeCollector::readObjectArray(
startLoc = NULL;
return retVal;
} else {
- return NULLPTR;
+ return nullptr;
}
}
@@ -615,7 +615,7 @@ CacheableDatePtr PdxReaderWithTypeCollector::readDate(const char* fieldName) {
m_dataInput->rewindCursor(position + PdxTypes::DATE_SIZE);
return retVal;
} else {
- return NULLPTR;
+ return nullptr;
}
}
@@ -635,7 +635,7 @@ void PdxReaderWithTypeCollector::readCollection(
PdxLocalReader::readCollection(fieldName, collection);
m_dataInput->rewindCursor(position);
} else {
- collection = NULLPTR;
+ collection = nullptr;
}
}
} // namespace client
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/PdxRemotePreservedData.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxRemotePreservedData.hpp b/src/cppcache/src/PdxRemotePreservedData.hpp
index 152bf7a..da15c5a 100644
--- a/src/cppcache/src/PdxRemotePreservedData.hpp
+++ b/src/cppcache/src/PdxRemotePreservedData.hpp
@@ -95,15 +95,15 @@ class PdxRemotePreservedData : public PdxUnreadFields {
}
virtual bool equals(SerializablePtr otherObject) {
- if (otherObject == NULLPTR) return false;
+ if (otherObject == nullptr) return false;
- if (m_owner == NULLPTR) return false;
+ if (m_owner == nullptr) return false;
return m_owner == otherObject;
}
virtual int GetHashCode() {
- if (m_owner != NULLPTR) {
+ if (m_owner != nullptr) {
// TODO
return 1; // m_owner->GetHashCode();
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/PdxRemoteReader.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxRemoteReader.cpp b/src/cppcache/src/PdxRemoteReader.cpp
index b085347..e28ab22 100644
--- a/src/cppcache/src/PdxRemoteReader.cpp
+++ b/src/cppcache/src/PdxRemoteReader.cpp
@@ -533,7 +533,7 @@ SerializablePtr PdxRemoteReader::readObject(const char* fieldName) {
return PdxLocalReader::readObject(fieldName); // in same order
}
case -1: {
- return NULLPTR;
+ return nullptr;
}
default: {
// sequence id read field and then update
@@ -547,7 +547,7 @@ SerializablePtr PdxRemoteReader::readObject(const char* fieldName) {
PdxLocalReader::resettoPdxHead();
return ptr;
} else {
- return NULLPTR; // null value
+ return nullptr; // null value
}
}
}
@@ -867,7 +867,7 @@ CacheableObjectArrayPtr PdxRemoteReader::readObjectArray(
case -2:
return PdxLocalReader::readObjectArray(fieldName); // in same order
case -1: {
- return NULLPTR; // null value
+ return nullptr; // null value
}
default: {
// sequence id read field and then update
@@ -915,7 +915,7 @@ CacheableDatePtr PdxRemoteReader::readDate(const char* fieldName) {
case -2:
return PdxLocalReader::readDate(fieldName); // in same order
case -1:
- return NULLPTR;
+ return nullptr;
default: {
// sequence id read field and then update
int position = m_pdxType->getFieldPosition(
@@ -1038,7 +1038,7 @@ void PdxRemoteReader::readCollection(const char* fieldName,
break;
}
case -1: {
- collection = NULLPTR;
+ collection = nullptr;
break; // null value
}
default: {
@@ -1051,7 +1051,7 @@ void PdxRemoteReader::readCollection(const char* fieldName,
PdxLocalReader::readCollection(fieldName, collection);
PdxLocalReader::resettoPdxHead();
} else {
- collection = NULLPTR;
+ collection = nullptr;
}
break;
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/PdxRemoteWriter.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxRemoteWriter.cpp b/src/cppcache/src/PdxRemoteWriter.cpp
index b1496ab..dd3f522 100644
--- a/src/cppcache/src/PdxRemoteWriter.cpp
+++ b/src/cppcache/src/PdxRemoteWriter.cpp
@@ -39,7 +39,7 @@ namespace client {
*/
PdxRemoteWriter::PdxRemoteWriter()
: m_preserveDataIdx(0), m_currentDataIdx(-1), m_remoteTolocalMapLength(0) {
- if (m_pdxType != NULLPTR) {
+ if (m_pdxType != nullptr) {
m_remoteTolocalMap =
m_pdxType->getRemoteToLocalMap(); // COVERITY --> 29286 Uninitialized
// pointer field
@@ -54,7 +54,7 @@ PdxRemoteWriter::PdxRemoteWriter(DataOutput& output, PdxTypePtr pdxType,
m_currentDataIdx(-1),
m_remoteTolocalMapLength(0) {
m_preserveData = preservedData;
- if (m_pdxType != NULLPTR) {
+ if (m_pdxType != nullptr) {
m_remoteTolocalMap = m_pdxType->getRemoteToLocalMap();
m_remoteTolocalMapLength = m_pdxType->getTotalFields();
}
@@ -64,12 +64,12 @@ PdxRemoteWriter::PdxRemoteWriter(DataOutput& output, PdxTypePtr pdxType,
}
PdxRemoteWriter::PdxRemoteWriter(DataOutput& output, const char* pdxClassName)
- : PdxLocalWriter(output, NULLPTR, pdxClassName),
+ : PdxLocalWriter(output, nullptr, pdxClassName),
m_preserveDataIdx(0),
m_currentDataIdx(-1),
m_remoteTolocalMapLength(0) {
- m_preserveData = NULLPTR;
- if (m_pdxType != NULLPTR) {
+ m_preserveData = nullptr;
+ if (m_pdxType != nullptr) {
m_remoteTolocalMapLength = m_pdxType->getTotalFields();
m_remoteTolocalMap =
m_pdxType->getRemoteToLocalMap(); // COVERITY --> 29285 Uninitialized
@@ -94,7 +94,7 @@ void PdxRemoteWriter::writePreserveData() {
LOGDEBUG("PdxRemoteWriter::writePreserveData m_remoteTolocalMap->Length = %d",
m_remoteTolocalMapLength);
- if (m_preserveData != NULLPTR) {
+ if (m_preserveData != nullptr) {
while (m_currentDataIdx < m_remoteTolocalMapLength) {
if (m_remoteTolocalMap[m_currentDataIdx] ==
-1) // need to add preserve data with offset
@@ -129,7 +129,7 @@ void PdxRemoteWriter::writePreserveData() {
void PdxRemoteWriter::initialize() {
// this is default case
- if (m_preserveData == NULLPTR) {
+ if (m_preserveData == nullptr) {
m_pdxType = PdxTypeRegistry::getLocalPdxType(m_pdxClassName);
}
}
@@ -143,90 +143,90 @@ PdxWriterPtr PdxRemoteWriter::writeUnreadFields(PdxUnreadFieldsPtr unread) {
PdxLocalWriter::writeUnreadFields(unread);
m_remoteTolocalMap = m_pdxType->getRemoteToLocalMap();
m_remoteTolocalMapLength = m_pdxType->getTotalFields();
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxRemoteWriter::writeChar(const char* fieldName, char value) {
writePreserveData();
PdxLocalWriter::writeChar(fieldName, value);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxRemoteWriter::writeWideChar(const char* fieldName,
wchar_t value) {
writePreserveData();
PdxLocalWriter::writeWideChar(fieldName, value);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxRemoteWriter::writeBoolean(const char* fieldName, bool value) {
writePreserveData();
PdxLocalWriter::writeBoolean(fieldName, value);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxRemoteWriter::writeByte(const char* fieldName, int8_t value) {
writePreserveData();
PdxLocalWriter::writeByte(fieldName, value);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxRemoteWriter::writeShort(const char* fieldName, int16_t value) {
writePreserveData();
PdxLocalWriter::writeShort(fieldName, value);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxRemoteWriter::writeInt(const char* fieldName, int32_t value) {
writePreserveData();
PdxLocalWriter::writeInt(fieldName, value);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxRemoteWriter::writeLong(const char* fieldName, int64_t value) {
writePreserveData();
PdxLocalWriter::writeLong(fieldName, value);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxRemoteWriter::writeFloat(const char* fieldName, float value) {
writePreserveData();
PdxLocalWriter::writeFloat(fieldName, value);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxRemoteWriter::writeDouble(const char* fieldName, double value) {
writePreserveData();
PdxLocalWriter::writeDouble(fieldName, value);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxRemoteWriter::writeDate(const char* fieldName,
CacheableDatePtr date) {
writePreserveData();
PdxLocalWriter::writeDate(fieldName, date);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxRemoteWriter::writeString(const char* fieldName,
const char* value) {
writePreserveData();
PdxLocalWriter::writeString(fieldName, value);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxRemoteWriter::writeWideString(const char* fieldName,
const wchar_t* value) {
writePreserveData();
PdxLocalWriter::writeWideString(fieldName, value);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxRemoteWriter::writeStringArray(const char* fieldName,
char** array, int length) {
writePreserveData();
PdxLocalWriter::writeStringArray(fieldName, array, length);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxRemoteWriter::writeWideStringArray(const char* fieldName,
@@ -234,84 +234,84 @@ PdxWriterPtr PdxRemoteWriter::writeWideStringArray(const char* fieldName,
int length) {
writePreserveData();
PdxLocalWriter::writeWideStringArray(fieldName, array, length);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxRemoteWriter::writeObject(const char* fieldName,
SerializablePtr value) {
writePreserveData();
PdxLocalWriter::writeObject(fieldName, value);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxRemoteWriter::writeBooleanArray(const char* fieldName,
bool* array, int length) {
writePreserveData();
PdxLocalWriter::writeBooleanArray(fieldName, array, length);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxRemoteWriter::writeCharArray(const char* fieldName, char* array,
int length) {
writePreserveData();
PdxLocalWriter::writeCharArray(fieldName, array, length);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxRemoteWriter::writeWideCharArray(const char* fieldName,
wchar_t* array, int length) {
writePreserveData();
PdxLocalWriter::writeWideCharArray(fieldName, array, length);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxRemoteWriter::writeByteArray(const char* fieldName,
int8_t* array, int length) {
writePreserveData();
PdxLocalWriter::writeByteArray(fieldName, array, length);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxRemoteWriter::writeShortArray(const char* fieldName,
int16_t* array, int length) {
writePreserveData();
PdxLocalWriter::writeShortArray(fieldName, array, length);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxRemoteWriter::writeIntArray(const char* fieldName,
int32_t* array, int length) {
writePreserveData();
PdxLocalWriter::writeIntArray(fieldName, array, length);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxRemoteWriter::writeLongArray(const char* fieldName,
int64_t* array, int length) {
writePreserveData();
PdxLocalWriter::writeLongArray(fieldName, array, length);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxRemoteWriter::writeFloatArray(const char* fieldName,
float* array, int length) {
writePreserveData();
PdxLocalWriter::writeFloatArray(fieldName, array, length);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxRemoteWriter::writeDoubleArray(const char* fieldName,
double* array, int length) {
writePreserveData();
PdxLocalWriter::writeDoubleArray(fieldName, array, length);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxRemoteWriter::writeObjectArray(const char* fieldName,
CacheableObjectArrayPtr array) {
writePreserveData();
PdxLocalWriter::writeObjectArray(fieldName, array);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxRemoteWriter::writeArrayOfByteArrays(const char* fieldName,
@@ -321,7 +321,7 @@ PdxWriterPtr PdxRemoteWriter::writeArrayOfByteArrays(const char* fieldName,
writePreserveData();
PdxLocalWriter::writeArrayOfByteArrays(fieldName, byteArrays, arrayLength,
elementLength);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
} // namespace client
} // namespace geode
[27/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from cppcache
Posted by jb...@apache.org.
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&);
[10/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from cppcache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/CqAttributesMutatorImpl.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CqAttributesMutatorImpl.cpp b/src/cppcache/src/CqAttributesMutatorImpl.cpp
index 737ae6c..4af8a3e 100644
--- a/src/cppcache/src/CqAttributesMutatorImpl.cpp
+++ b/src/cppcache/src/CqAttributesMutatorImpl.cpp
@@ -18,24 +18,20 @@
#include "CqAttributesImpl.hpp"
using namespace apache::geode::client;
CqAttributesMutatorImpl::CqAttributesMutatorImpl(const CqAttributesPtr& impl)
- : m_cqAttributes(const_cast<CqAttributes*>(impl.ptr())) {}
+ : m_cqAttributes(impl) {}
void CqAttributesMutatorImpl::addCqListener(const CqListenerPtr& aListener) {
- CqAttributesImpl* cqImpl =
- dynamic_cast<CqAttributesImpl*>(m_cqAttributes.ptr());
- CqListenerPtr listener = dynCast<CqListenerPtr>(aListener);
- cqImpl->addCqListener(listener);
+ std::static_pointer_cast<CqAttributesImpl>(m_cqAttributes)
+ ->addCqListener(aListener);
}
void CqAttributesMutatorImpl::removeCqListener(const CqListenerPtr& aListener) {
- CqAttributesImpl* cqImpl =
- dynamic_cast<CqAttributesImpl*>(m_cqAttributes.ptr());
- CqListenerPtr listener = dynCast<CqListenerPtr>(aListener);
- cqImpl->removeCqListener(listener);
+ std::static_pointer_cast<CqAttributesImpl>(m_cqAttributes)
+ ->removeCqListener(aListener);
}
-void CqAttributesMutatorImpl::setCqListeners(VectorOfCqListener& newListeners) {
- CqAttributesImpl* cqImpl =
- dynamic_cast<CqAttributesImpl*>(m_cqAttributes.ptr());
- cqImpl->setCqListeners(newListeners);
+void CqAttributesMutatorImpl::setCqListeners(
+ const CqAttributesImpl::listener_container_type& newListeners) {
+ std::static_pointer_cast<CqAttributesImpl>(m_cqAttributes)
+ ->setCqListeners(newListeners);
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/CqAttributesMutatorImpl.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CqAttributesMutatorImpl.hpp b/src/cppcache/src/CqAttributesMutatorImpl.hpp
index 7a97ecf..389f93b 100644
--- a/src/cppcache/src/CqAttributesMutatorImpl.hpp
+++ b/src/cppcache/src/CqAttributesMutatorImpl.hpp
@@ -73,7 +73,7 @@ class CPPCACHE_EXPORT CqAttributesMutatorImpl : public CqAttributesMutator {
* @throws IllegalArgumentException if the <code>newListeners</code> array
* has a null element
*/
- void setCqListeners(VectorOfCqListener& newListeners);
+ void setCqListeners(const std::vector<CqListenerPtr>& newListeners);
private:
CqAttributesPtr m_cqAttributes;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/CqEventImpl.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CqEventImpl.cpp b/src/cppcache/src/CqEventImpl.cpp
index 4d94f93..4485cb9 100644
--- a/src/cppcache/src/CqEventImpl.cpp
+++ b/src/cppcache/src/CqEventImpl.cpp
@@ -64,7 +64,7 @@ CacheableKeyPtr CqEventImpl::getKey() const { return m_key; }
* return null.
*/
CacheablePtr CqEventImpl::getNewValue() const {
- if (m_deltaValue == NULLPTR) {
+ if (m_deltaValue == nullptr) {
return m_newValue;
} else {
// Get full object for delta
@@ -78,7 +78,7 @@ CacheablePtr CqEventImpl::getNewValue() const {
err = static_cast<ThinClientCacheDistributionManager*>(m_tcrdm)
->sendRequestToPrimary(fullObjectMsg, reply);
}
- CacheablePtr fullObject = NULLPTR;
+ CacheablePtr fullObject = nullptr;
if (err == GF_NOERR) {
fullObject = reply.getValue();
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/CqQueryImpl.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CqQueryImpl.cpp b/src/cppcache/src/CqQueryImpl.cpp
index e88e485..b221f95 100644
--- a/src/cppcache/src/CqQueryImpl.cpp
+++ b/src/cppcache/src/CqQueryImpl.cpp
@@ -27,10 +27,12 @@
#include "ThinClientRegion.hpp"
using namespace apache::geode::client;
-CqQueryImpl::CqQueryImpl(CqServicePtr& cqService, std::string& cqName,
- std::string& queryString,
- CqAttributesPtr& cqAttributes, bool isDurable,
- UserAttributesPtr userAttributesPtr)
+CqQueryImpl::CqQueryImpl(const CqServicePtr& cqService,
+ const std::string& cqName,
+ const std::string& queryString,
+ const CqAttributesPtr& cqAttributes,
+ const bool isDurable,
+ const UserAttributesPtr& userAttributesPtr)
: m_cqName(cqName),
m_queryString(queryString),
m_cqService(cqService),
@@ -47,11 +49,11 @@ CqQueryImpl::CqQueryImpl(CqServicePtr& cqService, std::string& cqName,
CqAttributesFactory cqAf(cqAttributes);
m_cqAttributes = cqAf.create();
m_cqAttributesMutator =
- new CqAttributesMutatorImpl(CqAttributesPtr(m_cqAttributes));
- if (userAttributesPtr != NULLPTR) {
+ std::make_shared<CqAttributesMutatorImpl>(m_cqAttributes);
+ if (userAttributesPtr != nullptr) {
m_proxyCache = userAttributesPtr->getProxyCache();
} else {
- m_proxyCache = NULLPTR;
+ m_proxyCache = nullptr;
}
}
@@ -80,7 +82,7 @@ void CqQueryImpl::initCq() {
// Initialize the VSD statistics
// Update statistics with CQ creation.
- CqServiceVsdStats& stats = m_cqService->getCqServiceVsdStats();
+ auto& stats = m_cqService->getCqServiceVsdStats();
// stats.incNumCqsStopped();
stats.incNumCqsCreated();
// stats.incNumCqsOnClient();
@@ -110,7 +112,7 @@ void CqQueryImpl::close(bool sendRequestToServer) {
}
GuardUserAttribures gua;
- if (m_proxyCache != NULLPTR) {
+ if (m_proxyCache != nullptr) {
gua.setProxyCache(m_proxyCache);
}
LOGFINE("Started closing CQ CqName : %s", m_cqName.c_str());
@@ -118,7 +120,7 @@ void CqQueryImpl::close(bool sendRequestToServer) {
// bool isClosed = false;
// Stat update.
- CqServiceVsdStats& stats = m_cqService->getCqServiceVsdStats();
+ auto& stats = m_cqService->getCqServiceVsdStats();
/*
if (isRunning()) {
stats.decNumCqsActive();
@@ -141,19 +143,19 @@ void CqQueryImpl::close(bool sendRequestToServer) {
stats.incNumCqsClosed();
// Invoke close on Listeners if any.
- if (m_cqAttributes != NULLPTR) {
- VectorOfCqListener cqListeners;
+ if (m_cqAttributes) {
+ CqAttributes::listener_container_type cqListeners;
m_cqAttributes->getCqListeners(cqListeners);
if (!cqListeners.empty()) {
LOGFINE(
"Invoking CqListeners close() api for the CQ, CqName : %s Number of "
"CqListeners : %d",
- m_cqName.c_str(), cqListeners.length());
+ m_cqName.c_str(), cqListeners.size());
- for (int32_t lCnt = 0; lCnt < cqListeners.length(); lCnt++) {
+ for (auto& l : cqListeners) {
try {
- cqListeners[lCnt]->close();
+ l->close();
// Handle client side exceptions.
} catch (Exception& ex) {
LOGWARN(
@@ -179,7 +181,7 @@ void CqQueryImpl::addToCqMap() {
try {
LOGFINE("Adding to CQ Repository. CqName : %s Server CqName : %s",
m_cqName.c_str(), m_serverCqName.c_str());
- CqQueryPtr cq(this);
+ CqQueryPtr cq = shared_from_this();
m_cqService->addCq(m_cqName, cq);
} catch (Exception& ex) {
std::string errMsg =
@@ -239,7 +241,8 @@ void CqQueryImpl::cleanup() { removeFromCqMap(); }
/**
* @return Returns the cqListeners.
*/
-void CqQueryImpl::getCqListeners(VectorOfCqListener& cqListener) {
+void CqQueryImpl::getCqListeners(
+ CqAttributes::listener_container_type& cqListener) {
m_cqAttributes->getCqListeners(cqListener);
}
@@ -250,7 +253,7 @@ GfErrType CqQueryImpl::execute(TcrEndpoint* endpoint) {
}
GuardUserAttribures gua;
- if (m_proxyCache != NULLPTR) {
+ if (m_proxyCache != nullptr) {
gua.setProxyCache(m_proxyCache);
}
@@ -299,7 +302,7 @@ void CqQueryImpl::executeAfterFailover() {
void CqQueryImpl::execute() {
GuardUserAttribures gua;
- if (m_proxyCache != NULLPTR) {
+ if (m_proxyCache != nullptr) {
gua.setProxyCache(m_proxyCache);
}
@@ -312,10 +315,11 @@ void CqQueryImpl::execute() {
}
executeCq(TcrMessage::EXECUTECQ_MSG_TYPE);
}
+
// for EXECUTE_REQUEST or REDUNDANT_EXECUTE_REQUEST
bool CqQueryImpl::executeCq(TcrMessage::MsgType requestType) {
GuardUserAttribures gua;
- if (m_proxyCache != NULLPTR) {
+ if (m_proxyCache != nullptr) {
gua.setProxyCache(m_proxyCache);
}
@@ -351,7 +355,7 @@ bool CqQueryImpl::executeCq(TcrMessage::MsgType requestType) {
// for EXECUTE_INITIAL_RESULTS_REQUEST :
CqResultsPtr CqQueryImpl::executeWithInitialResults(uint32_t timeout) {
GuardUserAttribures gua;
- if (m_proxyCache != NULLPTR) {
+ if (m_proxyCache != nullptr) {
gua.setProxyCache(m_proxyCache);
}
@@ -367,7 +371,7 @@ CqResultsPtr CqQueryImpl::executeWithInitialResults(uint32_t timeout) {
TcrMessageExecuteCqWithIr msg(m_cqName, m_queryString, CqState::RUNNING,
isDurable(), m_tccdm);
TcrMessageReply reply(true, m_tccdm);
- ChunkedQueryResponse* resultCollector = (new ChunkedQueryResponse(reply));
+ auto resultCollector = (new ChunkedQueryResponse(reply));
reply.setChunkedResultHandler(
static_cast<TcrChunkedResult*>(resultCollector));
reply.setTimeout(timeout);
@@ -395,14 +399,15 @@ CqResultsPtr CqQueryImpl::executeWithInitialResults(uint32_t timeout) {
m_cqState = CqState::RUNNING;
updateStats();
CqResultsPtr sr;
- CacheableVectorPtr values = resultCollector->getQueryResults();
+ auto values = resultCollector->getQueryResults();
const std::vector<CacheableStringPtr>& fieldNameVec =
resultCollector->getStructFieldNames();
int32_t sizeOfFieldNamesVec = static_cast<int32_t>(fieldNameVec.size());
if (sizeOfFieldNamesVec == 0) {
LOGFINEST("Query::execute: creating ResultSet for query: %s",
m_queryString.c_str());
- sr = new ResultSetImpl(values);
+ sr = std::dynamic_pointer_cast<CqResults>(
+ std::make_shared<ResultSetImpl>(values));
} else {
if (values->size() % fieldNameVec.size() != 0) {
throw MessageException(
@@ -411,7 +416,8 @@ CqResultsPtr CqQueryImpl::executeWithInitialResults(uint32_t timeout) {
} else {
LOGFINEST("Query::execute: creating StructSet for query: %s",
m_queryString.c_str());
- sr = new StructSetImpl(values, fieldNameVec);
+ sr = std::dynamic_pointer_cast<CqResults>(
+ std::make_shared<StructSetImpl>(values, fieldNameVec));
}
}
delete resultCollector;
@@ -427,7 +433,7 @@ void CqQueryImpl::stop() {
}
GuardUserAttribures gua;
- if (m_proxyCache != NULLPTR) {
+ if (m_proxyCache != nullptr) {
gua.setProxyCache(m_proxyCache);
}
@@ -517,7 +523,7 @@ void CqQueryImpl::setCqOperation(CqOperation::CqOperationType cqOperation) {
* @param cqEvent object
*/
void CqQueryImpl::updateStats(CqEvent& cqEvent) {
- CqQueryVsdStats* stats = dynamic_cast<CqQueryVsdStats*>(m_stats.ptr());
+ auto stats = std::static_pointer_cast<CqQueryVsdStats>(m_stats);
stats->incNumEvents();
switch (cqEvent.getQueryOperation()) {
case CqOperation::OP_TYPE_CREATE:
@@ -550,7 +556,7 @@ bool CqQueryImpl::isRunning() {
bool CqQueryImpl::isStopped() {
ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
return m_cqState == CqState::STOPPED ||
- (m_proxyCache != NULLPTR && m_proxyCache->isClosed());
+ (m_proxyCache && m_proxyCache->isClosed());
}
/**
@@ -560,7 +566,7 @@ bool CqQueryImpl::isStopped() {
bool CqQueryImpl::isClosed() {
ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
return m_cqState == CqState::CLOSED ||
- (m_proxyCache != NULLPTR && m_proxyCache->isClosed());
+ (m_proxyCache && m_proxyCache->isClosed());
}
/**
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/CqQueryImpl.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CqQueryImpl.hpp b/src/cppcache/src/CqQueryImpl.hpp
index 1895f32..a4fcd04 100644
--- a/src/cppcache/src/CqQueryImpl.hpp
+++ b/src/cppcache/src/CqQueryImpl.hpp
@@ -54,7 +54,8 @@ namespace client {
* Represents the CqQuery object. Implements CqQuery API and CqAttributeMutator.
*
*/
-class CqQueryImpl : public CqQuery {
+class CqQueryImpl : public CqQuery,
+ public std::enable_shared_from_this<CqQueryImpl> {
protected:
std::string m_cqName;
std::string m_queryString;
@@ -91,10 +92,10 @@ class CqQueryImpl : public CqQuery {
* Constructor.
*/
public:
- CqQueryImpl(CqServicePtr& cqService, std::string& cqName,
- std::string& queryString, CqAttributesPtr& cqAttributes,
- bool isDurable = false,
- UserAttributesPtr userAttributesPtr = NULLPTR);
+ CqQueryImpl(const CqServicePtr& cqService, const std::string& cqName,
+ const std::string& queryString,
+ const CqAttributesPtr& cqAttributes, const bool isDurable = false,
+ const UserAttributesPtr& userAttributesPtr = nullptr);
~CqQueryImpl();
@@ -160,7 +161,7 @@ class CqQueryImpl : public CqQuery {
const CqStatisticsPtr getStatistics() const;
CqQueryVsdStats& getVsdStats() {
- return *dynamic_cast<CqQueryVsdStats*>(m_stats.ptr());
+ return *dynamic_cast<CqQueryVsdStats*>(m_stats.get());
}
const CqAttributesPtr getCqAttributes() const;
@@ -176,7 +177,7 @@ class CqQueryImpl : public CqQuery {
/**
* @return Returns the cqListeners.
*/
- void getCqListeners(VectorOfCqListener& cqListener);
+ void getCqListeners(std::vector<CqListenerPtr>& cqListener);
/**
* Start or resume executing the query.
@@ -270,6 +271,8 @@ class CqQueryImpl : public CqQuery {
void sendStopOrClose(TcrMessage::MsgType requestType);
ThinClientBaseDM* m_tccdm;
ProxyCachePtr m_proxyCache;
+
+ FRIEND_STD_SHARED_PTR(CqQueryImpl)
};
} // namespace client
} // namespace geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/CqService.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CqService.cpp b/src/cppcache/src/CqService.cpp
index 213d72d..d634e47 100644
--- a/src/cppcache/src/CqService.cpp
+++ b/src/cppcache/src/CqService.cpp
@@ -27,7 +27,9 @@
using namespace apache::geode::client;
CqService::CqService(ThinClientBaseDM* tccdm)
- : m_tccdm(tccdm), m_notificationSema(1), m_stats(new CqServiceVsdStats()) {
+ : m_tccdm(tccdm),
+ m_notificationSema(1),
+ m_stats(std::make_shared<CqServiceVsdStats>()) {
m_cqQueryMap = new MapOfCqQueryWithLock();
m_running = true;
LOGDEBUG("CqService Started");
@@ -38,7 +40,7 @@ CqService::~CqService() {
}
void CqService::updateStats() {
- CqServiceVsdStats* stats = dynamic_cast<CqServiceVsdStats*>(m_stats.ptr());
+ auto stats = std::dynamic_pointer_cast<CqServiceVsdStats>(m_stats);
stats->setNumCqsActive(0);
stats->setNumCqsStopped(0);
@@ -49,9 +51,8 @@ void CqService::updateStats() {
if (m_cqQueryMap->current_size() == 0) return;
- for (MapOfCqQueryWithLock::iterator q = m_cqQueryMap->begin();
- q != m_cqQueryMap->end(); ++q) {
- CqQueryPtr cquery = ((*q).int_id_);
+ for (auto q = m_cqQueryMap->begin(); q != m_cqQueryMap->end(); ++q) {
+ auto cquery = ((*q).int_id_);
switch (cquery->getState()) {
case CqState::RUNNING:
stats->incNumCqsActive();
@@ -78,16 +79,18 @@ bool CqService::checkAndAcquireLock() {
}
}
-CqQueryPtr CqService::newCq(std::string& cqName, std::string& queryString,
- CqAttributesPtr& cqAttributes, bool isDurable) {
+CqQueryPtr CqService::newCq(const std::string& cqName,
+ const std::string& queryString,
+ const CqAttributesPtr& cqAttributes,
+ bool isDurable) {
if (queryString.empty()) {
throw IllegalArgumentException("Null queryString is passed. ");
- } else if (cqAttributes == NULLPTR) {
+ } else if (cqAttributes == nullptr) {
throw IllegalArgumentException("Null cqAttribute is passed. ");
}
// Check if the subscription is enabled on the pool
- ThinClientPoolDM* pool = dynamic_cast<ThinClientPoolDM*>(m_tccdm);
+ auto pool = dynamic_cast<ThinClientPoolDM*>(m_tccdm);
if (pool != NULL && !pool->getSubscriptionEnabled()) {
LOGERROR(
"Cannot create CQ because subscription is not enabled on the pool.");
@@ -97,10 +100,10 @@ CqQueryPtr CqService::newCq(std::string& cqName, std::string& queryString,
// check for durable client
if (isDurable) {
- SystemProperties* sysProps = DistributedSystem::getSystemProperties();
- const char* durableID =
- (sysProps != NULL) ? sysProps->durableClientId() : NULL;
- if (durableID == NULL || strlen(durableID) == 0) {
+ auto sysProps = DistributedSystem::getSystemProperties();
+ const auto durableID =
+ (sysProps != nullptr) ? sysProps->durableClientId() : nullptr;
+ if (durableID == nullptr || strlen(durableID) == 0) {
LOGERROR("Cannot create durable CQ because client is not durable.");
throw IllegalStateException(
"Cannot create durable CQ because client is not durable.");
@@ -113,25 +116,22 @@ CqQueryPtr CqService::newCq(std::string& cqName, std::string& queryString,
("CQ with the given name already exists. CqName : " + cqName).c_str());
}
- UserAttributesPtr ua;
- ua = NULLPTR;
+ UserAttributesPtr ua = nullptr;
if (m_tccdm != NULL && m_tccdm->isMultiUserMode()) {
ua =
TSSUserAttributesWrapper::s_geodeTSSUserAttributes->getUserAttributes();
}
- CqServicePtr cqs(this);
- CqQueryImpl* cQuery =
- new CqQueryImpl(cqs, cqName, queryString, cqAttributes, isDurable, ua);
+ auto cQuery = std::make_shared<CqQueryImpl>(
+ shared_from_this(), cqName, queryString, cqAttributes, isDurable, ua);
cQuery->initCq();
- CqQueryPtr ptr(cQuery);
- return ptr;
+ return cQuery;
}
/**
* Adds the given CQ and cqQuery object into the CQ map.
*/
-void CqService::addCq(std::string& cqName, CqQueryPtr& cq) {
+void CqService::addCq(const std::string& cqName, CqQueryPtr& cq) {
try {
MapOfRegionGuard guard(m_cqQueryMap->mutex());
CqQueryPtr tmp;
@@ -147,7 +147,7 @@ void CqService::addCq(std::string& cqName, CqQueryPtr& cq) {
/**
* Removes given CQ from the cqMap..
*/
-void CqService::removeCq(std::string& cqName) {
+void CqService::removeCq(const std::string& cqName) {
try {
MapOfRegionGuard guard(m_cqQueryMap->mutex());
m_cqQueryMap->unbind(cqName);
@@ -160,7 +160,7 @@ void CqService::removeCq(std::string& cqName) {
* Retrieve a CqQuery by name.
* @return the CqQuery or null if not found
*/
-CqQueryPtr CqService::getCq(std::string& cqName) {
+CqQueryPtr CqService::getCq(const std::string& cqName) {
MapOfRegionGuard guard(m_cqQueryMap->mutex());
CqQueryPtr tmp;
if (0 != m_cqQueryMap->find(cqName, tmp)) {
@@ -168,7 +168,7 @@ CqQueryPtr CqService::getCq(std::string& cqName) {
} else {
return tmp;
}
- return NULLPTR;
+ return nullptr;
}
/**
@@ -187,14 +187,13 @@ void CqService::clearCqQueryMap() {
/**
* Retrieve all registered CQs
*/
-void CqService::getAllCqs(VectorOfCqQuery& cqVec) {
+void CqService::getAllCqs(query_container_type& cqVec) {
cqVec.clear();
MapOfRegionGuard guard(m_cqQueryMap->mutex());
if (m_cqQueryMap->current_size() == 0) return;
cqVec.reserve(static_cast<int32_t>(m_cqQueryMap->current_size()));
- for (MapOfCqQueryWithLock::iterator q = m_cqQueryMap->begin();
- q != m_cqQueryMap->end(); ++q) {
- cqVec.push_back((*q).int_id_);
+ for (auto& q : *m_cqQueryMap) {
+ cqVec.push_back(q.int_id_);
}
}
@@ -203,7 +202,7 @@ void CqService::getAllCqs(VectorOfCqQuery& cqVec) {
*/
void CqService::executeAllClientCqs(bool afterFailover) {
// ACE_Guard< ACE_Recursive_Thread_Mutex > _guard( m_mutex );
- VectorOfCqQuery cqVec;
+ query_container_type cqVec;
getAllCqs(cqVec);
// MapOfRegionGuard guard( m_cqQueryMap->mutex() );
executeCqs(cqVec, afterFailover);
@@ -213,7 +212,7 @@ void CqService::executeAllClientCqs(bool afterFailover) {
* Executes all CQs on the specified endpoint after failover.
*/
GfErrType CqService::executeAllClientCqs(TcrEndpoint* endpoint) {
- VectorOfCqQuery cqVec;
+ query_container_type cqVec;
getAllCqs(cqVec);
return executeCqs(cqVec, endpoint);
}
@@ -221,7 +220,8 @@ GfErrType CqService::executeAllClientCqs(TcrEndpoint* endpoint) {
/**
* Executes all the given cqs on the specified endpoint after failover.
*/
-GfErrType CqService::executeCqs(VectorOfCqQuery& cqs, TcrEndpoint* endpoint) {
+GfErrType CqService::executeCqs(query_container_type& cqs,
+ TcrEndpoint* endpoint) {
if (cqs.empty()) {
return GF_NOERR;
}
@@ -229,11 +229,9 @@ GfErrType CqService::executeCqs(VectorOfCqQuery& cqs, TcrEndpoint* endpoint) {
GfErrType err = GF_NOERR;
GfErrType opErr = GF_NOERR;
- for (int32_t cqCnt = 0; cqCnt < cqs.length(); cqCnt++) {
- CqQueryPtr cq = cqs[cqCnt];
- CqQueryImpl* cQueryImpl = static_cast<CqQueryImpl*>(cq.ptr());
+ for (auto& cq : cqs) {
if (!cq->isClosed() && cq->isRunning()) {
- opErr = cQueryImpl->execute(endpoint);
+ opErr = std::static_pointer_cast<CqQueryImpl>(cq)->execute(endpoint);
if (err == GF_NOERR) {
err = opErr;
}
@@ -245,20 +243,18 @@ GfErrType CqService::executeCqs(VectorOfCqQuery& cqs, TcrEndpoint* endpoint) {
/**
* Executes all the given cqs.
*/
-void CqService::executeCqs(VectorOfCqQuery& cqs, bool afterFailover) {
+void CqService::executeCqs(query_container_type& cqs, bool afterFailover) {
if (cqs.empty()) {
return;
}
std::string cqName;
- for (int32_t cqCnt = 0; cqCnt < cqs.length(); cqCnt++) {
- CqQueryPtr cq = cqs[cqCnt];
- CqQueryImpl* cQueryImpl = dynamic_cast<CqQueryImpl*>(cq.ptr());
+ for (auto& cq : cqs) {
if (!cq->isClosed() &&
(cq->isStopped() || (cq->isRunning() && afterFailover))) {
try {
cqName = cq->getName();
if (afterFailover) {
- cQueryImpl->executeAfterFailover();
+ std::static_pointer_cast<CqQueryImpl>(cq)->executeAfterFailover();
} else {
cq->execute();
}
@@ -279,7 +275,7 @@ void CqService::executeCqs(VectorOfCqQuery& cqs, bool afterFailover) {
* Stops all the cqs
*/
void CqService::stopAllClientCqs() {
- VectorOfCqQuery cqVec;
+ query_container_type cqVec;
getAllCqs(cqVec);
// MapOfRegionGuard guard( m_cqQueryMap->mutex() );
stopCqs(cqVec);
@@ -288,14 +284,13 @@ void CqService::stopAllClientCqs() {
/**
* Stops all the specified cqs.
*/
-void CqService::stopCqs(VectorOfCqQuery& cqs) {
+void CqService::stopCqs(query_container_type& cqs) {
if (cqs.empty()) {
return;
}
std::string cqName;
- for (int32_t cqCnt = 0; cqCnt < cqs.length(); cqCnt++) {
- CqQueryPtr cq = cqs[cqCnt];
+ for (auto cq : cqs) {
if (!cq->isClosed() && cq->isRunning()) {
try {
cqName = cq->getName();
@@ -313,21 +308,21 @@ void CqService::stopCqs(VectorOfCqQuery& cqs) {
}
}
-void CqService::closeCqs(VectorOfCqQuery& cqs) {
+void CqService::closeCqs(query_container_type& cqs) {
LOGDEBUG("closeCqs() TcrMessage::isKeepAlive() = %d ",
TcrMessage::isKeepAlive());
if (!cqs.empty()) {
std::string cqName;
- for (int32_t cqCnt = 0; cqCnt < cqs.length(); cqCnt++) {
+ for (auto& cq : cqs) {
try {
- CqQueryImpl* cq = dynamic_cast<CqQueryImpl*>(cqs[cqCnt].ptr());
- cqName = cq->getName();
+ auto cqi = std::static_pointer_cast<CqQueryImpl>(cq);
+ cqName = cqi->getName();
LOGDEBUG("closeCqs() cqname = %s isDurable = %d ", cqName.c_str(),
- cq->isDurable());
- if (!(cq->isDurable() && TcrMessage::isKeepAlive())) {
- cq->close(true);
+ cqi->isDurable());
+ if (!(cqi->isDurable() && TcrMessage::isKeepAlive())) {
+ cqi->close(true);
} else {
- cq->close(false);
+ cqi->close(false);
}
} catch (QueryException& qe) {
Log::fine(("Failed to close the CQ, CqName : " + cqName + " Error : " +
@@ -362,7 +357,7 @@ void CqService::closeCqService() {
}
void CqService::closeAllCqs() {
Log::fine("closeAllCqs()");
- VectorOfCqQuery cqVec;
+ query_container_type cqVec;
getAllCqs(cqVec);
Log::fine("closeAllCqs() 1");
MapOfRegionGuard guard(m_cqQueryMap->mutex());
@@ -389,7 +384,7 @@ void CqService::cleanup() {
* @param cqName name of the CQ.
* @return true if exists else false.
*/
-bool CqService::isCqExists(std::string& cqName) {
+bool CqService::isCqExists(const std::string& cqName) {
bool status = false;
try {
MapOfRegionGuard guard(m_cqQueryMap->mutex());
@@ -421,21 +416,18 @@ void CqService::invokeCqListeners(const std::map<std::string, int>* cqs,
CacheableBytesPtr deltaValue,
EventIdPtr eventId) {
LOGDEBUG("CqService::invokeCqListeners");
- CqQueryPtr cQuery;
- CqQueryImpl* cQueryImpl;
- for (std::map<std::string, int>::const_iterator iter = cqs->begin();
- iter != cqs->end(); ++iter) {
- std::string cqName = iter->first;
- cQuery = getCq(cqName);
- cQueryImpl = dynamic_cast<CqQueryImpl*>(cQuery.ptr());
- if (cQueryImpl == NULL || !cQueryImpl->isRunning()) {
+ for (const auto& kv : *cqs) {
+ const auto cqName = kv.first;
+ auto cQuery = getCq(cqName);
+ auto cQueryImpl = std::dynamic_pointer_cast<CqQueryImpl>(cQuery);
+ if (!(cQueryImpl && cQueryImpl->isRunning())) {
LOGFINE("Unable to invoke CqListener, %s, CqName: %s",
- (cQueryImpl == NULL) ? "CQ not found" : "CQ is Not running",
+ cQueryImpl ? "CQ not found" : "CQ is Not running",
cqName.c_str());
continue;
}
- int cqOp = iter->second;
+ const auto cqOp = kv.second;
// If Region destroy event, close the cq.
if (cqOp == TcrMessage::DESTROY_REGION) {
@@ -450,7 +442,7 @@ void CqService::invokeCqListeners(const std::map<std::string, int>* cqs,
}
// Construct CqEvent.
- CqEventImpl* cqEvent =
+ auto cqEvent =
new CqEventImpl(cQuery, getOperation(messageType), getOperation(cqOp),
key, value, m_tccdm, deltaValue, eventId);
@@ -458,7 +450,7 @@ void CqService::invokeCqListeners(const std::map<std::string, int>* cqs,
cQueryImpl->updateStats(*cqEvent);
// invoke CQ Listeners.
- VectorOfCqListener cqListeners;
+ CqAttributes::listener_container_type cqListeners;
cQueryImpl->getCqAttributes()->getCqListeners(cqListeners);
/*
Log::fine(("Invoking CqListeners for the CQ, CqName : " + cqName +
@@ -466,15 +458,15 @@ void CqService::invokeCqListeners(const std::map<std::string, int>* cqs,
cqEvent);
*/
- for (int32_t lCnt = 0; lCnt < cqListeners.length(); lCnt++) {
+ for (auto l : cqListeners) {
try {
// Check if the listener is not null, it could have been changed/reset
// by the CqAttributeMutator.
- if (cqListeners[lCnt] != NULLPTR) {
+ if (l) {
if (cqEvent->getError() == true) {
- cqListeners[lCnt]->onError(*cqEvent);
+ l->onError(*cqEvent);
} else {
- cqListeners[lCnt]->onEvent(*cqEvent);
+ l->onEvent(*cqEvent);
}
}
// Handle client side exceptions.
@@ -488,16 +480,14 @@ void CqService::invokeCqListeners(const std::map<std::string, int>* cqs,
}
}
-void CqService::invokeCqConnectedListeners(std::string poolName,
+void CqService::invokeCqConnectedListeners(const std::string& poolName,
bool connected) {
- CqQueryPtr cQuery;
- CqQueryImpl* cQueryImpl;
- VectorOfCqQuery vec;
+ query_container_type vec;
getAllCqs(vec);
for (int32_t i = 0; i < vec.size(); i++) {
std::string cqName = vec.at(i)->getName();
- cQuery = getCq(cqName);
- cQueryImpl = dynamic_cast<CqQueryImpl*>(cQuery.ptr());
+ auto cQuery = getCq(cqName);
+ auto cQueryImpl = std::dynamic_pointer_cast<CqQueryImpl>(cQuery);
if (cQueryImpl == NULL || !cQueryImpl->isRunning()) {
LOGFINE("Unable to invoke CqStatusListener, %s, CqName: %s",
(cQueryImpl == NULL) ? "CQ not found" : "CQ is Not running",
@@ -506,8 +496,7 @@ void CqService::invokeCqConnectedListeners(std::string poolName,
}
// Check cq pool to determine if the pool matches, if not continue.
- ThinClientPoolDM* poolDM =
- dynamic_cast<ThinClientPoolDM*>(cQueryImpl->getDM());
+ auto* poolDM = dynamic_cast<ThinClientPoolDM*>(cQueryImpl->getDM());
if (poolDM != NULL) {
std::string pName = poolDM->getName();
if (pName.compare(poolName) != 0) {
@@ -516,19 +505,13 @@ void CqService::invokeCqConnectedListeners(std::string poolName,
}
// invoke CQ Listeners.
- VectorOfCqListener cqListeners;
+ std::vector<CqListenerPtr> cqListeners;
cQueryImpl->getCqAttributes()->getCqListeners(cqListeners);
- for (int32_t lCnt = 0; lCnt < cqListeners.length(); lCnt++) {
+ for (auto l : cqListeners) {
try {
// Check if the listener is not null, it could have been changed/reset
// by the CqAttributeMutator.
- CqStatusListenerPtr statusLstr = NULLPTR;
- try {
- statusLstr = dynCast<CqStatusListenerPtr>(cqListeners[lCnt]);
- } catch (const ClassCastException&) {
- // ignore
- }
- if (statusLstr != NULLPTR) {
+ if (auto statusLstr = std::dynamic_pointer_cast<CqStatusListener>(l)) {
if (connected) {
statusLstr->onCqConnected();
} else {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/CqService.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CqService.hpp b/src/cppcache/src/CqService.hpp
index 4458064..5873df5 100644
--- a/src/cppcache/src/CqService.hpp
+++ b/src/cppcache/src/CqService.hpp
@@ -72,9 +72,11 @@ namespace client {
*
* FIX : Make the class NonCopyable
*/
-class CPPCACHE_EXPORT CqService : public SharedBase,
- private NonCopyable,
- private NonAssignable {
+class CPPCACHE_EXPORT CqService
+ : public SharedBase,
+ private NonCopyable,
+ private NonAssignable,
+ public std::enable_shared_from_this<CqService> {
private:
ThinClientBaseDM* m_tccdm;
ACE_Recursive_Thread_Mutex m_mutex;
@@ -92,6 +94,8 @@ class CPPCACHE_EXPORT CqService : public SharedBase,
}
public:
+ typedef std::vector<CqQueryPtr> query_container_type;
+
/**
* Constructor.
*/
@@ -109,7 +113,7 @@ class CPPCACHE_EXPORT CqService : public SharedBase,
void updateStats();
CqServiceVsdStats& getCqServiceVsdStats() {
- return *dynamic_cast<CqServiceVsdStats*>(m_stats.ptr());
+ return *dynamic_cast<CqServiceVsdStats*>(m_stats.get());
}
/**
@@ -142,23 +146,24 @@ class CPPCACHE_EXPORT CqService : public SharedBase,
* release.
*
*/
- CqQueryPtr newCq(std::string& cqName, std::string& queryString,
- CqAttributesPtr& cqAttributes, bool isDurable = false);
+ CqQueryPtr newCq(const std::string& cqName, const std::string& queryString,
+ const CqAttributesPtr& cqAttributes,
+ const bool isDurable = false);
/**
* Adds the given CQ and cqQuery object into the CQ map.
*/
- void addCq(std::string& cqName, CqQueryPtr& cq);
+ void addCq(const std::string& cqName, CqQueryPtr& cq);
/**
* Removes given CQ from the cqMap..
*/
- void removeCq(std::string& cqName);
+ void removeCq(const std::string& cqName);
/**
* Retrieve a CqQuery by name.
* @return the CqQuery or null if not found
*/
- CqQueryPtr getCq(std::string& cqName);
+ CqQueryPtr getCq(const std::string& cqName);
/**
* Clears the CQ Query Map.
@@ -167,7 +172,7 @@ class CPPCACHE_EXPORT CqService : public SharedBase,
/**
* Retrieve all registered CQs
*/
- void getAllCqs(VectorOfCqQuery& vec);
+ void getAllCqs(query_container_type& vec);
/**
* Executes all the cqs on this client.
*/
@@ -181,12 +186,12 @@ class CPPCACHE_EXPORT CqService : public SharedBase,
/**
* Executes all the given cqs.
*/
- void executeCqs(VectorOfCqQuery& cqs, bool afterFailover = false);
+ void executeCqs(query_container_type& cqs, bool afterFailover = false);
/**
* Executes all the given cqs on the specified endpoint after failover.
*/
- GfErrType executeCqs(VectorOfCqQuery& cqs, TcrEndpoint* endpoint);
+ GfErrType executeCqs(query_container_type& cqs, TcrEndpoint* endpoint);
/**
* Stops all the cqs
@@ -196,7 +201,7 @@ class CPPCACHE_EXPORT CqService : public SharedBase,
/**
* Stops all the specified cqs.
*/
- void stopCqs(VectorOfCqQuery& cqs);
+ void stopCqs(query_container_type& cqs);
/**
* Close all CQs executing in this client, and release resources
@@ -227,7 +232,7 @@ class CPPCACHE_EXPORT CqService : public SharedBase,
* @param cqName name of the CQ.
* @return true if exists else false.
*/
- bool isCqExists(std::string& cqName);
+ bool isCqExists(const std::string& cqName);
/**
* Invokes the CqListeners for the given CQs.
* @param cqs list of cqs with the cq operation from the Server.
@@ -246,7 +251,7 @@ class CPPCACHE_EXPORT CqService : public SharedBase,
*/
CqOperation::CqOperationType getOperation(int eventType);
- void closeCqs(VectorOfCqQuery& cqs);
+ void closeCqs(query_container_type& cqs);
/**
* Gets all the durable CQs registered by this client.
@@ -256,7 +261,8 @@ class CPPCACHE_EXPORT CqService : public SharedBase,
*/
CacheableArrayListPtr getAllDurableCqsFromServer();
- void invokeCqConnectedListeners(std::string poolName, bool connected);
+ void invokeCqConnectedListeners(const std::string& poolName,
+ const bool connected);
};
typedef SharedPtr<CqService> CqServicePtr;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/DSMemberForVersionStamp.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/DSMemberForVersionStamp.hpp b/src/cppcache/src/DSMemberForVersionStamp.hpp
index 59a1d89..4019095 100644
--- a/src/cppcache/src/DSMemberForVersionStamp.hpp
+++ b/src/cppcache/src/DSMemberForVersionStamp.hpp
@@ -32,7 +32,7 @@ typedef SharedPtr<DSMemberForVersionStamp> DSMemberForVersionStampPtr;
class DSMemberForVersionStamp : public CacheableKey {
public:
- virtual int16_t compareTo(DSMemberForVersionStampPtr tagID) = 0;
+ virtual int16_t compareTo(const DSMemberForVersionStamp& tagID) const = 0;
virtual std::string getHashKey() = 0;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/Delta.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/Delta.cpp b/src/cppcache/src/Delta.cpp
index 3d14cb6..5cae7cd 100644
--- a/src/cppcache/src/Delta.cpp
+++ b/src/cppcache/src/Delta.cpp
@@ -32,5 +32,5 @@ DeltaPtr Delta::clone() {
DataInput in(out.getBuffer(), out.getBufferLength());
CacheablePtr theClonePtr;
in.readObject(theClonePtr);
- return DeltaPtr(theClonePtr);
+ return std::dynamic_pointer_cast<Delta>(theClonePtr);
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/DiffieHellman.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/DiffieHellman.cpp b/src/cppcache/src/DiffieHellman.cpp
index f7013ca..a5b14d4 100644
--- a/src/cppcache/src/DiffieHellman.cpp
+++ b/src/cppcache/src/DiffieHellman.cpp
@@ -89,13 +89,13 @@ void DiffieHellman::initDhKeys(const PropertiesPtr& props) {
CacheableStringPtr ksPath = props->find(SecurityClientKsPath);
// Null check only for DH Algo
- if (dhAlgo == NULLPTR) {
+ if (dhAlgo == nullptr) {
LOGFINE("DH algo not available");
return;
}
int error = gf_initDhKeys_Ptr(&m_dhCtx, dhAlgo->asChar(),
- ksPath != NULLPTR ? ksPath->asChar() : NULL);
+ ksPath != nullptr ? ksPath->asChar() : NULL);
if (error == DH_ERR_UNSUPPORTED_ALGO) { // Unsupported Algorithm
char msg[64] = {'\0'};
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/DiskStoreId.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/DiskStoreId.hpp b/src/cppcache/src/DiskStoreId.hpp
index ebdee4b..886baec 100644
--- a/src/cppcache/src/DiskStoreId.hpp
+++ b/src/cppcache/src/DiskStoreId.hpp
@@ -63,10 +63,12 @@ class DiskStoreId : public DSMemberForVersionStamp {
return static_cast<int8_t>(GeodeTypeIdsImpl::DiskStoreId);
}
- virtual int16_t compareTo(DSMemberForVersionStampPtr tagID) {
- int64_t result = m_mostSig - ((DiskStoreId*)tagID.ptr())->m_mostSig;
+ virtual int16_t compareTo(const DSMemberForVersionStamp& tagID) const {
+ const DiskStoreId& otherDiskStoreId =
+ static_cast<const DiskStoreId&>(tagID);
+ int64_t result = m_mostSig - otherDiskStoreId.m_mostSig;
if (result == 0) {
- result = m_leastSig - ((DiskStoreId*)tagID.ptr())->m_leastSig;
+ result = m_leastSig - otherDiskStoreId.m_leastSig;
}
if (result < 0) {
return -1;
@@ -90,19 +92,8 @@ class DiskStoreId : public DSMemberForVersionStamp {
}
virtual bool operator==(const CacheableKey& other) const {
- CacheableKey& otherCopy = const_cast<CacheableKey&>(other);
- DSMemberForVersionStamp& temp =
- dynamic_cast<DSMemberForVersionStamp&>(otherCopy);
- DSMemberForVersionStampPtr otherObjPtr = NULLPTR;
- otherObjPtr = DSMemberForVersionStampPtr(&temp);
-
- DSMemberForVersionStampPtr callerPtr = NULLPTR;
- callerPtr = DSMemberForVersionStampPtr(this);
- if (callerPtr->compareTo(otherObjPtr) == 0) {
- return true;
- } else {
- return false;
- }
+ return (this->compareTo(
+ dynamic_cast<const DSMemberForVersionStamp&>(other)) == 0);
}
private:
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/DistributedSystem.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/DistributedSystem.cpp b/src/cppcache/src/DistributedSystem.cpp
index 3ee2215..ac7038a 100644
--- a/src/cppcache/src/DistributedSystem.cpp
+++ b/src/cppcache/src/DistributedSystem.cpp
@@ -181,7 +181,7 @@ DistributedSystemPtr DistributedSystem::connect(
CppCacheLibrary::closeLib();
delete g_sysProps;
g_sysProps = NULL;
- *m_instance_ptr = NULLPTR;
+ *m_instance_ptr = nullptr;
// delete g_disconnectLock;
throw;
}
@@ -252,7 +252,7 @@ DistributedSystemPtr DistributedSystem::connect(
CppCacheLibrary::closeLib();
delete g_sysProps;
g_sysProps = NULL;
- *m_instance_ptr = NULLPTR;
+ *m_instance_ptr = nullptr;
// delete g_disconnectLock;
throw;
}
@@ -287,7 +287,7 @@ DistributedSystemPtr DistributedSystem::connect(
}
m_connected = true;
- dptr = dp;
+ dptr.reset(dp);
*m_instance_ptr = dptr;
LOGCONFIG("Starting the Geode Native Client");
@@ -308,7 +308,7 @@ void DistributedSystem::disconnect() {
try {
CachePtr cache = CacheFactory::getAnyInstance();
- if (cache != NULLPTR && !cache->isClosed()) {
+ if (cache != nullptr && !cache->isClosed()) {
cache->close();
}
} catch (const apache::geode::client::Exception& e) {
@@ -367,7 +367,7 @@ void DistributedSystem::disconnect() {
LOGFINEST("Cleaned PoolStatType");
- *m_instance_ptr = NULLPTR;
+ *m_instance_ptr = nullptr;
// Free up library resources
CppCacheLibrary::closeLib();
@@ -393,7 +393,7 @@ bool DistributedSystem::isConnected() {
DistributedSystemPtr DistributedSystem::getInstance() {
CppCacheLibrary::initLib();
if (m_instance_ptr == NULL) {
- return NULLPTR;
+ return nullptr;
}
return *m_instance_ptr;
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/DistributedSystemImpl.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/DistributedSystemImpl.cpp b/src/cppcache/src/DistributedSystemImpl.cpp
index db8486d..c59b771 100644
--- a/src/cppcache/src/DistributedSystemImpl.cpp
+++ b/src/cppcache/src/DistributedSystemImpl.cpp
@@ -68,7 +68,7 @@ void DistributedSystemImpl::releaseDisconnectLock() {
int DistributedSystemImpl::currentInstances() {
ACE_Guard<ACE_Recursive_Thread_Mutex> disconnectGuard(*g_disconnectLock);
- if (DistributedSystem::getInstance() != NULLPTR &&
+ if (DistributedSystem::getInstance() != nullptr &&
DistributedSystem::getInstance()->getSystemProperties() != NULL &&
!DistributedSystem::getInstance()
->getSystemProperties()
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/EntriesMap.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/EntriesMap.hpp b/src/cppcache/src/EntriesMap.hpp
index fd2c203..08a08ca 100644
--- a/src/cppcache/src/EntriesMap.hpp
+++ b/src/cppcache/src/EntriesMap.hpp
@@ -151,8 +151,8 @@ class CPPCACHE_EXPORT EntriesMap {
virtual MapSegment* segmentFor(const CacheableKeyPtr& key) const = 0;
virtual CacheablePtr getFromDisk(const CacheableKeyPtr& key,
- MapEntryImpl* me) const {
- return NULLPTR;
+ MapEntryImplPtr& me) const {
+ return nullptr;
}
virtual void reapTombstones(std::map<uint16_t, int64_t>& gcVersions) = 0;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/EntriesMapFactory.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/EntriesMapFactory.hpp b/src/cppcache/src/EntriesMapFactory.hpp
index e04b930..c74c6db 100644
--- a/src/cppcache/src/EntriesMapFactory.hpp
+++ b/src/cppcache/src/EntriesMapFactory.hpp
@@ -33,7 +33,7 @@ class CPPCACHE_EXPORT EntriesMapFactory {
/** @brief used internally by Region implementation to create the appropriate
* type of entries map.
*/
- static EntriesMap* createMap(RegionInternal*,
+ static EntriesMap* createMap(RegionInternal* region,
const RegionAttributesPtr& attrs);
private:
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/EntryExpiryHandler.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/EntryExpiryHandler.cpp b/src/cppcache/src/EntryExpiryHandler.cpp
index b834cf1..31ef91c 100644
--- a/src/cppcache/src/EntryExpiryHandler.cpp
+++ b/src/cppcache/src/EntryExpiryHandler.cpp
@@ -102,7 +102,7 @@ inline void EntryExpiryHandler::DoTheExpirationAction(
"for region %s entry with key %s",
m_regionPtr->getFullPath(),
Utils::getCacheableKeyString(key)->asChar());
- m_regionPtr->invalidateNoThrow(key, NULLPTR, -1,
+ m_regionPtr->invalidateNoThrow(key, nullptr, -1,
CacheEventFlags::EXPIRATION, versionTag);
break;
}
@@ -113,7 +113,7 @@ inline void EntryExpiryHandler::DoTheExpirationAction(
m_regionPtr->getFullPath(),
Utils::getCacheableKeyString(key)->asChar());
m_regionPtr->invalidateNoThrow(
- key, NULLPTR, -1,
+ key, nullptr, -1,
CacheEventFlags::EXPIRATION | CacheEventFlags::LOCAL, versionTag);
break;
}
@@ -123,7 +123,7 @@ inline void EntryExpiryHandler::DoTheExpirationAction(
"for region %s entry with key %s",
m_regionPtr->getFullPath(),
Utils::getCacheableKeyString(key)->asChar());
- m_regionPtr->destroyNoThrow(key, NULLPTR, -1, CacheEventFlags::EXPIRATION,
+ m_regionPtr->destroyNoThrow(key, nullptr, -1, CacheEventFlags::EXPIRATION,
versionTag);
break;
}
@@ -134,7 +134,7 @@ inline void EntryExpiryHandler::DoTheExpirationAction(
m_regionPtr->getFullPath(),
Utils::getCacheableKeyString(key)->asChar());
m_regionPtr->destroyNoThrow(
- key, NULLPTR, -1,
+ key, nullptr, -1,
CacheEventFlags::EXPIRATION | CacheEventFlags::LOCAL, versionTag);
break;
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/EnumInfo.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/EnumInfo.cpp b/src/cppcache/src/EnumInfo.cpp
index 88df691..a19400a 100644
--- a/src/cppcache/src/EnumInfo.cpp
+++ b/src/cppcache/src/EnumInfo.cpp
@@ -25,7 +25,7 @@ namespace client {
EnumInfo::~EnumInfo() {}
EnumInfo::EnumInfo()
- : m_enumClassName(NULLPTR), m_enumName(NULLPTR), m_ordinal(-1) {}
+ : m_enumClassName(nullptr), m_enumName(nullptr), m_ordinal(-1) {}
EnumInfo::EnumInfo(const char *enumClassName, const char *enumName,
int32_t ordinal)
@@ -35,8 +35,8 @@ EnumInfo::EnumInfo(const char *enumClassName, const char *enumName,
}
int32_t EnumInfo::hashcode() const {
- return ((m_enumClassName != NULLPTR ? m_enumClassName->hashcode() : 0) +
- (m_enumName != NULLPTR ? m_enumName->hashcode() : 0));
+ return ((m_enumClassName != nullptr ? m_enumClassName->hashcode() : 0) +
+ (m_enumName != nullptr ? m_enumName->hashcode() : 0));
}
bool EnumInfo::operator==(const CacheableKey &other) const {
@@ -47,11 +47,11 @@ bool EnumInfo::operator==(const CacheableKey &other) const {
if (m_ordinal != otherEnum.m_ordinal) {
return false;
}
- if (m_enumClassName == NULLPTR) {
- return (otherEnum.m_enumClassName == NULLPTR);
+ if (m_enumClassName == nullptr) {
+ return (otherEnum.m_enumClassName == nullptr);
}
- if (m_enumName == NULLPTR) {
- return (otherEnum.m_enumName == NULLPTR);
+ if (m_enumName == nullptr) {
+ return (otherEnum.m_enumName == nullptr);
}
if (strcmp(m_enumClassName->asChar(), otherEnum.m_enumClassName->asChar()) !=
0) {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/EventIdMap.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/EventIdMap.cpp b/src/cppcache/src/EventIdMap.cpp
index a5f63f7..ec61be3 100644
--- a/src/cppcache/src/EventIdMap.cpp
+++ b/src/cppcache/src/EventIdMap.cpp
@@ -28,9 +28,9 @@ void EventIdMap::clear() {
}
EventIdMapEntry EventIdMap::make(EventIdPtr eventid) {
- EventSourcePtr sid(new EventSource(
- eventid->getMemId(), eventid->getMemIdLen(), eventid->getThrId()));
- EventSequencePtr seq(new EventSequence(eventid->getSeqNum()));
+ auto sid = std::make_shared<EventSource>(
+ eventid->getMemId(), eventid->getMemIdLen(), eventid->getThrId());
+ auto seq = std::make_shared<EventSequence>(eventid->getSeqNum());
return std::make_pair(sid, seq);
}
@@ -38,7 +38,7 @@ bool EventIdMap::isDuplicate(EventSourcePtr key, EventSequencePtr value) {
GUARD_MAP;
EventIdMapType::Iterator entry = m_map.find(key);
- if (entry != m_map.end() && ((*value.ptr()) <= (*entry.second().ptr()))) {
+ if (entry != m_map.end() && ((*value.get()) <= (*entry.second().get()))) {
return true;
}
return false;
@@ -52,7 +52,7 @@ bool EventIdMap::put(EventSourcePtr key, EventSequencePtr value, bool onlynew) {
EventIdMapType::Iterator entry = m_map.find(key);
if (entry != m_map.end()) {
- if (onlynew && ((*value.ptr()) <= (*entry.second().ptr()))) {
+ if (onlynew && ((*value.get()) <= (*entry.second().get()))) {
return false;
} else {
m_map.update(key, value);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/EvictionController.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/EvictionController.cpp b/src/cppcache/src/EvictionController.cpp
index dada43f..067e77f 100644
--- a/src/cppcache/src/EvictionController.cpp
+++ b/src/cppcache/src/EvictionController.cpp
@@ -157,8 +157,8 @@ void EvictionController::evict(int32_t percentage) {
std::string str = (std::string)regionTmpVector.at(i);
RegionPtr rptr;
m_cacheImpl->getRegion(str.c_str(), rptr);
- if (rptr != NULLPTR) {
- RegionInternal* rimpl = dynamic_cast<RegionInternal*>(rptr.ptr());
+ if (rptr != nullptr) {
+ RegionInternal* rimpl = dynamic_cast<RegionInternal*>(rptr.get());
if (rimpl != NULL) {
rimpl->evict(percentage);
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/Exception.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/Exception.cpp b/src/cppcache/src/Exception.cpp
index b5870a1..80aea76 100644
--- a/src/cppcache/src/Exception.cpp
+++ b/src/cppcache/src/Exception.cpp
@@ -59,7 +59,7 @@ Exception::Exception(const char* msg1, const char* msg2, bool forceTrace,
msg[len] = '\0';
if (s_exceptionStackTraceEnabled || forceTrace) {
- GF_NEW(m_stack, StackTrace());
+ m_stack = std::make_shared<StackTrace>();
}
m_message = CacheableString::createNoCopy(msg, static_cast<int32_t>(len));
}
@@ -78,12 +78,12 @@ void Exception::showMessage() const {
void Exception::printStackTrace() const {
showMessage();
- if (m_stack == NULLPTR) {
+ if (m_stack == nullptr) {
fprintf(stdout, " No stack available.\n");
} else {
m_stack->print();
}
- if (m_cause != NULLPTR) {
+ if (m_cause != nullptr) {
fprintf(stdout, "Cause by exception: ");
m_cause->printStackTrace();
}
@@ -95,12 +95,12 @@ size_t Exception::getStackTrace(char* buffer, size_t maxLength) const {
size_t len = 0;
if (maxLength > 0) {
std::string traceString;
- if (m_stack == NULLPTR) {
+ if (m_stack == nullptr) {
traceString = " No stack available.\n";
} else {
m_stack->getString(traceString);
}
- if (m_cause != NULLPTR) {
+ if (m_cause != nullptr) {
traceString += "Cause by exception: ";
m_cause->m_stack->getString(traceString);
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/ExceptionTypes.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ExceptionTypes.cpp b/src/cppcache/src/ExceptionTypes.cpp
index 0b6207e..653f3ca 100644
--- a/src/cppcache/src/ExceptionTypes.cpp
+++ b/src/cppcache/src/ExceptionTypes.cpp
@@ -267,8 +267,8 @@ void GfErrTypeThrowException(const char* str, GfErrType err) {
throw ex;
}
case GF_CACHE_LOCATOR_EXCEPTION: {
- ExceptionPtr exCause(new NoAvailableLocatorsException(
- str, (exMsg != NULL ? exMsg : ": No locators available")));
+ auto exCause = std::make_shared<NoAvailableLocatorsException>(
+ str, (exMsg != NULL ? exMsg : ": No locators available"));
NotConnectedException ex(
str, (exMsg != NULL ? exMsg : ": No locators available"), false,
exCause);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/ExecutionImpl.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ExecutionImpl.cpp b/src/cppcache/src/ExecutionImpl.cpp
index 6e0c504..84db490 100644
--- a/src/cppcache/src/ExecutionImpl.cpp
+++ b/src/cppcache/src/ExecutionImpl.cpp
@@ -28,39 +28,36 @@ FunctionToFunctionAttributes ExecutionImpl::m_func_attrs;
ACE_Recursive_Thread_Mutex ExecutionImpl::m_func_attrs_lock;
ExecutionPtr ExecutionImpl::withFilter(CacheableVectorPtr routingObj) {
// ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_lock);
- if (routingObj == NULLPTR) {
+ if (routingObj == nullptr) {
throw IllegalArgumentException("Execution::withFilter: filter is null");
}
- if (m_region == NULLPTR) {
+ if (m_region == nullptr) {
throw UnsupportedOperationException(
"Execution::withFilter: FunctionService::onRegion needs to be called "
"first before calling this function");
}
// m_routingObj = routingObj;
- ExecutionPtr ptr(new ExecutionImpl( //*this
- routingObj, m_args, m_rc, m_region, m_allServer, m_pool, m_proxyCache));
- return ptr;
+ return std::make_shared<ExecutionImpl>(routingObj, m_args, m_rc, m_region,
+ m_allServer, m_pool, m_proxyCache);
}
ExecutionPtr ExecutionImpl::withArgs(CacheablePtr args) {
// ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_lock);
- if (args == NULLPTR) {
+ if (args == nullptr) {
throw IllegalArgumentException("Execution::withArgs: args is null");
}
// m_args = args;
- ExecutionPtr ptr(new ExecutionImpl( //*this
- m_routingObj, args, m_rc, m_region, m_allServer, m_pool, m_proxyCache));
- return ptr;
+ return std::make_shared<ExecutionImpl>(m_routingObj, args, m_rc, m_region,
+ m_allServer, m_pool, m_proxyCache);
}
ExecutionPtr ExecutionImpl::withCollector(ResultCollectorPtr rs) {
// ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_lock);
- if (rs == NULLPTR) {
+ if (rs == nullptr) {
throw IllegalArgumentException(
"Execution::withCollector: collector is null");
}
// m_rc = rs;
- ExecutionPtr ptr(new ExecutionImpl( //*this
- m_routingObj, m_args, rs, m_region, m_allServer, m_pool, m_proxyCache));
- return ptr;
+ return std::make_shared<ExecutionImpl>(m_routingObj, m_args, rs, m_region,
+ m_allServer, m_pool, m_proxyCache);
}
std::vector<int8_t>* ExecutionImpl::getFunctionAttributes(const char* func) {
@@ -86,7 +83,7 @@ ResultCollectorPtr ExecutionImpl::execute(const char* fn, uint32_t timeout) {
std::string func = fn;
LOGDEBUG("ExecutionImpl::execute: ");
GuardUserAttribures gua;
- if (m_proxyCache != NULLPTR) {
+ if (m_proxyCache != nullptr) {
LOGDEBUG("ExecutionImpl::execute function on proxy cache");
gua.setProxyCache(m_proxyCache);
}
@@ -101,10 +98,10 @@ ResultCollectorPtr ExecutionImpl::execute(const char* fn, uint32_t timeout) {
GfErrType err = GF_NOERR;
attr = getFunctionAttributes(fn);
if (attr == NULL) {
- if (m_region != NULLPTR) {
- err = dynamic_cast<ThinClientRegion*>(m_region.ptr())
+ if (m_region != nullptr) {
+ err = dynamic_cast<ThinClientRegion*>(m_region.get())
->getFuncAttributes(fn, &attr);
- } else if (m_pool != NULLPTR) {
+ } else if (m_pool != nullptr) {
err = getFuncAttributes(fn, &attr);
}
if (err != GF_NOERR) {
@@ -127,9 +124,9 @@ ResultCollectorPtr ExecutionImpl::execute(const char* fn, uint32_t timeout) {
func.c_str(), serverHasResult, serverIsHA, serverOptimizeForWrite);
if (serverHasResult == false) {
- m_rc = new NoResult();
- } else if (m_rc == NULLPTR) {
- m_rc = new ResultCollector();
+ m_rc = std::make_shared<NoResult>();
+ } else if (m_rc == nullptr) {
+ m_rc = std::make_shared<ResultCollector>();
}
uint8_t isHAHasResultOptimizeForWrite = 0;
@@ -155,33 +152,33 @@ ResultCollectorPtr ExecutionImpl::execute(const char* fn, uint32_t timeout) {
"not supported");
}
- if (m_region != NULLPTR) {
+ if (m_region != nullptr) {
int32_t retryAttempts = 3;
- if (m_pool != NULLPTR) {
+ if (m_pool != nullptr) {
retryAttempts = m_pool->getRetryAttempts();
}
// if(txState != NULL && !txState->isReplay())
// {
- // VectorOfCacheablePtr args(new VectorOfCacheable());
+ // auto args = std::make_shared<VectorOfCacheable>();
// args->push_back(m_args);
// args->push_back(m_routingObj);
// args->push_back(m_rc);
// args->push_back(CacheableString::create(func));
// args->push_back(CacheableInt32::create(timeout));
// txState->recordTXOperation(GF_EXECUTE_FUNCTION,
- // m_region==NULLPTR?NULL:m_region->getFullPath(), NULLPTR, args);
+ // m_region==nullptr?NULL:m_region->getFullPath(), nullptr, args);
// }
// try{
- if (m_pool != NULLPTR && m_pool->getPRSingleHopEnabled()) {
- ThinClientPoolDM* tcrdm = dynamic_cast<ThinClientPoolDM*>(m_pool.ptr());
+ if (m_pool != nullptr && m_pool->getPRSingleHopEnabled()) {
+ ThinClientPoolDM* tcrdm = dynamic_cast<ThinClientPoolDM*>(m_pool.get());
if (tcrdm == NULL) {
throw IllegalArgumentException(
"Execute: pool cast to ThinClientPoolDM failed");
}
ClientMetadataService* cms = tcrdm->getClientMetaDataService();
CacheableHashSetPtr failedNodes = CacheableHashSet::create();
- if ((m_routingObj == NULLPTR || m_routingObj->empty()) &&
+ if ((m_routingObj == nullptr || m_routingObj->empty()) &&
txState ==
NULL) { // For transactions we should not create multiple threads
LOGDEBUG("ExecutionImpl::execute: m_routingObj is empty");
@@ -193,7 +190,7 @@ ResultCollectorPtr ExecutionImpl::execute(const char* fn, uint32_t timeout) {
LOGDEBUG(
"ExecutionImpl::execute: m_routingObj is empty and locationMap "
"is also empty so use old FE onRegion");
- dynamic_cast<ThinClientRegion*>(m_region.ptr())
+ dynamic_cast<ThinClientRegion*>(m_region.get())
->executeFunction(
fn, m_args, m_routingObj, isHAHasResultOptimizeForWrite, m_rc,
(isHAHasResultOptimizeForWrite & 1) ? retryAttempts : 0,
@@ -204,7 +201,7 @@ ResultCollectorPtr ExecutionImpl::execute(const char* fn, uint32_t timeout) {
"ExecutionImpl::execute: withoutFilter and locationMap is not "
"empty");
bool reExecute =
- dynamic_cast<ThinClientRegion*>(m_region.ptr())
+ dynamic_cast<ThinClientRegion*>(m_region.get())
->executeFunctionSH(fn, m_args, isHAHasResultOptimizeForWrite,
m_rc, locationMap, failedNodes, timeout,
/*allBuckets*/ true);
@@ -213,7 +210,7 @@ ResultCollectorPtr ExecutionImpl::execute(const char* fn, uint32_t timeout) {
if (isHAHasResultOptimizeForWrite & 1) { // isHA = true
m_rc->clearResults();
CacheableVectorPtr rs =
- dynamic_cast<ThinClientRegion*>(m_region.ptr())
+ dynamic_cast<ThinClientRegion*>(m_region.get())
->reExecuteFunction(fn, m_args, m_routingObj,
isHAHasResultOptimizeForWrite, m_rc,
(isHAHasResultOptimizeForWrite & 1)
@@ -222,7 +219,7 @@ ResultCollectorPtr ExecutionImpl::execute(const char* fn, uint32_t timeout) {
failedNodes, timeout);
} else { // isHA = false
m_rc->clearResults();
- dynamic_cast<ThinClientRegion*>(m_region.ptr())
+ dynamic_cast<ThinClientRegion*>(m_region.get())
->executeFunction(
fn, m_args, m_routingObj, isHAHasResultOptimizeForWrite,
m_rc,
@@ -231,9 +228,9 @@ ResultCollectorPtr ExecutionImpl::execute(const char* fn, uint32_t timeout) {
}
}
}
- } else if (m_routingObj != NULLPTR && m_routingObj->size() == 1) {
+ } else if (m_routingObj != nullptr && m_routingObj->size() == 1) {
LOGDEBUG("executeFunction onRegion WithFilter size equal to 1 ");
- dynamic_cast<ThinClientRegion*>(m_region.ptr())
+ dynamic_cast<ThinClientRegion*>(m_region.get())
->executeFunction(
fn, m_args, m_routingObj, isHAHasResultOptimizeForWrite, m_rc,
(isHAHasResultOptimizeForWrite & 1) ? retryAttempts : 0,
@@ -248,7 +245,7 @@ ResultCollectorPtr ExecutionImpl::execute(const char* fn, uint32_t timeout) {
LOGDEBUG(
"ExecutionImpl::execute: withFilter but locationMap is empty "
"so use old FE onRegion");
- dynamic_cast<ThinClientRegion*>(m_region.ptr())
+ dynamic_cast<ThinClientRegion*>(m_region.get())
->executeFunction(
fn, m_args, m_routingObj, isHAHasResultOptimizeForWrite,
m_rc,
@@ -259,7 +256,7 @@ ResultCollectorPtr ExecutionImpl::execute(const char* fn, uint32_t timeout) {
LOGDEBUG(
"ExecutionImpl::execute: withFilter and locationMap is not "
"empty");
- bool reExecute = dynamic_cast<ThinClientRegion*>(m_region.ptr())
+ bool reExecute = dynamic_cast<ThinClientRegion*>(m_region.get())
->executeFunctionSH(
fn, m_args, isHAHasResultOptimizeForWrite,
m_rc, locationMap, failedNodes, timeout,
@@ -269,7 +266,7 @@ ResultCollectorPtr ExecutionImpl::execute(const char* fn, uint32_t timeout) {
if (isHAHasResultOptimizeForWrite & 1) { // isHA = true
m_rc->clearResults();
CacheableVectorPtr rs =
- dynamic_cast<ThinClientRegion*>(m_region.ptr())
+ dynamic_cast<ThinClientRegion*>(m_region.get())
->reExecuteFunction(fn, m_args, m_routingObj,
isHAHasResultOptimizeForWrite, m_rc,
(isHAHasResultOptimizeForWrite & 1)
@@ -278,7 +275,7 @@ ResultCollectorPtr ExecutionImpl::execute(const char* fn, uint32_t timeout) {
failedNodes, timeout);
} else { // isHA = false
m_rc->clearResults();
- dynamic_cast<ThinClientRegion*>(m_region.ptr())
+ dynamic_cast<ThinClientRegion*>(m_region.get())
->executeFunction(
fn, m_args, m_routingObj, isHAHasResultOptimizeForWrite,
m_rc,
@@ -288,7 +285,7 @@ ResultCollectorPtr ExecutionImpl::execute(const char* fn, uint32_t timeout) {
}
}
} else { // For transactions use old way
- dynamic_cast<ThinClientRegion*>(m_region.ptr())
+ dynamic_cast<ThinClientRegion*>(m_region.get())
->executeFunction(
fn, m_args, m_routingObj, isHAHasResultOptimizeForWrite, m_rc,
(isHAHasResultOptimizeForWrite & 1) ? retryAttempts : 0,
@@ -296,7 +293,7 @@ ResultCollectorPtr ExecutionImpl::execute(const char* fn, uint32_t timeout) {
}
}
} else { // w/o single hop, Fallback to old FE onREgion
- dynamic_cast<ThinClientRegion*>(m_region.ptr())
+ dynamic_cast<ThinClientRegion*>(m_region.get())
->executeFunction(
fn, m_args, m_routingObj, isHAHasResultOptimizeForWrite, m_rc,
(isHAHasResultOptimizeForWrite & 1) ? retryAttempts : 0, timeout);
@@ -327,7 +324,7 @@ ResultCollectorPtr ExecutionImpl::execute(const char* fn, uint32_t timeout) {
}
return m_rc;
- } else if (m_pool != NULLPTR) {
+ } else if (m_pool != nullptr) {
if (txState != NULL) {
throw UnsupportedOperationException(
"Execution::execute: Transaction function execution on pool is not "
@@ -353,7 +350,7 @@ ResultCollectorPtr ExecutionImpl::execute(const char* fn, uint32_t timeout) {
GfErrType ExecutionImpl::getFuncAttributes(const char* func,
std::vector<int8_t>** attr) {
- ThinClientPoolDM* tcrdm = dynamic_cast<ThinClientPoolDM*>(m_pool.ptr());
+ ThinClientPoolDM* tcrdm = dynamic_cast<ThinClientPoolDM*>(m_pool.get());
if (tcrdm == NULL) {
throw IllegalArgumentException(
"Execute: pool cast to ThinClientPoolDM failed");
@@ -376,7 +373,7 @@ GfErrType ExecutionImpl::getFuncAttributes(const char* func,
break;
}
case TcrMessage::EXCEPTION: {
- err = dynamic_cast<ThinClientRegion*>(m_region.ptr())
+ err = dynamic_cast<ThinClientRegion*>(m_region.get())
->handleServerException("Region::GET_FUNCTION_ATTRIBUTES",
reply.getException());
break;
@@ -392,7 +389,7 @@ GfErrType ExecutionImpl::getFuncAttributes(const char* func,
void ExecutionImpl::addResults(ResultCollectorPtr& collector,
const CacheableVectorPtr& results) {
- if (results == NULLPTR || collector == NULLPTR) {
+ if (results == nullptr || collector == nullptr) {
return;
}
@@ -403,15 +400,15 @@ void ExecutionImpl::addResults(ResultCollectorPtr& collector,
}
void ExecutionImpl::executeOnAllServers(std::string& func, uint8_t getResult,
uint32_t timeout) {
- ThinClientPoolDM* tcrdm = dynamic_cast<ThinClientPoolDM*>(m_pool.ptr());
+ ThinClientPoolDM* tcrdm = dynamic_cast<ThinClientPoolDM*>(m_pool.get());
if (tcrdm == NULL) {
throw IllegalArgumentException(
"Execute: pool cast to ThinClientPoolDM failed");
}
- CacheableStringPtr exceptionPtr = NULLPTR;
+ CacheableStringPtr exceptionPtr = nullptr;
GfErrType err = tcrdm->sendRequestToAllServers(
func.c_str(), getResult, timeout, m_args, m_rc, exceptionPtr);
- if (exceptionPtr != NULLPTR && err != GF_NOERR) {
+ if (exceptionPtr != nullptr && err != GF_NOERR) {
LOGDEBUG("Execute errorred: %d", err);
// throw FunctionExecutionException( "Execute: failed to execute function
// with server." );
@@ -446,7 +443,7 @@ CacheableVectorPtr ExecutionImpl::executeOnPool(std::string& func,
uint8_t getResult,
int32_t retryAttempts,
uint32_t timeout) {
- ThinClientPoolDM* tcrdm = dynamic_cast<ThinClientPoolDM*>(m_pool.ptr());
+ ThinClientPoolDM* tcrdm = dynamic_cast<ThinClientPoolDM*>(m_pool.get());
if (tcrdm == NULL) {
throw IllegalArgumentException(
"Execute: pool cast to ThinClientPoolDM failed");
@@ -455,7 +452,7 @@ CacheableVectorPtr ExecutionImpl::executeOnPool(std::string& func,
// CacheableStringArrayPtr csArray = tcrdm->getServers();
- // if (csArray != NULLPTR && csArray->length() != 0) {
+ // if (csArray != nullptr && csArray->length() != 0) {
// for (int i = 0; i < csArray->length(); i++)
// {
// CacheableStringPtr cs = csArray[i];
@@ -538,7 +535,7 @@ CacheableVectorPtr ExecutionImpl::executeOnPool(std::string& func,
delete resultCollector;
resultCollector = NULL;
- return NULLPTR;
+ return nullptr;
}
- return NULLPTR;
+ return nullptr;
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/ExecutionImpl.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ExecutionImpl.hpp b/src/cppcache/src/ExecutionImpl.hpp
index caa8ef1..0511172 100644
--- a/src/cppcache/src/ExecutionImpl.hpp
+++ b/src/cppcache/src/ExecutionImpl.hpp
@@ -37,21 +37,21 @@ typedef std::map<std::string, std::vector<int8_t>*> FunctionToFunctionAttributes
class ExecutionImpl : public Execution {
public:
- ExecutionImpl(RegionPtr rptr = NULLPTR, ProxyCachePtr proxyCache = NULLPTR,
- PoolPtr pp = NULLPTR)
- : m_routingObj(NULLPTR),
- m_args(NULLPTR),
- m_rc(NULLPTR),
+ ExecutionImpl(RegionPtr rptr = nullptr, ProxyCachePtr proxyCache = nullptr,
+ PoolPtr pp = nullptr)
+ : m_routingObj(nullptr),
+ m_args(nullptr),
+ m_rc(nullptr),
m_region(rptr),
m_allServer(false),
m_pool(pp),
m_proxyCache(proxyCache) {}
ExecutionImpl(PoolPtr pool, bool allServer = false,
- ProxyCachePtr proxyCache = NULLPTR)
- : m_routingObj(NULLPTR),
- m_args(NULLPTR),
- m_rc(NULLPTR),
- m_region(NULLPTR),
+ ProxyCachePtr proxyCache = nullptr)
+ : m_routingObj(nullptr),
+ m_args(nullptr),
+ m_rc(nullptr),
+ m_region(nullptr),
m_allServer(allServer),
m_pool(pool),
m_proxyCache(proxyCache) {}
@@ -80,7 +80,7 @@ class ExecutionImpl : public Execution {
ExecutionImpl(const CacheableVectorPtr& routingObj, const CacheablePtr& args,
const ResultCollectorPtr& rc, const RegionPtr& region,
const bool allServer, const PoolPtr& pool,
- ProxyCachePtr proxyCache = NULLPTR)
+ ProxyCachePtr proxyCache = nullptr)
: m_routingObj(routingObj),
m_args(args),
m_rc(rc),
@@ -106,6 +106,8 @@ class ExecutionImpl : public Execution {
uint32_t timeout = DEFAULT_QUERY_RESPONSE_TIMEOUT);
std::vector<int8_t>* getFunctionAttributes(const char* func);
GfErrType getFuncAttributes(const char* func, std::vector<int8_t>** attr);
+
+ FRIEND_STD_SHARED_PTR(ExecutionImpl)
};
} // namespace client
} // namespace geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/FarSideEntryOp.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/FarSideEntryOp.cpp b/src/cppcache/src/FarSideEntryOp.cpp
index c62a0e8..c1b6a69 100644
--- a/src/cppcache/src/FarSideEntryOp.cpp
+++ b/src/cppcache/src/FarSideEntryOp.cpp
@@ -102,7 +102,7 @@ void FarSideEntryOp::fromData(DataInput& input, bool largeModCount,
// public static final short TOKEN_REMOVED2 =
// 145;
if (fixedId >= 141 && fixedId < 146) {
- m_value = NULLPTR;
+ m_value = nullptr;
} else {
input.rewindCursor(rewind);
input.readObject(m_value);
@@ -121,10 +121,10 @@ void FarSideEntryOp::fromData(DataInput& input, bool largeModCount,
}
void FarSideEntryOp::apply(RegionPtr& region) {
- // LocalRegion* localRegion = static_cast<LocalRegion*>(region.ptr());
+ // LocalRegion* localRegion = static_cast<LocalRegion*>(region.get());
// localRegion->acquireReadLock();
- RegionInternalPtr ri = region;
+ RegionInternalPtr ri = std::static_pointer_cast<RegionInternal>(region);
if (isDestroy(m_op)) {
ri->txDestroy(m_key, m_callbackArg, m_versionTag);
} else if (isInvalidate(m_op)) {
@@ -224,7 +224,7 @@ EntryEventPtr FarSideEntryOp::getEntryEvent(Cache* cache)
return EntryEventPtr(new EntryEvent(
m_region->getRegion(cache),
m_key,
- NULLPTR,
+ nullptr,
m_value,
m_callbackArg,
false));
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/FixedPartitionAttributesImpl.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/FixedPartitionAttributesImpl.hpp b/src/cppcache/src/FixedPartitionAttributesImpl.hpp
index 12dfac9..7d2671e 100644
--- a/src/cppcache/src/FixedPartitionAttributesImpl.hpp
+++ b/src/cppcache/src/FixedPartitionAttributesImpl.hpp
@@ -41,13 +41,13 @@ class FixedPartitionAttributesImpl : public Serializable {
public:
FixedPartitionAttributesImpl()
: Serializable(),
- m_partitionName(NULLPTR),
+ m_partitionName(nullptr),
m_isPrimary(false),
m_numBuckets(1),
m_startingBucketId(-1) {}
std::string getPartitionName() {
- if (m_partitionName != NULLPTR) {
+ if (m_partitionName != nullptr) {
return m_partitionName->asChar();
}
return "";
@@ -58,7 +58,7 @@ class FixedPartitionAttributesImpl : public Serializable {
int isPrimary() const { return m_isPrimary; }
void toData(DataOutput& output) const {
- if (m_partitionName != NULLPTR) {
+ if (m_partitionName != nullptr) {
output.writeNativeString(m_partitionName->asChar());
}
output.writeBoolean(m_isPrimary);
@@ -75,7 +75,7 @@ class FixedPartitionAttributesImpl : public Serializable {
}
uint32_t objectSize() const {
- if (m_partitionName != NULLPTR) {
+ if (m_partitionName != nullptr) {
return static_cast<uint32_t>(sizeof(int)) +
static_cast<uint32_t>(sizeof(int)) +
static_cast<uint32_t>(sizeof(bool)) +
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/FunctionService.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/FunctionService.cpp b/src/cppcache/src/FunctionService.cpp
index c9d7a71..77336b6 100644
--- a/src/cppcache/src/FunctionService.cpp
+++ b/src/cppcache/src/FunctionService.cpp
@@ -28,41 +28,41 @@ using namespace apache::geode::client;
ExecutionPtr FunctionService::onRegion(RegionPtr region) {
LOGDEBUG("FunctionService::onRegion(RegionPtr region)");
- if (region == NULLPTR) {
+ if (region == nullptr) {
throw NullPointerException("FunctionService::onRegion: region is null");
}
const PoolPtr& pool = region->getPool();
- if (pool == NULLPTR) {
+ if (pool == nullptr) {
throw IllegalArgumentException("Pool attached with region is closed.");
}
- ProxyCachePtr proxyCache = NULLPTR;
+ ProxyCachePtr proxyCache = nullptr;
if (pool->getMultiuserAuthentication()) {
- ProxyRegion* pr = dynamic_cast<ProxyRegion*>(region.ptr());
+ ProxyRegion* pr = dynamic_cast<ProxyRegion*>(region.get());
if (pr != NULL) {
LOGDEBUG("FunctionService::onRegion(RegionPtr region) proxy cache");
// it is in multiuser mode
proxyCache = pr->m_proxyCache;
PoolPtr userAttachedPool = proxyCache->m_userAttributes->getPool();
PoolPtr pool = PoolManager::find(userAttachedPool->getName());
- if (!(pool != NULLPTR && pool.ptr() == userAttachedPool.ptr() &&
+ if (!(pool != nullptr && pool.get() == userAttachedPool.get() &&
!pool->isDestroyed())) {
throw IllegalStateException(
"Pool has been closed with attached Logical Cache.");
}
RegionPtr tmpRegion;
- tmpRegion = NULLPTR;
+ tmpRegion = nullptr;
// getting real region to execute function on region
if (!CacheFactory::getAnyInstance()->isClosed()) {
- CacheRegionHelper::getCacheImpl(CacheFactory::getAnyInstance().ptr())
+ CacheRegionHelper::getCacheImpl(CacheFactory::getAnyInstance().get())
->getRegion(region->getName(), tmpRegion);
} else {
throw IllegalStateException("Cache has been closed");
}
- if (tmpRegion == NULLPTR) {
+ if (tmpRegion == nullptr) {
throw IllegalStateException("Real region has been closed.");
}
region = tmpRegion;
@@ -72,12 +72,11 @@ ExecutionPtr FunctionService::onRegion(RegionPtr region) {
}
}
- ExecutionPtr ptr(new ExecutionImpl(region, proxyCache, pool));
- return ptr;
+ return std::make_shared<ExecutionImpl>(region, proxyCache, pool);
}
ExecutionPtr FunctionService::onServerWithPool(const PoolPtr& pool) {
- if (pool == NULLPTR) {
+ if (pool == nullptr) {
throw NullPointerException("FunctionService::onServer: pool is null");
}
if (pool->getMultiuserAuthentication()) {
@@ -85,12 +84,11 @@ ExecutionPtr FunctionService::onServerWithPool(const PoolPtr& pool) {
"This API is not supported in multiuser mode. "
"Please use FunctionService::onServer(RegionService) API.");
}
- ExecutionPtr ptr(new ExecutionImpl(pool));
- return ptr;
+ return std::make_shared<ExecutionImpl>(pool);
}
ExecutionPtr FunctionService::onServersWithPool(const PoolPtr& pool) {
- if (pool == NULLPTR) {
+ if (pool == nullptr) {
throw NullPointerException("FunctionService::onServers: pool is null");
}
if (pool->getMultiuserAuthentication()) {
@@ -99,8 +97,7 @@ ExecutionPtr FunctionService::onServersWithPool(const PoolPtr& pool) {
"Please use FunctionService::onServers(RegionService) API.");
}
- ExecutionPtr ptr(new ExecutionImpl(pool, true));
- return ptr;
+ return std::make_shared<ExecutionImpl>(pool, true);
}
ExecutionPtr FunctionService::onServerWithCache(const RegionServicePtr& cache) {
@@ -108,21 +105,20 @@ ExecutionPtr FunctionService::onServerWithCache(const RegionServicePtr& cache) {
throw IllegalStateException("Cache has been closed");
}
- ProxyCache* pc = dynamic_cast<ProxyCache*>(cache.ptr());
+ auto pc = std::dynamic_pointer_cast<ProxyCache>(cache);
LOGDEBUG("FunctionService::onServer:");
if (pc != NULL) {
PoolPtr userAttachedPool = pc->m_userAttributes->getPool();
PoolPtr pool = PoolManager::find(userAttachedPool->getName());
- if (pool != NULLPTR && pool.ptr() == userAttachedPool.ptr() &&
+ if (pool != nullptr && pool.get() == userAttachedPool.get() &&
!pool->isDestroyed()) {
- ExecutionPtr ptr(new ExecutionImpl(pool, false, cache));
- return ptr;
+ return std::make_shared<ExecutionImpl>(pool, false, pc);
}
throw IllegalStateException(
"Pool has been close to execute function on server");
} else {
- CachePtr realcache = staticCast<CachePtr>(cache);
+ CachePtr realcache = std::static_pointer_cast<GF_UNWRAP_SP(CachePtr)>(cache);
return FunctionService::onServer(realcache->m_cacheImpl->getDefaultPool());
}
}
@@ -133,21 +129,20 @@ ExecutionPtr FunctionService::onServersWithCache(
throw IllegalStateException("Cache has been closed");
}
- ProxyCache* pc = dynamic_cast<ProxyCache*>(cache.ptr());
+ auto pc = std::dynamic_pointer_cast<ProxyCache>(cache);
LOGDEBUG("FunctionService::onServers:");
if (pc != NULL && !cache->isClosed()) {
PoolPtr userAttachedPool = pc->m_userAttributes->getPool();
PoolPtr pool = PoolManager::find(userAttachedPool->getName());
- if (pool != NULLPTR && pool.ptr() == userAttachedPool.ptr() &&
+ if (pool != nullptr && pool.get() == userAttachedPool.get() &&
!pool->isDestroyed()) {
- ExecutionPtr ptr(new ExecutionImpl(pool, true, cache));
- return ptr;
+ return std::make_shared<ExecutionImpl>(pool, true, pc);
}
throw IllegalStateException(
"Pool has been close to execute function on server");
} else {
- CachePtr realcache = staticCast<CachePtr>(cache);
+ CachePtr realcache = std::static_pointer_cast<GF_UNWRAP_SP(CachePtr)>(cache);
return FunctionService::onServers(realcache->m_cacheImpl->getDefaultPool());
}
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/FunctionServiceImpl.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/FunctionServiceImpl.cpp b/src/cppcache/src/FunctionServiceImpl.cpp
index f3f59e4..1b3adc8 100644
--- a/src/cppcache/src/FunctionServiceImpl.cpp
+++ b/src/cppcache/src/FunctionServiceImpl.cpp
@@ -27,6 +27,5 @@ FunctionServiceImpl::FunctionServiceImpl(ProxyCachePtr proxyCache) {
FunctionServicePtr FunctionServiceImpl::getFunctionService(
ProxyCachePtr proxyCache) {
- FunctionServicePtr fPtr(new FunctionServiceImpl(proxyCache));
- return fPtr;
+ return std::make_shared<FunctionServiceImpl>(proxyCache);
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/FunctionServiceImpl.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/FunctionServiceImpl.hpp b/src/cppcache/src/FunctionServiceImpl.hpp
index 2a90c4f..5f96381 100644
--- a/src/cppcache/src/FunctionServiceImpl.hpp
+++ b/src/cppcache/src/FunctionServiceImpl.hpp
@@ -61,6 +61,8 @@ class CPPCACHE_EXPORT FunctionServiceImpl : public FunctionService {
ProxyCachePtr m_proxyCache;
friend class ProxyCache;
+
+ FRIEND_STD_SHARED_PTR(FunctionServiceImpl)
};
} // namespace client
} // namespace geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/GatewayEventCallbackArgument.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/GatewayEventCallbackArgument.hpp b/src/cppcache/src/GatewayEventCallbackArgument.hpp
index ae1de8e..8c465b5 100644
--- a/src/cppcache/src/GatewayEventCallbackArgument.hpp
+++ b/src/cppcache/src/GatewayEventCallbackArgument.hpp
@@ -57,7 +57,7 @@ class GatewayEventCallbackArgument : public Serializable {
// input.readObject(ignored);// Changed
input.readNativeString(ignored);
}
- return m_callback.ptr();
+ return m_callback.get();
}
public:
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/GatewaySenderEventCallbackArgument.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/GatewaySenderEventCallbackArgument.hpp b/src/cppcache/src/GatewaySenderEventCallbackArgument.hpp
index 88ff69b..d6a87d8 100644
--- a/src/cppcache/src/GatewaySenderEventCallbackArgument.hpp
+++ b/src/cppcache/src/GatewaySenderEventCallbackArgument.hpp
@@ -61,7 +61,7 @@ class GatewaySenderEventCallbackArgument : public Serializable {
for (int32_t item = 0; item < items; item++) {
input.readInt(&ignoreInt);
}
- return m_callback.ptr();
+ return m_callback.get();
}
public:
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/GetAllServersResponse.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/GetAllServersResponse.cpp b/src/cppcache/src/GetAllServersResponse.cpp
index b1a793a..17a8452 100644
--- a/src/cppcache/src/GetAllServersResponse.cpp
+++ b/src/cppcache/src/GetAllServersResponse.cpp
@@ -22,8 +22,10 @@ void GetAllServersResponse::toData(DataOutput& output) const {
int32_t length = static_cast<int32_t>(m_servers.size());
output.writeInt(length);
for (int32_t i = 0; i < length; i++) {
- SerializablePtr sPtr(&m_servers.at(i));
- output.writeObject(sPtr);
+ // TODO shared_ptr - this is suspicious, in the original all entries were
+ // wrapped in a SharedPtr resulting in their destruction at the end of this
+ // function.
+ output.writeObject(&m_servers.at(i));
}
}
Serializable* GetAllServersResponse::fromData(DataInput& input) {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/InternalCacheTransactionManager2PCImpl.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/InternalCacheTransactionManager2PCImpl.cpp b/src/cppcache/src/InternalCacheTransactionManager2PCImpl.cpp
index fe7893d..047f02f 100644
--- a/src/cppcache/src/InternalCacheTransactionManager2PCImpl.cpp
+++ b/src/cppcache/src/InternalCacheTransactionManager2PCImpl.cpp
@@ -173,8 +173,8 @@ void InternalCacheTransactionManager2PCImpl::afterCompletion(int32_t status) {
switch (replyCommitAfter.getMessageType()) {
case TcrMessage::RESPONSE: {
TXCommitMessagePtr commit =
- staticCast<TXCommitMessagePtr>(replyCommitAfter.getValue());
- if (commit.ptr() !=
+ std::static_pointer_cast<GF_UNWRAP_SP(TXCommitMessagePtr)>(replyCommitAfter.getValue());
+ if (commit.get() !=
NULL) // e.g. when afterCompletion(STATUS_ROLLEDBACK) called
{
txCleaner.clean();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/LRUAction.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/LRUAction.cpp b/src/cppcache/src/LRUAction.cpp
index 1ba0ca0..b21f406 100644
--- a/src/cppcache/src/LRUAction.cpp
+++ b/src/cppcache/src/LRUAction.cpp
@@ -59,7 +59,7 @@ bool LRUOverFlowToDiskAction::evict(const MapEntryImplPtr& mePtr) {
CacheablePtr valuePtr;
mePtr->getKeyI(keyPtr);
mePtr->getValueI(valuePtr);
- if (valuePtr == NULLPTR) {
+ if (valuePtr == nullptr) {
LOGERROR(
"[internal error]:: OverflowAction: destroyed entry added to "
"LRU list");
@@ -110,7 +110,7 @@ bool LRULocalInvalidateAction::evict(const MapEntryImplPtr& mePtr) {
GfErrType err = GF_NOERR;
if (!m_regionPtr->isDestroyed()) {
err = m_regionPtr->invalidateNoThrow(
- keyPtr, NULLPTR, -1, CacheEventFlags::EVICTION | CacheEventFlags::LOCAL,
+ keyPtr, nullptr, -1, CacheEventFlags::EVICTION | CacheEventFlags::LOCAL,
versionTag);
}
return (err == GF_NOERR);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/LRUAction.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/LRUAction.hpp b/src/cppcache/src/LRUAction.hpp
index 4867cc8..711b1b3 100644
--- a/src/cppcache/src/LRUAction.hpp
+++ b/src/cppcache/src/LRUAction.hpp
@@ -119,7 +119,7 @@ class CPPCACHE_EXPORT LRUDestroyAction : public virtual LRUAction {
Utils::getCacheableKeyString(keyPtr)->asChar());
GfErrType err = GF_NOERR;
if (!m_regionPtr->isDestroyed()) {
- err = m_regionPtr->destroyNoThrow(keyPtr, NULLPTR, -1,
+ err = m_regionPtr->destroyNoThrow(keyPtr, nullptr, -1,
CacheEventFlags::EVICTION, versionTag);
}
return (err == GF_NOERR);
[04/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from cppcache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/TcrEndpoint.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/TcrEndpoint.cpp b/src/cppcache/src/TcrEndpoint.cpp
index cfe0900..24c3283 100644
--- a/src/cppcache/src/TcrEndpoint.cpp
+++ b/src/cppcache/src/TcrEndpoint.cpp
@@ -291,7 +291,7 @@ void TcrEndpoint::authenticateEndpoint(TcrConnection*& conn) {
GfErrType err = GF_NOERR;
PropertiesPtr creds = this->getCredentials();
- if (creds != NULLPTR) {
+ if (creds != nullptr) {
LOGDEBUG("TcrEndpoint::authenticateEndpoint got creds from app = %d",
creds->getSize());
} else {
@@ -338,7 +338,7 @@ PropertiesPtr TcrEndpoint::getCredentials() {
AuthInitializePtr authInitialize = DistributedSystem::m_impl->getAuthLoader();
- if (authInitialize != NULLPTR) {
+ if (authInitialize != nullptr) {
LOGFINER(
"Acquired handle to AuthInitialize plugin, "
"getting credentials for %s",
@@ -357,7 +357,7 @@ PropertiesPtr TcrEndpoint::getCredentials() {
LOGFINER("Done getting credentials");
return tmpAuthIniSecurityProperties;
}
- return NULLPTR;
+ return nullptr;
}
ServerQueueStatus TcrEndpoint::getFreshServerQueueStatus(
@@ -639,8 +639,8 @@ int TcrEndpoint::receiveNotification(volatile bool& isRunning) {
const std::string& regionFullPath1 = msg->getRegionName();
RegionPtr region1;
m_cache->getRegion(regionFullPath1.c_str(), region1);
- if (region1 != NULLPTR &&
- !static_cast<ThinClientRegion*>(region1.ptr())
+ if (region1 != nullptr &&
+ !static_cast<ThinClientRegion*>(region1.get())
->getDistMgr()
->isEndpointAttached(this)) {
// drop event before even processing the eventid for duplicate
@@ -673,8 +673,8 @@ int TcrEndpoint::receiveNotification(volatile bool& isRunning) {
const std::string& regionFullPath = msg->getRegionName();
RegionPtr region;
m_cache->getRegion(regionFullPath.c_str(), region);
- if (region != NULLPTR) {
- static_cast<ThinClientRegion*>(region.ptr())
+ if (region != nullptr) {
+ static_cast<ThinClientRegion*>(region.get())
->receiveNotification(msg);
} else {
LOGWARN(
@@ -685,8 +685,8 @@ int TcrEndpoint::receiveNotification(volatile bool& isRunning) {
} else {
LOGDEBUG("receive cq notification %d", msg->getMessageType());
QueryServicePtr queryService = getQueryService();
- if (queryService != NULLPTR) {
- static_cast<RemoteQueryService*>(queryService.ptr())
+ if (queryService != nullptr) {
+ static_cast<RemoteQueryService*>(queryService.get())
->receiveNotification(msg);
}
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/TcrMessage.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/TcrMessage.cpp b/src/cppcache/src/TcrMessage.cpp
index f211334..d20b40a 100644
--- a/src/cppcache/src/TcrMessage.cpp
+++ b/src/cppcache/src/TcrMessage.cpp
@@ -179,7 +179,7 @@ VersionTagPtr TcrMessage::readVersionTagPart(DataInput& input,
if (isObj == GeodeTypeIds::NullObj) return versionTag;
if (isObj == GeodeTypeIdsImpl::FixedIDByte) {
- versionTag = new VersionTag();
+ versionTag = std::make_shared<VersionTag>();
int8_t fixedId;
input.read(&fixedId);
if (fixedId == GeodeTypeIdsImpl::VersionTag) {
@@ -193,7 +193,7 @@ VersionTagPtr TcrMessage::readVersionTagPart(DataInput& input,
if (fixedId == GeodeTypeIdsImpl::DiskVersionTag) {
DiskVersionTag* disk = new DiskVersionTag();
disk->fromData(input);
- versionTag = disk;
+ versionTag.reset(disk);
return versionTag;
}
}
@@ -207,8 +207,7 @@ void TcrMessage::readVersionTag(DataInput& input, uint16_t endpointMemId) {
input.read(&isObj);
if (lenObj == 0) return;
- VersionTagPtr versionTag(
- TcrMessage::readVersionTagPart(input, endpointMemId));
+ auto versionTag = TcrMessage::readVersionTagPart(input, endpointMemId);
this->setVersionTag(versionTag);
}
@@ -314,7 +313,7 @@ inline void TcrMessage::readObjectPart(DataInput& input, bool defaultString) {
} else if (lenObj == 0 && isObj == 2) { // EMPTY BYTE ARRAY
m_value = CacheableBytes::create();
} else if (isObj == 0) {
- m_value = NULLPTR;
+ m_value = nullptr;
}
}
@@ -385,7 +384,7 @@ void TcrMessage::readUniqueIDObjectPart(DataInput& input) {
}
int64_t TcrMessage::getConnectionId(TcrConnection* conn) {
- if (m_connectionIDBytes != NULLPTR) {
+ if (m_connectionIDBytes != nullptr) {
CacheableBytesPtr tmp = conn->decryptBytes(m_connectionIDBytes);
DataInput di(tmp->value(), tmp->length());
int64_t connid;
@@ -398,9 +397,8 @@ int64_t TcrMessage::getConnectionId(TcrConnection* conn) {
}
int64_t TcrMessage::getUniqueId(TcrConnection* conn) {
- if (m_value != NULLPTR) {
- CacheableBytesPtr encryptBytes =
- static_cast<CacheableBytes*>(m_value.ptr());
+ if (m_value != nullptr) {
+ auto encryptBytes = std::static_pointer_cast<CacheableBytes>(m_value);
CacheableBytesPtr tmp = conn->decryptBytes(encryptBytes);
@@ -436,23 +434,8 @@ inline void TcrMessage::readKeyPart(DataInput& input) {
if (isObj) {
input.readObject(m_key);
} else {
- CacheableKeyPtr ckPtr(dynamic_cast<CacheableKey*>(
- readCacheableString(input, lenObj).ptr()));
- m_key = ckPtr;
- /* // check whether unicode or ASCII string (bug #356)
- uint16_t decodedLen = DataInput::getDecodedLength(
- input.currentBufferPosition(), lenObj);
- if (decodedLen == lenObj) {
- // ASCII string
- m_key = CacheableString::create((char*) input.currentBufferPosition(),
- lenObj);
- input.advanceCursor(lenObj);
- }
- else {
- wchar_t* wideStr;
- input.readUTFNoLen(&wideStr, decodedLen);
- m_key = CacheableString::createNoCopy(wideStr, decodedLen);
- }*/
+ m_key = std::static_pointer_cast<CacheableKey>(
+ readCacheableString(input, lenObj));
}
}
}
@@ -582,16 +565,17 @@ void TcrMessage::writeObjectPart(const SerializablePtr& se, bool isDelta,
// check if the type is a CacheableBytes
int8_t isObject = 1;
- if (se != NULLPTR && se->typeId() == GeodeTypeIds::CacheableBytes) {
+ if (se != nullptr && se->typeId() == GeodeTypeIds::CacheableBytes) {
// for an emty byte array write EMPTY_BYTEARRAY_CODE(2) to is object
try {
int byteArrLength = -1;
- if (instanceOf<CacheableBytesPtr>(se)) {
- CacheableBytesPtr cacheableBytes = dynCast<CacheableBytesPtr>(se);
+ if (auto cacheableBytes = std::dynamic_pointer_cast<CacheableBytes>(se)) {
byteArrLength = cacheableBytes->length();
} else {
- std::string classname(Utils::getCacheableKeyString(se)->asChar());
+ std::string classname(Utils::getCacheableKeyString(
+ std::static_pointer_cast<CacheableKey>(se))
+ ->asChar());
if (classname.find("apache::geode::client::ManagedCacheableKey") !=
std::string::npos) {
byteArrLength = se->objectSize();
@@ -617,7 +601,7 @@ void TcrMessage::writeObjectPart(const SerializablePtr& se, bool isDelta,
uint32_t sizeBeforeWritingObj = m_request->getBufferLength();
if (isDelta) {
- DeltaPtr deltaPtr = dynCast<DeltaPtr>(se);
+ auto deltaPtr = std::dynamic_pointer_cast<Delta>(se);
deltaPtr->toDelta(*m_request);
} else if (isObject) {
if (!callToData) {
@@ -641,7 +625,7 @@ void TcrMessage::writeObjectPart(const SerializablePtr& se, bool isDelta,
}
} else {
// TODO::
- // CacheableBytes* rawByteArray = static_cast<CacheableBytes*>(se.ptr());
+ // CacheableBytes* rawByteArray = static_cast<CacheableBytes*>(se.get());
// m_request->writeBytesOnly(rawByteArray->value(), rawByteArray->length());
writeBytesOnly(se);
}
@@ -883,7 +867,7 @@ void TcrMessage::processChunk(const uint8_t* bytes, int32_t len,
// last chunk -- wait for processing of all the chunks to complete
m_chunkedResult->waitFinalize();
ExceptionPtr ex = m_chunkedResult->getException();
- if (ex != NULLPTR) {
+ if (ex != nullptr) {
ex->raise();
}
}
@@ -914,7 +898,7 @@ void TcrMessage::processChunk(const uint8_t* bytes, int32_t len,
// of populating cache with registerAllKeys(), so that should be
// documented since rolling that back may not be a good idea either.
ExceptionPtr& ex = m_chunkedResult->getException();
- if (ex != NULLPTR) {
+ if (ex != nullptr) {
ex->raise();
}
}
@@ -993,7 +977,7 @@ void TcrMessage::processChunk(const uint8_t* bytes, int32_t len,
const char* TcrMessage::getPoolName() {
if (m_region != NULL) {
const PoolPtr& p = (const_cast<Region*>(m_region))->getPool();
- if (p != NULLPTR) {
+ if (p != nullptr) {
return p->getName();
} else {
return NULL;
@@ -1093,7 +1077,7 @@ void TcrMessage::handleByteArrayResponse(const char* bytearray, int32_t len,
receivednumparts++;
}
- if ((m_value == NULLPTR) && (flag & 0x08 /*VALUE_IS_INVALID*/)) {
+ if ((m_value == nullptr) && (flag & 0x08 /*VALUE_IS_INVALID*/)) {
m_value = CacheableToken::invalid();
}
@@ -1371,7 +1355,7 @@ void TcrMessage::handleByteArrayResponse(const char* bytearray, int32_t len,
uint16_t classLen;
input.readInt(&classLen); // Read classLen
input.advanceCursor(classLen);
- BucketServerLocationPtr location(new BucketServerLocation());
+ auto location = std::make_shared<BucketServerLocation>();
location->fromData(input);
LOGFINE("location contains %d\t%s\t%d\t%d\t%s",
location->getBucketId(), location->getServerName().c_str(),
@@ -1428,8 +1412,7 @@ void TcrMessage::handleByteArrayResponse(const char* bytearray, int32_t len,
uint16_t classLen;
input.readInt(&classLen); // Read classLen
input.advanceCursor(classLen);
- FixedPartitionAttributesImplPtr fpa(
- new FixedPartitionAttributesImpl());
+ auto fpa = std::make_shared<FixedPartitionAttributesImpl>();
fpa->fromData(input); // PART4 = set of FixedAttributes.
LOGDEBUG("fpa contains %d\t%s\t%d\t%d", fpa->getNumBuckets(),
fpa->getPartitionName().c_str(), fpa->isPrimary(),
@@ -1459,12 +1442,12 @@ void TcrMessage::handleByteArrayResponse(const char* bytearray, int32_t len,
input.read(&isObj);
if (tombstoneOpType == 0) {
- if (m_tombstoneVersions == NULLPTR) {
+ if (m_tombstoneVersions == nullptr) {
m_tombstoneVersions = CacheableHashMap::create();
}
readHashMapForGCVersions(input, m_tombstoneVersions);
} else if (tombstoneOpType == 1) {
- if (m_tombstoneKeys == NULLPTR) {
+ if (m_tombstoneKeys == nullptr) {
m_tombstoneKeys = CacheableHashSet::create();
}
// input.readObject(m_tombstoneKeys);
@@ -1516,7 +1499,7 @@ TcrMessageDestroyRegion::TcrMessageDestroyRegion(
m_messageResponseTimeout = messageResponsetimeout;
uint32_t numOfParts = 1;
- if (aCallbackArgument != NULLPTR) {
+ if (aCallbackArgument != nullptr) {
++numOfParts;
}
@@ -1526,7 +1509,7 @@ TcrMessageDestroyRegion::TcrMessageDestroyRegion(
writeHeader(m_msgType, numOfParts);
writeRegionPart(m_regionName);
writeEventIdPart();
- if (aCallbackArgument != NULLPTR) {
+ if (aCallbackArgument != nullptr) {
writeObjectPart(aCallbackArgument);
}
if (m_messageResponseTimeout != -1) {
@@ -1550,7 +1533,7 @@ TcrMessageClearRegion::TcrMessageClearRegion(
m_isSecurityHeaderAdded = false;
uint32_t numOfParts = 1;
- if (aCallbackArgument != NULLPTR) {
+ if (aCallbackArgument != nullptr) {
++numOfParts;
}
@@ -1560,7 +1543,7 @@ TcrMessageClearRegion::TcrMessageClearRegion(
writeHeader(m_msgType, numOfParts);
writeRegionPart(m_regionName);
writeEventIdPart();
- if (aCallbackArgument != NULLPTR) {
+ if (aCallbackArgument != nullptr) {
writeObjectPart(aCallbackArgument);
}
if (m_messageResponseTimeout != -1) {
@@ -1671,7 +1654,7 @@ TcrMessageQueryWithParameters::TcrMessageQueryWithParameters(
writeIntPart(m_messageResponseTimeout);
}
// Part-5: Parameters
- if (paramList != NULLPTR) {
+ if (paramList != nullptr) {
for (int32_t i = 0; i < paramList->size(); i++) {
CacheablePtr value = (*paramList)[i];
writeObjectPart(value);
@@ -1691,13 +1674,13 @@ TcrMessageContainsKey::TcrMessageContainsKey(
m_timeout = DEFAULT_TIMEOUT_SECONDS;
uint32_t numOfParts = 2;
- if (aCallbackArgument != NULLPTR) {
+ if (aCallbackArgument != nullptr) {
++numOfParts;
}
numOfParts++;
- if (key == NULLPTR) {
+ if (key == nullptr) {
delete m_request;
throw IllegalArgumentException(
"key passed to the constructor can't be NULL");
@@ -1708,7 +1691,7 @@ TcrMessageContainsKey::TcrMessageContainsKey(
writeObjectPart(key);
// write 0 to indicate containskey (1 for containsvalueforkey)
writeIntPart(isContainsKey ? 0 : 1);
- if (aCallbackArgument != NULLPTR) {
+ if (aCallbackArgument != nullptr) {
writeObjectPart(aCallbackArgument);
}
writeMessageLength();
@@ -1740,13 +1723,13 @@ TcrMessageRequest::TcrMessageRequest(const Region* region,
m_timeout = DEFAULT_TIMEOUT_SECONDS;
uint32_t numOfParts = 2;
- if (aCallbackArgument != NULLPTR) {
+ if (aCallbackArgument != nullptr) {
++numOfParts;
}
numOfParts++;
- if (key == NULLPTR) {
+ if (key == nullptr) {
delete m_request;
throw IllegalArgumentException(
"key passed to the constructor can't be NULL");
@@ -1756,7 +1739,7 @@ TcrMessageRequest::TcrMessageRequest(const Region* region,
writeHeader(TcrMessage::REQUEST, numOfParts);
writeRegionPart(m_regionName);
writeObjectPart(key);
- if (aCallbackArgument != NULLPTR) {
+ if (aCallbackArgument != nullptr) {
// set bool variable to true.
m_isCallBackArguement = true;
writeObjectPart(aCallbackArgument);
@@ -1777,13 +1760,13 @@ TcrMessageInvalidate::TcrMessageInvalidate(const Region* region,
m_timeout = DEFAULT_TIMEOUT_SECONDS;
uint32_t numOfParts = 2;
- if (aCallbackArgument != NULLPTR) {
+ if (aCallbackArgument != nullptr) {
++numOfParts;
}
numOfParts++;
- if (key == NULLPTR) {
+ if (key == nullptr) {
delete m_request;
throw IllegalArgumentException(
"key passed to the constructor can't be NULL");
@@ -1793,7 +1776,7 @@ TcrMessageInvalidate::TcrMessageInvalidate(const Region* region,
writeRegionPart(m_regionName);
writeObjectPart(key);
writeEventIdPart();
- if (aCallbackArgument != NULLPTR) {
+ if (aCallbackArgument != nullptr) {
// set bool variable to true.
m_isCallBackArguement = true;
writeObjectPart(aCallbackArgument);
@@ -1814,19 +1797,19 @@ TcrMessageDestroy::TcrMessageDestroy(const Region* region,
m_region = region;
m_timeout = DEFAULT_TIMEOUT_SECONDS;
uint32_t numOfParts = 2;
- if (aCallbackArgument != NULLPTR) {
+ if (aCallbackArgument != nullptr) {
++numOfParts;
}
numOfParts++;
- if (key == NULLPTR) {
+ if (key == nullptr) {
delete m_request;
throw IllegalArgumentException(
"key passed to the constructor can't be NULL");
}
- if (value != NULLPTR) {
+ if (value != nullptr) {
numOfParts += 2; // for GFE Destroy65.java
writeHeader(TcrMessage::DESTROY, numOfParts);
writeRegionPart(m_regionName);
@@ -1836,7 +1819,7 @@ TcrMessageDestroy::TcrMessageDestroy(const Region* region,
CacheableBytePtr removeBytePart = CacheableByte::create(removeByte);
writeObjectPart(removeBytePart); // operation part
writeEventIdPart();
- if (aCallbackArgument != NULLPTR) {
+ if (aCallbackArgument != nullptr) {
writeObjectPart(aCallbackArgument);
}
writeMessageLength();
@@ -1845,10 +1828,10 @@ TcrMessageDestroy::TcrMessageDestroy(const Region* region,
writeHeader(TcrMessage::DESTROY, numOfParts);
writeRegionPart(m_regionName);
writeObjectPart(key);
- writeObjectPart(NULLPTR); // expectedOldValue part
- writeObjectPart(NULLPTR); // operation part
+ writeObjectPart(nullptr); // expectedOldValue part
+ writeObjectPart(nullptr); // operation part
writeEventIdPart();
- if (aCallbackArgument != NULLPTR) {
+ if (aCallbackArgument != nullptr) {
writeObjectPart(aCallbackArgument);
}
writeMessageLength();
@@ -1873,13 +1856,13 @@ TcrMessagePut::TcrMessagePut(const Region* region, const CacheableKeyPtr& key,
// TODO check the number of parts in this constructor. doubt because in PUT
// value can be NULL also.
uint32_t numOfParts = 5;
- if (aCallbackArgument != NULLPTR) {
+ if (aCallbackArgument != nullptr) {
++numOfParts;
}
numOfParts++;
- if (key == NULLPTR) {
+ if (key == nullptr) {
delete m_request;
throw IllegalArgumentException(
"key passed to the constructor can't be NULL");
@@ -1888,13 +1871,13 @@ TcrMessagePut::TcrMessagePut(const Region* region, const CacheableKeyPtr& key,
numOfParts++;
writeHeader(m_msgType, numOfParts);
writeRegionPart(m_regionName);
- writeObjectPart(NULLPTR); // operation = null
+ writeObjectPart(nullptr); // operation = null
writeIntPart(0); // flags = 0
writeObjectPart(key);
writeObjectPart(CacheableBoolean::create(isDelta));
writeObjectPart(value, isDelta);
writeEventIdPart(0, fullValueAfterDeltaFail);
- if (aCallbackArgument != NULLPTR) {
+ if (aCallbackArgument != nullptr) {
writeObjectPart(aCallbackArgument);
}
writeMessageLength();
@@ -1975,10 +1958,10 @@ TcrMessageRegisterInterestList::TcrMessageRegisterInterestList(
writeInterestResultPolicyPart(interestPolicy);
writeBytePart(isDurable ? 1 : 0); // keepalive
- CacheableArrayListPtr cal(CacheableArrayList::create());
+ auto cal = CacheableArrayList::create();
for (uint32_t i = 0; i < numInItrestList; i++) {
- if (keys[i] == NULLPTR) {
+ if (keys[i] == nullptr) {
delete m_request;
throw IllegalArgumentException(
"keys in the interest list cannot be NULL");
@@ -1989,7 +1972,7 @@ TcrMessageRegisterInterestList::TcrMessageRegisterInterestList(
writeObjectPart(cal);
uint8_t bytes[2];
- CacheableBytesPtr byteArr = NULLPTR;
+ CacheableBytesPtr byteArr = nullptr;
bytes[0] = receiveValues ? 0 : 1; // reveive values
byteArr = CacheableBytes::create(bytes, 1);
writeObjectPart(byteArr);
@@ -2027,7 +2010,7 @@ TcrMessageUnregisterInterestList::TcrMessageUnregisterInterestList(
writeIntPart(static_cast<int32_t>(numInItrestList));
for (uint32_t i = 0; i < numInItrestList; i++) {
- if (keys[i] == NULLPTR) {
+ if (keys[i] == nullptr) {
delete m_request;
throw IllegalArgumentException(
"keys in the interest list cannot be NULL");
@@ -2076,7 +2059,7 @@ TcrMessageRegisterInterest::TcrMessageRegisterInterest(
writeRegionPart(str2); // regexp string
uint8_t bytes[2];
- CacheableBytesPtr byteArr = NULLPTR;
+ CacheableBytesPtr byteArr = nullptr;
bytes[0] = receiveValues ? 0 : 1;
byteArr = CacheableBytes::create(bytes, 1);
writeObjectPart(byteArr);
@@ -2207,7 +2190,7 @@ TcrMessagePutAll::TcrMessagePutAll(const Region* region,
uint32_t numOfParts = 0;
// bool skipCallBacks = false;
- if (aCallbackArgument != NULLPTR) {
+ if (aCallbackArgument != nullptr) {
m_msgType = TcrMessage::PUT_ALL_WITH_CALLBACK;
numOfParts = 6 + map.size() * 2;
// skipCallBacks = false;
@@ -2244,7 +2227,7 @@ TcrMessagePutAll::TcrMessagePutAll(const Region* region,
writeIntPart(map.size());
- if (aCallbackArgument != NULLPTR) {
+ if (aCallbackArgument != nullptr) {
writeObjectPart(aCallbackArgument);
}
@@ -2325,14 +2308,14 @@ TcrMessageGetAll::TcrMessageGetAll(const Region* region,
m_regionName = region->getFullPath();
m_region = region;
- /*CacheableObjectArrayPtr keyArr = NULLPTR;
+ /*CacheableObjectArrayPtr keyArr = nullptr;
if (keys != NULL) {
keyArr = CacheableObjectArray::create();
for (int32_t index = 0; index < keys->size(); ++index) {
keyArr->push_back(keys->operator[](index));
}
}*/
- if (m_callbackArgument != NULLPTR) {
+ if (m_callbackArgument != nullptr) {
m_msgType = TcrMessage::GET_ALL_WITH_CALLBACK;
} else {
m_msgType = TcrMessage::GET_ALL_70;
@@ -2347,7 +2330,7 @@ TcrMessageGetAll::TcrMessageGetAll(const Region* region,
}
void TcrMessage::InitializeGetallMsg(const UserDataPtr& aCallbackArgument) {
- /*CacheableObjectArrayPtr keyArr = NULLPTR;
+ /*CacheableObjectArrayPtr keyArr = nullptr;
if (m_keyList != NULL) {
keyArr = CacheableObjectArray::create();
for (int32_t index = 0; index < m_keyList->size(); ++index) {
@@ -2357,8 +2340,8 @@ void TcrMessage::InitializeGetallMsg(const UserDataPtr& aCallbackArgument) {
// LOGINFO(" in InitializeGetallMsg %s ", m_regionName.c_str());
// writeHeader(m_msgType, 2);
// writeRegionPart(m_regionName);
- writeObjectPart(NULLPTR, false, false, m_keyList); // will do manually
- if (aCallbackArgument != NULLPTR) {
+ writeObjectPart(nullptr, false, false, m_keyList); // will do manually
+ if (aCallbackArgument != nullptr) {
writeObjectPart(aCallbackArgument);
} else {
writeIntPart(0);
@@ -2449,15 +2432,15 @@ TcrMessageExecuteRegionFunction::TcrMessageExecuteRegionFunction(
m_region = region;
m_hasResult = getResult;
- if (routingObj != NULLPTR && routingObj->size() == 1) {
+ if (routingObj != nullptr && routingObj->size() == 1) {
LOGDEBUG("setting up key");
- m_key = routingObj->at(0);
+ m_key = std::static_pointer_cast<CacheableKey>(routingObj->at(0));
}
- uint32_t numOfParts = 6 + (routingObj == NULLPTR ? 0 : routingObj->size());
+ uint32_t numOfParts = 6 + (routingObj == nullptr ? 0 : routingObj->size());
numOfParts +=
2; // for the FunctionHA isReExecute and removedNodesSize parts.
- if (failedNodes != NULLPTR) {
+ if (failedNodes != nullptr) {
numOfParts++;
}
writeHeader(m_msgType, numOfParts);
@@ -2474,16 +2457,16 @@ TcrMessageExecuteRegionFunction::TcrMessageExecuteRegionFunction(
writeRegionPart(funcName); // function name string
writeObjectPart(args);
// klug for MemberMappedArgs
- writeObjectPart(NULLPTR);
+ writeObjectPart(nullptr);
writeBytePart(reExecute); // FunctionHA isReExecute = false
- writeIntPart(routingObj == NULLPTR ? 0 : routingObj->size());
- if (routingObj != NULLPTR) {
+ writeIntPart(routingObj == nullptr ? 0 : routingObj->size());
+ if (routingObj != nullptr) {
for (int32_t i = 0; i < routingObj->size(); i++) {
CacheablePtr value = routingObj->operator[](i);
writeObjectPart(value);
}
}
- if (failedNodes != NULLPTR) {
+ if (failedNodes != nullptr) {
writeIntPart(failedNodes->size());
writeObjectPart(failedNodes);
} else {
@@ -2504,10 +2487,10 @@ TcrMessageExecuteRegionFunctionSingleHop::
m_region = region;
m_hasResult = getResult;
- uint32_t numOfParts = 6 + (routingObj == NULLPTR ? 0 : routingObj->size());
+ uint32_t numOfParts = 6 + (routingObj == nullptr ? 0 : routingObj->size());
numOfParts +=
2; // for the FunctionHA isReExecute and removedNodesSize parts.
- if (failedNodes != NULLPTR) {
+ if (failedNodes != nullptr) {
numOfParts++;
}
writeHeader(m_msgType, numOfParts);
@@ -2524,29 +2507,25 @@ TcrMessageExecuteRegionFunctionSingleHop::
writeRegionPart(funcName); // function name string
writeObjectPart(args);
// klug for MemberMappedArgs
- writeObjectPart(NULLPTR);
+ writeObjectPart(nullptr);
writeBytePart(allBuckets ? 1 : 0);
- writeIntPart(routingObj == NULLPTR ? 0 : routingObj->size());
- if (routingObj != NULLPTR) {
+ writeIntPart(routingObj == nullptr ? 0 : routingObj->size());
+ if (routingObj != nullptr) {
if (allBuckets) {
LOGDEBUG("All Buckets so putting IntPart for buckets = %d ",
routingObj->size());
- for (CacheableHashSet::Iterator itr = routingObj->begin();
- itr != routingObj->end(); ++itr) {
- CacheableInt32Ptr value = *itr;
- writeIntPart(value->value());
+ for (const auto& itr : *routingObj) {
+ writeIntPart(std::static_pointer_cast<CacheableInt32>(itr)->value());
}
} else {
LOGDEBUG("putting keys as withFilter called, routing Keys size = %d ",
routingObj->size());
- for (CacheableHashSet::Iterator itr = routingObj->begin();
- itr != routingObj->end(); ++itr) {
- CacheablePtr value = *itr;
- writeObjectPart(value);
+ for (const auto& itr : *routingObj) {
+ writeObjectPart(itr);
}
}
}
- if (failedNodes != NULLPTR) {
+ if (failedNodes != nullptr) {
writeIntPart(failedNodes->size());
writeObjectPart(failedNodes);
} else {
@@ -2622,7 +2601,7 @@ void TcrMessage::createUserCredentialMessage(TcrConnection* conn) {
DataOutput dOut;
- if (m_creds != NULLPTR) m_creds->toData(dOut);
+ if (m_creds != nullptr) m_creds->toData(dOut);
CacheableBytesPtr credBytes =
CacheableBytes::create(dOut.getBuffer(), dOut.getBufferLength());
@@ -2990,17 +2969,17 @@ void TcrMessage::readHashMapForGCVersions(
int64_t version;
input.read(&versiontype);
input.readInt(&version);
- CacheablePtr valVersion = CacheableInt64::create(version);
- CacheableKeyPtr keyPtr = dynCast<CacheableKeyPtr>(key);
- CacheablePtr valVersionPtr = dynCast<CacheablePtr>(valVersion);
+ auto valVersion = CacheableInt64::create(version);
+ auto keyPtr = std::dynamic_pointer_cast<CacheableKey>(key);
+ auto valVersionPtr = std::dynamic_pointer_cast<Cacheable>(valVersion);
- if (value != NULLPTR) {
+ if (value != nullptr) {
value->insert(keyPtr, valVersionPtr);
} else {
throw Exception(
"Inserting values in HashMap For GC versions. value must not be "
- "NULLPTR. ");
+ "nullptr. ");
}
}
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/TcrMessage.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/TcrMessage.hpp b/src/cppcache/src/TcrMessage.hpp
index d7fdf93..00951e2 100644
--- a/src/cppcache/src/TcrMessage.hpp
+++ b/src/cppcache/src/TcrMessage.hpp
@@ -380,7 +380,7 @@ class CPPCACHE_EXPORT TcrMessage {
// takes ownership of delta bytes.
CacheableBytesPtr getDeltaBytes() {
if (m_deltaBytes == NULL) {
- return NULLPTR;
+ return nullptr;
}
CacheableBytesPtr retVal(
CacheableBytes::createNoCopy(m_deltaBytes, m_deltaBytesLen));
@@ -449,7 +449,7 @@ class CPPCACHE_EXPORT TcrMessage {
protected:
TcrMessage()
: m_feAnotherHop(false),
- m_connectionIDBytes(NULLPTR),
+ m_connectionIDBytes(nullptr),
isSecurityOn(false),
m_isLastChunkAndisSecurityHeader(0),
m_isSecurityHeaderAdded(false),
@@ -467,11 +467,11 @@ class CPPCACHE_EXPORT TcrMessage {
m_chunkedResult(NULL),
m_keyList(NULL),
m_key(),
- m_value(NULLPTR),
+ m_value(nullptr),
m_failedNode(),
- m_callbackArgument(NULLPTR),
+ m_callbackArgument(nullptr),
m_versionTag(),
- m_eventid(NULLPTR),
+ m_eventid(nullptr),
m_regionName("INVALID_REGION_NAME"),
m_region(NULL),
m_regex(),
@@ -499,7 +499,7 @@ class CPPCACHE_EXPORT TcrMessage {
m_deltaBytes(NULL),
m_deltaBytesLen(0),
m_isCallBackArguement(false),
- m_bucketServerLocation(NULLPTR),
+ m_bucketServerLocation(nullptr),
m_entryNotFound(0),
m_fpaSet(),
m_functionAttributes(),
@@ -1028,7 +1028,7 @@ class TcrMessageGetAll : public TcrMessage {
public:
TcrMessageGetAll(const Region* region, const VectorOfCacheableKey* keys,
ThinClientBaseDM* connectionDM = NULL,
- const UserDataPtr& aCallbackArgument = NULLPTR);
+ const UserDataPtr& aCallbackArgument = nullptr);
virtual ~TcrMessageGetAll() {}
};
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/ThinClientCacheDistributionManager.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ThinClientCacheDistributionManager.cpp b/src/cppcache/src/ThinClientCacheDistributionManager.cpp
index 931c8ed..9104ecc 100644
--- a/src/cppcache/src/ThinClientCacheDistributionManager.cpp
+++ b/src/cppcache/src/ThinClientCacheDistributionManager.cpp
@@ -183,8 +183,8 @@ bool ThinClientCacheDistributionManager::postFailoverAction(
return false;
}
try {
- RemoteQueryServicePtr rqsService =
- dynCast<RemoteQueryServicePtr>(cache->getQueryService(true));
+ auto rqsService = std::dynamic_pointer_cast<RemoteQueryService>(
+ cache->getQueryService(true));
rqsService->executeAllCqs(true);
} catch (const Exception& excp) {
LOGWARN("Failed to recover CQs during failover attempt to endpoint[%s]: %s",
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/ThinClientDistributionManager.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ThinClientDistributionManager.cpp b/src/cppcache/src/ThinClientDistributionManager.cpp
index 12fcae7..9063437 100644
--- a/src/cppcache/src/ThinClientDistributionManager.cpp
+++ b/src/cppcache/src/ThinClientDistributionManager.cpp
@@ -311,7 +311,7 @@ PropertiesPtr ThinClientDistributionManager::getCredentials(TcrEndpoint* ep) {
AuthInitializePtr authInitialize = DistributedSystem::m_impl->getAuthLoader();
- if (authInitialize != NULLPTR) {
+ if (authInitialize != nullptr) {
LOGFINER(
"ThinClientDistributionManager::getCredentials: acquired handle to "
"authLoader, "
@@ -331,7 +331,7 @@ PropertiesPtr ThinClientDistributionManager::getCredentials(TcrEndpoint* ep) {
tmpSecurityProperties, /*tmpEndpoint*/ ep->name().c_str());
return tmpAuthIniSecurityProperties;
}
- return NULLPTR;
+ return nullptr;
}
GfErrType ThinClientDistributionManager::sendUserCredentials(
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/ThinClientHARegion.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ThinClientHARegion.cpp b/src/cppcache/src/ThinClientHARegion.cpp
index ae2fc2f..0ef2e0a 100644
--- a/src/cppcache/src/ThinClientHARegion.cpp
+++ b/src/cppcache/src/ThinClientHARegion.cpp
@@ -27,7 +27,8 @@ namespace geode {
namespace client {
ThinClientHARegion::ThinClientHARegion(const std::string& name,
- CacheImpl* cache, RegionInternal* rPtr,
+ CacheImpl* cache,
+ const RegionInternalPtr& rPtr,
const RegionAttributesPtr& attributes,
const CacheStatisticsPtr& stats,
bool shared, bool enableNotification)
@@ -60,7 +61,7 @@ void ThinClientHARegion::initTCR() {
m_tcrdm->init();
} else {
m_tcrdm = dynamic_cast<ThinClientPoolHADM*>(
- PoolManager::find(m_attribute->getPoolName()).ptr());
+ PoolManager::find(m_attribute->getPoolName()).get());
if (m_tcrdm) {
m_poolDM = true;
// Pool DM should only be inited once and it
@@ -106,8 +107,8 @@ void ThinClientHARegion::handleMarker() {
return;
}
- if (m_listener != NULLPTR && !m_processedMarker) {
- RegionEvent event(RegionPtr(this), NULLPTR, false);
+ if (m_listener != nullptr && !m_processedMarker) {
+ RegionEvent event(shared_from_this(), nullptr, false);
int64_t sampleStartNanos = Utils::startStatOpTime();
try {
m_listener->afterRegionLive(event);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/ThinClientHARegion.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ThinClientHARegion.hpp b/src/cppcache/src/ThinClientHARegion.hpp
index 65ef3c5..9a3e711 100644
--- a/src/cppcache/src/ThinClientHARegion.hpp
+++ b/src/cppcache/src/ThinClientHARegion.hpp
@@ -47,7 +47,7 @@ class CPPCACHE_EXPORT ThinClientHARegion : public ThinClientRegion {
* @brief constructor/destructor
*/
ThinClientHARegion(const std::string& name, CacheImpl* cache,
- RegionInternal* rPtr,
+ const RegionInternalPtr& rPtr,
const RegionAttributesPtr& attributes,
const CacheStatisticsPtr& stats, bool shared = false,
bool enableNotification = true);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/ThinClientLocatorHelper.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ThinClientLocatorHelper.cpp b/src/cppcache/src/ThinClientLocatorHelper.cpp
index 57a0482..2942a84 100644
--- a/src/cppcache/src/ThinClientLocatorHelper.cpp
+++ b/src/cppcache/src/ThinClientLocatorHelper.cpp
@@ -118,7 +118,7 @@ GfErrType ThinClientLocatorHelper::getAllServers(
}
DataInput di(reinterpret_cast<uint8_t*>(buff), receivedLength);
- GetAllServersResponsePtr response(NULLPTR);
+ GetAllServersResponsePtr response(nullptr);
/* adongre
* SSL Enabled on Location and not in the client
@@ -216,7 +216,7 @@ GfErrType ThinClientLocatorHelper::getEndpointForNewCallBackConn(
continue;
}
DataInput di(reinterpret_cast<uint8_t*>(buff), receivedLength);
- QueueConnectionResponsePtr response(NULLPTR);
+ QueueConnectionResponsePtr response(nullptr);
/* adongre
* ssl defect
@@ -412,7 +412,7 @@ GfErrType ThinClientLocatorHelper::updateLocators(
continue;
}
DataInput di(reinterpret_cast<uint8_t*>(buff), receivedLength);
- LocatorListResponsePtr response(new LocatorListResponse());
+ auto response = std::make_shared<LocatorListResponse>();
/* adongre
* SSL Enabled on Location and not in the client
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/ThinClientPoolDM.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ThinClientPoolDM.cpp b/src/cppcache/src/ThinClientPoolDM.cpp
index 7c8fab5..7b53636 100644
--- a/src/cppcache/src/ThinClientPoolDM.cpp
+++ b/src/cppcache/src/ThinClientPoolDM.cpp
@@ -75,13 +75,13 @@ class GetAllWork : public PooledWork<GfErrType>,
m_attemptFailover(attemptFailover),
m_isBGThread(isBGThread),
m_addToLocalCache(addToLocalCache),
- m_userAttribute(NULLPTR),
+ m_userAttribute(nullptr),
m_responseHandler(responseHandler),
m_regionName(region->getFullPath()),
m_keys(keys),
m_region(region),
m_aCallbackArgument(aCallbackArgument) {
- m_request = new TcrMessageGetAll(region.ptr(), m_keys.ptr(), m_poolDM,
+ m_request = new TcrMessageGetAll(region.get(), m_keys.get(), m_poolDM,
m_aCallbackArgument);
m_reply = new TcrMessageReply(true, m_poolDM);
if (m_poolDM->isMultiUserMode()) {
@@ -90,7 +90,7 @@ class GetAllWork : public PooledWork<GfErrType>,
}
m_resultCollector = (new ChunkedGetAllResponse(
- *m_reply, dynamic_cast<ThinClientRegion*>(m_region.ptr()), m_keys.ptr(),
+ *m_reply, dynamic_cast<ThinClientRegion*>(m_region.get()), m_keys.get(),
m_responseHandler->getValues(), m_responseHandler->getExceptions(),
m_responseHandler->getResultKeys(),
m_responseHandler->getUpdateCounters(), 0, m_addToLocalCache,
@@ -111,7 +111,7 @@ class GetAllWork : public PooledWork<GfErrType>,
GfErrType execute(void) {
GuardUserAttribures gua;
- if (m_userAttribute != NULLPTR) {
+ if (m_userAttribute != nullptr) {
gua.setProxyCache(m_userAttribute->getProxyCache());
}
m_request->InitializeGetallMsg(
@@ -201,7 +201,7 @@ ThinClientPoolDM::ThinClientPoolDM(const char* name,
}
}
if (m_attrs->getPRSingleHopEnabled()) {
- m_clientMetadataService = new ClientMetadataService(PoolPtr(this));
+ m_clientMetadataService = new ClientMetadataService(this);
}
m_manager = new ThinClientStickyManager(this);
}
@@ -241,7 +241,7 @@ PropertiesPtr ThinClientPoolDM::getCredentials(TcrEndpoint* ep) {
AuthInitializePtr authInitialize = DistributedSystem::m_impl->getAuthLoader();
- if (authInitialize != NULLPTR) {
+ if (authInitialize != nullptr) {
LOGFINER(
"ThinClientPoolDM::getCredentials: acquired handle to authLoader, "
"invoking getCredentials %s",
@@ -250,7 +250,7 @@ PropertiesPtr ThinClientPoolDM::getCredentials(TcrEndpoint* ep) {
tmpSecurityProperties, ep->name().c_str());
return tmpAuthIniSecurityProperties;
}
- return NULLPTR;
+ return nullptr;
}
void ThinClientPoolDM::startBackgroundThreads() {
@@ -345,7 +345,7 @@ void ThinClientPoolDM::startBackgroundThreads() {
"service");
// Init Query Service
m_remoteQueryServicePtr =
- new RemoteQueryService(m_connManager.getCacheImpl(), this);
+ std::make_shared<RemoteQueryService>(m_connManager.getCacheImpl(), this);
m_remoteQueryServicePtr->init();
LOGDEBUG(
@@ -613,7 +613,7 @@ GfErrType ThinClientPoolDM::sendRequestToAllServers(
CacheableStringArrayPtr csArray = getServers();
- if (csArray != NULLPTR && csArray->length() == 0) {
+ if (csArray != nullptr && csArray->length() == 0) {
LOGWARN("No server found to execute the function");
return GF_NOSERVER_FOUND;
}
@@ -624,7 +624,7 @@ GfErrType ThinClientPoolDM::sendRequestToAllServers(
UserAttributesPtr userAttr =
TSSUserAttributesWrapper::s_geodeTSSUserAttributes->getUserAttributes();
for (int i = 0; i < csArray->length(); i++) {
- CacheableStringPtr cs = csArray[i];
+ CacheableStringPtr cs = (*csArray)[i];
std::string endpointStr(cs->asChar());
TcrEndpoint* ep = NULL;
if (m_endpoints.find(endpointStr, ep)) {
@@ -645,7 +645,7 @@ GfErrType ThinClientPoolDM::sendRequestToAllServers(
FunctionExecution* funcExe = &fePtrList[i];
err = funcExe->getResult();
if (err != GF_NOERR) {
- if (funcExe->getException() == NULLPTR) {
+ if (funcExe->getException() == nullptr) {
if (err == GF_TIMOUT) {
getStats().incTimeoutClientOps();
} else {
@@ -781,9 +781,9 @@ void ThinClientPoolDM::destroy(bool keepAlive) {
if (!m_isDestroyed && (!m_destroyPending || m_destroyPendingHADM)) {
checkRegions();
TcrMessage::setKeepAlive(keepAlive);
- if (m_remoteQueryServicePtr != NULLPTR) {
+ if (m_remoteQueryServicePtr != nullptr) {
m_remoteQueryServicePtr->close();
- m_remoteQueryServicePtr = NULLPTR;
+ m_remoteQueryServicePtr = nullptr;
}
LOGDEBUG("Closing PoolStatsSampler thread.");
@@ -867,7 +867,7 @@ QueryServicePtr ThinClientPoolDM::getQueryService() {
}
QueryServicePtr ThinClientPoolDM::getQueryServiceWithoutCheck() {
- if (!(m_remoteQueryServicePtr == NULLPTR)) {
+ if (!(m_remoteQueryServicePtr == nullptr)) {
return m_remoteQueryServicePtr;
}
SystemProperties* props = DistributedSystem::getSystemProperties();
@@ -875,8 +875,8 @@ QueryServicePtr ThinClientPoolDM::getQueryServiceWithoutCheck() {
if (props->isGridClient()) {
LOGWARN("Initializing query service while grid-client setting is enabled.");
// Init Query Service
- m_remoteQueryServicePtr =
- new RemoteQueryService(m_connManager.getCacheImpl(), this);
+ m_remoteQueryServicePtr = std::make_shared<RemoteQueryService>(
+ m_connManager.getCacheImpl(), this);
m_remoteQueryServicePtr->init();
} else {
LOGWARN("Remote query service is not initialized.");
@@ -944,7 +944,7 @@ int32_t ThinClientPoolDM::GetPDXIdForType(SerializablePtr pdxType) {
}
int32_t pdxTypeId =
- static_cast<CacheableInt32*>(reply.getValue().ptr())->value();
+ static_cast<CacheableInt32*>(reply.getValue().get())->value();
// need to broadcast this id to all other pool
{
@@ -953,7 +953,7 @@ int32_t ThinClientPoolDM::GetPDXIdForType(SerializablePtr pdxType) {
for (HashMapOfPools::Iterator iter = pools.begin(); iter != pools.end();
++iter) {
ThinClientPoolDM* currPool =
- static_cast<ThinClientPoolDM*>(iter.second().ptr());
+ static_cast<ThinClientPoolDM*>(iter.second().get());
if (currPool != this) {
currPool->AddPdxType(pdxType, pdxTypeId);
@@ -1026,7 +1026,7 @@ int32_t ThinClientPoolDM::GetEnumValue(SerializablePtr enumInfo) {
}
int32_t enumVal =
- static_cast<CacheableInt32*>(reply.getValue().ptr())->value();
+ static_cast<CacheableInt32*>(reply.getValue().get())->value();
// need to broadcast this id to all other pool
{
@@ -1035,7 +1035,7 @@ int32_t ThinClientPoolDM::GetEnumValue(SerializablePtr enumInfo) {
for (HashMapOfPools::Iterator iter = pools.begin(); iter != pools.end();
++iter) {
ThinClientPoolDM* currPool =
- static_cast<ThinClientPoolDM*>(iter.second().ptr());
+ static_cast<ThinClientPoolDM*>(iter.second().get());
if (currPool != this) {
currPool->AddEnum(enumInfo, enumVal);
@@ -1151,19 +1151,20 @@ TcrEndpoint* ThinClientPoolDM::getSingleHopServer(
BucketServerLocationPtr& serverlocation,
std::set<ServerLocation>& excludeServers) {
const CacheableKeyPtr& key = request.getKeyRef();
- if (m_clientMetadataService == NULL || key == NULLPTR) return NULL;
- RegionPtr region(request.getRegion());
+ if (m_clientMetadataService == NULL || key == nullptr) return NULL;
+ auto r = request.getRegion();
+ auto region = nullptr == r ? nullptr : r->shared_from_this();
TcrEndpoint* ep = NULL;
- if (region == NULLPTR) {
+ if (region == nullptr) {
m_connManager.getCacheImpl()->getRegion(request.getRegionName().c_str(),
region);
}
- if (region != NULLPTR) {
+ if (region != nullptr) {
m_clientMetadataService->getBucketServerLocation(
region, key, request.getValueRef(), request.getCallbackArgumentRef(),
request.forPrimary(), serverlocation, version);
- if (serverlocation != NULLPTR && serverlocation->isValid()) {
+ if (serverlocation != nullptr && serverlocation->isValid()) {
LOGFINE("Server host and port are %s:%d",
serverlocation->getServerName().c_str(),
serverlocation->getPort());
@@ -1196,7 +1197,7 @@ TcrEndpoint* ThinClientPoolDM::getEndPoint(
itr != m_attrs->m_initServList.end(); ++itr) {
if ((ACE_OS::strcmp(serverLocation->getEpString().c_str(),
(*itr).c_str()) == 0)) {
- ep = addEP(*(serverLocation.ptr())); // see if this is new endpoint
+ ep = addEP(*(serverLocation.get())); // see if this is new endpoint
break;
}
}
@@ -1208,14 +1209,14 @@ TcrEndpoint* ThinClientPoolDM::getEndPoint(
std::string servGrp = this->getServerGroup();
if (servGrp.length() > 0) {
CacheableStringArrayPtr groups = serverLocation->getServerGroups();
- if ((groups != NULLPTR) && (groups->length() > 0)) {
+ if ((groups != nullptr) && (groups->length() > 0)) {
for (int i = 0; i < groups->length(); i++) {
- CacheableStringPtr cs = groups[i];
+ CacheableStringPtr cs = (*groups)[i];
if (cs->length() > 0) {
std::string str = cs->toString();
if ((ACE_OS::strcmp(str.c_str(), servGrp.c_str()) == 0)) {
ep = addEP(
- *(serverLocation.ptr())); // see if this is new endpoint
+ *(serverLocation.get())); // see if this is new endpoint
break;
}
}
@@ -1223,7 +1224,7 @@ TcrEndpoint* ThinClientPoolDM::getEndPoint(
}
} else // just add it
{
- ep = addEP(*(serverLocation.ptr())); // see if this is new endpoint
+ ep = addEP(*(serverLocation.get())); // see if this is new endpoint
}
}
}
@@ -1263,7 +1264,7 @@ GfErrType ThinClientPoolDM::sendSyncRequest(TcrMessage& request,
request.InitializeGetallMsg(
request.getCallbackArgument()); // now initialize getall msg
return sendSyncRequest(request, reply, attemptFailover, isBGThread,
- NULLPTR);
+ nullptr);
}
std::vector<GetAllWork*> getAllWorkers;
ThreadPool* threadPool = TPSingleton::instance();
@@ -1274,7 +1275,7 @@ GfErrType ThinClientPoolDM::sendSyncRequest(TcrMessage& request,
locationIter = locationMap->begin();
locationIter != locationMap->end(); locationIter++) {
BucketServerLocationPtr serverLocation = locationIter.first();
- if (serverLocation == NULLPTR) {
+ if (serverLocation == nullptr) {
}
VectorOfCacheableKeyPtr keys = locationIter.second();
GetAllWork* worker =
@@ -1311,7 +1312,7 @@ GfErrType ThinClientPoolDM::sendSyncRequest(TcrMessage& request,
request.getCallbackArgument()); // now initialize getall msg
}
return sendSyncRequest(request, reply, attemptFailover, isBGThread,
- NULLPTR);
+ nullptr);
}
}
@@ -1326,7 +1327,7 @@ GfErrType ThinClientPoolDM::sendSyncRequest(
GfErrType error = GF_NOTCON;
- UserAttributesPtr userAttr = NULLPTR;
+ UserAttributesPtr userAttr = nullptr;
reply.setDM(this);
int32_t type = request.getMessageType();
@@ -1390,7 +1391,7 @@ GfErrType ThinClientPoolDM::sendSyncRequest(
} else {
userAttr = TSSUserAttributesWrapper::s_geodeTSSUserAttributes
->getUserAttributes();
- if (userAttr == NULLPTR) {
+ if (userAttr == nullptr) {
LOGWARN("Attempted operation type %d without credentials",
request.getMessageType());
return GF_NOT_AUTHORIZED_EXCEPTION;
@@ -1419,12 +1420,12 @@ GfErrType ThinClientPoolDM::sendSyncRequest(
RegionPtr region;
m_connManager.getCacheImpl()->getRegion(request.getRegionName().c_str(),
region);
- if (region != NULLPTR) {
+ if (region != nullptr) {
LOGFINE(
"Need to refresh pr-meta-data timeout in client only with refresh "
"metadata");
ThinClientRegion* tcrRegion =
- dynamic_cast<ThinClientRegion*>(region.ptr());
+ dynamic_cast<ThinClientRegion*>(region.get());
tcrRegion->setMetaDataRefreshed(false);
m_clientMetadataService->enqueueForMetadataRefresh(
region->getFullPath(), reply.getserverGroupVersion());
@@ -1522,7 +1523,7 @@ GfErrType ThinClientPoolDM::sendSyncRequest(
TcrEndpoint* ep = conn->getEndpointObject();
if (!this->m_isMultiUserMode) {
ep->setAuthenticated(false);
- } else if (userAttr != NULLPTR) {
+ } else if (userAttr != nullptr) {
userAttr->unAuthenticateEP(ep);
}
LOGFINEST(
@@ -1543,19 +1544,19 @@ GfErrType ThinClientPoolDM::sendSyncRequest(
if (m_clientMetadataService != NULL && request.forSingleHop() &&
(reply.getMetaDataVersion() != 0 ||
(request.getMessageType() == TcrMessage::EXECUTE_REGION_FUNCTION &&
- request.getKeyRef() != NULLPTR && reply.isFEAnotherHop()))) {
+ request.getKeyRef() != nullptr && reply.isFEAnotherHop()))) {
// Need to get direct access to Region's name to avoid referencing
// temp data and causing crashes
RegionPtr region;
m_connManager.getCacheImpl()->getRegion(request.getRegionName().c_str(),
region);
- if (region != NULLPTR) {
+ if (region != nullptr) {
if (!connFound) // max limit case then don't refresh otherwise always
// refresh
{
LOGFINE("Need to refresh pr-meta-data");
ThinClientRegion* tcrRegion =
- dynamic_cast<ThinClientRegion*>(region.ptr());
+ dynamic_cast<ThinClientRegion*>(region.get());
tcrRegion->setMetaDataRefreshed(false);
}
m_clientMetadataService->enqueueForMetadataRefresh(
@@ -1943,7 +1944,7 @@ GfErrType ThinClientPoolDM::sendRequestToEP(const TcrMessage& request,
}
reply.setDM(this);
- UserAttributesPtr ua = NULLPTR;
+ UserAttributesPtr ua = nullptr;
// in multi user mode need to chk whether user is authenticated or not
// and then follow usual process which we did in send syncrequest.
// need to user initiative ops
@@ -1959,7 +1960,7 @@ GfErrType ThinClientPoolDM::sendRequestToEP(const TcrMessage& request,
} else if (this->m_isMultiUserMode) {
ua = TSSUserAttributesWrapper::s_geodeTSSUserAttributes
->getUserAttributes();
- if (ua == NULLPTR) {
+ if (ua == nullptr) {
LOGWARN("Attempted operation type %d without credentials",
request.getMessageType());
if (conn != NULL) putInQueue(conn, false, request.forTransaction());
@@ -2015,7 +2016,7 @@ GfErrType ThinClientPoolDM::sendRequestToEP(const TcrMessage& request,
if (isAuthRequireException(reply.getException())) {
if (!this->m_isMultiUserMode) {
currentEndpoint->setAuthenticated(false);
- } else if (ua != NULLPTR) {
+ } else if (ua != nullptr) {
ua->unAuthenticateEP(currentEndpoint);
}
LOGFINEST(
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/ThinClientPoolDM.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ThinClientPoolDM.hpp b/src/cppcache/src/ThinClientPoolDM.hpp
index 503cd60..ecbf487 100644
--- a/src/cppcache/src/ThinClientPoolDM.hpp
+++ b/src/cppcache/src/ThinClientPoolDM.hpp
@@ -240,7 +240,7 @@ class ThinClientPoolDM
GfErrType* error, std::set<ServerLocation>& excludeServers,
bool isBGThread, TcrMessage& request, int8_t& version, bool& match,
bool& connFound,
- const BucketServerLocationPtr& serverLocation = NULLPTR) {
+ const BucketServerLocationPtr& serverLocation = nullptr) {
TcrConnection* conn = NULL;
TcrEndpoint* theEP = NULL;
LOGDEBUG("prEnabled = %s, forSingleHop = %s %d",
@@ -249,7 +249,7 @@ class ThinClientPoolDM
request.getMessageType());
match = false;
- BucketServerLocationPtr slTmp = NULLPTR;
+ BucketServerLocationPtr slTmp = nullptr;
if (request.forTransaction()) {
bool connFound =
m_manager->getStickyConnection(conn, error, excludeServers, true);
@@ -266,7 +266,7 @@ class ThinClientPoolDM
if (txState != NULL) {
txState->setDirty();
}
- } else if (serverLocation != NULLPTR /*&& excludeServers.size() == 0*/) {
+ } else if (serverLocation != nullptr /*&& excludeServers.size() == 0*/) {
theEP = getEndPoint(serverLocation, version, excludeServers);
} else if (
m_attrs->getPRSingleHopEnabled() /*&& excludeServers.size() == 0*/ &&
@@ -278,7 +278,7 @@ class ThinClientPoolDM
// if all buckets are not initialized
// match = true;
}
- if (slTmp != NULLPTR && m_clientMetadataService != NULL) {
+ if (slTmp != nullptr && m_clientMetadataService != NULL) {
if (m_clientMetadataService->isBucketMarkedForTimeout(
request.getRegionName().c_str(), slTmp->getBucketId()) ==
true) {
@@ -297,14 +297,14 @@ class ThinClientPoolDM
createPoolConnectionToAEndPoint(conn, theEP, maxConnLimit, true);
if (*error == GF_CLIENT_WAIT_TIMEOUT ||
*error == GF_CLIENT_WAIT_TIMEOUT_REFRESH_PRMETADATA) {
- if (m_clientMetadataService == NULL || request.getKey() == NULLPTR) {
+ if (m_clientMetadataService == NULL || request.getKey() == nullptr) {
return NULL;
}
RegionPtr region;
m_connManager.getCacheImpl()->getRegion(
request.getRegionName().c_str(), region);
- if (region != NULLPTR) {
- slTmp = NULLPTR;
+ if (region != nullptr) {
+ slTmp = nullptr;
m_clientMetadataService
->markPrimaryBucketForTimeoutButLookSecondaryBucket(
region, request.getKey(), request.getValue(),
@@ -454,7 +454,8 @@ class FunctionExecution : public PooledWork<GfErrType> {
m_timeout = 0;
m_error = GF_NOERR;
m_rc = NULL;
- m_userAttr = NULLPTR;
+ m_resultCollectorLock = NULL;
+ m_userAttr = nullptr;
}
~FunctionExecution() {}
@@ -466,7 +467,7 @@ class FunctionExecution : public PooledWork<GfErrType> {
ThinClientPoolDM* poolDM,
const std::shared_ptr<ACE_Recursive_Thread_Mutex>& rCL,
ResultCollectorPtr* rs, UserAttributesPtr userAttr) {
- exceptionPtr = NULLPTR;
+ exceptionPtr = nullptr;
m_resultCollectorLock = rCL;
m_rc = rs;
m_error = GF_NOTCON;
@@ -486,7 +487,7 @@ class FunctionExecution : public PooledWork<GfErrType> {
// TSSUserAttributesWrapper::s_geodeTSSUserAttributes->setUserAttributes(m_userAttr);
GuardUserAttribures gua;
- if (m_userAttr != NULLPTR) gua.setProxyCache(m_userAttr->getProxyCache());
+ if (m_userAttr != nullptr) gua.setProxyCache(m_userAttr->getProxyCache());
std::string funcName(m_func);
TcrMessageExecuteFunction request(funcName, m_args, m_getResult, m_poolDM,
@@ -645,7 +646,7 @@ class OnRegionFunctionExecution : public PooledWork<GfErrType> {
std::string funcName(m_func);
m_request = new TcrMessageExecuteRegionFunctionSingleHop(
- funcName, m_region, m_args, m_routingObj, m_getResult, NULLPTR,
+ funcName, m_region, m_args, m_routingObj, m_getResult, nullptr,
m_allBuckets, timeout, m_poolDM);
m_reply = new TcrMessageReply(true, m_poolDM);
m_resultCollector = new ChunkedFunctionExecutionResponse(
@@ -672,7 +673,7 @@ class OnRegionFunctionExecution : public PooledWork<GfErrType> {
GfErrType execute(void) {
GuardUserAttribures gua;
- if (m_userAttr != NULLPTR) gua.setProxyCache(m_userAttr->getProxyCache());
+ if (m_userAttr != nullptr) gua.setProxyCache(m_userAttr->getProxyCache());
return m_poolDM->sendSyncRequest(*m_request, *m_reply, !(m_getResult & 1),
m_isBGThread, m_serverLocation);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/ThinClientPoolHADM.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ThinClientPoolHADM.cpp b/src/cppcache/src/ThinClientPoolHADM.cpp
index 81457c3..b9a5071 100644
--- a/src/cppcache/src/ThinClientPoolHADM.cpp
+++ b/src/cppcache/src/ThinClientPoolHADM.cpp
@@ -162,9 +162,9 @@ void ThinClientPoolHADM::destroy(bool keepAlive) {
if (!m_isDestroyed && !m_destroyPending) {
checkRegions();
- if (m_remoteQueryServicePtr != NULLPTR) {
+ if (m_remoteQueryServicePtr != nullptr) {
m_remoteQueryServicePtr->close();
- m_remoteQueryServicePtr = NULLPTR;
+ m_remoteQueryServicePtr = nullptr;
}
stopPingThread();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/ThinClientPoolRegion.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ThinClientPoolRegion.cpp b/src/cppcache/src/ThinClientPoolRegion.cpp
index 4ed2af9..c846e62 100644
--- a/src/cppcache/src/ThinClientPoolRegion.cpp
+++ b/src/cppcache/src/ThinClientPoolRegion.cpp
@@ -30,7 +30,7 @@
using namespace apache::geode::client;
ThinClientPoolRegion::ThinClientPoolRegion(
- const std::string& name, CacheImpl* cache, RegionInternal* rPtr,
+ const std::string& name, CacheImpl* cache, const RegionInternalPtr& rPtr,
const RegionAttributesPtr& attributes, const CacheStatisticsPtr& stats,
bool shared)
: ThinClientRegion(name, cache, rPtr, attributes, stats, shared) {}
@@ -40,7 +40,7 @@ ThinClientPoolRegion::~ThinClientPoolRegion() { m_tcrdm = NULL; }
void ThinClientPoolRegion::initTCR() {
try {
ThinClientPoolDM* poolDM = dynamic_cast<ThinClientPoolDM*>(
- PoolManager::find(m_regionAttributes->getPoolName()).ptr());
+ PoolManager::find(m_regionAttributes->getPoolName()).get());
m_tcrdm = dynamic_cast<ThinClientBaseDM*>(poolDM);
if (!m_tcrdm) {
// TODO: create a PoolNotFound exception.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/ThinClientPoolRegion.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ThinClientPoolRegion.hpp b/src/cppcache/src/ThinClientPoolRegion.hpp
index d208245..4db675d 100644
--- a/src/cppcache/src/ThinClientPoolRegion.hpp
+++ b/src/cppcache/src/ThinClientPoolRegion.hpp
@@ -37,7 +37,7 @@ class ThinClientPoolRegion : public ThinClientRegion {
* @brief constructor/initializer/destructor
*/
ThinClientPoolRegion(const std::string& name, CacheImpl* cache,
- RegionInternal* rPtr,
+ const RegionInternalPtr& rPtr,
const RegionAttributesPtr& attributes,
const CacheStatisticsPtr& stats, bool shared = false);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/ThinClientPoolStickyDM.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ThinClientPoolStickyDM.cpp b/src/cppcache/src/ThinClientPoolStickyDM.cpp
index 270e61d..e2dbe22 100644
--- a/src/cppcache/src/ThinClientPoolStickyDM.cpp
+++ b/src/cppcache/src/ThinClientPoolStickyDM.cpp
@@ -32,9 +32,9 @@ TcrConnection* ThinClientPoolStickyDM::getConnectionFromQueueW(
serverLocation);
return conn;
}
- BucketServerLocationPtr slTmp = NULLPTR;
+ BucketServerLocationPtr slTmp = nullptr;
if (m_attrs->getPRSingleHopEnabled() && !request.forTransaction()) {
- if (serverLocation != NULLPTR) {
+ if (serverLocation != nullptr) {
ep = getEndPoint(serverLocation, version, excludeServers);
} else if (request.forSingleHop()) {
ep = getSingleHopServer(request, version, slTmp, excludeServers);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/ThinClientPoolStickyDM.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ThinClientPoolStickyDM.hpp b/src/cppcache/src/ThinClientPoolStickyDM.hpp
index 289f7e4..42c2463 100644
--- a/src/cppcache/src/ThinClientPoolStickyDM.hpp
+++ b/src/cppcache/src/ThinClientPoolStickyDM.hpp
@@ -42,7 +42,7 @@ class ThinClientPoolStickyDM : public ThinClientPoolDM {
virtual TcrConnection* getConnectionFromQueueW(
GfErrType* error, std::set<ServerLocation>&, bool isBGThread,
TcrMessage& request, int8_t& version, bool& match, bool& connFound,
- const BucketServerLocationPtr& serverLocation = NULLPTR);
+ const BucketServerLocationPtr& serverLocation = nullptr);
virtual void putInQueue(TcrConnection* conn, bool isBGThread,
bool isTransaction = false);
virtual void setStickyNull(bool isBGThread);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/ThinClientPoolStickyHADM.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ThinClientPoolStickyHADM.hpp b/src/cppcache/src/ThinClientPoolStickyHADM.hpp
index 6785599..30c51d8 100644
--- a/src/cppcache/src/ThinClientPoolStickyHADM.hpp
+++ b/src/cppcache/src/ThinClientPoolStickyHADM.hpp
@@ -41,7 +41,7 @@ protected:
virtual void cleanStickyConnections(volatile bool& isRunning);
virtual TcrConnection* getConnectionFromQueueW( GfErrType* error,
std::set< ServerLocation >&, bool isBGThread, TcrMessage & request, int8_t&
-version, bool & dummy, const BucketServerLocationPtr& serverLocation = NULLPTR
+version, bool & dummy, const BucketServerLocationPtr& serverLocation = nullptr
);
virtual void putInQueue(TcrConnection* conn, bool isBGThread, bool
isTransaction = false );
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/ThinClientRedundancyManager.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ThinClientRedundancyManager.cpp b/src/cppcache/src/ThinClientRedundancyManager.cpp
index 4a025dd..8d0dd2c 100644
--- a/src/cppcache/src/ThinClientRedundancyManager.cpp
+++ b/src/cppcache/src/ThinClientRedundancyManager.cpp
@@ -54,8 +54,8 @@ ThinClientRedundancyManager::ThinClientRedundancyManager(
m_loggedRedundancyWarning(false),
m_poolHADM(poolHADM),
m_theTcrConnManager(theConnManager),
- m_locators(NULLPTR),
- m_servers(NULLPTR),
+ m_locators(nullptr),
+ m_servers(nullptr),
m_periodicAckTask(NULL),
m_processEventIdMapTaskId(-1),
m_nextAckInc(0),
@@ -89,7 +89,7 @@ std::list<ServerLocation> ThinClientRedundancyManager::selectServers(
m_server = 0;
}
ServerLocation location(
- Utils::convertHostToCanonicalForm(m_servers[m_server++]->asChar())
+ Utils::convertHostToCanonicalForm((*m_servers)[m_server++]->asChar())
.c_str());
if (exclEndPts.find(location) != exclEndPts.end()) {
// exclude this one
@@ -217,8 +217,8 @@ GfErrType ThinClientRedundancyManager::maintainRedundancyLevel(
m_nonredundantEndpoints.clear();
int howMany = -1;
- if (m_locators != NULLPTR && m_locators->length() > 0 &&
- m_servers != NULLPTR && m_servers->length() == 0) {
+ if (m_locators != nullptr && m_locators->length() > 0 &&
+ m_servers != nullptr && m_servers->length() == 0) {
// if we are using locators only request the required number of servers.
howMany = m_redundancyLevel - static_cast<int>(exclEndPts.size()) + 1;
}
@@ -405,10 +405,10 @@ GfErrType ThinClientRedundancyManager::maintainRedundancyLevel(
RemoteQueryServicePtr queryServicePtr;
ThinClientPoolDM* poolDM = dynamic_cast<ThinClientPoolDM*>(m_poolHADM);
if (poolDM) {
- queryServicePtr =
- dynCast<RemoteQueryServicePtr>(poolDM->getQueryServiceWithoutCheck());
+ queryServicePtr = std::dynamic_pointer_cast<RemoteQueryService>(
+ poolDM->getQueryServiceWithoutCheck());
}
- if (queryServicePtr != NULLPTR) {
+ if (queryServicePtr != nullptr) {
if (isPrimaryConnected) {
// call CqStatusListener connect
LOGDEBUG(
@@ -550,9 +550,9 @@ GfErrType ThinClientRedundancyManager::createQueueEP(TcrEndpoint* ep,
} else {
// recover CQs
CacheImpl* cache = m_theTcrConnManager->getCacheImpl();
- RemoteQueryServicePtr rqsService =
- dynCast<RemoteQueryServicePtr>(cache->getQueryService(true));
- if (rqsService != NULLPTR) {
+ auto rqsService = std::dynamic_pointer_cast<RemoteQueryService>(
+ cache->getQueryService(true));
+ if (rqsService != nullptr) {
try {
err = rqsService->executeAllCqs(ep);
} catch (const Exception& excp) {
@@ -590,9 +590,9 @@ GfErrType ThinClientRedundancyManager::createPoolQueueEP(
}
} else {
// recover CQs
- RemoteQueryServicePtr rqsService = dynCast<RemoteQueryServicePtr>(
+ auto rqsService = std::dynamic_pointer_cast<RemoteQueryService>(
m_poolHADM->getQueryServiceWithoutCheck());
- if (rqsService != NULLPTR) {
+ if (rqsService != nullptr) {
try {
err = rqsService->executeAllCqs(ep);
} catch (const Exception& excp) {
@@ -676,8 +676,8 @@ void ThinClientRedundancyManager::initialize(int redundancyLevel) {
std::vector<std::string> locators;
for (int item = 0; item < m_locators->length(); item++) {
LOGDEBUG("ThinClientRedundancyManager::initialize: adding locator %s",
- m_locators[item]->asChar());
- locators.push_back(m_locators[item]->asChar());
+ (*m_locators)[item]->asChar());
+ locators.push_back((*m_locators)[item]->asChar());
}
} else if (m_servers->length() > 0) {
@@ -869,14 +869,14 @@ GfErrType ThinClientRedundancyManager::sendSyncRequestCq(
? 5
: attempts; // at least 5 attempts if ep lists are small.
- ProxyCachePtr proxyCache = NULLPTR;
+ ProxyCachePtr proxyCache = nullptr;
while (attempts--) {
if (err != GF_NOERR || m_redundantEndpoints.empty()) {
UserAttributesPtr userAttr =
TSSUserAttributesWrapper::s_geodeTSSUserAttributes
->getUserAttributes();
- if (userAttr != NULLPTR) proxyCache = userAttr->getProxyCache();
+ if (userAttr != nullptr) proxyCache = userAttr->getProxyCache();
err = maintainRedundancyLevel();
// we continue on fatal error because MRL only tries a handshake without
// sending a request (no params passed) so no need to check
@@ -894,7 +894,7 @@ GfErrType ThinClientRedundancyManager::sendSyncRequestCq(
"ThinClientRedundancyManager::sendSyncRequestCq: to primary [%s]",
primaryEndpoint->name().c_str());
GuardUserAttribures gua;
- if (proxyCache != NULLPTR) {
+ if (proxyCache != nullptr) {
gua.setProxyCache(proxyCache);
}
err = theHADM->sendRequestToEP(request, reply, primaryEndpoint);
[29/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from cppcache
Posted by jb...@apache.org.
GEODE-2741: Remove custom shared pointer from cppcache
Project: http://git-wip-us.apache.org/repos/asf/geode-native/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode-native/commit/c0098121
Tree: http://git-wip-us.apache.org/repos/asf/geode-native/tree/c0098121
Diff: http://git-wip-us.apache.org/repos/asf/geode-native/diff/c0098121
Branch: refs/heads/develop
Commit: c0098121eb9b8ee7d537ac0d0bb767ebb6d46927
Parents: e2630b1
Author: Jacob Barrett <jb...@pivotal.io>
Authored: Tue Mar 28 17:34:29 2017 -0700
Committer: David Kimura <dk...@pivotal.io>
Committed: Mon May 15 11:40:55 2017 -0700
----------------------------------------------------------------------
packer/solaris/install-build-tools.sh | 17 +-
packer/solaris/install-opencsw.sh | 11 +-
packer/solaris/install-solarisstudio.sh | 11 +-
packer/solaris/install-test-tools.sh | 8 +-
src/clicache/src/AttributesFactory.cpp | 14 +-
src/clicache/src/AttributesMutator.cpp | 6 +-
src/clicache/src/Cache.cpp | 6 +-
src/clicache/src/CacheFactory.cpp | 4 +-
src/clicache/src/CacheTransactionManager.cpp | 10 +-
src/clicache/src/CacheableBuiltins.hpp | 4 +-
src/clicache/src/CacheableHashSet.hpp | 6 +-
src/clicache/src/CacheableObjectArray.cpp | 2 +-
src/clicache/src/CqAttributesFactory.cpp | 26 +-
src/clicache/src/CqAttributesMutator.cpp | 28 +-
src/clicache/src/CqQuery.cpp | 10 +-
src/clicache/src/DistributedSystem.cpp | 8 +-
src/clicache/src/ExceptionTypes.cpp | 2 +-
src/clicache/src/ExceptionTypes.hpp | 2 +-
src/clicache/src/Execution.cpp | 10 +-
src/clicache/src/LocalRegion.cpp | 24 +-
src/clicache/src/Pool.cpp | 4 +-
src/clicache/src/PoolFactory.cpp | 2 +-
src/clicache/src/PoolManager.cpp | 12 +-
src/clicache/src/Properties.cpp | 4 +-
src/clicache/src/QueryService.cpp | 14 +-
src/clicache/src/Region.cpp | 70 +-
src/clicache/src/RegionAttributes.cpp | 2 +-
src/clicache/src/RegionFactory.cpp | 12 +-
src/clicache/src/ResultCollector.cpp | 2 +-
src/clicache/src/ResultSet.cpp | 2 +-
src/clicache/src/Serializable.cpp | 96 +--
src/clicache/src/Serializable.hpp | 2 +-
src/clicache/src/Struct.cpp | 8 +-
src/clicache/src/StructSet.cpp | 2 +-
src/clicache/src/impl/CacheLoader.hpp | 4 +-
src/clicache/src/impl/ManagedAuthInitialize.cpp | 4 +-
src/clicache/src/impl/ManagedCacheListener.cpp | 4 +-
src/clicache/src/impl/ManagedCacheLoader.cpp | 4 +-
src/clicache/src/impl/ManagedCacheWriter.cpp | 2 +-
src/clicache/src/impl/ManagedCacheableDelta.cpp | 4 +-
.../src/impl/ManagedCacheableDeltaBytes.cpp | 6 +-
src/clicache/src/impl/ManagedCacheableKey.cpp | 4 +-
.../src/impl/ManagedCacheableKeyBytes.cpp | 6 +-
.../src/impl/ManagedCqStatusListener.hpp | 2 +-
.../src/impl/ManagedFixedPartitionResolver.cpp | 2 +-
.../src/impl/ManagedPartitionResolver.cpp | 2 +-
.../src/impl/ManagedResultCollector.cpp | 4 +-
.../src/impl/ManagedTransactionListener.cpp | 6 +-
.../src/impl/ManagedTransactionWriter.cpp | 2 +-
src/clicache/src/impl/ManagedVisitor.cpp | 4 +-
src/clicache/src/impl/PdxHelper.cpp | 4 +-
src/clicache/src/impl/PdxInstanceImpl.cpp | 4 +-
.../src/impl/PdxManagedCacheableKey.cpp | 6 +-
.../src/impl/PdxManagedCacheableKeyBytes.cpp | 8 +-
.../src/impl/PersistenceManagerProxy.hpp | 4 +-
src/clicache/src/impl/SafeConvert.hpp | 2 +-
.../include/geode/AttributesFactory.hpp | 22 +-
src/cppcache/include/geode/Cache.hpp | 14 +-
src/cppcache/include/geode/CacheFactory.hpp | 16 +-
src/cppcache/include/geode/CacheListener.hpp | 4 +-
src/cppcache/include/geode/CacheLoader.hpp | 6 +-
src/cppcache/include/geode/CacheWriter.hpp | 2 +-
src/cppcache/include/geode/Cacheable.inl | 2 +-
.../include/geode/CacheableBuiltins.hpp | 104 +--
src/cppcache/include/geode/CacheableDate.hpp | 16 +-
src/cppcache/include/geode/CacheableEnum.hpp | 5 +-
.../include/geode/CacheableFileName.hpp | 10 +-
src/cppcache/include/geode/CacheableKey.hpp | 2 +
.../include/geode/CacheableObjectArray.hpp | 6 +-
src/cppcache/include/geode/CacheableString.hpp | 54 +-
.../include/geode/CacheableUndefined.hpp | 4 +-
src/cppcache/include/geode/CqAttributes.hpp | 8 +-
.../include/geode/CqAttributesFactory.hpp | 8 +-
.../include/geode/CqAttributesMutator.hpp | 9 +-
src/cppcache/include/geode/CqEvent.hpp | 4 +-
src/cppcache/include/geode/CqListener.hpp | 2 +-
src/cppcache/include/geode/DataInput.hpp | 16 +-
src/cppcache/include/geode/DataOutput.hpp | 2 +-
.../include/geode/DistributedSystem.hpp | 2 +-
src/cppcache/include/geode/EntryEvent.hpp | 4 +-
src/cppcache/include/geode/Exception.hpp | 2 +-
src/cppcache/include/geode/ExceptionTypes.hpp | 2 +-
src/cppcache/include/geode/Execution.hpp | 6 +-
src/cppcache/include/geode/FunctionService.hpp | 10 +-
src/cppcache/include/geode/HashFunction.hpp | 2 +-
.../include/geode/HashMapOfSharedBase.hpp | 2 +-
src/cppcache/include/geode/HashMapT.hpp | 18 +-
.../include/geode/HashSetOfSharedBase.hpp | 2 +-
src/cppcache/include/geode/HashSetT.hpp | 8 +-
.../include/geode/PdxInstanceFactory.hpp | 2 +-
src/cppcache/include/geode/PdxWrapper.hpp | 5 +-
src/cppcache/include/geode/Pool.hpp | 3 +-
src/cppcache/include/geode/PoolManager.hpp | 6 +-
src/cppcache/include/geode/Properties.hpp | 10 +-
src/cppcache/include/geode/QueryService.hpp | 10 +-
src/cppcache/include/geode/Region.hpp | 185 ++---
src/cppcache/include/geode/RegionAttributes.hpp | 12 +-
src/cppcache/include/geode/RegionEntry.hpp | 8 +-
src/cppcache/include/geode/RegionFactory.hpp | 19 +-
src/cppcache/include/geode/RegionService.hpp | 2 +-
.../include/geode/SelectResultsIterator.hpp | 2 +-
src/cppcache/include/geode/Serializable.hpp | 4 +-
src/cppcache/include/geode/Serializer.hpp | 6 +-
src/cppcache/include/geode/SharedBase.hpp | 43 +-
src/cppcache/include/geode/SharedPtr.hpp | 261 +------
src/cppcache/include/geode/SharedPtrHelper.hpp | 15 +-
src/cppcache/include/geode/Struct.hpp | 4 +-
src/cppcache/include/geode/SystemProperties.hpp | 16 +-
src/cppcache/include/geode/TypeHelper.hpp | 13 +-
.../include/geode/VectorOfSharedBase.hpp | 4 +-
src/cppcache/include/geode/VectorT.hpp | 42 +-
src/cppcache/include/geode/geode_base.hpp | 28 +-
.../BuiltinCacheableWrappers.hpp | 131 ++--
src/cppcache/integration-test/CMakeLists.txt | 1 -
src/cppcache/integration-test/CacheHelper.cpp | 60 +-
src/cppcache/integration-test/CacheHelper.hpp | 26 +-
.../integration-test/CacheImplHelper.hpp | 6 +-
src/cppcache/integration-test/DeltaEx.hpp | 15 +-
src/cppcache/integration-test/QueryHelper.hpp | 33 +-
src/cppcache/integration-test/TallyListener.hpp | 12 +-
src/cppcache/integration-test/TallyWriter.hpp | 8 +-
src/cppcache/integration-test/ThinClientCQ.hpp | 4 +-
.../integration-test/ThinClientCallbackArg.hpp | 4 +-
.../integration-test/ThinClientDistOps.hpp | 73 +-
.../integration-test/ThinClientDistOps2.hpp | 56 +-
.../integration-test/ThinClientDurable.hpp | 70 +-
.../ThinClientDurableFailover.hpp | 30 +-
.../ThinClientDurableInterest.hpp | 28 +-
.../ThinClientDurableReconnect.hpp | 8 +-
.../integration-test/ThinClientFailover.hpp | 26 +-
.../integration-test/ThinClientFailover2.hpp | 36 +-
.../integration-test/ThinClientFailover3.hpp | 20 +-
.../ThinClientFailoverInterest.hpp | 28 +-
.../ThinClientFailoverInterest2.hpp | 24 +-
.../ThinClientFailoverInterestAllWithCache.hpp | 42 +-
.../ThinClientFailoverRegex.hpp | 34 +-
.../integration-test/ThinClientGatewayTest.hpp | 4 +-
.../integration-test/ThinClientHeapLRU.hpp | 12 +-
.../integration-test/ThinClientHelper.hpp | 78 +--
.../integration-test/ThinClientInterest1.hpp | 2 +-
.../integration-test/ThinClientInterest3.hpp | 6 +-
.../ThinClientInterest3Cacheless.hpp | 8 +-
.../integration-test/ThinClientInterestList.hpp | 26 +-
.../ThinClientInterestList2.hpp | 20 +-
.../integration-test/ThinClientListenerInit.hpp | 16 +-
.../ThinClientListenerWriter.hpp | 30 +-
.../ThinClientLocalCacheLoader.hpp | 24 +-
.../integration-test/ThinClientNotification.hpp | 34 +-
.../ThinClientPdxSerializer.hpp | 121 ++--
.../ThinClientPdxSerializers.hpp | 17 +-
.../integration-test/ThinClientPutAll.hpp | 105 +--
.../ThinClientPutAllWithCallBack.hpp | 101 +--
.../integration-test/ThinClientPutGetAll.hpp | 129 ++--
.../ThinClientRIwithlocalRegionDestroy.hpp | 10 +-
.../integration-test/ThinClientRegex.hpp | 20 +-
.../integration-test/ThinClientRegex2.hpp | 24 +-
.../integration-test/ThinClientRegex3.hpp | 26 +-
.../integration-test/ThinClientRemoveAll.hpp | 32 +-
src/cppcache/integration-test/ThinClientSSL.hpp | 34 +-
.../ThinClientSSLWithPassword.hpp | 36 +-
.../integration-test/ThinClientSecurity.hpp | 6 +-
.../ThinClientSecurityHelper.hpp | 12 +-
.../integration-test/ThinClientTXFailover.hpp | 26 +-
.../integration-test/ThinClientTransactions.hpp | 56 +-
.../ThinClientTransactionsXA.hpp | 88 +--
.../integration-test/ThinClientVersionedOps.hpp | 100 +--
src/cppcache/integration-test/fw_dunit.cpp | 2 -
src/cppcache/integration-test/fw_dunit.hpp | 2 -
.../integration-test/testAttributesFactory.cpp | 48 +-
.../integration-test/testAttributesMutator.cpp | 11 +-
src/cppcache/integration-test/testCache.cpp | 18 +-
src/cppcache/integration-test/testCacheless.cpp | 20 +-
.../integration-test/testEntriesMap.cpp | 96 +--
.../testEntriesMapForVersioning.cpp | 556 +++++++--------
.../integration-test/testExpiration.cpp | 48 +-
src/cppcache/integration-test/testLRUList.cpp | 22 +-
.../testOverflowPutGetSqLite.cpp | 84 ++-
.../testRegionAccessThreadSafe.cpp | 6 +-
src/cppcache/integration-test/testRegionMap.cpp | 8 +-
.../integration-test/testRegionTemplateArgs.cpp | 244 +++----
.../integration-test/testSerialization.cpp | 13 +-
src/cppcache/integration-test/testSharedPtr.cpp | 108 ---
.../integration-test/testSystemProperties.cpp | 8 +-
.../testThinClientAfterRegionLive.cpp | 12 +-
.../integration-test/testThinClientBigValue.cpp | 69 +-
.../testThinClientCacheableStringArray.cpp | 12 +-
.../testThinClientCacheables.cpp | 26 +-
.../testThinClientCacheablesLimits.cpp | 26 +-
.../testThinClientClearRegion.cpp | 12 +-
.../testThinClientConflation.cpp | 21 +-
.../testThinClientContainsKeyOnServer.cpp | 4 +-
.../integration-test/testThinClientCq.cpp | 90 +--
.../integration-test/testThinClientCqDelta.cpp | 14 +-
.../testThinClientCqDurable.cpp | 56 +-
.../testThinClientCqFailover.cpp | 58 +-
.../testThinClientCqHAFailover.cpp | 48 +-
.../integration-test/testThinClientCqIR.cpp | 103 ++-
.../testThinClientDeltaWithNotification.cpp | 8 +-
.../testThinClientDisconnectionListioner.cpp | 2 +-
.../testThinClientExecuteFunctionPrSHOP.cpp | 79 ++-
.../testThinClientFixedPartitionResolver.cpp | 19 +-
.../testThinClientGetInterests.cpp | 8 +-
.../testThinClientHADistOps.cpp | 33 +-
.../testThinClientHAEventIDMap.cpp | 32 +-
.../testThinClientHAFailover.cpp | 22 +-
.../testThinClientHAFailoverRegex.cpp | 22 +-
.../testThinClientHAMixedRedundancy.cpp | 22 +-
.../testThinClientHAPeriodicAck.cpp | 32 +-
.../testThinClientHAQueryFailover.cpp | 14 +-
.../integration-test/testThinClientHeapLRU.cpp | 6 +-
.../testThinClientIntResPolKeysInv.cpp | 24 +-
.../testThinClientInterest1Cacheless.cpp | 15 +-
.../testThinClientInterest1_Bug1001.cpp | 30 +-
.../testThinClientInterestNotify.cpp | 35 +-
.../testThinClientLRUExpiration.cpp | 36 +-
.../testThinClientListenerCallbackArgTest.cpp | 30 +-
.../testThinClientListenerEvents.cpp | 4 +-
.../integration-test/testThinClientLocator.cpp | 4 +-
.../testThinClientLocatorFailover.cpp | 21 +-
.../integration-test/testThinClientMultiDS.cpp | 20 +-
...nClientNotificationWithDeltaWithoutcache.cpp | 6 +-
.../testThinClientPRPutAllFailover.cpp | 13 +-
.../testThinClientPRSingleHop.cpp | 56 +-
.../testThinClientPRSingleHopServerGroup.cpp | 39 +-
.../testThinClientPartitionResolver.cpp | 3 +-
.../testThinClientPdxDeltaWithNotification.cpp | 8 +-
.../integration-test/testThinClientPdxEnum.cpp | 16 +-
.../testThinClientPdxInstance.cpp | 430 ++++++------
.../integration-test/testThinClientPdxTests.cpp | 480 ++++++-------
.../testThinClientPoolExecuteFunction.cpp | 695 ++++++++-----------
...ExecuteFunctionDisableChunkHandlerThread.cpp | 10 +-
.../testThinClientPoolExecuteFunctionPrSHOP.cpp | 687 ++++++++----------
...ClientPoolExecuteFunctionThrowsException.cpp | 310 ++++-----
.../testThinClientPoolExecuteHAFunction.cpp | 136 ++--
...estThinClientPoolExecuteHAFunctionPrSHOP.cpp | 114 +--
.../testThinClientPoolLocator.cpp | 21 +-
.../testThinClientPoolRedundancy.cpp | 29 +-
.../testThinClientPutAllPRSingleHop.cpp | 22 +-
.../testThinClientPutWithDelta.cpp | 27 +-
...nClientRegionQueryDifferentServerConfigs.cpp | 8 +-
.../testThinClientRegionQueryExclusiveness.cpp | 14 +-
.../testThinClientRemoteQueryFailover.cpp | 10 +-
.../testThinClientRemoteQueryFailoverPdx.cpp | 10 +-
.../testThinClientRemoteQueryRS.cpp | 74 +-
.../testThinClientRemoteQuerySS.cpp | 166 ++---
.../testThinClientRemoteQueryTimeout.cpp | 16 +-
.../testThinClientRemoteRegionQuery.cpp | 17 +-
.../testThinClientRemoveOps.cpp | 141 ++--
.../testThinClientSSLAuthCorrupt.cpp | 14 +-
.../testThinClientSSLAuthFail.cpp | 6 +-
.../testThinClientSSLAuthUntrusted.cpp | 14 +-
.../testThinClientSSLWithSecurityAuthz.cpp | 60 +-
.../testThinClientSecurityAuthentication.cpp | 30 +-
.../testThinClientSecurityAuthenticationMU.cpp | 59 +-
.../testThinClientSecurityAuthorization.cpp | 64 +-
.../testThinClientSecurityAuthorizationMU.cpp | 122 ++--
.../testThinClientSecurityCQAuthorization.cpp | 44 +-
.../testThinClientSecurityCQAuthorizationMU.cpp | 38 +-
.../testThinClientSecurityDH.cpp | 12 +-
.../testThinClientSecurityDH_MU.cpp | 19 +-
...inClientSecurityDurableCQAuthorizationMU.cpp | 52 +-
.../testThinClientSecurityMultiUserTest.cpp | 4 +-
.../testThinClientSecurityPostAuthorization.cpp | 29 +-
.../testThinClientStatistics.cpp | 12 +-
.../testThinClientTicket303.cpp | 2 +-
.../testThinClientTicket317.cpp | 6 +-
.../integration-test/testThinClientTracking.cpp | 6 +-
.../testThinClientWriterException.cpp | 8 +-
src/cppcache/integration-test/testUtils.hpp | 30 +-
.../testXmlCacheCreationWithOverFlow.cpp | 35 +-
.../testXmlCacheCreationWithPools.cpp | 26 +-
src/cppcache/src/AdminRegion.cpp | 35 +-
src/cppcache/src/AdminRegion.hpp | 18 +-
src/cppcache/src/AttributesFactory.cpp | 29 +-
src/cppcache/src/AttributesMutator.cpp | 32 +-
src/cppcache/src/BucketServerLocation.hpp | 10 +-
src/cppcache/src/Cache.cpp | 25 +-
src/cppcache/src/CacheConfig.cpp | 2 +-
src/cppcache/src/CacheFactory.cpp | 174 ++---
src/cppcache/src/CacheImpl.cpp | 156 ++---
src/cppcache/src/CacheImpl.hpp | 12 +-
src/cppcache/src/CacheRegionHelper.hpp | 2 +-
.../src/CacheTransactionManagerImpl.cpp | 54 +-
.../src/CacheTransactionManagerImpl.hpp | 4 +-
src/cppcache/src/CacheXmlParser.cpp | 12 +-
src/cppcache/src/CacheableEnum.cpp | 18 +-
src/cppcache/src/CacheableObjectPartList.cpp | 13 +-
src/cppcache/src/CacheableObjectPartList.hpp | 6 +-
src/cppcache/src/CacheableToken.cpp | 45 +-
src/cppcache/src/CacheableToken.hpp | 35 +-
src/cppcache/src/CachedDeserializableHelper.hpp | 2 +-
src/cppcache/src/ClientMetadata.cpp | 26 +-
src/cppcache/src/ClientMetadataService.cpp | 147 ++--
src/cppcache/src/ClientMetadataService.hpp | 4 +-
src/cppcache/src/ClientProxyMembershipID.cpp | 29 +-
src/cppcache/src/ClientProxyMembershipID.hpp | 17 +-
src/cppcache/src/ConcurrentEntriesMap.cpp | 2 +-
src/cppcache/src/ConcurrentEntriesMap.hpp | 3 +-
src/cppcache/src/CppCacheLibrary.cpp | 26 +-
src/cppcache/src/CqAttributesFactory.cpp | 38 +-
src/cppcache/src/CqAttributesImpl.cpp | 39 +-
src/cppcache/src/CqAttributesImpl.hpp | 16 +-
src/cppcache/src/CqAttributesMutatorImpl.cpp | 22 +-
src/cppcache/src/CqAttributesMutatorImpl.hpp | 2 +-
src/cppcache/src/CqEventImpl.cpp | 4 +-
src/cppcache/src/CqQueryImpl.cpp | 64 +-
src/cppcache/src/CqQueryImpl.hpp | 17 +-
src/cppcache/src/CqService.cpp | 157 ++---
src/cppcache/src/CqService.hpp | 38 +-
src/cppcache/src/DSMemberForVersionStamp.hpp | 2 +-
src/cppcache/src/Delta.cpp | 2 +-
src/cppcache/src/DiffieHellman.cpp | 4 +-
src/cppcache/src/DiskStoreId.hpp | 23 +-
src/cppcache/src/DistributedSystem.cpp | 12 +-
src/cppcache/src/DistributedSystemImpl.cpp | 2 +-
src/cppcache/src/EntriesMap.hpp | 4 +-
src/cppcache/src/EntriesMapFactory.hpp | 2 +-
src/cppcache/src/EntryExpiryHandler.cpp | 8 +-
src/cppcache/src/EnumInfo.cpp | 14 +-
src/cppcache/src/EventIdMap.cpp | 10 +-
src/cppcache/src/EvictionController.cpp | 4 +-
src/cppcache/src/Exception.cpp | 10 +-
src/cppcache/src/ExceptionTypes.cpp | 4 +-
src/cppcache/src/ExecutionImpl.cpp | 97 ++-
src/cppcache/src/ExecutionImpl.hpp | 24 +-
src/cppcache/src/FarSideEntryOp.cpp | 8 +-
.../src/FixedPartitionAttributesImpl.hpp | 8 +-
src/cppcache/src/FunctionService.cpp | 47 +-
src/cppcache/src/FunctionServiceImpl.cpp | 3 +-
src/cppcache/src/FunctionServiceImpl.hpp | 2 +
.../src/GatewayEventCallbackArgument.hpp | 2 +-
.../src/GatewaySenderEventCallbackArgument.hpp | 2 +-
src/cppcache/src/GetAllServersResponse.cpp | 6 +-
.../InternalCacheTransactionManager2PCImpl.cpp | 4 +-
src/cppcache/src/LRUAction.cpp | 4 +-
src/cppcache/src/LRUAction.hpp | 2 +-
src/cppcache/src/LRUEntriesMap.cpp | 42 +-
src/cppcache/src/LRUEntriesMap.hpp | 2 +-
src/cppcache/src/LRUList.cpp | 6 +-
src/cppcache/src/LRULocalDestroyAction.cpp | 2 +-
src/cppcache/src/LocalRegion.cpp | 301 ++++----
src/cppcache/src/LocalRegion.hpp | 73 +-
src/cppcache/src/MapEntry.cpp | 2 +-
src/cppcache/src/MapEntry.hpp | 13 +-
src/cppcache/src/MapEntryT.hpp | 20 +-
src/cppcache/src/MapSegment.cpp | 101 +--
src/cppcache/src/MapSegment.hpp | 18 +-
src/cppcache/src/MapWithLock.hpp | 2 +-
src/cppcache/src/MemberListForVersionStamp.cpp | 2 +-
src/cppcache/src/MemberListForVersionStamp.hpp | 2 +-
src/cppcache/src/PdxEnumInstantiator.cpp | 2 +-
src/cppcache/src/PdxFieldType.cpp | 4 +-
src/cppcache/src/PdxHelper.cpp | 255 ++-----
src/cppcache/src/PdxHelper.hpp | 5 +-
src/cppcache/src/PdxInstanceFactoryImpl.cpp | 63 +-
src/cppcache/src/PdxInstanceFactoryImpl.hpp | 6 +-
src/cppcache/src/PdxInstanceImpl.cpp | 395 +++++------
src/cppcache/src/PdxInstanceImpl.hpp | 2 +-
src/cppcache/src/PdxInstantiator.cpp | 2 +-
src/cppcache/src/PdxLocalReader.cpp | 18 +-
src/cppcache/src/PdxLocalWriter.cpp | 107 +--
src/cppcache/src/PdxLocalWriter.hpp | 3 +-
src/cppcache/src/PdxReaderWithTypeCollector.cpp | 12 +-
src/cppcache/src/PdxRemotePreservedData.hpp | 6 +-
src/cppcache/src/PdxRemoteReader.cpp | 12 +-
src/cppcache/src/PdxRemoteWriter.cpp | 68 +-
src/cppcache/src/PdxType.cpp | 74 +-
src/cppcache/src/PdxType.hpp | 6 +-
src/cppcache/src/PdxTypeRegistry.cpp | 46 +-
src/cppcache/src/PdxWrapper.cpp | 4 +-
src/cppcache/src/PdxWriterWithTypeCollector.cpp | 60 +-
src/cppcache/src/Pool.cpp | 18 +-
src/cppcache/src/PoolAttributes.cpp | 3 +-
src/cppcache/src/PoolFactory.cpp | 16 +-
src/cppcache/src/PoolManager.cpp | 9 +-
src/cppcache/src/Properties.cpp | 22 +-
src/cppcache/src/ProxyCache.cpp | 38 +-
src/cppcache/src/ProxyCache.hpp | 6 +-
src/cppcache/src/ProxyRegion.hpp | 204 +++---
src/cppcache/src/ProxyRemoteQueryService.cpp | 85 ++-
src/cppcache/src/ProxyRemoteQueryService.hpp | 6 +-
src/cppcache/src/PutAllPartialResult.cpp | 2 +-
src/cppcache/src/PutAllPartialResult.hpp | 8 +-
.../src/PutAllPartialResultServerException.cpp | 2 +-
src/cppcache/src/RegionAttributes.cpp | 62 +-
src/cppcache/src/RegionCommit.cpp | 25 +-
src/cppcache/src/RegionCommit.hpp | 4 +-
src/cppcache/src/RegionEntry.cpp | 6 +-
src/cppcache/src/RegionExpiryHandler.cpp | 8 +-
src/cppcache/src/RegionFactory.cpp | 81 +--
src/cppcache/src/RegionInternal.cpp | 40 +-
src/cppcache/src/RegionInternal.hpp | 8 +-
src/cppcache/src/RegionXmlCreation.cpp | 10 +-
src/cppcache/src/RemoteQuery.cpp | 14 +-
src/cppcache/src/RemoteQuery.hpp | 4 +-
src/cppcache/src/RemoteQueryService.cpp | 44 +-
src/cppcache/src/RemoteQueryService.hpp | 12 +-
src/cppcache/src/ResultSetImpl.cpp | 2 +-
src/cppcache/src/ResultSetImpl.hpp | 4 +-
src/cppcache/src/SelectResultsIterator.cpp | 4 +-
src/cppcache/src/SerializationRegistry.cpp | 43 +-
src/cppcache/src/SerializationRegistry.hpp | 2 +-
src/cppcache/src/ServerLocation.cpp | 2 +-
src/cppcache/src/ServerLocation.hpp | 12 +-
src/cppcache/src/SharedBase.cpp | 39 --
src/cppcache/src/Struct.cpp | 2 +-
src/cppcache/src/StructSetImpl.cpp | 4 +-
src/cppcache/src/StructSetImpl.hpp | 4 +-
src/cppcache/src/SystemProperties.cpp | 28 +-
src/cppcache/src/TXCleaner.cpp | 2 +-
src/cppcache/src/TXCommitMessage.cpp | 6 +-
src/cppcache/src/TXState.cpp | 6 +-
src/cppcache/src/TcrChunkedContext.hpp | 6 +-
src/cppcache/src/TcrConnection.cpp | 46 +-
src/cppcache/src/TcrConnectionManager.cpp | 4 +-
src/cppcache/src/TcrEndpoint.cpp | 18 +-
src/cppcache/src/TcrMessage.cpp | 191 +++--
src/cppcache/src/TcrMessage.hpp | 14 +-
.../src/ThinClientCacheDistributionManager.cpp | 4 +-
.../src/ThinClientDistributionManager.cpp | 4 +-
src/cppcache/src/ThinClientHARegion.cpp | 9 +-
src/cppcache/src/ThinClientHARegion.hpp | 2 +-
src/cppcache/src/ThinClientLocatorHelper.cpp | 6 +-
src/cppcache/src/ThinClientPoolDM.cpp | 89 +--
src/cppcache/src/ThinClientPoolDM.hpp | 25 +-
src/cppcache/src/ThinClientPoolHADM.cpp | 4 +-
src/cppcache/src/ThinClientPoolRegion.cpp | 4 +-
src/cppcache/src/ThinClientPoolRegion.hpp | 2 +-
src/cppcache/src/ThinClientPoolStickyDM.cpp | 4 +-
src/cppcache/src/ThinClientPoolStickyDM.hpp | 2 +-
src/cppcache/src/ThinClientPoolStickyHADM.hpp | 2 +-
.../src/ThinClientRedundancyManager.cpp | 36 +-
src/cppcache/src/ThinClientRegion.cpp | 345 ++++-----
src/cppcache/src/ThinClientRegion.hpp | 25 +-
src/cppcache/src/ThinClientStickyManager.cpp | 22 +-
src/cppcache/src/TombstoneList.cpp | 33 +-
src/cppcache/src/TombstoneList.hpp | 15 +-
src/cppcache/src/TrackedMapEntry.hpp | 6 +-
src/cppcache/src/TransactionalOperation.cpp | 45 +-
src/cppcache/src/TssConnectionWrapper.cpp | 4 +-
src/cppcache/src/TssConnectionWrapper.hpp | 2 +-
src/cppcache/src/UserAttributes.cpp | 10 +-
src/cppcache/src/UserAttributes.hpp | 4 +-
src/cppcache/src/Utils.hpp | 11 +-
src/cppcache/src/VersionStamp.cpp | 72 +-
src/cppcache/src/VersionStamp.hpp | 24 +-
.../src/VersionedCacheableObjectPartList.cpp | 41 +-
.../src/VersionedCacheableObjectPartList.hpp | 23 +-
src/cppcache/src/statistics/HostStatSampler.cpp | 2 +-
.../src/statistics/PoolStatsSampler.cpp | 9 +-
.../src/statistics/PoolStatsSampler.hpp | 16 +-
.../src/statistics/StatisticsManager.cpp | 2 +-
src/cppcache/test/DataInputTest.cpp | 6 +-
src/cppcache/test/PdxLocalReaderTest.cpp | 6 +-
src/cppcache/test/SharedBaseTest.cpp | 62 --
src/cppcache/test/SharedPtrTest.cpp | 114 ---
src/cppcache/test/TcrMessage_unittest.cpp | 26 +-
src/quickstart/cpp/CqQuery.cpp | 18 +-
src/quickstart/cpp/Delta.cpp | 2 +-
src/quickstart/cpp/Exceptions.cpp | 2 +-
src/quickstart/cpp/ExecuteFunctions.cpp | 18 +-
src/quickstart/cpp/HACache.cpp | 4 +-
src/quickstart/cpp/MultiuserSecurity.cpp | 6 +-
src/quickstart/cpp/PdxRemoteQuery.cpp | 4 +-
src/quickstart/cpp/PdxSerializer.cpp | 2 +-
src/quickstart/cpp/PoolCqQuery.cpp | 18 +-
src/quickstart/cpp/PoolRemoteQuery.cpp | 4 +-
src/quickstart/cpp/PutAllGetAllOperations.cpp | 2 +-
src/quickstart/cpp/RegisterInterest.cpp | 4 +-
src/quickstart/cpp/RemoteQuery.cpp | 6 +-
.../cpp/plugins/DurableCacheListener.cpp | 4 +-
src/quickstart/cpp/queryobjects/Portfolio.cpp | 10 +-
src/quickstart/cpp/queryobjects/Portfolio.hpp | 12 +-
.../cpp/queryobjects/PortfolioPdx.cpp | 14 +-
.../cpp/queryobjects/PortfolioPdx.hpp | 2 +-
.../cpp/queryobjects/PortfolioPdxAuto.cpp | 8 +-
.../cpp/queryobjects/PortfolioPdxAuto.hpp | 2 +-
src/quickstart/cpp/queryobjects/Position.cpp | 10 +-
src/sqliteimpl/SqLiteImpl.cpp | 8 +-
src/templates/security/PkcsAuthInit.cpp | 2 +-
src/templates/security/UserPasswordAuthInit.cpp | 6 +-
src/tests/cli/PkcsWrapper/PkcsAuthInitMN.cpp | 4 +-
src/tests/cpp/fwk/UdpIpc.cpp | 2 +-
src/tests/cpp/fwklib/FrameworkTest.cpp | 30 +-
src/tests/cpp/fwklib/FrameworkTest.hpp | 2 +-
src/tests/cpp/fwklib/FwkObjects.hpp | 6 +-
src/tests/cpp/fwklib/PoolHelper.hpp | 10 +-
src/tests/cpp/fwklib/QueryHelper.hpp | 38 +-
src/tests/cpp/fwklib/RegionHelper.hpp | 2 +-
src/tests/cpp/security/PkcsAuthInit.cpp | 2 +-
src/tests/cpp/security/Security.cpp | 35 +-
.../security/XmlAuthzCredentialGenerator.hpp | 6 +-
src/tests/cpp/testobject/ArrayOfByte.hpp | 2 +-
src/tests/cpp/testobject/BatchObject.hpp | 4 +-
.../cpp/testobject/DeltaFastAssetAccount.cpp | 2 +-
.../cpp/testobject/DeltaFastAssetAccount.hpp | 12 +-
src/tests/cpp/testobject/DeltaPSTObject.cpp | 2 +-
src/tests/cpp/testobject/DeltaPSTObject.hpp | 10 +-
src/tests/cpp/testobject/DeltaTestImpl.cpp | 10 +-
src/tests/cpp/testobject/DeltaTestImpl.hpp | 5 +-
src/tests/cpp/testobject/EqStruct.hpp | 2 +-
src/tests/cpp/testobject/FastAsset.hpp | 4 +-
src/tests/cpp/testobject/FastAssetAccount.cpp | 2 +-
src/tests/cpp/testobject/FastAssetAccount.hpp | 6 +-
src/tests/cpp/testobject/InvalidPdxUsage.cpp | 27 +-
src/tests/cpp/testobject/InvalidPdxUsage.hpp | 16 +-
src/tests/cpp/testobject/NestedPdxObject.cpp | 12 +-
src/tests/cpp/testobject/NestedPdxObject.hpp | 9 +-
src/tests/cpp/testobject/NonPdxType.cpp | 10 +-
src/tests/cpp/testobject/NonPdxType.hpp | 4 +-
src/tests/cpp/testobject/PSTObject.cpp | 2 +-
src/tests/cpp/testobject/PSTObject.hpp | 4 +-
src/tests/cpp/testobject/PdxClassV1.cpp | 51 +-
src/tests/cpp/testobject/PdxClassV2.cpp | 51 +-
src/tests/cpp/testobject/PdxType.cpp | 32 +-
src/tests/cpp/testobject/PdxType.hpp | 24 +-
src/tests/cpp/testobject/PdxVersioned1.cpp | 9 +-
src/tests/cpp/testobject/PdxVersioned1.hpp | 4 +-
src/tests/cpp/testobject/PdxVersioned2.cpp | 9 +-
src/tests/cpp/testobject/PdxVersioned2.hpp | 4 +-
src/tests/cpp/testobject/Portfolio.cpp | 18 +-
src/tests/cpp/testobject/Portfolio.hpp | 12 +-
src/tests/cpp/testobject/PortfolioPdx.cpp | 25 +-
src/tests/cpp/testobject/PortfolioPdx.hpp | 2 +-
src/tests/cpp/testobject/Position.cpp | 10 +-
src/tests/cpp/testobject/Position.hpp | 2 +-
src/tests/cpp/testobject/TestObject1.cpp | 4 +-
src/tests/cpp/testobject/TestObject1.hpp | 2 +-
src/tests/cpp/testobject/VariousPdxTypes.cpp | 133 ++--
529 files changed, 7731 insertions(+), 8980 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/packer/solaris/install-build-tools.sh
----------------------------------------------------------------------
diff --git a/packer/solaris/install-build-tools.sh b/packer/solaris/install-build-tools.sh
index 077b4c5..ccdd3e6 100755
--- a/packer/solaris/install-build-tools.sh
+++ b/packer/solaris/install-build-tools.sh
@@ -18,7 +18,9 @@
set -x -e -o pipefail
# Remove meta-packages that prevent installation of updated tools
-pkg uninstall -v entire consolidation/userland/userland-incorporation consolidation/java-8/java-8-incorporation
+pkg uninstall -v entire consolidation/userland/userland-incorporation
+pkg change-facet \
+ facet.version-lock.consolidation/java-8/java-8-incorporation=false
# Install required tools
pkg install -v --accept \
@@ -26,13 +28,8 @@ pkg install -v --accept \
developer/assembler \
developer/documentation-tool/doxygen \
developer/java/jdk-8 \
+ developer/build/gnu-make \
+ developer/build/cmake \
+ developer/versioning/git \
+ archiver/gnu-tar \
text/gnu-patch
-
-# broken developer/build/gnu-make \
-
-
-# too old developer/build/cmake
-/opt/csw/bin/pkgutil -i -y cmake gmake gtar
-
-# dependent perl package conflict developer/versioning/git
-/opt/csw/bin/pkgutil -i -y git
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/packer/solaris/install-opencsw.sh
----------------------------------------------------------------------
diff --git a/packer/solaris/install-opencsw.sh b/packer/solaris/install-opencsw.sh
index a2a36bf..010950e 100644
--- a/packer/solaris/install-opencsw.sh
+++ b/packer/solaris/install-opencsw.sh
@@ -20,9 +20,8 @@ set -e
yes | pkgadd -d http://get.opencsw.org/now all
/opt/csw/bin/pkgutil -U
-echo 'PATH=$PATH:/opt/csw/bin; export PATH' >> .profile
-echo 'PATH=$PATH:/opt/csw/bin; export PATH' >> .bashrc
-
-echo 'PATH=$PATH:/opt/csw/bin; export PATH' >> /etc/skel/.profile
-echo 'PATH=$PATH:/opt/csw/bin; export PATH' >> /etc/skel/.bashrc
-
+p='PATH=$PATH:/opt/csw/bin; export PATH'
+echo "$p" >> ~/.profile
+echo "$p" >> ~/.bashrc
+echo "$p" >> /etc/skel/.profile
+echo "$p" >> /etc/skel/.bashrc
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/packer/solaris/install-solarisstudio.sh
----------------------------------------------------------------------
diff --git a/packer/solaris/install-solarisstudio.sh b/packer/solaris/install-solarisstudio.sh
index 95347c5..11afbeb 100644
--- a/packer/solaris/install-solarisstudio.sh
+++ b/packer/solaris/install-solarisstudio.sh
@@ -22,9 +22,10 @@ pkg set-publisher \
-c /var/pkg/ssl/pkg.oracle.com.certificate.pem \
-G '*' -g https://pkg.oracle.com/solarisstudio/release solarisstudio
-pkg install -v solarisstudio-124/c++ solarisstudio-124/dbx
+pkg install -v solarisstudio-125/c++ solarisstudio-125/dbx
-echo 'PATH=$PATH:/opt/solarisstudio12.4/bin; export PATH' >> ~/.profile
-
-echo 'PATH=$PATH:/opt/solarisstudio12.4/bin; export PATH' >> ~/.bashrc
-echo 'PATH=$PATH:/opt/csw//bin; export PATH' >> ~/.bashrc
+p='PATH=$PATH:/opt/developerstudio12.5/bin; export PATH'
+echo "$p" >> ~/.profile
+echo "$p" >> ~/.bashrc
+echo "$p" >> /etc/skel/.profile
+echo "$p" >> /etc/skel/.bashrc
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/packer/solaris/install-test-tools.sh
----------------------------------------------------------------------
diff --git a/packer/solaris/install-test-tools.sh b/packer/solaris/install-test-tools.sh
index c69fd78..b7b543d 100755
--- a/packer/solaris/install-test-tools.sh
+++ b/packer/solaris/install-test-tools.sh
@@ -18,12 +18,12 @@
set -x -e -o pipefail
# Remove meta-packages that prevent installation of updated tools
-pkg uninstall -v entire consolidation/userland/userland-incorporation consolidation/java-8/java-8-incorporation
+pkg uninstall -v entire consolidation/userland/userland-incorporation
+pkg change-facet \
+ facet.version-lock.consolidation/java-8/java-8-incorporation=false
# Install required tools
pkg install -v --accept \
developer/java/jdk-8 \
+ developer/build/cmake \
archiver/gnu-tar
-
-# too old developer/build/cmake
-/opt/csw/bin/pkgutil -i -y cmake
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/AttributesFactory.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/AttributesFactory.cpp b/src/clicache/src/AttributesFactory.cpp
index f3ab002..67c4d97 100644
--- a/src/clicache/src/AttributesFactory.cpp
+++ b/src/clicache/src/AttributesFactory.cpp
@@ -67,7 +67,7 @@ namespace Apache
CacheLoaderGeneric<TKey, TValue>^ clg = gcnew CacheLoaderGeneric<TKey, TValue>();
clg->SetCacheLoader(cacheLoader);
loaderptr = new apache::geode::client::ManagedCacheLoaderGeneric( /*clg,*/ cacheLoader );
- ((apache::geode::client::ManagedCacheLoaderGeneric*)loaderptr.ptr())->setptr(clg);
+ ((apache::geode::client::ManagedCacheLoaderGeneric*)loaderptr.get())->setptr(clg);
}
NativePtr->setCacheLoader( loaderptr );
}
@@ -80,7 +80,7 @@ namespace Apache
CacheWriterGeneric<TKey, TValue>^ cwg = gcnew CacheWriterGeneric<TKey, TValue>();
cwg->SetCacheWriter(cacheWriter);
writerptr = new apache::geode::client::ManagedCacheWriterGeneric( /*cwg,*/ cacheWriter );
- ((apache::geode::client::ManagedCacheWriterGeneric*)writerptr.ptr())->setptr(cwg);
+ ((apache::geode::client::ManagedCacheWriterGeneric*)writerptr.get())->setptr(cwg);
}
NativePtr->setCacheWriter( writerptr );
}
@@ -94,7 +94,7 @@ namespace Apache
clg->SetCacheListener(cacheListener);
//listenerptr = new apache::geode::client::ManagedCacheListenerGeneric( (ICacheListener<Object^, Object^>^)cacheListener );
listenerptr = new apache::geode::client::ManagedCacheListenerGeneric( /*clg,*/ cacheListener );
- ((apache::geode::client::ManagedCacheListenerGeneric*)listenerptr.ptr())->setptr(clg);
+ ((apache::geode::client::ManagedCacheListenerGeneric*)listenerptr.get())->setptr(clg);
}
NativePtr->setCacheListener( listenerptr );
}
@@ -110,13 +110,13 @@ namespace Apache
FixedPartitionResolverGeneric<TKey, TValue>^ prg = gcnew FixedPartitionResolverGeneric<TKey, TValue>();
prg->SetPartitionResolver(partitionresolver);
resolverptr = new apache::geode::client::ManagedFixedPartitionResolverGeneric( partitionresolver );
- ((apache::geode::client::ManagedFixedPartitionResolverGeneric*)resolverptr.ptr())->setptr(prg);
+ ((apache::geode::client::ManagedFixedPartitionResolverGeneric*)resolverptr.get())->setptr(prg);
}
else {
PartitionResolverGeneric<TKey, TValue>^ prg = gcnew PartitionResolverGeneric<TKey, TValue>();
prg->SetPartitionResolver(partitionresolver);
resolverptr = new apache::geode::client::ManagedPartitionResolverGeneric( partitionresolver );
- ((apache::geode::client::ManagedPartitionResolverGeneric*)resolverptr.ptr())->setptr(prg);
+ ((apache::geode::client::ManagedPartitionResolverGeneric*)resolverptr.get())->setptr(prg);
}
}
NativePtr->setPartitionResolver( resolverptr );
@@ -205,7 +205,7 @@ namespace Apache
PersistenceManagerGeneric<TKey, TValue>^ clg = gcnew PersistenceManagerGeneric<TKey, TValue>();
clg->SetPersistenceManager(persistenceManager);
persistenceManagerptr = new apache::geode::client::ManagedPersistenceManagerGeneric( /*clg,*/ persistenceManager );
- ((apache::geode::client::ManagedPersistenceManagerGeneric*)persistenceManagerptr.ptr())->setptr(clg);
+ ((apache::geode::client::ManagedPersistenceManagerGeneric*)persistenceManagerptr.get())->setptr(clg);
}
apache::geode::client::PropertiesPtr configptr(GetNativePtr<apache::geode::client::Properties>( config ) );
NativePtr->setPersistenceManager( persistenceManagerptr, configptr );
@@ -321,7 +321,7 @@ namespace Apache
apache::geode::client::RegionAttributesPtr& nativeptr(
NativePtr->createRegionAttributes());
- return Apache::Geode::Client::RegionAttributes<TKey, TValue>::Create(nativeptr.ptr());
+ return Apache::Geode::Client::RegionAttributes<TKey, TValue>::Create(nativeptr.get());
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/AttributesMutator.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/AttributesMutator.cpp b/src/clicache/src/AttributesMutator.cpp
index 515f114..081dccb 100644
--- a/src/clicache/src/AttributesMutator.cpp
+++ b/src/clicache/src/AttributesMutator.cpp
@@ -109,7 +109,7 @@ namespace Apache
CacheListenerGeneric<TKey, TValue>^ clg = gcnew CacheListenerGeneric<TKey, TValue>();
clg->SetCacheListener(cacheListener);
listenerptr = new apache::geode::client::ManagedCacheListenerGeneric( /*clg,*/ cacheListener );
- ((apache::geode::client::ManagedCacheListenerGeneric*)listenerptr.ptr())->setptr(clg);
+ ((apache::geode::client::ManagedCacheListenerGeneric*)listenerptr.get())->setptr(clg);
}
NativePtr->setCacheListener( listenerptr );
}
@@ -135,7 +135,7 @@ namespace Apache
CacheLoaderGeneric<TKey, TValue>^ clg = gcnew CacheLoaderGeneric<TKey, TValue>();
clg->SetCacheLoader(cacheLoader);
loaderptr = new apache::geode::client::ManagedCacheLoaderGeneric( /*clg,*/ cacheLoader );
- ((apache::geode::client::ManagedCacheLoaderGeneric*)loaderptr.ptr())->setptr(clg);
+ ((apache::geode::client::ManagedCacheLoaderGeneric*)loaderptr.get())->setptr(clg);
}
NativePtr->setCacheLoader( loaderptr );
}
@@ -161,7 +161,7 @@ namespace Apache
CacheWriterGeneric<TKey, TValue>^ cwg = gcnew CacheWriterGeneric<TKey, TValue>();
cwg->SetCacheWriter(cacheWriter);
writerptr = new apache::geode::client::ManagedCacheWriterGeneric( /*cwg,*/ cacheWriter );
- ((apache::geode::client::ManagedCacheWriterGeneric*)writerptr.ptr())->setptr(cwg);
+ ((apache::geode::client::ManagedCacheWriterGeneric*)writerptr.get())->setptr(cwg);
}
NativePtr->setCacheWriter( writerptr );
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/Cache.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/Cache.cpp b/src/clicache/src/Cache.cpp
index 278aceb..1906830 100644
--- a/src/clicache/src/Cache.cpp
+++ b/src/clicache/src/Cache.cpp
@@ -187,7 +187,7 @@ namespace Apache
break;
}
- return RegionFactory::Create(NativePtr->createRegionFactory(preDefineRegionAttr).ptr());
+ return RegionFactory::Create(NativePtr->createRegionFactory(preDefineRegionAttr).get());
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -206,7 +206,7 @@ namespace Apache
_GF_MG_EXCEPTION_TRY2
- return AuthenticatedCache::Create( (NativePtr->createAuthenticatedView(credPtr)).ptr());
+ return AuthenticatedCache::Create( (NativePtr->createAuthenticatedView(credPtr)).get());
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -245,7 +245,7 @@ namespace Apache
_GF_MG_EXCEPTION_TRY2
- return AuthenticatedCache::Create( (NativePtr->createAuthenticatedView(credPtr, mg_poolName.CharPtr)).ptr());
+ return AuthenticatedCache::Create( (NativePtr->createAuthenticatedView(credPtr, mg_poolName.CharPtr)).get());
_GF_MG_EXCEPTION_CATCH_ALL2
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/CacheFactory.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CacheFactory.cpp b/src/clicache/src/CacheFactory.cpp
index 02420e8..8c71107 100644
--- a/src/clicache/src/CacheFactory.cpp
+++ b/src/clicache/src/CacheFactory.cpp
@@ -52,8 +52,8 @@ namespace Apache
GetNativePtr<apache::geode::client::Properties>(dsProps));
apache::geode::client::CacheFactoryPtr& nativeptr( apache::geode::client::CacheFactory::createCacheFactory( nativepropsptr) );
- if (nativeptr.ptr() != nullptr)
- return gcnew CacheFactory( nativeptr.ptr(), dsProps );
+ if (nativeptr.get() != nullptr)
+ return gcnew CacheFactory( nativeptr.get(), dsProps );
return nullptr;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/CacheTransactionManager.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CacheTransactionManager.cpp b/src/clicache/src/CacheTransactionManager.cpp
index 71b1f8d..f8139a1 100644
--- a/src/clicache/src/CacheTransactionManager.cpp
+++ b/src/clicache/src/CacheTransactionManager.cpp
@@ -75,7 +75,7 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- return Apache::Geode::Client::TransactionId::Create( NativePtr->suspend().ptr() );
+ return Apache::Geode::Client::TransactionId::Create( NativePtr->suspend().get() );
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -83,7 +83,7 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- return Apache::Geode::Client::TransactionId::Create( NativePtr->getTransactionId().ptr() );
+ return Apache::Geode::Client::TransactionId::Create( NativePtr->getTransactionId().get() );
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -161,7 +161,7 @@ namespace Apache
TransactionWriterGeneric<TKey, TValue>^ twg = gcnew TransactionWriterGeneric<TKey, TValue> ();
twg->SetTransactionWriter(transactionWriter);
writerPtr = new apache::geode::client::ManagedTransactionWriterGeneric( transactionWriter );
- ((apache::geode::client::ManagedTransactionWriterGeneric*)writerPtr.ptr())->setptr(twg);
+ ((apache::geode::client::ManagedTransactionWriterGeneric*)writerPtr.get())->setptr(twg);
}
NativePtr->setWriter( writerPtr );
@@ -180,7 +180,7 @@ namespace Apache
TransactionListenerGeneric<TKey, TValue>^ twg = gcnew TransactionListenerGeneric<TKey, TValue> ();
twg->SetTransactionListener(transactionListener);
listenerPtr = new apache::geode::client::ManagedTransactionListenerGeneric( transactionListener );
- ((apache::geode::client::ManagedTransactionListenerGeneric*)listenerPtr.ptr())->setptr(twg);
+ ((apache::geode::client::ManagedTransactionListenerGeneric*)listenerPtr.get())->setptr(twg);
}
NativePtr->addListener( listenerPtr );
@@ -199,7 +199,7 @@ namespace Apache
TransactionListenerGeneric<TKey, TValue>^ twg = gcnew TransactionListenerGeneric<TKey, TValue> ();
twg->SetTransactionListener(transactionListener);
listenerPtr = new apache::geode::client::ManagedTransactionListenerGeneric( transactionListener );
- ((apache::geode::client::ManagedTransactionListenerGeneric*)listenerPtr.ptr())->setptr(twg);
+ ((apache::geode::client::ManagedTransactionListenerGeneric*)listenerPtr.get())->setptr(twg);
}
NativePtr->removeListener( listenerPtr );
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/CacheableBuiltins.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CacheableBuiltins.hpp b/src/clicache/src/CacheableBuiltins.hpp
index c0e11d6..3cee562 100644
--- a/src/clicache/src/CacheableBuiltins.hpp
+++ b/src/clicache/src/CacheableBuiltins.hpp
@@ -56,7 +56,7 @@ namespace Apache
{
apache::geode::client::SharedPtr<TNative>& nativeptr = TNative::create();
- SetSP(nativeptr.ptr());
+ SetSP(nativeptr.get());
}
/// <summary>
@@ -67,7 +67,7 @@ namespace Apache
{
apache::geode::client::SharedPtr<TNative>& nativeptr = TNative::create(value);
- SetSP(nativeptr.ptr());
+ SetSP(nativeptr.get());
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/CacheableHashSet.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CacheableHashSet.hpp b/src/clicache/src/CacheableHashSet.hpp
index ab59f8c..aa6085b 100644
--- a/src/clicache/src/CacheableHashSet.hpp
+++ b/src/clicache/src/CacheableHashSet.hpp
@@ -57,7 +57,7 @@ namespace Apache
HSTYPE* set = static_cast<HSTYPE*>(nptr());
for (typename HSTYPE::Iterator iter = set->begin();
iter != set->end(); ++iter) {
- //Generic::ICacheableKey^ key = SafeGenericUMKeyConvert<ICacheableKey^>((*iter).ptr());
+ //Generic::ICacheableKey^ key = SafeGenericUMKeyConvert<ICacheableKey^>((*iter).get());
Object^ key = Serializable::GetManagedValueGeneric<Object^>((*iter));
output->WriteObject(key);
}
@@ -158,7 +158,7 @@ namespace Apache
throw gcnew System::InvalidOperationException(
"Call MoveNext first.");
}
- //return SafeGenericUMKeyConvert<Client::ICacheableKey^>((*(*NativePtr())).ptr());
+ //return SafeGenericUMKeyConvert<Client::ICacheableKey^>((*(*NativePtr())).get());
return Serializable::GetManagedValueGeneric<Object^>((*(*NativePtr())));
}
}
@@ -520,7 +520,7 @@ namespace Apache
/// </summary>
/// <param name="size">The initial size of the HashSet.</param>
inline CacheableHashSetType<TYPEID, HSTYPE>(System::Int32 size)
- : Serializable(HSTYPE::create(size).ptr())
+ : Serializable(HSTYPE::create(size).get())
{ }
};
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/CacheableObjectArray.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CacheableObjectArray.cpp b/src/clicache/src/CacheableObjectArray.cpp
index 9a41846..c4caa7d 100644
--- a/src/clicache/src/CacheableObjectArray.cpp
+++ b/src/clicache/src/CacheableObjectArray.cpp
@@ -99,7 +99,7 @@ namespace Apache
apache::geode::client::CacheablePtr value;
for (System::Int32 index = 0; index < len; ++index) {
nativeInput.readObject(value);
- Add(SafeUMSerializableConvert(value.ptr()));
+ Add(SafeUMSerializableConvert(value.get()));
}
_GF_MG_EXCEPTION_CATCH_ALL
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/CqAttributesFactory.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CqAttributesFactory.cpp b/src/clicache/src/CqAttributesFactory.cpp
index e30a707..9903d0f 100644
--- a/src/clicache/src/CqAttributesFactory.cpp
+++ b/src/clicache/src/CqAttributesFactory.cpp
@@ -47,15 +47,15 @@ namespace Apache
try {
CqListenerHelper<TKey, TResult>::g_readerWriterLock->AcquireWriterLock(-1);
if ( CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->ContainsKey( cqListener) ) {
- CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict[cqListener] = (IntPtr)listenerptr.ptr();
+ CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict[cqListener] = (IntPtr)listenerptr.get();
}
else {
- CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->Add(cqListener, (IntPtr)listenerptr.ptr());
+ CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->Add(cqListener, (IntPtr)listenerptr.get());
}
} finally {
CqListenerHelper<TKey, TResult>::g_readerWriterLock->ReleaseWriterLock();
}
- ((apache::geode::client::ManagedCqStatusListenerGeneric*)listenerptr.ptr())->setptr(sLstr);
+ ((apache::geode::client::ManagedCqStatusListenerGeneric*)listenerptr.get())->setptr(sLstr);
}
else {
//TODO::split
@@ -66,15 +66,15 @@ namespace Apache
try {
CqListenerHelper<TKey, TResult>::g_readerWriterLock->AcquireWriterLock(-1);
if ( CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->ContainsKey( cqListener) ) {
- CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict[cqListener] = (IntPtr)listenerptr.ptr();
+ CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict[cqListener] = (IntPtr)listenerptr.get();
}
else {
- CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->Add(cqListener, (IntPtr)listenerptr.ptr());
+ CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->Add(cqListener, (IntPtr)listenerptr.get());
}
} finally {
CqListenerHelper<TKey, TResult>::g_readerWriterLock->ReleaseWriterLock();
}
- ((apache::geode::client::ManagedCqListenerGeneric*)listenerptr.ptr())->setptr(cqlg);
+ ((apache::geode::client::ManagedCqListenerGeneric*)listenerptr.get())->setptr(cqlg);
}
}
@@ -97,15 +97,15 @@ namespace Apache
try {
CqListenerHelper<TKey, TResult>::g_readerWriterLock->AcquireWriterLock(-1);
if ( CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->ContainsKey( cqListeners[i]) ) {
- CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict[cqListeners[i]] = (IntPtr)cptr.ptr();
+ CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict[cqListeners[i]] = (IntPtr)cptr.get();
}
else {
- CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->Add(cqListeners[i], (IntPtr)cptr.ptr());
+ CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->Add(cqListeners[i], (IntPtr)cptr.get());
}
} finally {
CqListenerHelper<TKey, TResult>::g_readerWriterLock->ReleaseWriterLock();
}
- ((apache::geode::client::ManagedCqStatusListenerGeneric*)vrr[i].ptr())->setptr(cqlg);
+ ((apache::geode::client::ManagedCqStatusListenerGeneric*)vrr[i].get())->setptr(cqlg);
}
else {
ICqListener<TKey, TResult>^ lister = cqListeners[i];
@@ -117,15 +117,15 @@ namespace Apache
try {
CqListenerHelper<TKey, TResult>::g_readerWriterLock->AcquireWriterLock(-1);
if ( CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->ContainsKey( cqListeners[i]) ) {
- CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict[cqListeners[i]] = (IntPtr)cptr.ptr();
+ CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict[cqListeners[i]] = (IntPtr)cptr.get();
}
else {
- CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->Add(cqListeners[i], (IntPtr)cptr.ptr());
+ CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->Add(cqListeners[i], (IntPtr)cptr.get());
}
} finally {
CqListenerHelper<TKey, TResult>::g_readerWriterLock->ReleaseWriterLock();
}
- ((apache::geode::client::ManagedCqListenerGeneric*)vrr[i].ptr())->setptr(cqlg);
+ ((apache::geode::client::ManagedCqListenerGeneric*)vrr[i].get())->setptr(cqlg);
}
}
@@ -135,7 +135,7 @@ namespace Apache
generic<class TKey, class TResult>
Client::CqAttributes<TKey, TResult>^ CqAttributesFactory<TKey, TResult>::Create( )
{
- return Client::CqAttributes<TKey, TResult>::Create(NativePtr->create().ptr());
+ return Client::CqAttributes<TKey, TResult>::Create(NativePtr->create().get());
} // namespace Client
} // namespace Geode
} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/CqAttributesMutator.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CqAttributesMutator.cpp b/src/clicache/src/CqAttributesMutator.cpp
index 68adf79..c6950b4 100644
--- a/src/clicache/src/CqAttributesMutator.cpp
+++ b/src/clicache/src/CqAttributesMutator.cpp
@@ -45,16 +45,16 @@ namespace Apache
try {
CqListenerHelper<TKey, TResult>::g_readerWriterLock->AcquireWriterLock(-1);
if ( CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->ContainsKey(cqListener) ) {
- CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict[cqListener] = (IntPtr)listenerptr.ptr();
+ CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict[cqListener] = (IntPtr)listenerptr.get();
}
else {
- CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->Add(cqListener, (IntPtr)listenerptr.ptr());
+ CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->Add(cqListener, (IntPtr)listenerptr.get());
}
}
finally {
CqListenerHelper<TKey, TResult>::g_readerWriterLock->ReleaseWriterLock();
}
- ((apache::geode::client::ManagedCqStatusListenerGeneric*)listenerptr.ptr())->setptr(sLstr);
+ ((apache::geode::client::ManagedCqStatusListenerGeneric*)listenerptr.get())->setptr(sLstr);
}
else {
//TODO::split
@@ -65,15 +65,15 @@ namespace Apache
try {
CqListenerHelper<TKey, TResult>::g_readerWriterLock->AcquireWriterLock(-1);
if ( CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->ContainsKey(cqListener) ) {
- CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict[cqListener] = (IntPtr)listenerptr.ptr();
+ CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict[cqListener] = (IntPtr)listenerptr.get();
}
else {
- CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->Add(cqListener, (IntPtr)listenerptr.ptr());
+ CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->Add(cqListener, (IntPtr)listenerptr.get());
}
} finally {
CqListenerHelper<TKey, TResult>::g_readerWriterLock->ReleaseWriterLock();
}
- ((apache::geode::client::ManagedCqListenerGeneric*)listenerptr.ptr())->setptr(cqlg);
+ ((apache::geode::client::ManagedCqListenerGeneric*)listenerptr.get())->setptr(cqlg);
}
}
NativePtr->addCqListener( listenerptr );
@@ -88,7 +88,7 @@ namespace Apache
cqlg->AddCqListener(cqListener);
apache::geode::client::CqStatusListenerPtr lptr(new apache::geode::client::ManagedCqStatusListenerGeneric(
(Client::ICqStatusListener<TKey, TResult>^) lister ));
- ((apache::geode::client::ManagedCqStatusListenerGeneric*)lptr.ptr())->setptr(cqlg);
+ ((apache::geode::client::ManagedCqStatusListenerGeneric*)lptr.get())->setptr(cqlg);
try {
IntPtr value;
CqListenerHelper<TKey, TResult>::g_readerWriterLock->AcquireWriterLock(-1);
@@ -105,7 +105,7 @@ namespace Apache
cqlg->AddCqListener(cqListener);
apache::geode::client::CqListenerPtr lptr(new apache::geode::client::ManagedCqListenerGeneric(
(Client::ICqListener<TKey, TResult>^) cqListener ));
- ((apache::geode::client::ManagedCqListenerGeneric*)lptr.ptr())->setptr(cqlg);
+ ((apache::geode::client::ManagedCqListenerGeneric*)lptr.get())->setptr(cqlg);
try {
IntPtr value;
CqListenerHelper<TKey, TResult>::g_readerWriterLock->AcquireWriterLock(-1);
@@ -135,15 +135,15 @@ namespace Apache
try {
CqListenerHelper<TKey, TResult>::g_readerWriterLock->AcquireWriterLock(-1);
if ( CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->ContainsKey( newListeners[i]) ) {
- CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict[newListeners[i]] = (IntPtr)cptr.ptr();
+ CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict[newListeners[i]] = (IntPtr)cptr.get();
}
else {
- CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->Add(newListeners[i], (IntPtr)cptr.ptr());
+ CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->Add(newListeners[i], (IntPtr)cptr.get());
}
} finally {
CqListenerHelper<TKey, TResult>::g_readerWriterLock->ReleaseWriterLock();
}
- ((apache::geode::client::ManagedCqStatusListenerGeneric*)vrr[i].ptr())->setptr(cqlg);
+ ((apache::geode::client::ManagedCqStatusListenerGeneric*)vrr[i].get())->setptr(cqlg);
}
else {
Client::ICqListener<TKey, TResult>^ lister = newListeners[i];
@@ -155,15 +155,15 @@ namespace Apache
try {
CqListenerHelper<TKey, TResult>::g_readerWriterLock->AcquireWriterLock(-1);
if ( CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->ContainsKey( newListeners[i]) ) {
- CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict[newListeners[i]] = (IntPtr)cptr.ptr();
+ CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict[newListeners[i]] = (IntPtr)cptr.get();
}
else {
- CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->Add(newListeners[i], (IntPtr)cptr.ptr());
+ CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->Add(newListeners[i], (IntPtr)cptr.get());
}
} finally {
CqListenerHelper<TKey, TResult>::g_readerWriterLock->ReleaseWriterLock();
}
- ((apache::geode::client::ManagedCqListenerGeneric*)vrr[i].ptr())->setptr(cqlg);
+ ((apache::geode::client::ManagedCqListenerGeneric*)vrr[i].get())->setptr(cqlg);
}
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/CqQuery.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CqQuery.cpp b/src/clicache/src/CqQuery.cpp
index 1e8461b..eb50ad7 100644
--- a/src/clicache/src/CqQuery.cpp
+++ b/src/clicache/src/CqQuery.cpp
@@ -48,7 +48,7 @@ namespace Apache
apache::geode::client::CqResultsPtr& nativeptr =
NativePtr->executeWithInitialResults(timeout);
- if (nativeptr.ptr() == NULL) return nullptr;
+ if (nativeptr.get() == NULL) return nullptr;
apache::geode::client::ResultSet* resultptr = dynamic_cast<apache::geode::client::ResultSet*>(
nativeptr.ptr( ) );
@@ -97,25 +97,25 @@ namespace Apache
generic<class TKey, class TResult>
Query<TResult>^ CqQuery<TKey, TResult>::GetQuery( )
{
- return Query<TResult>::Create(NativePtr->getQuery().ptr());
+ return Query<TResult>::Create(NativePtr->getQuery().get());
}
generic<class TKey, class TResult>
CqAttributes<TKey, TResult>^ CqQuery<TKey, TResult>::GetCqAttributes( )
{
- return CqAttributes<TKey, TResult>::Create(NativePtr->getCqAttributes( ).ptr());
+ return CqAttributes<TKey, TResult>::Create(NativePtr->getCqAttributes( ).get());
}
generic<class TKey, class TResult>
CqAttributesMutator<TKey, TResult>^ CqQuery<TKey, TResult>::GetCqAttributesMutator( )
{
- return CqAttributesMutator<TKey, TResult>::Create(NativePtr->getCqAttributesMutator().ptr());
+ return CqAttributesMutator<TKey, TResult>::Create(NativePtr->getCqAttributesMutator().get());
}
generic<class TKey, class TResult>
CqStatistics^ CqQuery<TKey, TResult>::GetStatistics( )
{
- return CqStatistics::Create(NativePtr->getStatistics().ptr());
+ return CqStatistics::Create(NativePtr->getStatistics().get());
}
generic<class TKey, class TResult>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/DistributedSystem.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/DistributedSystem.cpp b/src/clicache/src/DistributedSystem.cpp
index f170a5b..bd29a91 100644
--- a/src/clicache/src/DistributedSystem.cpp
+++ b/src/clicache/src/DistributedSystem.cpp
@@ -156,7 +156,7 @@ namespace Apache
// DistributedSystem::AppDomainInstancePostInitialization();
- return Create(nativeptr.ptr());
+ return Create(nativeptr.get());
_GF_MG_EXCEPTION_CATCH_ALL2
@@ -217,7 +217,7 @@ namespace Apache
DistributedSystem::AppDomainInstancePostInitialization();
- return Create(nativeptr.ptr());
+ return Create(nativeptr.get());
_GF_MG_EXCEPTION_CATCH_ALL
@@ -750,7 +750,7 @@ namespace Apache
void DistributedSystem::AppDomainInstancePostInitialization()
{
//to create .net memory pressure handler
- Create(apache::geode::client::DistributedSystem::getInstance().ptr());
+ Create(apache::geode::client::DistributedSystem::getInstance().get());
}
void DistributedSystem::UnregisterBuiltinManagedTypes()
@@ -826,7 +826,7 @@ namespace Apache
{
apache::geode::client::DistributedSystemPtr& nativeptr(
apache::geode::client::DistributedSystem::getInstance());
- return Create(nativeptr.ptr());
+ return Create(nativeptr.get());
}
void DistributedSystem::HandleMemoryPressure(System::Object^ state)
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/ExceptionTypes.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/ExceptionTypes.cpp b/src/clicache/src/ExceptionTypes.cpp
index 7192066..9388670 100644
--- a/src/clicache/src/ExceptionTypes.cpp
+++ b/src/clicache/src/ExceptionTypes.cpp
@@ -114,7 +114,7 @@ namespace Apache
{
Exception^ innerException = nullptr;
const apache::geode::client::ExceptionPtr& cause = nativeEx.getCause();
- if (cause != NULLPTR) {
+ if (cause != nullptr) {
innerException = GeodeException::Get(*cause);
}
String^ exName = gcnew String( nativeEx.getName( ) );
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/ExceptionTypes.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/ExceptionTypes.hpp b/src/clicache/src/ExceptionTypes.hpp
index 03eb11e..8f25654 100644
--- a/src/clicache/src/ExceptionTypes.hpp
+++ b/src/clicache/src/ExceptionTypes.hpp
@@ -166,7 +166,7 @@ namespace Apache
mg_exStr.CharPtr, NULL, false, cause));
}
}
- return NULLPTR;
+ return nullptr;
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/Execution.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/Execution.cpp b/src/clicache/src/Execution.cpp
index 3034382..6037299 100644
--- a/src/clicache/src/Execution.cpp
+++ b/src/clicache/src/Execution.cpp
@@ -48,7 +48,7 @@ namespace Apache
rsptr->push_back(Serializable::GetUnmanagedValueGeneric<TFilter>( item ));
}
- return Execution<TResult>::Create(NativePtr->withFilter(rsptr).ptr(), this->m_rc);
+ return Execution<TResult>::Create(NativePtr->withFilter(rsptr).get(), this->m_rc);
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
else {
@@ -63,7 +63,7 @@ namespace Apache
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
apache::geode::client::CacheablePtr argsptr( Serializable::GetUnmanagedValueGeneric<TArgs>( args ) );
- return Execution<TResult>::Create(NativePtr->withArgs(argsptr).ptr(), this->m_rc);
+ return Execution<TResult>::Create(NativePtr->withArgs(argsptr).get(), this->m_rc);
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -77,9 +77,9 @@ namespace Apache
rcg->SetResultCollector(rc);
rcptr = new apache::geode::client::ManagedResultCollectorGeneric( rcg );
- //((apache::geode::client::ManagedResultCollectorGeneric*)rcptr.ptr())->setptr(rcg);
+ //((apache::geode::client::ManagedResultCollectorGeneric*)rcptr.get())->setptr(rcg);
}
- return Execution<TResult>::Create( NativePtr->withCollector(rcptr).ptr(), rc);
+ return Execution<TResult>::Create( NativePtr->withCollector(rcptr).get(), rc);
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -90,7 +90,7 @@ namespace Apache
ManagedString mg_function( func );
apache::geode::client::ResultCollectorPtr rc = NativePtr->execute(mg_function.CharPtr, timeout);
if(m_rc == nullptr)
- return gcnew ResultCollector<TResult>(rc.ptr());
+ return gcnew ResultCollector<TResult>(rc.get());
else
return m_rc;
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/LocalRegion.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/LocalRegion.cpp b/src/clicache/src/LocalRegion.cpp
index 93d07c8..9fd618f 100644
--- a/src/clicache/src/LocalRegion.cpp
+++ b/src/clicache/src/LocalRegion.cpp
@@ -40,7 +40,7 @@ namespace Apache
{
apache::geode::client::CacheableKeyPtr keyptr( Serializable::GetUnmanagedValueGeneric<TKey>( key ) );
apache::geode::client::CacheablePtr nativeptr(this->getRegionEntryValue(keyptr));
- if (nativeptr == NULLPTR)
+ if (nativeptr == nullptr)
{
throw gcnew KeyNotFoundException("The given key was not present in the region");
}
@@ -53,11 +53,11 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
apache::geode::client::RegionEntryPtr entryPtr = NativePtr->getEntry( keyptr );
- if (entryPtr != NULLPTR) {
+ if (entryPtr != nullptr) {
return entryPtr->getValue() ;
}
else {
- return NULLPTR;
+ return nullptr;
}
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -81,7 +81,7 @@ namespace Apache
{
apache::geode::client::CacheableKeyPtr keyptr( Serializable::GetUnmanagedValueGeneric<TKey>( key ) );
apache::geode::client::CacheablePtr nativeptr(this->getRegionEntryValue(keyptr));
- if (nativeptr == NULLPTR)
+ if (nativeptr == nullptr)
{
throw gcnew KeyNotFoundException("The given key was not present in the region");
}
@@ -155,15 +155,15 @@ namespace Apache
generic<class TKey, class TValue>
bool LocalRegion<TKey, TValue>::AreValuesEqual(apache::geode::client::CacheablePtr& val1, apache::geode::client::CacheablePtr& val2)
{
- if ( val1 == NULLPTR && val2 == NULLPTR )
+ if ( val1 == nullptr && val2 == nullptr )
{
return true;
}
- else if ((val1 == NULLPTR && val2 != NULLPTR) || (val1 != NULLPTR && val2 == NULLPTR))
+ else if ((val1 == nullptr && val2 != nullptr) || (val1 != nullptr && val2 == nullptr))
{
return false;
}
- else if( val1 != NULLPTR && val2 != NULLPTR )
+ else if( val1 != nullptr && val2 != nullptr )
{
if (val1->classId() != val2->classId() || val1->typeId() != val2->typeId())
{
@@ -192,7 +192,7 @@ namespace Apache
apache::geode::client::CacheableKeyPtr keyptr( Serializable::GetUnmanagedValueGeneric<TKey>( keyValuePair.Key ) );
apache::geode::client::CacheablePtr nativeptr(this->getRegionEntryValue(keyptr));
//This means that key is not present.
- if (nativeptr == NULLPTR) {
+ if (nativeptr == nullptr) {
return false;
}
TValue value = Serializable::GetManagedValueGeneric<TValue>(nativeptr);
@@ -216,7 +216,7 @@ namespace Apache
{
apache::geode::client::CacheableKeyPtr keyptr( Serializable::GetUnmanagedValueGeneric<TKey>( key ) );
apache::geode::client::CacheablePtr nativeptr(this->getRegionEntryValue(keyptr));
- if (nativeptr == NULLPTR) {
+ if (nativeptr == nullptr) {
val = TValue();
return false;
}
@@ -552,7 +552,7 @@ namespace Apache
apache::geode::client::RegionAttributesPtr& nativeptr( NativePtr->getAttributes( ) );
- return Apache::Geode::Client::RegionAttributes<TKey, TValue>::Create(nativeptr.ptr());
+ return Apache::Geode::Client::RegionAttributes<TKey, TValue>::Create(nativeptr.get());
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -610,7 +610,7 @@ namespace Apache
GetNativePtrFromSBWrap<apache::geode::client::RegionAttributes>( attributes ) );*/
apache::geode::client::RegionPtr& nativeptr( NativePtr->createSubregion(
- mg_subregionName.CharPtr, /*p_attrs*/NULLPTR ) );
+ mg_subregionName.CharPtr, /*p_attrs*/nullptr ) );
return Region<TKey, TValue>::Create( nativeptr.ptr( ) )->GetLocalView();
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
@@ -681,7 +681,7 @@ namespace Apache
apache::geode::client::RegionServicePtr& nativeptr( NativePtr->getRegionService( ) );
- apache::geode::client::Cache* realCache = dynamic_cast<apache::geode::client::Cache*>(nativeptr.ptr());
+ apache::geode::client::Cache* realCache = dynamic_cast<apache::geode::client::Cache*>(nativeptr.get());
if(realCache != NULL)
{
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/Pool.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/Pool.cpp b/src/clicache/src/Pool.cpp
index 800caa9..3a3e68f 100644
--- a/src/clicache/src/Pool.cpp
+++ b/src/clicache/src/Pool.cpp
@@ -153,7 +153,7 @@ namespace Apache
array<String^>^ result = gcnew array<String^>(length);
for (int item = 0; item < length; item++)
{
- result[item] = CacheableString::GetString(locators[item].ptr());
+ result[item] = CacheableString::GetString(locators[item].get());
}
return result;
}
@@ -173,7 +173,7 @@ namespace Apache
array<String^>^ result = gcnew array<String^>(length);
for (int item = 0; item < length; item++)
{
- result[item] = CacheableString::GetString(servers[item].ptr());
+ result[item] = CacheableString::GetString(servers[item].get());
}
return result;
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/PoolFactory.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/PoolFactory.cpp b/src/clicache/src/PoolFactory.cpp
index c4998bb..427453a 100644
--- a/src/clicache/src/PoolFactory.cpp
+++ b/src/clicache/src/PoolFactory.cpp
@@ -282,7 +282,7 @@ namespace Apache
ManagedString mg_name( name );
apache::geode::client::PoolPtr & pool = NativePtr->create(mg_name.CharPtr);
- return Pool/*<TKey, TValue>*/::Create(pool.ptr());
+ return Pool/*<TKey, TValue>*/::Create(pool.get());
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
} // namespace Client
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/PoolManager.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/PoolManager.cpp b/src/clicache/src/PoolManager.cpp
index 9796f59..d609860 100644
--- a/src/clicache/src/PoolManager.cpp
+++ b/src/clicache/src/PoolManager.cpp
@@ -37,7 +37,7 @@ namespace Apache
//generic<class TKey, class TValue>
PoolFactory/*<TKey, TValue>*/^ PoolManager/*<TKey, TValue>*/::CreateFactory()
{
- return PoolFactory/*<TKey, TValue>*/::Create(apache::geode::client::PoolManager::createFactory().ptr());
+ return PoolFactory/*<TKey, TValue>*/::Create(apache::geode::client::PoolManager::createFactory().get());
}
//generic<class TKey, class TValue>
@@ -47,8 +47,8 @@ namespace Apache
Dictionary<String^, Pool/*<TKey, TValue>*/^>^ result = gcnew Dictionary<String^, Pool/*<TKey, TValue>*/^>();
for (apache::geode::client::HashMapOfPools::Iterator iter = pools.begin(); iter != pools.end(); ++iter)
{
- String^ key = CacheableString::GetString(iter.first().ptr());
- Pool/*<TKey, TValue>*/^ val = Pool/*<TKey, TValue>*/::Create(iter.second().ptr());
+ String^ key = CacheableString::GetString(iter.first().get());
+ Pool/*<TKey, TValue>*/^ val = Pool/*<TKey, TValue>*/::Create(iter.second().get());
result->Add(key, val);
}
return result;
@@ -59,14 +59,14 @@ namespace Apache
{
ManagedString mg_name( name );
apache::geode::client::PoolPtr pool = apache::geode::client::PoolManager::find(mg_name.CharPtr);
- return Pool/*<TKey, TValue>*/::Create(pool.ptr());
+ return Pool/*<TKey, TValue>*/::Create(pool.get());
}
//generic <class TKey, class TValue>
Pool/*<TKey, TValue>*/^ PoolManager/*<TKey, TValue>*/::Find(Client::Region<Object^, Object^>^ region)
{
- //return Pool::Create(apache::geode::client::PoolManager::find(apache::geode::client::RegionPtr(GetNativePtr<apache::geode::client::Region>(region))).ptr());
- return Pool/*<TKey, TValue>*/::Create(apache::geode::client::PoolManager::find(apache::geode::client::RegionPtr(region->_NativePtr)).ptr());
+ //return Pool::Create(apache::geode::client::PoolManager::find(apache::geode::client::RegionPtr(GetNativePtr<apache::geode::client::Region>(region))).get());
+ return Pool/*<TKey, TValue>*/::Create(apache::geode::client::PoolManager::find(apache::geode::client::RegionPtr(region->_NativePtr)).get());
}
//generic<class TKey, class TValue>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/Properties.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/Properties.cpp b/src/clicache/src/Properties.cpp
index 843ac40..e7b43c6 100644
--- a/src/clicache/src/Properties.cpp
+++ b/src/clicache/src/Properties.cpp
@@ -114,7 +114,7 @@ namespace Apache
generic<class TPropKey, class TPropValue>
IGeodeSerializable^ Properties<TPropKey, TPropValue>::ConvertCacheableString(apache::geode::client::CacheablePtr& value)
{
- apache::geode::client::CacheableString * cs = dynamic_cast<apache::geode::client::CacheableString *>( value.ptr() );
+ apache::geode::client::CacheableString * cs = dynamic_cast<apache::geode::client::CacheableString *>( value.get() );
if ( cs == NULL) {
return SafeUMSerializableConvert( value.ptr( ) );
}
@@ -261,7 +261,7 @@ namespace Apache
apache::geode::client::CacheableStringPtr csPtr;
CacheableString::GetCacheableString(cStr->Value, csPtr);
- return csPtr.ptr();
+ return csPtr.get();
}
*/
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/QueryService.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/QueryService.cpp b/src/clicache/src/QueryService.cpp
index f60ce3c..f4301e8 100644
--- a/src/clicache/src/QueryService.cpp
+++ b/src/clicache/src/QueryService.cpp
@@ -44,7 +44,7 @@ namespace Apache
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
return Query<TResult>::Create(NativePtr->newQuery(
- mg_queryStr.CharPtr).ptr());
+ mg_queryStr.CharPtr).get());
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -57,7 +57,7 @@ namespace Apache
try
{
return CqQuery<TKey, TResult>::Create(NativePtr->newCq(
- mg_queryStr.CharPtr, attr, isDurable).ptr());
+ mg_queryStr.CharPtr, attr, isDurable).get());
}
catch (const apache::geode::client::Exception& ex)
{
@@ -74,7 +74,7 @@ namespace Apache
try
{
return CqQuery<TKey, TResult>::Create(NativePtr->newCq(
- mg_nameStr.CharPtr, mg_queryStr.CharPtr, attr, isDurable).ptr());
+ mg_nameStr.CharPtr, mg_queryStr.CharPtr, attr, isDurable).get());
}
catch (const apache::geode::client::Exception& ex)
{
@@ -106,7 +106,7 @@ namespace Apache
for (System::Int32 index = 0; index < vrr.size(); index++)
{
- cqs[index] = CqQuery<TKey, TResult>::Create(vrr[index].ptr());
+ cqs[index] = CqQuery<TKey, TResult>::Create(vrr[index].get());
}
return cqs;
}
@@ -123,7 +123,7 @@ namespace Apache
try
{
return CqQuery<TKey, TResult>::Create(NativePtr->getCq(
- mg_queryStr.CharPtr).ptr());
+ mg_queryStr.CharPtr).get());
}
catch (const apache::geode::client::Exception& ex)
{
@@ -162,7 +162,7 @@ namespace Apache
{
try
{
- return CqServiceStatistics::Create(NativePtr->getCqServiceStatistics().ptr());
+ return CqServiceStatistics::Create(NativePtr->getCqServiceStatistics().get());
}
catch (const apache::geode::client::Exception& ex)
{
@@ -176,7 +176,7 @@ namespace Apache
try
{
apache::geode::client::CacheableArrayListPtr durableCqsArrayListPtr = NativePtr->getAllDurableCqsFromServer();
- int length = durableCqsArrayListPtr != NULLPTR ? durableCqsArrayListPtr->length() : 0;
+ int length = durableCqsArrayListPtr != nullptr ? durableCqsArrayListPtr->length() : 0;
System::Collections::Generic::List<String^>^ durableCqsList = gcnew System::Collections::Generic::List<String^>();
if (length > 0)
{
[40/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from clicache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/CacheTransactionManager.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CacheTransactionManager.cpp b/src/clicache/src/CacheTransactionManager.cpp
index f8139a1..68c1ddb 100644
--- a/src/clicache/src/CacheTransactionManager.cpp
+++ b/src/clicache/src/CacheTransactionManager.cpp
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-//#include "geode_includes.hpp"
#include "impl/SafeConvert.hpp"
#include "impl/ManagedTransactionListener.hpp"
#include "impl/ManagedTransactionWriter.hpp"
@@ -34,7 +33,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- NativePtr->begin( );
+ try
+ {
+ m_nativeptr->get()->begin( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -43,7 +49,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- NativePtr->prepare( );
+ try
+ {
+ m_nativeptr->get()->prepare( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -51,14 +64,28 @@ namespace Apache
void CacheTransactionManager::Commit( )
{
_GF_MG_EXCEPTION_TRY2
- NativePtr->commit( );
+ try
+ {
+ m_nativeptr->get()->commit( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2
}
void CacheTransactionManager::Rollback( )
{
_GF_MG_EXCEPTION_TRY2
- NativePtr->rollback( );
+ try
+ {
+ m_nativeptr->get()->rollback( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -66,7 +93,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- return NativePtr->exists( );
+ try
+ {
+ return m_nativeptr->get()->exists( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -75,7 +109,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- return Apache::Geode::Client::TransactionId::Create( NativePtr->suspend().get() );
+ try
+ {
+ return Apache::Geode::Client::TransactionId::Create( m_nativeptr->get()->suspend() );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -83,7 +124,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- return Apache::Geode::Client::TransactionId::Create( NativePtr->getTransactionId().get() );
+ try
+ {
+ return Apache::Geode::Client::TransactionId::Create( m_nativeptr->get()->getTransactionId() );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -91,7 +139,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- return NativePtr->resume( apache::geode::client::TransactionIdPtr(transactionId->NativePtr()));
+ try
+ {
+ return m_nativeptr->get()->resume(transactionId->GetNative());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -99,7 +154,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- return NativePtr->isSuspended( apache::geode::client::TransactionIdPtr(transactionId->NativePtr()));
+ try
+ {
+ return m_nativeptr->get()->isSuspended(transactionId->GetNative());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -107,7 +169,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- return NativePtr->tryResume( apache::geode::client::TransactionIdPtr(transactionId->NativePtr()));
+ try
+ {
+ return m_nativeptr->get()->tryResume(transactionId->GetNative());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -115,7 +184,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- return NativePtr->tryResume( apache::geode::client::TransactionIdPtr(transactionId->NativePtr()), waitTimeInMilliSec);
+ try
+ {
+ return m_nativeptr->get()->tryResume(transactionId->GetNative(), waitTimeInMilliSec);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -123,7 +199,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- return NativePtr->exists( apache::geode::client::TransactionIdPtr(transactionId->NativePtr()));
+ try
+ {
+ return m_nativeptr->get()->exists(transactionId->GetNative());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -135,9 +218,9 @@ namespace Apache
_GF_MG_EXCEPTION_TRY2
// Conver the unmanaged object to managed generic object
- apache::geode::client::TransactionWriterPtr& writerPtr( NativePtr->getWriter( ) );
+ apache::geode::client::TransactionWriterPtr& writerPtr( m_nativeptr->getGCKeepAlive()->getWriter( ) );
apache::geode::client::ManagedTransactionWriterGeneric* twg =
- dynamic_cast<apache::geode::client::ManagedTransactionWriterGeneric*>( writerPtr.ptr( ) );
+ dynamic_cast<apache::geode::client::ManagedTransactionWriterGeneric*>( writerPtr.get() );
if (twg != nullptr)
{
@@ -163,7 +246,7 @@ namespace Apache
writerPtr = new apache::geode::client::ManagedTransactionWriterGeneric( transactionWriter );
((apache::geode::client::ManagedTransactionWriterGeneric*)writerPtr.get())->setptr(twg);
}
- NativePtr->setWriter( writerPtr );
+ m_nativeptr->getGCKeepAlive()->setWriter( writerPtr );
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -182,7 +265,7 @@ namespace Apache
listenerPtr = new apache::geode::client::ManagedTransactionListenerGeneric( transactionListener );
((apache::geode::client::ManagedTransactionListenerGeneric*)listenerPtr.get())->setptr(twg);
}
- NativePtr->addListener( listenerPtr );
+ m_nativeptr->getGCKeepAlive()->addListener( listenerPtr );
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -201,7 +284,7 @@ namespace Apache
listenerPtr = new apache::geode::client::ManagedTransactionListenerGeneric( transactionListener );
((apache::geode::client::ManagedTransactionListenerGeneric*)listenerPtr.get())->setptr(twg);
}
- NativePtr->removeListener( listenerPtr );
+ m_nativeptr->getGCKeepAlive()->removeListener( listenerPtr );
_GF_MG_EXCEPTION_CATCH_ALL2
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/CacheTransactionManager.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CacheTransactionManager.hpp b/src/clicache/src/CacheTransactionManager.hpp
index 480d95a..07f6954 100644
--- a/src/clicache/src/CacheTransactionManager.hpp
+++ b/src/clicache/src/CacheTransactionManager.hpp
@@ -18,12 +18,12 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/CacheTransactionManager.hpp>
#include <geode/InternalCacheTransactionManager2PC.hpp>
+#include "end_native.hpp"
+#include "native_shared_ptr.hpp"
#include "TransactionId.hpp"
-//#include "impl/NativeWrapper.hpp"
-//#include "impl/TransactionWriter.hpp"
-//#include "impl/TransactionListener.hpp"
using namespace System;
namespace Apache
@@ -32,12 +32,11 @@ namespace Apache
{
namespace Client
{
-
+ namespace native = apache::geode::client;
/// <summary>
/// CacheTransactionManager encapsulates the transactions for a cache
/// </summary>
public ref class CacheTransactionManager sealed
- : Internal::SBWrap<apache::geode::client::InternalCacheTransactionManager2PC>
{
public:
/// <summary>
@@ -202,52 +201,9 @@ namespace Apache
Apache::Geode::Client::TransactionId^ get( );
}
-#ifdef CSTX_COMMENTED
-
- /// <summary>
- /// Returns the current transaction writer
- /// </summary>
- /// <returns>current transaction writer(<c>ITransactionWriter</c>)</returns>
- generic<class TKey, class TValue>
- ITransactionWriter<TKey, TValue>^ GetWriter ();
-
- /// <summary>
- /// Set the <c>ITransactionWriter</c> for the cache
- /// <param name="transactionWriter">transaction writer</param>
- generic<class TKey, class TValue>
- void SetWriter (ITransactionWriter<TKey, TValue>^ transactionWriter);
-
- /// <summary>
- /// Adds a transaction listener to the end of the list of transaction listeners
- /// on this cache.
- /// </summary>
- /// <param name="aListener">
- /// the user defined transaction listener to add to the cache
- /// </param>
- /// <exception cref="IllegalArgumentException">
- /// If the parameter is null.
- /// </exception>
- generic<class TKey, class TValue>
- void AddListener(ITransactionListener<TKey, TValue>^ aListener);
-
- /// <summary>
- /// Removes a transaction listener from the list of transaction listeners on this cache.
- /// Does nothing if the specified listener has not been added.
- /// If the specified listener has been added then the close method of the listener will
- /// be called.
- /// </summary>
- /// <param name="aListener">the transaction listener to remove from the cache.</param>
- /// <exception cref="IllegalArgumentException">
- /// if the parameteris null
- /// </exception>
- generic<class TKey, class TValue>
- void RemoveListener(ITransactionListener<TKey, TValue>^ aListener);
-
-#endif
-
internal:
- inline static CacheTransactionManager^ Create( apache::geode::client::InternalCacheTransactionManager2PC* nativeptr )
+ inline static CacheTransactionManager^ Create( native::InternalCacheTransactionManager2PCPtr nativeptr )
{
return ( nativeptr != nullptr ?
gcnew CacheTransactionManager( nativeptr ) : nullptr );
@@ -260,8 +216,12 @@ namespace Apache
/// Private constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline CacheTransactionManager( apache::geode::client::InternalCacheTransactionManager2PC* nativeptr )
- : SBWrap( nativeptr ) { }
+ inline CacheTransactionManager( native::InternalCacheTransactionManager2PCPtr nativeptr )
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::InternalCacheTransactionManager2PC>(nativeptr);
+ }
+
+ native_shared_ptr<native::InternalCacheTransactionManager2PC>^ m_nativeptr;
};
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/CacheableBuiltins.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CacheableBuiltins.hpp b/src/clicache/src/CacheableBuiltins.hpp
index 3cee562..ce96b61 100644
--- a/src/clicache/src/CacheableBuiltins.hpp
+++ b/src/clicache/src/CacheableBuiltins.hpp
@@ -20,7 +20,10 @@
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/CacheableBuiltins.hpp>
+#include "end_native.hpp"
+
#include "CacheableKey.hpp"
#include "Serializable.hpp"
#include "ExceptionTypes.hpp"
@@ -37,7 +40,7 @@ namespace Apache
namespace Client
{
- //namespace Internal
+ namespace native = apache::geode::client;
/// <summary>
@@ -54,9 +57,8 @@ namespace Apache
/// </summary>
CacheableBuiltinKey()
{
- apache::geode::client::SharedPtr<TNative>& nativeptr = TNative::create();
-
- SetSP(nativeptr.get());
+ auto nativeptr = TNative::create();
+ m_nativeptr = gcnew native_shared_ptr<native::Serializable>(nativeptr);
}
/// <summary>
@@ -65,9 +67,8 @@ namespace Apache
/// <param name="value">the value of the new instance</param>
CacheableBuiltinKey(TManaged value)
{
- apache::geode::client::SharedPtr<TNative>& nativeptr = TNative::create(value);
-
- SetSP(nativeptr.get());
+ auto nativeptr = TNative::create(value);
+ m_nativeptr = gcnew native_shared_ptr<native::Serializable>(nativeptr);
}
/// <summary>
@@ -90,7 +91,15 @@ namespace Apache
/// </summary>
virtual String^ ToString() override
{
- return static_cast<TNative*>(NativePtr())->value().ToString();
+ try
+ {
+ return static_cast<TNative*>(m_nativeptr->get())->value().ToString();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
}
/// <summary>
@@ -98,14 +107,23 @@ namespace Apache
/// It invokes the '==' operator of the underlying
/// native object.
/// </summary>
- virtual bool Equals(ICacheableKey^ other) override
+ virtual bool Equals(CacheableBuiltinKey^ other) override
{
- if (other == nullptr || other->ClassId != TYPEID)
+ if (other == nullptr)
{
return false;
}
- return static_cast<TNative*>(NativePtr())->operator==(
- *static_cast<TNative*>(((CacheableKey^)other)->NativePtr()));
+
+ try
+ {
+ return static_cast<TNative*>(m_nativeptr->get())->operator==(
+ *static_cast<TNative*>(other->m_nativeptr->get()));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ GC::KeepAlive(other->m_nativeptr);
+ }
}
/// <summary>
@@ -115,14 +133,7 @@ namespace Apache
/// </summary>
virtual bool Equals(Object^ obj) override
{
- CacheableBuiltinKey^ otherKey =
- dynamic_cast<CacheableBuiltinKey^>(obj);
-
- if (otherKey != nullptr) {
- return static_cast<TNative*>(NativePtr())->operator==(
- *static_cast<TNative*>(otherKey->NativePtr()));
- }
- return false;
+ return Equals(dynamic_cast<CacheableBuiltinKey^>(obj));
}
/// <summary>
@@ -130,7 +141,15 @@ namespace Apache
/// </summary>
bool operator == (TManaged other)
{
- return (static_cast<TNative*>(NativePtr())->value() == other);
+ try
+ {
+ return (static_cast<TNative*>(m_nativeptr->get())->value() == other);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
}
/// <summary>
@@ -140,7 +159,15 @@ namespace Apache
{
inline TManaged get()
{
- return static_cast<TNative*>(NativePtr())->value();
+ try
+ {
+ return static_cast<TNative*>(m_nativeptr->get())->value();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
}
}
@@ -150,7 +177,7 @@ namespace Apache
/// Protected constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline CacheableBuiltinKey(apache::geode::client::Serializable* nativeptr)
+ inline CacheableBuiltinKey(native::SerializablePtr nativeptr)
: CacheableKey(nativeptr) { }
};
@@ -246,7 +273,7 @@ namespace Apache
inline CacheableBuiltinArray()
{
//TODO:
- //apache::geode::client::Serializable* sp = TNative::createDeserializable();
+ //native::Serializable* sp = TNative::createDeserializable();
//SetSP(sp);
}
@@ -254,13 +281,10 @@ namespace Apache
/// Protected constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline CacheableBuiltinArray(apache::geode::client::Serializable* nptr)
+ inline CacheableBuiltinArray(native::SerializablePtr nptr)
: Serializable(nptr)
{
- //TODO: ??
- // ManagedPtrWrap< apache::geode::client::Serializable,
- // Internal::SBWrap<apache::geode::client::Serializable> > nptr = nativeptr;
- TNative* nativeptr = static_cast<TNative*>(nptr);
+ auto nativeptr = std::static_pointer_cast<TNative>(nptr);
System::Int32 len = nativeptr->length();
if (len > 0)
{
@@ -364,20 +388,20 @@ namespace Apache
} \
\
internal: \
- static IGeodeSerializable^ Create(apache::geode::client::Serializable* obj) \
+ static IGeodeSerializable^ Create(native::SerializablePtr obj) \
{ \
return (obj != nullptr ? gcnew m(obj) : nullptr); \
} \
\
private: \
- inline m(apache::geode::client::Serializable* nativeptr) \
+ inline m(native::SerializablePtr nativeptr) \
: CacheableBuiltinKey(nativeptr) { } \
};
#define _GFCLI_CACHEABLE_ARRAY_DEF_NEW(m, mt) \
ref class m : public CacheableBuiltinArray< \
- apache::geode::client::m, apache::geode::client::m##Ptr, mt, GeodeClassIds::m> \
+ native::m, native::m##Ptr, mt, GeodeClassIds::m> \
{ \
public: \
/** <summary>
@@ -427,7 +451,7 @@ namespace Apache
} \
\
internal: \
- static IGeodeSerializable^ Create(apache::geode::client::Serializable* obj) \
+ static IGeodeSerializable^ Create(native::SerializablePtr obj) \
{ \
return (obj != nullptr ? gcnew m(obj) : nullptr); \
} \
@@ -460,7 +484,7 @@ namespace Apache
*/ \
inline m(array<mt>^ value, System::Int32 length) \
: CacheableBuiltinArray(value, length) { } \
- inline m(apache::geode::client::Serializable* nativeptr) \
+ inline m(native::SerializablePtr nativeptr) \
: CacheableBuiltinArray(nativeptr) { } \
};
@@ -471,56 +495,56 @@ namespace Apache
/// An immutable wrapper for booleans that can serve
/// as a distributable key object for caching.
/// </summary>
- _GFCLI_CACHEABLE_KEY_DEF_NEW(apache::geode::client::CacheableBoolean,
+ _GFCLI_CACHEABLE_KEY_DEF_NEW(native::CacheableBoolean,
CacheableBoolean, bool);
/// <summary>
/// An immutable wrapper for bytes that can serve
/// as a distributable key object for caching.
/// </summary>
- _GFCLI_CACHEABLE_KEY_DEF_NEW(apache::geode::client::CacheableByte,
+ _GFCLI_CACHEABLE_KEY_DEF_NEW(native::CacheableByte,
CacheableByte, Byte);
/// <summary>
/// An immutable wrapper for 16-bit characters that can serve
/// as a distributable key object for caching.
/// </summary>
- _GFCLI_CACHEABLE_KEY_DEF_NEW(apache::geode::client::CacheableWideChar,
+ _GFCLI_CACHEABLE_KEY_DEF_NEW(native::CacheableWideChar,
CacheableCharacter, Char);
/// <summary>
/// An immutable wrapper for doubles that can serve
/// as a distributable key object for caching.
/// </summary>
- _GFCLI_CACHEABLE_KEY_DEF_NEW(apache::geode::client::CacheableDouble,
+ _GFCLI_CACHEABLE_KEY_DEF_NEW(native::CacheableDouble,
CacheableDouble, Double);
/// <summary>
/// An immutable wrapper for floats that can serve
/// as a distributable key object for caching.
/// </summary>
- _GFCLI_CACHEABLE_KEY_DEF_NEW(apache::geode::client::CacheableFloat,
+ _GFCLI_CACHEABLE_KEY_DEF_NEW(native::CacheableFloat,
CacheableFloat, Single);
/// <summary>
/// An immutable wrapper for 16-bit integers that can serve
/// as a distributable key object for caching.
/// </summary>
- _GFCLI_CACHEABLE_KEY_DEF_NEW(apache::geode::client::CacheableInt16,
+ _GFCLI_CACHEABLE_KEY_DEF_NEW(native::CacheableInt16,
CacheableInt16, System::Int16);
/// <summary>
/// An immutable wrapper for 32-bit integers that can serve
/// as a distributable key object for caching.
/// </summary>
- _GFCLI_CACHEABLE_KEY_DEF_NEW(apache::geode::client::CacheableInt32,
+ _GFCLI_CACHEABLE_KEY_DEF_NEW(native::CacheableInt32,
CacheableInt32, System::Int32);
/// <summary>
/// An immutable wrapper for 64-bit integers that can serve
/// as a distributable key object for caching.
/// </summary>
- _GFCLI_CACHEABLE_KEY_DEF_NEW(apache::geode::client::CacheableInt64,
+ _GFCLI_CACHEABLE_KEY_DEF_NEW(native::CacheableInt64,
CacheableInt64, System::Int64);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/CacheableDate.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CacheableDate.cpp b/src/clicache/src/CacheableDate.cpp
index 79bd75d..824b16c 100644
--- a/src/clicache/src/CacheableDate.cpp
+++ b/src/clicache/src/CacheableDate.cpp
@@ -15,10 +15,6 @@
* limitations under the License.
*/
-
-
-
-//#include "geode_includes.hpp"
#include "CacheableDate.hpp"
#include "DataInput.hpp"
#include "DataOutput.hpp"
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/CacheableDate.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CacheableDate.hpp b/src/clicache/src/CacheableDate.hpp
index 9cf2435..9530ef2 100644
--- a/src/clicache/src/CacheableDate.hpp
+++ b/src/clicache/src/CacheableDate.hpp
@@ -17,12 +17,9 @@
#pragma once
-
-
#include "geode_defs.hpp"
#include "ICacheableKey.hpp"
-
using namespace System;
namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/CacheableHashSet.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CacheableHashSet.hpp b/src/clicache/src/CacheableHashSet.hpp
index aa6085b..b7fc935 100644
--- a/src/clicache/src/CacheableHashSet.hpp
+++ b/src/clicache/src/CacheableHashSet.hpp
@@ -20,10 +20,15 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/CacheableBuiltins.hpp>
+#include "end_native.hpp"
+
#include "Serializable.hpp"
#include "ExceptionTypes.hpp"
#include "impl/PdxInstanceImpl.hpp"
+#include "native_shared_ptr.hpp"
+#include "native_unique_ptr.hpp"
using namespace System;
using namespace System::Collections::Generic;
@@ -52,15 +57,14 @@ namespace Apache
{
output->WriteArrayLen(this->Count);
- Internal::ManagedPtrWrap< apache::geode::client::Serializable,
- Internal::SBWrap<apache::geode::client::Serializable> > nptr = NativePtr;
- HSTYPE* set = static_cast<HSTYPE*>(nptr());
+ auto set = static_cast<HSTYPE*>(m_nativeptr->get());
for (typename HSTYPE::Iterator iter = set->begin();
iter != set->end(); ++iter) {
- //Generic::ICacheableKey^ key = SafeGenericUMKeyConvert<ICacheableKey^>((*iter).get());
- Object^ key = Serializable::GetManagedValueGeneric<Object^>((*iter));
+ auto key = Serializable::GetManagedValueGeneric<Object^>((*iter));
output->WriteObject(key);
}
+
+ GC::KeepAlive(this);
}
virtual IGeodeSerializable^ FromData(DataInput^ input) override
@@ -70,7 +74,6 @@ namespace Apache
{
for (int i = 0; i < len; i++)
{
- //Generic::ICacheableKey^ key = dynamic_cast<Client::ICacheableKey^>(input->ReadObject());
Object^ key = (input->ReadObject());
this->Add(key);
}
@@ -135,8 +138,7 @@ namespace Apache
/// Enumerator for <c>CacheableHashSet</c> class.
/// </summary>
ref class Enumerator sealed
- : public Internal::UMWrap<typename HSTYPE::Iterator>,
- public IEnumerator<Object^>
+ : public IEnumerator<Object^>
{
public:
// Region: IEnumerator<ICacheableKey^> Members
@@ -153,13 +155,14 @@ namespace Apache
{
virtual Object^ get() =
IEnumerator<Object^>::Current::get
- {
- if (!m_started) {
- throw gcnew System::InvalidOperationException(
- "Call MoveNext first.");
- }
- //return SafeGenericUMKeyConvert<Client::ICacheableKey^>((*(*NativePtr())).get());
- return Serializable::GetManagedValueGeneric<Object^>((*(*NativePtr())));
+ {
+ if (!m_started) {
+ throw gcnew System::InvalidOperationException(
+ "Call MoveNext first.");
+ }
+ auto ret = Serializable::GetManagedValueGeneric<Object^>(*(*(m_nativeptr->get())));
+ GC::KeepAlive(this);
+ return ret;
}
}
@@ -177,15 +180,14 @@ namespace Apache
/// </returns>
virtual bool MoveNext()
{
- Internal::ManagedPtrWrap< typename HSTYPE::Iterator,
- Internal::UMWrap<typename HSTYPE::Iterator> > nptr = NativePtr;
+ auto nptr = m_nativeptr->get();
bool isEnd = nptr->isEnd();
if (!m_started) {
m_started = true;
}
else {
if (!isEnd) {
- (*nptr())++;
+ (*nptr)++;
isEnd = nptr->isEnd();
}
}
@@ -199,10 +201,20 @@ namespace Apache
/// </summary>
virtual void Reset()
{
- NativePtr->reset();
+ try
+ {
+ m_nativeptr->get()->reset();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
m_started = false;
}
+ !Enumerator() {}
+ ~Enumerator() {}
+
// End Region: IEnumerator Members
internal:
@@ -210,9 +222,11 @@ namespace Apache
/// Internal constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline Enumerator(typename HSTYPE::Iterator* nativeptr,
+ inline Enumerator(std::unique_ptr<typename HSTYPE::Iterator> nativeptr,
CacheableHashSetType<TYPEID, HSTYPE>^ set)
- : UMWrap(nativeptr, true), m_set(set) { }
+ : m_set(set) {
+ m_nativeptr = gcnew native_unique_ptr<typename HSTYPE::Iterator>(std::move(nativeptr));
+ }
private:
// Region: IEnumerator Members
@@ -241,6 +255,8 @@ namespace Apache
bool m_started;
CacheableHashSetType<TYPEID, HSTYPE>^ m_set;
+
+ native_unique_ptr<typename HSTYPE::Iterator>^ m_nativeptr;
};
/// <summary>
@@ -253,7 +269,6 @@ namespace Apache
{
virtual System::UInt32 get() override
{
- //return static_cast<HSTYPE*>(NativePtr())->classId() + 0x80000000;
return TYPEID;
}
}
@@ -265,7 +280,14 @@ namespace Apache
{
inline System::Int32 get()
{
- return static_cast<HSTYPE*>(NativePtr())->max_size();
+ try
+ {
+ return static_cast<HSTYPE*>(m_nativeptr->get())->max_size();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
}
@@ -276,7 +298,14 @@ namespace Apache
{
inline bool get()
{
- return static_cast<HSTYPE*>(NativePtr())->empty();
+ try
+ {
+ return static_cast<HSTYPE*>(m_nativeptr->get())->empty();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
}
@@ -287,7 +316,14 @@ namespace Apache
{
inline System::Int32 get()
{
- return static_cast<HSTYPE*>(NativePtr())->bucket_count();
+ try
+ {
+ return static_cast<HSTYPE*>(m_nativeptr->get())->bucket_count();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
}
@@ -297,7 +333,14 @@ namespace Apache
/// <param name="size">The new size of the HashSet.</param>
virtual void Resize(System::Int32 size) sealed
{
- static_cast<HSTYPE*>(NativePtr())->resize(size);
+ try
+ {
+ static_cast<HSTYPE*>(m_nativeptr->get())->resize(size);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
/// <summary>
@@ -309,9 +352,17 @@ namespace Apache
/// </param>
virtual void Swap(CacheableHashSetType<TYPEID, HSTYPE>^ other) sealed
{
- if (other != nullptr) {
- static_cast<HSTYPE*>(NativePtr())->swap(
- *static_cast<HSTYPE*>(other->NativePtr()));
+ try
+ {
+ if (other != nullptr) {
+ static_cast<HSTYPE*>(m_nativeptr->get())->swap(
+ *static_cast<HSTYPE*>(other->m_nativeptr->get()));
+ }
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ GC::KeepAlive(other->m_nativeptr);
}
}
@@ -327,8 +378,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::CacheableKeyPtr nativeptr(Serializable::GetUnmanagedValueGeneric(item));
- static_cast<HSTYPE*>(NativePtr())->insert(nativeptr);
+ try
+ {
+ static_cast<HSTYPE*>(m_nativeptr->get())->insert(Serializable::GetUnmanagedValueGeneric(item));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -338,7 +395,14 @@ namespace Apache
/// </summary>
virtual void Clear()
{
- static_cast<HSTYPE*>(NativePtr())->clear();
+ try
+ {
+ static_cast<HSTYPE*>(m_nativeptr->get())->clear();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
/// <summary>
@@ -354,8 +418,14 @@ namespace Apache
/// </returns>
virtual bool Contains(Object^ item)
{
- return static_cast<HSTYPE*>(NativePtr())->contains(
- apache::geode::client::CacheableKeyPtr(Serializable::GetUnmanagedValueGeneric(item)));
+ try
+ {
+ return static_cast<HSTYPE*>(m_nativeptr->get())->contains(Serializable::GetUnmanagedValueGeneric(item));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
/// <summary>
@@ -386,9 +456,8 @@ namespace Apache
throw gcnew IllegalArgumentException("CacheableHashSet.CopyTo():"
" array is null or array index is less than zero");
}
- Internal::ManagedPtrWrap< apache::geode::client::Serializable,
- Internal::SBWrap<apache::geode::client::Serializable> > nptr = NativePtr;
- HSTYPE* set = static_cast<HSTYPE*>(nptr());
+
+ auto set = static_cast<HSTYPE*>(m_nativeptr->get());
System::Int32 index = arrayIndex;
if (arrayIndex >= array->Length ||
@@ -402,7 +471,8 @@ namespace Apache
iter != set->end(); ++iter, ++index) {
array[index] = Serializable::GetManagedValueGeneric<Object^>((*iter));
}
- GC::KeepAlive(this);
+
+ GC::KeepAlive(m_nativeptr);
}
/// <summary>
@@ -413,7 +483,14 @@ namespace Apache
{
virtual System::Int32 get()
{
- return static_cast<HSTYPE*>(NativePtr())->size();
+ try
+ {
+ return static_cast<HSTYPE*>(m_nativeptr->get())->size();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
}
@@ -432,8 +509,14 @@ namespace Apache
/// </returns>
virtual bool Remove(Object^ item)
{
- return (static_cast<HSTYPE*>(NativePtr())->erase(
- apache::geode::client::CacheableKeyPtr(Serializable::GetUnmanagedValueGeneric(item))) > 0);
+ try
+ {
+ return (static_cast<HSTYPE*>(m_nativeptr->get())->erase(Serializable::GetUnmanagedValueGeneric(item)) > 0);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
/// <summary>
@@ -464,10 +547,16 @@ namespace Apache
/// </returns>
virtual IEnumerator<Object^>^ GetEnumerator()
{
- typename HSTYPE::Iterator* iter = new typename HSTYPE::Iterator(
- static_cast<HSTYPE*>(NativePtr())->begin());
-
- return gcnew Enumerator(iter, this);
+ try
+ {
+ auto iter = std::make_unique<typename HSTYPE::Iterator>(
+ static_cast<HSTYPE*>(m_nativeptr->get())->begin());
+ return gcnew Enumerator(std::move(iter), this);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
// End Region: IEnumerable<ICacheableKey^> Members
@@ -505,14 +594,14 @@ namespace Apache
/// Private constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline CacheableHashSetType<TYPEID, HSTYPE>(apache::geode::client::Serializable* nativeptr)
+ inline CacheableHashSetType<TYPEID, HSTYPE>(apache::geode::client::SerializablePtr nativeptr)
: Serializable(nativeptr) { }
/// <summary>
/// Allocates a new empty instance.
/// </summary>
inline CacheableHashSetType<TYPEID, HSTYPE>()
- : Serializable(HSTYPE::createDeserializable())
+ : Serializable(std::shared_ptr<HSTYPE>(static_cast<HSTYPE*>(HSTYPE::createDeserializable())))
{ }
/// <summary>
@@ -520,7 +609,7 @@ namespace Apache
/// </summary>
/// <param name="size">The initial size of the HashSet.</param>
inline CacheableHashSetType<TYPEID, HSTYPE>(System::Int32 size)
- : Serializable(HSTYPE::create(size).get())
+ : Serializable(HSTYPE::create(size))
{ }
};
}
@@ -572,13 +661,13 @@ namespace Apache
} \
\
internal: \
- static IGeodeSerializable^ Create(apache::geode::client::Serializable* obj) \
+ static IGeodeSerializable^ Create(apache::geode::client::SerializablePtr obj) \
{ \
return gcnew m(obj); \
} \
\
private: \
- inline m(apache::geode::client::Serializable* nativeptr) \
+ inline m(apache::geode::client::SerializablePtr nativeptr) \
: Internal::CacheableHashSetType<Apache::Geode::Client::GeodeClassIds::m, HSTYPE>(nativeptr) { } \
};
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/CacheableKey.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CacheableKey.cpp b/src/clicache/src/CacheableKey.cpp
index 4526b78..5fc03fa 100644
--- a/src/clicache/src/CacheableKey.cpp
+++ b/src/clicache/src/CacheableKey.cpp
@@ -29,10 +29,19 @@ namespace Apache
namespace Client
{
+ namespace native = apache::geode::client;
+
// generic<class TKey>
System::Int32 CacheableKey::GetHashCode()
{
- return static_cast<apache::geode::client::CacheableKey*>(NativePtr())->hashcode();
+ try
+ {
+ return static_cast<native::CacheableKey*>(m_nativeptr->get())->hashcode();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
// generic<class TKey>
@@ -41,22 +50,23 @@ namespace Apache
if (other == nullptr || other->ClassId != ClassId) {
return false;
}
- return static_cast<apache::geode::client::CacheableKey*>(NativePtr())->operator==(
- *static_cast<apache::geode::client::CacheableKey*>(
- ((Client::CacheableKey^)other)->NativePtr()));
+ try
+ {
+ return static_cast<native::CacheableKey*>(m_nativeptr->get())->operator==(
+ *static_cast<native::CacheableKey*>(
+ ((Client::CacheableKey^)other)->m_nativeptr->get()));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ GC::KeepAlive(((Client::CacheableKey^)other)->m_nativeptr);
+ }
}
//generic<class TKey>
bool CacheableKey::Equals(Object^ obj)
{
- CacheableKey^ otherKey =
- dynamic_cast<CacheableKey^>(obj);
-
- if (otherKey != nullptr) {
- return static_cast<apache::geode::client::CacheableKey*>(NativePtr())->operator==(
- *static_cast<apache::geode::client::CacheableKey*>(otherKey->NativePtr()));
- }
- return false;
+ return Equals(dynamic_cast<CacheableKey^>(obj));
}
//generic<class TKey>
@@ -108,11 +118,10 @@ namespace Apache
}
//generic<class TKey>
- CacheableKey::operator CacheableKey^ (String^ value)
+ CacheableKey::operator CacheableKey ^ (String^ value)
{
return dynamic_cast<CacheableKey^>(CacheableString::Create(value));
+ }
} // namespace Client
} // namespace Geode
} // namespace Apache
-
-} //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/CacheableKey.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CacheableKey.hpp b/src/clicache/src/CacheableKey.hpp
index f36f3ae..39bf3e5 100644
--- a/src/clicache/src/CacheableKey.hpp
+++ b/src/clicache/src/CacheableKey.hpp
@@ -18,8 +18,10 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/CacheableKey.hpp>
-//#include "impl/NativeWrapper.hpp"
+#include "end_native.hpp"
+
#include "Serializable.hpp"
#include "ICacheableKey.hpp"
@@ -129,7 +131,7 @@ namespace Apache
/// Internal constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline CacheableKey(apache::geode::client::Serializable* nativeptr)
+ inline CacheableKey(apache::geode::client::SerializablePtr nativeptr)
: Client::Serializable(nativeptr) { }
};
} // namespace Client
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/CacheableObjectArray.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CacheableObjectArray.cpp b/src/clicache/src/CacheableObjectArray.cpp
index c4caa7d..ac615fd 100644
--- a/src/clicache/src/CacheableObjectArray.cpp
+++ b/src/clicache/src/CacheableObjectArray.cpp
@@ -16,9 +16,9 @@
*/
-
-//#include "geode_includes.hpp"
+#include "begin_native.hpp"
#include <GeodeTypeIdsImpl.hpp>
+#include "end_native.hpp"
#include "CacheableObjectArray.hpp"
#include "DataOutput.hpp"
#include "DataInput.hpp"
@@ -50,20 +50,6 @@ namespace Apache
//TODO::split
output->WriteObject(obj);
}
-
- /*_GF_MG_EXCEPTION_TRY
-
- apache::geode::client::DataOutput& nativeOutput = *(output->_NativePtr);
- nativeOutput.writeArrayLen((System::Int32)Count);
- nativeOutput.write((int8_t)apache::geode::client::GeodeTypeIdsImpl::Class);
- nativeOutput.write((int8_t)apache::geode::client::GeodeTypeIds::CacheableASCIIString);
- nativeOutput.writeASCII("java.lang.Object");
- for each (IGeodeSerializable^ obj in this) {
- apache::geode::client::SerializablePtr objPtr(SafeMSerializableConvert(obj));
- nativeOutput.writeObject(objPtr);
- }
-
- _GF_MG_EXCEPTION_CATCH_ALL*/
}
IGeodeSerializable^ CacheableObjectArray::FromData(DataInput^ input)
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/CacheableStack.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CacheableStack.cpp b/src/clicache/src/CacheableStack.cpp
index 96839e6..6b5d1c8 100644
--- a/src/clicache/src/CacheableStack.cpp
+++ b/src/clicache/src/CacheableStack.cpp
@@ -17,11 +17,12 @@
-//#include "geode_includes.hpp"
#include "CacheableStack.hpp"
#include "DataOutput.hpp"
#include "DataInput.hpp"
+#include "begin_native.hpp"
#include <GeodeTypeIdsImpl.hpp>
+#include "end_native.hpp"
#include "impl/SafeConvert.hpp"
#include "GeodeClassIds.hpp"
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/CacheableString.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CacheableString.cpp b/src/clicache/src/CacheableString.cpp
index 36d7b09..ceea6d6 100644
--- a/src/clicache/src/CacheableString.cpp
+++ b/src/clicache/src/CacheableString.cpp
@@ -79,8 +79,8 @@ namespace Apache
cStr = apache::geode::client::CacheableString::create(pin_value, (System::Int32)len);
}
else {
- cStr = (apache::geode::client::CacheableString*)
- apache::geode::client::CacheableString::createDeserializable();
+ cStr.reset(
+ static_cast<apache::geode::client::CacheableString*>(apache::geode::client::CacheableString::createDeserializable()));
}
}
@@ -94,8 +94,8 @@ namespace Apache
(const wchar_t*)pin_value, (System::Int32)len);
}
else {
- cStr = (apache::geode::client::CacheableString*)
- apache::geode::client::CacheableString::createDeserializable();
+ cStr.reset(
+ static_cast<apache::geode::client::CacheableString*>(apache::geode::client::CacheableString::createDeserializable()));
}
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/CacheableString.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CacheableString.hpp b/src/clicache/src/CacheableString.hpp
index 633cae9..d24adc5 100644
--- a/src/clicache/src/CacheableString.hpp
+++ b/src/clicache/src/CacheableString.hpp
@@ -20,7 +20,10 @@
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/CacheableString.hpp>
+#include "end_native.hpp"
+
#include "impl/ManagedString.hpp"
#include "CacheableKey.hpp"
#include "GeodeClassIds.hpp"
@@ -239,7 +242,7 @@ namespace Apache
/// <summary>
/// Factory function to register wrapper
/// </summary>
- static IGeodeSerializable^ Create(apache::geode::client::Serializable* obj)
+ static IGeodeSerializable^ Create(apache::geode::client::SerializablePtr obj)
{
return (obj != nullptr ?
gcnew CacheableString(obj) : nullptr);
@@ -313,7 +316,7 @@ namespace Apache
/// Private constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline CacheableString(apache::geode::client::Serializable* nativeptr)
+ inline CacheableString(apache::geode::client::SerializablePtr nativeptr)
: CacheableKey(nativeptr) { }
};
} // namespace Client
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/CacheableStringArray.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CacheableStringArray.hpp b/src/clicache/src/CacheableStringArray.hpp
index fca0be6..e8c66f6 100644
--- a/src/clicache/src/CacheableStringArray.hpp
+++ b/src/clicache/src/CacheableStringArray.hpp
@@ -20,7 +20,10 @@
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/CacheableBuiltins.hpp>
+#include "end_native.hpp"
+
#include "Serializable.hpp"
#include "GeodeClassIds.hpp"
#include "CacheableString.hpp"
@@ -152,7 +155,7 @@ namespace Apache
/// <summary>
/// Factory function to register wrapper
/// </summary>
- static IGeodeSerializable^ Create(apache::geode::client::Serializable* obj)
+ static IGeodeSerializable^ Create(apache::geode::client::SerializablePtr obj)
{
return (obj != nullptr ?
gcnew CacheableStringArray(obj) : nullptr);
@@ -180,7 +183,7 @@ namespace Apache
/// Private constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline CacheableStringArray(apache::geode::client::Serializable* nativeptr)
+ inline CacheableStringArray(apache::geode::client::SerializablePtr nativeptr)
: Serializable(nativeptr) { }
};
} // namespace Client
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/CqAttributes.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CqAttributes.cpp b/src/clicache/src/CqAttributes.cpp
index 7025eb6..ef10045 100644
--- a/src/clicache/src/CqAttributes.cpp
+++ b/src/clicache/src/CqAttributes.cpp
@@ -23,7 +23,9 @@
#include "impl/ManagedCqStatusListener.hpp"
#include "ICqStatusListener.hpp"
-using namespace System;
+#include "begin_native.hpp"
+#include <geode/CqAttributes.hpp>
+#include "end_native.hpp"
namespace Apache
{
@@ -31,37 +33,42 @@ namespace Apache
{
namespace Client
{
+ using namespace System;
+
+ namespace native = apache::geode::client;
generic<class TKey, class TResult>
array<ICqListener<TKey, TResult>^>^ CqAttributes<TKey, TResult>::getCqListeners( )
{
- apache::geode::client::VectorOfCqListener vrr;
- NativePtr->getCqListeners( vrr );
- array<ICqListener<TKey, TResult>^>^ listners = gcnew array<ICqListener<TKey, TResult>^>( vrr.size( ) );
+ native::CqAttributes::listener_container_type vrr;
+ try
+ {
+ m_nativeptr->get()->getCqListeners(vrr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ auto listners = gcnew array<ICqListener<TKey, TResult>^>(vrr.size());
- for( System::Int32 index = 0; index < vrr.size( ); index++ )
+ for (System::Int32 index = 0; index < vrr.size(); index++)
{
- apache::geode::client::CqListenerPtr& nativeptr( vrr[ index ] );
- apache::geode::client::ManagedCqListenerGeneric* mg_listener =
- dynamic_cast<apache::geode::client::ManagedCqListenerGeneric*>( nativeptr.ptr( ) );
- if (mg_listener != nullptr)
+ auto nativeptr = vrr[index];
+ if (auto mg_listener = std::dynamic_pointer_cast<native::ManagedCqListenerGeneric>(nativeptr))
{
- listners[ index ] = (ICqListener<TKey, TResult>^) mg_listener->userptr( );
- }else
+ listners[index] = (ICqListener<TKey, TResult>^) mg_listener->userptr();
+ }
+ else if (auto mg_statuslistener = std::dynamic_pointer_cast<native::ManagedCqStatusListenerGeneric>(nativeptr))
+ {
+ listners[index] = (ICqStatusListener<TKey, TResult>^) mg_statuslistener->userptr();
+ }
+ else
{
- apache::geode::client::ManagedCqStatusListenerGeneric* mg_statuslistener =
- dynamic_cast<apache::geode::client::ManagedCqStatusListenerGeneric*>( nativeptr.ptr( ) );
- if (mg_statuslistener != nullptr) {
- listners[ index ] = (ICqStatusListener<TKey, TResult>^) mg_statuslistener->userptr( );
- }
- else {
- listners[ index ] = nullptr;
- }
+ listners[index] = nullptr;
}
}
return listners;
+ }
} // namespace Client
} // namespace Geode
} // namespace Apache
-
-} //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/CqAttributes.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CqAttributes.hpp b/src/clicache/src/CqAttributes.hpp
index 756bc85..cf3fb56 100644
--- a/src/clicache/src/CqAttributes.hpp
+++ b/src/clicache/src/CqAttributes.hpp
@@ -18,8 +18,11 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/CqAttributes.hpp>
-#include "impl/NativeWrapper.hpp"
+#include "end_native.hpp"
+
+#include "native_shared_ptr.hpp"
using namespace System;
@@ -30,6 +33,7 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
generic<class TKey, class TResult>
interface class ICqListener;
@@ -39,7 +43,6 @@ namespace Apache
/// </summary>
generic<class TKey, class TResult>
public ref class CqAttributes sealed
- : public Internal::SBWrap<apache::geode::client::CqAttributes>
{
public:
@@ -58,15 +61,16 @@ namespace Apache
/// <returns>
/// The managed wrapper object; null if the native pointer is null.
/// </returns>
- inline static CqAttributes<TKey, TResult>^ Create( apache::geode::client::CqAttributes* nativeptr )
+ inline static CqAttributes<TKey, TResult>^ Create( native::CqAttributesPtr nativeptr )
{
- if (nativeptr == nullptr)
- {
- return nullptr;
- }
- return gcnew CqAttributes( nativeptr );
+ return __nullptr == nativeptr ? nullptr :
+ gcnew CqAttributes( nativeptr );
}
+ std::shared_ptr<native::CqAttributes> GetNative()
+ {
+ return m_nativeptr->get_shared_ptr();
+ }
private:
@@ -74,8 +78,12 @@ namespace Apache
/// Private constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline CqAttributes( apache::geode::client::CqAttributes* nativeptr )
- : SBWrap( nativeptr ) { }
+ inline CqAttributes( native::CqAttributesPtr nativeptr )
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::CqAttributes>(nativeptr);
+ }
+
+ native_shared_ptr<native::CqAttributes>^ m_nativeptr;
};
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/CqAttributesFactory.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CqAttributesFactory.cpp b/src/clicache/src/CqAttributesFactory.cpp
index 9903d0f..d504335 100644
--- a/src/clicache/src/CqAttributesFactory.cpp
+++ b/src/clicache/src/CqAttributesFactory.cpp
@@ -15,6 +15,9 @@
* limitations under the License.
*/
+#include "begin_native.hpp"
+#include <geode/QueryService.hpp>
+#include "end_native.hpp"
//#include "geode_includes.hpp"
#include "CqAttributesFactory.hpp"
@@ -32,18 +35,18 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
generic<class TKey, class TResult>
void CqAttributesFactory<TKey, TResult>::AddCqListener(Client::ICqListener<TKey, TResult>^ cqListener )
{
- apache::geode::client::CqListenerPtr listenerptr;
+ native::CqListenerPtr listenerptr;
if ( cqListener != nullptr ) {
- ICqStatusListener<TKey, TResult>^ cqStatusListener =
- dynamic_cast<ICqStatusListener<TKey, TResult>^>(cqListener);
+ auto cqStatusListener = dynamic_cast<ICqStatusListener<TKey, TResult>^>(cqListener);
if (cqStatusListener != nullptr) {
- CqStatusListenerGeneric<TKey, TResult>^ sLstr = gcnew CqStatusListenerGeneric<TKey, TResult>();
+ auto sLstr = gcnew CqStatusListenerGeneric<TKey, TResult>();
sLstr->AddCqListener(cqListener);
- listenerptr = new apache::geode::client::ManagedCqStatusListenerGeneric(cqListener);
+ listenerptr = std::shared_ptr<native::ManagedCqStatusListenerGeneric>(new native::ManagedCqStatusListenerGeneric(cqListener));
try {
CqListenerHelper<TKey, TResult>::g_readerWriterLock->AcquireWriterLock(-1);
if ( CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->ContainsKey( cqListener) ) {
@@ -55,14 +58,13 @@ namespace Apache
} finally {
CqListenerHelper<TKey, TResult>::g_readerWriterLock->ReleaseWriterLock();
}
- ((apache::geode::client::ManagedCqStatusListenerGeneric*)listenerptr.get())->setptr(sLstr);
+ ((native::ManagedCqStatusListenerGeneric*)listenerptr.get())->setptr(sLstr);
}
else {
//TODO::split
- CqListenerGeneric<TKey, TResult>^ cqlg = gcnew CqListenerGeneric<TKey, TResult>();
+ auto cqlg = gcnew CqListenerGeneric<TKey, TResult>();
cqlg->AddCqListener(cqListener);
- //listenerptr = new apache::geode::client::ManagedCqListenerGeneric((ICqListener<Object^, Object^>^)cqListener );
- listenerptr = new apache::geode::client::ManagedCqListenerGeneric( /*clg,*/ cqListener );
+ listenerptr = std::shared_ptr<native::ManagedCqListenerGeneric>(new native::ManagedCqListenerGeneric(cqListener));
try {
CqListenerHelper<TKey, TResult>::g_readerWriterLock->AcquireWriterLock(-1);
if ( CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->ContainsKey( cqListener) ) {
@@ -74,25 +76,31 @@ namespace Apache
} finally {
CqListenerHelper<TKey, TResult>::g_readerWriterLock->ReleaseWriterLock();
}
- ((apache::geode::client::ManagedCqListenerGeneric*)listenerptr.get())->setptr(cqlg);
+ ((native::ManagedCqListenerGeneric*)listenerptr.get())->setptr(cqlg);
}
}
- NativePtr->addCqListener( listenerptr );
+ try
+ {
+ m_nativeptr->get()->addCqListener( listenerptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TResult>
void CqAttributesFactory<TKey, TResult>::InitCqListeners(array<Client::ICqListener<TKey, TResult>^>^ cqListeners)
{
- apache::geode::client::VectorOfCqListener vrr;
+ native::CqAttributes::listener_container_type vrr;
for( int i = 0; i < cqListeners->Length; i++ )
{
- ICqStatusListener<TKey, TResult>^ lister = dynamic_cast<ICqStatusListener<TKey, TResult>^>(cqListeners[i]);
+ auto lister = dynamic_cast<ICqStatusListener<TKey, TResult>^>(cqListeners[i]);
if (lister != nullptr) {
- apache::geode::client::CqStatusListenerPtr cptr(new apache::geode::client::ManagedCqStatusListenerGeneric(
- (ICqStatusListener<TKey, TResult>^)lister ));
- vrr.push_back(cptr);
- CqStatusListenerGeneric<TKey, TResult>^ cqlg = gcnew CqStatusListenerGeneric<TKey, TResult>();
+ auto cptr = std::shared_ptr<native::ManagedCqStatusListenerGeneric>(new native::ManagedCqStatusListenerGeneric(lister));
+ vrr.push_back(std::static_pointer_cast<native::CqListener>(cptr));
+ auto cqlg = gcnew CqStatusListenerGeneric<TKey, TResult>();
cqlg->AddCqListener(cqListeners[i]);
try {
CqListenerHelper<TKey, TResult>::g_readerWriterLock->AcquireWriterLock(-1);
@@ -105,12 +113,11 @@ namespace Apache
} finally {
CqListenerHelper<TKey, TResult>::g_readerWriterLock->ReleaseWriterLock();
}
- ((apache::geode::client::ManagedCqStatusListenerGeneric*)vrr[i].get())->setptr(cqlg);
+ ((native::ManagedCqStatusListenerGeneric*)vrr[i].get())->setptr(cqlg);
}
else {
- ICqListener<TKey, TResult>^ lister = cqListeners[i];
- apache::geode::client::CqListenerPtr cptr(new apache::geode::client::ManagedCqListenerGeneric(
- (ICqListener<TKey, TResult>^)lister ));
+ auto lister = cqListeners[i];
+ auto cptr = std::shared_ptr<native::ManagedCqListenerGeneric>(new native::ManagedCqListenerGeneric(lister));
vrr.push_back(cptr);
CqListenerGeneric<TKey, TResult>^ cqlg = gcnew CqListenerGeneric<TKey, TResult>();
cqlg->AddCqListener(cqListeners[i]);
@@ -125,19 +132,32 @@ namespace Apache
} finally {
CqListenerHelper<TKey, TResult>::g_readerWriterLock->ReleaseWriterLock();
}
- ((apache::geode::client::ManagedCqListenerGeneric*)vrr[i].get())->setptr(cqlg);
+ ((native::ManagedCqListenerGeneric*)vrr[i].get())->setptr(cqlg);
}
}
- NativePtr->initCqListeners( vrr );
+ try
+ {
+ m_nativeptr->get()->initCqListeners( vrr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TResult>
Client::CqAttributes<TKey, TResult>^ CqAttributesFactory<TKey, TResult>::Create( )
{
- return Client::CqAttributes<TKey, TResult>::Create(NativePtr->create().get());
+ try
+ {
+ return Client::CqAttributes<TKey, TResult>::Create(m_nativeptr->get()->create());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
} // namespace Client
} // namespace Geode
} // namespace Apache
-
-} //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/CqAttributesFactory.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CqAttributesFactory.hpp b/src/clicache/src/CqAttributesFactory.hpp
index d421caa..6fa5ab0 100644
--- a/src/clicache/src/CqAttributesFactory.hpp
+++ b/src/clicache/src/CqAttributesFactory.hpp
@@ -18,11 +18,13 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/CqAttributesFactory.hpp>
-//#include "impl/NativeWrapper.hpp"
-#include "impl/SafeConvert.hpp"
+#include "end_native.hpp"
+#include "impl/SafeConvert.hpp"
#include "CqAttributes.hpp"
+#include "native_unique_ptr.hpp"
using namespace System;
using namespace System::Collections::Generic;
@@ -33,11 +35,8 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
- /*
- generic<class TKey, class TValue>
- ref class CqAttributes;
- */
generic<class TKey, class TResult>
interface class ICqListener;
@@ -47,7 +46,6 @@ namespace Apache
/// <seealso cref="CqAttributes" />
generic<class TKey, class TResult>
public ref class CqAttributesFactory sealed
- : public Internal::UMWrap<apache::geode::client::CqAttributesFactory>
{
public:
@@ -56,12 +54,14 @@ namespace Apache
/// to create a <c>CqAttributes</c> with default settings.
/// </summary>
inline CqAttributesFactory( )
- : UMWrap( new apache::geode::client::CqAttributesFactory( ), true )
- { }
+ {
+ m_nativeptr = gcnew native_unique_ptr<native::CqAttributesFactory>(std::make_unique<native::CqAttributesFactory>());
+ }
inline CqAttributesFactory(Client::CqAttributes<TKey, TResult>^ cqAttributes )
- : UMWrap( new apache::geode::client::CqAttributesFactory(apache::geode::client::CqAttributesPtr(GetNativePtrFromSBWrapGeneric<apache::geode::client::CqAttributes>(cqAttributes ))), true )
- { }
+ {
+ m_nativeptr = gcnew native_unique_ptr<native::CqAttributesFactory>(std::make_unique<native::CqAttributesFactory>(cqAttributes->GetNative()));
+ }
// ATTRIBUTES
@@ -81,6 +81,10 @@ namespace Apache
/// Creates a <c>CqAttributes</c> with the current settings.
/// </summary>
Client::CqAttributes<TKey, TResult>^ Create( );
+
+ private:
+
+ native_unique_ptr<native::CqAttributesFactory>^ m_nativeptr;
};
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/CqAttributesMutator.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CqAttributesMutator.cpp b/src/clicache/src/CqAttributesMutator.cpp
index c6950b4..5184903 100644
--- a/src/clicache/src/CqAttributesMutator.cpp
+++ b/src/clicache/src/CqAttributesMutator.cpp
@@ -15,8 +15,12 @@
* limitations under the License.
*/
+#include <memory>
+
+#include "begin_native.hpp"
+#include <geode/QueryService.hpp>
+#include "end_native.hpp"
-//#include "geode_includes.hpp"
#include "CqAttributesMutator.hpp"
#include "impl/ManagedCqListener.hpp"
#include "impl/ManagedCqStatusListener.hpp"
@@ -30,18 +34,18 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
generic<class TKey, class TResult>
void CqAttributesMutator<TKey, TResult>::AddCqListener( Client::ICqListener<TKey, TResult>^ cqListener )
{
- apache::geode::client::CqListenerPtr listenerptr;
+ native::CqListenerPtr listenerptr;
if ( cqListener != nullptr ) {
- ICqStatusListener<TKey, TResult>^ cqStatusListener =
- dynamic_cast<ICqStatusListener<TKey, TResult>^>(cqListener);
+ auto cqStatusListener = dynamic_cast<ICqStatusListener<TKey, TResult>^>(cqListener);
if (cqStatusListener != nullptr) {
- CqStatusListenerGeneric<TKey, TResult>^ sLstr = gcnew CqStatusListenerGeneric<TKey, TResult>();
+ auto sLstr = gcnew CqStatusListenerGeneric<TKey, TResult>();
sLstr->AddCqListener(cqListener);
- listenerptr = new apache::geode::client::ManagedCqStatusListenerGeneric(cqListener);
+ listenerptr = std::shared_ptr<native::ManagedCqStatusListenerGeneric>(new native::ManagedCqStatusListenerGeneric(cqListener));
try {
CqListenerHelper<TKey, TResult>::g_readerWriterLock->AcquireWriterLock(-1);
if ( CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->ContainsKey(cqListener) ) {
@@ -54,14 +58,13 @@ namespace Apache
finally {
CqListenerHelper<TKey, TResult>::g_readerWriterLock->ReleaseWriterLock();
}
- ((apache::geode::client::ManagedCqStatusListenerGeneric*)listenerptr.get())->setptr(sLstr);
+ ((native::ManagedCqStatusListenerGeneric*)listenerptr.get())->setptr(sLstr);
}
else {
//TODO::split
- CqListenerGeneric<TKey, TResult>^ cqlg = gcnew CqListenerGeneric<TKey, TResult>();
+ auto cqlg = gcnew CqListenerGeneric<TKey, TResult>();
cqlg->AddCqListener(cqListener);
- //listenerptr = new apache::geode::client::ManagedCqListenerGeneric((ICqListener<Object^, Object^>^)cqListener );
- listenerptr = new apache::geode::client::ManagedCqListenerGeneric( /*clg,*/ cqListener );
+ listenerptr = std::shared_ptr<native::ManagedCqListenerGeneric>(new native::ManagedCqListenerGeneric(cqListener));
try {
CqListenerHelper<TKey, TResult>::g_readerWriterLock->AcquireWriterLock(-1);
if ( CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->ContainsKey(cqListener) ) {
@@ -73,45 +76,68 @@ namespace Apache
} finally {
CqListenerHelper<TKey, TResult>::g_readerWriterLock->ReleaseWriterLock();
}
- ((apache::geode::client::ManagedCqListenerGeneric*)listenerptr.get())->setptr(cqlg);
+ ((native::ManagedCqListenerGeneric*)listenerptr.get())->setptr(cqlg);
}
}
- NativePtr->addCqListener( listenerptr );
+ try
+ {
+ m_nativeptr->get()->addCqListener( listenerptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TResult>
void CqAttributesMutator<TKey, TResult>::RemoveCqListener( Client::ICqListener<TKey, TResult>^ cqListener )
{
- Client::ICqStatusListener<TKey, TResult>^ lister = dynamic_cast<Client::ICqStatusListener<TKey, TResult>^>(cqListener);
+ auto lister = dynamic_cast<Client::ICqStatusListener<TKey, TResult>^>(cqListener);
if (lister != nullptr) {
- CqStatusListenerGeneric<TKey, TResult>^ cqlg = gcnew CqStatusListenerGeneric<TKey, TResult>();
+ auto cqlg = gcnew CqStatusListenerGeneric<TKey, TResult>();
cqlg->AddCqListener(cqListener);
- apache::geode::client::CqStatusListenerPtr lptr(new apache::geode::client::ManagedCqStatusListenerGeneric(
- (Client::ICqStatusListener<TKey, TResult>^) lister ));
- ((apache::geode::client::ManagedCqStatusListenerGeneric*)lptr.get())->setptr(cqlg);
+ native::CqStatusListenerPtr lptr = std::shared_ptr<native::ManagedCqStatusListenerGeneric>(
+ new native::ManagedCqStatusListenerGeneric(lister));
+ ((native::ManagedCqStatusListenerGeneric*)lptr.get())->setptr(cqlg);
try {
IntPtr value;
CqListenerHelper<TKey, TResult>::g_readerWriterLock->AcquireWriterLock(-1);
if ( CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->TryGetValue(cqListener, value) ) {
- apache::geode::client::CqStatusListenerPtr lptr((apache::geode::client::CqStatusListener*)value.ToPointer());
- NativePtr->removeCqListener(lptr);
+ // TODO shared_ptr this will break, need to keep shared_ptr
+ native::CqStatusListenerPtr lptr((native::CqStatusListener*)value.ToPointer());
+ try
+ {
+ m_nativeptr->get()->removeCqListener(lptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
} finally {
CqListenerHelper<TKey, TResult>::g_readerWriterLock->ReleaseWriterLock();
}
}
else {
- CqListenerGeneric<TKey, TResult>^ cqlg = gcnew CqListenerGeneric<TKey, TResult>();
+ auto cqlg = gcnew CqListenerGeneric<TKey, TResult>();
cqlg->AddCqListener(cqListener);
- apache::geode::client::CqListenerPtr lptr(new apache::geode::client::ManagedCqListenerGeneric(
- (Client::ICqListener<TKey, TResult>^) cqListener ));
- ((apache::geode::client::ManagedCqListenerGeneric*)lptr.get())->setptr(cqlg);
+ native::CqListenerPtr lptr = std::shared_ptr<native::ManagedCqListenerGeneric>(
+ new native::ManagedCqListenerGeneric(cqListener));
+ ((native::ManagedCqListenerGeneric*)lptr.get())->setptr(cqlg);
try {
IntPtr value;
CqListenerHelper<TKey, TResult>::g_readerWriterLock->AcquireWriterLock(-1);
if ( CqListenerHelper<TKey, TResult>::m_ManagedVsUnManagedCqLstrDict->TryGetValue(cqListener, value) ) {
- apache::geode::client::CqListenerPtr lptr((apache::geode::client::CqListener*)value.ToPointer());
- NativePtr->removeCqListener(lptr);
+ // TODO shared_ptr this will break, need to keep shared_ptr
+ native::CqListenerPtr lptr((native::CqListener*)value.ToPointer());
+ try
+ {
+ m_nativeptr->get()->removeCqListener(lptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
} finally {
CqListenerHelper<TKey, TResult>::g_readerWriterLock->ReleaseWriterLock();
@@ -122,15 +148,14 @@ namespace Apache
generic<class TKey, class TResult>
void CqAttributesMutator<TKey, TResult>::SetCqListeners(array<Client::ICqListener<TKey, TResult>^>^ newListeners)
{
- apache::geode::client::VectorOfCqListener vrr;
+ native::CqAttributes::listener_container_type vrr;
for( int i = 0; i < newListeners->Length; i++ )
{
- Client::ICqStatusListener<TKey, TResult>^ lister = dynamic_cast<Client::ICqStatusListener<TKey, TResult>^>(newListeners[i]);
+ auto lister = dynamic_cast<Client::ICqStatusListener<TKey, TResult>^>(newListeners[i]);
if (lister != nullptr) {
- apache::geode::client::CqStatusListenerPtr cptr(new apache::geode::client::ManagedCqStatusListenerGeneric(
- (ICqStatusListener<TKey, TResult>^)lister ));
+ auto cptr = std::shared_ptr<native::ManagedCqStatusListenerGeneric>(new native::ManagedCqStatusListenerGeneric(lister));
vrr.push_back(cptr);
- CqStatusListenerGeneric<TKey, TResult>^ cqlg = gcnew CqStatusListenerGeneric<TKey, TResult>();
+ auto cqlg = gcnew CqStatusListenerGeneric<TKey, TResult>();
cqlg->AddCqListener(newListeners[i]);
try {
CqListenerHelper<TKey, TResult>::g_readerWriterLock->AcquireWriterLock(-1);
@@ -143,14 +168,13 @@ namespace Apache
} finally {
CqListenerHelper<TKey, TResult>::g_readerWriterLock->ReleaseWriterLock();
}
- ((apache::geode::client::ManagedCqStatusListenerGeneric*)vrr[i].get())->setptr(cqlg);
+ ((native::ManagedCqStatusListenerGeneric*)vrr[i].get())->setptr(cqlg);
}
else {
- Client::ICqListener<TKey, TResult>^ lister = newListeners[i];
- apache::geode::client::CqListenerPtr cptr(new apache::geode::client::ManagedCqListenerGeneric(
- (ICqListener<TKey, TResult>^)lister ));
+ auto lister = newListeners[i];
+ auto cptr = std::shared_ptr<native::ManagedCqListenerGeneric>(new native::ManagedCqListenerGeneric(lister));
vrr.push_back(cptr);
- CqListenerGeneric<TKey, TResult>^ cqlg = gcnew CqListenerGeneric<TKey, TResult>();
+ auto cqlg = gcnew CqListenerGeneric<TKey, TResult>();
cqlg->AddCqListener(newListeners[i]);
try {
CqListenerHelper<TKey, TResult>::g_readerWriterLock->AcquireWriterLock(-1);
@@ -163,13 +187,19 @@ namespace Apache
} finally {
CqListenerHelper<TKey, TResult>::g_readerWriterLock->ReleaseWriterLock();
}
- ((apache::geode::client::ManagedCqListenerGeneric*)vrr[i].get())->setptr(cqlg);
+ ((native::ManagedCqListenerGeneric*)vrr[i].get())->setptr(cqlg);
}
}
- NativePtr->setCqListeners( vrr );
+ try
+ {
+ m_nativeptr->get()->setCqListeners( vrr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
} // namespace Client
} // namespace Geode
} // namespace Apache
-
-} //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/CqAttributesMutator.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CqAttributesMutator.hpp b/src/clicache/src/CqAttributesMutator.hpp
index 2aafb5c..498de30 100644
--- a/src/clicache/src/CqAttributesMutator.hpp
+++ b/src/clicache/src/CqAttributesMutator.hpp
@@ -18,8 +18,12 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/CqAttributesMutator.hpp>
-#include "impl/NativeWrapper.hpp"
+#include "end_native.hpp"
+
+
+#include "native_shared_ptr.hpp"
using namespace System;
@@ -32,6 +36,7 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
generic<class TKey, class TResult>
interface class ICqListener;
@@ -52,7 +57,6 @@ namespace Apache
/// </summary>
generic<class TKey, class TResult>
public ref class CqAttributesMutator sealed
- : public Internal::SBWrap<apache::geode::client::CqAttributesMutator>
{
public:
@@ -87,13 +91,10 @@ namespace Apache
/// <returns>
/// The managed wrapper object; null if the native pointer is null.
/// </returns>
- inline static Client::CqAttributesMutator<TKey, TResult>^ Create( apache::geode::client::CqAttributesMutator* nativeptr )
+ inline static Client::CqAttributesMutator<TKey, TResult>^ Create( native::CqAttributesMutatorPtr nativeptr )
{
- if (nativeptr == nullptr)
- {
- return nullptr;
- }
- return gcnew Client::CqAttributesMutator<TKey, TResult>( nativeptr );
+ return __nullptr == nativeptr ? nullptr :
+ gcnew Client::CqAttributesMutator<TKey, TResult>( nativeptr );
}
@@ -103,8 +104,12 @@ namespace Apache
/// Private constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline CqAttributesMutator<TKey, TResult>( apache::geode::client::CqAttributesMutator* nativeptr )
- : SBWrap( nativeptr ) { }
+ inline CqAttributesMutator<TKey, TResult>( native::CqAttributesMutatorPtr nativeptr )
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::CqAttributesMutator>(nativeptr);
+ }
+
+ native_shared_ptr<native::CqAttributesMutator>^ m_nativeptr;
};
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/CqEvent.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CqEvent.cpp b/src/clicache/src/CqEvent.cpp
index a8d4109..ae1c668 100644
--- a/src/clicache/src/CqEvent.cpp
+++ b/src/clicache/src/CqEvent.cpp
@@ -28,45 +28,46 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
generic<class TKey, class TResult>
CqQuery<TKey, TResult>^ CqEvent<TKey, TResult>::getCq( )
{
- apache::geode::client::CqQueryPtr& cQueryptr( NativePtr->getCq( ) );
- return CqQuery<TKey, TResult>::Create( cQueryptr.ptr( ) );
+ native::CqQueryPtr& cQueryptr( m_nativeptr->getCq( ) );
+ return CqQuery<TKey, TResult>::Create( cQueryptr);
}
generic<class TKey, class TResult>
CqOperationType CqEvent<TKey, TResult>::getBaseOperation( )
{
- return CqOperation::ConvertFromNative(NativePtr->getBaseOperation());
+ return CqOperation::ConvertFromNative(m_nativeptr->getBaseOperation());
}
generic<class TKey, class TResult>
CqOperationType CqEvent<TKey, TResult>::getQueryOperation( )
{
- return CqOperation::ConvertFromNative(NativePtr->getQueryOperation());
+ return CqOperation::ConvertFromNative(m_nativeptr->getQueryOperation());
}
generic<class TKey, class TResult>
TKey CqEvent<TKey, TResult>::getKey( )
{
- apache::geode::client::CacheableKeyPtr& keyptr( NativePtr->getKey( ) );
+ native::CacheableKeyPtr& keyptr( m_nativeptr->getKey( ) );
return Serializable::GetManagedValueGeneric<TKey>(keyptr);
}
generic<class TKey, class TResult>
TResult CqEvent<TKey, TResult>::getNewValue( )
{
- apache::geode::client::CacheablePtr& valptr( NativePtr->getNewValue( ) );
+ native::CacheablePtr& valptr( m_nativeptr->getNewValue( ) );
return Serializable::GetManagedValueGeneric<TResult>(valptr);
}
generic<class TKey, class TResult>
array< Byte >^ CqEvent<TKey, TResult>::getDeltaValue( )
{
- apache::geode::client::CacheableBytesPtr deltaBytes = NativePtr->getDeltaValue( );
- CacheableBytes^ managedDeltaBytes = ( CacheableBytes^ ) CacheableBytes::Create( deltaBytes.ptr( ) );
+ auto deltaBytes = m_nativeptr->getDeltaValue( );
+ auto managedDeltaBytes = ( CacheableBytes^ ) CacheableBytes::Create( deltaBytes );
return ( array< Byte >^ ) managedDeltaBytes;
}
} // namespace Client
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/CqEvent.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CqEvent.hpp b/src/clicache/src/CqEvent.hpp
index 5e12595..d0ddcc1 100644
--- a/src/clicache/src/CqEvent.hpp
+++ b/src/clicache/src/CqEvent.hpp
@@ -17,11 +17,14 @@
#pragma once
+#include "native_shared_ptr.hpp"
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/CqEvent.hpp>
+#include "end_native.hpp"
+
#include "CqQuery.hpp"
#include "CqOperation.hpp"
-//#include "impl/NativeWrapper.hpp"
#include "ICqEvent.hpp"
#include "ICacheableKey.hpp"
@@ -34,17 +37,15 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
interface class IGeodeSerializable;
- //interface class ICqEvent;
- //interface class ICacheableKey;
-
+
/// <summary>
/// This class encapsulates events that occur for cq.
/// </summary>
generic<class TKey, class TResult>
public ref class CqEvent sealed
- : public Internal::UMWrap<apache::geode::client::CqEvent>
{
public:
@@ -85,8 +86,18 @@ namespace Apache
/// Private constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline CqEvent( const apache::geode::client::CqEvent* nativeptr )
- : UMWrap( const_cast<apache::geode::client::CqEvent*>( nativeptr ), false ) { }
+ inline CqEvent( const native::CqEvent* nativeptr )
+ : m_nativeptr(nativeptr)
+ {
+ }
+
+ const native::CqEvent* GetNative()
+ {
+ return m_nativeptr;
+ }
+
+ private:
+ const native::CqEvent* m_nativeptr;
};
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/CqListener.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CqListener.hpp b/src/clicache/src/CqListener.hpp
deleted file mode 100644
index 977447f..0000000
--- a/src/clicache/src/CqListener.hpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include "geode_defs.hpp"
-#include "ICqListener.hpp"
-//#include "impl/NativeWrapper.hpp"
-
-
-using namespace System;
-using namespace System::Collections::Generic;
-
-namespace Apache
-{
- namespace Geode
- {
- namespace Client
- {
-
- generic<class TKey, class TResult>
- ref class CqEvent;
- //interface class ICqListener;
-
- /// <summary>
- /// This class wraps the native C++ <c>apache::geode::client::Serializable</c> objects
- /// as managed <see cref="../../IGeodeSerializable" /> objects.
- /// </summary>
- generic<class TKey, class TResult>
- public ref class CqListener
- : public Internal::SBWrap<apache::geode::client::CqListener>, public ICqListener<TKey, TResult>
- {
- public:
-
- /// <summary>
- /// Invoke on an event
- /// </summary>
- virtual void OnEvent( CqEvent<TKey, TResult>^ ev)
- {
- }
-
- /// <summary>
- /// Invoke on an error
- /// </summary>
- virtual void OnError( CqEvent<TKey, TResult>^ ev)
- {
- }
-
- /// <summary>
- /// Invoke on close
- /// </summary>
- virtual void Close()
- {
- }
-
- internal:
-
- /// <summary>
- /// Default constructor.
- /// </summary>
- inline CqListener<TKey, TResult>( )
- : SBWrap( ) { }
-
- /// <summary>
- /// Internal constructor to wrap a native object pointer
- /// </summary>
- /// <param name="nativeptr">The native object pointer</param>
- inline CqListener<TKey, TResult>( apache::geode::client::CqListener* nativeptr )
- : SBWrap( nativeptr ) { }
-
- /// <summary>
- /// Used to assign the native Serializable pointer to a new object.
- /// </summary>
- /// <remarks>
- /// Note the order of preserveSB() and releaseSB(). This handles the
- /// corner case when <c>m_nativeptr</c> is same as <c>nativeptr</c>.
- /// </remarks>
- inline void AssignSP( apache::geode::client::CqListener* nativeptr )
- {
- AssignPtr( nativeptr );
- }
-
- /// <summary>
- /// Used to assign the native CqListener pointer to a new object.
- /// </summary>
- inline void SetSP( apache::geode::client::CqListener* nativeptr )
- {
- if ( nativeptr != nullptr ) {
- nativeptr->preserveSB( );
- }
- _SetNativePtr( nativeptr );
- }
-
- };
- } // namespace Client
- } // namespace Geode
-} // namespace Apache
-
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/CqOperation.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CqOperation.hpp b/src/clicache/src/CqOperation.hpp
index c092008..e6292c9 100644
--- a/src/clicache/src/CqOperation.hpp
+++ b/src/clicache/src/CqOperation.hpp
@@ -20,7 +20,10 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/CqOperation.hpp>
+#include "end_native.hpp"
+
using namespace System;
@@ -31,6 +34,7 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
/// <summary>
/// Enumerated type for CqOperationType
@@ -45,29 +49,29 @@ namespace Apache
OP_TYPE_DESTROY = 16,
OP_TYPE_MARKER = 32
};
+
public ref class CqOperation sealed
- : public Internal::UMWrap<apache::geode::client::CqOperation>
{
public:
/// <summary>
/// conenience function for convertin from c++
- /// apache::geode::client::CqOperation::CqOperationType to
+ /// native::CqOperation::CqOperationType to
/// CqOperationType here.
/// </summary>
- inline static CqOperationType ConvertFromNative(apache::geode::client::CqOperation::CqOperationType tp)
+ inline static CqOperationType ConvertFromNative(native::CqOperation::CqOperationType tp)
{
- if(tp==apache::geode::client::CqOperation::OP_TYPE_CREATE)
+ if(tp==native::CqOperation::OP_TYPE_CREATE)
return CqOperationType::OP_TYPE_CREATE;
- if(tp==apache::geode::client::CqOperation::OP_TYPE_UPDATE)
+ if(tp==native::CqOperation::OP_TYPE_UPDATE)
return CqOperationType::OP_TYPE_UPDATE;
- if(tp==apache::geode::client::CqOperation::OP_TYPE_INVALIDATE)
+ if(tp==native::CqOperation::OP_TYPE_INVALIDATE)
return CqOperationType::OP_TYPE_INVALIDATE;
- if(tp==apache::geode::client::CqOperation::OP_TYPE_REGION_CLEAR)
+ if(tp==native::CqOperation::OP_TYPE_REGION_CLEAR)
return CqOperationType::OP_TYPE_REGION_CLEAR;
- if(tp==apache::geode::client::CqOperation::OP_TYPE_DESTROY)
+ if(tp==native::CqOperation::OP_TYPE_DESTROY)
return CqOperationType::OP_TYPE_DESTROY;
- if(tp==apache::geode::client::CqOperation::OP_TYPE_MARKER)
+ if(tp==native::CqOperation::OP_TYPE_MARKER)
return CqOperationType::OP_TYPE_MARKER;
return CqOperationType::OP_TYPE_INVALID;
}
@@ -77,8 +81,13 @@ namespace Apache
/// Internal constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline CqOperation( apache::geode::client::CqOperation* nativeptr )
- : UMWrap( nativeptr, false ) { }
+ inline CqOperation( native::CqOperation* nativeptr )
+ : m_nativeptr(nativeptr)
+ {
+ }
+
+ private:
+ const native::CqOperation* m_nativeptr;
};
} // namespace Client
} // namespace Geode
[36/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from clicache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/Properties.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/Properties.cpp b/src/clicache/src/Properties.cpp
index e7b43c6..53a86ee 100644
--- a/src/clicache/src/Properties.cpp
+++ b/src/clicache/src/Properties.cpp
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-//#include "geode_includes.hpp"
#include "Properties.hpp"
#include "impl/ManagedVisitor.hpp"
#include "impl/ManagedString.hpp"
@@ -33,6 +32,8 @@ namespace Apache
namespace Client
{
+ namespace native = apache::geode::client;
+
// Visitor class to get string representations of a property object
ref class PropertyToString
{
@@ -62,351 +63,80 @@ namespace Apache
generic<class TPropKey, class TPropValue>
TPropValue Properties<TPropKey, TPropValue>::Find( TPropKey key)
{
- //ManagedString mg_key( key );
- apache::geode::client::CacheableKeyPtr keyptr( Serializable::GetUnmanagedValueGeneric<TPropKey>( key ) );
-
- //_GF_MG_EXCEPTION_TRY2
-
- apache::geode::client::CacheablePtr nativeptr(NativePtr->find( keyptr ));
- TPropValue returnVal = Serializable::GetManagedValueGeneric<TPropValue>( nativeptr );
- return returnVal;
-
- //apache::geode::client::CacheablePtr& value = NativePtr->find( keyptr );
- //return SafeUMSerializableConvert( value.ptr( ) );
-
- //apache::geode::client::CacheableStringPtr value = NativePtr->find( mg_key.CharPtr );
- //return CacheableString::GetString( value.ptr( ) );
-
- // _GF_MG_EXCEPTION_CATCH_ALL2
- }
-
- /*IGeodeSerializable^ Properties::Find( Apache::Geode::Client::ICacheableKey^ key)
- {
- CacheableString^ cStr = dynamic_cast<CacheableString ^>(key);
-
- if ( key != nullptr) {
- _GF_MG_EXCEPTION_TRY2
-
- apache::geode::client::CacheableStringPtr csPtr;
-
- CacheableString::GetCacheableString(cStr->Value, csPtr);
-
- apache::geode::client::CacheablePtr& value = NativePtr->find( csPtr );
-
- return ConvertCacheableString(value);
-
- _GF_MG_EXCEPTION_CATCH_ALL2
- }
- else {
- apache::geode::client::CacheableKeyPtr keyptr( SafeMKeyConvert( key ) );
-
- _GF_MG_EXCEPTION_TRY2
-
- apache::geode::client::CacheablePtr& value = NativePtr->find( keyptr );
- return SafeUMSerializableConvert( value.ptr( ) );
-
- _GF_MG_EXCEPTION_CATCH_ALL2
- }
- return nullptr;
- }*/
-
- /*
- generic<class TPropKey, class TPropValue>
- IGeodeSerializable^ Properties<TPropKey, TPropValue>::ConvertCacheableString(apache::geode::client::CacheablePtr& value)
- {
- apache::geode::client::CacheableString * cs = dynamic_cast<apache::geode::client::CacheableString *>( value.get() );
- if ( cs == NULL) {
- return SafeUMSerializableConvert( value.ptr( ) );
- }
- else {
- if(cs->typeId() == (int8_t)apache::geode::client::GeodeTypeIds::CacheableASCIIString
- || cs->typeId() == (int8_t)apache::geode::client::GeodeTypeIds::CacheableASCIIStringHuge) {
- String^ str = gcnew String(cs->asChar());
- return CacheableString::Create(str);
- }
- else {
- String^ str = gcnew String(cs->asWChar());
- return CacheableString::Create(str);
- }
- }
- return nullptr;
- }
- */
-
- /*IGeodeSerializable^ Properties::Find( CacheableKey^ key)
- {
- CacheableString^ cStr = dynamic_cast<CacheableString ^>(key);
-
- if ( key != nullptr) {
- _GF_MG_EXCEPTION_TRY2
-
- apache::geode::client::CacheableStringPtr csPtr;
-
- CacheableString::GetCacheableString(cStr->Value, csPtr);
-
- apache::geode::client::CacheablePtr& value = NativePtr->find( csPtr );
-
- return ConvertCacheableString(value);
-
- _GF_MG_EXCEPTION_CATCH_ALL2
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TPropKey>(key);
+ auto nativeptr = m_nativeptr->get()->find(keyptr);
+ return Serializable::GetManagedValueGeneric<TPropValue>(nativeptr);
}
- else {
- apache::geode::client::CacheableKeyPtr keyptr(
- (apache::geode::client::CacheableKey*)GetNativePtr<apache::geode::client::Cacheable>( key ) );
-
- _GF_MG_EXCEPTION_TRY2
-
- apache::geode::client::CacheablePtr& value = NativePtr->find( keyptr );
- return SafeUMSerializableConvert( value.ptr( ) );
-
- _GF_MG_EXCEPTION_CATCH_ALL2
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
}
- return nullptr;
- }*/
+ }
generic<class TPropKey, class TPropValue>
void Properties<TPropKey, TPropValue>::Insert( TPropKey key, TPropValue value )
{
- apache::geode::client::CacheableKeyPtr keyptr( Serializable::GetUnmanagedValueGeneric<TPropKey>( key, true ) );
- apache::geode::client::CacheablePtr valueptr( Serializable::GetUnmanagedValueGeneric<TPropValue>( value, true ) );
-
- //ManagedString mg_key( key );
- //ManagedString mg_value( value );
-
- _GF_MG_EXCEPTION_TRY2
-
- //NativePtr->insert( mg_key.CharPtr, mg_value.CharPtr );
- NativePtr->insert( keyptr, valueptr );
-
- _GF_MG_EXCEPTION_CATCH_ALL2
- }
-
- /*void Properties::Insert( String^ key, const System::Int32 value)
- {
- //TODO::
- ManagedString mg_key( key );
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TPropKey>(key, true);
+ auto valueptr = Serializable::GetUnmanagedValueGeneric<TPropValue>(value, true);
_GF_MG_EXCEPTION_TRY2
- NativePtr->insert( mg_key.CharPtr, value );
-
- _GF_MG_EXCEPTION_CATCH_ALL2
- }*/
-
- /*void Properties::Insert( Apache::Geode::Client::ICacheableKey^ key, IGeodeSerializable^ value)
- {
- CacheableString^ cStr = dynamic_cast<CacheableString ^>(key);
- if (cStr != nullptr) {
- _GF_MG_EXCEPTION_TRY2
- apache::geode::client::CacheableKeyPtr keyptr(ConvertCacheableStringKey(cStr));
- CacheableString^ cValueStr = dynamic_cast<CacheableString ^>(value);
-
- if (cValueStr != nullptr) {
- apache::geode::client::CacheablePtr valueptr(ConvertCacheableStringKey(cValueStr));
- NativePtr->insert( keyptr, valueptr );
- }
- else {
- apache::geode::client::CacheablePtr valueptr( SafeMSerializableConvert( value ) );
- NativePtr->insert( keyptr, valueptr );
- }
- _GF_MG_EXCEPTION_CATCH_ALL2
- }
- else {
- apache::geode::client::CacheableKeyPtr keyptr( SafeMKeyConvert( key ) );
- apache::geode::client::CacheablePtr valueptr( SafeMSerializableConvert( value ) );
-
- _GF_MG_EXCEPTION_TRY2
-
- NativePtr->insert( keyptr, valueptr );
-
- _GF_MG_EXCEPTION_CATCH_ALL2
- }
- }*/
-
- /*void Properties::Insert( CacheableKey^ key, IGeodeSerializable^ value)
- {
- CacheableString^ cStr = dynamic_cast<CacheableString ^>(key);
- if (cStr != nullptr) {
- _GF_MG_EXCEPTION_TRY2
- apache::geode::client::CacheableKeyPtr keyptr(ConvertCacheableStringKey(cStr));
- CacheableString^ cValueStr = dynamic_cast<CacheableString ^>(value);
-
- if (cValueStr != nullptr) {
- apache::geode::client::CacheablePtr valueptr(ConvertCacheableStringKey(cValueStr));
- NativePtr->insert( keyptr, valueptr );
+ try
+ {
+ m_nativeptr->get()->insert(keyptr, valueptr);
}
- else {
- apache::geode::client::CacheablePtr valueptr( SafeMSerializableConvert( value ) );
- NativePtr->insert( keyptr, valueptr );
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
}
- _GF_MG_EXCEPTION_CATCH_ALL2
- }
- else {
- apache::geode::client::CacheableKeyPtr keyptr(
- (apache::geode::client::CacheableKey*)GetNativePtr<apache::geode::client::Cacheable>( key ) );
- apache::geode::client::CacheablePtr valueptr( SafeMSerializableConvert( value ) );
-
- _GF_MG_EXCEPTION_TRY2
-
- NativePtr->insert( keyptr, valueptr );
-
- _GF_MG_EXCEPTION_CATCH_ALL2
- }
- }*/
-
- /*
- generic<class TPropKey, class TPropValue>
- apache::geode::client::CacheableKey * Properties<TPropKey, TPropValue>::ConvertCacheableStringKey(CacheableString^ cStr)
- {
- apache::geode::client::CacheableStringPtr csPtr;
- CacheableString::GetCacheableString(cStr->Value, csPtr);
- return csPtr.get();
+ _GF_MG_EXCEPTION_CATCH_ALL2
}
- */
-
- /*void Properties::Insert( Apache::Geode::Client::ICacheableKey^ key, Serializable^ value)
- {
- CacheableString^ cStr = dynamic_cast<CacheableString ^>(key);
- if (cStr != nullptr) {
- _GF_MG_EXCEPTION_TRY2
- apache::geode::client::CacheableKeyPtr keyptr(ConvertCacheableStringKey(cStr));
- CacheableString^ cValueStr = dynamic_cast<CacheableString ^>(value);
-
- if (cValueStr != nullptr) {
- apache::geode::client::CacheablePtr valueptr(ConvertCacheableStringKey(cValueStr));
- NativePtr->insert( keyptr, valueptr );
- }
- else {
- apache::geode::client::CacheablePtr valueptr(
- GetNativePtr<apache::geode::client::Cacheable>( value ) );
- NativePtr->insert( keyptr, valueptr );
- }
- _GF_MG_EXCEPTION_CATCH_ALL2
- }
- else {
- apache::geode::client::CacheableKeyPtr keyptr( SafeMKeyConvert( key ) );
- apache::geode::client::CacheablePtr valueptr(
- GetNativePtr<apache::geode::client::Cacheable>( value ) );
-
- _GF_MG_EXCEPTION_TRY2
-
- NativePtr->insert( keyptr, valueptr );
-
- _GF_MG_EXCEPTION_CATCH_ALL2
- }
- }*/
-
- /*void Properties::Insert( CacheableKey^ key, Serializable^ value)
- {
- CacheableString^ cStr = dynamic_cast<CacheableString ^>(key);
- if (cStr != nullptr) {
- _GF_MG_EXCEPTION_TRY2
- apache::geode::client::CacheableKeyPtr keyptr(ConvertCacheableStringKey(cStr));
- CacheableString^ cValueStr = dynamic_cast<CacheableString ^>(value);
-
- if (cValueStr != nullptr) {
- apache::geode::client::CacheablePtr valueptr(ConvertCacheableStringKey(cValueStr));
- NativePtr->insert( keyptr, valueptr );
- }
- else {
- apache::geode::client::CacheablePtr valueptr(
- GetNativePtr<apache::geode::client::Cacheable>( value ) );
- NativePtr->insert( keyptr, valueptr );
- }
- _GF_MG_EXCEPTION_CATCH_ALL2
- }
- else {
- apache::geode::client::CacheableKeyPtr keyptr(
- (apache::geode::client::CacheableKey*)GetNativePtr<apache::geode::client::Cacheable>( key ) );
- apache::geode::client::CacheablePtr valueptr(
- GetNativePtr<apache::geode::client::Cacheable>( value ) );
-
- _GF_MG_EXCEPTION_TRY2
-
- NativePtr->insert( keyptr, valueptr );
-
- _GF_MG_EXCEPTION_CATCH_ALL2
- }
- }*/
generic<class TPropKey, class TPropValue>
void Properties<TPropKey, TPropValue>::Remove( TPropKey key)
{
- //ManagedString mg_key( key );
- apache::geode::client::CacheableKeyPtr keyptr( Serializable::GetUnmanagedValueGeneric<TPropKey>( key ) );
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TPropKey>(key);
_GF_MG_EXCEPTION_TRY2
- //NativePtr->remove( mg_key.CharPtr );
- NativePtr->remove( keyptr );
+ try
+ {
+ m_nativeptr->get()->remove( keyptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2
}
- /*void Properties::Remove( Apache::Geode::Client::ICacheableKey^ key)
- {
- CacheableString^ cStr = dynamic_cast<CacheableString ^>(key);
- if (cStr != nullptr) {
- _GF_MG_EXCEPTION_TRY2
-
- apache::geode::client::CacheableKeyPtr keyptr(ConvertCacheableStringKey(cStr));
-
- NativePtr->remove( keyptr );
-
- _GF_MG_EXCEPTION_CATCH_ALL2
- }
- else {
- apache::geode::client::CacheableKeyPtr keyptr( SafeMKeyConvert( key ) );
-
- _GF_MG_EXCEPTION_TRY2
-
- NativePtr->remove( keyptr );
-
- _GF_MG_EXCEPTION_CATCH_ALL2
- }
- }*/
-
- /*void Properties::Remove( CacheableKey^ key)
- {
- CacheableString^ cStr = dynamic_cast<CacheableString ^>(key);
- if (cStr != nullptr) {
- _GF_MG_EXCEPTION_TRY2
-
- apache::geode::client::CacheableKeyPtr keyptr(ConvertCacheableStringKey(cStr));
-
- NativePtr->remove( keyptr );
-
- _GF_MG_EXCEPTION_CATCH_ALL2
- }
- else {
- apache::geode::client::CacheableKeyPtr keyptr(
- (apache::geode::client::CacheableKey*)GetNativePtr<apache::geode::client::Cacheable>( key ) );
-
- _GF_MG_EXCEPTION_TRY2
-
- NativePtr->remove( keyptr );
-
- _GF_MG_EXCEPTION_CATCH_ALL2
- }
- }*/
-
generic<class TPropKey, class TPropValue>
void Properties<TPropKey, TPropValue>::ForEach( PropertyVisitorGeneric<TPropKey, TPropValue>^ visitor )
{
if (visitor != nullptr)
{
- apache::geode::client::ManagedVisitorGeneric mg_visitor( visitor );
+ native::ManagedVisitorGeneric mg_visitor( visitor );
- PropertyVisitorProxy<TPropKey, TPropValue>^ proxy = gcnew PropertyVisitorProxy<TPropKey, TPropValue>();
+ auto proxy = gcnew PropertyVisitorProxy<TPropKey, TPropValue>();
proxy->SetPropertyVisitorGeneric(visitor);
- PropertyVisitor^ otherVisitor = gcnew PropertyVisitor(proxy, &PropertyVisitorProxy<TPropKey, TPropValue>::Visit);
+ auto otherVisitor = gcnew PropertyVisitor(proxy, &PropertyVisitorProxy<TPropKey, TPropValue>::Visit);
mg_visitor.setptr(otherVisitor);
_GF_MG_EXCEPTION_TRY2
- NativePtr->foreach( mg_visitor );
+ try
+ {
+ m_nativeptr->get()->foreach( mg_visitor );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -417,7 +147,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- return NativePtr->getSize( );
+ try
+ {
+ return m_nativeptr->get()->getSize( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -425,15 +162,16 @@ namespace Apache
generic<class TPropKey, class TPropValue>
void Properties<TPropKey, TPropValue>::AddAll( Properties<TPropKey, TPropValue>^ other )
{
- /*apache::geode::client::PropertiesPtr p_other(
- GetNativePtr<apache::geode::client::Properties>( other ) );*/
-
- apache::geode::client::PropertiesPtr p_other(
- GetNativePtrFromSBWrapGeneric<apache::geode::client::Properties>( other ) );
-
_GF_MG_EXCEPTION_TRY2
- NativePtr->addAll( p_other );
+ try
+ {
+ m_nativeptr->get()->addAll( other->GetNative() );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -445,7 +183,14 @@ namespace Apache
_GF_MG_EXCEPTION_TRY2
- NativePtr->load( mg_fname.CharPtr );
+ try
+ {
+ m_nativeptr->get()->load( mg_fname.CharPtr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -453,11 +198,6 @@ namespace Apache
generic<class TPropKey, class TPropValue>
String^ Properties<TPropKey, TPropValue>::ToString( )
{
- /* PropertyToString^ propStr = gcnew PropertyToString( );
- this->ForEach( gcnew PropertyVisitorGeneric( propStr,
- &PropertyToString::Visit ) );
- String^ str = propStr->ToString( );
- return ( str + "}" );*/
return "";
}
@@ -471,20 +211,26 @@ namespace Apache
output->WriteBytesToUMDataOutput();
}
- apache::geode::client::DataOutput* nativeOutput =
- GetNativePtr<apache::geode::client::DataOutput>(output);
-
- if (nativeOutput != nullptr)
+ try
{
- _GF_MG_EXCEPTION_TRY2
+ auto nativeOutput = output->GetNative();
+ if (nativeOutput != nullptr)
+ {
+ _GF_MG_EXCEPTION_TRY2
- NativePtr->toData( *nativeOutput );
+ m_nativeptr->get()->toData(*nativeOutput);
- _GF_MG_EXCEPTION_CATCH_ALL2
- }
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
- if (output->IsManagedObject()) {
- output->SetBuffer();
+ if (output->IsManagedObject()) {
+ output->SetBuffer();
+ }
+ }
+ finally
+ {
+ GC::KeepAlive(output);
+ GC::KeepAlive(m_nativeptr);
}
}
@@ -494,17 +240,11 @@ namespace Apache
if(input->IsManagedObject()) {
input->AdvanceUMCursor();
}
- //TODO::??
- apache::geode::client::DataInput* nativeInput =
- GetNativePtr<apache::geode::client::DataInput>( input );
+
+ auto nativeInput = input->GetNative();
if (nativeInput != nullptr)
{
- _GF_MG_EXCEPTION_TRY2
-
- AssignPtr( static_cast<apache::geode::client::Properties*>(
- NativePtr->fromData( *nativeInput ) ) );
-
- _GF_MG_EXCEPTION_CATCH_ALL2
+ FromData(*nativeInput);
}
if(input->IsManagedObject()) {
@@ -515,12 +255,39 @@ namespace Apache
}
generic<class TPropKey, class TPropValue>
+ void Properties<TPropKey, TPropValue>::FromData( native::DataInput& input )
+ {
+ _GF_MG_EXCEPTION_TRY2
+
+ try
+ {
+ auto p = static_cast<native::Properties*>(m_nativeptr->get()->fromData(input));
+ if (m_nativeptr->get() != p) {
+ m_nativeptr->get_shared_ptr().reset(p);
+ }
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
+
+ generic<class TPropKey, class TPropValue>
System::UInt32 Properties<TPropKey, TPropValue>::ObjectSize::get( )
{
//TODO::
_GF_MG_EXCEPTION_TRY2
- return NativePtr->objectSize( );
+ try
+ {
+ return m_nativeptr->get()->objectSize( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -531,29 +298,34 @@ namespace Apache
void Properties<TPropKey, TPropValue>::GetObjectData( SerializationInfo^ info,
StreamingContext context )
{
- if (_NativePtr != NULL) {
- apache::geode::client::DataOutput output;
-
- _GF_MG_EXCEPTION_TRY2
-
- NativePtr->toData( output );
+ native::DataOutput output;
- _GF_MG_EXCEPTION_CATCH_ALL2
+ _GF_MG_EXCEPTION_TRY2
- array<Byte>^ bytes = gcnew array<Byte>( output.getBufferLength( ) );
+ try
+ {
+ m_nativeptr->get()->toData( output );
+ }
+ finally
{
- pin_ptr<const Byte> pin_bytes = &bytes[0];
- memcpy( (System::Byte*)pin_bytes, output.getBuffer( ),
- output.getBufferLength( ) );
+ GC::KeepAlive(m_nativeptr);
}
- info->AddValue( "bytes", bytes, array<Byte>::typeid );
+
+ _GF_MG_EXCEPTION_CATCH_ALL2
+
+ auto bytes = gcnew array<Byte>( output.getBufferLength( ) );
+ {
+ pin_ptr<const Byte> pin_bytes = &bytes[0];
+ memcpy( (System::Byte*)pin_bytes, output.getBuffer( ),
+ output.getBufferLength( ) );
}
+ info->AddValue( "bytes", bytes, array<Byte>::typeid );
}
generic<class TPropKey, class TPropValue>
Properties<TPropKey, TPropValue>::Properties( SerializationInfo^ info,
StreamingContext context )
- : SBWrap( apache::geode::client::Properties::create( ).ptr( ) )
+ : Properties()
{
array<Byte>^ bytes = nullptr;
try {
@@ -568,14 +340,11 @@ namespace Apache
_GF_MG_EXCEPTION_TRY2
- apache::geode::client::DataInput input( (System::Byte*)pin_bytes, bytes->Length );
- AssignPtr( static_cast<apache::geode::client::Properties*>(
- NativePtr->fromData( input ) ) );
-
+ native::DataInput input( (System::Byte*)pin_bytes, bytes->Length );
+ FromData(input);
_GF_MG_EXCEPTION_CATCH_ALL2
+ }
+ }
} // namespace Client
} // namespace Geode
} // namespace Apache
-
- }
-}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/Properties.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/Properties.hpp b/src/clicache/src/Properties.hpp
index 4d32558..cf798b6 100644
--- a/src/clicache/src/Properties.hpp
+++ b/src/clicache/src/Properties.hpp
@@ -19,16 +19,19 @@
#include "geode_defs.hpp"
-//#include "impl/NativeWrapper.hpp"
+#include "begin_native.hpp"
+#include <geode/Properties.hpp>
+#include "end_native.hpp"
+
#include "IGeodeSerializable.hpp"
#include "ICacheableKey.hpp"
#include "DataInput.hpp"
#include "DataOutput.hpp"
#include "CacheableString.hpp"
-
-#include "geode/Properties.hpp"
+#include "native_shared_ptr.hpp"
#include "impl/SafeConvert.hpp"
#include "Serializable.hpp"
+#include "native_shared_ptr.hpp"
using namespace System;
using namespace System::Runtime::Serialization;
@@ -40,6 +43,7 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
delegate void PropertyVisitor(Apache::Geode::Client::ICacheableKey^ key, Apache::Geode::Client::IGeodeSerializable^ value);
@@ -67,7 +71,7 @@ namespace Apache
/// or an integer.
/// </summary>
public ref class Properties sealed
- : public Internal::SBWrap<apache::geode::client::Properties>, public IGeodeSerializable,
+ : public IGeodeSerializable,
public ISerializable
{
public:
@@ -76,7 +80,8 @@ namespace Apache
/// Default constructor: returns an empty collection.
/// </summary>
inline Properties( )
- : SBWrap( apache::geode::client::Properties::create( ).ptr( ) ) { }
+ : Properties(native::Properties::create())
+ {}
/// <summary>
/// Factory method to create an empty collection of properties.
@@ -204,40 +209,6 @@ namespace Apache
// End: ISerializable members
- /// <summary>
- /// Get the underlying native unmanaged pointer.
- /// </summary>
- property void* NativeIntPtr
- {
- inline void* get()
- {
- return _NativePtr;
- }
- }
-
- /*
- inline static IGeodeSerializable^ ConvertCacheableString(apache::geode::client::CacheablePtr& value);
- inline static apache::geode::client::CacheableKey * ConvertCacheableStringKey(CacheableString^ cStr);
- */
-
-
- /// <summary>
- /// Internal factory function to wrap a native object pointer inside
- /// this managed class with null pointer check.
- /// </summary>
- /// <param name="ptr">The native IntPtr pointer</param>
- /// <returns>
- /// The managed wrapper object; null if the native pointer is null.
- /// </returns>
- generic<class TPropKey, class TPropValue>
- static Properties<TPropKey, TPropValue>^ CreateFromVoidPtr(void* ptr)
- {
- apache::geode::client::Properties* nativeptr = (apache::geode::client::Properties*)ptr;
- return ( nativeptr != nullptr ?
- gcnew Properties<TPropKey, TPropValue>( nativeptr ) : nullptr );
- }
-
-
protected:
// For deserialization using the .NET serialization (ISerializable)
@@ -254,35 +225,37 @@ namespace Apache
/// <returns>
/// The managed wrapper object; null if the native pointer is null.
/// </returns>
- generic<class TPropKey, class TPropValue>
- static Properties<TPropKey, TPropValue>^ Create( apache::geode::client::Serializable* nativeptr )
+ //generic<class TPropKey, class TPropValue>
+ static Properties<TPropKey, TPropValue>^ Create( native::PropertiesPtr nativeptr )
{
- return ( nativeptr != nullptr ?
- gcnew Properties<TPropKey, TPropValue>( nativeptr ) : nullptr );
+ return __nullptr == nativeptr ? nullptr :
+ gcnew Properties<TPropKey, TPropValue>( nativeptr );
}
- inline static IGeodeSerializable^ CreateDeserializable( )
+ std::shared_ptr<native::Properties> GetNative()
{
- return Create<String^, String^>( );
+ return m_nativeptr->get_shared_ptr();
}
- /// <summary>
- /// Factory function to register wrapper
- /// </summary>
- inline static IGeodeSerializable^ CreateDeserializable(
- apache::geode::client::Serializable* nativeptr )
+ inline static IGeodeSerializable^ CreateDeserializable( )
{
- return Create<String^, String^>( nativeptr );
+ return Create<String^, String^>();
}
- internal:
+ private:
/// <summary>
/// Private constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline Properties( apache::geode::client::Serializable* nativeptr )
- : SBWrap( (apache::geode::client::Properties*)nativeptr ) { }
+ inline Properties( native::PropertiesPtr nativeptr )
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::Properties>(nativeptr);
+ }
+
+ native_shared_ptr<native::Properties>^ m_nativeptr;
+
+ void FromData(native::DataInput & input);
};
generic <class TPropKey, class TPropValue>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/Query.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/Query.cpp b/src/clicache/src/Query.cpp
index 4723b3f..f1041f8 100644
--- a/src/clicache/src/Query.cpp
+++ b/src/clicache/src/Query.cpp
@@ -44,25 +44,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::SelectResultsPtr& nativeptr = NativePtr->execute( timeout );
- if ( nativeptr.ptr( ) == NULL ) return nullptr;
-
- apache::geode::client::ResultSet* resultptr = dynamic_cast<apache::geode::client::ResultSet*>(
- nativeptr.ptr( ) );
- if ( resultptr == NULL )
+ try
{
- apache::geode::client::StructSet* structptr = dynamic_cast<apache::geode::client::StructSet*>(
- nativeptr.ptr( ) );
- if ( structptr == NULL )
- {
- return nullptr;
- }
- return StructSet<TResult>::Create(structptr);
+ return WrapResults( m_nativeptr->get()->execute( timeout ));
}
- else
+ finally
{
- return ResultSet<TResult>::Create(resultptr);
- }
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -78,40 +67,53 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::CacheableVectorPtr rsptr = apache::geode::client::CacheableVector::create();
- for( int index = 0; index < paramList->Length; index++ )
- {
- apache::geode::client::CacheablePtr valueptr( Serializable::GetUnmanagedValueGeneric<Object^>(paramList[index]->GetType(), (Object^)paramList[index]) ) ;
- rsptr->push_back(valueptr);
- }
-
- apache::geode::client::SelectResultsPtr& nativeptr = NativePtr->execute(rsptr, timeout );
- if ( nativeptr.ptr( ) == NULL ) return nullptr;
-
- apache::geode::client::ResultSet* resultptr = dynamic_cast<apache::geode::client::ResultSet*>(
- nativeptr.ptr( ) );
- if ( resultptr == NULL )
- {
- apache::geode::client::StructSet* structptr = dynamic_cast<apache::geode::client::StructSet*>(
- nativeptr.ptr( ) );
- if ( structptr == NULL )
+ auto rsptr = apache::geode::client::CacheableVector::create();
+ for( int index = 0; index < paramList->Length; index++ )
{
- return nullptr;
+ auto valueptr = Serializable::GetUnmanagedValueGeneric<Object^>(paramList[index]->GetType(), (Object^)paramList[index]);
+ rsptr->push_back(valueptr);
+ }
+
+ try
+ {
+ return WrapResults( m_nativeptr->get()->execute(rsptr, timeout ));
}
- return StructSet<TResult>::Create(structptr);
- }
- else
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
+
+ generic<class TResult>
+ ISelectResults<TResult>^ Query<TResult>::WrapResults(const apache::geode::client::SelectResultsPtr& selectResults)
+ {
+ if ( __nullptr == selectResults ) return nullptr;
+
+ if (auto resultptr = std::dynamic_pointer_cast<apache::geode::client::ResultSet>(selectResults))
{
return ResultSet<TResult>::Create(resultptr);
}
+ else if (auto structptr = std::dynamic_pointer_cast<apache::geode::client::StructSet>(selectResults))
+ {
+ return StructSet<TResult>::Create(structptr);
+ }
- _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ return nullptr;
}
generic<class TResult>
String^ Query<TResult>::QueryString::get( )
{
- return ManagedString::Get( NativePtr->getQueryString( ) );
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getQueryString( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TResult>
@@ -119,21 +121,34 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->compile( );
+ try
+ {
+ m_nativeptr->get()->compile( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
generic<class TResult>
- bool Query<TResult>::IsCompiled::get( )
+ bool Query<TResult>::IsCompiled::get()
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return NativePtr->isCompiled( );
+ try
+ {
+ return m_nativeptr->get()->isCompiled();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
} // namespace Client
} // namespace Geode
} // namespace Apache
-
- } //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/Query.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/Query.hpp b/src/clicache/src/Query.hpp
index 2166911..951cd2c 100644
--- a/src/clicache/src/Query.hpp
+++ b/src/clicache/src/Query.hpp
@@ -18,8 +18,11 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/Query.hpp>
-#include "impl/NativeWrapper.hpp"
+#include "end_native.hpp"
+
+#include "native_shared_ptr.hpp"
#include "IGeodeSerializable.hpp"
@@ -31,6 +34,7 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
generic<class TResult>
interface class ISelectResults;
@@ -50,7 +54,6 @@ namespace Apache
/// </remarks>
generic<class TResult>
public ref class Query sealed
- : public Internal::SBWrap<apache::geode::client::Query>
{
public:
@@ -188,10 +191,10 @@ namespace Apache
/// <returns>
/// The managed wrapper object; null if the native pointer is null.
/// </returns>
- inline static Query<TResult>^ Create( apache::geode::client::Query* nativeptr )
+ inline static Query<TResult>^ Create( apache::geode::client::QueryPtr nativeptr )
{
- return ( nativeptr != nullptr ?
- gcnew Query<TResult>( nativeptr ) : nullptr );
+ return __nullptr == nativeptr ? nullptr :
+ gcnew Query<TResult>( nativeptr );
}
@@ -201,8 +204,14 @@ namespace Apache
/// Private constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline Query( apache::geode::client::Query* nativeptr )
- : SBWrap( nativeptr ) { }
+ inline Query( apache::geode::client::QueryPtr nativeptr )
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::Query>(nativeptr);
+ }
+
+ ISelectResults<TResult>^ WrapResults(const apache::geode::client::SelectResultsPtr& selectResults);
+
+ native_shared_ptr<native::Query>^ m_nativeptr;
};
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/QueryService.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/QueryService.cpp b/src/clicache/src/QueryService.cpp
index f4301e8..c5b328a 100644
--- a/src/clicache/src/QueryService.cpp
+++ b/src/clicache/src/QueryService.cpp
@@ -40,29 +40,38 @@ namespace Apache
Query<TResult>^ QueryService<TKey, TResult>::NewQuery(String^ query)
{
ManagedString mg_queryStr(query);
-
- _GF_MG_EXCEPTION_TRY2/* due to auto replace */
-
- return Query<TResult>::Create(NativePtr->newQuery(
- mg_queryStr.CharPtr).get());
-
- _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ try
+ {
+ return Query<TResult>::Create(m_nativeptr->get()->newQuery(
+ mg_queryStr.CharPtr));
+ }
+ catch (const apache::geode::client::Exception& ex)
+ {
+ throw GeodeException::Get(ex);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TResult>
CqQuery<TKey, TResult>^ QueryService<TKey, TResult>::NewCq(String^ query, CqAttributes<TKey, TResult>^ cqAttr, bool isDurable)
{
ManagedString mg_queryStr(query);
- apache::geode::client::CqAttributesPtr attr(GetNativePtrFromSBWrapGeneric<apache::geode::client::CqAttributes>(cqAttr));
try
{
- return CqQuery<TKey, TResult>::Create(NativePtr->newCq(
- mg_queryStr.CharPtr, attr, isDurable).get());
+ return CqQuery<TKey, TResult>::Create(m_nativeptr->get()->newCq(
+ mg_queryStr.CharPtr, cqAttr->GetNative(), isDurable));
}
catch (const apache::geode::client::Exception& ex)
{
throw GeodeException::Get(ex);
}
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TResult>
@@ -70,16 +79,19 @@ namespace Apache
{
ManagedString mg_queryStr(query);
ManagedString mg_nameStr(name);
- apache::geode::client::CqAttributesPtr attr(GetNativePtrFromSBWrapGeneric<apache::geode::client::CqAttributes>(cqAttr));
try
{
- return CqQuery<TKey, TResult>::Create(NativePtr->newCq(
- mg_nameStr.CharPtr, mg_queryStr.CharPtr, attr, isDurable).get());
+ return CqQuery<TKey, TResult>::Create(m_nativeptr->get()->newCq(
+ mg_nameStr.CharPtr, mg_queryStr.CharPtr, cqAttr->GetNative(), isDurable));
}
catch (const apache::geode::client::Exception& ex)
{
throw GeodeException::Get(ex);
}
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TResult>
@@ -87,12 +99,16 @@ namespace Apache
{
try
{
- NativePtr->closeCqs();
+ m_nativeptr->get()->closeCqs();
}
catch (const apache::geode::client::Exception& ex)
{
throw GeodeException::Get(ex);
}
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TResult>
@@ -100,13 +116,13 @@ namespace Apache
{
try
{
- apache::geode::client::VectorOfCqQuery vrr;
- NativePtr->getCqs(vrr);
- array<CqQuery<TKey, TResult>^>^ cqs = gcnew array<CqQuery<TKey, TResult>^>(vrr.size());
+ apache::geode::client::QueryService::query_container_type vrr;
+ m_nativeptr->get()->getCqs(vrr);
+ auto cqs = gcnew array<CqQuery<TKey, TResult>^>(vrr.size());
for (System::Int32 index = 0; index < vrr.size(); index++)
{
- cqs[index] = CqQuery<TKey, TResult>::Create(vrr[index].get());
+ cqs[index] = CqQuery<TKey, TResult>::Create(vrr[index]);
}
return cqs;
}
@@ -114,6 +130,10 @@ namespace Apache
{
throw GeodeException::Get(ex);
}
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TResult>
@@ -122,13 +142,17 @@ namespace Apache
ManagedString mg_queryStr(name);
try
{
- return CqQuery<TKey, TResult>::Create(NativePtr->getCq(
- mg_queryStr.CharPtr).get());
+ return CqQuery<TKey, TResult>::Create(m_nativeptr->get()->getCq(
+ mg_queryStr.CharPtr));
}
catch (const apache::geode::client::Exception& ex)
{
throw GeodeException::Get(ex);
}
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TResult>
@@ -136,12 +160,16 @@ namespace Apache
{
try
{
- NativePtr->executeCqs();
+ m_nativeptr->get()->executeCqs();
}
catch (const apache::geode::client::Exception& ex)
{
throw GeodeException::Get(ex);
}
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TResult>
@@ -149,12 +177,16 @@ namespace Apache
{
try
{
- NativePtr->stopCqs();
+ m_nativeptr->get()->stopCqs();
}
catch (const apache::geode::client::Exception& ex)
{
throw GeodeException::Get(ex);
}
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TResult>
@@ -162,12 +194,16 @@ namespace Apache
{
try
{
- return CqServiceStatistics::Create(NativePtr->getCqServiceStatistics().get());
+ return CqServiceStatistics::Create(m_nativeptr->get()->getCqServiceStatistics());
}
catch (const apache::geode::client::Exception& ex)
{
throw GeodeException::Get(ex);
}
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TResult>
@@ -175,15 +211,12 @@ namespace Apache
{
try
{
- apache::geode::client::CacheableArrayListPtr durableCqsArrayListPtr = NativePtr->getAllDurableCqsFromServer();
+ auto durableCqsArrayListPtr = m_nativeptr->get()->getAllDurableCqsFromServer();
int length = durableCqsArrayListPtr != nullptr ? durableCqsArrayListPtr->length() : 0;
- System::Collections::Generic::List<String^>^ durableCqsList = gcnew System::Collections::Generic::List<String^>();
- if (length > 0)
+ auto durableCqsList = gcnew System::Collections::Generic::List<String^>();
+ for (int i = 0; i < length; i++)
{
- for (int i = 0; i < length; i++)
- {
- durableCqsList->Add(CacheableString::GetString(durableCqsArrayListPtr->at(i)));
- }
+ durableCqsList->Add(CacheableString::GetString(std::static_pointer_cast<apache::geode::client::CacheableString>(durableCqsArrayListPtr->at(i))));
}
return durableCqsList;
}
@@ -191,6 +224,10 @@ namespace Apache
{
throw GeodeException::Get(ex);
}
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/QueryService.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/QueryService.hpp b/src/clicache/src/QueryService.hpp
index 6845ee1..78d29ef 100644
--- a/src/clicache/src/QueryService.hpp
+++ b/src/clicache/src/QueryService.hpp
@@ -18,8 +18,11 @@
#pragma once
#include "geode_defs.hpp"
-#include "impl/NativeWrapper.hpp"
+#include "native_shared_ptr.hpp"
+#include "begin_native.hpp"
#include <geode/QueryService.hpp>
+#include "end_native.hpp"
+
@@ -32,6 +35,8 @@ namespace Apache
namespace Client
{
+ namespace native = apache::geode::client;
+
generic<class TResult>
ref class Query;
@@ -48,7 +53,6 @@ namespace Apache
/// </summary>
generic<class TKey, class TResult>
public ref class QueryService sealed
- : public Internal::SBWrap<apache::geode::client::QueryService>
{
public:
@@ -132,10 +136,10 @@ namespace Apache
/// <returns>
/// The managed wrapper object; null if the native pointer is null.
/// </returns>
- inline static Apache::Geode::Client::QueryService<TKey, TResult>^ Create( apache::geode::client::QueryService* nativeptr )
+ inline static QueryService<TKey, TResult>^ Create(native::QueryServicePtr nativeptr )
{
- return ( nativeptr != nullptr ?
- gcnew Apache::Geode::Client::QueryService<TKey, TResult>( nativeptr ) : nullptr );
+ return __nullptr == nativeptr ? nullptr :
+ gcnew QueryService<TKey, TResult>( nativeptr );
}
@@ -145,8 +149,12 @@ namespace Apache
/// Private constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline QueryService( apache::geode::client::QueryService* nativeptr )
- : SBWrap( nativeptr ) { }
+ inline QueryService(native::QueryServicePtr nativeptr)
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::QueryService>(nativeptr);
+ }
+
+ native_shared_ptr<native::QueryService>^ m_nativeptr;
};
} // namespace Client
} // namespace Geode
[35/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from clicache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/Region.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/Region.cpp b/src/clicache/src/Region.cpp
index 6100412..0ea7aa2 100644
--- a/src/clicache/src/Region.cpp
+++ b/src/clicache/src/Region.cpp
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-//#include "geode_includes.hpp"
#include "Region.hpp"
#include "Cache.hpp"
#include "CacheStatistics.hpp"
@@ -28,15 +27,11 @@
#include "StructSet.hpp"
#include "impl/AuthenticatedCache.hpp"
#include "impl/SafeConvert.hpp"
-//#include <geode/Serializable.hpp>
-//#include <cppcache/DataOutPut.hpp>
#include "LocalRegion.hpp"
#include "Pool.hpp"
#include "PoolManager.hpp"
#include "SystemProperties.hpp"
-using namespace System;
-
namespace Apache
{
namespace Geode
@@ -44,35 +39,50 @@ namespace Apache
namespace Client
{
+ using namespace System;
+ namespace native = apache::geode::client;
+
generic<class TKey, class TValue>
TValue Region<TKey, TValue>::Get(TKey key, Object^ callbackArg)
{
- apache::geode::client::CacheableKeyPtr keyptr(Serializable::GetUnmanagedValueGeneric<TKey>(key));
- apache::geode::client::UserDataPtr callbackptr(
- Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg));
- apache::geode::client::CacheablePtr nativeptr(this->get(keyptr, callbackptr));
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key);
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg);
+ auto nativeptr = this->get(keyptr, callbackptr);
if (nativeptr == nullptr)
{
throw gcnew KeyNotFoundException("The given key was not present in the region.");
}
TValue returnVal = Serializable::GetManagedValueGeneric<TValue>(nativeptr);
return returnVal;
-
}
generic<class TKey, class TValue>
- apache::geode::client::SerializablePtr Region<TKey, TValue>::get(apache::geode::client::CacheableKeyPtr& keyptr, apache::geode::client::SerializablePtr& callbackptr)
+ native::SerializablePtr Region<TKey, TValue>::get(native::CacheableKeyPtr& keyptr, native::SerializablePtr& callbackptr)
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return NativePtr->get(keyptr, callbackptr);
+ try
+ {
+ return m_nativeptr->get()->get(keyptr, callbackptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
generic<class TKey, class TValue>
- apache::geode::client::SerializablePtr Region<TKey, TValue>::get(apache::geode::client::CacheableKeyPtr& keyptr)
+ native::SerializablePtr Region<TKey, TValue>::get(native::CacheableKeyPtr& keyptr)
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return NativePtr->get(keyptr);
+ try
+ {
+ return m_nativeptr->get()->get(keyptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -80,15 +90,15 @@ namespace Apache
bool Region<TKey, TValue>::isPoolInMultiuserMode()
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- Apache::Geode::Client::RegionAttributes<TKey, TValue>^ rAttributes = this->Attributes;
- String^ poolName = rAttributes->PoolName;
- if (poolName != nullptr) {
- Pool/*<TKey, TValue>*/^ pool = PoolManager/*<TKey, TValue>*/::Find(poolName);
- if (pool != nullptr && !pool->Destroyed) {
- return pool->MultiuserAuthentication;
+ auto rAttributes = this->Attributes;
+ auto poolName = rAttributes->PoolName;
+ if (poolName != nullptr) {
+ auto pool = PoolManager::Find(poolName);
+ if (pool != nullptr && !pool->Destroyed) {
+ return pool->MultiuserAuthentication;
+ }
}
- }
- return false;
+ return false;
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -97,20 +107,26 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::CacheableKeyPtr keyptr(Serializable::GetUnmanagedValueGeneric<TKey>(key));
- apache::geode::client::CacheablePtr valueptr(Serializable::GetUnmanagedValueGeneric<TValue>(value));
- apache::geode::client::UserDataPtr callbackptr(
- Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg));
- NativePtr->put(keyptr, valueptr, callbackptr);
-
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key);
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(value);
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg);
+ m_nativeptr->get()->put(keyptr, valueptr, callbackptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
generic<class TKey, class TValue>
TValue Region<TKey, TValue>::default::get(TKey key)
{
- apache::geode::client::CacheableKeyPtr keyptr(Serializable::GetUnmanagedValueGeneric<TKey>(key));
- apache::geode::client::CacheablePtr nativeptr(this->get(keyptr));
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key);
+ auto nativeptr = this->get(keyptr);
if (nativeptr == nullptr)
{
throw gcnew KeyNotFoundException("The given key was not present in the region.");
@@ -124,9 +140,16 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::CacheableKeyPtr keyptr(Serializable::GetUnmanagedValueGeneric<TKey>(key));
- apache::geode::client::CacheablePtr valueptr(Serializable::GetUnmanagedValueGeneric<TValue>(value));
- NativePtr->put(keyptr, valueptr);
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key);
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(value);
+ m_nativeptr->get()->put(keyptr, valueptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -135,22 +158,28 @@ namespace Apache
System::Collections::Generic::IEnumerator<KeyValuePair<TKey, TValue>>^
Region<TKey, TValue>::GetEnumerator()
{
- array<KeyValuePair<TKey, TValue>>^ toArray;
- apache::geode::client::VectorOfRegionEntry vc;
+ native::VectorOfRegionEntry vc;
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->entries(vc, false);
+ try
+ {
+ m_nativeptr->get()->entries(vc, false);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
- toArray = gcnew array<KeyValuePair<TKey, TValue>>(vc.size());
+ auto toArray = gcnew array<KeyValuePair<TKey, TValue>>(vc.size());
for (System::Int32 index = 0; index < vc.size(); index++)
{
- apache::geode::client::RegionEntryPtr nativeptr = vc[index];
- TKey key = Serializable::GetManagedValueGeneric<TKey>(nativeptr->getKey());
- TValue val = Serializable::GetManagedValueGeneric<TValue>(nativeptr->getValue());
+ auto& nativeptr = vc[index];
+ auto key = Serializable::GetManagedValueGeneric<TKey>(nativeptr->getKey());
+ auto val = Serializable::GetManagedValueGeneric<TValue>(nativeptr->getValue());
toArray[index] = KeyValuePair<TKey, TValue>(key, val);
}
return ((System::Collections::Generic::IEnumerable<KeyValuePair<TKey, TValue>>^)toArray)->GetEnumerator();
@@ -160,29 +189,35 @@ namespace Apache
System::Collections::IEnumerator^
Region<TKey, TValue>::GetEnumeratorOld()
{
- array<Object^>^ toArray;
- apache::geode::client::VectorOfRegionEntry vc;
+ native::VectorOfRegionEntry vc;
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->entries(vc, false);
+ try
+ {
+ m_nativeptr->get()->entries(vc, false);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
- toArray = gcnew array<Object^>(vc.size());
+ auto toArray = gcnew array<Object^>(vc.size());
for (System::Int32 index = 0; index < vc.size(); index++)
{
- apache::geode::client::RegionEntryPtr nativeptr = vc[index];
- TKey key = Serializable::GetManagedValueGeneric<TKey>(nativeptr->getKey());
- TValue val = Serializable::GetManagedValueGeneric<TValue>(nativeptr->getValue());
+ auto& nativeptr = vc[index];
+ auto key = Serializable::GetManagedValueGeneric<TKey>(nativeptr->getKey());
+ auto val = Serializable::GetManagedValueGeneric<TValue>(nativeptr->getValue());
toArray[index] = KeyValuePair<TKey, TValue>(key, val);
}
return ((System::Collections::Generic::IEnumerable<Object^>^)toArray)->GetEnumerator();
}
generic<class TKey, class TValue>
- bool Region<TKey, TValue>::AreValuesEqual(apache::geode::client::CacheablePtr& val1, apache::geode::client::CacheablePtr& val2)
+ bool Region<TKey, TValue>::AreValuesEqual(native::CacheablePtr& val1, native::CacheablePtr& val2)
{
if (val1 == nullptr && val2 == nullptr)
{
@@ -198,8 +233,8 @@ namespace Apache
{
return false;
}
- apache::geode::client::DataOutput out1;
- apache::geode::client::DataOutput out2;
+ native::DataOutput out1;
+ native::DataOutput out2;
val1->toData(out1);
val2->toData(out2);
if (out1.getBufferLength() != out2.getBufferLength())
@@ -218,13 +253,13 @@ namespace Apache
generic<class TKey, class TValue>
bool Region<TKey, TValue>::Contains(KeyValuePair<TKey, TValue> keyValuePair)
{
- apache::geode::client::CacheableKeyPtr keyptr(Serializable::GetUnmanagedValueGeneric<TKey>(keyValuePair.Key));
- apache::geode::client::CacheablePtr nativeptr(this->get(keyptr));
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(keyValuePair.Key);
+ auto nativeptr = this->get(keyptr);
//This means that key is not present.
if (nativeptr == nullptr) {
return false;
}
- TValue value = Serializable::GetManagedValueGeneric<TValue>(nativeptr);
+ auto value = Serializable::GetManagedValueGeneric<TValue>(nativeptr);
return ((Object^)value)->Equals(keyValuePair.Value);
}
@@ -233,9 +268,15 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::CacheableKeyPtr keyptr(Serializable::GetUnmanagedValueGeneric<TKey>(key));
-
- return NativePtr->containsKeyOnServer(keyptr);
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key);
+ return m_nativeptr->get()->containsKeyOnServer(keyptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -244,8 +285,8 @@ namespace Apache
bool Region<TKey, TValue>::TryGetValue(TKey key, TValue %val)
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::CacheableKeyPtr keyptr(Serializable::GetUnmanagedValueGeneric<TKey>(key));
- apache::geode::client::CacheablePtr nativeptr(this->get(keyptr));
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key);
+ auto nativeptr = this->get(keyptr);
if (nativeptr == nullptr) {
val = TValue();
return false;
@@ -263,19 +304,22 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::VectorOfCacheableKey vc;
- NativePtr->serverKeys(vc);
- //List<TKey>^ collectionlist = gcnew List<TKey>(vc.size());
- array<TKey>^ keyarr =
- gcnew array<TKey>(vc.size());
+ native::VectorOfCacheableKey vc;
+ try
+ {
+ m_nativeptr->get()->serverKeys(vc);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ auto keyarr = gcnew array<TKey>(vc.size());
for (System::Int32 index = 0; index < vc.size(); index++)
{
- apache::geode::client::CacheableKeyPtr& nativeptr(vc[index]);
+ auto& nativeptr = vc[index];
keyarr[index] = Serializable::GetManagedValueGeneric<TKey>(nativeptr);
- //collectionlist[ index ] = Serializable::GetManagedValue<TKey>(nativeptr);
}
- System::Collections::Generic::ICollection<TKey>^ collectionlist =
- (System::Collections::Generic::ICollection<TKey>^)keyarr;
+ auto collectionlist = (System::Collections::Generic::ICollection<TKey>^)keyarr;
return collectionlist;
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
@@ -286,19 +330,22 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::VectorOfCacheable vc;
- NativePtr->values(vc);
- //List<TValue>^ collectionlist = gcnew List<TValue>(vc.size());
- array<TValue>^ valarr =
- gcnew array<TValue>(vc.size());
+ native::VectorOfCacheable vc;
+ try
+ {
+ m_nativeptr->get()->values(vc);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ auto valarr = gcnew array<TValue>(vc.size());
for (System::Int32 index = 0; index < vc.size(); index++)
{
- apache::geode::client::CacheablePtr& nativeptr(vc[index]);
+ auto& nativeptr = vc[index];
valarr[index] = Serializable::GetManagedValueGeneric<TValue>(nativeptr);
- //collectionlist[ index ] = Serializable::GetManagedValueGeneric<TValue>(nativeptr);
}
- System::Collections::Generic::ICollection<TValue>^ collectionlist =
- (System::Collections::Generic::ICollection<TValue>^)valarr;
+ auto collectionlist = (System::Collections::Generic::ICollection<TValue>^)valarr;
return collectionlist;
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
@@ -309,9 +356,16 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::CacheableKeyPtr keyptr(Serializable::GetUnmanagedValueGeneric<TKey>(key));
- apache::geode::client::CacheablePtr valueptr(Serializable::GetUnmanagedValueGeneric<TValue>(value));
- NativePtr->create(keyptr, valueptr);
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key);
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(value);
+ m_nativeptr->get()->create(keyptr, valueptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -321,9 +375,16 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::CacheableKeyPtr keyptr(Serializable::GetUnmanagedValueGeneric<TKey>(keyValuePair.Key));
- apache::geode::client::CacheablePtr valueptr(Serializable::GetUnmanagedValueGeneric<TValue>(keyValuePair.Value));
- NativePtr->create(keyptr, valueptr);
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(keyValuePair.Key);
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(keyValuePair.Value);
+ m_nativeptr->get()->create(keyptr, valueptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -333,11 +394,17 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::CacheableKeyPtr keyptr(Serializable::GetUnmanagedValueGeneric<TKey>(key));
- apache::geode::client::CacheablePtr valueptr(Serializable::GetUnmanagedValueGeneric<TValue>(value));
- apache::geode::client::UserDataPtr callbackptr(
- Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg));
- NativePtr->create(keyptr, valueptr, callbackptr);
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key);
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(value);
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg);
+ m_nativeptr->get()->create(keyptr, valueptr, callbackptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -347,8 +414,15 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::CacheableKeyPtr keyptr(Serializable::GetUnmanagedValueGeneric<TKey>(key));
- return NativePtr->removeEx(keyptr);
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key);
+ return m_nativeptr->get()->removeEx(keyptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
@@ -359,10 +433,16 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::CacheableKeyPtr keyptr(Serializable::GetUnmanagedValueGeneric<TKey>(key));
- apache::geode::client::UserDataPtr callbackptr(
- Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg));
- return NativePtr->removeEx(keyptr, callbackptr);
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key);
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg);
+ return m_nativeptr->get()->removeEx(keyptr, callbackptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -372,10 +452,16 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::CacheableKeyPtr keyptr(Serializable::GetUnmanagedValueGeneric<TKey>(keyValuePair.Key));
- apache::geode::client::CacheablePtr valueptr(Serializable::GetUnmanagedValueGeneric<TValue>(keyValuePair.Value));
-
- return NativePtr->remove(keyptr, valueptr);
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(keyValuePair.Key);
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(keyValuePair.Value);
+ return m_nativeptr->get()->remove(keyptr, valueptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -385,10 +471,17 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::CacheableKeyPtr keyptr(Serializable::GetUnmanagedValueGeneric<TKey>(key));
- apache::geode::client::CacheablePtr valueptr(Serializable::GetUnmanagedValueGeneric<TValue>(value));
- apache::geode::client::UserDataPtr callbackptr(Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg));
- return NativePtr->remove(keyptr, valueptr, callbackptr);
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key);
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(value);
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg);
+ return m_nativeptr->get()->remove(keyptr, valueptr, callbackptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -408,9 +501,15 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::UserDataPtr callbackptr(
- Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg));
- NativePtr->invalidateRegion(callbackptr);
+ try
+ {
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg);
+ m_nativeptr->get()->invalidateRegion(callbackptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -430,9 +529,15 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::UserDataPtr callbackptr(
- Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg));
- NativePtr->destroyRegion(callbackptr);
+ try
+ {
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg);
+ m_nativeptr->get()->destroyRegion(callbackptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -453,10 +558,16 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::CacheableKeyPtr keyptr(Serializable::GetUnmanagedValueGeneric<TKey>(key));
- apache::geode::client::UserDataPtr callbackptr(
- Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg));
- NativePtr->invalidate(keyptr, callbackptr);
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key);
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg);
+ m_nativeptr->get()->invalidate(keyptr, callbackptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -477,14 +588,21 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::HashMapOfCacheable nativeMap;
+ native::HashMapOfCacheable nativeMap;
for each (KeyValuePair<TKey, TValue> keyValPair in map)
{
- apache::geode::client::CacheableKeyPtr keyptr(Serializable::GetUnmanagedValueGeneric<TKey>(keyValPair.Key));
- apache::geode::client::CacheablePtr valueptr(Serializable::GetUnmanagedValueGeneric<TValue>(keyValPair.Value));
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(keyValPair.Key);
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(keyValPair.Value);
nativeMap.insert(keyptr, valueptr);
}
- NativePtr->putAll(nativeMap, timeout);
+ try
+ {
+ m_nativeptr->get()->putAll(nativeMap, timeout);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
@@ -495,16 +613,22 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::HashMapOfCacheable nativeMap;
+ native::HashMapOfCacheable nativeMap;
for each (KeyValuePair<TKey, TValue> keyValPair in map)
{
- apache::geode::client::CacheableKeyPtr keyptr(Serializable::GetUnmanagedValueGeneric<TKey>(keyValPair.Key));
- apache::geode::client::CacheablePtr valueptr(Serializable::GetUnmanagedValueGeneric<TValue>(keyValPair.Value));
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(keyValPair.Key);
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TValue>(keyValPair.Value);
nativeMap.insert(keyptr, valueptr);
}
- apache::geode::client::UserDataPtr callbackptr(
- Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg));
- NativePtr->putAll(nativeMap, timeout, callbackptr);
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg);
+ try
+ {
+ m_nativeptr->get()->putAll(nativeMap, timeout, callbackptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
@@ -532,7 +656,7 @@ namespace Apache
if (keys != nullptr) {
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::VectorOfCacheableKey vecKeys;
+ native::VectorOfCacheableKey vecKeys;
for each(TKey item in keys)
{
@@ -540,18 +664,24 @@ namespace Apache
Serializable::GetUnmanagedValueGeneric<TKey>(item));
}
- apache::geode::client::HashMapOfCacheablePtr valuesPtr(nullptr);
+ native::HashMapOfCacheablePtr valuesPtr;
if (values != nullptr) {
- valuesPtr = new apache::geode::client::HashMapOfCacheable();
+ valuesPtr = std::make_shared<native::HashMapOfCacheable>();
}
- apache::geode::client::HashMapOfExceptionPtr exceptionsPtr(nullptr);
+ native::HashMapOfExceptionPtr exceptionsPtr;
if (exceptions != nullptr) {
- exceptionsPtr = new apache::geode::client::HashMapOfException();
+ exceptionsPtr = std::make_shared<native::HashMapOfException>();
+ }
+ try
+ {
+ m_nativeptr->get()->getAll(vecKeys, valuesPtr, exceptionsPtr, addToLocalCache);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
}
- NativePtr->getAll(vecKeys, valuesPtr, exceptionsPtr,
- addToLocalCache);
if (values != nullptr) {
- for (apache::geode::client::HashMapOfCacheable::Iterator iter =
+ for (native::HashMapOfCacheable::Iterator iter =
valuesPtr->begin(); iter != valuesPtr->end(); ++iter) {
TKey key = Serializable::GetManagedValueGeneric<TKey>(iter.first());
TValue val = Serializable::GetManagedValueGeneric<TValue>(iter.second());
@@ -559,7 +689,7 @@ namespace Apache
}
}
if (exceptions != nullptr) {
- for (apache::geode::client::HashMapOfException::Iterator iter =
+ for (native::HashMapOfException::Iterator iter =
exceptionsPtr->begin(); iter != exceptionsPtr->end(); ++iter) {
TKey key = Serializable::GetManagedValueGeneric<TKey>(iter.first());
System::Exception^ ex = GeodeException::Get(*iter.second());
@@ -583,7 +713,7 @@ namespace Apache
if (keys != nullptr) {
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::VectorOfCacheableKey vecKeys;
+ native::VectorOfCacheableKey vecKeys;
for each(TKey item in keys)
{
@@ -591,22 +721,27 @@ namespace Apache
Serializable::GetUnmanagedValueGeneric<TKey>(item));
}
- apache::geode::client::HashMapOfCacheablePtr valuesPtr(nullptr);
+ native::HashMapOfCacheablePtr valuesPtr;
if (values != nullptr) {
- valuesPtr = new apache::geode::client::HashMapOfCacheable();
+ valuesPtr = std::make_shared<native::HashMapOfCacheable>();
}
- apache::geode::client::HashMapOfExceptionPtr exceptionsPtr(nullptr);
+ native::HashMapOfExceptionPtr exceptionsPtr;
if (exceptions != nullptr) {
- exceptionsPtr = new apache::geode::client::HashMapOfException();
+ exceptionsPtr = std::make_shared<native::HashMapOfException>();
}
- apache::geode::client::UserDataPtr callbackptr(
- Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg));
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg);
- NativePtr->getAll(vecKeys, valuesPtr, exceptionsPtr,
- addToLocalCache, callbackptr);
+ try
+ {
+ m_nativeptr->get()->getAll(vecKeys, valuesPtr, exceptionsPtr, addToLocalCache, callbackptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
if (values != nullptr) {
- for (apache::geode::client::HashMapOfCacheable::Iterator iter =
+ for (native::HashMapOfCacheable::Iterator iter =
valuesPtr->begin(); iter != valuesPtr->end(); ++iter) {
TKey key = Serializable::GetManagedValueGeneric<TKey>(iter.first());
TValue val = Serializable::GetManagedValueGeneric<TValue>(iter.second());
@@ -614,7 +749,7 @@ namespace Apache
}
}
if (exceptions != nullptr) {
- for (apache::geode::client::HashMapOfException::Iterator iter =
+ for (native::HashMapOfException::Iterator iter =
exceptionsPtr->begin(); iter != exceptionsPtr->end(); ++iter) {
TKey key = Serializable::GetManagedValueGeneric<TKey>(iter.first());
System::Exception^ ex = GeodeException::Get(*iter.second());
@@ -646,14 +781,20 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::VectorOfCacheableKey vecKeys;
+ native::VectorOfCacheableKey vecKeys;
for each(TKey item in keys)
vecKeys.push_back(Serializable::GetUnmanagedValueGeneric<TKey>(item));
- apache::geode::client::UserDataPtr callbackptr(
- Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg));
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg);
- NativePtr->removeAll(vecKeys, callbackptr);
+ try
+ {
+ m_nativeptr->get()->removeAll(vecKeys, callbackptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
@@ -661,13 +802,27 @@ namespace Apache
generic<class TKey, class TValue>
String^ Region<TKey, TValue>::Name::get()
{
- return ManagedString::Get(NativePtr->getName());
+ try
+ {
+ return ManagedString::Get(m_nativeptr->get()->getName());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TValue>
String^ Region<TKey, TValue>::FullPath::get()
{
- return ManagedString::Get(NativePtr->getFullPath());
+ try
+ {
+ return ManagedString::Get(m_nativeptr->get()->getFullPath());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TValue>
@@ -675,9 +830,15 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::RegionPtr& nativeptr(NativePtr->getParentRegion());
-
- return Region::Create(nativeptr.get());
+ try
+ {
+ auto parentRegion = m_nativeptr->get()->getParentRegion();
+ return Region::Create(parentRegion);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -687,9 +848,15 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::RegionAttributesPtr& nativeptr(NativePtr->getAttributes());
-
- return Apache::Geode::Client::RegionAttributes<TKey, TValue>::Create(nativeptr.get());
+ try
+ {
+ auto nativeptr = m_nativeptr->get()->getAttributes();
+ return Apache::Geode::Client::RegionAttributes<TKey, TValue>::Create(nativeptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -699,10 +866,15 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::AttributesMutatorPtr& nativeptr(
- NativePtr->getAttributesMutator());
-
- return Apache::Geode::Client::AttributesMutator<TKey, TValue>::Create(nativeptr.get());
+ try
+ {
+ auto am = m_nativeptr->get()->getAttributesMutator();
+ return Apache::Geode::Client::AttributesMutator<TKey, TValue>::Create( am );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -712,8 +884,15 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::CacheStatisticsPtr& nativeptr(NativePtr->getStatistics());
- return Apache::Geode::Client::CacheStatistics::Create(nativeptr.get());
+ try
+ {
+ auto nativeptr = m_nativeptr->get()->getStatistics();
+ return Apache::Geode::Client::CacheStatistics::Create(nativeptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -724,9 +903,15 @@ namespace Apache
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
ManagedString mg_path(path);
- apache::geode::client::RegionPtr& nativeptr(
- NativePtr->getSubregion(mg_path.CharPtr));
- return Region::Create(nativeptr.get());
+ try
+ {
+ auto subRegion = m_nativeptr->get()->getSubregion(mg_path.CharPtr);
+ return Region::Create(subRegion);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -737,14 +922,16 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- ManagedString mg_subregionName(subRegionName);
- //TODO:split
- apache::geode::client::RegionAttributesPtr p_attrs(
- GetNativePtrFromSBWrapGeneric<apache::geode::client::RegionAttributes>(attributes));
-
- apache::geode::client::RegionPtr& nativeptr(NativePtr->createSubregion(
- mg_subregionName.CharPtr, p_attrs /*nullptr*/));
- return Region::Create(nativeptr.get());
+ try
+ {
+ ManagedString mg_subregionName(subRegionName);
+ auto p_attrs = attributes->GetNative();
+ return Region::Create(m_nativeptr->get()->createSubregion(mg_subregionName.CharPtr, p_attrs));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
@@ -755,18 +942,24 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::VectorOfRegion vsr;
- NativePtr->subregions(recursive, vsr);
+ native::VectorOfRegion vsr;
+ try
+ {
+ m_nativeptr->get()->subregions(recursive, vsr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
array<IRegion<TKey, TValue>^>^ subRegions =
gcnew array<IRegion<TKey, TValue>^>(vsr.size());
for (System::Int32 index = 0; index < vsr.size(); index++)
{
- apache::geode::client::RegionPtr& nativeptr(vsr[index]);
- subRegions[index] = Region<TKey, TValue>::Create(nativeptr.get());
+ auto subRegion = vsr[index];
+ subRegions[index] = Region<TKey, TValue>::Create(subRegion);
}
- System::Collections::Generic::ICollection<IRegion<TKey, TValue>^>^ collection =
- (System::Collections::Generic::ICollection<IRegion<TKey, TValue>^>^)subRegions;
+ auto collection = (System::Collections::Generic::ICollection<IRegion<TKey, TValue>^>^)subRegions;
return collection;
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
@@ -777,9 +970,16 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::CacheableKeyPtr keyptr(Serializable::GetUnmanagedValueGeneric<TKey>(key));
- apache::geode::client::RegionEntryPtr& nativeptr(NativePtr->getEntry(keyptr));
- return RegionEntry<TKey, TValue>::Create(nativeptr.get());
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key);
+ auto nativeptr = m_nativeptr->get()->getEntry(keyptr);
+ return RegionEntry<TKey, TValue>::Create(nativeptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -789,17 +989,23 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::VectorOfRegionEntry vc;
- NativePtr->entries(vc, recursive);
+ native::VectorOfRegionEntry vc;
+ try
+ {
+ m_nativeptr->get()->entries(vc, recursive);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
array<RegionEntry<TKey, TValue>^>^ entryarr = gcnew array<RegionEntry<TKey, TValue>^>(vc.size());
for (System::Int32 index = 0; index < vc.size(); index++)
{
- apache::geode::client::RegionEntryPtr& nativeptr(vc[index]);
- entryarr[index] = RegionEntry<TKey, TValue>::Create(nativeptr.get());
+ auto& nativeptr = vc[index];
+ entryarr[index] = RegionEntry<TKey, TValue>::Create(nativeptr);
}
- System::Collections::Generic::ICollection<RegionEntry<TKey, TValue>^>^ collection =
- (System::Collections::Generic::ICollection<RegionEntry<TKey, TValue>^>^)entryarr;
+ auto collection = (System::Collections::Generic::ICollection<RegionEntry<TKey, TValue>^>^)entryarr;
return collection;
@@ -812,18 +1018,22 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::RegionServicePtr& nativeptr(NativePtr->getRegionService());
-
- apache::geode::client::Cache* realCache = dynamic_cast<apache::geode::client::Cache*>(nativeptr.get());
-
- if (realCache != NULL)
- {
- return Apache::Geode::Client::Cache::Create(((apache::geode::client::CachePtr)nativeptr).get());
- }
- else
- {
- return Apache::Geode::Client::AuthenticatedCache::Create(nativeptr.get());
- }
+ try
+ {
+ auto regionService = m_nativeptr->get()->getRegionService();
+ if (auto realCache = std::dynamic_pointer_cast<native::Cache>(regionService))
+ {
+ return Apache::Geode::Client::Cache::Create(realCache);
+ }
+ else
+ {
+ return Apache::Geode::Client::AuthenticatedCache::Create(regionService);
+ }
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -833,8 +1043,15 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::CacheableKeyPtr keyptr(Serializable::GetUnmanagedValueGeneric<TKey>(key));
- return NativePtr->containsValueForKey(keyptr);
+ try
+ {
+ native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TKey>(key);
+ return m_nativeptr->get()->containsValueForKey(keyptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -843,7 +1060,14 @@ namespace Apache
int Region<TKey, TValue>::Count::get()
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return NativePtr->size();
+ try
+ {
+ return m_nativeptr->get()->size();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -857,9 +1081,15 @@ namespace Apache
void Region<TKey, TValue>::Clear(Object^ callbackArg)
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::UserDataPtr callbackptr(
- Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg));
- NativePtr->clear(callbackptr);
+ try
+ {
+ native::UserDataPtr callbackptr = Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg);
+ m_nativeptr->get()->clear(callbackptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -878,8 +1108,15 @@ namespace Apache
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::VectorOfRegionEntry vc;
- NativePtr->entries(vc, false);
+ native::VectorOfRegionEntry vc;
+ try
+ {
+ m_nativeptr->get()->entries(vc, false);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
if (toArray->Rank > 1 || (vc.size() > (toArray->Length - startIdx)))
{
@@ -888,9 +1125,9 @@ namespace Apache
for (System::Int32 index = 0; index < vc.size(); index++)
{
- apache::geode::client::RegionEntryPtr nativeptr = vc[index];
- TKey key = Serializable::GetManagedValueGeneric<TKey>(nativeptr->getKey());
- TValue val = Serializable::GetManagedValueGeneric<TValue>(nativeptr->getValue());
+ auto& nativeptr = vc[index];
+ auto key = Serializable::GetManagedValueGeneric<TKey>(nativeptr->getKey());
+ auto val = Serializable::GetManagedValueGeneric<TValue>(nativeptr->getValue());
toArray[startIdx] = KeyValuePair<TKey, TValue>(key, val);
++startIdx;
}
@@ -901,7 +1138,14 @@ namespace Apache
generic<class TKey, class TValue>
bool Region<TKey, TValue>::IsDestroyed::get()
{
- return NativePtr->isDestroyed();
+ try
+ {
+ return m_nativeptr->get()->isDestroyed();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TValue>
@@ -926,14 +1170,20 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::VectorOfCacheableKey vecKeys;
+ native::VectorOfCacheableKey vecKeys;
for each(TKey item in keys)
{
- vecKeys.push_back(
- Serializable::GetUnmanagedValueGeneric<TKey>(item));
+ vecKeys.push_back(Serializable::GetUnmanagedValueGeneric<TKey>(item));
+ }
+ try
+ {
+ m_nativeptr->get()->registerKeys(vecKeys, isDurable, getInitialValues, receiveValues);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
}
- NativePtr->registerKeys(vecKeys, isDurable, getInitialValues, receiveValues);
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -946,7 +1196,7 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::VectorOfCacheableKey vecKeys;
+ native::VectorOfCacheableKey vecKeys;
for each(TKey item in keys)
{
@@ -954,7 +1204,14 @@ namespace Apache
Serializable::GetUnmanagedValueGeneric<TKey>(item));
}
- NativePtr->unregisterKeys(vecKeys);
+ try
+ {
+ m_nativeptr->get()->unregisterKeys(vecKeys);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -989,9 +1246,16 @@ namespace Apache
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
if (resultKeys != nullptr) {
- auto mg_keys = std::make_shared<apache::geode::client::VectorOfCacheableKey>();
+ auto mg_keys = std::make_shared<native::VectorOfCacheableKey>();
- NativePtr->registerAllKeys(isDurable, mg_keys, getInitialValues, receiveValues);
+ try
+ {
+ m_nativeptr->get()->registerAllKeys(isDurable, mg_keys, getInitialValues, receiveValues);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
for (System::Int32 index = 0; index < mg_keys->size(); ++index) {
resultKeys->Add(Serializable::GetManagedValueGeneric<TKey>(
@@ -999,7 +1263,14 @@ namespace Apache
}
}
else {
- NativePtr->registerAllKeys(isDurable, nullptr, getInitialValues, receiveValues);
+ try
+ {
+ m_nativeptr->get()->registerAllKeys(isDurable, nullptr, getInitialValues, receiveValues);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
@@ -1010,20 +1281,23 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::VectorOfCacheableKey vc;
- NativePtr->getInterestList(vc);
- //List<TValue>^ collectionlist = gcnew List<TValue>(vc.size());
- array<TKey>^ keyarr =
- gcnew array<TKey>(vc.size());
+ native::VectorOfCacheableKey vc;
+ try
+ {
+ m_nativeptr->get()->getInterestList(vc);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ auto keyarr = gcnew array<TKey>(vc.size());
for (System::Int32 index = 0; index < vc.size(); index++)
{
- apache::geode::client::CacheableKeyPtr& nativeptr(vc[index]);
+ auto& nativeptr = vc[index];
keyarr[index] = Serializable::GetManagedValueGeneric<TKey>(nativeptr);
- //collectionlist[ index ] = Serializable::GetManagedValueGeneric<TValue>(nativeptr);
}
- System::Collections::Generic::ICollection<TKey>^ collectionlist =
- (System::Collections::Generic::ICollection<TKey>^)keyarr;
+ auto collectionlist = (System::Collections::Generic::ICollection<TKey>^)keyarr;
return collectionlist;
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
@@ -1034,8 +1308,15 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::VectorOfCacheableString vc;
- NativePtr->getInterestListRegex(vc);
+ native::VectorOfCacheableString vc;
+ try
+ {
+ m_nativeptr->get()->getInterestListRegex(vc);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
array<String^>^ strarr =
gcnew array<String^>(vc.size());
//List<String>^ collectionlist = gcnew List<String>(vc.size());
@@ -1044,8 +1325,7 @@ namespace Apache
strarr[index] = ManagedString::Get(vc[index]->asChar());
//collectionlist[ index ] = Serializable::GetManagedValue<TValue>(nativeptr);
}
- System::Collections::Generic::ICollection<String^>^ collectionlist =
- (System::Collections::Generic::ICollection<String^>^)strarr;
+ auto collectionlist = (System::Collections::Generic::ICollection<String^>^)strarr;
return collectionlist;
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
@@ -1056,7 +1336,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->unregisterAllKeys();
+ try
+ {
+ m_nativeptr->get()->unregisterAllKeys();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
@@ -1094,20 +1381,27 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ try
+ {
ManagedString mg_regex(regex);
- if (resultKeys != nullptr) {
- auto mg_keys = std::make_shared<apache::geode::client::VectorOfCacheableKey>();
- NativePtr->registerRegex(mg_regex.CharPtr, isDurable,
- mg_keys, getInitialValues, receiveValues);
-
- for (System::Int32 index = 0; index < mg_keys->size(); ++index) {
- resultKeys->Add(Serializable::GetManagedValueGeneric<TKey>(
- mg_keys->operator[](index)));
+ if (resultKeys != nullptr) {
+ auto mg_keys = std::make_shared<native::VectorOfCacheableKey>();
+ m_nativeptr->get()->registerRegex(mg_regex.CharPtr, isDurable,
+ mg_keys, getInitialValues, receiveValues);
+
+ for (System::Int32 index = 0; index < mg_keys->size(); ++index) {
+ resultKeys->Add(Serializable::GetManagedValueGeneric<TKey>(
+ mg_keys->operator[](index)));
+ }
+ }
+ else {
+ m_nativeptr->get()->registerRegex(mg_regex.CharPtr, isDurable,
+ nullptr, getInitialValues, receiveValues);
}
}
- else {
- NativePtr->registerRegex(mg_regex.CharPtr, isDurable,
- nullptr, getInitialValues, receiveValues);
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
}
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
@@ -1119,7 +1413,14 @@ namespace Apache
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
ManagedString mg_regex(regex);
- NativePtr->unregisterRegex(mg_regex.CharPtr);
+ try
+ {
+ m_nativeptr->get()->unregisterRegex(mg_regex.CharPtr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
@@ -1129,33 +1430,7 @@ namespace Apache
generic<class TResult>
ISelectResults<TResult>^ Region<TKey, TValue>::Query(String^ predicate)
{
- //return Query( predicate, DEFAULT_QUERY_RESPONSE_TIMEOUT );
- ManagedString mg_predicate(predicate);
-
- _GF_MG_EXCEPTION_TRY2/* due to auto replace */
-
- apache::geode::client::SelectResultsPtr& nativeptr = NativePtr->query(
- mg_predicate.CharPtr, DEFAULT_QUERY_RESPONSE_TIMEOUT);
- if (nativeptr.get() == NULL) return nullptr;
-
- apache::geode::client::ResultSet* resultptr = dynamic_cast<apache::geode::client::ResultSet*>(
- nativeptr.get());
- if (resultptr == NULL)
- {
- apache::geode::client::StructSet* structptr = dynamic_cast<apache::geode::client::StructSet*>(
- nativeptr.get());
- if (structptr == NULL)
- {
- return nullptr;
- }
- return StructSet<TResult>::Create(structptr);
- }
- else
- {
- return ResultSet<TResult>::Create(resultptr);
- }
- _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
-
+ return Query<TResult>( predicate, DEFAULT_QUERY_RESPONSE_TIMEOUT );
}
generic<class TKey, class TValue>
@@ -1166,26 +1441,24 @@ namespace Apache
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::SelectResultsPtr& nativeptr = NativePtr->query(
- mg_predicate.CharPtr, timeout);
- if (nativeptr.get() == NULL) return nullptr;
-
- apache::geode::client::ResultSet* resultptr = dynamic_cast<apache::geode::client::ResultSet*>(
- nativeptr.get());
- if (resultptr == NULL)
- {
- apache::geode::client::StructSet* structptr = dynamic_cast<apache::geode::client::StructSet*>(
- nativeptr.get());
- if (structptr == NULL)
+ try
{
+ auto selectResults = m_nativeptr->get()->query(mg_predicate.CharPtr, timeout);
+ if (auto resultptr = std::dynamic_pointer_cast<native::ResultSet>(selectResults))
+ {
+ return ResultSet<TResult>::Create(resultptr);
+ }
+ else if (auto structptr = std::dynamic_pointer_cast<native::StructSet>(selectResults))
+ {
+ return StructSet<TResult>::Create(structptr);
+ }
return nullptr;
}
- return StructSet<TResult>::Create(structptr);
- }
- else
- {
- return ResultSet<TResult>::Create(resultptr);
- }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -1202,7 +1475,14 @@ namespace Apache
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return NativePtr->existsValue(mg_predicate.CharPtr, timeout);
+ try
+ {
+ return m_nativeptr->get()->existsValue(mg_predicate.CharPtr, timeout);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
@@ -1221,10 +1501,15 @@ namespace Apache
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::client::CacheablePtr& nativeptr(NativePtr->selectValue(
- mg_predicate.CharPtr, timeout));
-
- return Serializable::GetManagedValueGeneric<Object^>(nativeptr);
+ try
+ {
+ auto nativeptr = m_nativeptr->get()->selectValue(mg_predicate.CharPtr, timeout);
+ return Serializable::GetManagedValueGeneric<Object^>(nativeptr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
@@ -1239,8 +1524,7 @@ namespace Apache
generic<class TKey, class TValue>
IRegion<TKey, TValue>^ Region<TKey, TValue>::GetLocalView()
{
- return (_NativePtr != nullptr ?
- gcnew LocalRegion<TKey, TValue>(_NativePtr) : nullptr);
+ return gcnew LocalRegion<TKey, TValue>(GetNative());
}
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/Region.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/Region.hpp b/src/clicache/src/Region.hpp
index b7b18fe..9aa7c27 100644
--- a/src/clicache/src/Region.hpp
+++ b/src/clicache/src/Region.hpp
@@ -18,16 +18,16 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/Cache.hpp>
-#include "impl/NativeWrapper.hpp"
+#include "end_native.hpp"
+
+
#include "IRegion.hpp"
-//#include "Log.hpp"
-//#include "ExceptionTypes.hpp"
#include "ISubscriptionService.hpp"
+#include "native_shared_ptr.hpp"
using namespace System;
-//using namespace System::Collections;
-//using namespace System::Collections::Generic;
namespace Apache
{
@@ -36,11 +36,10 @@ namespace Apache
namespace Client
{
- //generic<class TKey, class TValue>
- // ref class AttributesMutator;
+ namespace native = apache::geode::client;
generic<class TKey, class TValue>
- public ref class Region : public Internal::SBWrap<apache::geode::client::Region>,
+ public ref class Region :
public IRegion<TKey, TValue>,
public ISubscriptionService<TKey>
{
@@ -270,11 +269,16 @@ namespace Apache
/// The managed wrapper object; null if the native pointer is null.
/// </returns>
//generic<class TKey, class TValue>
- inline static Apache::Geode::Client::IRegion<TKey, TValue>^
- Create( apache::geode::client::Region* nativeptr )
+ inline static IRegion<TKey, TValue>^
+ Create( native::RegionPtr nativeptr )
+ {
+ return __nullptr == nativeptr ? nullptr :
+ gcnew Region<TKey, TValue>( nativeptr );
+ }
+
+ std::shared_ptr<native::Region> GetNative()
{
- return ( nativeptr != nullptr ?
- gcnew Region<TKey, TValue>( nativeptr ) : nullptr );
+ return m_nativeptr->get_shared_ptr();
}
@@ -283,14 +287,20 @@ namespace Apache
/// Private constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline Region( apache::geode::client::Region* nativeptr )
- : SBWrap<apache::geode::client::Region>( nativeptr ) { }
+ inline Region( native::RegionPtr nativeptr )
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::Region>(nativeptr);
+ }
inline apache::geode::client::SerializablePtr get(apache::geode::client::CacheableKeyPtr& key, apache::geode::client::SerializablePtr& callbackArg);
inline apache::geode::client::SerializablePtr get(apache::geode::client::CacheableKeyPtr& key);
bool AreValuesEqual(apache::geode::client::CacheablePtr& val1, apache::geode::client::CacheablePtr& val2);
bool isPoolInMultiuserMode();
+
+ native_shared_ptr<native::Region>^ m_nativeptr;
+
};
+
} // namespace Client
} // namespace Geode
} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/RegionAttributes.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/RegionAttributes.cpp b/src/clicache/src/RegionAttributes.cpp
index fe4d12b..7bc639a 100644
--- a/src/clicache/src/RegionAttributes.cpp
+++ b/src/clicache/src/RegionAttributes.cpp
@@ -15,9 +15,7 @@
* limitations under the License.
*/
-//#include "geode_includes.hpp"
#include "RegionAttributes.hpp"
-//#include "Region.hpp"
#include "impl/ManagedCacheLoader.hpp"
#include "impl/ManagedCacheWriter.hpp"
#include "impl/ManagedCacheListener.hpp"
@@ -44,16 +42,23 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
generic <class TKey, class TValue>
void Client::RegionAttributes<TKey, TValue>::ToData(
Apache::Geode::Client::DataOutput^ output )
{
- apache::geode::client::DataOutput* nativeOutput =
- Apache::Geode::Client::GetNativePtrFromUMWrapGeneric<apache::geode::client::DataOutput>( output );
+ auto nativeOutput = output->GetNative();
if (nativeOutput != nullptr)
{
- NativePtr->toData( *nativeOutput );
+ try
+ {
+ m_nativeptr->get()->toData(*nativeOutput);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
}
@@ -61,12 +66,21 @@ namespace Apache
Apache::Geode::Client::IGeodeSerializable^ Client::RegionAttributes<TKey, TValue>::FromData(
Apache::Geode::Client::DataInput^ input )
{
- apache::geode::client::DataInput* nativeInput =
- Apache::Geode::Client::GetNativePtrFromUMWrapGeneric<apache::geode::client::DataInput>( input );
+ auto nativeInput = input->GetNative();
if (nativeInput != nullptr)
{
- AssignPtr( static_cast<apache::geode::client::RegionAttributes*>(
- NativePtr->fromData( *nativeInput ) ) );
+ try
+ {
+ auto temp = static_cast<native::RegionAttributes*>(m_nativeptr->get()->fromData(*nativeInput));
+ if (temp != m_nativeptr->get())
+ {
+ m_nativeptr->get_shared_ptr().reset(temp);
+ }
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
return this;
}
@@ -74,286 +88,517 @@ namespace Apache
generic <class TKey, class TValue>
ICacheLoader<TKey, TValue>^ Client::RegionAttributes<TKey, TValue>::CacheLoader::get()
{
- apache::geode::client::CacheLoaderPtr& loaderptr( NativePtr->getCacheLoader( ) );
- apache::geode::client::ManagedCacheLoaderGeneric* mg_loader =
- dynamic_cast<apache::geode::client::ManagedCacheLoaderGeneric*>( loaderptr.ptr( ) );
-
- if (mg_loader != nullptr)
+ try
+ {
+ auto loaderptr = m_nativeptr->get()->getCacheLoader();
+ if (auto mg_loader = std::dynamic_pointer_cast<native::ManagedCacheLoaderGeneric>(loaderptr))
+ {
+ return (ICacheLoader<TKey, TValue>^) mg_loader->userptr();
+ }
+ return nullptr;
+ }
+ finally
{
- return (ICacheLoader<TKey, TValue>^) mg_loader->userptr( );
+ GC::KeepAlive(m_nativeptr);
}
- return nullptr;
}
generic <class TKey, class TValue>
ICacheWriter<TKey, TValue>^ Client::RegionAttributes<TKey, TValue>::CacheWriter::get()
{
- apache::geode::client::CacheWriterPtr& writerptr( NativePtr->getCacheWriter( ) );
- apache::geode::client::ManagedCacheWriterGeneric* mg_writer =
- dynamic_cast<apache::geode::client::ManagedCacheWriterGeneric*>( writerptr.ptr( ) );
-
- if (mg_writer != nullptr)
+ try
+ {
+ auto writerptr = m_nativeptr->get()->getCacheWriter();
+ if (auto mg_writer = std::dynamic_pointer_cast<native::ManagedCacheWriterGeneric>(writerptr))
+ {
+ return (ICacheWriter<TKey, TValue>^)mg_writer->userptr();
+ }
+ return nullptr;
+ }
+ finally
{
- return (ICacheWriter<TKey, TValue>^)mg_writer->userptr( );
+ GC::KeepAlive(m_nativeptr);
}
- return nullptr;
}
generic <class TKey, class TValue>
ICacheListener<TKey, TValue>^ Client::RegionAttributes<TKey, TValue>::CacheListener::get()
{
- apache::geode::client::CacheListenerPtr& listenerptr( NativePtr->getCacheListener( ) );
- apache::geode::client::ManagedCacheListenerGeneric* mg_listener =
- dynamic_cast<apache::geode::client::ManagedCacheListenerGeneric*>( listenerptr.ptr( ) );
-
- if (mg_listener != nullptr)
+ try
{
- /*
- CacheListenerGeneric<TKey, TValue>^ clg = gcnew CacheListenerGeneric<TKey, TValue>();
- clg->SetCacheListener((ICacheListener<TKey, TValue>^)mg_listener->userptr());
- mg_listener->setptr(clg);
- */
- return (ICacheListener<TKey, TValue>^)mg_listener->userptr( );
+ auto listenerptr = m_nativeptr->get()->getCacheListener();
+ if (auto mg_listener = std::dynamic_pointer_cast<native::ManagedCacheListenerGeneric>(listenerptr))
+ {
+ return (ICacheListener<TKey, TValue>^)mg_listener->userptr();
+ }
+ return nullptr;
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
}
- return nullptr;
}
generic <class TKey, class TValue>
IPartitionResolver<TKey, TValue>^ Client::RegionAttributes<TKey, TValue>::PartitionResolver::get()
{
- apache::geode::client::PartitionResolverPtr& resolverptr( NativePtr->getPartitionResolver( ) );
- apache::geode::client::ManagedPartitionResolverGeneric* mg_resolver =
- dynamic_cast<apache::geode::client::ManagedPartitionResolverGeneric*>( resolverptr.ptr( ) );
-
- if (mg_resolver != nullptr)
+ try
{
- return (IPartitionResolver<TKey, TValue>^)mg_resolver->userptr( );
+ auto resolverptr = m_nativeptr->get()->getPartitionResolver();
+ if (auto mg_resolver = std::dynamic_pointer_cast<native::ManagedPartitionResolverGeneric>(resolverptr))
+ {
+ return (IPartitionResolver<TKey, TValue>^)mg_resolver->userptr();
+ }
+
+ if (auto mg_fixedResolver = std::dynamic_pointer_cast<native::ManagedFixedPartitionResolverGeneric>(resolverptr))
+ {
+ return (IPartitionResolver<TKey, TValue>^)mg_fixedResolver->userptr();
+ }
+
+ return nullptr;
}
-
- apache::geode::client::ManagedFixedPartitionResolverGeneric* mg_fixedResolver =
- dynamic_cast<apache::geode::client::ManagedFixedPartitionResolverGeneric*>( resolverptr.ptr( ) );
-
- if (mg_fixedResolver != nullptr)
+ finally
{
- return (IPartitionResolver<TKey, TValue>^)mg_fixedResolver->userptr( );
+ GC::KeepAlive(m_nativeptr);
}
-
- return nullptr;
}
generic <class TKey, class TValue>
System::Int32 Client::RegionAttributes<TKey, TValue>::RegionTimeToLive::get()
{
- return NativePtr->getRegionTimeToLive( );
+ try
+ {
+ return m_nativeptr->get()->getRegionTimeToLive( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic <class TKey, class TValue>
ExpirationAction Client::RegionAttributes<TKey, TValue>::RegionTimeToLiveAction::get()
{
- return static_cast<ExpirationAction>( NativePtr->getRegionTimeToLiveAction( ) );
+ try
+ {
+ return static_cast<ExpirationAction>( m_nativeptr->get()->getRegionTimeToLiveAction( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic <class TKey, class TValue>
System::Int32 Client::RegionAttributes<TKey, TValue>::RegionIdleTimeout::get()
{
- return NativePtr->getRegionIdleTimeout( );
+ try
+ {
+ return m_nativeptr->get()->getRegionIdleTimeout( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic <class TKey, class TValue>
ExpirationAction Client::RegionAttributes<TKey, TValue>::RegionIdleTimeoutAction::get()
{
- return static_cast<ExpirationAction>( NativePtr->getRegionIdleTimeoutAction( ) );
+ try
+ {
+ return static_cast<ExpirationAction>( m_nativeptr->get()->getRegionIdleTimeoutAction( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic <class TKey, class TValue>
System::Int32 Client::RegionAttributes<TKey, TValue>::EntryTimeToLive::get()
{
- return NativePtr->getEntryTimeToLive( );
+ try
+ {
+ return m_nativeptr->get()->getEntryTimeToLive( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic <class TKey, class TValue>
ExpirationAction Client::RegionAttributes<TKey, TValue>::EntryTimeToLiveAction::get()
{
- return static_cast<ExpirationAction>( NativePtr->getEntryTimeToLiveAction( ) );
+ try
+ {
+ return static_cast<ExpirationAction>( m_nativeptr->get()->getEntryTimeToLiveAction( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic <class TKey, class TValue>
System::Int32 Client::RegionAttributes<TKey, TValue>::EntryIdleTimeout::get()
{
- return NativePtr->getEntryIdleTimeout( );
+ try
+ {
+ return m_nativeptr->get()->getEntryIdleTimeout( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic <class TKey, class TValue>
ExpirationAction Client::RegionAttributes<TKey, TValue>::EntryIdleTimeoutAction::get()
{
- return static_cast<ExpirationAction>( NativePtr->getEntryIdleTimeoutAction( ) );
+ try
+ {
+ return static_cast<ExpirationAction>( m_nativeptr->get()->getEntryIdleTimeoutAction( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic <class TKey, class TValue>
bool Client::RegionAttributes<TKey, TValue>::CachingEnabled::get()
{
- return NativePtr->getCachingEnabled( );
+ try
+ {
+ return m_nativeptr->get()->getCachingEnabled( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic <class TKey, class TValue>
bool Client::RegionAttributes<TKey, TValue>::CloningEnabled::get()
{
- return NativePtr->getCloningEnabled( );
+ try
+ {
+ return m_nativeptr->get()->getCloningEnabled( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic <class TKey, class TValue>
System::Int32 Client::RegionAttributes<TKey, TValue>::InitialCapacity::get()
{
- return NativePtr->getInitialCapacity( );
+ try
+ {
+ return m_nativeptr->get()->getInitialCapacity( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic <class TKey, class TValue>
Single Client::RegionAttributes<TKey, TValue>::LoadFactor::get()
{
- return NativePtr->getLoadFactor( );
+ try
+ {
+ return m_nativeptr->get()->getLoadFactor( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic <class TKey, class TValue>
System::Int32 Client::RegionAttributes<TKey, TValue>::ConcurrencyLevel::get()
{
- return NativePtr->getConcurrencyLevel( );
+ try
+ {
+ return m_nativeptr->get()->getConcurrencyLevel( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic <class TKey, class TValue>
System::UInt32 Client::RegionAttributes<TKey, TValue>::LruEntriesLimit::get()
{
- return NativePtr->getLruEntriesLimit( );
+ try
+ {
+ return m_nativeptr->get()->getLruEntriesLimit( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic <class TKey, class TValue>
DiskPolicyType Client::RegionAttributes<TKey, TValue>::DiskPolicy::get()
{
- return static_cast<DiskPolicyType>( NativePtr->getDiskPolicy( ) );
+ try
+ {
+ return static_cast<DiskPolicyType>( m_nativeptr->get()->getDiskPolicy( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic <class TKey, class TValue>
ExpirationAction Client::RegionAttributes<TKey, TValue>::LruEvictionAction::get()
{
- return static_cast<ExpirationAction>( NativePtr->getLruEvictionAction( ) );
+ try
+ {
+ return static_cast<ExpirationAction>( m_nativeptr->get()->getLruEvictionAction( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic <class TKey, class TValue>
String^ Client::RegionAttributes<TKey, TValue>::CacheLoaderLibrary::get()
{
- return ManagedString::Get( NativePtr->getCacheLoaderLibrary( ) );
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getCacheLoaderLibrary( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic <class TKey, class TValue>
String^ Client::RegionAttributes<TKey, TValue>::CacheLoaderFactory::get()
{
- return ManagedString::Get( NativePtr->getCacheLoaderFactory( ) );
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getCacheLoaderFactory( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic <class TKey, class TValue>
String^ Client::RegionAttributes<TKey, TValue>::CacheListenerLibrary::get()
{
- return ManagedString::Get( NativePtr->getCacheListenerLibrary( ) );
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getCacheListenerLibrary( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic <class TKey, class TValue>
String^ Client::RegionAttributes<TKey, TValue>::PartitionResolverLibrary::get()
{
- return ManagedString::Get( NativePtr->getPartitionResolverLibrary( ) );
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getPartitionResolverLibrary( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic <class TKey, class TValue>
String^ Client::RegionAttributes<TKey, TValue>::PartitionResolverFactory::get()
{
- return ManagedString::Get( NativePtr->getPartitionResolverFactory( ) );
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getPartitionResolverFactory( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic <class TKey, class TValue>
String^ Client::RegionAttributes<TKey, TValue>::CacheListenerFactory::get()
{
- return ManagedString::Get( NativePtr->getCacheListenerFactory( ) );
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getCacheListenerFactory( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic <class TKey, class TValue>
String^ Client::RegionAttributes<TKey, TValue>::CacheWriterLibrary::get()
{
- return ManagedString::Get( NativePtr->getCacheWriterLibrary( ) );
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getCacheWriterLibrary( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic <class TKey, class TValue>
String^ Client::RegionAttributes<TKey, TValue>::CacheWriterFactory::get()
{
- return ManagedString::Get( NativePtr->getCacheWriterFactory( ) );
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getCacheWriterFactory( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic <class TKey, class TValue>
bool Client::RegionAttributes<TKey, TValue>::Equals(Client::RegionAttributes<TKey, TValue>^ other)
{
- apache::geode::client::RegionAttributes* otherPtr =
- GetNativePtrFromSBWrapGeneric<apache::geode::client::RegionAttributes>( other );
- if (_NativePtr != nullptr && otherPtr != nullptr) {
- return NativePtr->operator==(*otherPtr);
+ auto otherPtr = other->GetNative();
+ try
+ {
+ if (GetNative() != __nullptr && otherPtr != __nullptr) {
+ return m_nativeptr->get()->operator==(*otherPtr);
+ }
+ return (GetNative() == otherPtr);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
}
- return (_NativePtr == otherPtr);
}
generic <class TKey, class TValue>
bool Client::RegionAttributes<TKey, TValue>::Equals(Object^ other)
{
- apache::geode::client::RegionAttributes* otherPtr = GetNativePtrFromSBWrapGeneric<apache::geode::client::
- RegionAttributes>( dynamic_cast<Client::RegionAttributes<TKey, TValue>^>( other ) );
- if (_NativePtr != nullptr && otherPtr != nullptr) {
- return NativePtr->operator==(*otherPtr);
- }
- return (_NativePtr == otherPtr);
+ return Equals(dynamic_cast<Client::RegionAttributes<TKey, TValue>^>(other));
}
generic <class TKey, class TValue>
void Client::RegionAttributes<TKey, TValue>::ValidateSerializableAttributes()
{
- NativePtr->validateSerializableAttributes( );
+ try
+ {
+ m_nativeptr->get()->validateSerializableAttributes( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic <class TKey, class TValue>
String^ Client::RegionAttributes<TKey, TValue>::Endpoints::get()
{
- return ManagedString::Get( NativePtr->getEndpoints( ) );
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getEndpoints( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic <class TKey, class TValue>
String^ Client::RegionAttributes<TKey, TValue>::PoolName::get()
{
- return ManagedString::Get( NativePtr->getPoolName( ) );
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getPoolName( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic <class TKey, class TValue>
Boolean Client::RegionAttributes<TKey, TValue>::ClientNotificationEnabled::get()
{
- return NativePtr->getClientNotificationEnabled( );
+ try
+ {
+ return m_nativeptr->get()->getClientNotificationEnabled( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic <class TKey, class TValue>
String^ Client::RegionAttributes<TKey, TValue>::PersistenceLibrary::get()
{
- return ManagedString::Get( NativePtr->getPersistenceLibrary( ) );
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getPersistenceLibrary( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic <class TKey, class TValue>
String^ Client::RegionAttributes<TKey, TValue>::PersistenceFactory::get()
{
- return ManagedString::Get( NativePtr->getPersistenceFactory( ) );
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getPersistenceFactory( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic <class TKey, class TValue>
bool Client::RegionAttributes<TKey, TValue>::ConcurrencyChecksEnabled::get()
{
- return NativePtr->getConcurrencyChecksEnabled( );
+ try
+ {
+ return m_nativeptr->get()->getConcurrencyChecksEnabled( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic <class TKey, class TValue>
Properties<String^, String^>^Client::RegionAttributes<TKey, TValue>::PersistenceProperties::get()
{
- apache::geode::client::PropertiesPtr& nativeptr(
- NativePtr->getPersistenceProperties());
- return Properties<String^, String^>::Create<String^, String^>(nativeptr.get());
+ try
+ {
+ return Properties<String^, String^>::Create(m_nativeptr->get()->getPersistenceProperties());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/RegionAttributes.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/RegionAttributes.hpp b/src/clicache/src/RegionAttributes.hpp
index 05e413f..da47fc3 100644
--- a/src/clicache/src/RegionAttributes.hpp
+++ b/src/clicache/src/RegionAttributes.hpp
@@ -18,8 +18,11 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/RegionAttributes.hpp>
-//#include "impl/NativeWrapper.hpp"
+#include "end_native.hpp"
+
+#include "native_shared_ptr.hpp"
#include "IGeodeSerializable.hpp"
#include "ExpirationAction.hpp"
#include "DiskPolicyType.hpp"
@@ -39,11 +42,7 @@ namespace Apache
{
namespace Client
{
-
- //interface class ICacheLoader;
- //interface class ICacheWriter;
- //interface class ICacheListener;
- //interface class IPartitionResolver;
+ namespace native = apache::geode::client;
/// <summary>
/// Defines attributes for configuring a region.
@@ -68,7 +67,7 @@ namespace Apache
/// <seealso cref="Region.Attributes" />
generic <class TKey, class TValue>
public ref class RegionAttributes sealed
- : public Client::Internal::SBWrap<apache::geode::client::RegionAttributes>, public IGeodeSerializable
+ : public IGeodeSerializable
{
public:
@@ -481,12 +480,16 @@ namespace Apache
/// <returns>
/// The managed wrapper object; null if the native pointer is null.
/// </returns>
- inline static RegionAttributes<TKey, TValue>^ Create(apache::geode::client::RegionAttributes* nativeptr)
+ inline static RegionAttributes<TKey, TValue>^ Create(native::RegionAttributesPtr nativeptr)
{
- return (nativeptr != nullptr ?
- gcnew RegionAttributes<TKey, TValue>(nativeptr) : nullptr);
+ return __nullptr == nativeptr ? nullptr :
+ gcnew RegionAttributes<TKey, TValue>( nativeptr );
}
+ std::shared_ptr<native::RegionAttributes> GetNative()
+ {
+ return m_nativeptr->get_shared_ptr();
+ }
private:
@@ -494,8 +497,12 @@ namespace Apache
/// Private constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline RegionAttributes<TKey, TValue>(apache::geode::client::RegionAttributes* nativeptr)
- : SBWrap(nativeptr) { }
+ inline RegionAttributes<TKey, TValue>(native::RegionAttributesPtr nativeptr)
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::RegionAttributes>(nativeptr);
+ }
+
+ native_shared_ptr<native::RegionAttributes>^ m_nativeptr;
};
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/RegionEntry.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/RegionEntry.cpp b/src/clicache/src/RegionEntry.cpp
index cfde37d..95b5b57 100644
--- a/src/clicache/src/RegionEntry.cpp
+++ b/src/clicache/src/RegionEntry.cpp
@@ -32,44 +32,70 @@ namespace Apache
generic<class TKey, class TValue>
TKey RegionEntry<TKey, TValue>::Key::get( )
- {
- apache::geode::client::CacheableKeyPtr& nativeptr( NativePtr->getKey( ) );
-
- return Serializable::GetManagedValueGeneric<TKey>( nativeptr );
+ {
+ try
+ {
+ return Serializable::GetManagedValueGeneric<TKey>(m_nativeptr->get()->getKey());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TValue>
TValue RegionEntry<TKey, TValue>::Value::get( )
{
- apache::geode::client::CacheablePtr& nativeptr( NativePtr->getValue( ) );
-
- return Serializable::GetManagedValueGeneric<TValue>( nativeptr );
+ try
+ {
+ return Serializable::GetManagedValueGeneric<TValue>(m_nativeptr->get()->getValue());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TValue>
IRegion<TKey, TValue>^ RegionEntry<TKey, TValue>::Region::get( )
{
- apache::geode::client::RegionPtr rptr;
-
- NativePtr->getRegion( rptr );
- return Apache::Geode::Client::Region<TKey, TValue>::Create( rptr.ptr( ) );
+ try
+ {
+ return Apache::Geode::Client::Region<TKey, TValue>::Create(m_nativeptr->get()->getRegion());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TValue>
Apache::Geode::Client::CacheStatistics^ RegionEntry<TKey, TValue>::Statistics::get( )
{
apache::geode::client::CacheStatisticsPtr nativeptr;
-
- NativePtr->getStatistics( nativeptr );
- return Apache::Geode::Client::CacheStatistics::Create( nativeptr.ptr( ) );
+ try
+ {
+ m_nativeptr->get()->getStatistics( nativeptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ return Apache::Geode::Client::CacheStatistics::Create( nativeptr);
}
generic<class TKey, class TValue>
bool RegionEntry<TKey, TValue>::IsDestroyed::get( )
{
- return NativePtr->isDestroyed( );
+ try
+ {
+ return m_nativeptr->get()->isDestroyed( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
} // namespace Client
} // namespace Geode
} // namespace Apache
-
- } //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/RegionEntry.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/RegionEntry.hpp b/src/clicache/src/RegionEntry.hpp
index 767a052..85c933f 100644
--- a/src/clicache/src/RegionEntry.hpp
+++ b/src/clicache/src/RegionEntry.hpp
@@ -18,8 +18,11 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/RegionEntry.hpp>
-#include "impl/NativeWrapper.hpp"
+#include "end_native.hpp"
+
+#include "native_shared_ptr.hpp"
//#include "ICacheableKey.hpp"
#include "IRegion.hpp"
@@ -31,6 +34,7 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
//ref class Region;
ref class CacheStatistics;
@@ -51,7 +55,6 @@ namespace Apache
/// </remarks>
generic<class TKey, class TValue>
public ref class RegionEntry sealed
- : public Internal::SBWrap<apache::geode::client::RegionEntry>
{
public:
@@ -159,10 +162,10 @@ namespace Apache
/// <returns>
/// The managed wrapper object; null if the native pointer is null.
/// </returns>
- inline static Client::RegionEntry<TKey, TValue>^ Create( apache::geode::client::RegionEntry* nativeptr )
+ inline static Client::RegionEntry<TKey, TValue>^ Create( native::RegionEntryPtr nativeptr )
{
- return ( nativeptr != nullptr ?
- gcnew Client::RegionEntry<TKey, TValue>( nativeptr ) : nullptr );
+ return __nullptr == nativeptr ? nullptr :
+ gcnew RegionEntry<TKey, TValue>( nativeptr );
}
@@ -172,8 +175,12 @@ namespace Apache
/// Private constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline RegionEntry( apache::geode::client::RegionEntry* nativeptr )
- : SBWrap( nativeptr ) { }
+ inline RegionEntry( native::RegionEntryPtr nativeptr )
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::RegionEntry>(nativeptr);
+ }
+
+ native_shared_ptr<native::RegionEntry>^ m_nativeptr;
};
} // namespace Client
} // namespace Geode
[23/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from cppcache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientPutGetAll.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientPutGetAll.hpp b/src/cppcache/integration-test/ThinClientPutGetAll.hpp
index e7a74f8..53c0a2a 100644
--- a/src/cppcache/integration-test/ThinClientPutGetAll.hpp
+++ b/src/cppcache/integration-test/ThinClientPutGetAll.hpp
@@ -60,7 +60,7 @@ const char* _regionNames[] = {"DistRegionAck"};
#include "LocatorHelper.hpp"
void verifyGetAll(RegionPtr region, bool addToLocalCache, const char** _vals,
- int startIndex, CacheablePtr callBack = NULLPTR) {
+ int startIndex, CacheablePtr callBack = nullptr) {
CacheableKeyPtr keyPtr0 = CacheableKey::create(_keys[0]);
CacheableKeyPtr keyPtr1 = CacheableKey::create(_keys[1]);
CacheableKeyPtr keyPtr2 = CacheableKey::create("keyNotThere");
@@ -74,17 +74,17 @@ void verifyGetAll(RegionPtr region, bool addToLocalCache, const char** _vals,
expected[_keys[0]] = _vals[startIndex + 0];
expected[_keys[1]] = _vals[startIndex + 1];
- HashMapOfCacheablePtr valuesMap(new HashMapOfCacheable());
+ auto valuesMap = std::make_shared<HashMapOfCacheable>();
valuesMap->clear();
- region->getAll(keys1, valuesMap, NULLPTR, addToLocalCache, callBack);
+ region->getAll(keys1, valuesMap, nullptr, addToLocalCache, callBack);
if (valuesMap->size() == keys1.size()) {
char buf[2048];
for (HashMapOfCacheable::Iterator iter = valuesMap->begin();
iter != valuesMap->end(); iter++) {
- CacheableKeyPtr key = dynCast<CacheableKeyPtr>(iter.first());
+ auto key = std::dynamic_pointer_cast<CacheableKey>(iter.first());
const char* actualKey = key->toString()->asChar();
CacheablePtr mVal = iter.second();
- if (mVal != NULLPTR) {
+ if (mVal != nullptr) {
const char* expectedVal = expected[actualKey].c_str();
const char* actualVal = mVal->toString()->asChar();
sprintf(buf, "value from map %s , expected value %s ", actualVal,
@@ -115,7 +115,7 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators,
RegionPtr regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
@@ -131,9 +131,10 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, StepOne_Pooled_Locator)
{
+ // waitForDebugger();
// start 1st client with caching enable true and client notification true
initClientWithPool(true, "__TEST_POOL1__", locatorsG, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
createPooledRegion(_regionNames[0], USE_ACK, locatorsG, poolName, true,
true);
LOG("StepOne_Pooled_Locator complete.");
@@ -144,7 +145,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepTwo_Pooled_Locator)
{
// start 1st client with caching enable true and client notification true
initClientWithPool(true, "__TEST_POOL1__", locatorsG, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
createPooledRegion(_regionNames[0], USE_ACK, locatorsG, poolName, true,
true);
LOG("StepTwo_Pooled_Locator complete.");
@@ -207,7 +208,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, GetAllAfterLocalDestroyRegionOnClientTwo)
// of region.
RegionPtr reg0 = getHelper()->getRegion(_regionNames[0]);
reg0->localDestroyRegion();
- reg0 = NULLPTR;
+ reg0 = nullptr;
getHelper()->createPooledRegion(regionNames[0], USE_ACK, 0,
"__TEST_POOL1__", true, true);
reg0 = getHelper()->getRegion(_regionNames[0]);
@@ -223,7 +224,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, GetAllAfterLocalDestroyRegionOnClientTwo_Pool)
// of region.
RegionPtr reg0 = getHelper()->getRegion(_regionNames[0]);
reg0->localDestroyRegion();
- reg0 = NULLPTR;
+ reg0 = nullptr;
createPooledRegion(_regionNames[0], USE_ACK, locatorsG, poolName, true,
true);
reg0 = getHelper()->getRegion(_regionNames[0]);
@@ -294,16 +295,16 @@ DUNIT_TASK_DEFINITION(CLIENT1, putallAndGetallPdxWithCallBackArg)
// ignore exception
}
- PdxTypes1Ptr p1(new PdxTypes1());
- PdxTypes2Ptr p2(new PdxTypes2());
- PdxTypes3Ptr p3(new PdxTypes3());
- PdxTypes4Ptr p4(new PdxTypes4());
- PdxTypes5Ptr p5(new PdxTypes5());
- PdxTypes6Ptr p6(new PdxTypes6());
- PdxTypes7Ptr p7(new PdxTypes7());
- PdxTypes8Ptr p8(new PdxTypes8());
- PdxTypes9Ptr p9(new PdxTypes9());
- PdxTypes10Ptr p10(new PdxTypes10());
+ auto p1 = std::make_shared<PdxTypes1>();
+ auto p2 = std::make_shared<PdxTypes2>();
+ auto p3 = std::make_shared<PdxTypes3>();
+ auto p4 = std::make_shared<PdxTypes4>();
+ auto p5 = std::make_shared<PdxTypes5>();
+ auto p6 = std::make_shared<PdxTypes6>();
+ auto p7 = std::make_shared<PdxTypes7>();
+ auto p8 = std::make_shared<PdxTypes8>();
+ auto p9 = std::make_shared<PdxTypes9>();
+ auto p10 = std::make_shared<PdxTypes10>();
// putAll from client 1
HashMapOfCacheable map0;
@@ -348,51 +349,61 @@ DUNIT_TASK_DEFINITION(CLIENT1, putallAndGetallPdxWithCallBackArg)
keys1.push_back(CacheableInt32::create(28));
keys1.push_back(CacheableInt32::create(29));
keys1.push_back(CacheableInt32::create(30));
- HashMapOfCacheablePtr valuesMap(new HashMapOfCacheable());
+ auto valuesMap = std::make_shared<HashMapOfCacheable>();
valuesMap->clear();
- regPtr0->getAll(keys1, valuesMap, NULLPTR, true,
+ regPtr0->getAll(keys1, valuesMap, nullptr, true,
CacheableInt32::create(1000));
LOG("GetallPdxWithCallBackArg on Pdx objects completed.");
ASSERT(valuesMap->size() == keys1.size(), "getAll size did not match");
- PdxTypes10Ptr pRet10 = valuesMap->operator[](CacheableInt32::create(30));
+ auto pRet10 = std::dynamic_pointer_cast<PdxTypes10>(
+ valuesMap->operator[](CacheableInt32::create(30)));
ASSERT(p10->equals(pRet10) == true,
"Objects of type PdxTypes10 should be equal");
- PdxTypes9Ptr pRet9 = valuesMap->operator[](CacheableInt32::create(29));
+ auto pRet9 = std::dynamic_pointer_cast<PdxTypes9>(
+ valuesMap->operator[](CacheableInt32::create(29)));
ASSERT(p9->equals(pRet9) == true,
"Objects of type PdxTypes9 should be equal");
- PdxTypes8Ptr pRet8 = valuesMap->operator[](CacheableInt32::create(28));
+ auto pRet8 = std::dynamic_pointer_cast<PdxTypes8>(
+ valuesMap->operator[](CacheableInt32::create(28)));
ASSERT(p8->equals(pRet8) == true,
"Objects of type PdxTypes8 should be equal");
- PdxTypes7Ptr pRet7 = valuesMap->operator[](CacheableInt32::create(27));
+ auto pRet7 = std::dynamic_pointer_cast<PdxTypes7>(
+ valuesMap->operator[](CacheableInt32::create(27)));
ASSERT(p7->equals(pRet7) == true,
"Objects of type PdxTypes7 should be equal");
- PdxTypes6Ptr pRet6 = valuesMap->operator[](CacheableInt32::create(26));
+ auto pRet6 = std::dynamic_pointer_cast<PdxTypes6>(
+ valuesMap->operator[](CacheableInt32::create(26)));
ASSERT(p6->equals(pRet6) == true,
"Objects of type PdxTypes6 should be equal");
- PdxTypes5Ptr pRet5 = valuesMap->operator[](CacheableInt32::create(25));
+ auto pRet5 = std::dynamic_pointer_cast<PdxTypes5>(
+ valuesMap->operator[](CacheableInt32::create(25)));
ASSERT(p5->equals(pRet5) == true,
"Objects of type PdxTypes5 should be equal");
- PdxTypes4Ptr pRet4 = valuesMap->operator[](CacheableInt32::create(24));
+ auto pRet4 = std::dynamic_pointer_cast<PdxTypes4>(
+ valuesMap->operator[](CacheableInt32::create(24)));
ASSERT(p4->equals(pRet4) == true,
"Objects of type PdxTypes4 should be equal");
- PdxTypes3Ptr pRet3 = valuesMap->operator[](CacheableInt32::create(23));
+ auto pRet3 = std::dynamic_pointer_cast<PdxTypes3>(
+ valuesMap->operator[](CacheableInt32::create(23)));
ASSERT(p3->equals(pRet3) == true,
"Objects of type PdxTypes3 should be equal");
- PdxTypes2Ptr pRet2 = valuesMap->operator[](CacheableInt32::create(22));
+ auto pRet2 = std::dynamic_pointer_cast<PdxTypes2>(
+ valuesMap->operator[](CacheableInt32::create(22)));
ASSERT(p2->equals(pRet2) == true,
"Objects of type PdxTypes2 should be equal");
- PdxTypes1Ptr pRet1 = valuesMap->operator[](CacheableInt32::create(21));
+ auto pRet1 = std::dynamic_pointer_cast<PdxTypes1>(
+ valuesMap->operator[](CacheableInt32::create(21)));
ASSERT(p1->equals(pRet1) == true,
"Objects of type PdxTypes1 should be equal");
@@ -461,16 +472,16 @@ DUNIT_TASK_DEFINITION(CLIENT1, putallAndGetallPdx)
// ignore exception
}
- PdxTypes1Ptr p1(new PdxTypes1());
- PdxTypes2Ptr p2(new PdxTypes2());
- PdxTypes3Ptr p3(new PdxTypes3());
- PdxTypes4Ptr p4(new PdxTypes4());
- PdxTypes5Ptr p5(new PdxTypes5());
- PdxTypes6Ptr p6(new PdxTypes6());
- PdxTypes7Ptr p7(new PdxTypes7());
- PdxTypes8Ptr p8(new PdxTypes8());
- PdxTypes9Ptr p9(new PdxTypes9());
- PdxTypes10Ptr p10(new PdxTypes10());
+ auto p1 = std::make_shared<PdxTypes1>();
+ auto p2 = std::make_shared<PdxTypes2>();
+ auto p3 = std::make_shared<PdxTypes3>();
+ auto p4 = std::make_shared<PdxTypes4>();
+ auto p5 = std::make_shared<PdxTypes5>();
+ auto p6 = std::make_shared<PdxTypes6>();
+ auto p7 = std::make_shared<PdxTypes7>();
+ auto p8 = std::make_shared<PdxTypes8>();
+ auto p9 = std::make_shared<PdxTypes9>();
+ auto p10 = std::make_shared<PdxTypes10>();
// putAll from client 1
HashMapOfCacheable map0;
@@ -513,50 +524,60 @@ DUNIT_TASK_DEFINITION(CLIENT1, putallAndGetallPdx)
keys1.push_back(CacheableInt32::create(28));
keys1.push_back(CacheableInt32::create(29));
keys1.push_back(CacheableInt32::create(30));
- HashMapOfCacheablePtr valuesMap(new HashMapOfCacheable());
+ auto valuesMap = std::make_shared<HashMapOfCacheable>();
valuesMap->clear();
- regPtr0->getAll(keys1, valuesMap, NULLPTR, true);
+ regPtr0->getAll(keys1, valuesMap, nullptr, true);
LOG("getAll on Pdx objects completed.");
ASSERT(valuesMap->size() == keys1.size(), "getAll size did not match");
- PdxTypes10Ptr pRet10 = valuesMap->operator[](CacheableInt32::create(30));
+ auto pRet10 = std::dynamic_pointer_cast<PdxTypes10>(
+ valuesMap->operator[](CacheableInt32::create(30)));
ASSERT(p10->equals(pRet10) == true,
"Objects of type PdxTypes10 should be equal");
- PdxTypes9Ptr pRet9 = valuesMap->operator[](CacheableInt32::create(29));
+ auto pRet9 = std::dynamic_pointer_cast<PdxTypes9>(
+ valuesMap->operator[](CacheableInt32::create(29)));
ASSERT(p9->equals(pRet9) == true,
"Objects of type PdxTypes9 should be equal");
- PdxTypes8Ptr pRet8 = valuesMap->operator[](CacheableInt32::create(28));
+ auto pRet8 = std::dynamic_pointer_cast<PdxTypes8>(
+ valuesMap->operator[](CacheableInt32::create(28)));
ASSERT(p8->equals(pRet8) == true,
"Objects of type PdxTypes8 should be equal");
- PdxTypes7Ptr pRet7 = valuesMap->operator[](CacheableInt32::create(27));
+ auto pRet7 = std::dynamic_pointer_cast<PdxTypes7>(
+ valuesMap->operator[](CacheableInt32::create(27)));
ASSERT(p7->equals(pRet7) == true,
"Objects of type PdxTypes7 should be equal");
- PdxTypes6Ptr pRet6 = valuesMap->operator[](CacheableInt32::create(26));
+ auto pRet6 = std::dynamic_pointer_cast<PdxTypes6>(
+ valuesMap->operator[](CacheableInt32::create(26)));
ASSERT(p6->equals(pRet6) == true,
"Objects of type PdxTypes6 should be equal");
- PdxTypes5Ptr pRet5 = valuesMap->operator[](CacheableInt32::create(25));
+ auto pRet5 = std::dynamic_pointer_cast<PdxTypes5>(
+ valuesMap->operator[](CacheableInt32::create(25)));
ASSERT(p5->equals(pRet5) == true,
"Objects of type PdxTypes5 should be equal");
- PdxTypes4Ptr pRet4 = valuesMap->operator[](CacheableInt32::create(24));
+ auto pRet4 = std::dynamic_pointer_cast<PdxTypes4>(
+ valuesMap->operator[](CacheableInt32::create(24)));
ASSERT(p4->equals(pRet4) == true,
"Objects of type PdxTypes4 should be equal");
- PdxTypes3Ptr pRet3 = valuesMap->operator[](CacheableInt32::create(23));
+ auto pRet3 = std::dynamic_pointer_cast<PdxTypes3>(
+ valuesMap->operator[](CacheableInt32::create(23)));
ASSERT(p3->equals(pRet3) == true,
"Objects of type PdxTypes3 should be equal");
- PdxTypes2Ptr pRet2 = valuesMap->operator[](CacheableInt32::create(22));
+ auto pRet2 = std::dynamic_pointer_cast<PdxTypes2>(
+ valuesMap->operator[](CacheableInt32::create(22)));
ASSERT(p2->equals(pRet2) == true,
"Objects of type PdxTypes2 should be equal");
- PdxTypes1Ptr pRet1 = valuesMap->operator[](CacheableInt32::create(21));
+ auto pRet1 = std::dynamic_pointer_cast<PdxTypes1>(
+ valuesMap->operator[](CacheableInt32::create(21)));
ASSERT(p1->equals(pRet1) == true,
"Objects of type PdxTypes1 should be equal");
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientRIwithlocalRegionDestroy.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientRIwithlocalRegionDestroy.hpp b/src/cppcache/integration-test/ThinClientRIwithlocalRegionDestroy.hpp
index 39d2da2..c7ca2fd 100644
--- a/src/cppcache/integration-test/ThinClientRIwithlocalRegionDestroy.hpp
+++ b/src/cppcache/integration-test/ThinClientRIwithlocalRegionDestroy.hpp
@@ -93,8 +93,8 @@ class SimpleCacheListener : public CacheListener {
};
typedef SharedPtr<SimpleCacheListener> SimpleCacheListenerPtr;
-SimpleCacheListenerPtr eventListener1 = NULLPTR;
-SimpleCacheListenerPtr eventListener2 = NULLPTR;
+SimpleCacheListenerPtr eventListener1 = nullptr;
+SimpleCacheListenerPtr eventListener2 = nullptr;
void initClient(const bool isthinClient) {
if (cacheHelper == NULL) {
@@ -124,7 +124,7 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators,
RegionPtr regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
@@ -159,12 +159,12 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepOne_Pool_Locator)
// Attache Listener
RegionPtr regionPtr0 = getHelper()->getRegion(regionNames[0]);
AttributesMutatorPtr attrMutatorPtr = regionPtr0->getAttributesMutator();
- eventListener1 = new SimpleCacheListener();
+ eventListener1 = std::make_shared<SimpleCacheListener>();
attrMutatorPtr->setCacheListener(eventListener1);
AttributesMutatorPtr subregAttrMutatorPtr =
subregPtr1->getAttributesMutator();
- eventListener2 = new SimpleCacheListener();
+ eventListener2 = std::make_shared<SimpleCacheListener>();
subregAttrMutatorPtr->setCacheListener(eventListener2);
LOG("StepOne_Pool complete.");
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientRegex.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientRegex.hpp b/src/cppcache/integration-test/ThinClientRegex.hpp
index fe4debe..c7696d3 100644
--- a/src/cppcache/integration-test/ThinClientRegex.hpp
+++ b/src/cppcache/integration-test/ThinClientRegex.hpp
@@ -84,7 +84,7 @@ void _verifyEntry(const char* name, const char* key, const char* val,
free(buf);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
CacheableKeyPtr keyPtr = createKey(key);
@@ -133,10 +133,9 @@ void _verifyEntry(const char* name, const char* key, const char* val,
}
if (val != NULL) {
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
- ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null.");
+ ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
sprintf(buf, "In verify loop, get returned %s for key %s",
checkPtr->asChar(), key);
@@ -204,7 +203,7 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators,
RegionPtr regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
void createEntry(const char* name, const char* key, const char* value = NULL) {
@@ -220,7 +219,7 @@ void createEntry(const char* name, const char* key, const char* value = NULL) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
@@ -245,7 +244,7 @@ void updateEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
ASSERT(regPtr->containsValueForKey(keyPtr),
@@ -271,17 +270,16 @@ void doNetsearch(const char* name, const char* key, const char* value) {
RegionPtr regPtr = getHelper()->getRegion(name);
fprintf(stdout, "netsearch region %s\n", regPtr->getName());
fflush(stdout);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
ASSERT(!regPtr->containsValueForKey(keyPtr),
"Value should not have been found in region.");
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); // force a netsearch
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr)); // force a netsearch
- if (checkPtr != NULLPTR) {
+ if (checkPtr != nullptr) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientRegex2.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientRegex2.hpp b/src/cppcache/integration-test/ThinClientRegex2.hpp
index 4d93d56..db199fa 100644
--- a/src/cppcache/integration-test/ThinClientRegex2.hpp
+++ b/src/cppcache/integration-test/ThinClientRegex2.hpp
@@ -85,7 +85,7 @@ void _verifyEntry(const char* name, const char* key, const char* val,
free(buf);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
CacheableKeyPtr keyPtr = createKey(key);
@@ -134,10 +134,9 @@ void _verifyEntry(const char* name, const char* key, const char* val,
}
if (val != NULL) {
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
- ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null.");
+ ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
sprintf(buf, "In verify loop, get returned %s for key %s",
checkPtr->asChar(), key);
@@ -200,9 +199,9 @@ void createRegion(const char* name, bool ackMode,
LOG("createRegion() entered.");
fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
fflush(stdout);
- RegionPtr regPtr = getHelper()->createRegion(name, ackMode, true, NULLPTR,
+ RegionPtr regPtr = getHelper()->createRegion(name, ackMode, true, nullptr,
clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
void createPooledRegion(const char* name, bool ackMode, const char* locators,
@@ -215,7 +214,7 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators,
RegionPtr regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
void createEntry(const char* name, const char* key, const char* value = NULL) {
@@ -231,7 +230,7 @@ void createEntry(const char* name, const char* key, const char* value = NULL) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
@@ -256,7 +255,7 @@ void updateEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
ASSERT(regPtr->containsValueForKey(keyPtr),
@@ -282,17 +281,16 @@ void doNetsearch(const char* name, const char* key, const char* value) {
RegionPtr regPtr = getHelper()->getRegion(name);
fprintf(stdout, "netsearch region %s\n", regPtr->getName());
fflush(stdout);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
ASSERT(!regPtr->containsValueForKey(keyPtr),
"Value should not have been found in region.");
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); // force a netsearch
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr)); // force a netsearch
- if (checkPtr != NULLPTR) {
+ if (checkPtr != nullptr) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientRegex3.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientRegex3.hpp b/src/cppcache/integration-test/ThinClientRegex3.hpp
index ed4b287..bae3756 100644
--- a/src/cppcache/integration-test/ThinClientRegex3.hpp
+++ b/src/cppcache/integration-test/ThinClientRegex3.hpp
@@ -85,7 +85,7 @@ void _verifyEntry(const char* name, const char* key, const char* val,
free(buf);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
CacheableKeyPtr keyPtr = createKey(key);
@@ -134,10 +134,10 @@ void _verifyEntry(const char* name, const char* key, const char* val,
}
if (val != NULL) {
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
+ auto checkPtr =
+ std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
- ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null.");
+ ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
sprintf(buf, "In verify loop, get returned %s for key %s",
checkPtr->asChar(), key);
@@ -201,8 +201,8 @@ void createRegion(const char* name, bool ackMode, const char* endpoints,
fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
fflush(stdout);
RegionPtr regPtr = getHelper()->createRegion(
- name, ackMode, true, NULLPTR, endpoints, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ name, ackMode, true, nullptr, endpoints, clientNotificationEnabled);
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
void createPooledRegion(const char* name, bool ackMode, const char* locators,
@@ -215,7 +215,7 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators,
RegionPtr regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
void createEntry(const char* name, const char* key, const char* value = NULL) {
@@ -231,7 +231,7 @@ void createEntry(const char* name, const char* key, const char* value = NULL) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
@@ -256,7 +256,7 @@ void updateEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
ASSERT(regPtr->containsValueForKey(keyPtr),
@@ -282,17 +282,17 @@ void doNetsearch(const char* name, const char* key, const char* value) {
RegionPtr regPtr = getHelper()->getRegion(name);
fprintf(stdout, "netsearch region %s\n", regPtr->getName());
fflush(stdout);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
ASSERT(!regPtr->containsValueForKey(keyPtr),
"Value should not have been found in region.");
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); // force a netsearch
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(
+ regPtr->get(keyPtr)); // force a netsearch
- if (checkPtr != NULLPTR) {
+ if (checkPtr != nullptr) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientRemoveAll.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientRemoveAll.hpp b/src/cppcache/integration-test/ThinClientRemoveAll.hpp
index b112f2e..b86420f 100644
--- a/src/cppcache/integration-test/ThinClientRemoveAll.hpp
+++ b/src/cppcache/integration-test/ThinClientRemoveAll.hpp
@@ -89,8 +89,8 @@ void createRegion(const char* name, bool ackMode, const char* endpoints,
fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
fflush(stdout);
RegionPtr regPtr = getHelper()->createRegion(
- name, ackMode, isCacheEnabled, NULLPTR, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ name, ackMode, isCacheEnabled, nullptr, clientNotificationEnabled);
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
@@ -101,8 +101,8 @@ void createRegionLocal(const char* name, bool ackMode, const char* endpoints,
fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
fflush(stdout);
RegionPtr regPtr = getHelper()->createRegion(
- name, ackMode, isCacheEnabled, NULLPTR, clientNotificationEnabled, true);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ name, ackMode, isCacheEnabled, nullptr, clientNotificationEnabled, true);
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
@@ -116,7 +116,7 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators,
RegionPtr regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
@@ -130,7 +130,7 @@ void createPooledRegionConcurrencyCheckDisabled(
RegionPtr regPtr = getHelper()->createPooledRegionConcurrencyCheckDisabled(
name, ackMode, locators, poolname, cachingEnable,
clientNotificationEnabled, concurrencyCheckEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
@@ -209,7 +209,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, removeAllValidation)
}
try {
- regPtr0->removeAll(removeallkeys, NULLPTR);
+ regPtr0->removeAll(removeallkeys, nullptr);
FAIL("Did not get expected IllegalArgumentException exception");
} catch (IllegalArgumentException&) {
LOG("Got expected IllegalArgumentException found exception");
@@ -233,7 +233,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, removeAllValidation)
}
try {
- regPtr0->removeAll(removeallkeys, NULLPTR);
+ regPtr0->removeAll(removeallkeys, nullptr);
} catch (EntryNotFoundException&) {
FAIL("Got un expected entry not found exception");
}
@@ -261,7 +261,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, removeAllValidationLocal)
}
try {
- regPtr0->removeAll(removeallkeys, NULLPTR);
+ regPtr0->removeAll(removeallkeys, nullptr);
FAIL("Did not get expected IllegalArgumentException exception");
} catch (IllegalArgumentException&) {
LOG("Got expected IllegalArgumentException found exception");
@@ -285,7 +285,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, removeAllValidationLocal)
}
try {
- regPtr0->removeAll(removeallkeys, NULLPTR);
+ regPtr0->removeAll(removeallkeys, nullptr);
} catch (EntryNotFoundException&) {
FAIL("Got un expected entry not found exception");
}
@@ -349,10 +349,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, removeAllSequence)
regPtr0->removeAll(removeallkeys);
LOG("removeAll complete");
- ASSERT(regPtr0->get(CacheableKey::create(1)) == NULLPTR, "Key 1 exists");
- ASSERT(regPtr0->get(CacheableKey::create(2)) == NULLPTR, "Key 2 exists");
- ASSERT(regPtr0->get(CacheableKey::create(3)) == NULLPTR, "Key 3 exists");
- ASSERT(regPtr0->get(CacheableKey::create(4)) == NULLPTR, "Key 4 exists");
+ ASSERT(regPtr0->get(CacheableKey::create(1)) == nullptr, "Key 1 exists");
+ ASSERT(regPtr0->get(CacheableKey::create(2)) == nullptr, "Key 2 exists");
+ ASSERT(regPtr0->get(CacheableKey::create(3)) == nullptr, "Key 3 exists");
+ ASSERT(regPtr0->get(CacheableKey::create(4)) == nullptr, "Key 4 exists");
entryMap.clear();
entryMap.insert(CacheableKey::create(5), CacheableInt32::create(5));
@@ -361,8 +361,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, removeAllSequence)
regPtr0->putAll(entryMap);
LOG("putAll2 complete");
- ASSERT(regPtr0->get(CacheableKey::create(5)) != NULLPTR, "Key 5 missing");
- ASSERT(regPtr0->get(CacheableKey::create(6)) != NULLPTR, "Key 6 missing");
+ ASSERT(regPtr0->get(CacheableKey::create(5)) != nullptr, "Key 5 missing");
+ ASSERT(regPtr0->get(CacheableKey::create(6)) != nullptr, "Key 6 missing");
LOG("remove all complete.");
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientSSL.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientSSL.hpp b/src/cppcache/integration-test/ThinClientSSL.hpp
index 0dc8cc4..3f933ad 100644
--- a/src/cppcache/integration-test/ThinClientSSL.hpp
+++ b/src/cppcache/integration-test/ThinClientSSL.hpp
@@ -90,7 +90,7 @@ void _verifyEntry(const char* name, const char* key, const char* val,
free(buf);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
CacheableKeyPtr keyPtr = createKey(key);
@@ -127,10 +127,10 @@ void _verifyEntry(const char* name, const char* key, const char* val,
if (val != NULL) {
LOG(" checkin val");
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
+ auto checkPtr =
+ std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
- ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null.");
+ ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
sprintf(buf, "In verify loop, get returned %s for key %s",
checkPtr->asChar(), key);
@@ -188,7 +188,7 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators,
RegionPtr regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
@@ -202,7 +202,7 @@ void createEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
@@ -227,7 +227,7 @@ void updateEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
ASSERT(regPtr->containsValueForKey(keyPtr),
@@ -253,17 +253,17 @@ void doNetsearch(const char* name, const char* key, const char* value) {
RegionPtr regPtr = getHelper()->getRegion(name);
fprintf(stdout, "netsearch region %s\n", regPtr->getName());
fflush(stdout);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
ASSERT(!regPtr->containsValueForKey(keyPtr),
"Value should not have been found in region.");
CacheablePtr theValue = regPtr->get(keyPtr);
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(theValue); // force a netsearch
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(
+ theValue); // force a netsearch
- if (checkPtr != NULLPTR) {
+ if (checkPtr != nullptr) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
@@ -284,7 +284,7 @@ void invalidateEntry(const char* name, const char* key) {
CacheableKeyPtr keyPtr = CacheableKey::create(key);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
ASSERT(regPtr->containsValueForKey(keyPtr),
@@ -305,7 +305,7 @@ void destroyEntry(const char* name, const char* key) {
CacheableKeyPtr keyPtr = CacheableKey::create(key);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
@@ -354,9 +354,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, CreateRegions1_PoolLocators)
true);
createPooledRegion(regionNames[1], NO_ACK, locatorsG, "__TESTPOOL1_", true);
RegionPtr regPtr = getHelper()->getRegion(regionNames[0]);
- regPtr->registerAllKeys(false, NULLPTR, false, false);
+ regPtr->registerAllKeys(false, nullptr, false, false);
regPtr = getHelper()->getRegion(regionNames[1]);
- regPtr->registerAllKeys(false, NULLPTR, false, false);
+ regPtr->registerAllKeys(false, nullptr, false, false);
LOG("CreateRegions1_PoolLocators complete.");
}
END_TASK_DEFINITION
@@ -367,9 +367,9 @@ DUNIT_TASK_DEFINITION(CLIENT2, CreateRegions2_PoolLocators)
true);
createPooledRegion(regionNames[1], NO_ACK, locatorsG, "__TESTPOOL1_", true);
RegionPtr regPtr = getHelper()->getRegion(regionNames[0]);
- regPtr->registerAllKeys(false, NULLPTR, false, false);
+ regPtr->registerAllKeys(false, nullptr, false, false);
regPtr = getHelper()->getRegion(regionNames[1]);
- regPtr->registerAllKeys(false, NULLPTR, false, false);
+ regPtr->registerAllKeys(false, nullptr, false, false);
LOG("CreateRegions2_PoolLocators complete.");
}
END_TASK_DEFINITION
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientSSLWithPassword.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientSSLWithPassword.hpp b/src/cppcache/integration-test/ThinClientSSLWithPassword.hpp
index b4fef02..5a43fa9 100644
--- a/src/cppcache/integration-test/ThinClientSSLWithPassword.hpp
+++ b/src/cppcache/integration-test/ThinClientSSLWithPassword.hpp
@@ -92,7 +92,7 @@ void _verifyEntry(const char* name, const char* key, const char* val,
free(buf);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
CacheableKeyPtr keyPtr = createKey(key);
@@ -129,10 +129,9 @@ void _verifyEntry(const char* name, const char* key, const char* val,
if (val != NULL) {
LOG(" checkin val");
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
- ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null.");
+ ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
sprintf(buf, "In verify loop, get returned %s for key %s",
checkPtr->asChar(), key);
@@ -187,8 +186,8 @@ void createRegion(const char* name, bool ackMode, const char* endpoints,
fflush(stdout);
// ack, caching
RegionPtr regPtr = getHelper()->createRegion(
- name, ackMode, true, NULLPTR, endpoints, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ name, ackMode, true, nullptr, endpoints, clientNotificationEnabled);
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
@@ -202,7 +201,7 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators,
RegionPtr regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
@@ -216,7 +215,7 @@ void createEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
@@ -241,7 +240,7 @@ void updateEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
ASSERT(regPtr->containsValueForKey(keyPtr),
@@ -267,17 +266,16 @@ void doNetsearch(const char* name, const char* key, const char* value) {
RegionPtr regPtr = getHelper()->getRegion(name);
fprintf(stdout, "netsearch region %s\n", regPtr->getName());
fflush(stdout);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
ASSERT(!regPtr->containsValueForKey(keyPtr),
"Value should not have been found in region.");
CacheablePtr theValue = regPtr->get(keyPtr);
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(theValue); // force a netsearch
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(theValue); // force a netsearch
- if (checkPtr != NULLPTR) {
+ if (checkPtr != nullptr) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
@@ -298,7 +296,7 @@ void invalidateEntry(const char* name, const char* key) {
CacheableKeyPtr keyPtr = CacheableKey::create(key);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
ASSERT(regPtr->containsValueForKey(keyPtr),
@@ -319,7 +317,7 @@ void destroyEntry(const char* name, const char* key) {
CacheableKeyPtr keyPtr = CacheableKey::create(key);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
@@ -368,9 +366,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, CreateRegions1_PoolLocators)
true);
createPooledRegion(regionNames[1], NO_ACK, locatorsG, "__TESTPOOL1_", true);
RegionPtr regPtr = getHelper()->getRegion(regionNames[0]);
- regPtr->registerAllKeys(false, NULLPTR, false, false);
+ regPtr->registerAllKeys(false, nullptr, false, false);
regPtr = getHelper()->getRegion(regionNames[1]);
- regPtr->registerAllKeys(false, NULLPTR, false, false);
+ regPtr->registerAllKeys(false, nullptr, false, false);
LOG("CreateRegions1_PoolLocators complete.");
}
END_TASK_DEFINITION
@@ -381,9 +379,9 @@ DUNIT_TASK_DEFINITION(CLIENT2, CreateRegions2_PoolLocators)
true);
createPooledRegion(regionNames[1], NO_ACK, locatorsG, "__TESTPOOL1_", true);
RegionPtr regPtr = getHelper()->getRegion(regionNames[0]);
- regPtr->registerAllKeys(false, NULLPTR, false, false);
+ regPtr->registerAllKeys(false, nullptr, false, false);
regPtr = getHelper()->getRegion(regionNames[1]);
- regPtr->registerAllKeys(false, NULLPTR, false, false);
+ regPtr->registerAllKeys(false, nullptr, false, false);
LOG("CreateRegions2_PoolLocators complete.");
}
END_TASK_DEFINITION
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientSecurity.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientSecurity.hpp b/src/cppcache/integration-test/ThinClientSecurity.hpp
index c0e726c..14c069e 100644
--- a/src/cppcache/integration-test/ThinClientSecurity.hpp
+++ b/src/cppcache/integration-test/ThinClientSecurity.hpp
@@ -38,7 +38,7 @@ const char* locatorsG =
CacheHelper::getLocatorHostPort(isLocator, isLocalServer, numberOfLocators);
void setCacheListener(const char* regName, const CacheListenerPtr& listener) {
- if (listener != NULLPTR) {
+ if (listener != nullptr) {
RegionPtr reg = getHelper()->getRegion(regName);
AttributesMutatorPtr attrMutator = reg->getAttributesMutator();
attrMutator->setCacheListener(listener);
@@ -47,7 +47,7 @@ void setCacheListener(const char* regName, const CacheListenerPtr& listener) {
void createRegionForSecurity(const char* name, bool ackMode,
bool clientNotificationEnabled = false,
- const CacheListenerPtr& listener = NULLPTR,
+ const CacheListenerPtr& listener = nullptr,
bool caching = true, int connections = -1,
bool isMultiuserMode = false,
int subscriptionRedundancy = -1) {
@@ -57,7 +57,7 @@ void createRegionForSecurity(const char* name, bool ackMode,
char buff[128] = {'\0'};
const char* poolName = name;
- if (PoolManager::find(name) != NULLPTR) {
+ if (PoolManager::find(name) != nullptr) {
static unsigned int index = 0;
sprintf(buff, "%s_%d", poolName, index++);
poolName = buff;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientSecurityHelper.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientSecurityHelper.hpp b/src/cppcache/integration-test/ThinClientSecurityHelper.hpp
index 20d732a..0fce0f3 100644
--- a/src/cppcache/integration-test/ThinClientSecurityHelper.hpp
+++ b/src/cppcache/integration-test/ThinClientSecurityHelper.hpp
@@ -65,7 +65,7 @@ void initCredentialGenerator() {
}
}
- if (credentialGeneratorHandler == NULLPTR) {
+ if (credentialGeneratorHandler == nullptr) {
FAIL("credentialGeneratorHandler is NULL");
}
@@ -121,7 +121,7 @@ void initClientAuth(char UserType) {
credentialGeneratorHandler->getAllowedCredentialsForOps(wr, config, NULL);
printf("User is %s Pass is %s ",
config->find("security-username")->asChar(),
- (config->find("security-password") != NULLPTR
+ (config->find("security-password") != nullptr
? config->find("security-password")->asChar()
: " not set"));
break;
@@ -129,7 +129,7 @@ void initClientAuth(char UserType) {
credentialGeneratorHandler->getAllowedCredentialsForOps(rt, config, NULL);
printf("User is %s Pass is %s ",
config->find("security-username")->asChar(),
- (config->find("security-password") != NULLPTR
+ (config->find("security-password") != nullptr
? config->find("security-password")->asChar()
: " not set"));
break;
@@ -137,7 +137,7 @@ void initClientAuth(char UserType) {
credentialGeneratorHandler->getAllowedCredentialsForOps(ad, config, NULL);
printf("User is %s Pass is %s ",
config->find("security-username")->asChar(),
- (config->find("security-password") != NULLPTR
+ (config->find("security-password") != nullptr
? config->find("security-password")->asChar()
: " not set"));
default:
@@ -199,7 +199,7 @@ class putThread : public ACE_Task_Base {
char buf[20];
char valbuf[20];
if (m_regInt) {
- m_reg->registerAllKeys(false, NULLPTR, true);
+ m_reg->registerAllKeys(false, nullptr, true);
}
if (m_waitTime != 0) {
ACE_OS::sleep(m_waitTime);
@@ -230,7 +230,7 @@ class putThread : public ACE_Task_Base {
m_reg->registerKeys(keys0, false, true);
}
} else if (m_opcode == 6) {
- m_reg->registerRegex("key-[1-3]", false, NULLPTR, true);
+ m_reg->registerRegex("key-[1-3]", false, nullptr, true);
} else {
try {
if (m_isCallBack) {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientTXFailover.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientTXFailover.hpp b/src/cppcache/integration-test/ThinClientTXFailover.hpp
index d30cdb0..e5a26fc 100644
--- a/src/cppcache/integration-test/ThinClientTXFailover.hpp
+++ b/src/cppcache/integration-test/ThinClientTXFailover.hpp
@@ -85,7 +85,7 @@ void _verifyEntry(const char* name, const char* key, const char* val,
free(buf);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
CacheableKeyPtr keyPtr = createKey(key);
@@ -119,10 +119,9 @@ void _verifyEntry(const char* name, const char* key, const char* val,
}
if (val != NULL) {
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
- ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null.");
+ ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
sprintf(buf, "In verify loop, get returned %s for key %s",
checkPtr->asChar(), key);
@@ -156,8 +155,8 @@ void createRegion(const char* name, bool ackMode, const char* endpoints,
fflush(stdout);
// ack, caching
RegionPtr regPtr = getHelper()->createRegion(
- name, ackMode, true, NULLPTR, endpoints, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ name, ackMode, true, nullptr, endpoints, clientNotificationEnabled);
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
void createPooledRegion(const char* name, bool ackMode, const char* locators,
@@ -170,7 +169,7 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators,
RegionPtr regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
@@ -184,7 +183,7 @@ void createPooledRegionSticky(const char* name, bool ackMode,
RegionPtr regPtr = getHelper()->createPooledRegionSticky(
name, ackMode, locators, poolname, cachingEnable,
clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
@@ -198,7 +197,7 @@ void createEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
// ASSERT( !regPtr->containsKey( keyPtr ), "Key should not have been found in
// region." );
@@ -223,7 +222,7 @@ void updateEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
// ASSERT( regPtr->containsKeyOnServer( keyPtr ), "Key should have been found
// in region." );
@@ -250,17 +249,16 @@ void doNetsearch(const char* name, const char* key, const char* value) {
RegionPtr regPtr = getHelper()->getRegion(name);
fprintf(stdout, "netsearch region %s\n", regPtr->getName());
fflush(stdout);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
// ASSERT( !regPtr->containsKey( keyPtr ), "Key should not have been found in
// region." );
// ASSERT( !regPtr->containsValueForKey( keyPtr ), "Value should not have been
// found in region." );
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); // force a netsearch
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr)); // force a netsearch
- if (checkPtr != NULLPTR) {
+ if (checkPtr != nullptr) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientTransactions.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientTransactions.hpp b/src/cppcache/integration-test/ThinClientTransactions.hpp
index d8f4c46..8745977 100644
--- a/src/cppcache/integration-test/ThinClientTransactions.hpp
+++ b/src/cppcache/integration-test/ThinClientTransactions.hpp
@@ -104,7 +104,7 @@ void _verifyEntry(const char* name, const char* key, const char* val,
free(buf);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
CacheableKeyPtr keyPtr = createKey(key);
@@ -142,10 +142,10 @@ void _verifyEntry(const char* name, const char* key, const char* val,
}
if (val != NULL) {
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
+ auto checkPtr =
+ std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
- ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null.");
+ ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
sprintf(buf, "In verify loop, get returned %s for key %s",
checkPtr->asChar(), key);
@@ -199,9 +199,9 @@ void createRegion(const char* name, bool ackMode, const char* endpoints,
fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
fflush(stdout);
RegionPtr regPtr =
- getHelper()->createRegion(name, ackMode, cachingEnable, NULLPTR,
+ getHelper()->createRegion(name, ackMode, cachingEnable, nullptr,
endpoints, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
void createPooledRegion(const char* name, bool ackMode, const char* locators,
@@ -214,7 +214,7 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators,
RegionPtr regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
@@ -228,7 +228,7 @@ void createPooledRegionSticky(const char* name, bool ackMode,
RegionPtr regPtr = getHelper()->createPooledRegionSticky(
name, ackMode, locators, poolname, cachingEnable,
clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
@@ -242,7 +242,7 @@ void createEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
@@ -289,7 +289,7 @@ void updateEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
ASSERT(regPtr->containsValueForKey(keyPtr),
@@ -314,12 +314,12 @@ void doGetAgain(const char* name, const char* key, const char* value) {
RegionPtr regPtr = getHelper()->getRegion(name);
fprintf(stdout, "get region name%s\n", regPtr->getName());
fflush(stdout);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); // force a netsearch
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(
+ regPtr->get(keyPtr)); // force a netsearch
- if (checkPtr != NULLPTR) {
+ if (checkPtr != nullptr) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In doGetAgain, get returned %s for key %s",
@@ -346,7 +346,7 @@ void doNetsearch(const char* name, const char* key, const char* value) {
RegionPtr regPtr = getHelper()->getRegion(name);
fprintf(stdout, "netsearch region %s\n", regPtr->getName());
fflush(stdout);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
if (count == 0) {
ASSERT(!regPtr->containsKey(keyPtr),
@@ -355,10 +355,10 @@ void doNetsearch(const char* name, const char* key, const char* value) {
"Value should not have been found in region.");
count++;
}
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); // force a netsearch
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(
+ regPtr->get(keyPtr)); // force a netsearch
- if (checkPtr != NULLPTR) {
+ if (checkPtr != nullptr) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
@@ -399,7 +399,7 @@ class SuspendTransactionThread : public ACE_Task_Base {
public:
SuspendTransactionThread(bool sleep, ACE_Auto_Event* txEvent)
- : m_suspendedTransaction(NULLPTR), m_sleep(sleep), m_txEvent(txEvent) {}
+ : m_suspendedTransaction(nullptr), m_sleep(sleep), m_txEvent(txEvent) {}
int svc(void) {
char buf[1024];
@@ -457,7 +457,7 @@ class ResumeTransactionThread : public ACE_Task_Base {
LOG(buf);
RegionPtr regPtr0 = getHelper()->getRegion(regionNames[0]);
- THREADERRORCHECK(regPtr0 != NULLPTR,
+ THREADERRORCHECK(regPtr0 != nullptr,
"In ResumeTransactionThread - Region not found.");
CacheableKeyPtr keyPtr4 = createKey(keys[4]);
@@ -465,7 +465,7 @@ class ResumeTransactionThread : public ACE_Task_Base {
CacheableKeyPtr keyPtr6 = createKey(keys[6]);
RegionPtr regPtr1 = getHelper()->getRegion(regionNames[1]);
- THREADERRORCHECK(regPtr1 != NULLPTR,
+ THREADERRORCHECK(regPtr1 != nullptr,
"In ResumeTransactionThread - Region not found.");
THREADERRORCHECK(!regPtr0->containsKeyOnServer(keyPtr4),
@@ -590,9 +590,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, SuspendResumeCommit)
CacheTransactionManagerPtr txManager =
getHelper()->getCache()->getCacheTransactionManager();
RegionPtr regPtr0 = getHelper()->getRegion(regionNames[0]);
- ASSERT(regPtr0 != NULLPTR, "In SuspendResumeCommit - Region not found.");
+ ASSERT(regPtr0 != nullptr, "In SuspendResumeCommit - Region not found.");
RegionPtr regPtr1 = getHelper()->getRegion(regionNames[1]);
- ASSERT(regPtr1 != NULLPTR, "In SuspendResumeCommit - Region not found.");
+ ASSERT(regPtr1 != nullptr, "In SuspendResumeCommit - Region not found.");
CacheableKeyPtr keyPtr4 = createKey(keys[4]);
CacheableKeyPtr keyPtr5 = createKey(keys[5]);
CacheableKeyPtr keyPtr6 = createKey(keys[6]);
@@ -657,7 +657,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, SuspendResumeCommit)
ASSERT(resumeExc,
"SuspendResumeCommit: Transaction shouldnt have been resumed");
- ASSERT(txManager->suspend() == NULLPTR,
+ ASSERT(txManager->suspend() == nullptr,
"SuspendResumeCommit: Transaction shouldnt have been suspended");
}
END_TASK_DEFINITION
@@ -670,7 +670,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, SuspendTimeOut)
CacheableKeyPtr keyPtr5 = createKey(keys[5]);
RegionPtr regPtr0 = getHelper()->getRegion(regionNames[0]);
- ASSERT(regPtr0 != NULLPTR, "In SuspendTimeOut - Region not found.");
+ ASSERT(regPtr0 != nullptr, "In SuspendTimeOut - Region not found.");
txManager->begin();
createEntry(regionNames[0], keys[4], vals[4]);
@@ -712,9 +712,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, SuspendResumeRollback)
CacheableKeyPtr keyPtr6 = createKey(keys[6]);
RegionPtr regPtr0 = getHelper()->getRegion(regionNames[0]);
- ASSERT(regPtr0 != NULLPTR, "In SuspendResumeRollback - Region not found.");
+ ASSERT(regPtr0 != nullptr, "In SuspendResumeRollback - Region not found.");
RegionPtr regPtr1 = getHelper()->getRegion(regionNames[1]);
- ASSERT(regPtr1 != NULLPTR, "In SuspendResumeRollback - Region not found.");
+ ASSERT(regPtr1 != nullptr, "In SuspendResumeRollback - Region not found.");
txManager->begin();
createEntry(regionNames[0], keys[4], vals[4]);
@@ -1066,7 +1066,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, CreateClient1KeyThriceWithSticky)
reg0->localInvalidate(createKey(keys[1]));
reg1->localInvalidate(createKey(keys[3]));
PoolPtr pool = PoolManager::find("__TESTPOOL1_");
- ASSERT(pool != NULLPTR, "Pool Should have been found");
+ ASSERT(pool != nullptr, "Pool Should have been found");
doNetsearch(regionNames[0], keys[1], nvals[1]);
doNetsearch(regionNames[1], keys[3], nvals[3]);
pool->releaseThreadLocalConnection();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientTransactionsXA.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientTransactionsXA.hpp b/src/cppcache/integration-test/ThinClientTransactionsXA.hpp
index be0437b..6a3ba83 100644
--- a/src/cppcache/integration-test/ThinClientTransactionsXA.hpp
+++ b/src/cppcache/integration-test/ThinClientTransactionsXA.hpp
@@ -104,7 +104,7 @@ void _verifyEntry(const char* name, const char* key, const char* val,
free(buf);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
CacheableKeyPtr keyPtr = createKey(key);
@@ -142,10 +142,10 @@ void _verifyEntry(const char* name, const char* key, const char* val,
}
if (val != NULL) {
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
+ auto checkPtr =
+ std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
- ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null.");
+ ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
sprintf(buf, "In verify loop, get returned %s for key %s",
checkPtr->asChar(), key);
@@ -199,9 +199,9 @@ void createRegion(const char* name, bool ackMode, const char* endpoints,
fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
fflush(stdout);
RegionPtr regPtr =
- getHelper()->createRegion(name, ackMode, cachingEnable, NULLPTR,
+ getHelper()->createRegion(name, ackMode, cachingEnable, nullptr,
endpoints, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
void createPooledRegion(const char* name, bool ackMode, const char* locators,
@@ -214,7 +214,7 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators,
RegionPtr regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
@@ -228,7 +228,7 @@ void createPooledRegionSticky(const char* name, bool ackMode,
RegionPtr regPtr = getHelper()->createPooledRegionSticky(
name, ackMode, locators, poolname, cachingEnable,
clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
@@ -242,7 +242,7 @@ void createEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
@@ -289,7 +289,7 @@ void updateEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
ASSERT(regPtr->containsValueForKey(keyPtr),
@@ -314,12 +314,12 @@ void doGetAgain(const char* name, const char* key, const char* value) {
RegionPtr regPtr = getHelper()->getRegion(name);
fprintf(stdout, "get region name%s\n", regPtr->getName());
fflush(stdout);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); // force a netsearch
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(
+ regPtr->get(keyPtr)); // force a netsearch
- if (checkPtr != NULLPTR) {
+ if (checkPtr != nullptr) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In doGetAgain, get returned %s for key %s",
@@ -346,7 +346,7 @@ void doNetsearch(const char* name, const char* key, const char* value) {
RegionPtr regPtr = getHelper()->getRegion(name);
fprintf(stdout, "netsearch region %s\n", regPtr->getName());
fflush(stdout);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
if (count == 0) {
ASSERT(!regPtr->containsKey(keyPtr),
@@ -355,10 +355,10 @@ void doNetsearch(const char* name, const char* key, const char* value) {
"Value should not have been found in region.");
count++;
}
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); // force a netsearch
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(
+ regPtr->get(keyPtr)); // force a netsearch
- if (checkPtr != NULLPTR) {
+ if (checkPtr != nullptr) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
@@ -399,15 +399,15 @@ class SuspendTransactionThread : public ACE_Task_Base {
public:
SuspendTransactionThread(bool sleep, ACE_Auto_Event* txEvent)
- : m_suspendedTransaction(NULLPTR), m_sleep(sleep), m_txEvent(txEvent) {}
+ : m_suspendedTransaction(nullptr), m_sleep(sleep), m_txEvent(txEvent) {}
int svc(void) {
char buf[1024];
sprintf(buf, " In SuspendTransactionThread");
LOG(buf);
- InternalCacheTransactionManager2PCPtr txManager =
- static_cast<InternalCacheTransactionManager2PCPtr>(
+ auto txManager =
+ std::dynamic_pointer_cast<InternalCacheTransactionManager2PC>(
getHelper()->getCache()->getCacheTransactionManager());
txManager->begin();
@@ -458,7 +458,7 @@ class ResumeTransactionThread : public ACE_Task_Base {
LOG(buf);
RegionPtr regPtr0 = getHelper()->getRegion(regionNames[0]);
- THREADERRORCHECK(regPtr0 != NULLPTR,
+ THREADERRORCHECK(regPtr0 != nullptr,
"In ResumeTransactionThread - Region not found.");
CacheableKeyPtr keyPtr4 = createKey(keys[4]);
@@ -466,7 +466,7 @@ class ResumeTransactionThread : public ACE_Task_Base {
CacheableKeyPtr keyPtr6 = createKey(keys[6]);
RegionPtr regPtr1 = getHelper()->getRegion(regionNames[1]);
- THREADERRORCHECK(regPtr1 != NULLPTR,
+ THREADERRORCHECK(regPtr1 != nullptr,
"In ResumeTransactionThread - Region not found.");
THREADERRORCHECK(!regPtr0->containsKeyOnServer(keyPtr4),
@@ -477,8 +477,8 @@ class ResumeTransactionThread : public ACE_Task_Base {
"In ResumeTransactionThread - Key should not have been "
"found in region.");
- InternalCacheTransactionManager2PCPtr txManager =
- static_cast<InternalCacheTransactionManager2PCPtr>(
+ auto txManager =
+ std::dynamic_pointer_cast<InternalCacheTransactionManager2PC>(
getHelper()->getCache()->getCacheTransactionManager());
if (m_tryResumeWithSleep) {
THREADERRORCHECK(!txManager->isSuspended(m_suspendedTransaction),
@@ -591,13 +591,13 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, SuspendResumeCommit)
{
- InternalCacheTransactionManager2PCPtr txManager =
- static_cast<InternalCacheTransactionManager2PCPtr>(
+ auto txManager =
+ std::dynamic_pointer_cast<InternalCacheTransactionManager2PC>(
getHelper()->getCache()->getCacheTransactionManager());
RegionPtr regPtr0 = getHelper()->getRegion(regionNames[0]);
- ASSERT(regPtr0 != NULLPTR, "In SuspendResumeCommit - Region not found.");
+ ASSERT(regPtr0 != nullptr, "In SuspendResumeCommit - Region not found.");
RegionPtr regPtr1 = getHelper()->getRegion(regionNames[1]);
- ASSERT(regPtr1 != NULLPTR, "In SuspendResumeCommit - Region not found.");
+ ASSERT(regPtr1 != nullptr, "In SuspendResumeCommit - Region not found.");
CacheableKeyPtr keyPtr4 = createKey(keys[4]);
CacheableKeyPtr keyPtr5 = createKey(keys[5]);
CacheableKeyPtr keyPtr6 = createKey(keys[6]);
@@ -663,21 +663,21 @@ DUNIT_TASK_DEFINITION(CLIENT1, SuspendResumeCommit)
ASSERT(resumeExc,
"SuspendResumeCommit: Transaction shouldnt have been resumed");
- ASSERT(txManager->suspend() == NULLPTR,
+ ASSERT(txManager->suspend() == nullptr,
"SuspendResumeCommit: Transaction shouldnt have been suspended");
}
END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, SuspendTimeOut)
{
- InternalCacheTransactionManager2PCPtr txManager =
- static_cast<InternalCacheTransactionManager2PCPtr>(
+ auto txManager =
+ std::dynamic_pointer_cast<InternalCacheTransactionManager2PC>(
getHelper()->getCache()->getCacheTransactionManager());
CacheableKeyPtr keyPtr4 = createKey(keys[4]);
CacheableKeyPtr keyPtr5 = createKey(keys[5]);
RegionPtr regPtr0 = getHelper()->getRegion(regionNames[0]);
- ASSERT(regPtr0 != NULLPTR, "In SuspendTimeOut - Region not found.");
+ ASSERT(regPtr0 != nullptr, "In SuspendTimeOut - Region not found.");
txManager->begin();
createEntry(regionNames[0], keys[4], vals[4]);
@@ -713,17 +713,17 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, SuspendResumeRollback)
{
- InternalCacheTransactionManager2PCPtr txManager =
- static_cast<InternalCacheTransactionManager2PCPtr>(
+ auto txManager =
+ std::dynamic_pointer_cast<InternalCacheTransactionManager2PC>(
getHelper()->getCache()->getCacheTransactionManager());
CacheableKeyPtr keyPtr4 = createKey(keys[4]);
CacheableKeyPtr keyPtr5 = createKey(keys[5]);
CacheableKeyPtr keyPtr6 = createKey(keys[6]);
RegionPtr regPtr0 = getHelper()->getRegion(regionNames[0]);
- ASSERT(regPtr0 != NULLPTR, "In SuspendResumeRollback - Region not found.");
+ ASSERT(regPtr0 != nullptr, "In SuspendResumeRollback - Region not found.");
RegionPtr regPtr1 = getHelper()->getRegion(regionNames[1]);
- ASSERT(regPtr1 != NULLPTR, "In SuspendResumeRollback - Region not found.");
+ ASSERT(regPtr1 != nullptr, "In SuspendResumeRollback - Region not found.");
txManager->begin();
createEntry(regionNames[0], keys[4], vals[4]);
@@ -959,8 +959,8 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
{
- InternalCacheTransactionManager2PCPtr txManager =
- static_cast<InternalCacheTransactionManager2PCPtr>(
+ auto txManager =
+ std::dynamic_pointer_cast<InternalCacheTransactionManager2PC>(
getHelper()->getCache()->getCacheTransactionManager());
txManager->begin();
createEntry(regionNames[0], keys[0], vals[0]);
@@ -975,8 +975,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepFour)
{
doNetsearch(regionNames[0], keys[0], vals[0]);
doNetsearch(regionNames[1], keys[2], vals[2]);
- InternalCacheTransactionManager2PCPtr txManager =
- static_cast<InternalCacheTransactionManager2PCPtr>(
+ auto txManager =
+ std::dynamic_pointer_cast<InternalCacheTransactionManager2PC>(
getHelper()->getCache()->getCacheTransactionManager());
txManager->begin();
createEntry(regionNames[0], keys[1], vals[1]);
@@ -1025,8 +1025,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepSix)
{
doNetsearch(regionNames[0], keys[0], vals[0]);
doNetsearch(regionNames[1], keys[2], vals[2]);
- InternalCacheTransactionManager2PCPtr txManager =
- static_cast<InternalCacheTransactionManager2PCPtr>(
+ auto txManager =
+ std::dynamic_pointer_cast<InternalCacheTransactionManager2PC>(
getHelper()->getCache()->getCacheTransactionManager());
txManager->begin();
updateEntry(regionNames[0], keys[1], nvals[1]);
@@ -1082,7 +1082,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepEight_Pool_Sticky)
reg0->localInvalidate(createKey(keys[1]));
reg1->localInvalidate(createKey(keys[3]));
PoolPtr pool = PoolManager::find("__TESTPOOL1_");
- ASSERT(pool != NULLPTR, "Pool Should have been found");
+ ASSERT(pool != nullptr, "Pool Should have been found");
doNetsearch(regionNames[0], keys[1], nvals[1]);
doNetsearch(regionNames[1], keys[3], nvals[3]);
pool->releaseThreadLocalConnection();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientVersionedOps.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientVersionedOps.hpp b/src/cppcache/integration-test/ThinClientVersionedOps.hpp
index 2794022..565d9c4 100644
--- a/src/cppcache/integration-test/ThinClientVersionedOps.hpp
+++ b/src/cppcache/integration-test/ThinClientVersionedOps.hpp
@@ -134,7 +134,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StartClient1)
// initClientWithPool(true/*isthinClient*/, NULL/*poolName*/,
// NULL/*locators*/,serverGroup1, NULL/*servers*/,
- // NULLPTR/*PropertiesPtr&*/,
+ // nullptr/*PropertiesPtr&*/,
// 0/*redundancy*/, true/*clientNotification*/,
// -1/*subscriptionAckInterval*/,
// 5/*connections*/, 60000/*loadConditioningInterval*/);
@@ -166,7 +166,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, StartClient2)
gfendpoints2 += tmp2;
LOG( "Client-2 Init -4" );
initClientWithPool(true, NULL, NULL, serverGroup2, gfendpoints2.c_str(),
- NULLPTR, 0, true, -1, 5, 60000);
+ nullptr, 0, true, -1, 5, 60000);
LOG( "Client-2 Init -5" );
RegionPtr regPtr0 = createRegionAndAttachPool(regNames[0],USE_ACK, NULL);
@@ -220,9 +220,9 @@ DUNIT_TASK_DEFINITION(CLIENT2, transactionPutOnClient2)
// localGet
- c2v11 = dynCast<CacheableStringPtr>(rptr->get(keyPtr1));
- c2v12 = dynCast<CacheableStringPtr>(rptr->get(keyPtr2));
- c2v13 = dynCast<CacheableStringPtr>(rptr->get(keyPtr3));
+ c2v11 = std::dynamic_pointer_cast<CacheableString>(rptr->get(keyPtr1));
+ c2v12 = std::dynamic_pointer_cast<CacheableString>(rptr->get(keyPtr2));
+ c2v13 = std::dynamic_pointer_cast<CacheableString>(rptr->get(keyPtr3));
// localDestroy
rptr->localDestroy(keyPtr1);
@@ -230,9 +230,9 @@ DUNIT_TASK_DEFINITION(CLIENT2, transactionPutOnClient2)
rptr->localDestroy(keyPtr3);
// remoteGet
- c2v11 = dynCast<CacheableStringPtr>(rptr->get(keyPtr1));
- s2v12 = dynCast<CacheableStringPtr>(rptr->get(keyPtr2));
- s2v13 = dynCast<CacheableStringPtr>(rptr->get(keyPtr3));
+ c2v11 = std::dynamic_pointer_cast<CacheableString>(rptr->get(keyPtr1));
+ s2v12 = std::dynamic_pointer_cast<CacheableString>(rptr->get(keyPtr2));
+ s2v13 = std::dynamic_pointer_cast<CacheableString>(rptr->get(keyPtr3));
// Print remoteGet Values
LOGINFO(
@@ -251,11 +251,11 @@ DUNIT_TASK_DEFINITION(CLIENT2, transactionPutOnClient2)
"Val3 = %s ",
c2v13->asChar(), s2v13->asChar());
- ASSERT(*c2v11.ptr() == *c2v11.ptr(),
+ ASSERT(*c2v11.get() == *c2v11.get(),
"transactionPutOnClient2:Values should be equal-1");
- ASSERT(*c2v12.ptr() == *c2v12.ptr(),
+ ASSERT(*c2v12.get() == *c2v12.get(),
"transactionPutOnClient2:Values should be equal-2");
- ASSERT(*c2v13.ptr() == *c2v13.ptr(),
+ ASSERT(*c2v13.get() == *c2v13.get(),
"transactionPutOnClient2:Values should be equal-3");
LOG("CLIENT-2 :: TASK: transactionPutOnClient2 completed successfully");
@@ -274,9 +274,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, verifyGetonClient1)
CacheableKeyPtr keyPtr3 = CacheableKey::create("key-3");
// localGet
- c1v11 = dynCast<CacheableStringPtr>(rptr->get(keyPtr1));
- c1v12 = dynCast<CacheableStringPtr>(rptr->get(keyPtr2));
- c1v13 = dynCast<CacheableStringPtr>(rptr->get(keyPtr3));
+ c1v11 = std::dynamic_pointer_cast<CacheableString>(rptr->get(keyPtr1));
+ c1v12 = std::dynamic_pointer_cast<CacheableString>(rptr->get(keyPtr2));
+ c1v13 = std::dynamic_pointer_cast<CacheableString>(rptr->get(keyPtr3));
// localDestroy
rptr->localDestroy(keyPtr1);
@@ -284,9 +284,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, verifyGetonClient1)
rptr->localDestroy(keyPtr3);
// remoteGet
- s1v11 = dynCast<CacheableStringPtr>(rptr->get(keyPtr1));
- s1v12 = dynCast<CacheableStringPtr>(rptr->get(keyPtr2));
- s1v13 = dynCast<CacheableStringPtr>(rptr->get(keyPtr3));
+ s1v11 = std::dynamic_pointer_cast<CacheableString>(rptr->get(keyPtr1));
+ s1v12 = std::dynamic_pointer_cast<CacheableString>(rptr->get(keyPtr2));
+ s1v13 = std::dynamic_pointer_cast<CacheableString>(rptr->get(keyPtr3));
// Print remoteGet Values
LOGINFO(
@@ -302,11 +302,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, verifyGetonClient1)
"%s ",
c1v13->asChar(), s1v13->asChar());
- ASSERT(*c1v11.ptr() == *s1v11.ptr(),
+ ASSERT(*c1v11.get() == *s1v11.get(),
"verifyGetonClient1:Values should be equal-1");
- ASSERT(*c1v12.ptr() == *s1v12.ptr(),
+ ASSERT(*c1v12.get() == *s1v12.get(),
"verifyGetonClient1:Values should be equal-2");
- ASSERT(*c1v13.ptr() == *s1v13.ptr(),
+ ASSERT(*c1v13.get() == *s1v13.get(),
"verifyGetonClient1:Values should be equal-3");
LOG("CLIENT-2 :: TASK: verifyGetonClient1 completed successfully");
@@ -368,11 +368,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, GetOnClient1)
CacheableKeyPtr keyPtr4 = CacheableKey::create("key-4");
CacheableKeyPtr keyPtr5 = CacheableKey::create("key-5");
- c1v11 = dynCast<CacheableStringPtr>(regPtr->get(keyPtr1));
- c1v12 = dynCast<CacheableStringPtr>(regPtr->get(keyPtr2));
- c1v13 = dynCast<CacheableStringPtr>(regPtr->get(keyPtr3));
- c1v14 = dynCast<CacheableStringPtr>(regPtr->get(keyPtr4));
- c1v15 = dynCast<CacheableStringPtr>(regPtr->get(keyPtr5));
+ c1v11 = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr1));
+ c1v12 = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr2));
+ c1v13 = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr3));
+ c1v14 = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr4));
+ c1v15 = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr5));
// Print local Get Values
LOGINFO("CLIENT-1 :: local GET operation -6 c1v11 = %s", c1v11->asChar());
@@ -392,11 +392,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, GetOnClient1)
LOG("CLIENT-1 :: localDestroy() operation....Done");
// remoteGet
- s1v11 = dynCast<CacheableStringPtr>(regPtr->get(keyPtr1));
- s1v12 = dynCast<CacheableStringPtr>(regPtr->get(keyPtr2));
- s1v13 = dynCast<CacheableStringPtr>(regPtr->get(keyPtr3));
- s1v14 = dynCast<CacheableStringPtr>(regPtr->get(keyPtr4));
- s1v15 = dynCast<CacheableStringPtr>(regPtr->get(keyPtr5));
+ s1v11 = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr1));
+ s1v12 = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr2));
+ s1v13 = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr3));
+ s1v14 = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr4));
+ s1v15 = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr5));
// Print remoteGet Values
LOGINFO("CLIENT-1 :: remoteGet operation -6 s1v11 = %s", s1v11->asChar());
@@ -405,15 +405,15 @@ DUNIT_TASK_DEFINITION(CLIENT1, GetOnClient1)
LOGINFO("CLIENT-1 :: remoteGet operation -6 s1v14 = %s", s1v14->asChar());
LOGINFO("CLIENT-1 :: remoteGet operation -6 s1v15 = %s", s1v15->asChar());
- ASSERT(*c1v11.ptr() == *s1v11.ptr(),
+ ASSERT(*c1v11.get() == *s1v11.get(),
"GetOnClient1:Values should be equal-1");
- ASSERT(*c1v12.ptr() == *s1v12.ptr(),
+ ASSERT(*c1v12.get() == *s1v12.get(),
"GetOnClient1:Values should be equal-2");
- ASSERT(*c1v13.ptr() == *s1v13.ptr(),
+ ASSERT(*c1v13.get() == *s1v13.get(),
"GetOnClient1:Values should be equal-3");
- ASSERT(*c1v14.ptr() == *s1v14.ptr(),
+ ASSERT(*c1v14.get() == *s1v14.get(),
"GetOnClient1:Values should be equal-4");
- ASSERT(*c1v15.ptr() == *s1v15.ptr(),
+ ASSERT(*c1v15.get() == *s1v15.get(),
"GetOnClient1:Values should be equal-5");
LOG("CLIENT-1 ::local GET operation....Done");
}
@@ -433,11 +433,11 @@ DUNIT_TASK_DEFINITION(CLIENT2, GetOnClient2)
CacheableKeyPtr keyPtr4 = CacheableKey::create("key-4");
CacheableKeyPtr keyPtr5 = CacheableKey::create("key-5");
- c2v11 = dynCast<CacheableStringPtr>(regPtr->get(keyPtr1));
- c2v12 = dynCast<CacheableStringPtr>(regPtr->get(keyPtr2));
- c2v13 = dynCast<CacheableStringPtr>(regPtr->get(keyPtr3));
- c2v14 = dynCast<CacheableStringPtr>(regPtr->get(keyPtr4));
- c2v15 = dynCast<CacheableStringPtr>(regPtr->get(keyPtr5));
+ c2v11 = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr1));
+ c2v12 = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr2));
+ c2v13 = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr3));
+ c2v14 = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr4));
+ c2v15 = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr5));
// Print localGets
// Print local Get Values
@@ -459,11 +459,11 @@ DUNIT_TASK_DEFINITION(CLIENT2, GetOnClient2)
LOG("CLIENT-2 :: localDestroy() operation....Done");
// remoteGet
- s2v11 = dynCast<CacheableStringPtr>(regPtr->get(keyPtr1));
- s2v12 = dynCast<CacheableStringPtr>(regPtr->get(keyPtr2));
- s2v13 = dynCast<CacheableStringPtr>(regPtr->get(keyPtr3));
- s2v14 = dynCast<CacheableStringPtr>(regPtr->get(keyPtr4));
- s2v15 = dynCast<CacheableStringPtr>(regPtr->get(keyPtr5));
+ s2v11 = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr1));
+ s2v12 = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr2));
+ s2v13 = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr3));
+ s2v14 = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr4));
+ s2v15 = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr5));
// Print remoteGet Values
LOGINFO("CLIENT-2 :: remoteGet operation s2v11 = %s", s2v11->asChar());
@@ -472,15 +472,15 @@ DUNIT_TASK_DEFINITION(CLIENT2, GetOnClient2)
LOGINFO("CLIENT-2 :: remoteGet operation s2v14 = %s", s2v14->asChar());
LOGINFO("CLIENT-2 :: remoteGet operation s2v15 = %s", s2v15->asChar());
- ASSERT(*c2v11.ptr() == *s2v11.ptr(),
+ ASSERT(*c2v11.get() == *s2v11.get(),
"GetOnClient2:Values should be equal-1");
- ASSERT(*c2v12.ptr() == *s2v12.ptr(),
+ ASSERT(*c2v12.get() == *s2v12.get(),
"GetOnClient2:Values should be equal-2");
- ASSERT(*c2v13.ptr() == *s2v13.ptr(),
+ ASSERT(*c2v13.get() == *s2v13.get(),
"GetOnClient2:Values should be equal-3");
- ASSERT(*c2v14.ptr() == *s2v14.ptr(),
+ ASSERT(*c2v14.get() == *s2v14.get(),
"GetOnClient2:Values should be equal-4");
- ASSERT(*c2v15.ptr() == *s2v15.ptr(),
+ ASSERT(*c2v15.get() == *s2v15.get(),
"GetOnClient2:Values should be equal-5");
LOG("GetOnClient2 completed");
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/fw_dunit.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/fw_dunit.cpp b/src/cppcache/integration-test/fw_dunit.cpp
index 57673a0..fe9cc39 100644
--- a/src/cppcache/integration-test/fw_dunit.cpp
+++ b/src/cppcache/integration-test/fw_dunit.cpp
@@ -33,8 +33,6 @@
#include <ace/ACE.h>
-// #include <geode/GeodeCppCache.hpp>
-
#include <typeinfo>
#include <string>
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/fw_dunit.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/fw_dunit.hpp b/src/cppcache/integration-test/fw_dunit.hpp
index 096e124..624004f 100644
--- a/src/cppcache/integration-test/fw_dunit.hpp
+++ b/src/cppcache/integration-test/fw_dunit.hpp
@@ -121,12 +121,10 @@ END_TASK(validate)
#define ASSERT(x, y) \
if (!(x)) { \
- raise(SIGABRT); \
throw dunit::TestException(y, __LINE__, __FILE__); \
}
#define XASSERT(x) \
if (!(x)) { \
- raise(SIGABRT); \
throw dunit::TestException(#x, __LINE__, __FILE__); \
}
#define FAIL(y) throw dunit::TestException(y, __LINE__, __FILE__)
[22/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from cppcache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testAttributesFactory.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testAttributesFactory.cpp b/src/cppcache/integration-test/testAttributesFactory.cpp
index 9489f6f..2e4ffcf 100644
--- a/src/cppcache/integration-test/testAttributesFactory.cpp
+++ b/src/cppcache/integration-test/testAttributesFactory.cpp
@@ -23,22 +23,22 @@
using namespace apache::geode::client;
-BEGIN_TEST(ATTRIBUTE_FACTORY)
- {
- AttributesFactory af;
- RegionAttributesPtr ra;
- RegionPtr region;
-
- CacheFactoryPtr cacheFactoryPtr = CacheFactory::createCacheFactory();
- CachePtr cache = cacheFactoryPtr->create();
- ra = af.createRegionAttributes();
-
- CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cache.ptr());
- cacheImpl->createRegion("region1", ra, region);
- LOG("local region created with HA cache specification.");
- cache->close();
- }
-END_TEST(ATTRIBUTE_FACTORY)
+// BEGIN_TEST(ATTRIBUTE_FACTORY)
+// {
+// AttributesFactory af;
+// RegionAttributesPtr ra;
+// RegionPtr region;
+//
+// CacheFactoryPtr cacheFactoryPtr = CacheFactory::createCacheFactory();
+// CachePtr cache = cacheFactoryPtr->create();
+// ra = af.createRegionAttributes();
+//
+// CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cache.get());
+// cacheImpl->createRegion("region1", ra, region);
+// LOG("local region created with HA cache specification.");
+// cache->close();
+// }
+// END_TEST(ATTRIBUTE_FACTORY)
/* testing attributes with invalid value */
/* testing with negative values */ /*see bug no #865 */
@@ -53,7 +53,7 @@ BEGIN_TEST(REGION_FACTORY)
try {
rf->setInitialCapacity(-1);
FAIL("Should have got expected IllegalArgumentException");
- } catch (IllegalArgumentException) {
+ } catch (IllegalArgumentException&) {
LOG("Got expected IllegalArgumentException");
}
@@ -64,13 +64,13 @@ BEGIN_TEST(REGION_FACTORY)
"Incorrect InitialCapacity");
m_region->put(1, 1);
- CacheableInt32Ptr res = dynCast<CacheableInt32Ptr>(m_region->get(1));
+ auto res = std::dynamic_pointer_cast<CacheableInt32>(m_region->get(1));
ASSERT(res->value() == 1, "Expected to find value 1.");
m_region->destroyRegion();
m_cache->close();
- m_cache = NULLPTR;
- m_region = NULLPTR;
+ m_cache = nullptr;
+ m_region = nullptr;
CacheFactoryPtr cf1 = CacheFactory::createCacheFactory();
CachePtr m_cache1 = cf1->create();
@@ -80,7 +80,7 @@ BEGIN_TEST(REGION_FACTORY)
try {
rf1->setInitialCapacity(2147483648U);
FAIL("Should have got expected IllegalArgumentException");
- } catch (IllegalArgumentException) {
+ } catch (IllegalArgumentException&) {
LOG("Got expected IllegalArgumentException");
}
RegionPtr m_region1 = rf1->create("Local_ETTL_LI");
@@ -90,12 +90,12 @@ BEGIN_TEST(REGION_FACTORY)
"Incorrect InitialCapacity");
m_region1->put(1, 1);
- CacheableInt32Ptr res1 = dynCast<CacheableInt32Ptr>(m_region1->get(1));
+ auto res1 = std::dynamic_pointer_cast<CacheableInt32>(m_region1->get(1));
ASSERT(res1->value() == 1, "Expected to find value 1.");
m_region1->destroyRegion();
m_cache1->close();
- m_cache1 = NULLPTR;
- m_region1 = NULLPTR;
+ m_cache1 = nullptr;
+ m_region1 = nullptr;
}
END_TEST(REGION_FACTORY)
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testAttributesMutator.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testAttributesMutator.cpp b/src/cppcache/integration-test/testAttributesMutator.cpp
index 662bb33..16f8dbe 100644
--- a/src/cppcache/integration-test/testAttributesMutator.cpp
+++ b/src/cppcache/integration-test/testAttributesMutator.cpp
@@ -44,7 +44,7 @@ DUNIT_TASK(A, Init)
af.setEntryTimeToLive(ExpirationAction::LOCAL_INVALIDATE, 5);
RegionAttributesPtr attrs = af.createRegionAttributes();
- CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(Test.m_cache.ptr());
+ CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(Test.m_cache.get());
cacheImpl->createRegion("Local_ETTL_LI", attrs, Test.m_region);
}
ENDTASK
@@ -58,13 +58,12 @@ DUNIT_TASK(A, CreateAndVerifyExpiry)
// countdown begins... it is ttl so access should not play into it..
SLEEP(3000); // sleep for a second, expect value to still be there.
- CacheableInt32Ptr res =
- dynCast<CacheableInt32Ptr>(Test.m_region->get("one"));
+ auto res = std::dynamic_pointer_cast<CacheableInt32>(Test.m_region->get("one"));
ASSERT(res->value() == 1, "Expected to find value 1.");
fflush(stdout);
SLEEP(5000); // sleep for 5 more seconds, expect value to be invalid.
fflush(stdout);
- res = NULLPTR;
+ res = nullptr;
ASSERT(Test.m_region->containsValueForKey("one") == false,
"should not contain value.");
}
@@ -75,7 +74,7 @@ DUNIT_TASK(A, Close)
{
Test.m_region->destroyRegion();
Test.m_cache->close();
- Test.m_cache = NULLPTR;
- Test.m_region = NULLPTR;
+ Test.m_cache = nullptr;
+ Test.m_region = nullptr;
}
ENDTASK
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testCache.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testCache.cpp b/src/cppcache/integration-test/testCache.cpp
index 2937c93..e87530e 100644
--- a/src/cppcache/integration-test/testCache.cpp
+++ b/src/cppcache/integration-test/testCache.cpp
@@ -33,7 +33,7 @@ BEGIN_TEST(CacheFunction)
char* subRegionName2 = (char*)"TESTCACHE_SUB_REGION2";
char* subRegionName21 = (char*)"TESTCACHE_SUB_REGION21";
CachePtr cptr;
- if (cptr != NULLPTR) {
+ if (cptr != nullptr) {
cout << "cptr is not null" << endl;
}
cout << "create Cache with name=" << host_name << " and unitialized system"
@@ -49,16 +49,16 @@ BEGIN_TEST(CacheFunction)
cout << ex.getMessage() << endl;
ASSERT(false, "attribute create failed");
}
- if (rAttr == NULLPTR) {
+ if (rAttr == nullptr) {
cout << "Warnning! : AttributesFactory returned NULL" << endl;
}
RegionPtr rptr;
- if (rptr != NULLPTR) {
+ if (rptr != nullptr) {
cout << "rptr is not null" << endl;
}
cout << "create Region with name=" << regionName << endl;
try {
- CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cptr.ptr());
+ CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cptr.get());
cacheImpl->createRegion(regionName, rAttr, rptr);
} catch (Exception& ex) {
cout << ex.getMessage() << endl;
@@ -127,7 +127,7 @@ BEGIN_TEST(CacheFunction)
cout << ex.getMessage() << endl;
ASSERT(false, (char*)"getRegion");
}
- if (region == NULLPTR) {
+ if (region == nullptr) {
ASSERT(false, (char*)"did not find it");
} else {
cout << "found :" << region->getName() << endl;
@@ -139,7 +139,7 @@ BEGIN_TEST(CacheFunction)
cout << ex.getMessage() << endl;
ASSERT(false, (char*)"getRegion");
}
- if (region == NULLPTR) {
+ if (region == nullptr) {
ASSERT(false, (char*)"did not find it");
} else {
cout << "found :" << region->getName() << endl;
@@ -151,7 +151,7 @@ BEGIN_TEST(CacheFunction)
cout << ex.getMessage() << endl;
ASSERT(false, (char*)"getRegion");
}
- if (region == NULLPTR) {
+ if (region == nullptr) {
ASSERT(false, (char*)"did not find it");
} else {
cout << "found :" << region->getName() << endl;
@@ -164,7 +164,7 @@ BEGIN_TEST(CacheFunction)
cout << ex.getMessage() << endl;
ASSERT(false, (char*)"getRegion");
}
- if (region == NULLPTR) {
+ if (region == nullptr) {
ASSERT(false, (char*)"did not find it");
} else {
cout << "found :" << region->getName() << endl;
@@ -177,7 +177,7 @@ BEGIN_TEST(CacheFunction)
cout << ex.getMessage() << endl;
ASSERT(false, (char*)"getRegion");
}
- if (region == NULLPTR) {
+ if (region == nullptr) {
cout << "not found !" << endl;
} else {
ASSERT(false, (char*)"found it");
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testCacheless.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testCacheless.cpp b/src/cppcache/integration-test/testCacheless.cpp
index 491d05b..7bd1964 100644
--- a/src/cppcache/integration-test/testCacheless.cpp
+++ b/src/cppcache/integration-test/testCacheless.cpp
@@ -61,8 +61,8 @@ class RegionWrapper {
int tries = 0;
int val = 0;
do {
- valPtr = dynCast<CacheableStringPtr>(m_regionPtr->get(keyPtr));
- ASSERT(valPtr != NULLPTR, "value should not be null.");
+ valPtr = std::dynamic_pointer_cast<CacheableString>(m_regionPtr->get(keyPtr));
+ ASSERT(valPtr != nullptr, "value should not be null.");
val = atoi(valPtr->asChar());
SLEEP(100);
tries++;
@@ -122,7 +122,7 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(s1p1, CreateRegionNoCache)
{
initClientWithPool(true, "__TEST_POOL1__", locHostPort, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
LOG("Creating region in s1p1-pusher, no-ack, no-cache, no-listener");
getHelper()->createPooledRegion(REGIONNAME, false, locHostPort,
"__TEST_POOL1__", true, true);
@@ -133,8 +133,8 @@ DUNIT_TASK_DEFINITION(s1p2, CreateNoCacheWListener)
{
LOG("Creating region in s1p2-listener, no-ack, no-cache, with-listener");
initClientWithPool(true, "__TEST_POOL1__", locHostPort, "ServerGroup1",
- NULLPTR, 0, true);
- listener = new TallyListener();
+ nullptr, 0, true);
+ listener = std::make_shared<TallyListener>();
getHelper()->createPooledRegion(REGIONNAME, false, locHostPort,
"__TEST_POOL1__", true, true, 0, 0, 0, 0, 0,
listener);
@@ -146,7 +146,7 @@ DUNIT_TASK_DEFINITION(s2p1, CreateRegionCacheMirror)
LOG("Creating region in s2p1-storage, no-ack, cache, no-interestlist, "
"no-listener");
initClientWithPool(true, "__TEST_POOL1__", locHostPort, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
getHelper()->createPooledRegion(REGIONNAME, false, locHostPort,
"__TEST_POOL1__", true, true);
}
@@ -157,8 +157,8 @@ DUNIT_TASK_DEFINITION(s2p2, CreateRegionCache)
LOG("Creating region in s2p2-subset, no-ack, no-mirror, cache, "
"no-interestlist, with-listener");
initClientWithPool(true, "__TEST_POOL1__", locHostPort, "ServerGroup1",
- NULLPTR, 0, true);
- listener = new TallyListener();
+ nullptr, 0, true);
+ listener = std::make_shared<TallyListener>();
getHelper()->createPooledRegion(REGIONNAME, false, locHostPort,
"__TEST_POOL1__", true, true, 0, 0, 0, 0, 0,
listener);
@@ -171,8 +171,8 @@ DUNIT_TASK_DEFINITION(s1p2, NoEvents)
LOG("Verifying TallyListener has received nothing.");
ASSERT(listener->getCreates() == 0, "Should be no creates");
ASSERT(listener->getUpdates() == 0, "Should be no updates");
- ASSERT(listener->getLastKey() == NULLPTR, "Should be no key");
- ASSERT(listener->getLastValue() == NULLPTR, "Should be no value");
+ ASSERT(listener->getLastKey() == nullptr, "Should be no key");
+ ASSERT(listener->getLastValue() == nullptr, "Should be no value");
}
END_TASK_DEFINITION
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testEntriesMap.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testEntriesMap.cpp b/src/cppcache/integration-test/testEntriesMap.cpp
index 4bc1a5b..68b71c6 100644
--- a/src/cppcache/integration-test/testEntriesMap.cpp
+++ b/src/cppcache/integration-test/testEntriesMap.cpp
@@ -33,6 +33,7 @@ END_TEST(NotOnWindows)
#include <LRUMapEntry.hpp>
#include <VersionTag.hpp>
#include <cstdlib>
+#include <LocalRegion.hpp>
using namespace apache::geode::client;
using namespace std;
@@ -41,7 +42,7 @@ typedef std::vector<MapEntryImplPtr> VectorOfMapEntry;
CacheableStringPtr createCacheable(const char* value) {
CacheableStringPtr result = CacheableString::create(value);
- ASSERT(result != NULLPTR, "expected result non-NULL");
+ ASSERT(result != nullptr, "expected result non-NULL");
return result;
}
@@ -50,18 +51,19 @@ BEGIN_TEST(PutAndGet)
CacheableStringPtr ccstr = createCacheable("100");
CacheablePtr ct = ccstr;
EntryFactory* entryFactory = EntryFactory::singleton;
+ AttributesFactory af;
EntriesMap* entries = new ConcurrentEntriesMap(entryFactory, false);
entries->open();
CacheableKeyPtr keyPtr = CacheableKey::create((char*)"foobar");
- ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL");
+ ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL");
MapEntryImplPtr me;
VersionTagPtr versionTag;
CacheablePtr oldValue;
entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag);
CacheablePtr myValuePtr;
entries->get(keyPtr, myValuePtr, me);
- ASSERT(myValuePtr != NULLPTR, "expected non-NULL");
- CacheableStringPtr strValue = dynCast<CacheableStringPtr>(myValuePtr);
+ ASSERT(myValuePtr != nullptr, "expected non-NULL");
+ auto strValue = std::dynamic_pointer_cast<CacheableString>(myValuePtr);
ASSERT(ccstr->operator==(*strValue), "expected 100");
delete entries;
}
@@ -71,11 +73,11 @@ BEGIN_TEST(CheckMapEntryImplPtr)
{
char error[1000] ATTR_UNUSED;
MapEntryImplPtr mePtr;
- ASSERT(mePtr == NULLPTR, "expected mePtr to be NULL");
+ ASSERT(mePtr == nullptr, "expected mePtr to be NULL");
CacheableKeyPtr keyPtr = CacheableKey::create(fwtest_Name);
- ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL");
+ ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL");
EntryFactory::singleton->newMapEntry(keyPtr, mePtr);
- ASSERT(mePtr != NULLPTR, "expected to not be null.");
+ ASSERT(mePtr != nullptr, "expected to not be null.");
}
END_TEST(CheckMapEntryImplPtr)
@@ -88,18 +90,18 @@ BEGIN_TEST(RemoveTest)
entries->open();
CacheableKeyPtr keyPtr = CacheableKey::create(fwtest_Name);
MapEntryImplPtr me;
- ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL");
+ ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL");
CacheablePtr oldValue;
VersionTagPtr versionTag;
entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag);
CacheablePtr myValuePtr;
(void)entries->remove(keyPtr, myValuePtr, me, -1, versionTag, false);
- CacheableStringPtr resPtr = dynCast<CacheableStringPtr>(myValuePtr);
- ASSERT(myValuePtr != NULLPTR, "expected to not be null.");
+ auto resPtr = std::dynamic_pointer_cast<CacheableString>(myValuePtr);
+ ASSERT(myValuePtr != nullptr, "expected to not be null.");
ASSERT(resPtr->operator==(*createCacheable("200")),
"CustomerType with m_foobar 200.");
(void)entries->remove(keyPtr, myValuePtr, me, -1, versionTag, false);
- ASSERT(myValuePtr == NULLPTR,
+ ASSERT(myValuePtr == nullptr,
"expected already removed, and null result should clear ptr.");
}
END_TEST(RemoveTest)
@@ -114,15 +116,15 @@ BEGIN_TEST(GetEntryTest)
CacheableKeyPtr keyPtr;
MapEntryImplPtr me;
keyPtr = CacheableKey::create(fwtest_Name);
- ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL");
+ ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL");
CacheablePtr oldValue;
VersionTagPtr versionTag;
entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag);
MapEntryImplPtr mePtr;
CacheablePtr ctPtr;
entries->getEntry(keyPtr, mePtr, ctPtr);
- ASSERT(mePtr != NULLPTR, "should not be null.");
- CacheableStringPtr valPtr = dynCast<CacheableStringPtr>(ctPtr);
+ ASSERT(mePtr != nullptr, "should not be null.");
+ auto valPtr = std::dynamic_pointer_cast<CacheableString>(ctPtr);
ASSERT(valPtr->operator==(*cst),
"Entry should have a CustomerType Value of 200");
CacheableKeyPtr keyPtr1;
@@ -135,7 +137,7 @@ BEGIN_TEST(MapEntryImplPtrRCTest)
{
// Test Reference Counting and destruction for MapEntry.
CacheableKeyPtr keyPtr = CacheableKey::create("foobar");
- ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL");
+ ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL");
MapEntryImplPtr mePtr;
EntryFactory ef;
ef.newMapEntry(keyPtr, mePtr);
@@ -181,7 +183,7 @@ BEGIN_TEST(EntriesTest)
sprintf(keyBuf, "key_%d", i);
sprintf(valBuf, "%d", i);
CacheableKeyPtr keyPtr = CacheableKey::create(keyBuf);
- ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL");
+ ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL");
CacheablePtr v = createCacheable(valBuf);
CacheablePtr oldValue;
entries->put(keyPtr, v, me, oldValue, -1, 0, versionTag);
@@ -199,7 +201,7 @@ BEGIN_TEST(EntriesTest)
CacheableStringPtr ctPtr;
CacheablePtr ccPtr;
ccPtr = rePtr->getValue();
- ctPtr = dynCast<CacheableStringPtr>(ccPtr);
+ ctPtr = std::dynamic_pointer_cast<CacheableString>(ccPtr);
test::cout << "value is " << ctPtr->asChar() << test::endl;
int val = atoi(ctPtr->asChar());
test::cout << "atoi returned " << val << test::endl;
@@ -228,7 +230,7 @@ BEGIN_TEST(ValuesTest)
sprintf(keyBuf, "key_%d", i);
sprintf(valBuf, "%d", i);
CacheableKeyPtr keyPtr = CacheableKey::create(keyBuf);
- ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL");
+ ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL");
CacheablePtr v = createCacheable(valBuf);
CacheablePtr oldValue;
entries->put(keyPtr, v, me, oldValue, -1, 0, versionTag);
@@ -242,8 +244,8 @@ BEGIN_TEST(ValuesTest)
int expectedTotal = 0;
for (int k = 0; k < 10; k++) {
expectedTotal += k;
- CacheableStringPtr valuePtr =
- dynCast<CacheableStringPtr>(valuesVec->back());
+ auto valuePtr =
+ std::dynamic_pointer_cast<CacheableString>(valuesVec->back());
total += atoi(valuePtr->asChar());
valuesVec->pop_back();
}
@@ -267,7 +269,7 @@ BEGIN_TEST(KeysTest)
sprintf(keyBuf, "key_%d", i);
sprintf(valBuf, "%d", i);
CacheableKeyPtr keyPtr = CacheableKey::create(keyBuf);
- ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL");
+ ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL");
CacheablePtr v = createCacheable(valBuf);
CacheablePtr oldValue;
entries->put(keyPtr, v, me, oldValue, -1, 0, versionTag);
@@ -284,7 +286,7 @@ BEGIN_TEST(KeysTest)
CacheableKeyPtr keyPtr = keysVec.back();
CacheablePtr cvPtr;
entries->get(keyPtr, cvPtr, me);
- CacheableStringPtr valuePtr = dynCast<CacheableStringPtr>(cvPtr);
+ auto valuePtr = std::dynamic_pointer_cast<CacheableString>(cvPtr);
total += atoi(valuePtr->asChar());
keysVec.pop_back();
}
@@ -310,7 +312,7 @@ BEGIN_TEST(TestRehash)
sprintf(keyBuf, "key_%d", i);
sprintf(valBuf, "%d", i);
CacheableKeyPtr keyPtr = CacheableKey::create(keyBuf);
- ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL");
+ ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL");
CacheablePtr v = createCacheable(valBuf);
CacheablePtr oldValue;
VersionTagPtr versionTag;
@@ -327,11 +329,11 @@ BEGIN_TEST(TestRehash)
sprintf(keyBuf, "key_%d", j);
CacheableStringPtr valuePtr;
CacheableKeyPtr keyPtr = CacheableKey::create(keyBuf);
- ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL");
+ ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL");
CacheablePtr cvPtr;
entries->get(keyPtr, cvPtr, me);
- valuePtr = dynCast<CacheableStringPtr>(cvPtr);
- if (valuePtr == NULLPTR) {
+ valuePtr = std::dynamic_pointer_cast<CacheableString>(cvPtr);
+ if (valuePtr == nullptr) {
test::cout << "error finding key: " << keyBuf << test::endl;
FAIL("should have found value for all keys after rehash.");
}
@@ -348,7 +350,7 @@ BEGIN_TEST(LRUPutAndGet)
MapEntryImplPtr me;
EntryFactory* entryFactory = LRUEntryFactory::singleton;
EntriesMap* entries = new LRUEntriesMap(
- entryFactory, NULL, LRUAction::LOCAL_DESTROY, 20, false);
+ entryFactory, nullptr, LRUAction::LOCAL_DESTROY, 20, false);
entries->open();
ASSERT(entries->size() == 0, "expected size 0.");
CacheableKeyPtr keyPtr = CacheableKey::create("foobar");
@@ -358,10 +360,10 @@ BEGIN_TEST(LRUPutAndGet)
ASSERT(entries->size() == 1, "expected size 1.");
CacheableStringPtr myValuePtr;
CacheablePtr cvPtr;
- ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL");
+ ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL");
entries->get(keyPtr, cvPtr, me);
- myValuePtr = dynCast<CacheableStringPtr>(cvPtr);
- ASSERT(myValuePtr != NULLPTR, "expected non-NULL");
+ myValuePtr = std::dynamic_pointer_cast<CacheableString>(cvPtr);
+ ASSERT(myValuePtr != nullptr, "expected non-NULL");
ASSERT(cst->operator==(*myValuePtr), "expected 100");
delete entries;
}
@@ -371,13 +373,13 @@ BEGIN_TEST(CheckLRUMapEntryImplPtr)
{
char error[1000] ATTR_UNUSED;
MapEntryImplPtr mePtr;
- ASSERT(mePtr == NULLPTR, "expected mePtr to be NULL");
+ ASSERT(mePtr == nullptr, "expected mePtr to be NULL");
CacheableKeyPtr keyPtr = CacheableKey::create(fwtest_Name);
- ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL");
+ ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL");
LRUEntryFactory::singleton->newMapEntry(keyPtr, mePtr);
- ASSERT(mePtr != NULLPTR, "expected to not be null.");
- LRUMapEntryPtr lmePtr = dynCast<LRUMapEntryPtr>(mePtr);
- ASSERT(lmePtr != NULLPTR, "expected to cast successfully to LRUMapEntry.");
+ ASSERT(mePtr != nullptr, "expected to not be null.");
+ auto lmePtr = std::dynamic_pointer_cast<LRUMapEntry>(mePtr);
+ ASSERT(lmePtr != nullptr, "expected to cast successfully to LRUMapEntry.");
}
END_TEST(LRUCheckMapEntryImplPtr)
@@ -400,14 +402,14 @@ BEGIN_TEST(LRURemoveTest)
CacheableStringPtr myValuePtr;
CacheablePtr cvPtr;
(void)entries->remove(keyPtr, cvPtr, me, -1, versionTag, false);
- myValuePtr = dynCast<CacheableStringPtr>(cvPtr);
+ myValuePtr = std::dynamic_pointer_cast<CacheableString>(cvPtr);
ASSERT(entries->size() == 0, "expected size 0.");
- ASSERT(cvPtr != NULLPTR, "expected to not be null.");
+ ASSERT(cvPtr != nullptr, "expected to not be null.");
ASSERT(myValuePtr->operator==(*createCacheable("200")),
"CustomerType with m_foobar 200.");
(void)entries->remove(keyPtr, cvPtr, me, -1, versionTag, false);
- ASSERT(cvPtr == NULLPTR,
+ ASSERT(cvPtr == nullptr,
"expected already removed, and null result should clear ptr.");
}
END_TEST(LRURemoveTest)
@@ -423,7 +425,7 @@ BEGIN_TEST(LRUGetEntryTest)
CacheableKeyPtr keyPtr;
MapEntryImplPtr me;
keyPtr = CacheableKey::create(fwtest_Name);
- ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL");
+ ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL");
CacheablePtr oldValue;
VersionTagPtr versionTag;
entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag);
@@ -431,9 +433,9 @@ BEGIN_TEST(LRUGetEntryTest)
MapEntryImplPtr mePtr;
CacheablePtr cvPtr;
entries->getEntry(keyPtr, mePtr, cvPtr);
- ASSERT(mePtr != NULLPTR, "should not be null.");
+ ASSERT(mePtr != nullptr, "should not be null.");
CacheableStringPtr ctPtr;
- ctPtr = dynCast<CacheableStringPtr>(cvPtr);
+ ctPtr = std::dynamic_pointer_cast<CacheableString>(cvPtr);
ASSERT(ctPtr->operator==(*cst),
"Entry should have a CustomerType Value of 200");
CacheableKeyPtr keyPtr1;
@@ -452,29 +454,29 @@ BEGIN_TEST(LRULimitEvictTest)
CacheablePtr ct = createCacheable("somevalue");
CacheablePtr oldValue;
CacheableKeyPtr keyPtr = CacheableKey::create("1");
- ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL");
+ ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL");
VersionTagPtr versionTag;
entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag);
ASSERT(entries->size() == 1, "expected size 1.");
keyPtr = CacheableKey::create("2");
- ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL");
+ ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL");
entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag);
ASSERT(entries->size() == 2, "expected size 2.");
keyPtr = CacheableKey::create("3");
- ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL");
+ ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL");
entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag);
ASSERT(entries->size() == 3, "expected size 3.");
keyPtr = CacheableKey::create("4");
- ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL");
+ ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL");
entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag);
ASSERT(entries->size() == 4, "expected size 4.");
keyPtr = CacheableKey::create("5");
- ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL");
+ ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL");
entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag);
ASSERT(entries->size() == 5, "expected size 5.");
LOG("Map is now at the limit.");
keyPtr = CacheableKey::create("6");
- ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL");
+ ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL");
LOG("About to spill over.");
entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag);
LOG("Spilled over.");
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testEntriesMapForVersioning.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testEntriesMapForVersioning.cpp b/src/cppcache/integration-test/testEntriesMapForVersioning.cpp
index b99fb9d..7e4e301 100644
--- a/src/cppcache/integration-test/testEntriesMapForVersioning.cpp
+++ b/src/cppcache/integration-test/testEntriesMapForVersioning.cpp
@@ -92,9 +92,9 @@ void createRegion(const char* name, bool ackMode,
fflush(stdout);
// ack, caching
regPtr =
- getHelper()->createRegion(name, ackMode, caching, NULLPTR,
+ getHelper()->createRegion(name, ackMode, caching, nullptr,
clientNotificationEnabled, true, true, 5000);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
@@ -102,7 +102,7 @@ typedef std::vector<MapEntryImplPtr> VectorOfMapEntry;
CacheableStringPtr createCacheable(const char* value) {
CacheableStringPtr result = CacheableString::create(value);
- ASSERT(result != NULLPTR, "expected result non-NULL");
+ ASSERT(result != nullptr, "expected result non-NULL");
return result;
}
@@ -111,29 +111,29 @@ uint8_t addr2[6] = {0xff, 0xff, 0xff, 0xaa, 0xff, 0xbb};
uint8_t addr3[6] = {0xff, 0xff, 0xaa, 0xaa, 0xff, 0xff};
uint8_t addr4[6] = {0xff, 0xff, 0xff, 0xff, 0xaa, 0xff};
-ClientProxyMembershipIDPtr member_host1(
- new ClientProxyMembershipID(addr1, 6, 80, "", "myuniquetag", 0));
-ClientProxyMembershipIDPtr member_host12(
- new ClientProxyMembershipID(addr1, 6, 80, "", "myuniquetah", 0));
-ClientProxyMembershipIDPtr member_host13(
- new ClientProxyMembershipID(addr1, 6, 81, "", "myuniquetag", 0));
-ClientProxyMembershipIDPtr member_host14(
- new ClientProxyMembershipID(addr1, 6, 88, "", "myuniquetag", 0));
-ClientProxyMembershipIDPtr member_host15(
- new ClientProxyMembershipID(addr2, 6, 88, "", "myuniquetag", 0));
-ClientProxyMembershipIDPtr member_host16(
- new ClientProxyMembershipID(addr3, 6, 88, "", "myuniquetag", 0));
-ClientProxyMembershipIDPtr member_host17(
- new ClientProxyMembershipID(addr4, 6, 88, "", "myuniquetag", 0));
-DiskStoreId* diskStore17 = new DiskStoreId(1, 7);
-DiskStoreId* diskStore18 = new DiskStoreId(1, 8);
-DiskStoreId* diskStore27 = new DiskStoreId(2, 7);
-ClientProxyMembershipIDPtr member_host_vmview5(
- new ClientProxyMembershipID(addr4, 6, 88, "", "", 5));
-ClientProxyMembershipIDPtr member_host_vmview6(
- new ClientProxyMembershipID(addr4, 6, 88, "", "", 6));
-ClientProxyMembershipIDPtr member_host_vmview7(
- new ClientProxyMembershipID(addr4, 6, 88, "", "", 7));
+auto member_host1 = std::make_shared<ClientProxyMembershipID>(addr1, 6, 80, "",
+ "myuniquetag", 0);
+auto member_host12 = std::make_shared<ClientProxyMembershipID>(
+ addr1, 6, 80, "", "myuniquetah", 0);
+auto member_host13 = std::make_shared<ClientProxyMembershipID>(
+ addr1, 6, 81, "", "myuniquetag", 0);
+auto member_host14 = std::make_shared<ClientProxyMembershipID>(
+ addr1, 6, 88, "", "myuniquetag", 0);
+auto member_host15 = std::make_shared<ClientProxyMembershipID>(
+ addr2, 6, 88, "", "myuniquetag", 0);
+auto member_host16 = std::make_shared<ClientProxyMembershipID>(
+ addr3, 6, 88, "", "myuniquetag", 0);
+auto member_host17 = std::make_shared<ClientProxyMembershipID>(
+ addr4, 6, 88, "", "myuniquetag", 0);
+auto diskStore17 = new DiskStoreId(1, 7);
+auto diskStore18 = new DiskStoreId(1, 8);
+auto diskStore27 = new DiskStoreId(2, 7);
+auto member_host_vmview5 =
+ std::make_shared<ClientProxyMembershipID>(addr4, 6, 88, "", "", 5);
+auto member_host_vmview6 =
+ std::make_shared<ClientProxyMembershipID>(addr4, 6, 88, "", "", 6);
+auto member_host_vmview7 =
+ std::make_shared<ClientProxyMembershipID>(addr4, 6, 88, "", "", 7);
uint16_t host1;
uint16_t host12;
@@ -155,6 +155,13 @@ int DeltaEx::fromDeltaCount = 0;
int DeltaEx::fromDataCount = 0;
int DeltaEx::cloneCount = 0;
+//#undef DUNIT_TASK_DEFINITION
+//#define DUNIT_TASK_DEFINITION(_X, _Y) void _Y()
+//#undef END_TASK_DEFINITION
+//#define END_TASK_DEFINITION
+//#undef CALL_TASK
+//#define CALL_TASK(_Y) _Y()
+
DUNIT_TASK_DEFINITION(CLIENT1, CREATECLIENT)
{
initClient();
@@ -169,7 +176,7 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, StepOne_AddHosts)
{
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr.ptr()));
+ auto lregPtr = std::dynamic_pointer_cast<LocalRegion>(regPtr);
host1 = lregPtr->getCacheImpl()->getMemberListForVersionStamp()->add(
member_host1);
host12 = lregPtr->getCacheImpl()->getMemberListForVersionStamp()->add(
@@ -201,65 +208,63 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, StepTwo_TestPut)
{
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr.ptr()));
- CacheableStringPtr ccstr = createCacheable("100");
- CacheablePtr ct = ccstr;
- CacheableStringPtr ccstr1 = createCacheable("500");
- CacheablePtr ct1 = ccstr1;
- EntryFactory* entryFactory = EntryFactory::singleton;
+ auto lregPtr = std::dynamic_pointer_cast<LocalRegion>(regPtr);
+ auto ccstr = createCacheable("100");
+ auto ccstr1 = createCacheable("500");
+ auto entryFactory = EntryFactory::singleton;
entryFactory->setConcurrencyChecksEnabled(true);
- EntriesMap* entries = new ConcurrentEntriesMap(entryFactory, true, lregPtr);
+ EntriesMap* entries =
+ new ConcurrentEntriesMap(entryFactory, true, lregPtr.get());
entries->open();
- CacheableKeyPtr keyPtr = CacheableKey::create((char*)"key1");
- ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL");
+ auto keyPtr = CacheableKey::create("key1");
+ ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL");
MapEntryImplPtr me;
- VersionTagPtr versionTag1(new VersionTag(5, 6, 7, host1, 0));
+ auto versionTag1 = std::make_shared<VersionTag>(5, 6, 7, host1, 0);
- VersionTagPtr versionTag12(new VersionTag(5, 6, 7, host12, 0));
+ auto versionTag12 = std::make_shared<VersionTag>(5, 6, 7, host12, 0);
- VersionTagPtr versionTag13(new VersionTag(5, 6, 7, host13, 0));
- VersionTagPtr versionTag14(new VersionTag(5, 6, 7, host14, 0));
- VersionTagPtr versionTag15(new VersionTag(5, 6, 7, host15, 0));
- VersionTagPtr versionTag16(new VersionTag(5, 6, 7, host16, 0));
- VersionTagPtr versionTag17(new VersionTag(5, 6, 7, host17, 0));
+ auto versionTag13 = std::make_shared<VersionTag>(5, 6, 7, host13, 0);
+ auto versionTag14 = std::make_shared<VersionTag>(5, 6, 7, host14, 0);
+ auto versionTag15 = std::make_shared<VersionTag>(5, 6, 7, host15, 0);
+ auto versionTag16 = std::make_shared<VersionTag>(5, 6, 7, host16, 0);
+ auto versionTag17 = std::make_shared<VersionTag>(5, 6, 7, host17, 0);
CacheablePtr oldValue;
- entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag1);
+ entries->put(keyPtr, ccstr, me, oldValue, -1, 0, versionTag1);
char log[256];
- GfErrType err =
- entries->put(keyPtr, ct1, me, oldValue, -1, 0, versionTag12);
+ auto err = entries->put(keyPtr, ccstr1, me, oldValue, -1, 0, versionTag12);
ASSERT(err != GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception");
- err = entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag1);
+ err = entries->put(keyPtr, ccstr, me, oldValue, -1, 0, versionTag1);
ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception");
- err = entries->put(keyPtr, ct1, me, oldValue, -1, 0, versionTag13);
+ err = entries->put(keyPtr, ccstr1, me, oldValue, -1, 0, versionTag13);
ASSERT(err != GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception");
- err = entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag1);
+ err = entries->put(keyPtr, ccstr, me, oldValue, -1, 0, versionTag1);
ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception");
uint32_t conflatedEvents =
lregPtr->getCacheImpl()->m_cacheStats->getConflatedEvents();
ASSERT(conflatedEvents == 2, "conflated events should be 2");
- err = entries->put(keyPtr, ct1, me, oldValue, -1, 0, versionTag14);
+ err = entries->put(keyPtr, ccstr1, me, oldValue, -1, 0, versionTag14);
ASSERT(err != GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception");
- err = entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag1);
+ err = entries->put(keyPtr, ccstr, me, oldValue, -1, 0, versionTag1);
ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception");
- err = entries->put(keyPtr, ct1, me, oldValue, -1, 0, versionTag15);
+ err = entries->put(keyPtr, ccstr1, me, oldValue, -1, 0, versionTag15);
ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception");
- err = entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag1);
+ err = entries->put(keyPtr, ccstr, me, oldValue, -1, 0, versionTag1);
ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception");
- err = entries->put(keyPtr, ct1, me, oldValue, -1, 0, versionTag16);
+ err = entries->put(keyPtr, ccstr1, me, oldValue, -1, 0, versionTag16);
ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception");
- err = entries->put(keyPtr, ct1, me, oldValue, -1, 0, versionTag17);
+ err = entries->put(keyPtr, ccstr1, me, oldValue, -1, 0, versionTag17);
ASSERT(err != GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception");
MapEntryImplPtr result;
CacheablePtr value;
@@ -267,24 +272,24 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwo_TestPut)
ASSERT(atoi(value->toString()->asChar()) == 500, "an exception");
ASSERT(me->getVersionStamp().getMemberId() == 7, "an exception");
- VersionTagPtr versionTag18(new VersionTag(0xffffaa, 6, 7, host1, 0));
+ auto versionTag18 = std::make_shared<VersionTag>(0xffffaa, 6, 7, host1, 0);
// version rollover, this will not be applied
- err = entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag18);
+ err = entries->put(keyPtr, ccstr, me, oldValue, -1, 0, versionTag18);
ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception");
entries->getEntry(keyPtr, result, value);
ASSERT(atoi(value->toString()->asChar()) == 500, "an exception");
ASSERT(me->getVersionStamp().getMemberId() == 7, "an exception");
- CacheableKeyPtr keyPtr2 = CacheableKey::create((char*)"Key2");
- err = entries->put(keyPtr2, ct, me, oldValue, -1, 0, versionTag18);
+ auto keyPtr2 = CacheableKey::create("Key2");
+ err = entries->put(keyPtr2, ccstr, me, oldValue, -1, 0, versionTag18);
ASSERT(err != GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception");
entries->getEntry(keyPtr2, result, value);
ASSERT(atoi(value->toString()->asChar()) == 100, "an exception");
ASSERT(me->getVersionStamp().getMemberId() == 1, "an exception");
// version rollover, this will be applied
- err = entries->put(keyPtr2, ct1, me, oldValue, -1, 0, versionTag12);
+ err = entries->put(keyPtr2, ccstr1, me, oldValue, -1, 0, versionTag12);
ASSERT(err != GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception");
entries->getEntry(keyPtr2, result, value);
ASSERT(atoi(value->toString()->asChar()) == 500, "an exception");
@@ -292,7 +297,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwo_TestPut)
// Null version tag, this will be applied
VersionTagPtr versionTag19;
- err = entries->put(keyPtr2, ct, me, oldValue, -1, 0, versionTag19);
+ err = entries->put(keyPtr2, ccstr, me, oldValue, -1, 0, versionTag19);
ASSERT(err != GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception");
entries->getEntry(keyPtr2, result, value);
ASSERT(atoi(value->toString()->asChar()) == 100, "an exception");
@@ -300,8 +305,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwo_TestPut)
ASSERT(result->getVersionStamp().getEntryVersion() == 5, "an exception");
// inserts a null tag
- CacheableKeyPtr keyPtr3 = CacheableKey::create((char*)"Key3");
- err = entries->put(keyPtr3, ct1, me, oldValue, -1, 0, versionTag19);
+ auto keyPtr3 = CacheableKey::create("Key3");
+ err = entries->put(keyPtr3, ccstr1, me, oldValue, -1, 0, versionTag19);
ASSERT(err == GF_NOERR, "an exception");
entries->getEntry(keyPtr3, result, value);
ASSERT(atoi(value->toString()->asChar()) == 500, "an exception");
@@ -312,7 +317,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwo_TestPut)
// version
// stamp,
// should be allowed.
- err = entries->put(keyPtr3, ct1, me, oldValue, -1, 0, versionTag12);
+ err = entries->put(keyPtr3, ccstr1, me, oldValue, -1, 0, versionTag12);
ASSERT(err == GF_NOERR, "an exception");
entries->getEntry(keyPtr3, result, value);
ASSERT(atoi(value->toString()->asChar()) == 500, "an exception");
@@ -329,9 +334,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwo_TestPut)
sprintf(log, "Some delta tests...");
LOG(log);
- CacheableKeyPtr keyPtr4 = CacheableKey::create((char*)"Key4");
- DeltaEx* ptr = new DeltaEx();
- CacheablePtr valPtr(ptr);
+ auto keyPtr4 = CacheableKey::create("Key4");
+ auto valPtr = std::make_shared<DeltaEx>();
err = entries->put(keyPtr4, valPtr, me, oldValue, -1, 0, versionTag12);
ASSERT(err == GF_NOERR, "an exception");
entries->getEntry(keyPtr4, result, value);
@@ -339,17 +343,17 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwo_TestPut)
ASSERT(result->getVersionStamp().getEntryVersion() == 5, "an exception");
ASSERT(DeltaEx::fromDeltaCount == 0, " Delta count should have been 0 ");
- DeltaEx* ptr1 = new DeltaEx();
- ptr1->setDelta(true);
- CacheablePtr valPtr1(ptr1);
+ auto valPtr1 = std::make_shared<DeltaEx>();
+ valPtr1->setDelta(true);
DataOutput doutput;
doutput.writeInt(1);
- const uint8_t* buffer = doutput.getBuffer();
+ const auto buffer = doutput.getBuffer();
DataInput datainput(buffer, doutput.getBufferLength());
bool isUpdate;
- VersionTagPtr versionTag12plus(new VersionTag(6, 6, 7, host13, host12));
+ auto versionTag12plus =
+ std::make_shared<VersionTag>(6, 6, 7, host13, host12);
err = entries->put(keyPtr4, valPtr1, me, oldValue, -1, 0, versionTag12plus,
isUpdate, &datainput);
@@ -370,7 +374,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwo_TestPut)
// Delta update, Not allowed as delta based on a different host version
// different
- VersionTagPtr versionTag12pp(new VersionTag(7, 6, 7, host13, host12));
+ auto versionTag12pp = std::make_shared<VersionTag>(7, 6, 7, host13, host12);
err = entries->put(keyPtr4, valPtr1, me, oldValue, -1, 0, versionTag12plus,
isUpdate, &datainput);
ASSERT(err == GF_INVALID_DELTA, "an exception");
@@ -379,16 +383,16 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwo_TestPut)
ASSERT(result->getVersionStamp().getEntryVersion() == 6, "an exception");
ASSERT(DeltaEx::fromDeltaCount == 1, " Delta count should have been 1 ");
- DeltaEx* ptr2 = new DeltaEx();
- ptr2->setDelta(true);
- CacheablePtr valPtr2(ptr2);
+ auto valPtr2 = std::make_shared<DeltaEx>();
+ valPtr2->setDelta(true);
DataOutput doutput1;
doutput1.writeInt(1);
- const uint8_t* buffer1 = doutput1.getBuffer();
+ const auto buffer1 = doutput1.getBuffer();
DataInput datainput1(buffer1, doutput1.getBufferLength());
DeltaEx::fromDeltaCount = 0;
// Delta update, allowed as delta based on correct host version different
- VersionTagPtr versionTag12pp1(new VersionTag(7, 6, 7, host14, host13));
+ auto versionTag12pp1 =
+ std::make_shared<VersionTag>(7, 6, 7, host14, host13);
err = entries->put(keyPtr4, valPtr2, me, oldValue, -1, 0, versionTag12pp1,
isUpdate, &datainput1);
ASSERT(err == GF_NOERR, "an exception");
@@ -398,19 +402,25 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwo_TestPut)
ASSERT(DeltaEx::fromDeltaCount == 1, " Delta count should have been 1 ");
/******* Test disk version tags*****************/
- VersionTagPtr versiondiskTag17(new DiskVersionTag(5, 6, 7, disk17, 0));
- VersionTagPtr versiondiskTag18(new DiskVersionTag(5, 6, 7, disk18, 0));
- VersionTagPtr versiondiskTag27(new DiskVersionTag(5, 6, 7, disk27, 0));
- CacheableKeyPtr keydiskPtr = CacheableKey::create((char*)"keydisk1");
- err = entries->put(keydiskPtr, ct, me, oldValue, -1, 0, versiondiskTag17);
- err = entries->put(keydiskPtr, ct1, me, oldValue, -1, 0, versiondiskTag27);
+ auto versiondiskTag17 =
+ std::make_shared<DiskVersionTag>(5, 6, 7, disk17, 0);
+ auto versiondiskTag18 =
+ std::make_shared<DiskVersionTag>(5, 6, 7, disk18, 0);
+ auto versiondiskTag27 =
+ std::make_shared<DiskVersionTag>(5, 6, 7, disk27, 0);
+ auto keydiskPtr = CacheableKey::create("keydisk1");
+ err =
+ entries->put(keydiskPtr, ccstr, me, oldValue, -1, 0, versiondiskTag17);
+ err =
+ entries->put(keydiskPtr, ccstr1, me, oldValue, -1, 0, versiondiskTag27);
ASSERT(err == GF_NOERR, "an exception");
entries->getEntry(keydiskPtr, result, value);
ASSERT(atoi(value->toString()->asChar()) == 500, "an exception");
ASSERT(result->getVersionStamp().getMemberId() == disk27, "an exception");
ASSERT(result->getVersionStamp().getEntryVersion() == 5, "an exception");
- err = entries->put(keydiskPtr, ct, me, oldValue, -1, 0, versiondiskTag18);
+ err =
+ entries->put(keydiskPtr, ccstr, me, oldValue, -1, 0, versiondiskTag18);
ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception");
entries->getEntry(keydiskPtr, result, value);
ASSERT(atoi(value->toString()->asChar()) == 500, "an exception");
@@ -418,15 +428,18 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwo_TestPut)
ASSERT(result->getVersionStamp().getEntryVersion() == 5, "an exception");
/********* Test with vm view ids ****************/
- VersionTagPtr versionvmviewTag5(new VersionTag(5, 6, 7, hostVmview5, 0));
- VersionTagPtr versionvmviewTag6(new VersionTag(5, 6, 7, hostVmview6, 0));
- VersionTagPtr versionvmviewTag7(new VersionTag(5, 6, 7, hostVmview7, 0));
- CacheableKeyPtr keyvmviewPtr = CacheableKey::create((char*)"keyvm1");
- err =
- entries->put(keyvmviewPtr, ct, me, oldValue, -1, 0, versionvmviewTag5);
-
- err =
- entries->put(keyvmviewPtr, ct1, me, oldValue, -1, 0, versionvmviewTag7);
+ auto versionvmviewTag5 =
+ std::make_shared<VersionTag>(5, 6, 7, hostVmview5, 0);
+ auto versionvmviewTag6 =
+ std::make_shared<VersionTag>(5, 6, 7, hostVmview6, 0);
+ auto versionvmviewTag7 =
+ std::make_shared<VersionTag>(5, 6, 7, hostVmview7, 0);
+ auto keyvmviewPtr = CacheableKey::create("keyvm1");
+ err = entries->put(keyvmviewPtr, ccstr, me, oldValue, -1, 0,
+ versionvmviewTag5);
+
+ err = entries->put(keyvmviewPtr, ccstr1, me, oldValue, -1, 0,
+ versionvmviewTag7);
ASSERT(err == GF_NOERR, "an exception");
entries->getEntry(keyvmviewPtr, result, value);
ASSERT(atoi(value->toString()->asChar()) == 500, "an exception");
@@ -434,8 +447,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwo_TestPut)
"an exception");
ASSERT(result->getVersionStamp().getEntryVersion() == 5, "an exception");
- err =
- entries->put(keyvmviewPtr, ct, me, oldValue, -1, 0, versionvmviewTag6);
+ err = entries->put(keyvmviewPtr, ccstr, me, oldValue, -1, 0,
+ versionvmviewTag6);
ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception");
entries->getEntry(keyvmviewPtr, result, value);
ASSERT(atoi(value->toString()->asChar()) == 500, "an exception");
@@ -451,17 +464,16 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTwo_TestPut)
END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, StepThree_TestCreate)
{
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr.ptr()));
- CacheableStringPtr ccstr = createCacheable("100");
- CacheablePtr ct = ccstr;
- CacheableStringPtr ccstr1 = createCacheable("500");
- CacheablePtr ct1 = ccstr1;
- EntryFactory* entryFactory = EntryFactory::singleton;
+ auto lregPtr = std::dynamic_pointer_cast<LocalRegion>(regPtr);
+ auto ccstr = createCacheable("100");
+ auto ccstr1 = createCacheable("500");
+ auto entryFactory = EntryFactory::singleton;
entryFactory->setConcurrencyChecksEnabled(true);
- EntriesMap* entries = new ConcurrentEntriesMap(entryFactory, true, lregPtr);
+ EntriesMap* entries =
+ new ConcurrentEntriesMap(entryFactory, true, lregPtr.get());
entries->open();
- CacheableKeyPtr keyPtr4 = CacheableKey::create((char*)"key4");
- ASSERT(keyPtr4 != NULLPTR, "expected keyPtr non-NULL");
+ auto keyPtr4 = CacheableKey::create("key4");
+ ASSERT(keyPtr4 != nullptr, "expected keyPtr non-NULL");
MapEntryImplPtr me;
MapEntryImplPtr result;
CacheablePtr value;
@@ -469,87 +481,87 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree_TestCreate)
/*new VersionTag(int32_t entryVersion,
int16_t regionVersionHighBytes, int32_t regionVersionLowBytes,
uint16_t internalMemId, uint16_t previousMemId) */
- VersionTagPtr versionTag1(new VersionTag(5, 6, 7, host1, 0));
+ auto versionTag1 = std::make_shared<VersionTag>(5, 6, 7, host1, 0);
- VersionTagPtr versionTag12(new VersionTag(5, 6, 7, host12, 0));
+ auto versionTag12 = std::make_shared<VersionTag>(5, 6, 7, host12, 0);
- VersionTagPtr versionTag13(new VersionTag(5, 6, 7, host13, 0));
- VersionTagPtr versionTag14(new VersionTag(5, 6, 7, host14, 0));
- VersionTagPtr versionTag15(new VersionTag(5, 6, 7, host15, 0));
- VersionTagPtr versionTag16(new VersionTag(5, 6, 7, host16, 0));
- VersionTagPtr versionTag17(new VersionTag(5, 6, 7, host17, 0));
+ auto versionTag13 = std::make_shared<VersionTag>(5, 6, 7, host13, 0);
+ auto versionTag14 = std::make_shared<VersionTag>(5, 6, 7, host14, 0);
+ auto versionTag15 = std::make_shared<VersionTag>(5, 6, 7, host15, 0);
+ auto versionTag16 = std::make_shared<VersionTag>(5, 6, 7, host16, 0);
+ auto versionTag17 = std::make_shared<VersionTag>(5, 6, 7, host17, 0);
CacheablePtr oldValue;
- entries->create(keyPtr4, ct, me, oldValue, -1, 0, versionTag1);
+ entries->create(keyPtr4, ccstr, me, oldValue, -1, 0, versionTag1);
entries->getEntry(keyPtr4, result, value);
ASSERT(me->getVersionStamp().getEntryVersion() == 5, "an exception");
ASSERT(me->getVersionStamp().getMemberId() == 1, "an exception");
char log[256];
- CacheableKeyPtr keyPtr = CacheableKey::create((char*)"Key");
- GfErrType err =
- entries->create(keyPtr, NULLPTR, me, oldValue, -1, 0, versionTag12);
+ auto keyPtr = CacheableKey::create("Key");
+ auto err =
+ entries->create(keyPtr, nullptr, me, oldValue, -1, 0, versionTag12);
ASSERT(err == GF_NOERR, "an exception");
- err = entries->create(keyPtr, NULLPTR, me, oldValue, -1, 0, versionTag1);
+ err = entries->create(keyPtr, nullptr, me, oldValue, -1, 0, versionTag1);
ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception");
- err = entries->create(keyPtr, NULLPTR, me, oldValue, -1, 0, versionTag13);
+ err = entries->create(keyPtr, nullptr, me, oldValue, -1, 0, versionTag13);
ASSERT(err == GF_NOERR, "an exception");
- err = entries->create(keyPtr, NULLPTR, me, oldValue, -1, 0, versionTag1);
+ err = entries->create(keyPtr, nullptr, me, oldValue, -1, 0, versionTag1);
ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception");
- err = entries->create(keyPtr, NULLPTR, me, oldValue, -1, 0, versionTag14);
+ err = entries->create(keyPtr, nullptr, me, oldValue, -1, 0, versionTag14);
ASSERT(err == GF_NOERR, "an exception");
- err = entries->create(keyPtr, NULLPTR, me, oldValue, -1, 0, versionTag1);
+ err = entries->create(keyPtr, nullptr, me, oldValue, -1, 0, versionTag1);
ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception");
- err = entries->create(keyPtr, NULLPTR, me, oldValue, -1, 0, versionTag15);
+ err = entries->create(keyPtr, nullptr, me, oldValue, -1, 0, versionTag15);
ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception");
- err = entries->create(keyPtr, NULLPTR, me, oldValue, -1, 0, versionTag1);
+ err = entries->create(keyPtr, nullptr, me, oldValue, -1, 0, versionTag1);
ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception");
- err = entries->create(keyPtr, NULLPTR, me, oldValue, -1, 0, versionTag16);
+ err = entries->create(keyPtr, nullptr, me, oldValue, -1, 0, versionTag16);
ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception");
- err = entries->create(keyPtr, ct1, me, oldValue, -1, 0, versionTag17);
+ err = entries->create(keyPtr, ccstr1, me, oldValue, -1, 0, versionTag17);
ASSERT(err == GF_NOERR, "an exception");
entries->getEntry(keyPtr, result, value);
ASSERT(result->getVersionStamp().getMemberId() == 7, "an exception");
ASSERT(result->getVersionStamp().getEntryVersion() == 5, "an exception");
- VersionTagPtr versionTag18(new VersionTag(0xffffaa, 6, 7, host1, 0));
+ auto versionTag18 = std::make_shared<VersionTag>(0xffffaa, 6, 7, host1, 0);
- CacheableKeyPtr keyPtr2 = CacheableKey::create((char*)"Key2");
- err = entries->create(keyPtr2, NULLPTR, me, oldValue, -1, 0, versionTag18);
+ auto keyPtr2 = CacheableKey::create("Key2");
+ err = entries->create(keyPtr2, nullptr, me, oldValue, -1, 0, versionTag18);
ASSERT(err == GF_NOERR, "an exception");
// version rollover, this will be applied
- err = entries->create(keyPtr2, NULLPTR, me, oldValue, -1, 0, versionTag12);
+ err = entries->create(keyPtr2, nullptr, me, oldValue, -1, 0, versionTag12);
ASSERT(err == GF_NOERR, "an exception");
// Null version tag, this will be applied
VersionTagPtr versionTag19;
- err = entries->create(keyPtr2, ct, me, oldValue, -1, 0, versionTag19);
+ err = entries->create(keyPtr2, ccstr, me, oldValue, -1, 0, versionTag19);
ASSERT(err == GF_NOERR, "an exception");
entries->getEntry(keyPtr2, result, value);
ASSERT(result->getVersionStamp().getMemberId() == 2, "an exception");
ASSERT(result->getVersionStamp().getEntryVersion() == 5, "an exception");
// inserts a null tag
- CacheableKeyPtr keyPtr3 = CacheableKey::create((char*)"Key3");
- err = entries->create(keyPtr3, NULLPTR, me, oldValue, -1, 0, versionTag19);
+ auto keyPtr3 = CacheableKey::create("Key3");
+ err = entries->create(keyPtr3, nullptr, me, oldValue, -1, 0, versionTag19);
ASSERT(err == GF_NOERR, "an exception");
// inserts an entry with version stamp, the previous entry is without
// version
// stamp,
// should be allowed.
- err = entries->create(keyPtr3, ct1, me, oldValue, -1, 0, versionTag12);
+ err = entries->create(keyPtr3, ccstr1, me, oldValue, -1, 0, versionTag12);
ASSERT(err == GF_NOERR, "an exception");
entries->getEntry(keyPtr3, result, value);
ASSERT(result->getVersionStamp().getMemberId() == 2, "an exception");
@@ -564,46 +576,43 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, StepEight_TestLRUEntries)
{
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr.ptr()));
- CacheableStringPtr ccstr = createCacheable("100");
- CacheablePtr ct = ccstr;
- CacheableStringPtr ccstr1 = createCacheable("500");
- CacheablePtr ct1 = ccstr1;
- EntryFactory* entryFactory = LRUExpEntryFactory::singleton;
+ auto lregPtr = std::dynamic_pointer_cast<LocalRegion>(regPtr);
+ auto ccstr = createCacheable("100");
+ auto ccstr1 = createCacheable("500");
+ auto entryFactory = LRUExpEntryFactory::singleton;
entryFactory->setConcurrencyChecksEnabled(true);
- EntriesMap* entries = new LRUEntriesMap(entryFactory, lregPtr,
+ EntriesMap* entries = new LRUEntriesMap(entryFactory, lregPtr.get(),
LRUAction::DESTROY, 50000, true);
entries->open();
- CacheableKeyPtr keyPtr4 = CacheableKey::create((char*)"key4");
- CacheableKeyPtr keyPtr5 = CacheableKey::create((char*)"key5");
- CacheableKeyPtr keyPtr6 = CacheableKey::create((char*)"key6");
+ auto keyPtr4 = CacheableKey::create("key4");
+ auto keyPtr5 = CacheableKey::create("key5");
+ auto keyPtr6 = CacheableKey::create("key6");
MapEntryImplPtr me;
MapEntryImplPtr result;
CacheablePtr value;
char log[256];
- VersionTagPtr versionTag1(new VersionTag(5, 6, 7, host1, 0));
+ auto versionTag1 = std::make_shared<VersionTag>(5, 6, 7, host1, 0);
- VersionTagPtr versionTag12(new VersionTag(5, 6, 7, host12, 0));
+ auto versionTag12 = std::make_shared<VersionTag>(5, 6, 7, host12, 0);
- entries->put(keyPtr4, ct, me, value, -1, 0, versionTag1);
+ entries->put(keyPtr4, ccstr, me, value, -1, 0, versionTag1);
- GfErrType err =
- entries->remove(keyPtr4, value, me, -1, versionTag12, false);
+ auto err = entries->remove(keyPtr4, value, me, -1, versionTag12, false);
ASSERT(err == GF_NOERR, "an exception");
bool isTombstone;
err = entries->isTombstone(keyPtr4, result, isTombstone);
ASSERT(err == GF_NOERR, "an exception");
ASSERT(isTombstone == true, "an exception");
- entries->put(keyPtr5, ct, me, value, -1, 0, versionTag1);
+ entries->put(keyPtr5, ccstr, me, value, -1, 0, versionTag1);
err = entries->invalidate(keyPtr5, me, value, versionTag12);
ASSERT(err == GF_NOERR, "an exception");
entries->getEntry(keyPtr5, result, value);
ASSERT(CacheableToken::isInvalid(value) == true, "an exception");
- entries->put(keyPtr6, ct, me, value, -1, 0, versionTag1);
+ entries->put(keyPtr6, ccstr, me, value, -1, 0, versionTag1);
ASSERT(entries->get(keyPtr4, value, result) == false, "an exception");
ASSERT(entries->get(keyPtr6, value, result) == true, "an exception");
@@ -617,38 +626,36 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, StepFive_TestTombstoneExpiry)
{
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr.ptr()));
- CacheableStringPtr ccstr = createCacheable("100");
- CacheablePtr ct = ccstr;
- CacheableStringPtr ccstr1 = createCacheable("500");
- CacheablePtr ct1 = ccstr1;
- EntryFactory* entryFactory = EntryFactory::singleton;
+ auto lregPtr = std::dynamic_pointer_cast<LocalRegion>(regPtr);
+ auto ccstr = createCacheable("100");
+ auto ccstr1 = createCacheable("500");
+ auto entryFactory = EntryFactory::singleton;
entryFactory->setConcurrencyChecksEnabled(true);
- EntriesMap* entries = new ConcurrentEntriesMap(entryFactory, true, lregPtr);
+ EntriesMap* entries =
+ new ConcurrentEntriesMap(entryFactory, true, lregPtr.get());
entries->open();
- CacheableKeyPtr keyPtr4 = CacheableKey::create((char*)"key4");
- CacheableKeyPtr keyPtr5 = CacheableKey::create((char*)"key5");
- CacheableKeyPtr keyPtr6 = CacheableKey::create((char*)"key6");
+ auto keyPtr4 = CacheableKey::create("key4");
+ auto keyPtr5 = CacheableKey::create("key5");
+ auto keyPtr6 = CacheableKey::create("key6");
MapEntryImplPtr me;
MapEntryImplPtr result;
CacheablePtr value;
char log[256];
- VersionTagPtr versionTag1(new VersionTag(5, 6, 7, host1, 0));
+ auto versionTag1 = std::make_shared<VersionTag>(5, 6, 7, host1, 0);
- VersionTagPtr versionTag12(new VersionTag(5, 6, 7, host12, 0));
+ auto versionTag12 = std::make_shared<VersionTag>(5, 6, 7, host12, 0);
- entries->put(keyPtr4, ct, me, value, -1, 0, versionTag1);
+ entries->put(keyPtr4, ccstr, me, value, -1, 0, versionTag1);
- GfErrType err =
- entries->remove(keyPtr4, value, me, -1, versionTag12, false);
+ auto err = entries->remove(keyPtr4, value, me, -1, versionTag12, false);
ASSERT(err == GF_NOERR, "an exception");
bool isTombstone;
err = entries->isTombstone(keyPtr4, result, isTombstone);
ASSERT(err == GF_NOERR, "an exception");
ASSERT(isTombstone == true, "an exception");
- entries->put(keyPtr5, ct, me, value, -1, 0, versionTag1);
+ entries->put(keyPtr5, ccstr, me, value, -1, 0, versionTag1);
err = entries->remove(keyPtr5, value, me, -1, versionTag12, false);
ASSERT(err == GF_NOERR, "an exception");
@@ -656,10 +663,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFive_TestTombstoneExpiry)
ASSERT(err == GF_NOERR, "an exception");
ASSERT(isTombstone == true, "an exception");
- entries->put(keyPtr6, ct, me, value, -1, 0, versionTag1);
- uint32_t tombstone_count =
+ entries->put(keyPtr6, ccstr, me, value, -1, 0, versionTag1);
+ auto tombstone_count =
lregPtr->getCacheImpl()->m_cacheStats->getTombstoneCount();
- uint64_t tombstone_size =
+ auto tombstone_size =
lregPtr->getCacheImpl()->m_cacheStats->getTombstoneSize();
sprintf(log,
@@ -682,9 +689,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFive_TestTombstoneExpiry)
ASSERT(isTombstone == false, "an exception");
ASSERT(entries->get(keyPtr4, value, result) == false, "an exception");
- uint32_t tombstone_count_after =
+ auto tombstone_count_after =
lregPtr->getCacheImpl()->m_cacheStats->getTombstoneCount();
- uint64_t tombstone_size_after =
+ auto tombstone_size_after =
lregPtr->getCacheImpl()->m_cacheStats->getTombstoneSize();
sprintf(log,
@@ -706,48 +713,47 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, StepSix_TestInvalidate)
{
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr.ptr()));
- CacheableStringPtr ccstr = createCacheable("100");
- CacheablePtr ct = ccstr;
- CacheableStringPtr ccstr1 = createCacheable("500");
- CacheablePtr ct1 = ccstr1;
- EntryFactory* entryFactory = EntryFactory::singleton;
+ auto lregPtr = std::dynamic_pointer_cast<LocalRegion>(regPtr);
+ auto ccstr = createCacheable("100");
+ auto ccstr1 = createCacheable("500");
+ auto entryFactory = EntryFactory::singleton;
entryFactory->setConcurrencyChecksEnabled(true);
- EntriesMap* entries = new ConcurrentEntriesMap(entryFactory, true, lregPtr);
+ EntriesMap* entries =
+ new ConcurrentEntriesMap(entryFactory, true, lregPtr.get());
entries->open();
- CacheableKeyPtr keyPtr = CacheableKey::create((char*)"key1");
- ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL");
+ CacheableKeyPtr keyPtr = CacheableKey::create("key1");
+ ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL");
MapEntryImplPtr me;
MapEntryImplPtr result;
CacheablePtr value;
- VersionTagPtr versionTag1(new VersionTag(5, 6, 7, host1, 0));
+ auto versionTag1 = std::make_shared<VersionTag>(5, 6, 7, host1, 0);
- VersionTagPtr versionTag12(new VersionTag(5, 6, 7, host12, 0));
+ auto versionTag12 = std::make_shared<VersionTag>(5, 6, 7, host12, 0);
- VersionTagPtr versionTag13(new VersionTag(5, 6, 7, host13, 0));
- VersionTagPtr versionTag14(new VersionTag(5, 6, 7, host14, 0));
- VersionTagPtr versionTag15(new VersionTag(5, 6, 7, host15, 0));
- VersionTagPtr versionTag16(new VersionTag(5, 6, 7, host16, 0));
- VersionTagPtr versionTag17(new VersionTag(5, 6, 7, host17, 0));
- VersionTagPtr versionTag22(new VersionTag(9, 10, 10, host12, 0));
+ auto versionTag13 = std::make_shared<VersionTag>(5, 6, 7, host13, 0);
+ auto versionTag14 = std::make_shared<VersionTag>(5, 6, 7, host14, 0);
+ auto versionTag15 = std::make_shared<VersionTag>(5, 6, 7, host15, 0);
+ auto versionTag16 = std::make_shared<VersionTag>(5, 6, 7, host16, 0);
+ auto versionTag17 = std::make_shared<VersionTag>(5, 6, 7, host17, 0);
+ auto versionTag22 = std::make_shared<VersionTag>(9, 10, 10, host12, 0);
CacheablePtr oldValue;
- entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag1);
+ entries->put(keyPtr, ccstr, me, oldValue, -1, 0, versionTag1);
char log[256];
- GfErrType err = entries->invalidate(keyPtr, me, oldValue, versionTag12);
+ auto err = entries->invalidate(keyPtr, me, oldValue, versionTag12);
ASSERT(err == GF_NOERR, "an exception");
entries->getEntry(keyPtr, result, value);
ASSERT(CacheableToken::isInvalid(value) == true, "an exception");
- err = entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag1);
+ err = entries->put(keyPtr, ccstr, me, oldValue, -1, 0, versionTag1);
ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception");
entries->getEntry(keyPtr, result, value);
ASSERT(CacheableToken::isInvalid(value) == true, "an exception");
- err = entries->put(keyPtr, ct1, me, oldValue, -1, 0, versionTag13);
+ err = entries->put(keyPtr, ccstr1, me, oldValue, -1, 0, versionTag13);
ASSERT(err == GF_NOERR, "an exception");
entries->getEntry(keyPtr, result, value);
ASSERT(CacheableToken::isInvalid(value) != true, "an exception");
@@ -776,18 +782,18 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSix_TestInvalidate)
ASSERT(result->getVersionStamp().getMemberId() == 2, "an exception");
ASSERT(result->getVersionStamp().getEntryVersion() == 9, "an exception");
- VersionTagPtr versionTag18(new VersionTag(0xffffaa, 6, 7, host1, 0));
+ auto versionTag18 = std::make_shared<VersionTag>(0xffffaa, 6, 7, host1, 0);
// version rollover, this will not be applied
- err = entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag18);
+ err = entries->put(keyPtr, ccstr, me, oldValue, -1, 0, versionTag18);
ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception");
entries->getEntry(keyPtr, result, value);
ASSERT(CacheableToken::isInvalid(value) == true, "an exception");
ASSERT(result->getVersionStamp().getMemberId() == 2, "an exception");
ASSERT(result->getVersionStamp().getEntryVersion() == 9, "an exception");
- CacheableKeyPtr keyPtr2 = CacheableKey::create((char*)"Key2");
- err = entries->put(keyPtr2, ct, me, oldValue, -1, 0, versionTag18);
+ auto keyPtr2 = CacheableKey::create("Key2");
+ err = entries->put(keyPtr2, ccstr, me, oldValue, -1, 0, versionTag18);
ASSERT(err == GF_NOERR, "an exception");
entries->getEntry(keyPtr2, result, value);
ASSERT(atoi(value->toString()->asChar()) == 100, "an exception");
@@ -803,7 +809,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSix_TestInvalidate)
// Null version tag, this will be applied
VersionTagPtr versionTag19;
- err = entries->put(keyPtr2, ct, me, oldValue, -1, 0, versionTag19);
+ err = entries->put(keyPtr2, ccstr, me, oldValue, -1, 0, versionTag19);
entries->getEntry(keyPtr2, result, value);
ASSERT(CacheableToken::isInvalid(value) != true, "an exception");
ASSERT(atoi(value->toString()->asChar()) == 100, "an exception");
@@ -811,8 +817,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSix_TestInvalidate)
ASSERT(result->getVersionStamp().getEntryVersion() == 9, "an exception");
// inserts a null tag
- CacheableKeyPtr keyPtr3 = CacheableKey::create((char*)"Key3");
- err = entries->put(keyPtr3, ct1, me, oldValue, -1, 0, versionTag19);
+ auto keyPtr3 = CacheableKey::create("Key3");
+ err = entries->put(keyPtr3, ccstr1, me, oldValue, -1, 0, versionTag19);
ASSERT(err == GF_NOERR, "an exception");
entries->getEntry(keyPtr3, result, value);
ASSERT(atoi(value->toString()->asChar()) == 500, "an exception");
@@ -836,40 +842,38 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, StepSeven_TestGetsAfterRemove)
{
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr.ptr()));
- CacheableStringPtr ccstr = createCacheable("100");
- CacheablePtr ct = ccstr;
- CacheableStringPtr ccstr1 = createCacheable("500");
- CacheablePtr ct1 = ccstr1;
- EntryFactory* entryFactory = EntryFactory::singleton;
+ auto lregPtr = std::dynamic_pointer_cast<LocalRegion>(regPtr);
+ auto ccstr = createCacheable("100");
+ auto ccstr1 = createCacheable("500");
+ auto entryFactory = EntryFactory::singleton;
entryFactory->setConcurrencyChecksEnabled(true);
- EntriesMap* entries = new ConcurrentEntriesMap(entryFactory, true, lregPtr);
+ EntriesMap* entries =
+ new ConcurrentEntriesMap(entryFactory, true, lregPtr.get());
entries->open();
- CacheableKeyPtr keyPtr4 = CacheableKey::create((char*)"key4");
- CacheableKeyPtr keyPtr5 = CacheableKey::create((char*)"key5");
- CacheableKeyPtr keyPtr6 = CacheableKey::create((char*)"key6");
+ auto keyPtr4 = CacheableKey::create("key4");
+ auto keyPtr5 = CacheableKey::create("key5");
+ auto keyPtr6 = CacheableKey::create("key6");
MapEntryImplPtr me;
MapEntryImplPtr result;
CacheablePtr value;
char log[256];
- VersionTagPtr versionTag1(new VersionTag(5, 6, 7, host1, 0));
+ auto versionTag1 = std::make_shared<VersionTag>(5, 6, 7, host1, 0);
- VersionTagPtr versionTag12(new VersionTag(5, 6, 7, host12, 0));
+ auto versionTag12 = std::make_shared<VersionTag>(5, 6, 7, host12, 0);
- VersionTagPtr versionTag22(new VersionTag(6, 6, 7, host12, 0));
+ auto versionTag22 = std::make_shared<VersionTag>(6, 6, 7, host12, 0);
- entries->put(keyPtr4, ct, me, value, -1, 0, versionTag1);
+ entries->put(keyPtr4, ccstr, me, value, -1, 0, versionTag1);
- GfErrType err =
- entries->remove(keyPtr4, value, me, -1, versionTag12, false);
+ auto err = entries->remove(keyPtr4, value, me, -1, versionTag12, false);
ASSERT(err == GF_NOERR, "an exception");
bool isTombstone;
err = entries->isTombstone(keyPtr4, result, isTombstone);
ASSERT(err == GF_NOERR, "an exception");
ASSERT(isTombstone == true, "an exception");
- entries->put(keyPtr5, ct, me, value, -1, 0, versionTag1);
+ entries->put(keyPtr5, ccstr, me, value, -1, 0, versionTag1);
err = entries->remove(keyPtr5, value, me, -1, versionTag12, false);
ASSERT(err == GF_NOERR, "an exception");
@@ -877,7 +881,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSeven_TestGetsAfterRemove)
ASSERT(err == GF_NOERR, "an exception");
ASSERT(isTombstone == true, "an exception");
- entries->put(keyPtr6, ct, me, value, -1, 0, versionTag1);
+ entries->put(keyPtr6, ccstr, me, value, -1, 0, versionTag1);
ASSERT(entries->containsKey(keyPtr6) == true, "an exception");
ASSERT(entries->containsKey(keyPtr5) == false, "an exception");
@@ -898,7 +902,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSeven_TestGetsAfterRemove)
entries->entries(regionEntries);
ASSERT(regionEntries.length() == 1, "an exception");
- entries->put(keyPtr5, ct, me, value, -1, 0, versionTag22);
+ entries->put(keyPtr5, ccstr, me, value, -1, 0, versionTag22);
ASSERT(entries->containsKey(keyPtr6) == true, "an exception");
ASSERT(entries->containsKey(keyPtr5) == true, "an exception");
@@ -924,38 +928,36 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepSeven_TestGetsAfterRemove)
END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, StepFour_TestRemove)
{
- LocalRegion* lregPtr = (dynamic_cast<LocalRegion*>(regPtr.ptr()));
- CacheableStringPtr ccstr = createCacheable("100");
- CacheablePtr ct = ccstr;
- CacheableStringPtr ccstr1 = createCacheable("500");
- CacheablePtr ct1 = ccstr1;
- EntryFactory* entryFactory = EntryFactory::singleton;
+ auto lregPtr = std::dynamic_pointer_cast<LocalRegion>(regPtr);
+ auto ccstr = createCacheable("100");
+ auto ccstr1 = createCacheable("500");
+ auto entryFactory = EntryFactory::singleton;
entryFactory->setConcurrencyChecksEnabled(true);
- EntriesMap* entries = new ConcurrentEntriesMap(entryFactory, true, lregPtr);
+ EntriesMap* entries =
+ new ConcurrentEntriesMap(entryFactory, true, lregPtr.get());
entries->open();
- CacheableKeyPtr keyPtr = CacheableKey::create((char*)"key1");
- ASSERT(keyPtr != NULLPTR, "expected keyPtr non-NULL");
+ auto keyPtr = CacheableKey::create("key1");
+ ASSERT(keyPtr != nullptr, "expected keyPtr non-NULL");
MapEntryImplPtr me;
MapEntryImplPtr result;
CacheablePtr value;
- VersionTagPtr versionTag1(new VersionTag(5, 6, 7, host1, 0));
+ auto versionTag1 = std::make_shared<VersionTag>(5, 6, 7, host1, 0);
- VersionTagPtr versionTag12(new VersionTag(5, 6, 7, host12, 0));
+ auto versionTag12 = std::make_shared<VersionTag>(5, 6, 7, host12, 0);
- VersionTagPtr versionTag13(new VersionTag(5, 6, 7, host13, 0));
- VersionTagPtr versionTag14(new VersionTag(5, 6, 7, host14, 0));
- VersionTagPtr versionTag15(new VersionTag(5, 6, 7, host15, 0));
- VersionTagPtr versionTag16(new VersionTag(5, 6, 7, host16, 0));
- VersionTagPtr versionTag17(new VersionTag(5, 6, 7, host17, 0));
- VersionTagPtr versionTag22(new VersionTag(9, 10, 10, host12, 0));
+ auto versionTag13 = std::make_shared<VersionTag>(5, 6, 7, host13, 0);
+ auto versionTag14 = std::make_shared<VersionTag>(5, 6, 7, host14, 0);
+ auto versionTag15 = std::make_shared<VersionTag>(5, 6, 7, host15, 0);
+ auto versionTag16 = std::make_shared<VersionTag>(5, 6, 7, host16, 0);
+ auto versionTag17 = std::make_shared<VersionTag>(5, 6, 7, host17, 0);
+ auto versionTag22 = std::make_shared<VersionTag>(9, 10, 10, host12, 0);
CacheablePtr oldValue;
- entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag1);
+ entries->put(keyPtr, ccstr, me, oldValue, -1, 0, versionTag1);
char log[256];
- GfErrType err =
- entries->remove(keyPtr, oldValue, me, -1, versionTag12, false);
+ auto err = entries->remove(keyPtr, oldValue, me, -1, versionTag12, false);
ASSERT(err == GF_NOERR, "an exception");
bool isTombstone;
@@ -964,15 +966,15 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour_TestRemove)
entries->getEntry(keyPtr, result, value);
ASSERT(isTombstone == true, "an exception");
- err = entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag1);
+ err = entries->put(keyPtr, ccstr, me, oldValue, -1, 0, versionTag1);
ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception");
err = entries->isTombstone(keyPtr, result, isTombstone);
ASSERT(err == GF_NOERR, "an exception");
ASSERT(isTombstone == true, "an exception");
- uint32_t tombstone_count =
+ auto tombstone_count =
lregPtr->getCacheImpl()->m_cacheStats->getTombstoneCount();
- uint64_t tombstone_size =
+ auto tombstone_size =
lregPtr->getCacheImpl()->m_cacheStats->getTombstoneSize();
sprintf(log, "After tombstone creation, Tombstone size: %" PRId64
@@ -984,7 +986,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour_TestRemove)
"Tombstone size should be greater than 70 bytes. 70 is an approx "
"figure for tombstone overhead");
- err = entries->put(keyPtr, ct1, me, oldValue, -1, 0, versionTag13);
+ err = entries->put(keyPtr, ccstr1, me, oldValue, -1, 0, versionTag13);
ASSERT(err == GF_NOERR, "an exception");
err = entries->isTombstone(keyPtr, result, isTombstone);
ASSERT(err == GF_NOERR, "an exception");
@@ -1018,13 +1020,13 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour_TestRemove)
ASSERT(result->getVersionStamp().getEntryVersion() == 5, "an exception");
ASSERT(entries->get(keyPtr, value, result) == false, "an exception");
- err = entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag1);
+ err = entries->put(keyPtr, ccstr, me, oldValue, -1, 0, versionTag1);
ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception");
- err = entries->put(keyPtr, ct1, me, oldValue, -1, 0, versionTag15);
+ err = entries->put(keyPtr, ccstr1, me, oldValue, -1, 0, versionTag15);
ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception");
- err = entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag1);
+ err = entries->put(keyPtr, ccstr, me, oldValue, -1, 0, versionTag1);
ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception");
err = entries->remove(keyPtr, oldValue, me, -1, versionTag16, false);
@@ -1048,10 +1050,10 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour_TestRemove)
ASSERT(result->getVersionStamp().getEntryVersion() == 9, "an exception");
ASSERT(entries->get(keyPtr, value, result) == false, "an exception");
- VersionTagPtr versionTag18(new VersionTag(0xffffaa, 6, 7, host1, 0));
+ auto versionTag18 = std::make_shared<VersionTag>(0xffffaa, 6, 7, host1, 0);
// version rollover, this will not be applied
- err = entries->put(keyPtr, ct, me, oldValue, -1, 0, versionTag18);
+ err = entries->put(keyPtr, ccstr, me, oldValue, -1, 0, versionTag18);
ASSERT(err == GF_CACHE_CONCURRENT_MODIFICATION_EXCEPTION, "an exception");
err = entries->isTombstone(keyPtr, result, isTombstone);
ASSERT(err == GF_NOERR, "an exception");
@@ -1060,8 +1062,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour_TestRemove)
ASSERT(result->getVersionStamp().getEntryVersion() == 9, "an exception");
ASSERT(entries->get(keyPtr, value, result) == false, "an exception");
- CacheableKeyPtr keyPtr2 = CacheableKey::create((char*)"Key2");
- err = entries->put(keyPtr2, ct, me, oldValue, -1, 0, versionTag18);
+ auto keyPtr2 = CacheableKey::create("Key2");
+ err = entries->put(keyPtr2, ccstr, me, oldValue, -1, 0, versionTag18);
ASSERT(err == GF_NOERR, "an exception");
entries->getEntry(keyPtr2, result, value);
ASSERT(atoi(value->toString()->asChar()) == 100, "an exception");
@@ -1079,7 +1081,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour_TestRemove)
// Null version tag, this will be applied
VersionTagPtr versionTag19;
- err = entries->put(keyPtr2, ct, me, oldValue, -1, 0, versionTag19);
+ err = entries->put(keyPtr2, ccstr, me, oldValue, -1, 0, versionTag19);
ASSERT(err == GF_NOERR, "an exception");
entries->getEntry(keyPtr2, result, value);
ASSERT(atoi(value->toString()->asChar()) == 100, "an exception");
@@ -1087,8 +1089,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour_TestRemove)
ASSERT(result->getVersionStamp().getEntryVersion() == 9, "an exception");
// inserts a null tag
- CacheableKeyPtr keyPtr3 = CacheableKey::create((char*)"Key3");
- err = entries->put(keyPtr3, ct1, me, oldValue, -1, 0, versionTag19);
+ auto keyPtr3 = CacheableKey::create("Key3");
+ err = entries->put(keyPtr3, ccstr1, me, oldValue, -1, 0, versionTag19);
ASSERT(err == GF_NOERR, "an exception");
entries->getEntry(keyPtr3, result, value);
ASSERT(atoi(value->toString()->asChar()) == 500, "an exception");
@@ -1107,36 +1109,36 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour_TestRemove)
ASSERT(result->getVersionStamp().getEntryVersion() == 5, "an exception");
ASSERT(entries->get(keyPtr3, value, result) == false, "an exception");
- CacheableKeyPtr keyPtrR2 = CacheableKey::create((char*)"keyPtrR2");
- CacheableKeyPtr keyPtrR3 = CacheableKey::create((char*)"keyPtrR3");
- CacheableKeyPtr keyPtrR4 = CacheableKey::create((char*)"keyPtrR4");
- CacheableKeyPtr keyPtrR5 = CacheableKey::create((char*)"keyPtrR5");
- CacheableKeyPtr keyPtrR6 = CacheableKey::create((char*)"keyPtrR6");
+ auto keyPtrR2 = CacheableKey::create("keyPtrR2");
+ auto keyPtrR3 = CacheableKey::create("keyPtrR3");
+ auto keyPtrR4 = CacheableKey::create("keyPtrR4");
+ auto keyPtrR5 = CacheableKey::create("keyPtrR5");
+ auto keyPtrR6 = CacheableKey::create("keyPtrR6");
- CacheableKeyPtr keyPtrR21 = CacheableKey::create((char*)"keyPtrR21");
- CacheableKeyPtr keyPtrR31 = CacheableKey::create((char*)"keyPtrR31");
- CacheableKeyPtr keyPtrR41 = CacheableKey::create((char*)"keyPtrR41");
- CacheableKeyPtr keyPtrR51 = CacheableKey::create((char*)"keyPtrR51");
- CacheableKeyPtr keyPtrR61 = CacheableKey::create((char*)"keyPtrR61");
+ auto keyPtrR21 = CacheableKey::create("keyPtrR21");
+ auto keyPtrR31 = CacheableKey::create("keyPtrR31");
+ auto keyPtrR41 = CacheableKey::create("keyPtrR41");
+ auto keyPtrR51 = CacheableKey::create("keyPtrR51");
+ auto keyPtrR61 = CacheableKey::create("keyPtrR61");
- VersionTagPtr versionTag23(new VersionTag(9, 10, 10, host13, 0));
- VersionTagPtr versionTag24(new VersionTag(9, 10, 10, host14, 0));
- VersionTagPtr versionTag25(new VersionTag(9, 10, 10, host15, 0));
- VersionTagPtr versionTag26(new VersionTag(9, 10, 10, host16, 0));
+ auto versionTag23 = std::make_shared<VersionTag>(9, 10, 10, host13, 0);
+ auto versionTag24 = std::make_shared<VersionTag>(9, 10, 10, host14, 0);
+ auto versionTag25 = std::make_shared<VersionTag>(9, 10, 10, host15, 0);
+ auto versionTag26 = std::make_shared<VersionTag>(9, 10, 10, host16, 0);
sprintf(log, "Test reaping of tombstones");
LOG(log);
// add few entries with null version tags
- err = entries->put(keyPtrR2, ct1, me, oldValue, -1, 0, versionTag19);
- err = entries->put(keyPtrR3, ct1, me, oldValue, -1, 0, versionTag19);
- err = entries->put(keyPtrR4, ct1, me, oldValue, -1, 0, versionTag19);
- err = entries->put(keyPtrR5, ct1, me, oldValue, -1, 0, versionTag19);
- err = entries->put(keyPtrR21, ct1, me, oldValue, -1, 0, versionTag19);
- err = entries->put(keyPtrR31, ct1, me, oldValue, -1, 0, versionTag19);
- err = entries->put(keyPtrR41, ct1, me, oldValue, -1, 0, versionTag19);
- err = entries->put(keyPtrR51, ct1, me, oldValue, -1, 0, versionTag19);
- err = entries->put(keyPtrR61, ct1, me, oldValue, -1, 0, versionTag19);
+ err = entries->put(keyPtrR2, ccstr1, me, oldValue, -1, 0, versionTag19);
+ err = entries->put(keyPtrR3, ccstr1, me, oldValue, -1, 0, versionTag19);
+ err = entries->put(keyPtrR4, ccstr1, me, oldValue, -1, 0, versionTag19);
+ err = entries->put(keyPtrR5, ccstr1, me, oldValue, -1, 0, versionTag19);
+ err = entries->put(keyPtrR21, ccstr1, me, oldValue, -1, 0, versionTag19);
+ err = entries->put(keyPtrR31, ccstr1, me, oldValue, -1, 0, versionTag19);
+ err = entries->put(keyPtrR41, ccstr1, me, oldValue, -1, 0, versionTag19);
+ err = entries->put(keyPtrR51, ccstr1, me, oldValue, -1, 0, versionTag19);
+ err = entries->put(keyPtrR61, ccstr1, me, oldValue, -1, 0, versionTag19);
// remove those entries using non null version tags
err = entries->remove(keyPtrR2, oldValue, me, -1, versionTag12, false);
@@ -1236,8 +1238,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour_TestRemove)
sprintf(log, "Remove test complete. %d", err);
LOG(log);
// reap using removedKeys API
- CacheableKeyPtr keyPtrR71 = CacheableKey::create((char*)"keyPtrR71");
- CacheableHashSetPtr removedKeys = CacheableHashSet::create();
+ auto keyPtrR71 = CacheableKey::create("keyPtrR71");
+ auto removedKeys = CacheableHashSet::create();
removedKeys->insert(keyPtrR3);
removedKeys->insert(keyPtrR71);
removedKeys->insert(keyPtrR2);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testExpiration.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testExpiration.cpp b/src/cppcache/integration-test/testExpiration.cpp
index 5aa2f3f..b214744 100644
--- a/src/cppcache/integration-test/testExpiration.cpp
+++ b/src/cppcache/integration-test/testExpiration.cpp
@@ -38,7 +38,7 @@ void startDSandCreateCache(CachePtr& cache) {
PropertiesPtr pp = Properties::create();
CacheFactoryPtr cacheFactoryPtr = CacheFactory::createCacheFactory(pp);
cache = cacheFactoryPtr->create();
- ASSERT(cache != NULLPTR, "cache not equal to null expected");
+ ASSERT(cache != nullptr, "cache not equal to null expected");
}
void doNPuts(RegionPtr& rptr, int n) {
@@ -48,7 +48,7 @@ void doNPuts(RegionPtr& rptr, int n) {
buf[15] = '\0';
memcpy(buf, "Value - ", 8);
value = CacheableString::create(buf);
- ASSERT(value != NULLPTR, "Failed to create value.");
+ ASSERT(value != nullptr, "Failed to create value.");
for (int i = 0; i < n; i++) {
sprintf(buf, "KeyA - %d", i + 1);
@@ -66,7 +66,7 @@ CacheableKeyPtr do1Put(RegionPtr& rptr) {
buf[15] = '\0';
memcpy(buf, "Value - ", 8);
value = CacheableString::create(buf);
- ASSERT(value != NULLPTR, "Failed to create value.");
+ ASSERT(value != nullptr, "Failed to create value.");
sprintf(buf, "KeyA - %d", 0 + 1);
CacheableKeyPtr key = CacheableKey::create(buf);
@@ -94,22 +94,24 @@ BEGIN_TEST(TEST_EXPIRATION)
startDSandCreateCache(cache);
- ASSERT(cache != NULLPTR, "Expected cache to be NON-NULL");
+ ASSERT(cache != nullptr, "Expected cache to be NON-NULL");
+
+ CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cache.get());
+
+ int n;
RegionAttributesPtr attrs_1;
// ettl = 0, eit = 0, rttl = 0, reit = 0
setExpTimes(attrs_1);
-
RegionPtr R1;
- CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cache.ptr());
cacheImpl->createRegion("R1", attrs_1, R1);
- ASSERT(R1 != NULLPTR, "Expected R1 to be NON-NULL");
+ ASSERT(R1 != nullptr, "Expected R1 to be NON-NULL");
doNPuts(R1, 100);
ACE_OS::sleep(10);
- int n = getNumOfEntries(R1);
+ n = getNumOfEntries(R1);
ASSERT(n == 100, "Expected 100 entries");
ASSERT(R1->isDestroyed() == false, "Expected R1 to be alive");
@@ -120,7 +122,7 @@ BEGIN_TEST(TEST_EXPIRATION)
RegionPtr R2;
cacheImpl->createRegion("R2", attrs_2, R2);
- ASSERT(R2 != NULLPTR, "Expected R2 to be NON-NULL");
+ ASSERT(R2 != nullptr, "Expected R2 to be NON-NULL");
LOG("Region R2 created");
doNPuts(R2, 1);
@@ -137,7 +139,7 @@ BEGIN_TEST(TEST_EXPIRATION)
RegionPtr R3;
cacheImpl->createRegion("R3", attrs_3, R3);
- ASSERT(R3 != NULLPTR, "Expected R3 to be NON-NULL");
+ ASSERT(R3 != nullptr, "Expected R3 to be NON-NULL");
ACE_OS::sleep(5);
@@ -149,7 +151,7 @@ BEGIN_TEST(TEST_EXPIRATION)
RegionPtr R4;
cacheImpl->createRegion("R4", attrs_4, R4);
- ASSERT(R4 != NULLPTR, "Expected R4 to be NON-NULL");
+ ASSERT(R4 != nullptr, "Expected R4 to be NON-NULL");
doNPuts(R4, 1);
// This will be same as updating the object
@@ -167,7 +169,7 @@ BEGIN_TEST(TEST_EXPIRATION)
RegionPtr R5;
cacheImpl->createRegion("R5", attrs_5, R5);
- ASSERT(R5 != NULLPTR, "Expected R5 to be NON-NULL");
+ ASSERT(R5 != nullptr, "Expected R5 to be NON-NULL");
CacheableKeyPtr key_0 = do1Put(R5);
@@ -194,7 +196,7 @@ BEGIN_TEST(TEST_EXPIRATION)
RegionPtr R6;
cacheImpl->createRegion("R6", attrs_6, R6);
- ASSERT(R6 != NULLPTR, "Expected R6 to be NON-NULL");
+ ASSERT(R6 != nullptr, "Expected R6 to be NON-NULL");
doNPuts(R6, 1);
@@ -212,7 +214,7 @@ BEGIN_TEST(TEST_EXPIRATION)
RegionPtr R7;
cacheImpl->createRegion("R7", attrs_7, R7);
- ASSERT(R7 != NULLPTR, "Expected R7 to be NON-NULL");
+ ASSERT(R7 != nullptr, "Expected R7 to be NON-NULL");
doNPuts(R7, 1);
@@ -230,7 +232,7 @@ BEGIN_TEST(TEST_EXPIRATION)
RegionPtr R8;
cacheImpl->createRegion("R8", attrs_8, R8);
- ASSERT(R8 != NULLPTR, "Expected R8 to be NON-NULL");
+ ASSERT(R8 != nullptr, "Expected R8 to be NON-NULL");
CacheableKeyPtr key = do1Put(R8);
@@ -249,7 +251,7 @@ BEGIN_TEST(TEST_EXPIRATION)
RegionPtr R9;
cacheImpl->createRegion("R9", attrs_9, R9);
- ASSERT(R9 != NULLPTR, "Expected R9 to be NON-NULL");
+ ASSERT(R9 != nullptr, "Expected R9 to be NON-NULL");
CacheableKeyPtr key_1 = do1Put(R9);
@@ -270,7 +272,7 @@ BEGIN_TEST(TEST_EXPIRATION)
RegionPtr R10;
cacheImpl->createRegion("R10", attrs_10, R10);
- ASSERT(R10 != NULLPTR, "Expected R10 to be NON-NULL");
+ ASSERT(R10 != nullptr, "Expected R10 to be NON-NULL");
doNPuts(R10, 1);
@@ -290,7 +292,7 @@ BEGIN_TEST(TEST_EXPIRATION)
RegionPtr R11;
cacheImpl->createRegion("R11", attrs_11, R11);
- ASSERT(R11 != NULLPTR, "Expected R11 to be NON-NULL");
+ ASSERT(R11 != nullptr, "Expected R11 to be NON-NULL");
CacheableKeyPtr k11 = do1Put(R11);
@@ -316,7 +318,7 @@ BEGIN_TEST(TEST_EXPIRATION)
RegionPtr R12;
cacheImpl->createRegion("R12", attrs_12, R12);
- ASSERT(R12 != NULLPTR, "Expected R12 to be NON-NULL");
+ ASSERT(R12 != nullptr, "Expected R12 to be NON-NULL");
CacheableKeyPtr key_3 = do1Put(R12);
@@ -334,7 +336,7 @@ BEGIN_TEST(TEST_EXPIRATION)
RegionPtr R14;
cacheImpl->createRegion("R14", attrs_14, R14);
- ASSERT(R14 != NULLPTR, "Expected R14 to be NON-NULL");
+ ASSERT(R14 != nullptr, "Expected R14 to be NON-NULL");
doNPuts(R14, 1);
@@ -348,7 +350,7 @@ BEGIN_TEST(TEST_EXPIRATION)
RegionPtr R15;
cacheImpl->createRegion("R15", attrs_15, R15);
- ASSERT(R15 != NULLPTR, "Expected R15 to be NON-NULL");
+ ASSERT(R15 != nullptr, "Expected R15 to be NON-NULL");
CacheableKeyPtr key_4 = do1Put(R15);
@@ -367,7 +369,7 @@ BEGIN_TEST(TEST_EXPIRATION)
RegionPtr R18;
cacheImpl->createRegion("R18", attrs_18, R18);
- ASSERT(R18 != NULLPTR, "Expected R18 to be NON-NULL");
+ ASSERT(R18 != nullptr, "Expected R18 to be NON-NULL");
doNPuts(R18, 1);
@@ -386,7 +388,7 @@ BEGIN_TEST(TEST_EXPIRATION)
RegionPtr R19;
cacheImpl->createRegion("R19x", attrs_19, R19);
- ASSERT(R19 != NULLPTR, "Expected R19 to be NON-NULL");
+ ASSERT(R19 != nullptr, "Expected R19 to be NON-NULL");
ACE_OS::sleep(4);
[05/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from cppcache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/ProxyRemoteQueryService.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ProxyRemoteQueryService.cpp b/src/cppcache/src/ProxyRemoteQueryService.cpp
index d1adc86..da66e0b 100644
--- a/src/cppcache/src/ProxyRemoteQueryService.cpp
+++ b/src/cppcache/src/ProxyRemoteQueryService.cpp
@@ -19,21 +19,19 @@
#include <geode/PoolManager.hpp>
#include "CqQueryImpl.hpp"
-ProxyRemoteQueryService::ProxyRemoteQueryService(ProxyCache* cptr) {
- ProxyCachePtr pcp(cptr);
- m_proxyCache = pcp;
-}
+ProxyRemoteQueryService::ProxyRemoteQueryService(ProxyCachePtr cptr)
+ : m_proxyCache(cptr) {}
QueryPtr ProxyRemoteQueryService::newQuery(const char* querystring) {
if (!m_proxyCache->isClosed()) {
- PoolPtr userAttachedPool = m_proxyCache->m_userAttributes->getPool();
- PoolPtr pool = PoolManager::find(userAttachedPool->getName());
- if (pool != NULLPTR && pool.ptr() == userAttachedPool.ptr() &&
+ auto userAttachedPool = m_proxyCache->m_userAttributes->getPool();
+ auto pool = PoolManager::find(userAttachedPool->getName());
+ if (pool != nullptr && pool.get() == userAttachedPool.get() &&
!pool->isDestroyed()) {
GuardUserAttribures gua(m_proxyCache);
- ThinClientPoolDMPtr pooDM(static_cast<ThinClientPoolDM*>(pool.ptr()));
- if (!pooDM->isDestroyed()) {
- return pooDM->getQueryServiceWithoutCheck()->newQuery(querystring);
+ auto poolDM = std::static_pointer_cast<ThinClientPoolDM>(pool);
+ if (!poolDM->isDestroyed()) {
+ return poolDM->getQueryServiceWithoutCheck()->newQuery(querystring);
}
}
throw IllegalStateException("Pool has been closed.");
@@ -54,14 +52,14 @@ CqQueryPtr ProxyRemoteQueryService::newCq(const char* querystr,
CqAttributesPtr& cqAttr,
bool isDurable) {
if (!m_proxyCache->isClosed()) {
- PoolPtr userAttachedPool = m_proxyCache->m_userAttributes->getPool();
- PoolPtr pool = PoolManager::find(userAttachedPool->getName());
- if (pool != NULLPTR && pool.ptr() == userAttachedPool.ptr() &&
+ auto userAttachedPool = m_proxyCache->m_userAttributes->getPool();
+ auto pool = PoolManager::find(userAttachedPool->getName());
+ if (pool != nullptr && pool.get() == userAttachedPool.get() &&
!pool->isDestroyed()) {
GuardUserAttribures gua(m_proxyCache);
- ThinClientPoolDMPtr pooDM(static_cast<ThinClientPoolDM*>(pool.ptr()));
+ auto pooDM = std::static_pointer_cast<ThinClientPoolDM>(pool);
if (!pooDM->isDestroyed()) {
- CqQueryPtr cqQuery = pooDM->getQueryServiceWithoutCheck()->newCq(
+ auto cqQuery = pooDM->getQueryServiceWithoutCheck()->newCq(
querystr, cqAttr, isDurable);
addCqQuery(cqQuery);
return cqQuery;
@@ -82,14 +80,14 @@ CqQueryPtr ProxyRemoteQueryService::newCq(const char* name,
CqAttributesPtr& cqAttr,
bool isDurable) {
if (!m_proxyCache->isClosed()) {
- PoolPtr userAttachedPool = m_proxyCache->m_userAttributes->getPool();
- PoolPtr pool = PoolManager::find(userAttachedPool->getName());
- if (pool != NULLPTR && pool.ptr() == userAttachedPool.ptr() &&
+ auto userAttachedPool = m_proxyCache->m_userAttributes->getPool();
+ auto pool = PoolManager::find(userAttachedPool->getName());
+ if (pool != nullptr && pool.get() == userAttachedPool.get() &&
!pool->isDestroyed()) {
GuardUserAttribures gua(m_proxyCache);
- ThinClientPoolDMPtr pooDM(static_cast<ThinClientPoolDM*>(pool.ptr()));
- if (!pooDM->isDestroyed()) {
- CqQueryPtr cqQuery = pooDM->getQueryServiceWithoutCheck()->newCq(
+ auto poolDM = std::static_pointer_cast<ThinClientPoolDM>(pool);
+ if (!poolDM->isDestroyed()) {
+ auto cqQuery = poolDM->getQueryServiceWithoutCheck()->newCq(
name, querystr, cqAttr, isDurable);
addCqQuery(cqQuery);
return cqQuery;
@@ -105,14 +103,14 @@ void ProxyRemoteQueryService::closeCqs() { closeCqs(false); }
void ProxyRemoteQueryService::closeCqs(bool keepAlive) {
ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_cqQueryListLock);
- for (int32_t i = 0; i < m_cqQueries.size(); i++) {
- std::string cqName = m_cqQueries[i]->getName();
+ for (auto& q : m_cqQueries) {
+ std::string cqName = q->getName();
try {
- if (!(m_cqQueries[i]->isDurable() && keepAlive)) {
- m_cqQueries[i]->close();
+ if (!(q->isDurable() && keepAlive)) {
+ q->close();
} else {
// need to just cleanup client side data structure
- CqQueryImpl* cqImpl = static_cast<CqQueryImpl*>(m_cqQueries[i].ptr());
+ auto cqImpl = std::static_pointer_cast<CqQueryImpl>(q);
cqImpl->close(false);
}
} catch (QueryException& qe) {
@@ -127,24 +125,21 @@ void ProxyRemoteQueryService::closeCqs(bool keepAlive) {
}
}
-void ProxyRemoteQueryService::getCqs(VectorOfCqQuery& vec) {
+void ProxyRemoteQueryService::getCqs(query_container_type& vec) {
ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_cqQueryListLock);
-
- for (int32_t i = 0; i < m_cqQueries.size(); i++) {
- vec.push_back(m_cqQueries[i]);
- }
+ vec = m_cqQueries;
}
CqQueryPtr ProxyRemoteQueryService::getCq(const char* name) {
if (!m_proxyCache->isClosed()) {
- PoolPtr userAttachedPool = m_proxyCache->m_userAttributes->getPool();
- PoolPtr pool = PoolManager::find(userAttachedPool->getName());
- if (pool != NULLPTR && pool.ptr() == userAttachedPool.ptr() &&
+ auto userAttachedPool = m_proxyCache->m_userAttributes->getPool();
+ auto pool = PoolManager::find(userAttachedPool->getName());
+ if (pool != nullptr && pool.get() == userAttachedPool.get() &&
!pool->isDestroyed()) {
GuardUserAttribures gua(m_proxyCache);
- ThinClientPoolDMPtr pooDM(static_cast<ThinClientPoolDM*>(pool.ptr()));
- if (!pooDM->isDestroyed()) {
- return pooDM->getQueryServiceWithoutCheck()->getCq(name);
+ auto poolDM = std::static_pointer_cast<ThinClientPoolDM>(pool);
+ if (!poolDM->isDestroyed()) {
+ return poolDM->getQueryServiceWithoutCheck()->getCq(name);
}
}
throw IllegalStateException("Pool has been closed.");
@@ -155,10 +150,10 @@ CqQueryPtr ProxyRemoteQueryService::getCq(const char* name) {
void ProxyRemoteQueryService::executeCqs() {
ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_cqQueryListLock);
- for (int32_t i = 0; i < m_cqQueries.size(); i++) {
- std::string cqName = m_cqQueries[i]->getName();
+ for (auto& q : m_cqQueries) {
+ std::string cqName = q->getName();
try {
- m_cqQueries[i]->execute();
+ q->execute();
} catch (QueryException& qe) {
Log::fine(("Failed to excecue the CQ, CqName : " + cqName + " Error : " +
qe.getMessage())
@@ -174,10 +169,10 @@ void ProxyRemoteQueryService::executeCqs() {
void ProxyRemoteQueryService::stopCqs() {
ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_cqQueryListLock);
- for (int32_t i = 0; i < m_cqQueries.size(); i++) {
- std::string cqName = m_cqQueries[i]->getName();
+ for (auto& q : m_cqQueries) {
+ std::string cqName = q->getName();
try {
- m_cqQueries[i]->stop();
+ q->stop();
} catch (QueryException& qe) {
Log::fine(("Failed to stop the CQ, CqName : " + cqName + " Error : " +
qe.getMessage())
@@ -192,10 +187,10 @@ void ProxyRemoteQueryService::stopCqs() {
CqServiceStatisticsPtr ProxyRemoteQueryService::getCqServiceStatistics() {
unSupportedException("getCqServiceStatistics()");
- return NULLPTR;
+ return nullptr;
}
CacheableArrayListPtr ProxyRemoteQueryService::getAllDurableCqsFromServer() {
unSupportedException("getAllDurableCqsFromServer()");
- return NULLPTR;
+ return nullptr;
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/ProxyRemoteQueryService.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ProxyRemoteQueryService.hpp b/src/cppcache/src/ProxyRemoteQueryService.hpp
index 7eb3cbf..dcc36b6 100644
--- a/src/cppcache/src/ProxyRemoteQueryService.hpp
+++ b/src/cppcache/src/ProxyRemoteQueryService.hpp
@@ -38,7 +38,7 @@ class ThinClientPoolDM;
class CPPCACHE_EXPORT ProxyRemoteQueryService : public QueryService {
public:
- ProxyRemoteQueryService(ProxyCache* cptr);
+ ProxyRemoteQueryService(ProxyCachePtr cptr);
QueryPtr newQuery(const char* querystring);
@@ -48,7 +48,7 @@ class CPPCACHE_EXPORT ProxyRemoteQueryService : public QueryService {
virtual CqQueryPtr newCq(const char* name, const char* querystr,
CqAttributesPtr& cqAttr, bool isDurable = false);
virtual void closeCqs();
- virtual void getCqs(VectorOfCqQuery& vec);
+ virtual void getCqs(query_container_type& vec);
virtual CqQueryPtr getCq(const char* name);
virtual void executeCqs();
virtual void stopCqs();
@@ -62,7 +62,7 @@ class CPPCACHE_EXPORT ProxyRemoteQueryService : public QueryService {
QueryServicePtr m_realQueryService;
ProxyCachePtr m_proxyCache;
- VectorOfCqQuery m_cqQueries;
+ query_container_type m_cqQueries;
// lock for cqQuery list;
ACE_Recursive_Thread_Mutex m_cqQueryListLock;
friend class ProxyCache;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/PutAllPartialResult.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PutAllPartialResult.cpp b/src/cppcache/src/PutAllPartialResult.cpp
index 4ca4b68..24929b6 100644
--- a/src/cppcache/src/PutAllPartialResult.cpp
+++ b/src/cppcache/src/PutAllPartialResult.cpp
@@ -22,7 +22,7 @@ namespace client {
PutAllPartialResult::PutAllPartialResult(
int totalMapSize, ACE_Recursive_Thread_Mutex& responseLock) {
- m_succeededKeys = new VersionedCacheableObjectPartList(
+ m_succeededKeys = std::make_shared<VersionedCacheableObjectPartList>(
new VectorOfCacheableKey(), responseLock);
m_totalMapSize = totalMapSize;
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/PutAllPartialResult.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PutAllPartialResult.hpp b/src/cppcache/src/PutAllPartialResult.hpp
index 6b44b7b..6240b09 100644
--- a/src/cppcache/src/PutAllPartialResult.hpp
+++ b/src/cppcache/src/PutAllPartialResult.hpp
@@ -57,11 +57,11 @@ class PutAllPartialResult : public Serializable {
void addKeys(VectorOfCacheableKeyPtr m_keys);
void saveFailedKey(CacheableKeyPtr key, ExceptionPtr cause) {
- if (key == NULLPTR) {
+ if (key == nullptr) {
return;
}
// TODO:: Do we need to handle server cancelException.
- if (m_firstFailedKey == NULLPTR /*|| cause instanceof CaccelException */) {
+ if (m_firstFailedKey == nullptr /*|| cause instanceof CaccelException */) {
m_firstFailedKey = key;
m_firstCauseOfFailure = cause;
}
@@ -73,14 +73,14 @@ class PutAllPartialResult : public Serializable {
CacheableKeyPtr getFirstFailedKey() { return m_firstFailedKey; }
// Returns there's failedKeys
- bool hasFailure() { return m_firstFailedKey != NULLPTR; }
+ bool hasFailure() { return m_firstFailedKey != nullptr; }
// Returns there's saved succeed keys
bool hasSucceededKeys();
virtual CacheableStringPtr toString() const {
char msgStr1[1024];
- if (m_firstFailedKey != NULLPTR) {
+ if (m_firstFailedKey != nullptr) {
ACE_OS::snprintf(msgStr1, 1024, "[ Key =%s ]",
m_firstFailedKey->toString()->asChar());
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/PutAllPartialResultServerException.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PutAllPartialResultServerException.cpp b/src/cppcache/src/PutAllPartialResultServerException.cpp
index b0c9a2a..1585e70 100644
--- a/src/cppcache/src/PutAllPartialResultServerException.cpp
+++ b/src/cppcache/src/PutAllPartialResultServerException.cpp
@@ -29,7 +29,7 @@ PutAllPartialResultServerException::PutAllPartialResultServerException(
PutAllPartialResultServerException::PutAllPartialResultServerException() {
LOGDEBUG("Partial keys are processed in putAll");
ACE_Recursive_Thread_Mutex responseLock;
- m_result = new PutAllPartialResult(-1, responseLock);
+ m_result = std::make_shared<PutAllPartialResult>(-1, responseLock);
}
void PutAllPartialResultServerException::consolidate(
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/RegionAttributes.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/RegionAttributes.cpp b/src/cppcache/src/RegionAttributes.cpp
index 6b6cecd..6eee620 100644
--- a/src/cppcache/src/RegionAttributes.cpp
+++ b/src/cppcache/src/RegionAttributes.cpp
@@ -35,10 +35,10 @@ RegionAttributes::RegionAttributes()
m_entryTimeToLiveExpirationAction(ExpirationAction::INVALIDATE),
m_entryIdleTimeoutExpirationAction(ExpirationAction::INVALIDATE),
m_lruEvictionAction(ExpirationAction::LOCAL_DESTROY),
- m_cacheWriter(NULLPTR),
- m_cacheLoader(NULLPTR),
- m_cacheListener(NULLPTR),
- m_partitionResolver(NULLPTR),
+ m_cacheWriter(nullptr),
+ m_cacheLoader(nullptr),
+ m_cacheListener(nullptr),
+ m_partitionResolver(nullptr),
m_lruEntriesLimit(0),
m_caching(true),
m_maxValueDistLimit(100 * 1024),
@@ -62,8 +62,8 @@ RegionAttributes::RegionAttributes()
m_clientNotificationEnabled(false),
m_persistenceLibrary(NULL),
m_persistenceFactory(NULL),
- m_persistenceProperties(NULLPTR),
- m_persistenceManager(NULLPTR),
+ m_persistenceProperties(nullptr),
+ m_persistenceManager(nullptr),
m_poolName(NULL),
m_isClonable(false),
m_isConcurrencyChecksEnabled(true) {}
@@ -240,98 +240,98 @@ void* getFactoryFunc(const char* lib, const char* funcName) {
} // namespace apache
CacheLoaderPtr RegionAttributes::getCacheLoader() {
- if ((m_cacheLoader == NULLPTR) && (m_cacheLoaderLibrary != NULL)) {
+ if ((m_cacheLoader == nullptr) && (m_cacheLoaderLibrary != NULL)) {
if (CacheXmlParser::managedCacheLoaderFn != NULL &&
strchr(m_cacheLoaderFactory, '.') != NULL) {
// this is a managed library
- m_cacheLoader = (*CacheXmlParser::managedCacheLoaderFn)(
- m_cacheLoaderLibrary, m_cacheLoaderFactory);
+ m_cacheLoader.reset((*CacheXmlParser::managedCacheLoaderFn)(
+ m_cacheLoaderLibrary, m_cacheLoaderFactory));
} else {
CacheLoader* (*funcptr)();
funcptr = reinterpret_cast<CacheLoader* (*)()>(
apache::geode::client::impl::getFactoryFunc(m_cacheLoaderLibrary,
m_cacheLoaderFactory));
- m_cacheLoader = funcptr();
+ m_cacheLoader.reset(funcptr());
}
}
return m_cacheLoader;
}
CacheWriterPtr RegionAttributes::getCacheWriter() {
- if ((m_cacheWriter == NULLPTR) && (m_cacheWriterLibrary != NULL)) {
+ if ((m_cacheWriter == nullptr) && (m_cacheWriterLibrary != NULL)) {
if (CacheXmlParser::managedCacheWriterFn != NULL &&
strchr(m_cacheWriterFactory, '.') != NULL) {
// this is a managed library
- m_cacheWriter = (*CacheXmlParser::managedCacheWriterFn)(
- m_cacheWriterLibrary, m_cacheWriterFactory);
+ m_cacheWriter.reset((*CacheXmlParser::managedCacheWriterFn)(
+ m_cacheWriterLibrary, m_cacheWriterFactory));
} else {
CacheWriter* (*funcptr)();
funcptr = reinterpret_cast<CacheWriter* (*)()>(
apache::geode::client::impl::getFactoryFunc(m_cacheWriterLibrary,
m_cacheWriterFactory));
- m_cacheWriter = funcptr();
+ m_cacheWriter.reset(funcptr());
}
}
return m_cacheWriter;
}
CacheListenerPtr RegionAttributes::getCacheListener() {
- if ((m_cacheListener == NULLPTR) && (m_cacheListenerLibrary != NULL)) {
+ if ((m_cacheListener == nullptr) && (m_cacheListenerLibrary != NULL)) {
if (CacheXmlParser::managedCacheListenerFn != NULL &&
strchr(m_cacheListenerFactory, '.') != NULL) {
// LOGDEBUG( "RegionAttributes::getCacheListener: Trying to create
// instance from managed library." );
// this is a managed library
- m_cacheListener = (*CacheXmlParser::managedCacheListenerFn)(
- m_cacheListenerLibrary, m_cacheListenerFactory);
+ m_cacheListener.reset((*CacheXmlParser::managedCacheListenerFn)(
+ m_cacheListenerLibrary, m_cacheListenerFactory));
} else {
CacheListener* (*funcptr)();
funcptr = reinterpret_cast<CacheListener* (*)()>(
apache::geode::client::impl::getFactoryFunc(m_cacheListenerLibrary,
m_cacheListenerFactory));
- m_cacheListener = funcptr();
+ m_cacheListener.reset(funcptr());
}
}
return m_cacheListener;
}
PartitionResolverPtr RegionAttributes::getPartitionResolver() {
- if ((m_partitionResolver == NULLPTR) &&
+ if ((m_partitionResolver == nullptr) &&
(m_partitionResolverLibrary != NULL)) {
if (CacheXmlParser::managedPartitionResolverFn != NULL &&
strchr(m_partitionResolverFactory, '.') != NULL) {
// LOGDEBUG( "RegionAttributes::getCacheListener: Trying to create
// instance from managed library." );
// this is a managed library
- m_partitionResolver = (*CacheXmlParser::managedPartitionResolverFn)(
- m_partitionResolverLibrary, m_partitionResolverFactory);
+ m_partitionResolver.reset((*CacheXmlParser::managedPartitionResolverFn)(
+ m_partitionResolverLibrary, m_partitionResolverFactory));
} else {
PartitionResolver* (*funcptr)();
funcptr = reinterpret_cast<PartitionResolver* (*)()>(
apache::geode::client::impl::getFactoryFunc(
m_partitionResolverLibrary, m_partitionResolverFactory));
- m_partitionResolver = funcptr();
+ m_partitionResolver.reset(funcptr());
}
}
return m_partitionResolver;
}
PersistenceManagerPtr RegionAttributes::getPersistenceManager() {
- if ((m_persistenceManager == NULLPTR) && (m_persistenceLibrary != NULL)) {
+ if ((m_persistenceManager == nullptr) && (m_persistenceLibrary != NULL)) {
if (CacheXmlParser::managedPartitionResolverFn != NULL &&
strchr(m_persistenceFactory, '.') != NULL) {
LOGDEBUG(
"RegionAttributes::getPersistenceManager: Trying to create instance "
"from managed library.");
// this is a managed library
- m_persistenceManager = (*CacheXmlParser::managedPersistenceManagerFn)(
- m_persistenceLibrary, m_persistenceFactory);
+ m_persistenceManager.reset((*CacheXmlParser::managedPersistenceManagerFn)(
+ m_persistenceLibrary, m_persistenceFactory));
} else {
PersistenceManager* (*funcptr)();
funcptr = reinterpret_cast<PersistenceManager* (*)()>(
apache::geode::client::impl::getFactoryFunc(m_persistenceLibrary,
m_persistenceFactory));
- m_persistenceManager = funcptr();
+ m_persistenceManager.reset(funcptr());
}
}
return m_persistenceManager;
@@ -653,27 +653,27 @@ bool RegionAttributes::operator!=(const RegionAttributes& other) const {
/* Throws IllegalStateException when attributes targetted for use on a server do
* not meet requirements. */
void RegionAttributes::validateSerializableAttributes() {
- if (m_cacheLoader != NULLPTR) {
+ if (m_cacheLoader != nullptr) {
throw IllegalStateException(
"CacheLoader must be set with setCacheLoader(library, factory) in "
"members of type SERVER");
}
- if (m_cacheWriter != NULLPTR) {
+ if (m_cacheWriter != nullptr) {
throw IllegalStateException(
"CacheWriter must be set with setCacheWriter(library, factory) in "
"members of type SERVER");
}
- if (m_cacheListener != NULLPTR) {
+ if (m_cacheListener != nullptr) {
throw IllegalStateException(
"CacheListener must be set with setCacheListener(library, factory) in "
"members of type SERVER");
}
- if (m_partitionResolver != NULLPTR) {
+ if (m_partitionResolver != nullptr) {
throw IllegalStateException(
"PartitionResolver must be set with setPartitionResolver(library, "
"factory) in members of type SERVER");
}
- if (m_persistenceManager != NULLPTR) {
+ if (m_persistenceManager != nullptr) {
throw IllegalStateException(
"persistenceManager must be set with setPersistenceManager(library, "
"factory,config) in members of type SERVER");
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/RegionCommit.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/RegionCommit.cpp b/src/cppcache/src/RegionCommit.cpp
index ca60857..62e26c8 100644
--- a/src/cppcache/src/RegionCommit.cpp
+++ b/src/cppcache/src/RegionCommit.cpp
@@ -27,14 +27,6 @@ namespace apache {
namespace geode {
namespace client {
-RegionCommit::RegionCommit() {
- // TODO Auto-generated constructor stub
-}
-
-RegionCommit::~RegionCommit() {
- // TODO Auto-generated destructor stub
-}
-
void RegionCommit::fromData(DataInput& input) {
input.readObject(m_regionPath);
input.readObject(m_parentRegionPath);
@@ -48,7 +40,7 @@ void RegionCommit::fromData(DataInput& input) {
input.readObject(dsMember);
uint16_t memId = CacheImpl::getMemberListForVersionStamp()->add(dsMember);
for (int i = 0; i < size; i++) {
- FarSideEntryOpPtr entryOp(new FarSideEntryOp(this));
+ auto entryOp = std::make_shared<FarSideEntryOp>(this);
entryOp->fromData(input, largeModCount, memId);
m_farSideEntryOps.push_back(entryOp);
}
@@ -56,22 +48,19 @@ void RegionCommit::fromData(DataInput& input) {
}
void RegionCommit::apply(Cache* cache) {
- for (VectorOfSharedBase::Iterator iter = m_farSideEntryOps.begin();
- m_farSideEntryOps.end() != iter; iter++) {
- FarSideEntryOpPtr entryOp = staticCast<FarSideEntryOpPtr>(*iter);
- RegionPtr region = cache->getRegion(m_regionPath->asChar());
- if (region == NULLPTR && m_parentRegionPath != NULLPTR) {
+ for (auto& entryOp : m_farSideEntryOps) {
+ auto region = cache->getRegion(m_regionPath->asChar());
+ if (region == nullptr && m_parentRegionPath != nullptr) {
region = cache->getRegion(m_parentRegionPath->asChar());
}
- entryOp->apply(region);
+ std::static_pointer_cast<FarSideEntryOp>(entryOp)->apply(region);
}
}
void RegionCommit::fillEvents(Cache* cache,
std::vector<FarSideEntryOpPtr>& ops) {
- for (VectorOfSharedBase::Iterator iter = m_farSideEntryOps.begin();
- m_farSideEntryOps.end() != iter; iter++) {
- ops.push_back(*iter);
+ for (auto& entryOp : m_farSideEntryOps) {
+ ops.push_back(std::static_pointer_cast<FarSideEntryOp>(entryOp));
}
}
} // namespace client
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/RegionCommit.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/RegionCommit.hpp b/src/cppcache/src/RegionCommit.hpp
index 541614d..2de98b3 100644
--- a/src/cppcache/src/RegionCommit.hpp
+++ b/src/cppcache/src/RegionCommit.hpp
@@ -43,8 +43,8 @@ _GF_PTR_DEF_(RegionCommit, RegionCommitPtr);
class RegionCommit : public apache::geode::client::SharedBase {
public:
- RegionCommit();
- virtual ~RegionCommit();
+ RegionCommit(){};
+ virtual ~RegionCommit(){};
void fromData(DataInput& input);
void apply(Cache* cache);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/RegionEntry.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/RegionEntry.cpp b/src/cppcache/src/RegionEntry.cpp
index 96cfbf2..fbf6246 100644
--- a/src/cppcache/src/RegionEntry.cpp
+++ b/src/cppcache/src/RegionEntry.cpp
@@ -21,15 +21,15 @@
using namespace apache::geode::client;
-RegionEntry::RegionEntry(const RegionPtr& region, const CacheableKeyPtr& key,
+RegionEntry::RegionEntry(Region* region, const CacheableKeyPtr& key,
const CacheablePtr& value)
: m_region(region), m_key(key), m_value(value), m_destroyed(false) {}
RegionEntry::~RegionEntry() {}
CacheableKeyPtr RegionEntry::getKey() { return m_key; }
CacheablePtr RegionEntry::getValue() {
- return CacheableToken::isInvalid(m_value) ? NULLPTR : m_value;
+ return CacheableToken::isInvalid(m_value) ? nullptr : m_value;
}
-void RegionEntry::getRegion(RegionPtr& region) { region = m_region; }
+void RegionEntry::getRegion(Region* region) { region = m_region; }
void RegionEntry::getStatistics(CacheStatisticsPtr& csptr) {
csptr = m_statistics;
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/RegionExpiryHandler.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/RegionExpiryHandler.cpp b/src/cppcache/src/RegionExpiryHandler.cpp
index 3def51b..66e74c5 100644
--- a/src/cppcache/src/RegionExpiryHandler.cpp
+++ b/src/cppcache/src/RegionExpiryHandler.cpp
@@ -89,7 +89,7 @@ void RegionExpiryHandler::DoTheExpirationAction() {
"RegionExpiryHandler::DoTheExpirationAction INVALIDATE "
"region [%s]",
m_regionPtr->getFullPath());
- m_regionPtr->invalidateRegionNoThrow(NULLPTR,
+ m_regionPtr->invalidateRegionNoThrow(nullptr,
CacheEventFlags::EXPIRATION);
break;
}
@@ -99,7 +99,7 @@ void RegionExpiryHandler::DoTheExpirationAction() {
"region [%s]",
m_regionPtr->getFullPath());
m_regionPtr->invalidateRegionNoThrow(
- NULLPTR, CacheEventFlags::EXPIRATION | CacheEventFlags::LOCAL);
+ nullptr, CacheEventFlags::EXPIRATION | CacheEventFlags::LOCAL);
break;
}
case ExpirationAction::DESTROY: {
@@ -107,7 +107,7 @@ void RegionExpiryHandler::DoTheExpirationAction() {
"RegionExpiryHandler::DoTheExpirationAction DESTROY "
"region [%s]",
m_regionPtr->getFullPath());
- m_regionPtr->destroyRegionNoThrow(NULLPTR, true,
+ m_regionPtr->destroyRegionNoThrow(nullptr, true,
CacheEventFlags::EXPIRATION);
break;
}
@@ -117,7 +117,7 @@ void RegionExpiryHandler::DoTheExpirationAction() {
"region [%s]",
m_regionPtr->getFullPath());
m_regionPtr->destroyRegionNoThrow(
- NULLPTR, true, CacheEventFlags::EXPIRATION | CacheEventFlags::LOCAL);
+ nullptr, true, CacheEventFlags::EXPIRATION | CacheEventFlags::LOCAL);
break;
}
default: {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/RegionFactory.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/RegionFactory.cpp b/src/cppcache/src/RegionFactory.cpp
index c94255d..cd40cef 100644
--- a/src/cppcache/src/RegionFactory.cpp
+++ b/src/cppcache/src/RegionFactory.cpp
@@ -37,22 +37,22 @@ namespace client {
RegionFactory::RegionFactory(RegionShortcut preDefinedRegion) {
m_preDefinedRegion = preDefinedRegion;
- AttributesFactoryPtr afPtr(new AttributesFactory());
- m_attributeFactory = afPtr;
+ m_attributeFactory = std::make_shared<AttributesFactory>();
+ ;
setRegionShortcut();
}
RegionFactory::~RegionFactory() {}
RegionPtr RegionFactory::create(const char* name) {
- RegionPtr retRegionPtr = NULLPTR;
+ RegionPtr retRegionPtr = nullptr;
RegionAttributesPtr regAttr = m_attributeFactory->createRegionAttributes();
// assuming pool name is not DEFAULT_POOL_NAME
if (regAttr->getPoolName() != NULL && strlen(regAttr->getPoolName()) > 0) {
// poolname is set
CachePtr cache = CacheFactory::getAnyInstance();
- CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cache.ptr());
+ CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cache.get());
cacheImpl->createRegion(name, regAttr, retRegionPtr);
} else {
// need to look default Pool
@@ -60,7 +60,7 @@ RegionPtr RegionFactory::create(const char* name) {
// if local region no need to create default pool
if (m_preDefinedRegion != LOCAL) {
PoolPtr pool = CacheFactory::createOrGetDefaultPool();
- if (pool == NULLPTR) {
+ if (pool == nullptr) {
throw IllegalStateException("Pool is not defined create region.");
}
m_attributeFactory->setPoolName(pool->getName());
@@ -68,7 +68,7 @@ RegionPtr RegionFactory::create(const char* name) {
regAttr = m_attributeFactory->createRegionAttributes();
CachePtr cache = CacheFactory::getAnyInstance();
- CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cache.ptr());
+ CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cache.get());
cacheImpl->createRegion(name, regAttr, retRegionPtr);
}
@@ -82,82 +82,70 @@ void RegionFactory::setRegionShortcut() {
RegionFactoryPtr RegionFactory::setCacheLoader(
const CacheLoaderPtr& cacheLoader) {
m_attributeFactory->setCacheLoader(cacheLoader);
- RegionFactoryPtr rfPtr(this);
- return rfPtr;
+ return shared_from_this();
}
RegionFactoryPtr RegionFactory::setCacheWriter(
const CacheWriterPtr& cacheWriter) {
m_attributeFactory->setCacheWriter(cacheWriter);
- RegionFactoryPtr rfPtr(this);
- return rfPtr;
+ return shared_from_this();
}
RegionFactoryPtr RegionFactory::setCacheListener(
const CacheListenerPtr& aListener) {
m_attributeFactory->setCacheListener(aListener);
- RegionFactoryPtr rfPtr(this);
- return rfPtr;
+ return shared_from_this();
}
RegionFactoryPtr RegionFactory::setPartitionResolver(
const PartitionResolverPtr& aResolver) {
m_attributeFactory->setPartitionResolver(aResolver);
- RegionFactoryPtr rfPtr(this);
- return rfPtr;
+ return shared_from_this();
}
RegionFactoryPtr RegionFactory::setCacheLoader(const char* lib,
const char* func) {
m_attributeFactory->setCacheLoader(lib, func);
- RegionFactoryPtr rfPtr(this);
- return rfPtr;
+ return shared_from_this();
}
RegionFactoryPtr RegionFactory::setCacheWriter(const char* lib,
const char* func) {
m_attributeFactory->setCacheWriter(lib, func);
- RegionFactoryPtr rfPtr(this);
- return rfPtr;
+ return shared_from_this();
}
RegionFactoryPtr RegionFactory::setCacheListener(const char* lib,
const char* func) {
m_attributeFactory->setCacheListener(lib, func);
- RegionFactoryPtr rfPtr(this);
- return rfPtr;
+ return shared_from_this();
}
RegionFactoryPtr RegionFactory::setPartitionResolver(const char* lib,
const char* func) {
m_attributeFactory->setPartitionResolver(lib, func);
- RegionFactoryPtr rfPtr(this);
- return rfPtr;
+ return shared_from_this();
}
RegionFactoryPtr RegionFactory::setEntryIdleTimeout(
ExpirationAction::Action action, int idleTimeout) {
m_attributeFactory->setEntryIdleTimeout(action, idleTimeout);
- RegionFactoryPtr rfPtr(this);
- return rfPtr;
+ return shared_from_this();
}
RegionFactoryPtr RegionFactory::setEntryTimeToLive(
ExpirationAction::Action action, int timeToLive) {
m_attributeFactory->setEntryTimeToLive(action, timeToLive);
- RegionFactoryPtr rfPtr(this);
- return rfPtr;
+ return shared_from_this();
}
RegionFactoryPtr RegionFactory::setRegionIdleTimeout(
ExpirationAction::Action action, int idleTimeout) {
m_attributeFactory->setRegionIdleTimeout(action, idleTimeout);
- RegionFactoryPtr rfPtr(this);
- return rfPtr;
+ return shared_from_this();
}
RegionFactoryPtr RegionFactory::setRegionTimeToLive(
ExpirationAction::Action action, int timeToLive) {
m_attributeFactory->setRegionTimeToLive(action, timeToLive);
- RegionFactoryPtr rfPtr(this);
- return rfPtr;
+ return shared_from_this();
}
RegionFactoryPtr RegionFactory::setInitialCapacity(int initialCapacity) {
@@ -167,71 +155,60 @@ RegionFactoryPtr RegionFactory::setInitialCapacity(int initialCapacity) {
throw IllegalArgumentException(excpStr);
}
m_attributeFactory->setInitialCapacity(initialCapacity);
- RegionFactoryPtr rfPtr(this);
- return rfPtr;
+ return shared_from_this();
}
RegionFactoryPtr RegionFactory::setLoadFactor(float loadFactor) {
m_attributeFactory->setLoadFactor(loadFactor);
- RegionFactoryPtr rfPtr(this);
- return rfPtr;
+ return shared_from_this();
}
RegionFactoryPtr RegionFactory::setConcurrencyLevel(uint8_t concurrencyLevel) {
m_attributeFactory->setConcurrencyLevel(concurrencyLevel);
- RegionFactoryPtr rfPtr(this);
- return rfPtr;
+ return shared_from_this();
}
RegionFactoryPtr RegionFactory::setConcurrencyChecksEnabled(bool enable) {
m_attributeFactory->setConcurrencyChecksEnabled(enable);
- RegionFactoryPtr rfPtr(this);
- return rfPtr;
+ return shared_from_this();
}
RegionFactoryPtr RegionFactory::setLruEntriesLimit(
const uint32_t entriesLimit) {
m_attributeFactory->setLruEntriesLimit(entriesLimit);
- RegionFactoryPtr rfPtr(this);
- return rfPtr;
+ return shared_from_this();
}
RegionFactoryPtr RegionFactory::setDiskPolicy(
const DiskPolicyType::PolicyType diskPolicy) {
m_attributeFactory->setDiskPolicy(diskPolicy);
- RegionFactoryPtr rfPtr(this);
- return rfPtr;
+ return shared_from_this();
}
RegionFactoryPtr RegionFactory::setCachingEnabled(bool cachingEnabled) {
m_attributeFactory->setCachingEnabled(cachingEnabled);
- RegionFactoryPtr rfPtr(this);
- return rfPtr;
+ return shared_from_this();
}
RegionFactoryPtr RegionFactory::setPersistenceManager(
const PersistenceManagerPtr& persistenceManager,
const PropertiesPtr& config) {
m_attributeFactory->setPersistenceManager(persistenceManager, config);
- RegionFactoryPtr rfPtr(this);
- return rfPtr;
+ return shared_from_this();
}
RegionFactoryPtr RegionFactory::setPersistenceManager(
const char* lib, const char* func, const PropertiesPtr& config) {
m_attributeFactory->setPersistenceManager(lib, func, config);
- RegionFactoryPtr rfPtr(this);
- return rfPtr;
+ return shared_from_this();
}
RegionFactoryPtr RegionFactory::setPoolName(const char* name) {
m_attributeFactory->setPoolName(name);
- RegionFactoryPtr rfPtr(this);
- return rfPtr;
+ return shared_from_this();
}
RegionFactoryPtr RegionFactory::setCloningEnabled(bool isClonable) {
m_attributeFactory->setCloningEnabled(isClonable);
- RegionFactoryPtr rfPtr(this);
- return rfPtr;
+ return shared_from_this();
}
} // namespace client
} // namespace geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/RegionInternal.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/RegionInternal.cpp b/src/cppcache/src/RegionInternal.cpp
index d81ac75..512cf1d 100644
--- a/src/cppcache/src/RegionInternal.cpp
+++ b/src/cppcache/src/RegionInternal.cpp
@@ -105,129 +105,129 @@ TombstoneListPtr RegionInternal::getTombstoneList() {
RegionEntryPtr RegionInternal::createRegionEntry(const CacheableKeyPtr& key,
const CacheablePtr& value) {
- return RegionEntryPtr(new RegionEntry(RegionPtr(this), key, value));
+ return RegionEntryPtr(new RegionEntry(this, key, value));
}
void RegionInternal::setLruEntriesLimit(uint32_t limit) {
- if (m_regionAttributes != NULLPTR) {
+ if (m_regionAttributes != nullptr) {
m_regionAttributes->m_lruEntriesLimit = limit;
}
}
void RegionInternal::setRegionTimeToLiveExpirationAction(
ExpirationAction::Action action) {
- if (m_regionAttributes != NULLPTR) {
+ if (m_regionAttributes != nullptr) {
m_regionAttributes->m_regionTimeToLiveExpirationAction = action;
}
}
void RegionInternal::setRegionIdleTimeoutExpirationAction(
ExpirationAction::Action action) {
- if (m_regionAttributes != NULLPTR) {
+ if (m_regionAttributes != nullptr) {
m_regionAttributes->m_regionIdleTimeoutExpirationAction = action;
}
}
void RegionInternal::setEntryTimeToLiveExpirationAction(
ExpirationAction::Action action) {
- if (m_regionAttributes != NULLPTR) {
+ if (m_regionAttributes != nullptr) {
m_regionAttributes->m_entryTimeToLiveExpirationAction = action;
}
}
void RegionInternal::setEntryIdleTimeoutExpirationAction(
ExpirationAction::Action action) {
- if (m_regionAttributes != NULLPTR) {
+ if (m_regionAttributes != nullptr) {
m_regionAttributes->m_entryIdleTimeoutExpirationAction = action;
}
}
void RegionInternal::setRegionTimeToLive(int32_t duration) {
- if (m_regionAttributes != NULLPTR) {
+ if (m_regionAttributes != nullptr) {
m_regionAttributes->m_regionTimeToLive = duration;
}
}
void RegionInternal::setRegionIdleTimeout(int32_t duration) {
- if (m_regionAttributes != NULLPTR) {
+ if (m_regionAttributes != nullptr) {
m_regionAttributes->m_regionIdleTimeout = duration;
}
}
void RegionInternal::setEntryTimeToLive(int32_t duration) {
- if (m_regionAttributes != NULLPTR) {
+ if (m_regionAttributes != nullptr) {
m_regionAttributes->m_entryTimeToLive = duration;
}
}
void RegionInternal::setEntryIdleTimeout(int32_t duration) {
- if (m_regionAttributes != NULLPTR) {
+ if (m_regionAttributes != nullptr) {
m_regionAttributes->m_entryIdleTimeout = duration;
}
}
void RegionInternal::setCacheListener(const CacheListenerPtr& aListener) {
- if (m_regionAttributes != NULLPTR) {
+ if (m_regionAttributes != nullptr) {
m_regionAttributes->m_cacheListener = aListener;
}
}
void RegionInternal::setCacheListener(const char* libpath,
const char* factoryFuncName) {
- if (m_regionAttributes != NULLPTR) {
+ if (m_regionAttributes != nullptr) {
m_regionAttributes->setCacheListener(libpath, factoryFuncName);
}
}
void RegionInternal::setPartitionResolver(
const PartitionResolverPtr& aResolver) {
- if (m_regionAttributes != NULLPTR) {
+ if (m_regionAttributes != nullptr) {
m_regionAttributes->m_partitionResolver = aResolver;
}
}
void RegionInternal::setPartitionResolver(const char* libpath,
const char* factoryFuncName) {
- if (m_regionAttributes != NULLPTR) {
+ if (m_regionAttributes != nullptr) {
m_regionAttributes->setPartitionResolver(libpath, factoryFuncName);
}
}
void RegionInternal::setCacheLoader(const CacheLoaderPtr& aLoader) {
- if (m_regionAttributes != NULLPTR) {
+ if (m_regionAttributes != nullptr) {
m_regionAttributes->m_cacheLoader = aLoader;
}
}
void RegionInternal::setCacheLoader(const char* libpath,
const char* factoryFuncName) {
- if (m_regionAttributes != NULLPTR) {
+ if (m_regionAttributes != nullptr) {
m_regionAttributes->setCacheLoader(libpath, factoryFuncName);
}
}
void RegionInternal::setCacheWriter(const CacheWriterPtr& aWriter) {
- if (m_regionAttributes != NULLPTR) {
+ if (m_regionAttributes != nullptr) {
m_regionAttributes->m_cacheWriter = aWriter;
}
}
void RegionInternal::setCacheWriter(const char* libpath,
const char* factoryFuncName) {
- if (m_regionAttributes != NULLPTR) {
+ if (m_regionAttributes != nullptr) {
m_regionAttributes->setCacheWriter(libpath, factoryFuncName);
}
}
void RegionInternal::setEndpoints(const char* endpoints) {
- if (m_regionAttributes != NULLPTR) {
+ if (m_regionAttributes != nullptr) {
m_regionAttributes->setEndpoints(endpoints);
}
}
void RegionInternal::setClientNotificationEnabled(
bool clientNotificationEnabled) {
- if (m_regionAttributes != NULLPTR) {
+ if (m_regionAttributes != nullptr) {
m_regionAttributes->m_clientNotificationEnabled = clientNotificationEnabled;
}
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/RegionInternal.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/RegionInternal.hpp b/src/cppcache/src/RegionInternal.hpp
index fcadee8..8478a29 100644
--- a/src/cppcache/src/RegionInternal.hpp
+++ b/src/cppcache/src/RegionInternal.hpp
@@ -135,13 +135,13 @@ class RegionInternal : public Region {
bool receiveValues = true);
virtual void unregisterKeys(const VectorOfCacheableKey& keys);
virtual void registerAllKeys(bool isDurable = false,
- VectorOfCacheableKeyPtr resultKeys = NULLPTR,
+ VectorOfCacheableKeyPtr resultKeys = nullptr,
bool getInitialValues = false,
bool receiveValues = true);
virtual void unregisterAllKeys();
virtual void registerRegex(const char* regex, bool isDurable = false,
- VectorOfCacheableKeyPtr resultKeys = NULLPTR,
+ VectorOfCacheableKeyPtr resultKeys = nullptr,
bool getInitialValues = false,
bool receiveValues = true);
virtual void unregisterRegex(const char* regex);
@@ -172,7 +172,7 @@ class RegionInternal : public Region {
const CacheEventFlags eventFlags,
VersionTagPtr versionTag,
DataInput* delta = NULL,
- EventIdPtr eventId = NULLPTR) = 0;
+ EventIdPtr eventId = nullptr) = 0;
virtual GfErrType createNoThrow(const CacheableKeyPtr& key,
const CacheablePtr& value,
const UserDataPtr& aCallbackArgument,
@@ -227,7 +227,7 @@ class RegionInternal : public Region {
virtual bool cacheEnabled() = 0;
virtual bool isDestroyed() const = 0;
virtual void evict(int32_t percentage) = 0;
- virtual CacheImpl* getCacheImpl() = 0;
+ virtual CacheImpl* getCacheImpl() const = 0;
virtual TombstoneListPtr getTombstoneList();
// KN: added now.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/RegionXmlCreation.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/RegionXmlCreation.cpp b/src/cppcache/src/RegionXmlCreation.cpp
index b9b4aba..3c937e2 100644
--- a/src/cppcache/src/RegionXmlCreation.cpp
+++ b/src/cppcache/src/RegionXmlCreation.cpp
@@ -43,17 +43,17 @@ void RegionXmlCreation::fillIn(RegionPtr regionPtr) {
void RegionXmlCreation::createRoot(Cache* cache) {
GF_D_ASSERT(this->isRoot);
- RegionPtr rootRegPtr = NULLPTR;
+ RegionPtr rootRegPtr = nullptr;
if (Cache_CreatedFromCacheFactory) {
- // if(cache->m_cacheImpl->getDefaultPool() == NULLPTR)
+ // if(cache->m_cacheImpl->getDefaultPool() == nullptr)
{
// we may need to initialize default pool
if (regAttrs->getEndpoints() == NULL) {
if (regAttrs->getPoolName() == NULL) {
PoolPtr pool = CacheFactory::createOrGetDefaultPool();
- if (pool == NULLPTR) {
+ if (pool == nullptr) {
throw IllegalStateException("Pool is not defined create region.");
}
regAttrs->setPoolName(pool->getName());
@@ -69,14 +69,14 @@ void RegionXmlCreation::createRoot(Cache* cache) {
void RegionXmlCreation::create(RegionPtr parent) {
GF_D_ASSERT(!(this->isRoot));
- RegionPtr subRegPtr = NULLPTR;
+ RegionPtr subRegPtr = nullptr;
subRegPtr = parent->createSubregion(regionName.c_str(), regAttrs);
fillIn(subRegPtr);
}
RegionXmlCreation::RegionXmlCreation(char* name, bool isRootRegion)
- : regAttrs(NULLPTR) {
+ : regAttrs(nullptr) {
std::string tempName(name);
regionName = tempName;
isRoot = isRootRegion;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/RemoteQuery.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/RemoteQuery.cpp b/src/cppcache/src/RemoteQuery.cpp
index cf617ce..3fbb411 100644
--- a/src/cppcache/src/RemoteQuery.cpp
+++ b/src/cppcache/src/RemoteQuery.cpp
@@ -39,16 +39,16 @@ RemoteQuery::RemoteQuery(const char* querystr,
SelectResultsPtr RemoteQuery::execute(uint32_t timeout) {
GuardUserAttribures gua;
- if (m_proxyCache != NULLPTR) {
+ if (m_proxyCache != nullptr) {
gua.setProxyCache(m_proxyCache);
}
- return execute(timeout, "Query::execute", m_tccdm, NULLPTR);
+ return execute(timeout, "Query::execute", m_tccdm, nullptr);
}
SelectResultsPtr RemoteQuery::execute(CacheableVectorPtr paramList,
uint32_t timeout) {
GuardUserAttribures gua;
- if (m_proxyCache != NULLPTR) {
+ if (m_proxyCache != nullptr) {
gua.setProxyCache(m_proxyCache);
}
return execute(timeout, "Query::execute", m_tccdm, paramList);
@@ -88,7 +88,7 @@ SelectResultsPtr RemoteQuery::execute(uint32_t timeout, const char* func,
if (sizeOfFieldNamesVec == 0) {
LOGFINEST("%s: creating ResultSet for query: %s", func,
m_queryString.c_str());
- sr = new ResultSetImpl(values);
+ sr = std::make_shared<ResultSetImpl>(values);
} else {
if (values->size() % fieldNameVec.size() != 0) {
char exMsg[1024];
@@ -100,7 +100,7 @@ SelectResultsPtr RemoteQuery::execute(uint32_t timeout, const char* func,
} else {
LOGFINEST("%s: creating StructSet for query: %s", func,
m_queryString.c_str());
- sr = new StructSetImpl(values, fieldNameVec);
+ sr = std::make_shared<StructSetImpl>(values, fieldNameVec);
}
}
@@ -127,10 +127,10 @@ GfErrType RemoteQuery::executeNoThrow(uint32_t timeout, TcrMessageReply& reply,
}
LOGDEBUG("%s: creating QUERY TcrMessage for query: %s", func,
m_queryString.c_str());
- if (paramList != NULLPTR) {
+ if (paramList != nullptr) {
// QUERY_WITH_PARAMETERS
TcrMessageQueryWithParameters msg(
- m_queryString, NULLPTR, paramList,
+ m_queryString, nullptr, paramList,
static_cast<int>(timeout * 1000) /* in milli second */, tcdm);
msg.setTimeout(timeout);
reply.setTimeout(timeout);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/RemoteQuery.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/RemoteQuery.hpp b/src/cppcache/src/RemoteQuery.hpp
index b9daad7..3a44ce3 100644
--- a/src/cppcache/src/RemoteQuery.hpp
+++ b/src/cppcache/src/RemoteQuery.hpp
@@ -51,7 +51,7 @@ class CPPCACHE_EXPORT RemoteQuery : public Query {
public:
RemoteQuery(const char* querystr, const RemoteQueryServicePtr& queryService,
- ThinClientBaseDM* tccdmptr, ProxyCachePtr proxyCache = NULLPTR);
+ ThinClientBaseDM* tccdmptr, ProxyCachePtr proxyCache = nullptr);
//@TODO check the return type, is it ok. second option could be to pass
// SelectResults by reference as a parameter.
@@ -59,7 +59,7 @@ class CPPCACHE_EXPORT RemoteQuery : public Query {
//@TODO check the return type, is it ok. second option could be to pass
// SelectResults by reference as a parameter.
- SelectResultsPtr execute(CacheableVectorPtr paramList = NULLPTR,
+ SelectResultsPtr execute(CacheableVectorPtr paramList = nullptr,
uint32_t timeout = DEFAULT_QUERY_RESPONSE_TIMEOUT);
// executes a query using a given distribution manager
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/RemoteQueryService.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/RemoteQueryService.cpp b/src/cppcache/src/RemoteQueryService.cpp
index 791f13d..9240243 100644
--- a/src/cppcache/src/RemoteQueryService.cpp
+++ b/src/cppcache/src/RemoteQueryService.cpp
@@ -26,7 +26,7 @@ using namespace apache::geode::client;
RemoteQueryService::RemoteQueryService(CacheImpl* cptr,
ThinClientPoolDM* poolDM)
- : m_invalid(true), m_cqService(NULLPTR) {
+ : m_invalid(true), m_cqService(nullptr) {
if (poolDM) {
m_tccdm = poolDM;
} else {
@@ -62,8 +62,7 @@ QueryPtr RemoteQueryService::newQuery(const char* querystring) {
"QueryService::newQuery: Cache has been closed.");
}
LOGDEBUG("RemoteQueryService: creating a new query: %s", querystring);
- return QueryPtr(
- new RemoteQuery(querystring, RemoteQueryServicePtr(this), m_tccdm));
+ return QueryPtr(new RemoteQuery(querystring, shared_from_this(), m_tccdm));
} else {
UserAttributesPtr ua =
TSSUserAttributesWrapper::s_geodeTSSUserAttributes->getUserAttributes();
@@ -74,18 +73,18 @@ QueryPtr RemoteQueryService::newQuery(const char* querystring) {
"QueryService::newQuery: Cache has been closed.");
}
LOGDEBUG("RemoteQueryService: creating a new query: %s", querystring);
- return QueryPtr(new RemoteQuery(querystring, RemoteQueryServicePtr(this),
- m_tccdm, ua->getProxyCache()));
+ return QueryPtr(new RemoteQuery(querystring, shared_from_this(), m_tccdm,
+ ua->getProxyCache()));
}
}
void RemoteQueryService::close() {
LOGFINEST("RemoteQueryService::close: starting close");
TryWriteGuard guard(m_rwLock, m_invalid);
- if (m_cqService != NULLPTR) {
+ if (m_cqService != nullptr) {
LOGFINEST("RemoteQueryService::close: starting CQ service close");
m_cqService->closeCqService();
- m_cqService = NULLPTR;
+ m_cqService = nullptr;
LOGFINEST("RemoteQueryService::close: completed CQ service close");
}
if (dynamic_cast<ThinClientCacheDistributionManager*>(m_tccdm)) {
@@ -113,7 +112,7 @@ GfErrType RemoteQueryService::executeAllCqs(TcrEndpoint* endpoint) {
return GF_NOERR;
}
- if (m_cqService == NULLPTR) {
+ if (m_cqService == nullptr) {
LOGFINE(
"RemoteQueryService: no cq to execute after failover to endpoint[%s]",
endpoint->name().c_str());
@@ -134,7 +133,7 @@ void RemoteQueryService::executeAllCqs(bool failover) {
return;
}
/*if cq has not been started, then failover will not start it.*/
- if (m_cqService != NULLPTR) {
+ if (m_cqService != nullptr) {
LOGFINE("RemoteQueryService: execute all cqs after failover");
m_cqService->executeAllClientCqs(failover);
} else {
@@ -178,19 +177,19 @@ void RemoteQueryService::closeCqs() {
return;
}
// If cqService has not started, then no cq exists
- if (m_cqService != NULLPTR) {
+ if (m_cqService != nullptr) {
m_cqService->closeAllCqs();
}
}
-void RemoteQueryService::getCqs(VectorOfCqQuery& vec) {
+void RemoteQueryService::getCqs(CqService::query_container_type& vec) {
TryReadGuard guard(m_rwLock, m_invalid);
if (m_invalid) {
throw CacheClosedException("QueryService::getCqs: Cache has been closed.");
}
// If cqService has not started, then no cq exists
- if (m_cqService != NULLPTR) {
+ if (m_cqService != nullptr) {
m_cqService->getAllCqs(vec);
}
}
@@ -202,11 +201,11 @@ CqQueryPtr RemoteQueryService::getCq(const char* name) {
throw CacheClosedException("QueryService::getCq: Cache has been closed.");
}
// If cqService has not started, then no cq exists
- if (m_cqService != NULLPTR) {
+ if (m_cqService != nullptr) {
std::string nm(name);
return m_cqService->getCq(nm);
}
- return NULLPTR;
+ return nullptr;
}
void RemoteQueryService::executeCqs() {
@@ -217,7 +216,7 @@ void RemoteQueryService::executeCqs() {
"QueryService::executeCqs: Cache has been closed.");
}
// If cqService has not started, then no cq exists
- if (m_cqService != NULLPTR) {
+ if (m_cqService != nullptr) {
m_cqService->executeAllClientCqs();
}
}
@@ -230,7 +229,7 @@ void RemoteQueryService::stopCqs() {
return;
}
// If cqService has not started, then no cq exists
- if (m_cqService != NULLPTR) {
+ if (m_cqService != nullptr) {
m_cqService->stopAllClientCqs();
}
}
@@ -243,11 +242,10 @@ CqServiceStatisticsPtr RemoteQueryService::getCqServiceStatistics() {
"QueryService::getCqServiceStatistics: Cache has been closed.");
}
// If cqService has not started, then no cq exists
- if (m_cqService != NULLPTR) {
+ if (m_cqService != nullptr) {
return m_cqService->getCqServiceStatistics();
}
- CqServiceStatisticsPtr ptr(new CqServiceVsdStats());
- return ptr;
+ return std::make_shared<CqServiceVsdStats>();
}
void RemoteQueryService::receiveNotification(TcrMessage* msg) {
@@ -258,7 +256,7 @@ void RemoteQueryService::receiveNotification(TcrMessage* msg) {
return;
}
/*if cq has not been started, then no cq exists */
- if (m_cqService == NULLPTR) {
+ if (m_cqService == nullptr) {
return;
}
if (!m_cqService->checkAndAcquireLock()) {
@@ -276,16 +274,16 @@ CacheableArrayListPtr RemoteQueryService::getAllDurableCqsFromServer() {
"QueryService::getAllDurableCqsFromServer: Cache has been closed.");
}
// If cqService has not started, then no cq exists
- if (m_cqService != NULLPTR) {
+ if (m_cqService != nullptr) {
return m_cqService->getAllDurableCqsFromServer();
} else {
- return NULLPTR;
+ return nullptr;
}
}
void RemoteQueryService::invokeCqConnectedListeners(ThinClientPoolDM* pool,
bool connected) {
- if (m_cqService == NULLPTR) {
+ if (m_cqService == nullptr) {
return;
}
std::string poolName;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/RemoteQueryService.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/RemoteQueryService.hpp b/src/cppcache/src/RemoteQueryService.hpp
index 3c14c5b..c5bf8fb 100644
--- a/src/cppcache/src/RemoteQueryService.hpp
+++ b/src/cppcache/src/RemoteQueryService.hpp
@@ -35,9 +35,11 @@ namespace client {
class CacheImpl;
class ThinClientPoolDM;
typedef std::map<std::string, bool> CqPoolsConnected;
-class CPPCACHE_EXPORT RemoteQueryService : public QueryService {
+class CPPCACHE_EXPORT RemoteQueryService
+ : public QueryService,
+ public std::enable_shared_from_this<RemoteQueryService> {
public:
- RemoteQueryService(CacheImpl* cptr, ThinClientPoolDM* poolDM = NULL);
+ RemoteQueryService(CacheImpl* cptr, ThinClientPoolDM* poolDM = nullptr);
void init();
@@ -54,7 +56,7 @@ class CPPCACHE_EXPORT RemoteQueryService : public QueryService {
virtual CqQueryPtr newCq(const char* name, const char* querystr,
CqAttributesPtr& cqAttr, bool isDurable = false);
virtual void closeCqs();
- virtual void getCqs(VectorOfCqQuery& vec);
+ virtual void getCqs(QueryService::query_container_type& vec);
virtual CqQueryPtr getCq(const char* name);
virtual void executeCqs();
virtual void stopCqs();
@@ -69,9 +71,9 @@ class CPPCACHE_EXPORT RemoteQueryService : public QueryService {
void invokeCqConnectedListeners(ThinClientPoolDM* pool, bool connected);
// For Lazy Cq Start-no use, no start
inline void initCqService() {
- if (m_cqService == NULLPTR) {
+ if (m_cqService == nullptr) {
LOGFINE("RemoteQueryService: starting cq service");
- m_cqService = new CqService(m_tccdm);
+ m_cqService = std::make_shared<CqService>(m_tccdm);
LOGFINE("RemoteQueryService: started cq service");
}
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/ResultSetImpl.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ResultSetImpl.cpp b/src/cppcache/src/ResultSetImpl.cpp
index 63610bf..2e8df44 100644
--- a/src/cppcache/src/ResultSetImpl.cpp
+++ b/src/cppcache/src/ResultSetImpl.cpp
@@ -42,7 +42,7 @@ const SerializablePtr ResultSetImpl::operator[](int32_t index) const {
}
SelectResultsIterator ResultSetImpl::getIterator() {
- return SelectResultsIterator(m_resultSetVector, SelectResultsPtr(this));
+ return SelectResultsIterator(m_resultSetVector, shared_from_this());
}
SelectResults::Iterator ResultSetImpl::begin() const {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/ResultSetImpl.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ResultSetImpl.hpp b/src/cppcache/src/ResultSetImpl.hpp
index ff3891d..5eba661 100644
--- a/src/cppcache/src/ResultSetImpl.hpp
+++ b/src/cppcache/src/ResultSetImpl.hpp
@@ -36,7 +36,9 @@ namespace apache {
namespace geode {
namespace client {
-class CPPCACHE_EXPORT ResultSetImpl : public ResultSet {
+class CPPCACHE_EXPORT ResultSetImpl
+ : public ResultSet,
+ public std::enable_shared_from_this<ResultSetImpl> {
public:
ResultSetImpl(const CacheableVectorPtr& response);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/SelectResultsIterator.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/SelectResultsIterator.cpp b/src/cppcache/src/SelectResultsIterator.cpp
index 69a0a46..12c9cce 100644
--- a/src/cppcache/src/SelectResultsIterator.cpp
+++ b/src/cppcache/src/SelectResultsIterator.cpp
@@ -34,7 +34,7 @@ bool SelectResultsIterator::hasNext() const {
}
const SerializablePtr SelectResultsIterator::next() {
- if (!hasNext()) return NULLPTR;
+ if (!hasNext()) return nullptr;
return m_vectorSR->operator[](m_nextIndex++);
}
@@ -49,7 +49,7 @@ bool SelectResultsIterator::moveNext() {
}
const SerializablePtr SelectResultsIterator::current() const {
- if (m_nextIndex == 0 || m_nextIndex > m_vectorSR->size()) return NULLPTR;
+ if (m_nextIndex == 0 || m_nextIndex > m_vectorSR->size()) return nullptr;
return m_vectorSR->operator[](m_nextIndex - 1);
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/SerializationRegistry.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/SerializationRegistry.cpp b/src/cppcache/src/SerializationRegistry.cpp
index e7f7c27..b9ff536 100644
--- a/src/cppcache/src/SerializationRegistry.cpp
+++ b/src/cppcache/src/SerializationRegistry.cpp
@@ -339,7 +339,7 @@ TheTypeMap::TheTypeMap() {
typedef ACE_Singleton<TheTypeMap, ACE_Thread_Mutex> theTypeMap;
-PdxSerializerPtr SerializationRegistry::m_pdxSerializer = NULLPTR;
+PdxSerializerPtr SerializationRegistry::m_pdxSerializer = nullptr;
/** This starts at reading the typeid.. assumes the length has been read. */
SerializablePtr SerializationRegistry::deserialize(DataInput& input,
@@ -353,7 +353,7 @@ SerializablePtr SerializationRegistry::deserialize(DataInput& input,
LOGDEBUG("SerializationRegistry::deserialize typeid = %d currentTypeId= %d ",
typeId, currentTypeId);
if (compId == GeodeTypeIds::NullObj) {
- return NULLPTR;
+ return nullptr;
} else if (compId == GeodeTypeIds::CacheableNullString) {
return SerializablePtr(CacheableString::createDeserializable());
} else if (compId == GeodeTypeIdsImpl::CacheableUserData) {
@@ -414,7 +414,11 @@ SerializablePtr SerializationRegistry::deserialize(DataInput& input,
}
SerializablePtr obj(createType());
// This assignment allows the fromData method to return a different object.
- return SerializablePtr(obj->fromData(input));
+ auto tmp = obj->fromData(input);
+ if (obj.get() == tmp) {
+ return obj;
+ }
+ return tmp->shared_from_this();
}
void SerializationRegistry::addType(TypeFactoryMethod func) {
@@ -453,12 +457,12 @@ void SerializationRegistry::init() {
}
PdxSerializablePtr SerializationRegistry::getPdxType(char* className) {
- TypeFactoryMethodPdx objectType = NULL;
+ TypeFactoryMethodPdx objectType = nullptr;
theTypeMap::instance()->findPdxType(className, objectType);
PdxSerializablePtr pdxObj;
- if (objectType == NULL) {
+ if (nullptr == objectType) {
try {
- pdxObj = new PdxWrapper((const char*)className);
+ pdxObj = std::make_shared<PdxWrapper>((const char*)className);
} catch (const Exception&) {
LOGERROR(
"Unregistered class %s during PDX deserialization: Did the "
@@ -468,7 +472,7 @@ PdxSerializablePtr SerializationRegistry::getPdxType(char* className) {
"Unregistered class or serializer in PDX deserialization");
}
} else {
- pdxObj = objectType();
+ pdxObj.reset(objectType());
}
return pdxObj;
}
@@ -483,7 +487,7 @@ PdxSerializerPtr SerializationRegistry::getPdxSerializer() {
int32_t SerializationRegistry::GetPDXIdForType(const char* poolName,
SerializablePtr pdxType) {
- PoolPtr pool = NULLPTR;
+ PoolPtr pool = nullptr;
if (poolName == NULL) {
const HashMapOfPools& pools = PoolManager::getAll();
@@ -499,16 +503,16 @@ int32_t SerializationRegistry::GetPDXIdForType(const char* poolName,
pool = PoolManager::find(poolName);
}
- if (pool == NULLPTR) {
+ if (pool == nullptr) {
throw IllegalStateException("Pool not found, Pdx operation failed");
}
- return static_cast<ThinClientPoolDM*>(pool.ptr())->GetPDXIdForType(pdxType);
+ return static_cast<ThinClientPoolDM*>(pool.get())->GetPDXIdForType(pdxType);
}
SerializablePtr SerializationRegistry::GetPDXTypeById(const char* poolName,
int32_t typeId) {
- PoolPtr pool = NULLPTR;
+ PoolPtr pool = nullptr;
if (poolName == NULL) {
const HashMapOfPools& pools = PoolManager::getAll();
@@ -521,38 +525,37 @@ SerializablePtr SerializationRegistry::GetPDXTypeById(const char* poolName,
pool = PoolManager::find(poolName);
}
- if (pool == NULLPTR) {
+ if (pool == nullptr) {
throw IllegalStateException("Pool not found, Pdx operation failed");
}
- return static_cast<ThinClientPoolDM*>(pool.ptr())->GetPDXTypeById(typeId);
+ return static_cast<ThinClientPoolDM*>(pool.get())->GetPDXTypeById(typeId);
}
int32_t SerializationRegistry::GetEnumValue(SerializablePtr enumInfo) {
PoolPtr pool = getPool();
- if (pool == NULLPTR) {
+ if (pool == nullptr) {
throw IllegalStateException("Pool not found, Pdx operation failed");
}
- return static_cast<ThinClientPoolDM*>(pool.ptr())->GetEnumValue(enumInfo);
+ return static_cast<ThinClientPoolDM*>(pool.get())->GetEnumValue(enumInfo);
}
SerializablePtr SerializationRegistry::GetEnum(int32_t val) {
PoolPtr pool = getPool();
- if (pool == NULLPTR) {
+ if (pool == nullptr) {
throw IllegalStateException("Pool not found, Pdx operation failed");
}
- return static_cast<ThinClientPoolDM*>(pool.ptr())->GetEnum(val);
+ return static_cast<ThinClientPoolDM*>(pool.get())->GetEnum(val);
}
PoolPtr SerializationRegistry::getPool() {
- PoolPtr pool = NULLPTR;
+ PoolPtr pool = nullptr;
const HashMapOfPools& pools = PoolManager::getAll();
if (pools.size() > 0) {
for (HashMapOfPools::Iterator iter = pools.begin(); iter != pools.end();
++iter) {
- PoolPtr currPool(iter.second());
- pool = currPool;
+ pool = iter.second();
break;
}
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/SerializationRegistry.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/SerializationRegistry.hpp b/src/cppcache/src/SerializationRegistry.hpp
index 85783f7..211c35e 100644
--- a/src/cppcache/src/SerializationRegistry.hpp
+++ b/src/cppcache/src/SerializationRegistry.hpp
@@ -107,7 +107,7 @@ class CPPCACHE_EXPORT SerializationRegistry {
}
inline static void serialize(const SerializablePtr& obj, DataOutput& output) {
- serialize(obj.ptr(), output);
+ serialize(obj.get(), output);
}
/**
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/ServerLocation.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ServerLocation.cpp b/src/cppcache/src/ServerLocation.cpp
index e35c9c6..fbb1c2e 100644
--- a/src/cppcache/src/ServerLocation.cpp
+++ b/src/cppcache/src/ServerLocation.cpp
@@ -22,7 +22,7 @@ namespace apache {
namespace geode {
namespace client {
void ServerLocation::makeEpString() {
- if (m_serverName != NULLPTR) {
+ if (m_serverName != nullptr) {
char epstring[1024] = {0};
ACE_OS::snprintf(epstring, 1024, "%s:%d", m_serverName->asChar(), m_port);
m_epString = epstring;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/ServerLocation.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ServerLocation.hpp b/src/cppcache/src/ServerLocation.hpp
index 417020a..aea711e 100644
--- a/src/cppcache/src/ServerLocation.hpp
+++ b/src/cppcache/src/ServerLocation.hpp
@@ -45,7 +45,7 @@ class CPPCACHE_EXPORT ServerLocation : public Serializable {
}
ServerLocation()
: Serializable(),
- m_serverName(NULLPTR),
+ m_serverName(nullptr),
m_port(-1) // Default constructor for deserialiozation.
{}
@@ -62,7 +62,7 @@ class CPPCACHE_EXPORT ServerLocation : public Serializable {
}
std::string getServerName() const {
- if (m_serverName != NULLPTR) {
+ if (m_serverName != nullptr) {
return m_serverName->asChar();
}
return "";
@@ -70,7 +70,7 @@ class CPPCACHE_EXPORT ServerLocation : public Serializable {
void setServername(CacheableStringPtr sn) { m_serverName = sn; }
int getPort() const { return m_port; }
void toData(DataOutput& output) const {
- if (m_serverName != NULLPTR) {
+ if (m_serverName != nullptr) {
// output.writeObject( m_serverName );
output.writeNativeString(m_serverName->asChar()); // changed
}
@@ -84,7 +84,7 @@ class CPPCACHE_EXPORT ServerLocation : public Serializable {
return this;
}
uint32_t objectSize() const {
- if (m_serverName != NULLPTR) {
+ if (m_serverName != nullptr) {
return static_cast<uint32_t>(sizeof(int)) +
(m_serverName->length()) * static_cast<uint32_t>(sizeof(char));
}
@@ -132,7 +132,7 @@ class CPPCACHE_EXPORT ServerLocation : public Serializable {
/*char server1[256];
char server2[256];
size_t len = 0;
- if (m_serverName != NULLPTR && rhs.getServerName( ).c_str() != NULL) {
+ if (m_serverName != nullptr && rhs.getServerName( ).c_str() != NULL) {
ACE_INET_Addr addr1( m_port, m_serverName->asChar() );
len = strlen(addr1.get_host_addr());
memcpy(server1, addr1.get_host_addr(), len);
@@ -149,7 +149,7 @@ class CPPCACHE_EXPORT ServerLocation : public Serializable {
}
inline bool isValid() const {
- if (m_serverName == NULLPTR) return false;
+ if (m_serverName == nullptr) return false;
return m_serverName->length() > 0 && m_port >= 0;
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/SharedBase.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/SharedBase.cpp b/src/cppcache/src/SharedBase.cpp
deleted file mode 100644
index 976942d..0000000
--- a/src/cppcache/src/SharedBase.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <geode/SharedBase.hpp>
-#include <HostAsm.hpp>
-
-#include <typeinfo>
-
-namespace apache {
-namespace geode {
-namespace client {
-
-void SharedBase::preserveSB() const { HostAsm::atomicAdd(m_refCount, 1); }
-
-void SharedBase::releaseSB() const {
- if (HostAsm::atomicAdd(m_refCount, -1) == 0) {
- delete this;
- }
-}
-
-// dummy instance to use for NULLPTR
-const NullSharedBase* const NullSharedBase::s_instancePtr = NULL;
-} // namespace client
-} // namespace geode
-} // namespace apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/Struct.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/Struct.cpp b/src/cppcache/src/Struct.cpp
index d046e22..314b5ee 100644
--- a/src/cppcache/src/Struct.cpp
+++ b/src/cppcache/src/Struct.cpp
@@ -112,7 +112,7 @@ const char* Struct::getFieldName(int32_t index) {
const SerializablePtr Struct::operator[](int32_t index) const {
if (index >= m_fieldValues.size()) {
- return NULLPTR;
+ return nullptr;
}
return m_fieldValues[index];
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/StructSetImpl.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/StructSetImpl.cpp b/src/cppcache/src/StructSetImpl.cpp
index 6c09a24..3c8ce0f 100644
--- a/src/cppcache/src/StructSetImpl.cpp
+++ b/src/cppcache/src/StructSetImpl.cpp
@@ -47,7 +47,7 @@ StructSetImpl::StructSetImpl(
for (size_t i = 0; i < numOfFields; i++) {
tmpVec.push_back(response->operator[](valStoredCnt++));
}
- StructPtr siPtr(new Struct(this, tmpVec));
+ auto siPtr = std::make_shared<Struct>(this, tmpVec);
m_structVector->push_back(siPtr);
}
}
@@ -65,7 +65,7 @@ const SerializablePtr StructSetImpl::operator[](int32_t index) const {
}
SelectResultsIterator StructSetImpl::getIterator() {
- return SelectResultsIterator(m_structVector, SelectResultsPtr(this));
+ return SelectResultsIterator(m_structVector, shared_from_this());
}
int32_t StructSetImpl::getFieldIndex(const char* fieldname) {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/StructSetImpl.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/StructSetImpl.hpp b/src/cppcache/src/StructSetImpl.hpp
index 5c7eb0c..28f5368 100644
--- a/src/cppcache/src/StructSetImpl.hpp
+++ b/src/cppcache/src/StructSetImpl.hpp
@@ -40,7 +40,9 @@ namespace apache {
namespace geode {
namespace client {
-class CPPCACHE_EXPORT StructSetImpl : public StructSet {
+class CPPCACHE_EXPORT StructSetImpl
+ : public StructSet,
+ public std::enable_shared_from_this<StructSetImpl> {
public:
StructSetImpl(const CacheableVectorPtr& values,
const std::vector<CacheableStringPtr>& fieldNames);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/SystemProperties.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/SystemProperties.cpp b/src/cppcache/src/SystemProperties.cpp
index a1b2185..e17c1e5 100644
--- a/src/cppcache/src/SystemProperties.cpp
+++ b/src/cppcache/src/SystemProperties.cpp
@@ -202,11 +202,11 @@ SystemProperties::SystemProperties(const PropertiesPtr& propertiesPtr,
m_redundancyMonitorInterval(DefaultRedundancyMonitorInterval),
m_notifyAckInterval(DefaultNotifyAckInterval),
m_notifyDupCheckLife(DefaultNotifyDupCheckLife),
- m_AuthIniLoaderLibrary(NULLPTR),
- m_AuthIniLoaderFactory(NULLPTR),
- m_securityClientDhAlgo(NULLPTR),
- m_securityClientKsPath(NULLPTR),
- m_authInitializer(NULLPTR),
+ m_AuthIniLoaderLibrary(nullptr),
+ m_AuthIniLoaderFactory(nullptr),
+ m_securityClientDhAlgo(nullptr),
+ m_securityClientKsPath(nullptr),
+ m_authInitializer(nullptr),
m_durableClientId(NULL),
m_durableTimeout(DefaultDurableTimeout),
m_connectTimeout(DefaultConnectTimeout),
@@ -252,7 +252,7 @@ SystemProperties::SystemProperties(const PropertiesPtr& propertiesPtr,
void visit(CacheableKeyPtr& key, CacheablePtr& value) {
CacheableStringPtr prop = key->toString();
CacheableStringPtr val;
- if (value != NULLPTR) {
+ if (value != nullptr) {
val = value->toString();
}
m_sysProps->processProperty(prop->asChar(), val->asChar());
@@ -283,7 +283,7 @@ SystemProperties::SystemProperties(const PropertiesPtr& propertiesPtr,
givenConfigPtr->foreach (processPropsVisitor);
// Now consume any properties provided by the Properties object in code.
- if (propertiesPtr != NULLPTR) {
+ if (propertiesPtr != nullptr) {
propertiesPtr->foreach (processPropsVisitor);
}
@@ -925,25 +925,25 @@ void SystemProperties::logSettings() {
}
AuthInitializePtr SystemProperties::getAuthLoader() {
- if ((m_authInitializer == NULLPTR) && (m_AuthIniLoaderLibrary != NULLPTR &&
- m_AuthIniLoaderFactory != NULLPTR)) {
+ if ((m_authInitializer == nullptr) && (m_AuthIniLoaderLibrary != nullptr &&
+ m_AuthIniLoaderFactory != nullptr)) {
if (managedAuthInitializeFn != NULL &&
strchr(m_AuthIniLoaderFactory->asChar(), '.') != NULL) {
// this is a managed library
- m_authInitializer = (*managedAuthInitializeFn)(
- m_AuthIniLoaderLibrary->asChar(), m_AuthIniLoaderFactory->asChar());
+ m_authInitializer.reset((*managedAuthInitializeFn)(
+ m_AuthIniLoaderLibrary->asChar(), m_AuthIniLoaderFactory->asChar()));
} else {
AuthInitialize* (*funcptr)();
funcptr = reinterpret_cast<AuthInitialize* (*)()>(getFactoryFunc(
m_AuthIniLoaderLibrary->asChar(), m_AuthIniLoaderFactory->asChar()));
if (funcptr == NULL) {
LOGERROR("Failed to acquire handle to AuthInitialize library");
- return NULLPTR;
+ return nullptr;
}
AuthInitialize* p = funcptr();
- m_authInitializer = p;
+ m_authInitializer.reset(p);
}
- } else if (m_authInitializer == NULLPTR) {
+ } else if (m_authInitializer == nullptr) {
LOGFINE("No AuthInitialize library or factory configured");
}
return m_authInitializer;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/TXCleaner.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/TXCleaner.cpp b/src/cppcache/src/TXCleaner.cpp
index 3c9a0fc..7073e90 100644
--- a/src/cppcache/src/TXCleaner.cpp
+++ b/src/cppcache/src/TXCleaner.cpp
@@ -42,7 +42,7 @@ TXCleaner::~TXCleaner() {
}
}
void TXCleaner::clean() {
- if (m_txState != NULL && m_txState->getTransactionId().ptr() != NULL) {
+ if (m_txState != NULL && m_txState->getTransactionId().get() != NULL) {
m_cacheTxMgr->removeTx(m_txState->getTransactionId()->getId());
}
if (m_txStateWrapper != NULL && m_txState != NULL) {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/TXCommitMessage.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/TXCommitMessage.cpp b/src/cppcache/src/TXCommitMessage.cpp
index 03f92e7..ba7e15b 100644
--- a/src/cppcache/src/TXCommitMessage.cpp
+++ b/src/cppcache/src/TXCommitMessage.cpp
@@ -88,7 +88,7 @@ m_processorId = -1;
int32_t regionSize;
input.readInt(®ionSize);
for (int32_t i = 0; i < regionSize; i++) {
- RegionCommitPtr rc(new RegionCommit(/*this*/));
+ auto rc = std::make_shared<RegionCommit>();
rc->fromData(input);
m_regions.push_back(rc);
}
@@ -164,7 +164,7 @@ Serializable* TXCommitMessage::create() { return new TXCommitMessage(); }
void TXCommitMessage::apply(Cache* cache) {
for (VectorOfSharedBase::Iterator iter = m_regions.begin();
m_regions.end() != iter; iter++) {
- RegionCommitPtr regionCommit = staticCast<RegionCommitPtr>(*iter);
+ RegionCommitPtr regionCommit = std::static_pointer_cast<GF_UNWRAP_SP(RegionCommitPtr)>(*iter);
regionCommit->apply(cache);
}
}
@@ -177,7 +177,7 @@ VectorOfEntryEvent TXCommitMessage::getEvents(Cache* cache)
m_regions.end() != iter; iter++)
{
RegionCommitPtr regionCommit =
-staticCast<RegionCommitPtr>(*iter);
+std::static_pointer_cast<GF_UNWRAP_SP(RegionCommitPtr)>(*iter);
regionCommit->fillEvents(cache, ops);
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/TXState.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/TXState.cpp b/src/cppcache/src/TXState.cpp
index 2249b7b..89f327a 100644
--- a/src/cppcache/src/TXState.cpp
+++ b/src/cppcache/src/TXState.cpp
@@ -60,7 +60,7 @@ CacheablePtr TXState::replay(bool isRollback) {
GfErrTypeThrowException("Replay is unsupported", GF_NOTSUP);
int retryAttempts = 3;
- CacheablePtr result = NULLPTR;
+ CacheablePtr result = nullptr;
ReplayControl replayControl(this);
m_dirty = false;
@@ -84,7 +84,7 @@ CacheablePtr TXState::replay(bool isRollback) {
for (VectorOfSharedBase::Iterator iter = m_operations.begin();
m_operations.end() != iter; iter++) {
TransactionalOperationPtr operation =
- staticCast<TransactionalOperationPtr>(*iter);
+ std::static_pointer_cast<GF_UNWRAP_SP(TransactionalOperationPtr)>(*iter);
result = operation->replay(m_cache);
}
@@ -103,7 +103,7 @@ CacheablePtr TXState::replay(bool isRollback) {
GfErrTypeThrowException(
"Unable to reestablish transaction context on servers", GF_EUNDEF);
- return NULLPTR;
+ return nullptr;
}
void TXState::releaseStickyConnection() {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/TcrChunkedContext.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/TcrChunkedContext.hpp b/src/cppcache/src/TcrChunkedContext.hpp
index 3f3d760..c1c12a3 100644
--- a/src/cppcache/src/TcrChunkedContext.hpp
+++ b/src/cppcache/src/TcrChunkedContext.hpp
@@ -58,7 +58,7 @@ class TcrChunkedResult : public SharedBase {
public:
inline TcrChunkedResult()
: m_finalizeSema(NULL),
- m_ex(NULLPTR),
+ m_ex(nullptr),
m_inSameThread(false),
appDomainContext(createAppDomainContext()),
m_dsmemId(0) {}
@@ -117,9 +117,9 @@ class TcrChunkedResult : public SharedBase {
// getters/setters for the exception, if any, during chunk processing
- inline bool exceptionOccurred() const { return (m_ex != NULLPTR); }
+ inline bool exceptionOccurred() const { return (m_ex != nullptr); }
- inline void setException(Exception& ex) { m_ex = ex.clone(); }
+ inline void setException(Exception& ex) { m_ex.reset(ex.clone()); }
inline ExceptionPtr& getException() { return m_ex; }
};
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/TcrConnection.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/TcrConnection.cpp b/src/cppcache/src/TcrConnection.cpp
index 874ba42..865203e 100644
--- a/src/cppcache/src/TcrConnection.cpp
+++ b/src/cppcache/src/TcrConnection.cpp
@@ -198,7 +198,7 @@ bool TcrConnection::InitTcrConnection(
LOGDEBUG("TcrConnection this->m_endpointObj->isMultiUserMode() = %d ",
this->m_endpointObj->isMultiUserMode());
if (this->m_endpointObj->isMultiUserMode()) {
- if (dhalgo != NULLPTR && dhalgo->length() > 0) isDhOn = true;
+ if (dhalgo != nullptr && dhalgo->length() > 0) isDhOn = true;
}
}
@@ -233,7 +233,7 @@ bool TcrConnection::InitTcrConnection(
LOGFINER("TcrConnection: about to invoke authloader");
PropertiesPtr tmpSecurityProperties =
tmpSystemProperties->getSecurityProperties();
- if (tmpSecurityProperties == NULLPTR) {
+ if (tmpSecurityProperties == nullptr) {
LOGWARN("TcrConnection: security properties not found.");
}
// AuthInitializePtr authInitialize =
@@ -242,7 +242,7 @@ bool TcrConnection::InitTcrConnection(
if (isClientNotification) {
AuthInitializePtr authInitialize =
DistributedSystem::m_impl->getAuthLoader();
- if (authInitialize != NULLPTR) {
+ if (authInitialize != nullptr) {
LOGFINER(
"TcrConnection: acquired handle to authLoader, "
"invoking getCredentials");
@@ -266,7 +266,7 @@ bool TcrConnection::InitTcrConnection(
if (isDhOn) {
CacheableStringPtr ksPath =
tmpSecurityProperties->find("security-client-kspath");
- requireServerAuth = (ksPath != NULLPTR && ksPath->length() > 0);
+ requireServerAuth = (ksPath != nullptr && ksPath->length() > 0);
handShakeMsg.writeBoolean(requireServerAuth);
LOGFINE(
"HandShake: Server authentication using RSA signature %s required",
@@ -323,9 +323,9 @@ bool TcrConnection::InitTcrConnection(
if (error == CONN_NOERR) {
CacheableBytesPtr acceptanceCode = readHandshakeData(1, connectTimeout);
- LOGDEBUG(" Handshake: Got Accept Code %d", acceptanceCode[0]);
+ LOGDEBUG(" Handshake: Got Accept Code %d", (*acceptanceCode)[0]);
/* adongre */
- if (acceptanceCode[0] == REPLY_SSL_ENABLED &&
+ if ((*acceptanceCode)[0] == REPLY_SSL_ENABLED &&
!tmpSystemProperties->sslEnabled()) {
LOGERROR("SSL is enabled on server, enable SSL in client as well");
AuthenticationRequiredException ex(
@@ -335,7 +335,7 @@ bool TcrConnection::InitTcrConnection(
}
// if diffie-hellman based credential encryption is enabled
- if (isDhOn && acceptanceCode[0] == REPLY_OK) {
+ if (isDhOn && (*acceptanceCode)[0] == REPLY_OK) {
// read the server's DH public key
CacheableBytesPtr pubKeyBytes = readHandshakeByteArray(connectTimeout);
LOGDEBUG(" Handshake: Got pubKeySize %d", pubKeyBytes->length());
@@ -387,7 +387,7 @@ bool TcrConnection::InitTcrConnection(
if (error == CONN_NOERR) {
acceptanceCode = readHandshakeData(1, connectTimeout);
- LOGDEBUG("Handshake: Got acceptanceCode Finally %d", acceptanceCode[0]);
+ LOGDEBUG("Handshake: Got acceptanceCode Finally %d", (*acceptanceCode)[0]);
} else {
int32_t lastError = ACE_OS::last_error();
LOGERROR("Handshake failed, errno: %d, server may not be running",
@@ -409,9 +409,9 @@ bool TcrConnection::InitTcrConnection(
// TESTING: Durable clients - set server queue status.
// 0 - Non-Redundant , 1- Redundant , 2- Primary
- if (serverQueueStatus[0] == 1) {
+ if ((*serverQueueStatus)[0] == 1) {
m_hasServerQueue = REDUNDANT_SERVER;
- } else if (serverQueueStatus[0] == 2) {
+ } else if ((*serverQueueStatus)[0] == 2) {
m_hasServerQueue = PRIMARY_SERVER;
} else {
m_hasServerQueue = NON_REDUNDANT_SERVER;
@@ -443,16 +443,16 @@ bool TcrConnection::InitTcrConnection(
if (!isClientNotification) {
// Read and ignore the DistributedMember object
CacheableBytesPtr arrayLenHeader = readHandshakeData(1, connectTimeout);
- int32_t recvMsgLen = static_cast<int32_t>(arrayLenHeader[0]);
+ int32_t recvMsgLen = static_cast<int32_t>((*arrayLenHeader)[0]);
// now check for array length headers - since GFE 5.7
- if (static_cast<int8_t>(arrayLenHeader[0]) == -2) {
+ if (static_cast<int8_t>((*arrayLenHeader)[0]) == -2) {
CacheableBytesPtr recvMsgLenBytes =
readHandshakeData(2, connectTimeout);
DataInput dI2(recvMsgLenBytes->value(), recvMsgLenBytes->length());
int16_t recvMsgLenShort = 0;
dI2.readInt(&recvMsgLenShort);
recvMsgLen = recvMsgLenShort;
- } else if (static_cast<int8_t>(arrayLenHeader[0]) == -3) {
+ } else if (static_cast<int8_t>((*arrayLenHeader)[0]) == -3) {
CacheableBytesPtr recvMsgLenBytes =
readHandshakeData(4, connectTimeout);
DataInput dI2(recvMsgLenBytes->value(), recvMsgLenBytes->length());
@@ -488,11 +488,11 @@ bool TcrConnection::InitTcrConnection(
ThinClientBaseDM::setDeltaEnabledOnServer(isDeltaEnabledOnServer);
}
- switch (acceptanceCode[0]) {
+ switch ((*acceptanceCode)[0]) {
case REPLY_OK:
case SUCCESSFUL_SERVER_TO_CLIENT:
- LOGFINER("Handshake reply: %u,%u,%u", acceptanceCode[0],
- serverQueueStatus[0], recvMsgLen2);
+ LOGFINER("Handshake reply: %u,%u,%u", (*acceptanceCode)[0],
+ (*serverQueueStatus)[0], recvMsgLen2);
if (isClientNotification) readHandshakeInstantiatorMsg(connectTimeout);
break;
case REPLY_AUTHENTICATION_FAILED: {
@@ -532,7 +532,7 @@ bool TcrConnection::InitTcrConnection(
LOGERROR(
"Unknown error[%d] received from server [%s] in handshake: "
"%s",
- acceptanceCode[0], m_endpointObj->name().c_str(),
+ (*acceptanceCode)[0], m_endpointObj->name().c_str(),
recvMessage->value());
MessageException ex(
"TcrConnection::TcrConnection: Unknown error"
@@ -1231,7 +1231,7 @@ CacheableBytesPtr TcrConnection::readHandshakeData(int32_t msgLength,
return CacheableBytes::createNoCopy(reinterpret_cast<uint8_t*>(recvMessage),
msgLength + 1);
}
- return NULLPTR;
+ return nullptr;
}
// read just the bytes without the trailing null terminator
@@ -1247,7 +1247,7 @@ CacheableBytesPtr TcrConnection::readHandshakeRawData(int32_t msgLength,
msgLength = 0;
}
if (msgLength == 0) {
- return NULLPTR;
+ return nullptr;
}
char* recvMessage;
GF_NEW(recvMessage, char[msgLength]);
@@ -1267,7 +1267,7 @@ CacheableBytesPtr TcrConnection::readHandshakeRawData(int32_t msgLength,
"Handshake failure"));
}
// not expected to be reached
- return NULLPTR;
+ return nullptr;
} else {
return CacheableBytes::createNoCopy(reinterpret_cast<uint8_t*>(recvMessage),
msgLength);
@@ -1424,7 +1424,7 @@ CacheableStringPtr TcrConnection::readHandshakeString(uint32_t connectTimeout) {
uint32_t length = 0;
switch (static_cast<int8_t>(cstypeid)) {
case GeodeTypeIds::CacheableNullString: {
- return NULLPTR;
+ return nullptr;
break;
}
case GF_STRING: {
@@ -1446,7 +1446,7 @@ CacheableStringPtr TcrConnection::readHandshakeString(uint32_t connectTimeout) {
LOGDEBUG(" Received string len %d", length);
if (length == 0) {
- return NULLPTR;
+ return nullptr;
}
char* recvMessage;
@@ -1471,7 +1471,7 @@ CacheableStringPtr TcrConnection::readHandshakeString(uint32_t connectTimeout) {
"Handshake failure reading string bytes"));
}
// not expected to be reached
- return NULLPTR;
+ return nullptr;
} else {
LOGDEBUG(" Received string data [%s]", recvMessage);
CacheableStringPtr retval =
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/TcrConnectionManager.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/TcrConnectionManager.cpp b/src/cppcache/src/TcrConnectionManager.cpp
index 67d7d01..f46e2d0 100644
--- a/src/cppcache/src/TcrConnectionManager.cpp
+++ b/src/cppcache/src/TcrConnectionManager.cpp
@@ -84,7 +84,7 @@ void TcrConnectionManager::init(bool isPool) {
const char *endpoints;
m_redundancyManager->m_HAenabled = false;
- if (cacheAttributes != NULLPTR &&
+ if (cacheAttributes != nullptr &&
(cacheAttributes->getRedundancyLevel() > 0 || m_isDurable) &&
(endpoints = cacheAttributes->getEndpoints()) != NULL &&
strcmp(endpoints, "none") != 0) {
@@ -158,7 +158,7 @@ void TcrConnectionManager::close() {
}
CacheAttributesPtr cacheAttributes = m_cache->getAttributes();
- if (cacheAttributes != NULLPTR &&
+ if (cacheAttributes != nullptr &&
(cacheAttributes->getRedundancyLevel() > 0 || m_isDurable)) {
if (m_servermonitorTaskId > 0) {
CacheImpl::expiryTaskManager->cancelTask(m_servermonitorTaskId);
[43/46] geode-native git commit: GEODE-2741: Fix casting issues
between generics.
Posted by jb...@apache.org.
GEODE-2741: Fix casting issues between generics.
Project: http://git-wip-us.apache.org/repos/asf/geode-native/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode-native/commit/c6fdafe5
Tree: http://git-wip-us.apache.org/repos/asf/geode-native/tree/c6fdafe5
Diff: http://git-wip-us.apache.org/repos/asf/geode-native/diff/c6fdafe5
Branch: refs/heads/develop
Commit: c6fdafe5793afd057e95b5fbb3d07b88665d1043
Parents: 9a06e16
Author: Jacob Barrett <jb...@pivotal.io>
Authored: Tue May 16 20:29:56 2017 +0000
Committer: Jacob Barrett <jb...@pivotal.io>
Committed: Tue May 16 20:29:56 2017 +0000
----------------------------------------------------------------------
src/clicache/src/Properties.cpp | 2 +-
src/clicache/src/impl/CacheListener.hpp | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c6fdafe5/src/clicache/src/Properties.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/Properties.cpp b/src/clicache/src/Properties.cpp
index 53a86ee..b499369 100644
--- a/src/clicache/src/Properties.cpp
+++ b/src/clicache/src/Properties.cpp
@@ -79,7 +79,7 @@ namespace Apache
void Properties<TPropKey, TPropValue>::Insert( TPropKey key, TPropValue value )
{
native::CacheableKeyPtr keyptr = Serializable::GetUnmanagedValueGeneric<TPropKey>(key, true);
- auto valueptr = Serializable::GetUnmanagedValueGeneric<TPropValue>(value, true);
+ native::CacheablePtr valueptr = Serializable::GetUnmanagedValueGeneric<TPropValue>(value, true);
_GF_MG_EXCEPTION_TRY2
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c6fdafe5/src/clicache/src/impl/CacheListener.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/CacheListener.hpp b/src/clicache/src/impl/CacheListener.hpp
index d06a34c..a40a705 100644
--- a/src/clicache/src/impl/CacheListener.hpp
+++ b/src/clicache/src/impl/CacheListener.hpp
@@ -97,12 +97,14 @@ namespace Apache
virtual void AfterRegionDisconnected(Apache::Geode::Client::IRegion<Object^, Object^>^ region) override
{
- m_listener->AfterRegionDisconnected((IRegion<TKey, TValue>^) region);
+ auto gregion = Region<TKey, TValue>::Create(((Region<Object^, Object^>^)region)->GetNative());
+ m_listener->AfterRegionDisconnected(gregion);
}
virtual void Close(Apache::Geode::Client::IRegion<Object^, Object^>^ region) override
{
- m_listener->Close((IRegion<TKey, TValue>^) region);
+ auto gregion = Region<TKey, TValue>::Create(((Region<Object^, Object^>^)region)->GetNative());
+ m_listener->Close(gregion);
}
};
} // namespace Client
[24/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from cppcache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientHelper.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientHelper.hpp b/src/cppcache/integration-test/ThinClientHelper.hpp
index 49c9fc8..ec9ba2b 100644
--- a/src/cppcache/integration-test/ThinClientHelper.hpp
+++ b/src/cppcache/integration-test/ThinClientHelper.hpp
@@ -48,13 +48,13 @@ using namespace unitTests;
CacheHelper* cacheHelper = NULL;
void initGridClient(const bool isthinClient,
- const PropertiesPtr& configPtr = NULLPTR) {
+ const PropertiesPtr& configPtr = nullptr) {
static bool s_isGridClient = true;
s_isGridClient = !s_isGridClient;
if (cacheHelper == NULL) {
PropertiesPtr config = configPtr;
- if (config == NULLPTR) {
+ if (config == nullptr) {
config = Properties::create();
}
config->insert("grid-client", s_isGridClient ? "true" : "false");
@@ -64,7 +64,7 @@ void initGridClient(const bool isthinClient,
}
void initClient(const bool isthinClient,
- const PropertiesPtr& configPtr = NULLPTR) {
+ const PropertiesPtr& configPtr = nullptr) {
if (cacheHelper == NULL) {
cacheHelper = new CacheHelper(isthinClient, configPtr);
}
@@ -73,7 +73,7 @@ void initClient(const bool isthinClient,
void initClientWithPool(const bool isthinClient, const char* poolName,
const char* locators, const char* serverGroup,
- const PropertiesPtr& configPtr = NULLPTR,
+ const PropertiesPtr& configPtr = nullptr,
int redundancy = 0, bool clientNotification = false,
int subscriptionAckInterval = -1, int connections = -1,
int loadConditioningInterval = -1,
@@ -88,10 +88,10 @@ void initClientWithPool(const bool isthinClient, const char* poolName,
}
/* For HA Clients */
-void initClient(int redundancyLevel, const PropertiesPtr& configPtr = NULLPTR) {
+void initClient(int redundancyLevel, const PropertiesPtr& configPtr = nullptr) {
if (cacheHelper == NULL) {
PropertiesPtr config = configPtr;
- if (config == NULLPTR) {
+ if (config == nullptr) {
config = Properties::create();
}
cacheHelper = new CacheHelper(redundancyLevel, config);
@@ -100,13 +100,13 @@ void initClient(int redundancyLevel, const PropertiesPtr& configPtr = NULLPTR) {
}
void initGridClient(int redundancyLevel,
- const PropertiesPtr& configPtr = NULLPTR) {
+ const PropertiesPtr& configPtr = nullptr) {
static bool s_isGridClient = true;
s_isGridClient = !s_isGridClient;
if (cacheHelper == NULL) {
PropertiesPtr config = configPtr;
- if (config == NULLPTR) {
+ if (config == nullptr) {
config = Properties::create();
}
config->insert("grid-client", s_isGridClient ? "true" : "false");
@@ -178,7 +178,7 @@ void _verifyEntry(const char* name, const char* key, const char* val,
free(buf);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
CacheableKeyPtr keyPtr = createKey(key);
@@ -215,10 +215,10 @@ void _verifyEntry(const char* name, const char* key, const char* val,
}
if (val != NULL) {
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
+ auto checkPtr =
+ std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
- ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null.");
+ ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
sprintf(buf, "In verify loop, get returned %s for key %s",
checkPtr->asChar(), key);
@@ -285,7 +285,7 @@ void _verifyIntEntry(const char* name, const char* key, const int val,
}
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
CacheableKeyPtr keyPtr = createKey(key);
@@ -335,10 +335,10 @@ void _verifyIntEntry(const char* name, const char* key, const int val,
}
if (val != 0) {
- CacheableInt32Ptr checkPtr =
- dynCast<CacheableInt32Ptr>(regPtr->get(keyPtr));
+ auto checkPtr =
+ std::dynamic_pointer_cast<CacheableInt32>(regPtr->get(keyPtr));
- ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null.");
+ ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
sprintf(buf, "In verify loop, get returned %d for key %s",
checkPtr->value(), key);
@@ -368,7 +368,7 @@ void _verifyIntEntry(const char* name, const char* key, const int val,
void createRegion(const char* name, bool ackMode,
bool clientNotificationEnabled = false,
- const CacheListenerPtr& listener = NULLPTR,
+ const CacheListenerPtr& listener = nullptr,
bool caching = true) {
LOG("createRegion() entered.");
fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
@@ -376,7 +376,7 @@ void createRegion(const char* name, bool ackMode,
// ack, caching
RegionPtr regPtr = getHelper()->createRegion(name, ackMode, caching, listener,
clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
RegionPtr createOverflowRegion(const char* name, bool ackMode, int lel = 0,
@@ -400,7 +400,7 @@ RegionPtr createOverflowRegion(const char* name, bool ackMode, int lel = 0,
RegionAttributesPtr rattrsPtr = af.createRegionAttributes();
CachePtr cache = getHelper()->cachePtr;
- CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cache.ptr());
+ CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cache.get());
RegionPtr regionPtr;
cacheImpl->createRegion(name, rattrsPtr, regionPtr);
return regionPtr;
@@ -409,7 +409,7 @@ RegionPtr createOverflowRegion(const char* name, bool ackMode, int lel = 0,
RegionPtr createPooledRegion(const char* name, bool ackMode,
const char* locators, const char* poolname,
bool clientNotificationEnabled = false,
- const CacheListenerPtr& listener = NULLPTR,
+ const CacheListenerPtr& listener = nullptr,
bool caching = true) {
LOG("createPooledRegion() entered.");
fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
@@ -424,7 +424,7 @@ RegionPtr createPooledRegion(const char* name, bool ackMode,
name, ackMode, locators, poolname, caching, clientNotificationEnabled, 0,
0, 0, 0, 0, listener);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
return regPtr;
}
@@ -432,7 +432,7 @@ RegionPtr createPooledRegion(const char* name, bool ackMode,
PoolPtr findPool(const char* poolName) {
LOG("findPool() entered.");
PoolPtr poolPtr = PoolManager::find(poolName);
- ASSERT(poolPtr != NULLPTR, "Failed to find pool.");
+ ASSERT(poolPtr != nullptr, "Failed to find pool.");
return poolPtr;
}
PoolPtr createPool(const char* poolName, const char* locators,
@@ -445,7 +445,7 @@ PoolPtr createPool(const char* poolName, const char* locators,
PoolPtr poolPtr = getHelper()->createPool(
poolName, locators, serverGroup, redundancy, clientNotification,
subscriptionAckInterval, connections, loadConditioningInterval);
- ASSERT(poolPtr != NULLPTR, "Failed to create pool.");
+ ASSERT(poolPtr != nullptr, "Failed to create pool.");
LOG("Pool created.");
return poolPtr;
}
@@ -460,7 +460,7 @@ PoolPtr createPoolAndDestroy(const char* poolName, const char* locators,
PoolPtr poolPtr = getHelper()->createPool(
poolName, locators, serverGroup, redundancy, clientNotification,
subscriptionAckInterval, connections);
- ASSERT(poolPtr != NULLPTR, "Failed to create pool.");
+ ASSERT(poolPtr != nullptr, "Failed to create pool.");
poolPtr->destroy();
LOG("Pool created and destroyed.");
return poolPtr;
@@ -473,7 +473,7 @@ PoolPtr createPool2(const char* poolName, const char* locators,
PoolPtr poolPtr = getHelper()->createPool2(
poolName, locators, serverGroup, servers, redundancy, clientNotification);
- ASSERT(poolPtr != NULLPTR, "Failed to create pool.");
+ ASSERT(poolPtr != nullptr, "Failed to create pool.");
LOG("Pool created.");
return poolPtr;
}
@@ -485,7 +485,7 @@ RegionPtr createRegionAndAttachPool(
LOG("createRegionAndAttachPool() entered.");
RegionPtr regPtr = getHelper()->createRegionAndAttachPool(
name, ack, poolName, caching, ettl, eit, rttl, rit, lel, action);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
return regPtr;
}
@@ -500,7 +500,7 @@ void createEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
@@ -526,7 +526,7 @@ void updateEntry(const char* name, const char* key, const char* value,
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
if (checkKey) {
ASSERT(regPtr->containsKey(keyPtr),
@@ -558,7 +558,7 @@ void doNetsearch(const char* name, const char* key, const char* value,
RegionPtr regPtr = getHelper()->getRegion(name);
fprintf(stdout, "netsearch region %s\n", regPtr->getName());
fflush(stdout);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
// ASSERT( !regPtr->containsKey( keyPtr ), "Key should not have been found in
// region." );
@@ -567,10 +567,10 @@ void doNetsearch(const char* name, const char* key, const char* value,
"Value should not have been found in region.");
}
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); // force a netsearch
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(
+ regPtr->get(keyPtr)); // force a netsearch
- if (checkPtr != NULLPTR) {
+ if (checkPtr != nullptr) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
@@ -595,7 +595,7 @@ void createIntEntry(const char* name, const char* key, const int value,
CacheableInt32Ptr valPtr = CacheableInt32::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
if (onlyCreate) {
ASSERT(!regPtr->containsKey(keyPtr),
@@ -619,7 +619,7 @@ void invalidateEntry(const char* name, const char* key) {
CacheableKeyPtr keyPtr = CacheableKey::create(key);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
ASSERT(regPtr->containsValueForKey(keyPtr),
@@ -640,7 +640,7 @@ void destroyEntry(const char* name, const char* key) {
CacheableKeyPtr keyPtr = CacheableKey::create(key);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
@@ -663,7 +663,7 @@ class RegionOperations {
RegionOperations(const char* name)
: m_regionPtr(getHelper()->getRegion(name)) {}
- void putOp(int keys = 1, const UserDataPtr& aCallbackArgument = NULLPTR) {
+ void putOp(int keys = 1, const UserDataPtr& aCallbackArgument = nullptr) {
char keybuf[100];
char valbuf[100];
for (int i = 1; i <= keys; i++) {
@@ -674,7 +674,7 @@ class RegionOperations {
}
}
void invalidateOp(int keys = 1,
- const UserDataPtr& aCallbackArgument = NULLPTR) {
+ const UserDataPtr& aCallbackArgument = nullptr) {
char keybuf[100];
char valbuf[100];
for (int i = 1; i <= keys; i++) {
@@ -683,7 +683,7 @@ class RegionOperations {
m_regionPtr->localInvalidate(keybuf, aCallbackArgument);
}
}
- void destroyOp(int keys = 1, const UserDataPtr& aCallbackArgument = NULLPTR) {
+ void destroyOp(int keys = 1, const UserDataPtr& aCallbackArgument = nullptr) {
char keybuf[100];
char valbuf[100];
for (int i = 1; i <= keys; i++) {
@@ -692,7 +692,7 @@ class RegionOperations {
m_regionPtr->destroy(keybuf, aCallbackArgument);
}
}
- void removeOp(int keys = 1, const UserDataPtr& aCallbackArgument = NULLPTR) {
+ void removeOp(int keys = 1, const UserDataPtr& aCallbackArgument = nullptr) {
char keybuf[100];
char valbuf[100];
for (int i = 1; i <= keys; i++) {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientInterest1.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientInterest1.hpp b/src/cppcache/integration-test/ThinClientInterest1.hpp
index 5d01278..0185704 100644
--- a/src/cppcache/integration-test/ThinClientInterest1.hpp
+++ b/src/cppcache/integration-test/ThinClientInterest1.hpp
@@ -69,7 +69,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, setupClient2_Pool_Locator)
createPooledRegion(regionNames[0], false /*ack mode*/, locatorsG,
"__TEST_POOL1__", true /*client notification*/);
RegionPtr regPtr = getHelper()->getRegion(regionNames[0]);
- regPtr->registerAllKeys(false, NULLPTR, true);
+ regPtr->registerAllKeys(false, nullptr, true);
SLEEP(200);
}
END_TASK_DEFINITION
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientInterest3.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientInterest3.hpp b/src/cppcache/integration-test/ThinClientInterest3.hpp
index cd42325..3eb0c0f 100644
--- a/src/cppcache/integration-test/ThinClientInterest3.hpp
+++ b/src/cppcache/integration-test/ThinClientInterest3.hpp
@@ -96,8 +96,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, SetupClient1_Pool_Locator)
initClient(true);
createPooledRegion(regionNames[0], false /*ack mode*/, locatorsG,
"__TEST_POOL1__", true /*client notification*/);
- reg1Listener1 = new TallyListener();
- reg1Writer1 = new TallyWriter();
+ reg1Listener1 = std::make_shared<TallyListener>();
+ reg1Writer1 = std::make_shared<TallyWriter>();
setCacheListener(regionNames[0], reg1Listener1);
setCacheWriter(regionNames[0], reg1Writer1);
}
@@ -111,7 +111,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, testCreatesAndUpdates)
VectorOfCacheableKey keys;
keys.push_back(keyPtr1);
keys.push_back(keyPtr2);
- regPtr->registerKeys(keys, NULLPTR);
+ regPtr->registerKeys(keys);
// Do a create followed by a create on the same key
/*NIL: Changed the asserion due to the change in invalidate.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientInterest3Cacheless.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientInterest3Cacheless.hpp b/src/cppcache/integration-test/ThinClientInterest3Cacheless.hpp
index 0461fc8..3943e3a 100644
--- a/src/cppcache/integration-test/ThinClientInterest3Cacheless.hpp
+++ b/src/cppcache/integration-test/ThinClientInterest3Cacheless.hpp
@@ -96,9 +96,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, SetupClient1_Pool_Locator)
initClient(true);
createPooledRegion(regionNames[0], false /*ack mode*/, locatorsG,
"__TEST_POOL1__", true /*client notification*/,
- NULLPTR /*cachelistener*/, false /*caching*/);
- reg1Listener1 = new TallyListener();
- reg1Writer1 = new TallyWriter();
+ nullptr /*cachelistener*/, false /*caching*/);
+ reg1Listener1 = std::make_shared<TallyListener>();
+ reg1Writer1 = std::make_shared<TallyWriter>();
setCacheListener(regionNames[0], reg1Listener1);
setCacheWriter(regionNames[0], reg1Writer1);
}
@@ -112,7 +112,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, testCreatesAndUpdates)
VectorOfCacheableKey keys;
keys.push_back(keyPtr1);
keys.push_back(keyPtr2);
- regPtr->registerKeys(keys, NULLPTR);
+ regPtr->registerKeys(keys);
regPtr->create(keyPtr1, vals[1]);
numCreates++;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientInterestList.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientInterestList.hpp b/src/cppcache/integration-test/ThinClientInterestList.hpp
index 468e43a..1f09290 100644
--- a/src/cppcache/integration-test/ThinClientInterestList.hpp
+++ b/src/cppcache/integration-test/ThinClientInterestList.hpp
@@ -85,7 +85,7 @@ void _verifyEntry(const char* name, const char* key, const char* val,
free(buf);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
CacheableKeyPtr keyPtr = createKey(key);
@@ -134,10 +134,9 @@ void _verifyEntry(const char* name, const char* key, const char* val,
}
if (val != NULL) {
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
- ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null.");
+ ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
sprintf(buf, "In verify loop, get returned %s for key %s",
checkPtr->asChar(), key);
@@ -205,7 +204,7 @@ void createPooledRegion(const char* name, bool ackMode, const char* locatorsG,
RegionPtr regPtr =
getHelper()->createPooledRegion(name, ackMode, locatorsG, poolname,
cachingEnable, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
void createEntry(const char* name, const char* key, const char* value = NULL) {
@@ -221,7 +220,7 @@ void createEntry(const char* name, const char* key, const char* value = NULL) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
@@ -246,7 +245,7 @@ void updateEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
ASSERT(regPtr->containsValueForKey(keyPtr),
@@ -272,17 +271,16 @@ void doNetsearch(const char* name, const char* key, const char* value) {
RegionPtr regPtr = getHelper()->getRegion(name);
fprintf(stdout, "netsearch region %s\n", regPtr->getName());
fflush(stdout);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
ASSERT(!regPtr->containsValueForKey(keyPtr),
"Value should not have been found in region.");
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); // force a netsearch
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr)); // force a netsearch
- if (checkPtr != NULLPTR) {
+ if (checkPtr != nullptr) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
@@ -339,8 +337,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
VectorOfCacheableKey keys0, keys1;
keys0.push_back(keyPtr1);
keys1.push_back(keyPtr3);
- regPtr0->registerKeys(keys0, NULLPTR);
- regPtr1->registerKeys(keys1, NULLPTR);
+ regPtr0->registerKeys(keys0);
+ regPtr1->registerKeys(keys1);
// createEntry( regionNames[0], keys[1] );
// createEntry( regionNames[1], keys[3] );
@@ -359,7 +357,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepFour)
RegionPtr regPtr0 = getHelper()->getRegion(regionNames[0]);
VectorOfCacheableKey keys0;
keys0.push_back(keyPtr0);
- regPtr0->registerKeys(keys0, NULLPTR);
+ regPtr0->registerKeys(keys0);
LOG("StepFour complete.");
}
END_TASK_DEFINITION
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientInterestList2.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientInterestList2.hpp b/src/cppcache/integration-test/ThinClientInterestList2.hpp
index 1cdd14c..23e8d08 100644
--- a/src/cppcache/integration-test/ThinClientInterestList2.hpp
+++ b/src/cppcache/integration-test/ThinClientInterestList2.hpp
@@ -85,7 +85,7 @@ void _verifyEntry(const char* name, const char* key, const char* val,
free(buf);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
CacheableKeyPtr keyPtr = createKey(key);
@@ -134,10 +134,9 @@ void _verifyEntry(const char* name, const char* key, const char* val,
}
if (val != NULL) {
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
- ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null.");
+ ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
sprintf(buf, "In verify loop, get returned %s for key %s",
checkPtr->asChar(), key);
@@ -205,7 +204,7 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators,
RegionPtr regPtr =
getHelper()->createPooledRegion(name, ackMode, locatorsG, poolname,
cachingEnable, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
void createEntry(const char* name, const char* key, const char* value = NULL) {
@@ -221,7 +220,7 @@ void createEntry(const char* name, const char* key, const char* value = NULL) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
@@ -246,7 +245,7 @@ void updateEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
// ASSERT( regPtr->containsValueForKey( keyPtr ), "Value should have been
@@ -272,17 +271,16 @@ void doNetsearch(const char* name, const char* key, const char* value) {
RegionPtr regPtr = getHelper()->getRegion(name);
fprintf(stdout, "netsearch region %s\n", regPtr->getName());
fflush(stdout);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
ASSERT(!regPtr->containsValueForKey(keyPtr),
"Value should not have been found in region.");
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); // force a netsearch
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr)); // force a netsearch
- if (checkPtr != NULLPTR) {
+ if (checkPtr != nullptr) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientListenerInit.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientListenerInit.hpp b/src/cppcache/integration-test/ThinClientListenerInit.hpp
index 07ea409..340206a 100644
--- a/src/cppcache/integration-test/ThinClientListenerInit.hpp
+++ b/src/cppcache/integration-test/ThinClientListenerInit.hpp
@@ -56,13 +56,13 @@ class ThinClientTallyLoader : public TallyLoader {
CacheablePtr load(const RegionPtr& rp, const CacheableKeyPtr& key,
const UserDataPtr& aCallbackArgument) {
- int32_t loadValue = dynCast<CacheableInt32Ptr>(
+ int32_t loadValue = std::dynamic_pointer_cast<CacheableInt32>(
TallyLoader::load(rp, key, aCallbackArgument))
->value();
char lstrvalue[32];
sprintf(lstrvalue, "%i", loadValue);
CacheableStringPtr lreturnValue = CacheableString::create(lstrvalue);
- if (key != NULLPTR && (NULL != rp->getAttributes()->getEndpoints() ||
+ if (key != nullptr && (NULL != rp->getAttributes()->getEndpoints() ||
rp->getAttributes()->getPoolName() != NULL)) {
LOGDEBUG("Putting the value (%s) for local region clients only ",
lstrvalue);
@@ -122,11 +122,11 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, SetupClient_Pooled_Locator)
{
initClient(true);
- reg1Listener1 = new TallyListener();
+ reg1Listener1 = std::make_shared<TallyListener>();
createPooledRegion(regionNames[0], false, locatorsG, poolName, true,
reg1Listener1);
- reg1Loader1 = new ThinClientTallyLoader();
- reg1Writer1 = new TallyWriter();
+ reg1Loader1 = std::make_shared<ThinClientTallyLoader>();
+ reg1Writer1 = std::make_shared<TallyWriter>();
setCacheLoader(regionNames[0], reg1Loader1);
setCacheWriter(regionNames[0], reg1Writer1);
}
@@ -138,7 +138,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, testLoaderAndWriter)
CacheableKeyPtr keyPtr = CacheableKey::create(keys[0]);
VectorOfCacheableKey keys;
keys.push_back(keyPtr);
- regPtr->registerKeys(keys, NULLPTR);
+ regPtr->registerKeys(keys);
/*NIL: Changed the asserion due to the change in invalidate.
Now we create new entery for every invalidate event received or
@@ -146,7 +146,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, testLoaderAndWriter)
so expect containsKey to returns true insted of false earlier. */
ASSERT(regPtr->containsKey(keyPtr), "Key should found in region.");
// now having all the Callbacks set, lets call the loader and writer
- ASSERT(regPtr->get(keyPtr) != NULLPTR, "Expected non null value");
+ ASSERT(regPtr->get(keyPtr) != nullptr, "Expected non null value");
RegionEntryPtr regEntryPtr = regPtr->getEntry(keyPtr);
CacheablePtr valuePtr = regEntryPtr->getValue();
@@ -168,7 +168,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, testCreatesAndUpdates)
VectorOfCacheableKey keys;
keys.push_back(keyPtr1);
keys.push_back(keyPtr2);
- regPtr->registerKeys(keys, NULLPTR);
+ regPtr->registerKeys(keys);
// Do a create followed by a create on the same key
/*NIL: Changed the asserion due to the change in invalidate.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientListenerWriter.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientListenerWriter.hpp b/src/cppcache/integration-test/ThinClientListenerWriter.hpp
index d0fbde4..b150c9f 100644
--- a/src/cppcache/integration-test/ThinClientListenerWriter.hpp
+++ b/src/cppcache/integration-test/ThinClientListenerWriter.hpp
@@ -96,7 +96,7 @@ void SimpleCacheListener::afterRegionDestroy(const RegionEvent& event) {
void SimpleCacheListener::close(const RegionPtr& region) {
LOGINFO("SimpleCacheListener: Got an close event for %s region .",
- region.ptr()->getName());
+ region.get()->getName());
}
void SimpleCacheListener::afterRegionClear(const RegionEvent& event) {
@@ -193,7 +193,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, SetupClient1_Pooled_Locator)
initClient(true);
LOG("Creating region in CLIENT1, no-ack, no-cache, no-listener");
createPooledRegion(regionNames[0], false, locatorsG, poolName, true,
- NULLPTR, false);
+ nullptr, false);
}
END_TASK_DEFINITION
@@ -201,11 +201,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, SetupClient1withCachingEnabled_Pooled_Locator)
{
initClient(true);
LOG("Creating region in CLIENT1, no-ack, no-cache, no-listener");
- createPooledRegion(myRegNames[0], false, locatorsG, poolName, true, NULLPTR,
+ createPooledRegion(myRegNames[0], false, locatorsG, poolName, true, nullptr,
true);
- createPooledRegion(myRegNames[1], false, locatorsG, poolName, true, NULLPTR,
+ createPooledRegion(myRegNames[1], false, locatorsG, poolName, true, nullptr,
true);
- createPooledRegion(myRegNames[2], false, locatorsG, poolName, true, NULLPTR,
+ createPooledRegion(myRegNames[2], false, locatorsG, poolName, true, nullptr,
true);
// create subregion
@@ -249,14 +249,14 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT2, Register2WithFalse)
{
RegionPtr regPtr0 = getHelper()->getRegion(regionNames[0]);
- regPtr0->registerAllKeys(false, NULLPTR, false, false);
+ regPtr0->registerAllKeys(false, nullptr, false, false);
}
END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT3, Register3WithFalse)
{
RegionPtr regPtr0 = getHelper()->getRegion(regionNames[0]);
- regPtr0->registerAllKeys(false, NULLPTR, false, false);
+ regPtr0->registerAllKeys(false, nullptr, false, false);
}
END_TASK_DEFINITION
@@ -265,10 +265,10 @@ DUNIT_TASK_DEFINITION(CLIENT2, SetupClient2_Pooled_Locator)
initClient(true);
LOG("Creating region in CLIENT2 , no-ack, no-cache, with-listener and "
"writer");
- regListener = new TallyListener();
+ regListener = std::make_shared<TallyListener>();
createPooledRegion(regionNames[0], false, locatorsG, poolName, true,
regListener, false);
- regWriter = new TallyWriter();
+ regWriter = std::make_shared<TallyWriter>();
setCacheWriter(regionNames[0], regWriter);
RegionPtr regPtr0 = getHelper()->getRegion(regionNames[0]);
// regPtr0->registerAllKeys();
@@ -281,8 +281,8 @@ DUNIT_TASK_DEFINITION(CLIENT2, SetupClient2withCachingEnabled_Pooled_Locator)
initClient(true);
LOG("Creating region in CLIENT2 , no-ack, no-cache, with-listener and "
"writer");
- parentRegCacheListener = new SimpleCacheListener();
- distRegCacheListener = new SimpleCacheListener();
+ parentRegCacheListener = std::make_shared<SimpleCacheListener>();
+ distRegCacheListener = std::make_shared<SimpleCacheListener>();
createPooledRegion(myRegNames[0], false, locatorsG, poolName, true,
distRegCacheListener, true);
@@ -291,7 +291,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, SetupClient2withCachingEnabled_Pooled_Locator)
createPooledRegion(myRegNames[2], false, locatorsG, poolName, true,
parentRegCacheListener, true);
- regWriter = new TallyWriter();
+ regWriter = std::make_shared<TallyWriter>();
setCacheWriter(myRegNames[2], regWriter);
// create subregion
@@ -311,7 +311,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, SetupClient2withCachingEnabled_Pooled_Locator)
AttributesMutatorPtr subregAttrMutatorPtr =
subregPtr1->getAttributesMutator();
- subRegCacheListener = new SimpleCacheListener();
+ subRegCacheListener = std::make_shared<SimpleCacheListener>();
subregAttrMutatorPtr->setCacheListener(subRegCacheListener);
LOG("StepTwo_Pool complete.");
@@ -324,10 +324,10 @@ DUNIT_TASK_DEFINITION(CLIENT3, SetupClient3_Pooled_Locator)
initClient(true);
LOG("Creating region in CLIENT2 , no-ack, no-cache, with-listener and "
"writer");
- regListener = new TallyListener();
+ regListener = std::make_shared<TallyListener>();
createPooledRegion(regionNames[0], false, locatorsG, poolName, true,
regListener, false);
- regWriter = new TallyWriter();
+ regWriter = std::make_shared<TallyWriter>();
setCacheWriter(regionNames[0], regWriter);
}
END_TASK_DEFINITION
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientLocalCacheLoader.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientLocalCacheLoader.hpp b/src/cppcache/integration-test/ThinClientLocalCacheLoader.hpp
index aaa3b93..bb03832 100644
--- a/src/cppcache/integration-test/ThinClientLocalCacheLoader.hpp
+++ b/src/cppcache/integration-test/ThinClientLocalCacheLoader.hpp
@@ -45,13 +45,13 @@ class ThinClientTallyLoader : public TallyLoader {
CacheablePtr load(const RegionPtr& rp, const CacheableKeyPtr& key,
const UserDataPtr& aCallbackArgument) {
- int32_t loadValue = dynCast<CacheableInt32Ptr>(
+ int32_t loadValue = std::dynamic_pointer_cast<CacheableInt32>(
TallyLoader::load(rp, key, aCallbackArgument))
->value();
char lstrvalue[32];
sprintf(lstrvalue, "%i", loadValue);
CacheableStringPtr lreturnValue = CacheableString::create(lstrvalue);
- if (key != NULLPTR && (NULL != rp->getAttributes()->getEndpoints() ||
+ if (key != nullptr && (NULL != rp->getAttributes()->getEndpoints() ||
rp->getAttributes()->getPoolName() != NULL)) {
LOGDEBUG("Putting the value (%s) for local region clients only ",
lstrvalue);
@@ -62,21 +62,21 @@ class ThinClientTallyLoader : public TallyLoader {
void close(const RegionPtr& region) {
LOG(" ThinClientTallyLoader::close() called");
- if (region != NULLPTR) {
+ if (region != nullptr) {
LOGINFO(" Region %s is Destroyed = %d ", region->getName(),
region->isDestroyed());
ASSERT(region->isDestroyed() == true,
"region.isDestroyed should return true");
/*
- if(region.ptr() != NULL && region.ptr()->getCache() != NULLPTR){
+ if(region.get() != NULL && region.get()->getCache() != nullptr){
LOGINFO(" Cache Name is Closed = %d ",
- region.ptr()->getCache()->isClosed());
+ region.get()->getCache()->isClosed());
}else{
- LOGINFO(" regionPtr or cachePtr is NULLPTR");
+ LOGINFO(" regionPtr or cachePtr is nullptr");
}
*/
} else {
- LOGINFO(" region is NULLPTR");
+ LOGINFO(" region is nullptr");
}
}
};
@@ -114,7 +114,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, SetupClient)
// Plugin the ThinClientTallyLoader to the Region.
AttributesMutatorPtr attrMutatorPtr = regionPtr->getAttributesMutator();
- reg1Loader1 = new ThinClientTallyLoader();
+ reg1Loader1 = std::make_shared<ThinClientTallyLoader>();
attrMutatorPtr->setCacheLoader(reg1Loader1);
}
END_TASK_DEFINITION
@@ -122,9 +122,9 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, InitClientEvents)
{
numLoads = 0;
- regionPtr = NULLPTR;
- dSysPtr = NULLPTR;
- cachePtr = NULLPTR;
+ regionPtr = nullptr;
+ dSysPtr = nullptr;
+ cachePtr = nullptr;
}
END_TASK_DEFINITION
@@ -135,7 +135,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, testLoader)
ASSERT(!regionPtr->containsKey(keyPtr),
"Key should not have been found in region.");
// now having the Callbacks set, lets call the loader
- ASSERT(regionPtr->get(keyPtr) != NULLPTR, "Expected non null value");
+ ASSERT(regionPtr->get(keyPtr) != nullptr, "Expected non null value");
RegionEntryPtr regEntryPtr = regionPtr->getEntry(keyPtr);
CacheablePtr valuePtr = regEntryPtr->getValue();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientNotification.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientNotification.hpp b/src/cppcache/integration-test/ThinClientNotification.hpp
index 1094697..3b35bc1 100644
--- a/src/cppcache/integration-test/ThinClientNotification.hpp
+++ b/src/cppcache/integration-test/ThinClientNotification.hpp
@@ -45,7 +45,7 @@ CacheHelper* cacheHelper = NULL;
void initClient(const bool isthinClient) {
if (cacheHelper == NULL) {
cacheHelper = new CacheHelper(isthinClient, "__TEST_POOL1__", locatorsG,
- "ServerGroup1", NULLPTR, 0, true);
+ "ServerGroup1", nullptr, 0, true);
}
ASSERT(cacheHelper, "Failed to create a CacheHelper client instance.");
}
@@ -81,7 +81,7 @@ void _verifyEntry(const char* name, const char* key, const char* val,
free(buf);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
CacheableKeyPtr keyPtr = createKey(key);
@@ -118,10 +118,9 @@ void _verifyEntry(const char* name, const char* key, const char* val,
if (val != NULL) {
LOG(" checkin val");
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
- ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null.");
+ ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
sprintf(buf, "In verify loop, get returned %s for key %s",
checkPtr->asChar(), key);
@@ -179,7 +178,7 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators,
RegionPtr regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
@@ -193,7 +192,7 @@ void createEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
@@ -218,7 +217,7 @@ void updateEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
ASSERT(regPtr->containsValueForKey(keyPtr),
@@ -244,7 +243,7 @@ void doNetsearch(const char* name, const char* key, const char* value) {
RegionPtr regPtr = getHelper()->getRegion(name);
fprintf(stdout, "netsearch region %s\n", regPtr->getName());
fflush(stdout);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
/*NIL: Changed the asserion due to the change in invalidate.
Now we create new entery for every invalidate event received or
localInvalidate call
@@ -254,10 +253,9 @@ void doNetsearch(const char* name, const char* key, const char* value) {
"Value should not have been found in region.");
CacheablePtr theValue = regPtr->get(keyPtr);
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(theValue); // force a netsearch
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(theValue); // force a netsearch
- if (checkPtr != NULLPTR) {
+ if (checkPtr != nullptr) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
@@ -278,7 +276,7 @@ void invalidateEntry(const char* name, const char* key) {
CacheableKeyPtr keyPtr = CacheableKey::create(key);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
ASSERT(regPtr->containsValueForKey(keyPtr),
@@ -299,7 +297,7 @@ void destroyEntry(const char* name, const char* key) {
CacheableKeyPtr keyPtr = CacheableKey::create(key);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
@@ -341,9 +339,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, CreateRegions1_PoolLocators)
true);
createPooledRegion(regionNames[1], NO_ACK, locatorsG, "__TESTPOOL1_", true);
RegionPtr regPtr = getHelper()->getRegion(regionNames[0]);
- regPtr->registerAllKeys(false, NULLPTR, false, false);
+ regPtr->registerAllKeys(false, nullptr, false, false);
regPtr = getHelper()->getRegion(regionNames[1]);
- regPtr->registerAllKeys(false, NULLPTR, false, false);
+ regPtr->registerAllKeys(false, nullptr, false, false);
LOG("CreateRegions1_PoolLocators complete.");
}
END_TASK_DEFINITION
@@ -354,9 +352,9 @@ DUNIT_TASK_DEFINITION(CLIENT2, CreateRegions2_PoolLocators)
true);
createPooledRegion(regionNames[1], NO_ACK, locatorsG, "__TESTPOOL1_", true);
RegionPtr regPtr = getHelper()->getRegion(regionNames[0]);
- regPtr->registerAllKeys(false, NULLPTR, false, false);
+ regPtr->registerAllKeys(false, nullptr, false, false);
regPtr = getHelper()->getRegion(regionNames[1]);
- regPtr->registerAllKeys(false, NULLPTR, false, false);
+ regPtr->registerAllKeys(false, nullptr, false, false);
LOG("CreateRegions2_PoolLocators complete.");
}
END_TASK_DEFINITION
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientPdxSerializer.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientPdxSerializer.hpp b/src/cppcache/integration-test/ThinClientPdxSerializer.hpp
index 335a8c4..b7935ff 100644
--- a/src/cppcache/integration-test/ThinClientPdxSerializer.hpp
+++ b/src/cppcache/integration-test/ThinClientPdxSerializer.hpp
@@ -61,7 +61,7 @@ void initClient(const bool isthinClient, bool isPdxIgnoreUnreadFields) {
LOGINFO("initClient: isPdxIgnoreUnreadFields = %d ", isPdxIgnoreUnreadFields);
if (cacheHelper == NULL) {
cacheHelper = new CacheHelper(isthinClient, isPdxIgnoreUnreadFields, false,
- NULLPTR, false);
+ nullptr, false);
}
ASSERT(cacheHelper, "Failed to create a CacheHelper client instance.");
}
@@ -155,58 +155,55 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepTwoPoolLoc_PDX)
END_TASK_DEFINITION
void checkPdxInstanceToStringAtServer(RegionPtr regionPtr) {
- CacheableKeyPtr keyport = CacheableKey::create("success");
- CacheableBooleanPtr boolPtr =
- dynCast<CacheableBooleanPtr>(regionPtr->get(keyport));
+ auto keyport = CacheableKey::create("success");
+ auto boolPtr =
+ std::dynamic_pointer_cast<CacheableBoolean>(regionPtr->get(keyport));
bool val = boolPtr->value();
ASSERT(val == true, "checkPdxInstanceToStringAtServer: Val should be true");
}
DUNIT_TASK_DEFINITION(CLIENT1, JavaPutGet)
{
- Serializable::registerPdxSerializer(
- PdxSerializerPtr(new TestPdxSerializer));
+ Serializable::registerPdxSerializer(std::make_shared<TestPdxSerializer>());
- RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
+ auto regPtr0 = getHelper()->getRegion("DistRegionAck");
- CacheableKeyPtr keyport = CacheableKey::create(1);
+ auto keyport = CacheableKey::create(1);
- PdxTests::NonPdxType* npt1 = new PdxTests::NonPdxType;
- PdxWrapperPtr pdxobj(new PdxWrapper(npt1, CLASSNAME1));
+ auto npt1 = new PdxTests::NonPdxType;
+ auto pdxobj = std::make_shared<PdxWrapper>(npt1, CLASSNAME1);
regPtr0->put(keyport, pdxobj);
- PdxWrapperPtr obj2 = dynCast<PdxWrapperPtr>(regPtr0->get(keyport));
+ auto obj2 = std::dynamic_pointer_cast<PdxWrapper>(regPtr0->get(keyport));
- CacheableBooleanPtr boolPtr =
- dynCast<CacheableBooleanPtr>(regPtr0->get("success"));
- bool isEqual = boolPtr.ptr()->value();
+ auto boolPtr =
+ std::dynamic_pointer_cast<CacheableBoolean>(regPtr0->get("success"));
+ bool isEqual = boolPtr.get()->value();
ASSERT(isEqual == true,
"Task JavaPutGet:Objects of type NonPdxType should be equal");
- PdxTests::NonPdxType* npt2 =
- reinterpret_cast<PdxTests::NonPdxType*>(obj2->getObject());
+ auto npt2 = reinterpret_cast<PdxTests::NonPdxType*>(obj2->getObject());
ASSERT(npt1->equals(*npt2, false), "NonPdxType compare");
}
END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT2, JavaGet)
{
- Serializable::registerPdxSerializer(
- PdxSerializerPtr(new TestPdxSerializer));
+ Serializable::registerPdxSerializer(std::make_shared<TestPdxSerializer>());
LOGDEBUG("JavaGet-1 Line_309");
- RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
+ auto regPtr0 = getHelper()->getRegion("DistRegionAck");
- CacheableKeyPtr keyport1 = CacheableKey::create(1);
+ auto keyport1 = CacheableKey::create(1);
LOGDEBUG("JavaGet-2 Line_314");
- PdxWrapperPtr obj1 = dynCast<PdxWrapperPtr>(regPtr0->get(keyport1));
- PdxTests::NonPdxType* npt1 ATTR_UNUSED =
+ auto obj1 = std::dynamic_pointer_cast<PdxWrapper>(regPtr0->get(keyport1));
+ auto npt1 ATTR_UNUSED =
reinterpret_cast<PdxTests::NonPdxType*>(obj1->getObject());
LOGDEBUG("JavaGet-3 Line_316");
- CacheableKeyPtr keyport2 = CacheableKey::create("putFromjava");
+ auto keyport2 = CacheableKey::create("putFromjava");
LOGDEBUG("JavaGet-4 Line_316");
- PdxWrapperPtr obj2 = dynCast<PdxWrapperPtr>(regPtr0->get(keyport2));
- PdxTests::NonPdxType* npt2 ATTR_UNUSED =
+ auto obj2 = std::dynamic_pointer_cast<PdxWrapper>(regPtr0->get(keyport2));
+ auto npt2 ATTR_UNUSED =
reinterpret_cast<PdxTests::NonPdxType*>(obj2->getObject());
LOGDEBUG("JavaGet-5 Line_320");
}
@@ -214,24 +211,25 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, putFromVersion1_PS)
{
- RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
- CacheableKeyPtr key = CacheableKey::create(1);
+ auto regPtr0 = getHelper()->getRegion("DistRegionAck");
+ auto key = CacheableKey::create(1);
- PdxTests::TestDiffTypePdxSV1* npt1 =
- new PdxTests::TestDiffTypePdxSV1(false);
+ // purpose?
+ // PdxTests::TestDiffTypePdxSV2* npt1 =
+ // new PdxTests::TestDiffTypePdxSV2(false);
Serializable::registerPdxSerializer(
- PdxSerializerPtr(new TestPdxSerializerForV1));
+ std::make_shared<TestPdxSerializerForV1>());
- // Create New object and wrap it in PdxWrapper
- npt1 = new PdxTests::TestDiffTypePdxSV1(true);
- PdxWrapperPtr pdxobj(new PdxWrapper(npt1, V1CLASSNAME2));
+ // Create New object and wrap it in PdxWrapper (owner)
+ auto npt1 = new PdxTests::TestDiffTypePdxSV1(true);
+ auto pdxobj = std::make_shared<PdxWrapper>(npt1, V1CLASSNAME2);
// PUT
regPtr0->put(key, pdxobj);
// GET
- PdxWrapperPtr obj2 = dynCast<PdxWrapperPtr>(regPtr0->get(key));
- PdxTests::TestDiffTypePdxSV1* npt2 =
+ auto obj2 = std::dynamic_pointer_cast<PdxWrapper>(regPtr0->get(key));
+ auto npt2 =
reinterpret_cast<PdxTests::TestDiffTypePdxSV1*>(obj2->getObject());
// Equal check
@@ -245,24 +243,25 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT2, putFromVersion2_PS)
{
- RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
- CacheableKeyPtr key = CacheableKey::create(1);
+ auto regPtr0 = getHelper()->getRegion("DistRegionAck");
+ auto key = CacheableKey::create(1);
- PdxTests::TestDiffTypePdxSV2* npt1 =
- new PdxTests::TestDiffTypePdxSV2(false);
+ // purpose?
+ // PdxTests::TestDiffTypePdxSV2* npt1 =
+ // new PdxTests::TestDiffTypePdxSV2(false);
Serializable::registerPdxSerializer(
PdxSerializerPtr(new TestPdxSerializerForV2));
- // New object
- npt1 = new PdxTests::TestDiffTypePdxSV2(true);
- PdxWrapperPtr pdxobj(new PdxWrapper(npt1, V2CLASSNAME4));
+ // Create New object and wrap it in PdxWrapper (owner)
+ auto npt1 = new PdxTests::TestDiffTypePdxSV2(true);
+ auto pdxobj = std::make_shared<PdxWrapper>(npt1, V2CLASSNAME4);
// PUT
regPtr0->put(key, pdxobj);
// GET
- PdxWrapperPtr obj2 = dynCast<PdxWrapperPtr>(regPtr0->get(key));
- PdxTests::TestDiffTypePdxSV2* npt2 =
+ auto obj2 = std::dynamic_pointer_cast<PdxWrapper>(regPtr0->get(key));
+ auto npt2 =
reinterpret_cast<PdxTests::TestDiffTypePdxSV2*>(obj2->getObject());
// Equal check
@@ -272,23 +271,23 @@ DUNIT_TASK_DEFINITION(CLIENT2, putFromVersion2_PS)
"Task putFromVersion2_PS:Objects of type TestPdxSerializerForV2 "
"should be equal");
- CacheableKeyPtr key2 = CacheableKey::create(2);
+ auto key2 = CacheableKey::create(2);
regPtr0->put(key2, pdxobj);
}
END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, getputFromVersion1_PS)
{
- RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
- CacheableKeyPtr key = CacheableKey::create(1);
+ auto regPtr0 = getHelper()->getRegion("DistRegionAck");
+ auto key = CacheableKey::create(1);
// GET
- PdxWrapperPtr obj2 = dynCast<PdxWrapperPtr>(regPtr0->get(key));
- PdxTests::TestDiffTypePdxSV1* npt2 =
+ auto obj2 = std::dynamic_pointer_cast<PdxWrapper>(regPtr0->get(key));
+ auto npt2 =
reinterpret_cast<PdxTests::TestDiffTypePdxSV1*>(obj2->getObject());
// Create New object and Compare
- PdxTests::TestDiffTypePdxSV1* npt1 = new PdxTests::TestDiffTypePdxSV1(true);
+ auto npt1 = new PdxTests::TestDiffTypePdxSV1(true);
bool isEqual = npt1->equals(npt2);
LOGDEBUG("getputFromVersion1_PS-1 isEqual = %d", isEqual);
ASSERT(isEqual == true,
@@ -298,9 +297,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, getputFromVersion1_PS)
// PUT
regPtr0->put(key, obj2);
- CacheableKeyPtr key2 = CacheableKey::create(2);
- obj2 = dynCast<PdxWrapperPtr>(regPtr0->get(key2));
- PdxTests::TestDiffTypePdxSV1* pRet =
+ auto key2 = CacheableKey::create(2);
+ obj2 = std::dynamic_pointer_cast<PdxWrapper>(regPtr0->get(key2));
+ auto pRet =
reinterpret_cast<PdxTests::TestDiffTypePdxSV1*>(obj2->getObject());
isEqual = npt1->equals(pRet);
LOGDEBUG("getputFromVersion1_PS-2 isEqual = %d", isEqual);
@@ -309,22 +308,22 @@ DUNIT_TASK_DEFINITION(CLIENT1, getputFromVersion1_PS)
"should be equal");
// Get then Put.. this should Not merge data back
- PdxWrapperPtr pdxobj = PdxWrapperPtr(new PdxWrapper(npt1, V1CLASSNAME2));
+ auto pdxobj = std::make_shared<PdxWrapper>(npt1, V1CLASSNAME2);
regPtr0->put(key2, pdxobj);
}
END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT2, getAtVersion2_PS)
{
- RegionPtr regPtr0 = getHelper()->getRegion("DistRegionAck");
- CacheableKeyPtr key = CacheableKey::create(1);
+ auto regPtr0 = getHelper()->getRegion("DistRegionAck");
+ auto key = CacheableKey::create(1);
// New object
- PdxTests::TestDiffTypePdxSV2* np = new PdxTests::TestDiffTypePdxSV2(true);
+ auto np = new PdxTests::TestDiffTypePdxSV2(true);
// GET
- PdxWrapperPtr obj2 = dynCast<PdxWrapperPtr>(regPtr0->get(key));
- PdxTests::TestDiffTypePdxSV2* pRet =
+ auto obj2 = std::dynamic_pointer_cast<PdxWrapper>(regPtr0->get(key));
+ auto pRet =
reinterpret_cast<PdxTests::TestDiffTypePdxSV2*>(obj2->getObject());
bool isEqual = np->equals(pRet);
@@ -334,10 +333,10 @@ DUNIT_TASK_DEFINITION(CLIENT2, getAtVersion2_PS)
"Task getAtVersion2_PS:Objects of type TestPdxSerializerForV2 should "
"be equal");
- CacheableKeyPtr key2 = CacheableKey::create(2);
+ auto key2 = CacheableKey::create(2);
np = new PdxTests::TestDiffTypePdxSV2(true);
- obj2 = dynCast<PdxWrapperPtr>(regPtr0->get(key2));
+ obj2 = std::dynamic_pointer_cast<PdxWrapper>(regPtr0->get(key2));
pRet = reinterpret_cast<PdxTests::TestDiffTypePdxSV2*>(obj2->getObject());
isEqual = np->equals(pRet);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientPdxSerializers.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientPdxSerializers.hpp b/src/cppcache/integration-test/ThinClientPdxSerializers.hpp
index 834c8bf..f9ef18e 100644
--- a/src/cppcache/integration-test/ThinClientPdxSerializers.hpp
+++ b/src/cppcache/integration-test/ThinClientPdxSerializers.hpp
@@ -106,21 +106,26 @@ class TestPdxSerializer : public PdxSerializer {
npt->m_byteArray = pr->readByteArray("m_byteArray", npt->byteArrayLen);
npt->m_charArray = pr->readCharArray("m_charArray", npt->charArrayLen);
- npt->m_arraylist = pr->readObject("m_arraylist");
+ npt->m_arraylist = std::dynamic_pointer_cast<CacheableArrayList>(
+ pr->readObject("m_arraylist"));
- npt->m_map = dynCast<CacheableHashMapPtr>(pr->readObject("m_map"));
+ npt->m_map = std::dynamic_pointer_cast<CacheableHashMap>(pr->readObject("m_map"));
// TODO:Check for the size
- npt->m_hashtable = pr->readObject("m_hashtable");
+ npt->m_hashtable = std::dynamic_pointer_cast<CacheableHashTable>(
+ pr->readObject("m_hashtable"));
// TODO:Check for the size
- npt->m_vector = pr->readObject("m_vector");
+ npt->m_vector = std::dynamic_pointer_cast<CacheableVector>(
+ pr->readObject("m_vector"));
// TODO::Check for size
- npt->m_chs = pr->readObject("m_chs");
+ npt->m_chs =
+ std::dynamic_pointer_cast<CacheableHashSet>(pr->readObject("m_chs"));
// TODO::Size check
- npt->m_clhs = pr->readObject("m_clhs");
+ npt->m_clhs = std::dynamic_pointer_cast<CacheableLinkedHashSet>(
+ pr->readObject("m_clhs"));
// TODO:Size check
npt->m_string = pr->readString("m_string"); // GenericValCompare
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientPutAll.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientPutAll.hpp b/src/cppcache/integration-test/ThinClientPutAll.hpp
index 9db38ee..4fd8044 100644
--- a/src/cppcache/integration-test/ThinClientPutAll.hpp
+++ b/src/cppcache/integration-test/ThinClientPutAll.hpp
@@ -91,7 +91,7 @@ void _verifyEntry(const char* name, const char* key, const char* val,
free(buf);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
CacheableKeyPtr keyPtr = createKey(key);
@@ -140,10 +140,10 @@ void _verifyEntry(const char* name, const char* key, const char* val,
}
if (val != NULL) {
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
+ auto checkPtr =
+ std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
- ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null.");
+ ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
sprintf(buf, "In verify loop, get returned %s for key %s",
checkPtr->asChar(), key);
@@ -206,8 +206,8 @@ void createRegion(const char* name, bool ackMode, bool isCacheEnabled,
fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
fflush(stdout);
RegionPtr regPtr = getHelper()->createRegion(
- name, ackMode, isCacheEnabled, NULLPTR, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ name, ackMode, isCacheEnabled, nullptr, clientNotificationEnabled);
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
void createPooledRegion(const char* name, bool ackMode, const char* locators,
@@ -220,7 +220,7 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators,
RegionPtr regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
@@ -234,7 +234,7 @@ void createPooledRegionConcurrencyCheckDisabled(
RegionPtr regPtr = getHelper()->createPooledRegionConcurrencyCheckDisabled(
name, ackMode, locators, poolname, cachingEnable,
clientNotificationEnabled, concurrencyCheckEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
@@ -251,7 +251,7 @@ void createEntry(const char* name, const char* key, const char* value = NULL) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
@@ -276,7 +276,7 @@ void updateEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
ASSERT(regPtr->containsValueForKey(keyPtr),
@@ -302,17 +302,17 @@ void doNetsearch(const char* name, const char* key, const char* value) {
RegionPtr regPtr = getHelper()->getRegion(name);
fprintf(stdout, "netsearch region %s\n", regPtr->getName());
fflush(stdout);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
ASSERT(!regPtr->containsValueForKey(keyPtr),
"Value should not have been found in region.");
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); // force a netsearch
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(
+ regPtr->get(keyPtr)); // force a netsearch
- if (checkPtr != NULLPTR) {
+ if (checkPtr != nullptr) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
@@ -414,7 +414,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
VectorOfCacheableKey keys1;
keys1.push_back(keyPtr0);
keys1.push_back(keyPtr1);
- regPtr0->registerKeys(keys1, NULLPTR);
+ regPtr0->registerKeys(keys1);
CacheableKeyPtr keyPtr2 = CacheableKey::create(keys[2]);
CacheableKeyPtr keyPtr3 = CacheableKey::create(keys[3]);
@@ -422,7 +422,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
VectorOfCacheableKey keys2;
keys2.push_back(keyPtr2);
keys2.push_back(keyPtr3);
- regPtr1->registerKeys(keys2, NULLPTR);
+ regPtr1->registerKeys(keys2);
LOG("StepThree complete.");
}
@@ -482,9 +482,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutAllOps)
getAllkeys.push_back(CacheableKey::create(key));
}
- HashMapOfCacheablePtr valuesMap(new HashMapOfCacheable());
+ auto valuesMap = std::make_shared<HashMapOfCacheable>();
valuesMap->clear();
- regPtr0->getAll(getAllkeys, valuesMap, NULLPTR, false);
+ regPtr0->getAll(getAllkeys, valuesMap, nullptr, false);
ASSERT(valuesMap->size() == 500, "GetAll should return 2 entries.");
LOG("PutAllOps complete.");
@@ -588,11 +588,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepTen)
RegionPtr regPtr0 = getHelper()->getRegion(regionNames[0]);
RegionServicePtr rsp = regPtr0->getRegionService();
RegionPtr regPtr = rsp->getRegion(regionNames[0]);
- ASSERT(regPtr != NULLPTR, "Failed to get region.");
+ ASSERT(regPtr != nullptr, "Failed to get region.");
RegionServicePtr rsp1 = regPtr0->getRegionService();
RegionPtr regPtr1 = rsp1->getRegion("NOT_CREATED_REGION");
- ASSERT(regPtr1 == NULLPTR, "Unknown Region Returned");
+ ASSERT(regPtr1 == nullptr, "Unknown Region Returned");
LOG("StepTen complete.");
}
@@ -606,20 +606,20 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepEleven)
RegionPtr regPtr0 = getHelper()->getRegion(regionNames[0]);
regPtr0->put(keyPtr0, valPtr0);
- CacheableInt64Ptr checkPtr =
- dynCast<CacheableInt64Ptr>(regPtr0->get(keyPtr0));
- ASSERT(checkPtr != NULLPTR, "checkPtr should not be null.");
+ auto checkPtr =
+ std::dynamic_pointer_cast<CacheableInt64>(regPtr0->get(keyPtr0));
+ ASSERT(checkPtr != nullptr, "checkPtr should not be null.");
regPtr0->invalidate(keyPtr0);
- checkPtr = dynCast<CacheableInt64Ptr>(regPtr0->get(keyPtr0));
- ASSERT(checkPtr == NULLPTR, "checkPtr should be null.");
+ checkPtr = std::dynamic_pointer_cast<CacheableInt64>(regPtr0->get(keyPtr0));
+ ASSERT(checkPtr == nullptr, "checkPtr should be null.");
try {
CacheableKeyPtr key;
regPtr0->invalidate(key);
- FAIL("Invalidate on NULLPTR should throw exception");
+ FAIL("Invalidate on nullptr should throw exception");
} catch (IllegalArgumentException e) {
- LOG(" Got an expected exception invalidate on NULLPTR should be throwing "
+ LOG(" Got an expected exception invalidate on nullptr should be throwing "
"exception ");
}
@@ -636,8 +636,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThirteen)
}
regPtr0->putAll(map0);
for (int i = 0; i < 2; i++) {
- CacheableInt64Ptr checkPtr =
- dynCast<CacheableInt64Ptr>(regPtr0->get(CacheableInt64::create(i)));
+ auto checkPtr = std::dynamic_pointer_cast<CacheableInt32>(
+ regPtr0->get(CacheableInt64::create(i)));
ASSERT(checkPtr->value() == i,
"putAll entry with long key and long value Mismatch.");
}
@@ -650,29 +650,30 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThirteen)
}
regPtr0->putAll(map0);
for (int i = 80; i < 82; i++) {
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr0->get(CacheableInt64::create(i)));
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(
+ regPtr0->get(CacheableInt64::create(i)));
ASSERT(strcmp(checkPtr->asChar(), vals[i - 80]) == 0,
"putAll entry with long key and string value Mismatch");
}
map0.clear();
- PdxTests::PdxTypes1Ptr val111(new PdxTests::PdxTypes1());
+ auto val111 = std::make_shared<PdxTests::PdxTypes1>();
map0.insert(CacheableInt32::create(1211), val111);
regPtr0->putAll(map0);
- PdxTests::PdxTypes1Ptr retObj = dynCast<PdxTests::PdxTypes1Ptr>(
+ auto retObj = std::dynamic_pointer_cast<PdxTests::PdxTypes1>(
regPtr0->get(CacheableInt32::create(1211)));
ASSERT(val111->equals(retObj) == true, "val111 and retObj should match.");
map0.clear();
- CacheableKeyPtr keyObject(new PdxTests::PdxType());
+ auto keyObject = std::make_shared<PdxTests::PdxType>();
map0.insert(keyObject, CacheableInt32::create(111));
regPtr0->putAll(map0);
- CacheableInt32Ptr checkPtr = regPtr0->get(keyObject);
+ auto checkPtr =
+ std::dynamic_pointer_cast<CacheableInt32>(regPtr0->get(keyObject));
ASSERT(checkPtr->value() == 111,
"putAll with entry as object key and value as int Mismatch");
map0.clear();
- CacheableKeyPtr keyObject6(new PdxTests::PdxTypes3());
+ auto keyObject6 = std::make_shared<PdxTests::PdxTypes3>();
map0.insert(keyObject6, CacheableString::create("testString"));
regPtr0->putAll(map0);
CacheablePtr checkPtr1 = regPtr0->get(keyObject6);
@@ -680,23 +681,23 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThirteen)
"strVal should be testString.");
map0.clear();
- CacheableKeyPtr keyObject7(new PdxTests::PdxTypes2());
- PdxTests::PdxTypes1Ptr valObject(new PdxTests::PdxTypes1());
- CacheableKeyPtr keyObject8(new PdxTests::PdxTypes2());
- PdxTests::PdxTypes1Ptr valObject2(new PdxTests::PdxTypes1());
+ auto keyObject7 = std::make_shared<PdxTests::PdxTypes2>();
+ auto valObject = std::make_shared<PdxTests::PdxTypes1>();
+ auto keyObject8 = std::make_shared<PdxTests::PdxTypes2>();
+ auto valObject2 = std::make_shared<PdxTests::PdxTypes1>();
map0.insert(keyObject7, valObject);
map0.insert(keyObject8, valObject2);
regPtr0->putAll(map0);
- PdxTests::PdxTypes1Ptr objVal =
- dynCast<PdxTests::PdxTypes1Ptr>(regPtr0->get(keyObject7));
+ auto objVal = std::dynamic_pointer_cast<PdxTests::PdxTypes1>(
+ regPtr0->get(keyObject7));
ASSERT(valObject == objVal, "valObject and objVal should match.");
map0.clear();
try {
map0.insert(CacheableInt64::create(345), CacheableInt64::create(3465987));
regPtr0->putAll(map0, -1);
- CacheableInt64Ptr checkPtr =
- dynCast<CacheableInt64Ptr>(regPtr0->get(CacheableInt64::create(345)));
+ auto checkPtr = std::dynamic_pointer_cast<CacheableInt64>(
+ regPtr0->get(CacheableInt64::create(345)));
ASSERT(checkPtr->value() == 3465987,
"putAll entry with long key and long value Mismatch.");
} catch (Exception& excp) {
@@ -713,7 +714,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThirteen)
map0.insert(CacheableInt64::create(3451),
CacheableInt64::create(3465987));
regPtr0->putAll(map0, 2147500);
- CacheableInt64Ptr checkPtr = dynCast<CacheableInt64Ptr>(
+ auto checkPtr = std::dynamic_pointer_cast<CacheableInt64>(
regPtr0->get(CacheableInt64::create(3451)));
ASSERT(checkPtr->value() == 3465987,
"putAll entry with long key and long value Mismatch.");
@@ -732,17 +733,17 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThirteen)
VectorOfCacheableKey keys1;
keys1.push_back(keyObject7);
keys1.push_back(keyObject8);
- HashMapOfCacheablePtr valuesMap(new HashMapOfCacheable());
+ auto valuesMap = std::make_shared<HashMapOfCacheable>();
valuesMap->clear();
- regPtr0->getAll(keys1, valuesMap, NULLPTR, true);
+ regPtr0->getAll(keys1, valuesMap, nullptr, true);
if (valuesMap->size() == keys1.size()) {
char buf[2048];
for (HashMapOfCacheable::Iterator iter = valuesMap->begin();
iter != valuesMap->end(); iter++) {
- CacheableKeyPtr key = dynCast<CacheableKeyPtr>(iter.first());
+ auto key = std::dynamic_pointer_cast<CacheableKey>(iter.first());
CacheablePtr mVal = iter.second();
- if (mVal != NULLPTR) {
- PdxTests::PdxTypes1Ptr val1 = dynCast<PdxTests::PdxTypes1Ptr>(mVal);
+ if (mVal != nullptr) {
+ auto val1 = std::dynamic_pointer_cast<PdxTests::PdxTypes1>(mVal);
sprintf(buf, "value from map %d , expected value %d ",
val1->getm_i1(), 34324);
LOG(buf);
@@ -757,9 +758,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThirteen)
}
regPtr0->putAll(map2);
for (int i = 100; i < 102; i++) {
- CacheablePtr checkPtr = dynCast<CacheablePtr>( regPtr0->get(
+ auto checkPtr = std::dynamic_pointer_cast<Cacheable>( regPtr0->get(
CacheableString::create(vals[i - 100])) );
- if ( checkPtr != NULLPTR ) {
+ if ( checkPtr != nullptr ) {
FAIL ("putAll with entry cacheable key and null value Mismatch");
}
}*/
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/ThinClientPutAllWithCallBack.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/ThinClientPutAllWithCallBack.hpp b/src/cppcache/integration-test/ThinClientPutAllWithCallBack.hpp
index dffb51f..9427b24 100644
--- a/src/cppcache/integration-test/ThinClientPutAllWithCallBack.hpp
+++ b/src/cppcache/integration-test/ThinClientPutAllWithCallBack.hpp
@@ -90,7 +90,7 @@ void _verifyEntry(const char* name, const char* key, const char* val,
}
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
CacheableKeyPtr keyPtr = createKey(key);
@@ -139,10 +139,10 @@ void _verifyEntry(const char* name, const char* key, const char* val,
}
if (val != NULL) {
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr));
+ auto checkPtr =
+ std::dynamic_pointer_cast<CacheableString>(regPtr->get(keyPtr));
- ASSERT(checkPtr != NULLPTR, "Value Ptr should not be null.");
+ ASSERT(checkPtr != nullptr, "Value Ptr should not be null.");
char buf[1024];
sprintf(buf, "In verify loop, get returned %s for key %s",
checkPtr->asChar(), key);
@@ -205,8 +205,8 @@ void createRegion(const char* name, bool ackMode, bool isCacheEnabled,
fprintf(stdout, "Creating region -- %s ackMode is %d\n", name, ackMode);
fflush(stdout);
RegionPtr regPtr = getHelper()->createRegion(
- name, ackMode, isCacheEnabled, NULLPTR, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ name, ackMode, isCacheEnabled, nullptr, clientNotificationEnabled);
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
void createPooledRegion(const char* name, bool ackMode, const char* locators,
@@ -219,7 +219,7 @@ void createPooledRegion(const char* name, bool ackMode, const char* locators,
RegionPtr regPtr =
getHelper()->createPooledRegion(name, ackMode, locators, poolname,
cachingEnable, clientNotificationEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
@@ -233,7 +233,7 @@ void createPooledRegionConcurrencyCheckDisabled(
RegionPtr regPtr = getHelper()->createPooledRegionConcurrencyCheckDisabled(
name, ackMode, locators, poolname, cachingEnable,
clientNotificationEnabled, concurrencyCheckEnabled);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Pooled Region created.");
}
@@ -250,7 +250,7 @@ void createEntry(const char* name, const char* key, const char* value = NULL) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
@@ -275,7 +275,7 @@ void updateEntry(const char* name, const char* key, const char* value) {
CacheableStringPtr valPtr = CacheableString::create(value);
RegionPtr regPtr = getHelper()->getRegion(name);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(regPtr->containsKey(keyPtr), "Key should have been found in region.");
ASSERT(regPtr->containsValueForKey(keyPtr),
@@ -301,17 +301,17 @@ void doNetsearch(const char* name, const char* key, const char* value) {
RegionPtr regPtr = getHelper()->getRegion(name);
fprintf(stdout, "netsearch region %s\n", regPtr->getName());
fflush(stdout);
- ASSERT(regPtr != NULLPTR, "Region not found.");
+ ASSERT(regPtr != nullptr, "Region not found.");
ASSERT(!regPtr->containsKey(keyPtr),
"Key should not have been found in region.");
ASSERT(!regPtr->containsValueForKey(keyPtr),
"Value should not have been found in region.");
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr->get(keyPtr)); // force a netsearch
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(
+ regPtr->get(keyPtr)); // force a netsearch
- if (checkPtr != NULLPTR) {
+ if (checkPtr != nullptr) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
@@ -416,7 +416,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, RegisterClient1Keys)
VectorOfCacheableKey keys1;
keys1.push_back(keyPtr0);
keys1.push_back(keyPtr1);
- regPtr0->registerKeys(keys1, NULLPTR);
+ regPtr0->registerKeys(keys1);
CacheableKeyPtr keyPtr2 = CacheableKey::create(keys[2]);
CacheableKeyPtr keyPtr3 = CacheableKey::create(keys[3]);
@@ -424,7 +424,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, RegisterClient1Keys)
VectorOfCacheableKey keys2;
keys2.push_back(keyPtr2);
keys2.push_back(keyPtr3);
- regPtr1->registerKeys(keys2, NULLPTR);
+ regPtr1->registerKeys(keys2);
LOG("RegisterClient1Keys complete.");
}
@@ -485,9 +485,9 @@ DUNIT_TASK_DEFINITION(CLIENT1, PutAllOps)
getAllkeys.push_back(CacheableKey::create(key));
}
- HashMapOfCacheablePtr valuesMap(new HashMapOfCacheable());
+ auto valuesMap = std::make_shared<HashMapOfCacheable>();
valuesMap->clear();
- regPtr0->getAll(getAllkeys, valuesMap, NULLPTR, false);
+ regPtr0->getAll(getAllkeys, valuesMap, nullptr, false);
ASSERT(valuesMap->size() == 500, "GetAll should return 500 entries.");
LOG("PutAllOps complete.");
@@ -591,11 +591,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, VerifyRegionService)
RegionPtr regPtr0 = getHelper()->getRegion(regionNames[0]);
RegionServicePtr rsp = regPtr0->getRegionService();
RegionPtr regPtr = rsp->getRegion(regionNames[0]);
- ASSERT(regPtr != NULLPTR, "Failed to get region.");
+ ASSERT(regPtr != nullptr, "Failed to get region.");
RegionServicePtr rsp1 = regPtr0->getRegionService();
RegionPtr regPtr1 = rsp1->getRegion("NOT_CREATED_REGION");
- ASSERT(regPtr1 == NULLPTR, "Unknown Region Returned");
+ ASSERT(regPtr1 == nullptr, "Unknown Region Returned");
LOG("VerifyRegionService complete.");
}
@@ -609,20 +609,20 @@ DUNIT_TASK_DEFINITION(CLIENT1, InvalidateKeys)
RegionPtr regPtr0 = getHelper()->getRegion(regionNames[0]);
regPtr0->put(keyPtr0, valPtr0);
- CacheableInt64Ptr checkPtr =
- dynCast<CacheableInt64Ptr>(regPtr0->get(keyPtr0));
- ASSERT(checkPtr != NULLPTR, "checkPtr should not be null.");
+ auto checkPtr =
+ std::dynamic_pointer_cast<CacheableInt64>(regPtr0->get(keyPtr0));
+ ASSERT(checkPtr != nullptr, "checkPtr should not be null.");
regPtr0->invalidate(keyPtr0);
- checkPtr = dynCast<CacheableInt64Ptr>(regPtr0->get(keyPtr0));
- ASSERT(checkPtr == NULLPTR, "checkPtr should be null.");
+ checkPtr = std::dynamic_pointer_cast<CacheableInt64>(regPtr0->get(keyPtr0));
+ ASSERT(checkPtr == nullptr, "checkPtr should be null.");
try {
CacheableKeyPtr key;
regPtr0->invalidate(key);
- FAIL("Invalidate on NULLPTR should throw exception");
+ FAIL("Invalidate on nullptr should throw exception");
} catch (IllegalArgumentException e) {
- LOG(" Got an expected exception invalidate on NULLPTR should be throwing "
+ LOG(" Got an expected exception invalidate on nullptr should be throwing "
"exception ");
}
@@ -639,8 +639,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, VerifyPutAllWithLongKeyAndStringValue)
}
regPtr0->putAll(map0, 15, CacheableInt32::create(1000));
for (int i = 0; i < 2; i++) {
- CacheableInt64Ptr checkPtr =
- dynCast<CacheableInt64Ptr>(regPtr0->get(CacheableInt64::create(i)));
+ auto checkPtr = std::dynamic_pointer_cast<CacheableInt64>(
+ regPtr0->get(CacheableInt64::create(i)));
ASSERT(checkPtr->value() == i,
"putAll entry with long key and long value Mismatch.");
}
@@ -653,8 +653,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, VerifyPutAllWithLongKeyAndStringValue)
}
regPtr0->putAll(map0, 15, CacheableInt32::create(1000));
for (int i = 80; i < 82; i++) {
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr0->get(CacheableInt64::create(i)));
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(
+ regPtr0->get(CacheableInt64::create(i)));
ASSERT(strcmp(checkPtr->asChar(), vals[i - 80]) == 0,
"putAll entry with long key and string value Mismatch");
}
@@ -670,8 +670,8 @@ DUNIT_TASK_DEFINITION(CLIENT1, VerifyPutAllWithLongKeyAndLongValue)
try {
map0.insert(CacheableInt64::create(345), CacheableInt64::create(3465987));
regPtr0->putAll(map0, -1, CacheableInt32::create(1000));
- CacheableInt64Ptr checkPtr =
- dynCast<CacheableInt64Ptr>(regPtr0->get(CacheableInt64::create(345)));
+ auto checkPtr = std::dynamic_pointer_cast<CacheableInt64>(
+ regPtr0->get(CacheableInt64::create(345)));
ASSERT(checkPtr->value() == 3465987,
"putAll entry with long key and long value Mismatch.");
} catch (Exception& excp) {
@@ -688,7 +688,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, VerifyPutAllWithLongKeyAndLongValue)
map0.insert(CacheableInt64::create(3451),
CacheableInt64::create(3465987));
regPtr0->putAll(map0, 2147500, CacheableInt32::create(1000));
- CacheableInt64Ptr checkPtr = dynCast<CacheableInt64Ptr>(
+ auto checkPtr = std::dynamic_pointer_cast<CacheableInt64>(
regPtr0->get(CacheableInt64::create(3451)));
ASSERT(checkPtr->value() == 3465987,
"putAll entry with long key and long value Mismatch.");
@@ -709,22 +709,23 @@ DUNIT_TASK_DEFINITION(CLIENT1, VerifyPutAllWithObjectKey)
{
RegionPtr regPtr0 = getHelper()->getRegion(regionNames[0]);
HashMapOfCacheable map0;
- PdxTests::PdxTypes1Ptr val111(new PdxTests::PdxTypes1());
+ auto val111 = std::make_shared<PdxTests::PdxTypes1>();
map0.insert(CacheableInt32::create(1211), val111);
regPtr0->putAll(map0, 15, CacheableInt32::create(1000));
- PdxTests::PdxTypes1Ptr retObj = dynCast<PdxTests::PdxTypes1Ptr>(
+ auto retObj = std::dynamic_pointer_cast<PdxTests::PdxTypes1>(
regPtr0->get(CacheableInt32::create(1211)));
ASSERT(val111->equals(retObj) == true, "val111 and retObj should match.");
map0.clear();
- CacheableKeyPtr keyObject(new PdxTests::PdxType());
+ auto keyObject = std::make_shared<PdxTests::PdxType>();
map0.insert(keyObject, CacheableInt32::create(111));
regPtr0->putAll(map0, 15, CacheableInt32::create(1000));
- CacheableInt32Ptr checkPtr = regPtr0->get(keyObject);
+ CacheableInt32Ptr checkPtr =
+ std::dynamic_pointer_cast<CacheableInt32>(regPtr0->get(keyObject));
ASSERT(checkPtr->value() == 111,
"putAll with entry as object key and value as int Mismatch");
map0.clear();
- CacheableKeyPtr keyObject6(new PdxTests::PdxTypes3());
+ auto keyObject6 = std::make_shared<PdxTests::PdxTypes3>();
map0.insert(keyObject6, CacheableString::create("testString"));
regPtr0->putAll(map0, 15, CacheableInt32::create(1000));
CacheablePtr checkPtr1 = regPtr0->get(keyObject6);
@@ -732,15 +733,15 @@ DUNIT_TASK_DEFINITION(CLIENT1, VerifyPutAllWithObjectKey)
"strVal should be testString.");
map0.clear();
- CacheableKeyPtr keyObject7(new PdxTests::PdxTypes2());
- PdxTests::PdxTypes1Ptr valObject(new PdxTests::PdxTypes1());
- CacheableKeyPtr keyObject8(new PdxTests::PdxTypes2());
- PdxTests::PdxTypes1Ptr valObject2(new PdxTests::PdxTypes1());
+ auto keyObject7 = std::make_shared<PdxTests::PdxTypes2>();
+ auto valObject = std::make_shared<PdxTests::PdxTypes1>();
+ auto keyObject8 = std::make_shared<PdxTests::PdxTypes2>();
+ auto valObject2 = std::make_shared<PdxTests::PdxTypes1>();
map0.insert(keyObject7, valObject);
map0.insert(keyObject8, valObject2);
regPtr0->putAll(map0, 15, CacheableInt32::create(1000));
- PdxTests::PdxTypes1Ptr objVal =
- dynCast<PdxTests::PdxTypes1Ptr>(regPtr0->get(keyObject7));
+ auto objVal = std::dynamic_pointer_cast<PdxTests::PdxTypes1>(
+ regPtr0->get(keyObject7));
ASSERT(valObject == objVal, "valObject and objVal should match.");
regPtr0->localInvalidateRegion();
@@ -748,17 +749,17 @@ DUNIT_TASK_DEFINITION(CLIENT1, VerifyPutAllWithObjectKey)
VectorOfCacheableKey keys1;
keys1.push_back(keyObject7);
keys1.push_back(keyObject8);
- HashMapOfCacheablePtr valuesMap(new HashMapOfCacheable());
+ auto valuesMap = std::make_shared<HashMapOfCacheable>();
valuesMap->clear();
- regPtr0->getAll(keys1, valuesMap, NULLPTR, true);
+ regPtr0->getAll(keys1, valuesMap, nullptr, true);
if (valuesMap->size() == keys1.size()) {
char buf[2048];
for (HashMapOfCacheable::Iterator iter = valuesMap->begin();
iter != valuesMap->end(); iter++) {
- CacheableKeyPtr key = dynCast<CacheableKeyPtr>(iter.first());
+ auto key = std::dynamic_pointer_cast<CacheableKey>(iter.first());
CacheablePtr mVal = iter.second();
- if (mVal != NULLPTR) {
- PdxTests::PdxTypes1Ptr val1 = dynCast<PdxTests::PdxTypes1Ptr>(mVal);
+ if (mVal != nullptr) {
+ auto val1 = std::dynamic_pointer_cast<PdxTests::PdxTypes1>(mVal);
sprintf(buf, "value from map %d , expected value %d ",
val1->getm_i1(), 34324);
LOG(buf);
[12/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from cppcache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientSecurityCQAuthorizationMU.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientSecurityCQAuthorizationMU.cpp b/src/cppcache/integration-test/testThinClientSecurityCQAuthorizationMU.cpp
index 18f0d34..aac3381 100644
--- a/src/cppcache/integration-test/testThinClientSecurityCQAuthorizationMU.cpp
+++ b/src/cppcache/integration-test/testThinClientSecurityCQAuthorizationMU.cpp
@@ -101,7 +101,7 @@ class MyCqListener : public CqListener {
printf(" in cqEvent.getQueryOperation() %d id = %d\n",
cqEvent.getQueryOperation(), m_id);
printf(" in update key = %s \n",
- (dynamic_cast<CacheableString*>(cqEvent.getKey().ptr()))->asChar());
+ (dynamic_cast<CacheableString*>(cqEvent.getKey().get()))->asChar());
m_numEvents++;
switch (cqEvent.getQueryOperation()) {
case CqOperation::OP_TYPE_CREATE:
@@ -144,7 +144,7 @@ std::string getXmlPath() {
void initCredentialGenerator() {
credentialGeneratorHandler = CredentialGenerator::create("DUMMY3");
- if (credentialGeneratorHandler == NULLPTR) {
+ if (credentialGeneratorHandler == nullptr) {
FAIL("credentialGeneratorHandler is NULL");
}
}
@@ -207,7 +207,7 @@ void stepOne(bool pool = false, bool locator = false) {
LOG("StepOne1 complete. 1");
initClientCq(true);
LOG("StepOne1 complete. 2");
- createRegionForCQMU(regionNamesCq[0], USE_ACK, true, 0, NULLPTR, false, true);
+ createRegionForCQMU(regionNamesCq[0], USE_ACK, true, 0, nullptr, false, true);
LOG("StepOne1 complete. 3");
RegionPtr regptr = getHelper()->getRegion(regionNamesCq[0]);
LOG("StepOne1 complete. 4");
@@ -222,7 +222,7 @@ void stepOne2(bool pool = false, bool locator = false) {
LOG("StepOne2 complete. 1");
initClientCq(true);
LOG("StepOne2 complete. 2");
- createRegionForCQMU(regionNamesCq[0], USE_ACK, true, 0, NULLPTR, false, true);
+ createRegionForCQMU(regionNamesCq[0], USE_ACK, true, 0, nullptr, false, true);
LOG("StepOne2 complete. 3");
RegionPtr regptr = getHelper()->getRegion(regionNamesCq[0]);
LOG("StepOne2 complete. 4");
@@ -290,7 +290,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
try {
for (i = 0; i < MAX_LISTNER; i++) {
- CqListenerPtr cqLstner(new MyCqListener(i));
+ auto cqLstner = std::make_shared<MyCqListener>(i);
CqAttributesFactory cqFac;
cqFac.addCqListener(cqLstner);
CqAttributesPtr cqAttr = cqFac.create();
@@ -335,7 +335,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepTwo2)
qh->populatePortfolioData(regPtr0, 3, 2, 1);
qh->populatePositionData(subregPtr0, 3, 2);
for (int i = 1; i <= 4; i++) {
- CacheablePtr port(new Portfolio(i, 2));
+ auto port = std::make_shared<Portfolio>(i, 2);
char tmp[25] = {'\0'};
sprintf(tmp, "port1-%d", i);
@@ -380,12 +380,12 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
}
// if key port1-4 then only query 3 and 4 will satisfied
- CqQueryPtr cqy = qs->getCq(cqNames[3]);
- CqAttributesPtr cqAttr = cqy->getCqAttributes();
- VectorOfCqListener vl;
+ auto cqy = qs->getCq(cqNames[3]);
+ auto cqAttr = cqy->getCqAttributes();
+ std::vector<CqListenerPtr> vl;
cqAttr->getCqListeners(vl);
- MyCqListener* cqListener_3 = static_cast<MyCqListener*>(vl[0].ptr());
+ auto cqListener_3 = static_cast<MyCqListener*>(vl[0].get());
printf(" cqListener_3 should have one create event = %d \n",
cqListener_3->getNumInserts());
ASSERT(cqListener_3->getNumInserts() == 1,
@@ -397,7 +397,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
cqAttr = cqy->getCqAttributes();
cqAttr->getCqListeners(vl);
- MyCqListener* cqListener_4 = static_cast<MyCqListener*>(vl[0].ptr());
+ auto cqListener_4 = static_cast<MyCqListener*>(vl[0].get());
printf(" cqListener_4 should have one create event = %d \n",
cqListener_4->getNumInserts());
ASSERT(cqListener_4->getNumInserts() == 1,
@@ -420,10 +420,7 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, StepFour2)
{
- // CachePtr userCache = getVirtualCache(userCreds, regionNamesCq[0]);
- QueryServicePtr qs;
-
- qs = userQueryService;
+ auto qs = userQueryService;
char buf[1024];
@@ -440,7 +437,6 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour2)
events[i] = 0;
}
- CqAttributesFactory cqFac;
for (i = 0; i < MAX_LISTNER; i++) {
sprintf(buf, "get info for cq[%s]:", cqNames[i]);
LOG(buf);
@@ -449,12 +445,12 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour2)
}
// if key port1-4 then only query 3 and 4 will satisfied
- CqQueryPtr cqy = qs->getCq(cqNames[3]);
- CqAttributesPtr cqAttr = cqy->getCqAttributes();
- VectorOfCqListener vl;
+ auto cqy = qs->getCq(cqNames[3]);
+ auto cqAttr = cqy->getCqAttributes();
+ std::vector<CqListenerPtr> vl;
cqAttr->getCqListeners(vl);
- MyCqListener* cqListener_3 = static_cast<MyCqListener*>(vl[0].ptr());
+ MyCqListener* cqListener_3 = static_cast<MyCqListener*>(vl[0].get());
printf(" cqListener_3 should have one update event = %d \n",
cqListener_3->getNumUpdates());
ASSERT(cqListener_3->getNumUpdates() == 1,
@@ -466,7 +462,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour2)
cqAttr = cqy->getCqAttributes();
cqAttr->getCqListeners(vl);
- MyCqListener* cqListener_4 = static_cast<MyCqListener*>(vl[0].ptr());
+ auto cqListener_4 = static_cast<MyCqListener*>(vl[0].get());
printf(" cqListener_4 should have one update event = %d \n",
cqListener_4->getNumUpdates());
ASSERT(cqListener_4->getNumUpdates() == 1,
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientSecurityDH.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientSecurityDH.cpp b/src/cppcache/integration-test/testThinClientSecurityDH.cpp
index 2f0dbde..943b4ac 100644
--- a/src/cppcache/integration-test/testThinClientSecurityDH.cpp
+++ b/src/cppcache/integration-test/testThinClientSecurityDH.cpp
@@ -93,7 +93,7 @@ void initCredentialGenerator() {
}
}
- if (credentialGeneratorHandler == NULLPTR) {
+ if (credentialGeneratorHandler == nullptr) {
FAIL("credentialGeneratorHandler is NULL");
}
@@ -113,7 +113,7 @@ void initClientAuth(char credentialsType, const char* dhAlgo) {
printf("KeyStore Path is: %s", testsrc.c_str());
config->insert("security-client-kspath", testsrc.c_str());
- if (credentialGeneratorHandler == NULLPTR) {
+ if (credentialGeneratorHandler == nullptr) {
FAIL("credentialGeneratorHandler is NULL");
}
bool insertAuthInit = true;
@@ -193,9 +193,9 @@ void DoNetSearch() {
createRegionForSecurity(regionNamesAuth[1], USE_ACK, true);
RegionPtr regPtr0 = getHelper()->getRegion(regionNamesAuth[0]);
CacheableKeyPtr keyPtr = CacheableKey::create(keys[0]);
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr0->get(keyPtr));
- if (checkPtr != NULLPTR && !strcmp(nvals[0], checkPtr->asChar())) {
+ auto checkPtr =
+ std::dynamic_pointer_cast<CacheableString>(regPtr0->get(keyPtr));
+ if (checkPtr != nullptr && !strcmp(nvals[0], checkPtr->asChar())) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
@@ -213,7 +213,7 @@ void DoNetSearch() {
void initSecurityServer(int instance) {
std::string cmdServerAuthenticator;
- if (credentialGeneratorHandler == NULLPTR) {
+ if (credentialGeneratorHandler == nullptr) {
FAIL("credentialGeneratorHandler is NULL");
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientSecurityDH_MU.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientSecurityDH_MU.cpp b/src/cppcache/integration-test/testThinClientSecurityDH_MU.cpp
index 999b4e5..52f067f 100644
--- a/src/cppcache/integration-test/testThinClientSecurityDH_MU.cpp
+++ b/src/cppcache/integration-test/testThinClientSecurityDH_MU.cpp
@@ -96,7 +96,7 @@ void initCredentialGenerator() {
}
}
- if (credentialGeneratorHandler == NULLPTR) {
+ if (credentialGeneratorHandler == nullptr) {
FAIL("credentialGeneratorHandler is NULL");
}
@@ -119,7 +119,7 @@ void initClientAuth(char credentialsType, const char* dhAlgo) {
printf("KeyStore Path is: %s", testsrc.c_str());
config->insert("security-client-kspath", testsrc.c_str());
- if (credentialGeneratorHandler == NULLPTR) {
+ if (credentialGeneratorHandler == nullptr) {
FAIL("credentialGeneratorHandler is NULL");
}
bool insertAuthInit = true;
@@ -163,11 +163,11 @@ void InitIncorrectClients(const char* dhAlgo) {
}
try {
- createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, NULLPTR, false,
+ createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, nullptr, false,
-1, true, 0);
PoolPtr pool = getPool(regionNamesAuth[0]);
LOG(" 6");
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
LOG(" 7");
RegionServicePtr virtualCache = getVirtualCache(userCreds, pool);
LOG(" 8");
@@ -194,7 +194,7 @@ void InitCorrectClients(const char* dhAlgo) {
LOG(other.getMessage());
}
try {
- createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, NULLPTR, false,
+ createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, nullptr, false,
-1, true, 0);
PoolPtr pool = getPool(regionNamesAuth[0]);
LOG(" 6");
@@ -214,7 +214,7 @@ void InitCorrectClients(const char* dhAlgo) {
void DoNetSearch() {
try {
- createRegionForSecurity(regionNamesAuth[1], USE_ACK, false, NULLPTR, false,
+ createRegionForSecurity(regionNamesAuth[1], USE_ACK, false, nullptr, false,
-1, true, 0);
PoolPtr pool = getPool(regionNamesAuth[1]);
LOG(" 6");
@@ -225,9 +225,8 @@ void DoNetSearch() {
RegionPtr regionPtr = virtualCache->getRegion(regionNamesAuth[1]);
CacheableKeyPtr keyPtr = CacheableKey::create(keys[0]);
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regionPtr->get(keyPtr));
- if (checkPtr != NULLPTR && !strcmp(vals[0], checkPtr->asChar())) {
+ auto checkPtr = std::dynamic_pointer_cast<CacheableString>(regionPtr->get(keyPtr));
+ if (checkPtr != nullptr && !strcmp(vals[0], checkPtr->asChar())) {
LOG("checkPtr is not null");
char buf[1024];
sprintf(buf, "In net search, get returned %s for key %s",
@@ -245,7 +244,7 @@ void DoNetSearch() {
void initSecurityServer(int instance) {
std::string cmdServerAuthenticator;
- if (credentialGeneratorHandler == NULLPTR) {
+ if (credentialGeneratorHandler == nullptr) {
FAIL("credentialGeneratorHandler is NULL");
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientSecurityDurableCQAuthorizationMU.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientSecurityDurableCQAuthorizationMU.cpp b/src/cppcache/integration-test/testThinClientSecurityDurableCQAuthorizationMU.cpp
index d81c4ba..59224aa 100644
--- a/src/cppcache/integration-test/testThinClientSecurityDurableCQAuthorizationMU.cpp
+++ b/src/cppcache/integration-test/testThinClientSecurityDurableCQAuthorizationMU.cpp
@@ -101,7 +101,7 @@ class MyCqListener : public CqListener {
printf(" in cqEvent.getQueryOperation() %d id = %d\n",
cqEvent.getQueryOperation(), m_id);
printf(" in update key = %s \n",
- (dynamic_cast<CacheableString*>(cqEvent.getKey().ptr()))->asChar());
+ (dynamic_cast<CacheableString*>(cqEvent.getKey().get()))->asChar());
m_numEvents++;
switch (cqEvent.getQueryOperation()) {
case CqOperation::OP_TYPE_CREATE:
@@ -144,7 +144,7 @@ std::string getXmlPath() {
void initCredentialGenerator() {
credentialGeneratorHandler = CredentialGenerator::create("DUMMY3");
- if (credentialGeneratorHandler == NULLPTR) {
+ if (credentialGeneratorHandler == nullptr) {
FAIL("credentialGeneratorHandler is NULL");
}
}
@@ -216,7 +216,7 @@ void stepOne(bool pool = false, bool locator = false) {
LOG("StepOne1 complete. 1");
initClientCq(true, 0);
LOG("StepOne1 complete. 2");
- createRegionForCQMU(regionNamesCq[0], USE_ACK, true, 0, NULLPTR, false, true);
+ createRegionForCQMU(regionNamesCq[0], USE_ACK, true, 0, nullptr, false, true);
LOG("StepOne1 complete. 3");
RegionPtr regptr = getHelper()->getRegion(regionNamesCq[0]);
LOG("StepOne1 complete. 4");
@@ -240,7 +240,7 @@ void stepOne2(bool pool = false, bool locator = false) {
LOG("StepOne2 complete. 1");
initClientCq(true, 1);
LOG("StepOne2 complete. 2");
- createRegionForCQMU(regionNamesCq[0], USE_ACK, true, 0, NULLPTR, false, true);
+ createRegionForCQMU(regionNamesCq[0], USE_ACK, true, 0, nullptr, false, true);
LOG("StepOne2 complete. 3");
RegionPtr regptr = getHelper()->getRegion(regionNamesCq[0]);
LOG("StepOne2 complete. 4");
@@ -312,7 +312,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepThree)
try {
for (i = 0; i < MAX_LISTNER; i++) {
- CqListenerPtr cqLstner(new MyCqListener(i));
+ auto cqLstner = std::make_shared<MyCqListener>(i);
CqAttributesFactory cqFac;
cqFac.addCqListener(cqLstner);
CqAttributesPtr cqAttr = cqFac.create();
@@ -366,7 +366,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, StepTwo2)
qh->populatePortfolioData(regPtr0, 3, 2, 1);
qh->populatePositionData(subregPtr0, 3, 2);
for (int i = 1; i <= 4; i++) {
- CacheablePtr port(new Portfolio(i, 2));
+ auto port = std::make_shared<Portfolio>(i, 2);
char tmp[25] = {'\0'};
sprintf(tmp, "port1-%d", i);
@@ -383,9 +383,7 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
{
// CachePtr userCache = getVirtualCache(userCreds, regionNamesCq[0]);
- QueryServicePtr qs;
-
- qs = userQueryService;
+ auto qs = userQueryService;
char buf[1024];
@@ -402,7 +400,6 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
events[i] = 0;
}
- CqAttributesFactory cqFac;
for (i = 0; i < MAX_LISTNER; i++) {
sprintf(buf, "get info for cq[%s]:", cqNames[i]);
LOG(buf);
@@ -411,12 +408,12 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
}
// if key port1-4 then only query 3 and 4 will satisfied
- CqQueryPtr cqy = qs->getCq(cqNames[3]);
- CqAttributesPtr cqAttr = cqy->getCqAttributes();
- VectorOfCqListener vl;
+ auto cqy = qs->getCq(cqNames[3]);
+ auto cqAttr = cqy->getCqAttributes();
+ std::vector<CqListenerPtr> vl;
cqAttr->getCqListeners(vl);
- MyCqListener* cqListener_3 = static_cast<MyCqListener*>(vl[0].ptr());
+ auto cqListener_3 = static_cast<MyCqListener*>(vl[0].get());
printf(" cqListener_3 should have one create event = %d \n",
cqListener_3->getNumInserts());
ASSERT(cqListener_3->getNumInserts() == 1,
@@ -428,7 +425,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour)
cqAttr = cqy->getCqAttributes();
cqAttr->getCqListeners(vl);
- MyCqListener* cqListener_4 = static_cast<MyCqListener*>(vl[0].ptr());
+ auto cqListener_4 = static_cast<MyCqListener*>(vl[0].get());
printf(" cqListener_4 should have one create event = %d \n",
cqListener_4->getNumInserts());
ASSERT(cqListener_4->getNumInserts() == 1,
@@ -444,9 +441,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour2)
SLEEP(15000); // sleep .25 min
// CachePtr userCache = getVirtualCache(userCreds, regionNamesCq[0]);
userQueryService = userCache->getQueryService();
- QueryServicePtr qs;
-
- qs = userQueryService;
+ auto qs = userQueryService;
char buf[1024];
@@ -463,7 +458,6 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour2)
events[i] = 0;
}
- CqAttributesFactory cqFac;
for (i = 0; i < MAX_LISTNER; i++) {
sprintf(buf, "get info for cq[%s]:", cqNames[i]);
LOG(buf);
@@ -474,12 +468,12 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour2)
if ((durableCq && !logicalCacheKeepAlive && !closeLogicalCache) ||
(durableCq && logicalCacheKeepAlive && closeLogicalCache)) {
// if key port1-4 then only query 3 and 4 will satisfied
- CqQueryPtr cqy = qs->getCq(cqNames[3]);
- CqAttributesPtr cqAttr = cqy->getCqAttributes();
- VectorOfCqListener vl;
+ auto cqy = qs->getCq(cqNames[3]);
+ auto cqAttr = cqy->getCqAttributes();
+ std::vector<CqListenerPtr> vl;
cqAttr->getCqListeners(vl);
- MyCqListener* cqListener_3 = static_cast<MyCqListener*>(vl[0].ptr());
+ auto cqListener_3 = static_cast<MyCqListener*>(vl[0].get());
printf(" cqListener_3 should have one update event = %d \n",
cqListener_3->getNumUpdates());
ASSERT(cqListener_3->getNumUpdates() == 1,
@@ -491,7 +485,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour2)
cqAttr = cqy->getCqAttributes();
cqAttr->getCqListeners(vl);
- MyCqListener* cqListener_4 = static_cast<MyCqListener*>(vl[0].ptr());
+ MyCqListener* cqListener_4 = static_cast<MyCqListener*>(vl[0].get());
printf(" cqListener_4 should have one update event = %d \n",
cqListener_4->getNumUpdates());
ASSERT(cqListener_4->getNumUpdates() == 1,
@@ -501,12 +495,12 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour2)
if ((!durableCq && !logicalCacheKeepAlive && !closeLogicalCache) ||
(durableCq && !logicalCacheKeepAlive && closeLogicalCache)) {
// if key port1-4 then only query 3 and 4 will satisfied
- CqQueryPtr cqy = qs->getCq(cqNames[3]);
- CqAttributesPtr cqAttr = cqy->getCqAttributes();
- VectorOfCqListener vl;
+ auto cqy = qs->getCq(cqNames[3]);
+ auto cqAttr = cqy->getCqAttributes();
+ std::vector<CqListenerPtr> vl;
cqAttr->getCqListeners(vl);
- MyCqListener* cqListener_3 = static_cast<MyCqListener*>(vl[0].ptr());
+ auto cqListener_3 = static_cast<MyCqListener*>(vl[0].get());
printf(" cqListener_3 should have zero update event = %d \n",
cqListener_3->getNumUpdates());
ASSERT(cqListener_3->getNumUpdates() == 0,
@@ -518,7 +512,7 @@ DUNIT_TASK_DEFINITION(CLIENT1, StepFour2)
cqAttr = cqy->getCqAttributes();
cqAttr->getCqListeners(vl);
- MyCqListener* cqListener_4 = static_cast<MyCqListener*>(vl[0].ptr());
+ auto cqListener_4 = static_cast<MyCqListener*>(vl[0].get());
printf(" cqListener_4 should have zero update event = %d \n",
cqListener_4->getNumUpdates());
ASSERT(cqListener_4->getNumUpdates() == 0,
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientSecurityMultiUserTest.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientSecurityMultiUserTest.cpp b/src/cppcache/integration-test/testThinClientSecurityMultiUserTest.cpp
index 775efae..75ec233 100644
--- a/src/cppcache/integration-test/testThinClientSecurityMultiUserTest.cpp
+++ b/src/cppcache/integration-test/testThinClientSecurityMultiUserTest.cpp
@@ -67,7 +67,7 @@ void initCredentialGenerator() {
}
}
- if (credentialGeneratorHandler == NULLPTR) {
+ if (credentialGeneratorHandler == nullptr) {
FAIL("credentialGeneratorHandler is NULL");
}
@@ -356,7 +356,7 @@ DUNIT_TASK_DEFINITION(CLIENT_1, StepOne)
initClientAuth();
try {
LOG("Tying Region creation");
- createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, NULLPTR,
+ createRegionForSecurity(regionNamesAuth[0], USE_ACK, false, nullptr,
false, -1, true, 0);
LOG("Region created successfully");
PoolPtr pool = getPool(regionNamesAuth[0]);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientSecurityPostAuthorization.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientSecurityPostAuthorization.cpp b/src/cppcache/integration-test/testThinClientSecurityPostAuthorization.cpp
index 5f953ce..cea188d 100644
--- a/src/cppcache/integration-test/testThinClientSecurityPostAuthorization.cpp
+++ b/src/cppcache/integration-test/testThinClientSecurityPostAuthorization.cpp
@@ -140,7 +140,7 @@ void checkValuesMap(const HashMapOfCacheablePtr& values, int clientNum,
key = CacheableString::create(keys[index]);
HashMapOfCacheable::Iterator iter = values->find(key);
ASSERT(iter != values->end(), "key not found in values map");
- val = dynCast<CacheableStringPtr>(iter.second());
+ val = std::dynamic_pointer_cast<CacheableString>(iter.second());
expectedVal = CacheableString::create(nvals[index]);
ASSERT(*val == *expectedVal, "unexpected value in values map");
}
@@ -159,8 +159,9 @@ void checkExceptionsMap(const HashMapOfExceptionPtr& exceptions, int clientNum,
key = CacheableString::create(keys[index]);
HashMapOfException::Iterator iter = exceptions->find(key);
ASSERT(iter != exceptions->end(), "key not found in exceptions map");
- ASSERT(instanceOf<NotAuthorizedExceptionPtr>(iter.second()),
- "unexpected exception type in exception map");
+ ASSERT(
+ std::dynamic_pointer_cast<NotAuthorizedExceptionPtr>(iter.second()),
+ "unexpected exception type in exception map");
printf("Got expected NotAuthorizedException: %s",
iter.second()->getMessage());
}
@@ -219,7 +220,7 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne)
createEntry(regionNamesAuth[0], keys[0], vals[0]);
createEntry(regionNamesAuth[0], keys[2], nvals[2]);
RegionPtr regPtr0 = getHelper()->getRegion(regionNamesAuth[0]);
- if (regPtr0 != NULLPTR) {
+ if (regPtr0 != nullptr) {
regPtr0->registerAllKeys();
regPtr0->unregisterAllKeys();
}
@@ -227,13 +228,13 @@ DUNIT_TASK_DEFINITION(ADMIN_CLIENT, StepOne)
VectorOfCacheableKey keysVec;
keysVec.push_back(key0);
keysVec.push_back(key2);
- HashMapOfCacheablePtr values(new HashMapOfCacheable());
- HashMapOfExceptionPtr exceptions(new HashMapOfException());
+ auto values = std::make_shared<HashMapOfCacheable>();
+ auto exceptions = std::make_shared<HashMapOfException>();
regPtr0->getAll(keysVec, values, exceptions);
ASSERT(values->size() == 2, "Expected 2 entries");
ASSERT(exceptions->size() == (size_t)0, "Expected no exceptions");
- CacheableStringPtr res0 = dynCast<CacheableStringPtr>((*values)[key0]);
- CacheableStringPtr res2 = dynCast<CacheableStringPtr>((*values)[key2]);
+ auto res0 = std::dynamic_pointer_cast<CacheableString>((*values)[key0]);
+ auto res2 = std::dynamic_pointer_cast<CacheableString>((*values)[key2]);
ASSERT(*res0 == *val0, "Unexpected value for key");
ASSERT(*res2 == *val2, "Unexpected value for key");
}
@@ -265,8 +266,8 @@ DUNIT_TASK_DEFINITION(WRITER_CLIENT, StepTwo)
createRegionForSecurity(regionNamesAuth[0], USE_ACK, true);
RegionPtr regPtr0 = getHelper()->getRegion(regionNamesAuth[0]);
CacheableKeyPtr keyPtr = CacheableKey::create(keys[0]);
- CacheableStringPtr checkPtr =
- dynCast<CacheableStringPtr>(regPtr0->get(keyPtr));
+ auto checkPtr =
+ std::dynamic_pointer_cast<CacheableString>(regPtr0->get(keyPtr));
FAIL("Should get NotAuthorizedException");
}
HANDLE_NOT_AUTHORIZED_EXCEPTION
@@ -290,8 +291,8 @@ DUNIT_TASK_DEFINITION(READER_CLIENT, StepThree)
createRegionForSecurity(regionNamesAuth[0], USE_ACK, true);
VectorOfCacheableKey keys;
- HashMapOfCacheablePtr values(new HashMapOfCacheable());
- HashMapOfExceptionPtr exceptions(new HashMapOfException());
+ auto values = std::make_shared<HashMapOfCacheable>();
+ auto exceptions = std::make_shared<HashMapOfException>();
getKeysVector(keys, 6);
RegionPtr rptr = getHelper()->getRegion(regionNamesAuth[0]);
rptr->getAll(keys, values, exceptions);
@@ -309,8 +310,8 @@ DUNIT_TASK_DEFINITION(READER2_CLIENT, StepFour)
createRegionForSecurity(regionNamesAuth[0], USE_ACK, true);
VectorOfCacheableKey keys;
- HashMapOfCacheablePtr values(new HashMapOfCacheable());
- HashMapOfExceptionPtr exceptions(new HashMapOfException());
+ auto values = std::make_shared<HashMapOfCacheable>();
+ auto exceptions = std::make_shared<HashMapOfException>();
getKeysVector(keys, 6);
RegionPtr rptr = getHelper()->getRegion(regionNamesAuth[0]);
rptr->getAll(keys, values, exceptions);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientStatistics.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientStatistics.cpp b/src/cppcache/integration-test/testThinClientStatistics.cpp
index af985d4..ec9e1d0 100644
--- a/src/cppcache/integration-test/testThinClientStatistics.cpp
+++ b/src/cppcache/integration-test/testThinClientStatistics.cpp
@@ -168,10 +168,10 @@ void DoRegionOpsAndVerify() {
bool flag ATTR_UNUSED = regPtr0->remove(keyptr);
RegionEntryPtr remRegEntry = regPtr0->getEntry(keyptr);
- ASSERT(remRegEntry == NULLPTR,
- "regionEntry pointer to removed entry must be NULLPTR");
+ ASSERT(remRegEntry == nullptr,
+ "regionEntry pointer to removed entry must be nullptr");
- if (remRegEntry != NULLPTR) {
+ if (remRegEntry != nullptr) {
LOGINFO("remRegEntry->isDestroyed() = %d ", remRegEntry->isDestroyed());
ASSERT(remRegEntry->isDestroyed() == true,
"regionEntry is not destroyed, remRegEntry->isDestroyed must return "
@@ -180,10 +180,10 @@ void DoRegionOpsAndVerify() {
LOGINFO("regionEntry pointer for removed key is NULL");
}
- CacheStatisticsPtr cacheStatptr(new CacheStatistics());
+ auto cacheStatptr = std::make_shared<CacheStatistics>();
// CacheStatisticsPtr cacheStatptr;
try {
- CachePtr cache = dynCast<CachePtr>(
+ auto cache = std::dynamic_pointer_cast<Cache>(
regPtr0->getRegionService()); // This depends on LocalCache
// implementing RegionService...
bool flag = cache->getDistributedSystem()
@@ -198,7 +198,7 @@ void DoRegionOpsAndVerify() {
} catch (Exception& ex) {
LOGINFO("Exception Caught:: %s", ex.getMessage());
}
- if (cacheStatptr != NULLPTR) {
+ if (cacheStatptr != nullptr) {
LOGINFO("LastAccessedTime = %d ", cacheStatptr->getLastAccessedTime());
} else {
LOGINFO("cacheStatptr is NULL");
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientTicket303.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientTicket303.cpp b/src/cppcache/integration-test/testThinClientTicket303.cpp
index 5617d9e..e369906 100644
--- a/src/cppcache/integration-test/testThinClientTicket303.cpp
+++ b/src/cppcache/integration-test/testThinClientTicket303.cpp
@@ -28,7 +28,7 @@ void createAuthzRegion() {
initCredentialGenerator();
initClientAuth('A');
RegionPtr regPtr = createOverflowRegion(regionNamesAuth[0], false, 1);
- ASSERT(regPtr != NULLPTR, "Failed to create region.");
+ ASSERT(regPtr != nullptr, "Failed to create region.");
LOG("Region created.");
}
DUNIT_TASK_DEFINITION(SERVER, StartServer1)
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientTicket317.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientTicket317.cpp b/src/cppcache/integration-test/testThinClientTicket317.cpp
index ff7d35e..bcd4e0e 100644
--- a/src/cppcache/integration-test/testThinClientTicket317.cpp
+++ b/src/cppcache/integration-test/testThinClientTicket317.cpp
@@ -37,7 +37,7 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, SetupClient1)
{
initClientWithPool(true, "__TEST_POOL1__", locatorsG, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
getHelper()->createPooledRegion(regionNames[0], false, locatorsG,
"__TEST_POOL1__", true, true);
LOG("Client1 started");
@@ -46,7 +46,7 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT2, SetupClient2)
{
initClientWithPool(true, "__TEST_POOL1__", locatorsG, "ServerGroup1",
- NULLPTR, 0, true);
+ nullptr, 0, true);
getHelper()->createPooledRegion(regionNames[0], false, locatorsG,
"__TEST_POOL1__", true, true);
LOG("Client2 started");
@@ -79,7 +79,7 @@ DUNIT_TASK_DEFINITION(CLIENT2, verifyKeyDestroyedOnServer)
{
RegionPtr regPtr = getHelper()->getRegion(regionNames[0]);
CacheablePtr value = regPtr->get(keys[0]);
- if (value != NULLPTR) {
+ if (value != nullptr) {
FAIL("Entry not destroyed on server.");
}
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientTracking.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientTracking.cpp b/src/cppcache/integration-test/testThinClientTracking.cpp
index 91eee59..9f8c0db 100644
--- a/src/cppcache/integration-test/testThinClientTracking.cpp
+++ b/src/cppcache/integration-test/testThinClientTracking.cpp
@@ -39,11 +39,11 @@ void createAuthzRegion() {
void verifyEntry(const char *value) {
RegionPtr rptr = getHelper()->getRegion(regionNamesAuth[0]);
RegionEntryPtr entry = rptr->getEntry("key-1");
- ASSERT(entry != NULLPTR, "Key should have been found in region.");
- CacheableStringPtr valuePtr = dynCast<CacheableStringPtr>(entry->getValue());
+ ASSERT(entry != nullptr, "Key should have been found in region.");
+ auto valuePtr = std::dynamic_pointer_cast<CacheableString>(entry->getValue());
char buf1[1024];
- if (valuePtr == NULLPTR) {
+ if (valuePtr == nullptr) {
FAIL("Value was null.");
}
sprintf(buf1, "value for key-1 is %s", valuePtr->asChar());
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testThinClientWriterException.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testThinClientWriterException.cpp b/src/cppcache/integration-test/testThinClientWriterException.cpp
index 4acb2f0..ded57fa 100644
--- a/src/cppcache/integration-test/testThinClientWriterException.cpp
+++ b/src/cppcache/integration-test/testThinClientWriterException.cpp
@@ -73,7 +73,7 @@ void initCredentialGenerator() {
}
}
- if (credentialGeneratorHandler == NULLPTR) {
+ if (credentialGeneratorHandler == nullptr) {
FAIL("credentialGeneratorHandler is NULL");
}
@@ -110,7 +110,7 @@ void initClientAuth() {
credentialGeneratorHandler->getAuthInit(config);
credentialGeneratorHandler->getAllowedCredentialsForOps(rt, config, NULL);
printf("User is %s Pass is %s ", config->find("security-username")->asChar(),
- (config->find("security-password") != NULLPTR
+ (config->find("security-password") != nullptr
? config->find("security-password")->asChar()
: " not set"));
try {
@@ -160,9 +160,9 @@ void startClient() {
int i = 102;
LOG("Creating region in READER_CLIENT , no-ack, no-cache, with-listener and "
"writer");
- regListener = new TallyListener();
+ regListener = std::make_shared<TallyListener>();
createRegionForSecurity(regionNamesAuth[0], false, true, regListener);
- regWriter = new TallyWriter();
+ regWriter = std::make_shared<TallyWriter>();
setCacheWriter(regionNamesAuth[0], regWriter);
rptr = getHelper()->getRegion(regionNamesAuth[0]);
rptr->registerAllKeys();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testUtils.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testUtils.hpp b/src/cppcache/integration-test/testUtils.hpp
index 5b85ebe..b5b59b8 100644
--- a/src/cppcache/integration-test/testUtils.hpp
+++ b/src/cppcache/integration-test/testUtils.hpp
@@ -48,11 +48,11 @@ namespace unitTests {
class TestUtils {
public:
static RegionInternal* getRegionInternal(RegionPtr& rptr) {
- return dynamic_cast<RegionInternal*>(rptr.ptr());
+ return dynamic_cast<RegionInternal*>(rptr.get());
}
static CacheImpl* getCacheImpl(const CachePtr& cptr) {
- return CacheRegionHelper::getCacheImpl(cptr.ptr());
+ return CacheRegionHelper::getCacheImpl(cptr.get());
}
static int testGetNumberOfPdxIds() {
@@ -102,7 +102,7 @@ class TestUtils {
int tries = 0;
bool found = false;
// @TODO: ? How will valPtr every point to something else in this loop?
- while ((found = (valPtr == NULLPTR)) && (tries < maxTry)) {
+ while ((found = (valPtr == nullptr)) && (tries < maxTry)) {
SLEEP(msleepTime);
tries++;
}
@@ -115,8 +115,8 @@ class TestUtils {
int tries = 0;
int val = 0;
do {
- valPtr = dynCast<CacheableStringPtr>(rptr->get(keyPtr));
- ASSERT(valPtr != NULLPTR, "value should not be null.");
+ valPtr = std::dynamic_pointer_cast<CacheableString>(rptr->get(keyPtr));
+ ASSERT(valPtr != nullptr, "value should not be null.");
val = atoi(valPtr->asChar());
SLEEP(msleepTime);
tries++;
@@ -125,7 +125,7 @@ class TestUtils {
}
static void showKeys(RegionPtr& rptr) {
char buf[2048];
- if (rptr == NULLPTR) {
+ if (rptr == nullptr) {
sprintf(buf, "this region does not exist!\n");
LOG(buf);
return;
@@ -139,13 +139,13 @@ class TestUtils {
char keyText[100];
v[i]->logString(keyText, 100);
sprintf(buf, "key[%u] = '%s'\n", i,
- (v[i] == NULLPTR) ? "NULL KEY" : keyText);
+ (v[i] == nullptr) ? "NULL KEY" : keyText);
LOG(buf);
}
}
static void showKeyValues(RegionPtr& rptr) {
char buf[2048];
- if (rptr == NULLPTR) {
+ if (rptr == nullptr) {
sprintf(buf, "this region does not exist!\n");
LOG(buf);
return;
@@ -159,17 +159,17 @@ class TestUtils {
CacheableKeyPtr keyPtr = v[i];
char keyText[100];
keyPtr->logString(keyText, 100);
- CacheableStringPtr valPtr =
- dynCast<CacheableStringPtr>(rptr->get(keyPtr));
+ auto valPtr =
+ std::dynamic_pointer_cast<CacheableString>(rptr->get(keyPtr));
sprintf(buf, "key[%u] = '%s', value[%u]='%s'\n", i,
- (keyPtr == NULLPTR) ? "NULL KEY" : keyText, i,
- (valPtr == NULLPTR) ? "NULL_VALUE" : valPtr->asChar());
+ (keyPtr == nullptr) ? "NULL KEY" : keyText, i,
+ (valPtr == nullptr) ? "NULL_VALUE" : valPtr->asChar());
LOG(buf);
}
}
static void showValues(RegionPtr& rptr) {
char buf[2048];
- if (rptr == NULLPTR) {
+ if (rptr == nullptr) {
sprintf(buf, "this region does not exist!\n");
LOG(buf);
return;
@@ -180,9 +180,9 @@ class TestUtils {
sprintf(buf, "Total values in region %s : %u\n", rptr->getName(), len);
LOG(buf);
for (uint32_t i = 0; i < len; i++) {
- CacheableStringPtr value = dynCast<CacheableStringPtr>(v[i]);
+ auto value = std::dynamic_pointer_cast<CacheableString>(v[i]);
sprintf(buf, "value[%u] = '%s'\n", i,
- (value == NULLPTR) ? "NULL VALUE" : value->asChar());
+ (value == nullptr) ? "NULL VALUE" : value->asChar());
LOG(buf);
}
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testXmlCacheCreationWithOverFlow.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testXmlCacheCreationWithOverFlow.cpp b/src/cppcache/integration-test/testXmlCacheCreationWithOverFlow.cpp
index d60b30d..e02db11 100644
--- a/src/cppcache/integration-test/testXmlCacheCreationWithOverFlow.cpp
+++ b/src/cppcache/integration-test/testXmlCacheCreationWithOverFlow.cpp
@@ -94,7 +94,7 @@ int testXmlCacheCreationWithOverflow() {
cout << "Root regions in Cache :" << endl;
for (int32_t i = 0; i < vrp.size(); i++) {
- cout << "vc[" << i << "].m_reaPtr=" << vrp.at(i).ptr() << endl;
+ cout << "vc[" << i << "].m_reaPtr=" << vrp.at(i).get() << endl;
cout << "vc[" << i << "]=" << vrp.at(i)->getName() << endl;
}
RegionPtr regPtr1 = vrp.at(0);
@@ -114,7 +114,7 @@ int testXmlCacheCreationWithOverflow() {
cout << "get subregions from the root region :" << vrp.at(0)->getName()
<< endl;
for (int32_t i = 0; i < vr.size(); i++) {
- cout << "vc[" << i << "].m_reaPtr=" << vr.at(i).ptr() << endl;
+ cout << "vc[" << i << "].m_reaPtr=" << vr.at(i).get() << endl;
cout << "vc[" << i << "]=" << vr.at(i)->getName() << endl;
}
@@ -125,11 +125,11 @@ int testXmlCacheCreationWithOverflow() {
VectorOfRegion vsr;
regPtr2->subregions(true, vsr);
for (uint32_t i = 0; i < static_cast<uint32_t>(vsr.size()); i++) {
- Region* regPtr = vsr.at(i).ptr();
+ Region* regPtr = vsr.at(i).get();
childName = regPtr->getName();
RegionPtr x = regPtr->getParentRegion();
- parentName = (x.ptr())->getName();
+ parentName = (x.get())->getName();
if (strcmp(childName, "SubSubRegion221") == 0) {
if (strcmp(parentName, "SubRegion22") != 0) {
cout << "Incorrect parent: tree structure not formed correctly" << endl;
@@ -146,7 +146,7 @@ int testXmlCacheCreationWithOverflow() {
cout << "Test the attributes of region" << endl;
RegionAttributesPtr raPtr = regPtr1->getAttributes();
- RegionAttributes* regAttr = raPtr.ptr();
+ RegionAttributes* regAttr = raPtr.get();
cout << "Attributes of root region Root1 are : " << endl;
bool cachingEnabled = regAttr->getCachingEnabled();
@@ -194,7 +194,7 @@ int testXmlCacheCreationWithOverflow() {
cout << "persistence library = " << regAttr->getPersistenceLibrary() << endl;
cout << "persistence function = " << regAttr->getPersistenceFactory() << endl;
PropertiesPtr pconfig = regAttr->getPersistenceProperties();
- if (pconfig != NULLPTR) {
+ if (pconfig != nullptr) {
cout << " persistence property is not null" << endl;
cout << " persistencedir = "
<< pconfig->find("PersistenceDirectory")->asChar() << endl;
@@ -205,16 +205,15 @@ int testXmlCacheCreationWithOverflow() {
cout << "****Attributes of Root1 are correctly set****" << endl;
RegionAttributesPtr raPtr2 = regPtr2->getAttributes();
- RegionAttributes* regAttr2 = raPtr2.ptr();
- const char* lib2 = regAttr2->getPersistenceLibrary();
- const char* libFun2 = regAttr2->getPersistenceFactory();
+ const char* lib2 = raPtr2->getPersistenceLibrary();
+ const char* libFun2 = raPtr2->getPersistenceFactory();
printf(" persistence library2 = %s\n", lib2);
printf(" persistence function2 = %s\n", libFun2);
- cout << "persistence library = " << regAttr2->getPersistenceLibrary() << endl;
- cout << "persistence function = " << regAttr2->getPersistenceFactory()
+ cout << "persistence library = " << raPtr2->getPersistenceLibrary() << endl;
+ cout << "persistence function = " << raPtr2->getPersistenceFactory()
<< endl;
- PropertiesPtr pconfig2 = regAttr2->getPersistenceProperties();
- if (pconfig2 != NULLPTR) {
+ PropertiesPtr pconfig2 = raPtr2->getPersistenceProperties();
+ if (pconfig2 != nullptr) {
cout << " persistence property is not null for Root2" << endl;
cout << " persistencedir2 = "
<< pconfig2->find("PersistenceDirectory")->asChar() << endl;
@@ -232,12 +231,12 @@ int testXmlCacheCreationWithOverflow() {
return -1;
}
- regPtr1 = NULLPTR;
- regPtr2 = NULLPTR;
+ regPtr1 = nullptr;
+ regPtr2 = nullptr;
if (!cptr->isClosed()) {
cptr->close();
- cptr = NULLPTR;
+ cptr = nullptr;
}
////////////////////////////testing of cache.xml completed///////////////////
@@ -301,9 +300,9 @@ int testXmlCacheCreationWithOverflow() {
cout << "disconnecting..." << endl;
try {
cout << "just before disconnecting..." << endl;
- if (cptr != NULLPTR && !cptr->isClosed()) {
+ if (cptr != nullptr && !cptr->isClosed()) {
cptr->close();
- cptr = NULLPTR;
+ cptr = nullptr;
}
} catch (Exception& ex) {
ex.showMessage();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/testXmlCacheCreationWithPools.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/testXmlCacheCreationWithPools.cpp b/src/cppcache/integration-test/testXmlCacheCreationWithPools.cpp
index 448c9b1..337a2e5 100644
--- a/src/cppcache/integration-test/testXmlCacheCreationWithPools.cpp
+++ b/src/cppcache/integration-test/testXmlCacheCreationWithPools.cpp
@@ -55,9 +55,9 @@ bool findString(string& item, CacheableStringArrayPtr array) {
}
bool checkStringArray(SLIST& first, CacheableStringArrayPtr second) {
- if (second == NULLPTR && first.size() > 0) return false;
+ if (second == nullptr && first.size() > 0) return false;
- if (second == NULLPTR && first.size() == 0) return true;
+ if (second == nullptr && first.size() == 0) return true;
if (first.size() != second->length()) return false;
@@ -82,7 +82,7 @@ bool checkPoolAttribs(PoolPtr pool, SLIST& locators, SLIST& servers,
bool prSingleHopEnabled, int updateLocatorListInterval) {
char logmsg[500] = {0};
- if (pool == NULLPTR) {
+ if (pool == nullptr) {
LOG("checkPoolAttribs: PoolPtr is NULL");
return false;
}
@@ -290,7 +290,7 @@ int testXmlCacheCreationWithPools() {
test::cout << "Root regions in Cache :" << test::endl;
for (int32_t i = 0; i < vrp.size(); i++) {
- test::cout << "vc[" << i << "].m_regionPtr=" << vrp.at(i).ptr()
+ test::cout << "vc[" << i << "].m_regionPtr=" << vrp.at(i).get()
<< test::endl;
test::cout << "vc[" << i << "]=" << vrp.at(i)->getName() << test::endl;
}
@@ -310,7 +310,7 @@ int testXmlCacheCreationWithPools() {
test::cout << "get subregions from the root region :" << vrp.at(0)->getName()
<< test::endl;
for (int32_t i = 0; i < vr.size(); i++) {
- test::cout << "vc[" << i << "].m_regionPtr=" << vr.at(i).ptr()
+ test::cout << "vc[" << i << "].m_regionPtr=" << vr.at(i).get()
<< test::endl;
test::cout << "vc[" << i << "]=" << vr.at(i)->getName() << test::endl;
}
@@ -389,7 +389,7 @@ int testXmlCacheCreationWithPools() {
if (!cptr->isClosed()) {
cptr->close();
- cptr = NULLPTR;
+ cptr = nullptr;
}
if (!check1 || !check2 || !check3) {
@@ -453,7 +453,7 @@ int testXmlCacheCreationWithPools() {
test::cout << "disconnecting..." << test::endl;
try {
test::cout << "just before disconnecting..." << test::endl;
- if (cptr != NULLPTR) cptr->close();
+ if (cptr != nullptr) cptr->close();
} catch (Exception& ex) {
ex.showMessage();
ex.printStackTrace();
@@ -506,27 +506,27 @@ int testXmlDeclarativeCacheCreation() {
test::cout << "Root regions in Cache :" << test::endl;
for (int32_t i = 0; i < vrp.size(); i++) {
- test::cout << "vc[" << i << "].m_reaPtr=" << vrp.at(i).ptr() << test::endl;
+ test::cout << "vc[" << i << "].m_reaPtr=" << vrp.at(i).get() << test::endl;
test::cout << "vc[" << i << "]=" << vrp.at(i)->getName() << test::endl;
}
RegionPtr regPtr1 = vrp.at(0);
RegionAttributesPtr raPtr = regPtr1->getAttributes();
- RegionAttributes* regAttr = raPtr.ptr();
+ RegionAttributes* regAttr = raPtr.get();
test::cout << "Test Attributes of root region Root1 " << test::endl;
test::cout << "Region name " << regPtr1->getName() << test::endl;
- if (regAttr->getCacheLoader() == NULLPTR) {
+ if (regAttr->getCacheLoader() == nullptr) {
test::cout << "Cache Loader not initialized." << test::endl;
return -1;
}
- if (regAttr->getCacheListener() == NULLPTR) {
+ if (regAttr->getCacheListener() == nullptr) {
test::cout << "Cache Listener not initialized." << test::endl;
return -1;
}
- if (regAttr->getCacheWriter() == NULLPTR) {
+ if (regAttr->getCacheWriter() == nullptr) {
test::cout << "Cache Writer not initialized." << test::endl;
return -1;
}
@@ -535,7 +535,7 @@ int testXmlDeclarativeCacheCreation() {
if (!cptr->isClosed()) {
cptr->close();
- cptr = NULLPTR;
+ cptr = nullptr;
}
return 0;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/AdminRegion.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/AdminRegion.cpp b/src/cppcache/src/AdminRegion.cpp
index c6a5de8..271fd66 100644
--- a/src/cppcache/src/AdminRegion.cpp
+++ b/src/cppcache/src/AdminRegion.cpp
@@ -20,35 +20,34 @@
#include "ThinClientRegion.hpp"
#include <statistics/StatisticsManager.hpp>
#include "ThinClientPoolDM.hpp"
-using namespace apache::geode::client;
-AdminRegion::AdminRegion(CacheImpl* cache, ThinClientBaseDM* distMan)
- : m_distMngr((ThinClientBaseDM*)0)
- /* adongre
- * CID 28925: Uninitialized pointer field (UNINIT_CTOR)
- */
- ,
- m_connectionMgr((TcrConnectionManager*)0),
- m_destroyPending(false) {
- m_fullPath = "/__ADMIN_CLIENT_HEALTH_MONITORING__";
- // Only if Stats are enabled
+namespace apache {
+namespace geode {
+namespace client {
+
+AdminRegionPtr AdminRegion::create(CacheImpl* cache,
+ ThinClientBaseDM* distMan) {
+ auto adminRegion = std::make_shared<AdminRegion>();
SystemProperties* props =
cache->getCache()->getDistributedSystem()->getSystemProperties();
if (props && props->statisticsEnabled()) {
// no need to create a region .. just create a cacheDistribution Manager
- m_connectionMgr = &(cache->tcrConnectionManager());
+ adminRegion->m_connectionMgr = &(cache->tcrConnectionManager());
if (!distMan) {
- m_distMngr = new ThinClientCacheDistributionManager(*m_connectionMgr);
+ adminRegion->m_distMngr =
+ new ThinClientCacheDistributionManager(*adminRegion->m_connectionMgr);
StatisticsManager* mngr = StatisticsManager::getExistingInstance();
if (mngr) {
// Register it with StatisticsManager
- mngr->RegisterAdminRegion(AdminRegionPtr(this));
+ mngr->RegisterAdminRegion(adminRegion);
}
} else {
- m_distMngr = distMan;
+ adminRegion->m_distMngr = distMan;
}
}
+
+ return adminRegion;
}
void AdminRegion::init() {
@@ -79,7 +78,7 @@ GfErrType AdminRegion::putNoThrow(const CacheableKeyPtr& keyPtr,
// put obj to region
GfErrType err = GF_NOERR;
- TcrMessagePut request(NULL, keyPtr, valuePtr, NULLPTR, false, m_distMngr,
+ TcrMessagePut request(NULL, keyPtr, valuePtr, nullptr, false, m_distMngr,
true, false, m_fullPath.c_str());
request.setMetaRegion(true);
TcrMessageReply reply(true, m_distMngr);
@@ -142,3 +141,7 @@ AdminRegion::~AdminRegion() {
const bool& AdminRegion::isDestroyed() { return m_destroyPending; }
ACE_RW_Thread_Mutex& AdminRegion::getRWLock() { return m_rwLock; }
+
+} // namespace client
+} // namespace geode
+} // namespace apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/AdminRegion.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/AdminRegion.hpp b/src/cppcache/src/AdminRegion.hpp
index 9c930f5..84f24f6 100644
--- a/src/cppcache/src/AdminRegion.hpp
+++ b/src/cppcache/src/AdminRegion.hpp
@@ -55,7 +55,8 @@ class CacheImpl;
*/
class AdminRegion : public SharedBase,
private NonCopyable,
- private NonAssignable {
+ private NonAssignable,
+ public std::enable_shared_from_this<AdminRegion> {
private:
ThinClientBaseDM* m_distMngr;
std::string m_fullPath;
@@ -67,14 +68,25 @@ class AdminRegion : public SharedBase,
const CacheablePtr& valuePtr);
TcrConnectionManager* getConnectionManager();
+ AdminRegion()
+ : m_distMngr(nullptr),
+ m_fullPath("/__ADMIN_CLIENT_HEALTH_MONITORING__"),
+ m_connectionMgr(nullptr),
+ m_destroyPending(false)
+ {}
+
+ ~AdminRegion();
+
+ FRIEND_STD_SHARED_PTR(AdminRegion)
+
public:
+ static std::shared_ptr<AdminRegion> create(CacheImpl* cache,
+ ThinClientBaseDM* distMan = NULL);
ACE_RW_Thread_Mutex& getRWLock();
const bool& isDestroyed();
void close();
void init();
void put(const CacheableKeyPtr& keyPtr, const CacheablePtr& valuePtr);
- AdminRegion(CacheImpl* cache, ThinClientBaseDM* distMan = NULL);
- ~AdminRegion();
friend class apache::geode::statistics::HostStatSampler;
};
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/AttributesFactory.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/AttributesFactory.cpp b/src/cppcache/src/AttributesFactory.cpp
index 249e078..ddfb220 100644
--- a/src/cppcache/src/AttributesFactory.cpp
+++ b/src/cppcache/src/AttributesFactory.cpp
@@ -15,14 +15,6 @@
* limitations under the License.
*/
-namespace apache {
-namespace geode {
-namespace client {
-class Region;
-} // namespace client
-} // namespace geode
-} // namespace apache
-
#include <geode/Cache.hpp>
#include <geode/ExpirationAttributes.hpp>
#include <Utils.hpp>
@@ -31,7 +23,12 @@ class Region;
#include <string>
#include <geode/Pool.hpp>
#include <geode/PoolManager.hpp>
-using namespace apache::geode::client;
+
+namespace apache {
+namespace geode {
+namespace client {
+
+class Region;
AttributesFactory::AttributesFactory() : m_regionAttributes() {}
@@ -115,13 +112,13 @@ void AttributesFactory::setStatisticsEnabled( bool statisticsEnabled)
}
*/
-RegionAttributesPtr AttributesFactory::createRegionAttributes() {
+std::unique_ptr<RegionAttributes> AttributesFactory::createRegionAttributes() {
RegionAttributesPtr res;
/*
if( m_regionAttributes.m_poolName != NULL )
{
PoolPtr pool= PoolManager::find( m_regionAttributes.m_poolName );
- if (pool == NULLPTR) {
+ if (pool == nullptr) {
throw IllegalStateException("Pool not found while creating region
attributes");
}
@@ -131,8 +128,8 @@ RegionAttributesPtr AttributesFactory::createRegionAttributes() {
}
*/
validateAttributes(m_regionAttributes);
- res = new RegionAttributes(m_regionAttributes);
- return res;
+ return std::unique_ptr<RegionAttributes>(
+ new RegionAttributes(m_regionAttributes));
}
void AttributesFactory::validateAttributes(RegionAttributes& attrs) {
@@ -161,7 +158,7 @@ void AttributesFactory::validateAttributes(RegionAttributes& attrs) {
}
if (attrs.m_diskPolicy != DiskPolicyType::NONE) {
- if (attrs.m_persistenceManager == NULLPTR &&
+ if (attrs.m_persistenceManager == nullptr &&
(attrs.m_persistenceLibrary == NULL ||
attrs.m_persistenceFactory == NULL)) {
throw IllegalStateException(
@@ -214,3 +211,7 @@ void AttributesFactory::setCloningEnabled(bool isClonable) {
void AttributesFactory::setConcurrencyChecksEnabled(bool enable) {
m_regionAttributes.setConcurrencyChecksEnabled(enable);
}
+
+} // namespace client
+} // namespace geode
+} // namespace apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/AttributesMutator.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/AttributesMutator.cpp b/src/cppcache/src/AttributesMutator.cpp
index 096d5c8..67042f2 100644
--- a/src/cppcache/src/AttributesMutator.cpp
+++ b/src/cppcache/src/AttributesMutator.cpp
@@ -25,7 +25,7 @@ namespace client {
AttributesMutator::AttributesMutator(const RegionPtr& region)
: m_region(region) {}
-AttributesMutator::~AttributesMutator() { m_region = NULLPTR; }
+AttributesMutator::~AttributesMutator() { m_region = nullptr; }
/** Sets the idleTimeout duration for region entries.
* @param idleTimeout the idleTimeout in seconds for entries in this region.
@@ -35,7 +35,7 @@ AttributesMutator::~AttributesMutator() { m_region = NULLPTR; }
* disabled to enabled or enabled to disabled.
*/
int32_t AttributesMutator::setEntryIdleTimeout(int32_t idleTimeout) {
- RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.ptr());
+ RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.get());
return rImpl->adjustEntryExpiryDuration(idleTimeout);
}
@@ -46,7 +46,7 @@ int32_t AttributesMutator::setEntryIdleTimeout(int32_t idleTimeout) {
*/
ExpirationAction::Action AttributesMutator::setEntryIdleTimeoutAction(
ExpirationAction::Action action) {
- RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.ptr());
+ RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.get());
return rImpl->adjustEntryExpiryAction(action);
}
@@ -58,7 +58,7 @@ ExpirationAction::Action AttributesMutator::setEntryIdleTimeoutAction(
* disabled to enabled or enabled to disabled.
*/
int32_t AttributesMutator::setEntryTimeToLive(int32_t timeToLive) {
- RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.ptr());
+ RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.get());
return rImpl->adjustEntryExpiryDuration(timeToLive);
}
@@ -69,7 +69,7 @@ int32_t AttributesMutator::setEntryTimeToLive(int32_t timeToLive) {
*/
ExpirationAction::Action AttributesMutator::setEntryTimeToLiveAction(
ExpirationAction::Action action) {
- RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.ptr());
+ RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.get());
return rImpl->adjustEntryExpiryAction(action);
}
@@ -81,7 +81,7 @@ ExpirationAction::Action AttributesMutator::setEntryTimeToLiveAction(
* disabled to enabled or enabled to disabled.
*/
int32_t AttributesMutator::setRegionIdleTimeout(int32_t idleTimeout) {
- RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.ptr());
+ RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.get());
return rImpl->adjustRegionExpiryDuration(idleTimeout);
}
@@ -91,7 +91,7 @@ int32_t AttributesMutator::setRegionIdleTimeout(int32_t idleTimeout) {
*/
ExpirationAction::Action AttributesMutator::setRegionIdleTimeoutAction(
ExpirationAction::Action action) {
- RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.ptr());
+ RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.get());
return rImpl->adjustRegionExpiryAction(action);
}
@@ -103,7 +103,7 @@ ExpirationAction::Action AttributesMutator::setRegionIdleTimeoutAction(
* disabled to enabled or enabled to disabled.
*/
int32_t AttributesMutator::setRegionTimeToLive(int32_t timeToLive) {
- RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.ptr());
+ RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.get());
return rImpl->adjustRegionExpiryDuration(timeToLive);
}
@@ -113,7 +113,7 @@ int32_t AttributesMutator::setRegionTimeToLive(int32_t timeToLive) {
*/
ExpirationAction::Action AttributesMutator::setRegionTimeToLiveAction(
ExpirationAction::Action action) {
- RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.ptr());
+ RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.get());
return rImpl->adjustRegionExpiryAction(action);
}
@@ -124,40 +124,40 @@ ExpirationAction::Action AttributesMutator::setRegionTimeToLiveAction(
* disabled to enabled or enabled to disabled.
*/
uint32_t AttributesMutator::setLruEntriesLimit(uint32_t entriesLimit) {
- RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.ptr());
+ RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.get());
return rImpl->adjustLruEntriesLimit(entriesLimit);
}
void AttributesMutator::setCacheListener(const CacheListenerPtr& aListener) {
- RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.ptr());
+ RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.get());
rImpl->adjustCacheListener(aListener);
}
void AttributesMutator::setCacheListener(const char* libpath,
const char* factoryFuncName) {
- RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.ptr());
+ RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.get());
rImpl->adjustCacheListener(libpath, factoryFuncName);
}
void AttributesMutator::setCacheLoader(const CacheLoaderPtr& aLoader) {
- RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.ptr());
+ RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.get());
rImpl->adjustCacheLoader(aLoader);
}
void AttributesMutator::setCacheLoader(const char* libpath,
const char* factoryFuncName) {
- RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.ptr());
+ RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.get());
rImpl->adjustCacheLoader(libpath, factoryFuncName);
}
void AttributesMutator::setCacheWriter(const CacheWriterPtr& aWriter) {
- RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.ptr());
+ RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.get());
rImpl->adjustCacheWriter(aWriter);
}
void AttributesMutator::setCacheWriter(const char* libpath,
const char* factoryFuncName) {
- RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.ptr());
+ RegionInternal* rImpl = dynamic_cast<RegionInternal*>(m_region.get());
rImpl->adjustCacheWriter(libpath, factoryFuncName);
}
} // namespace client
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/BucketServerLocation.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/BucketServerLocation.hpp b/src/cppcache/src/BucketServerLocation.hpp
index 00dda10..b5afea1 100644
--- a/src/cppcache/src/BucketServerLocation.hpp
+++ b/src/cppcache/src/BucketServerLocation.hpp
@@ -42,7 +42,7 @@ class BucketServerLocation : public ServerLocation {
m_bucketId(-1),
m_isPrimary(false),
m_version(0),
- m_serverGroups(NULLPTR),
+ m_serverGroups(nullptr),
m_numServerGroups(static_cast<int8_t>(0)) {}
BucketServerLocation(std::string host)
@@ -50,7 +50,7 @@ class BucketServerLocation : public ServerLocation {
m_bucketId(-1),
m_isPrimary(false),
m_version(0),
- m_serverGroups(NULLPTR),
+ m_serverGroups(nullptr),
m_numServerGroups(static_cast<int8_t>(0)) {}
BucketServerLocation(int bucketId, int port, std::string host, bool isPrimary,
@@ -59,7 +59,7 @@ class BucketServerLocation : public ServerLocation {
m_bucketId(bucketId),
m_isPrimary(isPrimary),
m_version(version),
- m_serverGroups(NULLPTR),
+ m_serverGroups(nullptr),
m_numServerGroups(static_cast<int8_t>(0)) {}
BucketServerLocation(int bucketId, int port, std::string host, bool isPrimary,
@@ -85,7 +85,7 @@ class BucketServerLocation : public ServerLocation {
m_serverGroups = CacheableStringArray::createNoCopy(ptrArr, size);
m_numServerGroups = static_cast<int8_t>(size);
} else {
- m_serverGroups = NULLPTR;
+ m_serverGroups = nullptr;
m_numServerGroups = static_cast<int8_t>(0);
}
}
@@ -104,7 +104,7 @@ class BucketServerLocation : public ServerLocation {
output.write(static_cast<int8_t>(m_numServerGroups));
if (m_numServerGroups > 0) {
for (int i = 0; i < m_numServerGroups; i++) {
- output.writeNativeString(m_serverGroups[i]->asChar());
+ output.writeNativeString((*m_serverGroups)[i]->asChar());
}
}
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/Cache.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/Cache.cpp b/src/cppcache/src/Cache.cpp
index c49ac3c..d7226ab 100644
--- a/src/cppcache/src/Cache.cpp
+++ b/src/cppcache/src/Cache.cpp
@@ -93,7 +93,7 @@ RegionPtr Cache::getRegion(const char* path) {
RegionPtr result;
m_cacheImpl->getRegion(path, result);
- if (result != NULLPTR) {
+ if (result != nullptr) {
if (isPoolInMultiuserMode(result)) {
LOGWARN(
"Pool [%s] attached with region [%s] is in multiuser authentication "
@@ -149,18 +149,14 @@ CacheTransactionManagerPtr Cache::getCacheTransactionManager() {
return m_cacheImpl->getCacheTransactionManager();
}
-Cache::Cache(const char* name, DistributedSystemPtr sys,
- bool ignorePdxUnreadFields, bool readPdxSerialized) {
- m_cacheImpl =
- new CacheImpl(this, name, sys, ignorePdxUnreadFields, readPdxSerialized);
-}
Cache::Cache(const char* name, DistributedSystemPtr sys, const char* id_data,
bool ignorePdxUnreadFields, bool readPdxSerialized) {
- m_cacheImpl = new CacheImpl(this, name, sys, id_data, ignorePdxUnreadFields,
- readPdxSerialized);
+ m_cacheImpl = std::unique_ptr<CacheImpl>(new CacheImpl(
+ this, name, sys, id_data, ignorePdxUnreadFields, readPdxSerialized));
}
-Cache::~Cache() { delete m_cacheImpl; }
+Cache::Cache() = default;
+Cache::~Cache() = default;
/** Initialize the cache by the contents of an xml file
* @param cacheXml
@@ -192,7 +188,7 @@ bool Cache::isPoolInMultiuserMode(RegionPtr regionPtr) {
if (poolName != NULL) {
PoolPtr poolPtr = PoolManager::find(poolName);
- if (poolPtr != NULLPTR && !poolPtr->isDestroyed()) {
+ if (poolPtr != nullptr && !poolPtr->isDestroyed()) {
return poolPtr->getMultiuserAuthentication();
}
}
@@ -208,14 +204,13 @@ bool Cache::getPdxReadSerialized() {
}
PdxInstanceFactoryPtr Cache::createPdxInstanceFactory(const char* className) {
- PdxInstanceFactoryPtr pIFPtr(new PdxInstanceFactoryImpl(className));
- return pIFPtr;
+ return std::make_shared<PdxInstanceFactoryImpl>(className);
}
RegionServicePtr Cache::createAuthenticatedView(
PropertiesPtr userSecurityProperties, const char* poolName) {
if (poolName == NULL) {
- if (!this->isClosed() && m_cacheImpl->getDefaultPool() != NULLPTR) {
+ if (!this->isClosed() && m_cacheImpl->getDefaultPool() != nullptr) {
return m_cacheImpl->getDefaultPool()->createSecureUserCache(
userSecurityProperties);
}
@@ -227,7 +222,7 @@ RegionServicePtr Cache::createAuthenticatedView(
if (!this->isClosed()) {
if (poolName != NULL) {
PoolPtr poolPtr = PoolManager::find(poolName);
- if (poolPtr != NULLPTR && !poolPtr->isDestroyed()) {
+ if (poolPtr != nullptr && !poolPtr->isDestroyed()) {
return poolPtr->createSecureUserCache(userSecurityProperties);
}
throw IllegalStateException(
@@ -238,5 +233,5 @@ RegionServicePtr Cache::createAuthenticatedView(
throw IllegalStateException("Cache has been closed");
}
- return NULLPTR;
+ return nullptr;
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/CacheConfig.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CacheConfig.cpp b/src/cppcache/src/CacheConfig.cpp
index 530df4e..35de702 100644
--- a/src/cppcache/src/CacheConfig.cpp
+++ b/src/cppcache/src/CacheConfig.cpp
@@ -122,7 +122,7 @@ bool CacheConfig::parseAttributes(const char* name, xmlNode* node) {
std::string cachingStr =
(caching == NULL ? "true" : reinterpret_cast<const char*>(caching));
- RegionConfigPtr reg(new RegionConfig(scopeStr, initialCapacityStr));
+ auto reg = std::make_shared<RegionConfig>(scopeStr, initialCapacityStr);
reg->setLru(limitStr);
reg->setConcurrency(concStr);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/CacheFactory.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CacheFactory.cpp b/src/cppcache/src/CacheFactory.cpp
index b6fca2a..ec332e5 100644
--- a/src/cppcache/src/CacheFactory.cpp
+++ b/src/cppcache/src/CacheFactory.cpp
@@ -55,26 +55,26 @@ typedef std::map<std::string, CachePtr> StringToCachePtrMap;
void* CacheFactory::m_cacheMap = (void*)NULL;
-CacheFactoryPtr CacheFactory::default_CacheFactory = NULLPTR;
+CacheFactoryPtr CacheFactory::default_CacheFactory = nullptr;
PoolPtr CacheFactory::createOrGetDefaultPool() {
ACE_Guard<ACE_Recursive_Thread_Mutex> connectGuard(*g_disconnectLock);
CachePtr cache = CacheFactory::getAnyInstance();
- if (cache != NULLPTR && cache->isClosed() == false &&
- cache->m_cacheImpl->getDefaultPool() != NULLPTR) {
+ if (cache != nullptr && cache->isClosed() == false &&
+ cache->m_cacheImpl->getDefaultPool() != nullptr) {
return cache->m_cacheImpl->getDefaultPool();
}
PoolPtr pool = PoolManager::find(DEFAULT_POOL_NAME);
// if default_poolFactory is null then we are not using latest API....
- if (pool == NULLPTR && Cache_CreatedFromCacheFactory) {
- if (default_CacheFactory != NULLPTR) {
+ if (pool == nullptr && Cache_CreatedFromCacheFactory) {
+ if (default_CacheFactory != nullptr) {
pool = default_CacheFactory->determineDefaultPool(cache);
}
- default_CacheFactory = NULLPTR;
+ default_CacheFactory = nullptr;
}
return pool;
@@ -82,9 +82,7 @@ PoolPtr CacheFactory::createOrGetDefaultPool() {
CacheFactoryPtr CacheFactory::createCacheFactory(
const PropertiesPtr& configPtr) {
- // need to create PoolFactory instance
- CacheFactoryPtr cf(new CacheFactory(configPtr));
- return cf;
+ return std::make_shared<CacheFactory>(configPtr);
}
void CacheFactory::init() {
@@ -101,12 +99,12 @@ void CacheFactory::create_(const char* name, DistributedSystemPtr& system,
bool ignorePdxUnreadFields, bool readPdxSerialized) {
CppCacheLibrary::initLib();
- cptr = NULLPTR;
+ cptr = nullptr;
if (!reinterpret_cast<StringToCachePtrMap*>(m_cacheMap)) {
throw IllegalArgumentException(
"CacheFactory::create: cache map is not initialized");
}
- if (system == NULLPTR) {
+ if (system == nullptr) {
throw IllegalArgumentException(
"CacheFactory::create: system uninitialized");
}
@@ -117,17 +115,13 @@ void CacheFactory::create_(const char* name, DistributedSystemPtr& system,
name = "NativeCache";
}
- CachePtr cp = NULLPTR;
+ CachePtr cp = nullptr;
basicGetInstance(system, true, cp);
- if ((cp == NULLPTR) || (cp->isClosed() == true)) {
- Cache* cep = new Cache(name, system, id_data, ignorePdxUnreadFields,
- readPdxSerialized);
- if (!cep) {
- throw OutOfMemoryException("Out of Memory");
- }
- cptr = cep;
+ if ((cp == nullptr) || (cp->isClosed() == true)) {
+ cptr = std::make_shared<Cache>(name, system, id_data, ignorePdxUnreadFields,
+ readPdxSerialized);
std::string key(system->getName());
- if (cp != NULLPTR) {
+ if (cp != nullptr) {
ACE_Guard<ACE_Recursive_Thread_Mutex> guard(g_cfLock);
(reinterpret_cast<StringToCachePtrMap*>(m_cacheMap))
->erase(
@@ -144,7 +138,7 @@ void CacheFactory::create_(const char* name, DistributedSystemPtr& system,
CachePtr CacheFactory::getInstance(const DistributedSystemPtr& system) {
CachePtr cptr;
CppCacheLibrary::initLib();
- if (system == NULLPTR) {
+ if (system == nullptr) {
throw IllegalArgumentException(
"CacheFactory::getInstance: system uninitialized");
}
@@ -156,7 +150,7 @@ CachePtr CacheFactory::getInstance(const DistributedSystemPtr& system) {
CachePtr CacheFactory::getInstanceCloseOk(const DistributedSystemPtr& system) {
CachePtr cptr;
CppCacheLibrary::initLib();
- if (system == NULLPTR) {
+ if (system == nullptr) {
throw IllegalArgumentException(
"CacheFactory::getInstanceClosedOK: system uninitialized");
}
@@ -176,7 +170,7 @@ CachePtr CacheFactory::getAnyInstance(bool throwException) {
throw EntryNotFoundException(
"CacheFactory::getAnyInstance: not found, no cache created yet");
} else {
- return NULLPTR;
+ return nullptr;
}
}
for (StringToCachePtrMap::iterator p =
@@ -187,7 +181,7 @@ CachePtr CacheFactory::getAnyInstance(bool throwException) {
return cptr;
}
}
- return NULLPTR;
+ return nullptr;
}
const char* CacheFactory::getVersion() { return PRODUCT_VERSION; }
@@ -200,15 +194,15 @@ const char* CacheFactory::getProductDescription() {
CacheFactory::CacheFactory() {
ignorePdxUnreadFields = false;
pdxReadSerialized = false;
- dsProp = NULLPTR;
- pf = NULLPTR;
+ dsProp = nullptr;
+ pf = nullptr;
}
CacheFactory::CacheFactory(const PropertiesPtr dsProps) {
ignorePdxUnreadFields = false;
pdxReadSerialized = false;
this->dsProp = dsProps;
- this->pf = NULLPTR;
+ this->pf = nullptr;
}
CachePtr CacheFactory::create() {
@@ -216,7 +210,7 @@ CachePtr CacheFactory::create() {
// bool pdxReadSerialized = false;
ACE_Guard<ACE_Recursive_Thread_Mutex> connectGuard(*g_disconnectLock);
- DistributedSystemPtr dsPtr = NULLPTR;
+ DistributedSystemPtr dsPtr = nullptr;
// should we compare deafult DS properties here??
if (DistributedSystem::isConnected()) {
@@ -226,27 +220,26 @@ CachePtr CacheFactory::create() {
LOGFINE("CacheFactory called DistributedSystem::connect");
}
- CachePtr cache = NULLPTR;
+ CachePtr cache = nullptr;
cache = getAnyInstance(false);
- if (cache == NULLPTR) {
- CacheFactoryPtr cacheFac(this);
- default_CacheFactory = cacheFac;
+ if (cache == nullptr) {
+ default_CacheFactory = shared_from_this();
Cache_CreatedFromCacheFactory = true;
cache = create(DEFAULT_CACHE_NAME, dsPtr,
- dsPtr->getSystemProperties()->cacheXMLFile(), NULLPTR);
- // if(cache->m_cacheImpl->getDefaultPool() == NULLPTR)
+ dsPtr->getSystemProperties()->cacheXMLFile(), nullptr);
+ // if(cache->m_cacheImpl->getDefaultPool() == nullptr)
// determineDefaultPool(cache);
} else {
- if (cache->m_cacheImpl->getDefaultPool() != NULLPTR) {
+ if (cache->m_cacheImpl->getDefaultPool() != nullptr) {
// we already choose or created deafult pool
determineDefaultPool(cache);
} else {
// not yet created, create from first cacheFactory instance
- if (default_CacheFactory != NULLPTR) {
+ if (default_CacheFactory != nullptr) {
default_CacheFactory->determineDefaultPool(cache);
- default_CacheFactory = NULLPTR;
+ default_CacheFactory = nullptr;
}
determineDefaultPool(cache);
}
@@ -265,9 +258,9 @@ CachePtr CacheFactory::create() {
}
CachePtr CacheFactory::create(const char* name,
- DistributedSystemPtr system /*= NULLPTR*/,
+ DistributedSystemPtr system /*= nullptr*/,
const char* cacheXml /*= 0*/,
- const CacheAttributesPtr& attrs /*= NULLPTR*/) {
+ const CacheAttributesPtr& attrs /*= nullptr*/) {
ACE_Guard<ACE_Recursive_Thread_Mutex> connectGuard(*g_disconnectLock);
CachePtr cptr;
@@ -290,13 +283,13 @@ CachePtr CacheFactory::create(const char* name,
} catch (const apache::geode::client::Exception&) {
if (!cptr->isClosed()) {
cptr->close();
- cptr = NULLPTR;
+ cptr = nullptr;
}
throw;
} catch (...) {
if (!cptr->isClosed()) {
cptr->close();
- cptr = NULLPTR;
+ cptr = nullptr;
}
throw apache::geode::client::UnknownException(
"Exception thrown in CacheFactory::create");
@@ -306,12 +299,12 @@ CachePtr CacheFactory::create(const char* name,
}
PoolPtr CacheFactory::determineDefaultPool(CachePtr cachePtr) {
- PoolPtr pool = NULLPTR;
+ PoolPtr pool = nullptr;
HashMapOfPools allPools = PoolManager::getAll();
size_t currPoolSize = allPools.size();
// means user has not set any pool attributes
- if (this->pf == NULLPTR) {
+ if (this->pf == nullptr) {
this->pf = getPoolFactory();
if (currPoolSize == 0) {
if (!this->pf->m_addedServerOrLocator) {
@@ -330,7 +323,7 @@ PoolPtr CacheFactory::determineDefaultPool(CachePtr cachePtr) {
return pool;
} else {
// can't set anything as deafult pool
- return NULLPTR;
+ return nullptr;
}
} else {
PoolPtr defaulPool = cachePtr->m_cacheImpl->getDefaultPool();
@@ -339,7 +332,7 @@ PoolPtr CacheFactory::determineDefaultPool(CachePtr cachePtr) {
this->pf->addServer(DEFAULT_SERVER_HOST, DEFAULT_SERVER_PORT);
}
- if (defaulPool != NULLPTR) {
+ if (defaulPool != nullptr) {
// once default pool is created, we will not create
if (*(defaulPool->m_attrs) == *(this->pf->m_attrs)) {
return defaulPool;
@@ -349,21 +342,20 @@ PoolPtr CacheFactory::determineDefaultPool(CachePtr cachePtr) {
}
}
- pool = NULLPTR;
+ pool = nullptr;
// return any existing pool if it matches
- for (HashMapOfPools::Iterator iter = allPools.begin();
- iter != allPools.end(); ++iter) {
- PoolPtr currPool(iter.second());
+ for (auto iter = allPools.begin(); iter != allPools.end(); ++iter) {
+ auto currPool = iter.second();
if (*(currPool->m_attrs) == *(this->pf->m_attrs)) {
return currPool;
}
}
// defaul pool is null
- GF_DEV_ASSERT(defaulPool == NULLPTR);
+ GF_DEV_ASSERT(defaulPool == nullptr);
- if (defaulPool == NULLPTR) {
+ if (defaulPool == nullptr) {
pool = this->pf->create(DEFAULT_POOL_NAME);
LOGINFO("Created default pool");
// creating default so setting this as defaul pool
@@ -375,7 +367,7 @@ PoolPtr CacheFactory::determineDefaultPool(CachePtr cachePtr) {
}
PoolFactoryPtr CacheFactory::getPoolFactory() {
- if (this->pf == NULLPTR) {
+ if (this->pf == nullptr) {
this->pf = PoolManager::createFactory();
}
return this->pf;
@@ -395,10 +387,10 @@ void CacheFactory::cleanup() {
GfErrType CacheFactory::basicGetInstance(const DistributedSystemPtr& system,
const bool closeOk, CachePtr& cptr) {
GfErrType err = GF_NOERR;
- if (system == NULLPTR) {
+ if (system == nullptr) {
return GF_CACHE_ILLEGAL_ARGUMENT_EXCEPTION;
}
- cptr = NULLPTR;
+ cptr = nullptr;
ACE_Guard<ACE_Recursive_Thread_Mutex> guard(g_cfLock);
if ((reinterpret_cast<StringToCachePtrMap*>(m_cacheMap))->empty() == true) {
return GF_CACHE_ENTRY_NOT_FOUND;
@@ -448,135 +440,111 @@ void CacheFactory::handleXML(CachePtr& cachePtr, const char* cachexml,
}
CacheFactoryPtr CacheFactory::set(const char* name, const char* value) {
- if (this->dsProp == NULLPTR) this->dsProp = Properties::create();
+ if (this->dsProp == nullptr) this->dsProp = Properties::create();
this->dsProp->insert(name, value);
- CacheFactoryPtr cfPtr(this);
- return cfPtr;
+ return shared_from_this();
}
CacheFactoryPtr CacheFactory::setFreeConnectionTimeout(int connectionTimeout) {
getPoolFactory()->setFreeConnectionTimeout(connectionTimeout);
- CacheFactoryPtr cfPtr(this);
- return cfPtr;
+ return shared_from_this();
}
CacheFactoryPtr CacheFactory::setLoadConditioningInterval(
int loadConditioningInterval) {
getPoolFactory()->setLoadConditioningInterval(loadConditioningInterval);
- CacheFactoryPtr cfPtr(this);
- return cfPtr;
+ return shared_from_this();
}
CacheFactoryPtr CacheFactory::setSocketBufferSize(int bufferSize) {
getPoolFactory()->setSocketBufferSize(bufferSize);
- CacheFactoryPtr cfPtr(this);
- return cfPtr;
+ return shared_from_this();
}
CacheFactoryPtr CacheFactory::setThreadLocalConnections(
bool threadLocalConnections) {
getPoolFactory()->setThreadLocalConnections(threadLocalConnections);
- CacheFactoryPtr cfPtr(this);
- return cfPtr;
+ return shared_from_this();
}
CacheFactoryPtr CacheFactory::setReadTimeout(int timeout) {
getPoolFactory()->setReadTimeout(timeout);
- CacheFactoryPtr cfPtr(this);
- return cfPtr;
+ return shared_from_this();
}
CacheFactoryPtr CacheFactory::setMinConnections(int minConnections) {
getPoolFactory()->setMinConnections(minConnections);
- CacheFactoryPtr cfPtr(this);
- return cfPtr;
+ return shared_from_this();
}
CacheFactoryPtr CacheFactory::setMaxConnections(int maxConnections) {
getPoolFactory()->setMaxConnections(maxConnections);
- CacheFactoryPtr cfPtr(this);
- return cfPtr;
+ return shared_from_this();
}
CacheFactoryPtr CacheFactory::setIdleTimeout(long idleTimeout) {
getPoolFactory()->setIdleTimeout(idleTimeout);
- CacheFactoryPtr cfPtr(this);
- return cfPtr;
+ return shared_from_this();
}
CacheFactoryPtr CacheFactory::setRetryAttempts(int retryAttempts) {
getPoolFactory()->setRetryAttempts(retryAttempts);
- CacheFactoryPtr cfPtr(this);
- return cfPtr;
+ return shared_from_this();
}
CacheFactoryPtr CacheFactory::setPingInterval(long pingInterval) {
getPoolFactory()->setPingInterval(pingInterval);
- CacheFactoryPtr cfPtr(this);
- return cfPtr;
+ return shared_from_this();
}
CacheFactoryPtr CacheFactory::setUpdateLocatorListInterval(
long updateLocatorListInterval) {
getPoolFactory()->setUpdateLocatorListInterval(updateLocatorListInterval);
- CacheFactoryPtr cfPtr(this);
- return cfPtr;
+ return shared_from_this();
}
CacheFactoryPtr CacheFactory::setStatisticInterval(int statisticInterval) {
getPoolFactory()->setStatisticInterval(statisticInterval);
- CacheFactoryPtr cfPtr(this);
- return cfPtr;
+ return shared_from_this();
}
CacheFactoryPtr CacheFactory::setServerGroup(const char* group) {
getPoolFactory()->setServerGroup(group);
- CacheFactoryPtr cfPtr(this);
- return cfPtr;
+ return shared_from_this();
}
CacheFactoryPtr CacheFactory::addLocator(const char* host, int port) {
getPoolFactory()->addLocator(host, port);
- CacheFactoryPtr cfPtr(this);
- return cfPtr;
+ return shared_from_this();
}
CacheFactoryPtr CacheFactory::addServer(const char* host, int port) {
getPoolFactory()->addServer(host, port);
- CacheFactoryPtr cfPtr(this);
- return cfPtr;
+ return shared_from_this();
}
CacheFactoryPtr CacheFactory::setSubscriptionEnabled(bool enabled) {
getPoolFactory()->setSubscriptionEnabled(enabled);
- CacheFactoryPtr cfPtr(this);
- return cfPtr;
+ return shared_from_this();
}
CacheFactoryPtr CacheFactory::setSubscriptionRedundancy(int redundancy) {
getPoolFactory()->setSubscriptionRedundancy(redundancy);
- CacheFactoryPtr cfPtr(this);
- return cfPtr;
+ return shared_from_this();
}
CacheFactoryPtr CacheFactory::setSubscriptionMessageTrackingTimeout(
int messageTrackingTimeout) {
getPoolFactory()->setSubscriptionMessageTrackingTimeout(
messageTrackingTimeout);
- CacheFactoryPtr cfPtr(this);
- return cfPtr;
+ return shared_from_this();
}
CacheFactoryPtr CacheFactory::setSubscriptionAckInterval(int ackInterval) {
getPoolFactory()->setSubscriptionAckInterval(ackInterval);
- CacheFactoryPtr cfPtr(this);
- return cfPtr;
+ return shared_from_this();
}
CacheFactoryPtr CacheFactory::setMultiuserAuthentication(
bool multiuserAuthentication) {
getPoolFactory()->setMultiuserAuthentication(multiuserAuthentication);
- CacheFactoryPtr cfPtr(this);
- return cfPtr;
+ return shared_from_this();
}
CacheFactoryPtr CacheFactory::setPRSingleHopEnabled(bool enabled) {
getPoolFactory()->setPRSingleHopEnabled(enabled);
- CacheFactoryPtr cfPtr(this);
- return cfPtr;
+ return shared_from_this();
}
CacheFactoryPtr CacheFactory::setPdxIgnoreUnreadFields(bool ignore) {
ignorePdxUnreadFields = ignore;
- CacheFactoryPtr cfPtr(this);
- return cfPtr;
+ return shared_from_this();
}
CacheFactoryPtr CacheFactory::setPdxReadSerialized(bool prs) {
pdxReadSerialized = prs;
- CacheFactoryPtr cfPtr(this);
- return cfPtr;
+ return shared_from_this();
}
} // namespace client
} // namespace geode
[06/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from cppcache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/PdxType.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxType.cpp b/src/cppcache/src/PdxType.cpp
index 3fd619a..f5fb711 100644
--- a/src/cppcache/src/PdxType.cpp
+++ b/src/cppcache/src/PdxType.cpp
@@ -44,7 +44,7 @@ PdxType::~PdxType() {
}
PdxType::PdxType() : Serializable() {
- // m_lockObj = NULLPTR;
+ // m_lockObj = nullptr;
m_className = NULL;
m_isLocal = false;
m_numberOfVarLenFields = 0;
@@ -69,7 +69,7 @@ PdxType::PdxType() : Serializable() {
PdxType::PdxType(const char* pdxDomainClassName, bool isLocal)
: Serializable() {
- // m_lockObj = NULLPTR;
+ // m_lockObj = nullptr;
m_className = Utils::copyString(pdxDomainClassName);
m_isLocal = isLocal;
m_numberOfVarLenFields = 0;
@@ -146,7 +146,7 @@ Serializable* PdxType::fromData(DataInput& input) {
bool foundVarLenType = false;
for (int i = 0; i < len; i++) {
- PdxFieldTypePtr pft(new PdxFieldType());
+ auto pft = std::make_shared<PdxFieldType>();
pft->fromData(input);
m_pdxFieldTypes->push_back(pft);
@@ -190,9 +190,9 @@ void PdxType::addFixedLengthTypeField(const char* fieldName,
fieldName);
throw IllegalStateException(excpStr);
}
- PdxFieldTypePtr pfxPtr(new PdxFieldType(
+ auto pfxPtr = std::make_shared<PdxFieldType>(
fieldName, className, typeId, static_cast<int32_t>(m_pdxFieldTypes->size()),
- false, size, 0));
+ false, size, 0);
m_pdxFieldTypes->push_back(pfxPtr);
m_fieldNameVsPdxType[fieldName] = pfxPtr;
}
@@ -217,9 +217,9 @@ void PdxType::addVariableLengthTypeField(const char* fieldName,
}
m_numberOfVarLenFields++;
m_isVarLenFieldAdded = true;
- PdxFieldTypePtr pfxPtr(new PdxFieldType(
+ auto pfxPtr = std::make_shared<PdxFieldType>(
fieldName, className, typeId, static_cast<int32_t>(m_pdxFieldTypes->size()),
- true, -1, m_varLenFieldIdx));
+ true, -1, m_varLenFieldIdx);
m_pdxFieldTypes->push_back(pfxPtr);
m_fieldNameVsPdxType[fieldName] = pfxPtr;
}
@@ -239,12 +239,12 @@ void PdxType::initRemoteToLocal() {
// -1 = local type don't have this VariableLengthType field
// -2 = local type don't have this FixedLengthType field
- PdxTypePtr localPdxType = NULLPTR;
+ PdxTypePtr localPdxType = nullptr;
//[TODO - open this up once PdxTypeRegistry is done]
localPdxType = PdxTypeRegistry::getLocalPdxType(m_className);
m_numberOfFieldsExtra = 0;
- if (localPdxType != NULLPTR) {
+ if (localPdxType != nullptr) {
std::vector<PdxFieldTypePtr>* localPdxFields =
localPdxType->getPdxFieldTypes();
int32_t fieldIdx = 0;
@@ -262,8 +262,8 @@ void PdxType::initRemoteToLocal() {
for (std::vector<PdxFieldTypePtr>::iterator localPdxfield =
localPdxFields->begin();
localPdxfield != localPdxFields->end(); ++localPdxfield) {
- // PdxFieldType* remotePdx = (*(remotePdxField)).ptr();
- // PdxFieldType* localPdx = (*(localPdxfield)).ptr();
+ // PdxFieldType* remotePdx = (*(remotePdxField)).get();
+ // PdxFieldType* localPdx = (*(localPdxfield)).get();
if ((*localPdxfield)->equals(*remotePdxField)) {
found = true;
m_remoteToLocalFieldMap[fieldIdx++] = 1; // field there in remote
@@ -275,7 +275,7 @@ void PdxType::initRemoteToLocal() {
if (!found) {
// while writing take this from weakhashmap
// local field is not in remote type
- // if((*(remotePdxField)).ptr()->IsVariableLengthType()) {
+ // if((*(remotePdxField)).get()->IsVariableLengthType()) {
if ((*remotePdxField)->IsVariableLengthType()) {
m_remoteToLocalFieldMap[fieldIdx++] =
-1; // local type don't have this fields
@@ -300,10 +300,10 @@ void PdxType::initLocalToRemote() {
// then mark m_localToRemoteFieldMap with remotePdxField sequenceId
// 5. else if local field is not in remote type then -1
- PdxTypePtr localPdxType = NULLPTR;
+ PdxTypePtr localPdxType = nullptr;
localPdxType = PdxTypeRegistry::getLocalPdxType(m_className);
- if (localPdxType != NULLPTR) {
+ if (localPdxType != nullptr) {
std::vector<PdxFieldTypePtr>* localPdxFields =
localPdxType->getPdxFieldTypes();
@@ -316,8 +316,8 @@ void PdxType::initLocalToRemote() {
for (int32_t i = 0; i < localToRemoteFieldMapSize &&
i < static_cast<int32_t>(m_pdxFieldTypes->size());
i++) {
- // PdxFieldType* localPdx = localPdxFields->at(fieldIdx).ptr();
- // PdxFieldType* remotePdx = m_pdxFieldTypes->at(i).ptr();
+ // PdxFieldType* localPdx = localPdxFields->at(fieldIdx).get();
+ // PdxFieldType* remotePdx = m_pdxFieldTypes->at(i).get();
if (localPdxFields->at(fieldIdx)->equals(m_pdxFieldTypes->at(i))) {
// fields are in same order, we can read as it is
m_localToRemoteFieldMap[fieldIdx++] = -2;
@@ -336,8 +336,8 @@ void PdxType::initLocalToRemote() {
remotePdxfield != m_pdxFieldTypes->end(); ++remotePdxfield)
// for each(PdxFieldType^ remotePdxfield in m_pdxFieldTypes)
{
- // PdxFieldType* localPdx = localPdxField.ptr();
- PdxFieldType* remotePdx = (*(remotePdxfield)).ptr();
+ // PdxFieldType* localPdx = localPdxField.get();
+ PdxFieldType* remotePdx = (*(remotePdxfield)).get();
if (localPdxField->equals(*remotePdxfield)) {
found = true;
// store pdxfield type position to get the offset quickly
@@ -364,7 +364,7 @@ int32_t PdxType::getFieldPosition(const char* fieldName,
uint8_t* offsetPosition, int32_t offsetSize,
int32_t pdxStreamlen) {
PdxFieldTypePtr pft = this->getPdxField(fieldName);
- if (pft != NULLPTR) {
+ if (pft != nullptr) {
if (pft->IsVariableLengthType()) {
return variableLengthFieldPosition(pft, offsetPosition, offsetSize,
pdxStreamlen);
@@ -379,7 +379,7 @@ int32_t PdxType::getFieldPosition(const char* fieldName,
int32_t PdxType::getFieldPosition(int32_t fieldIdx, uint8_t* offsetPosition,
int32_t offsetSize, int32_t pdxStreamlen) {
PdxFieldTypePtr pft = m_pdxFieldTypes->at(fieldIdx);
- if (pft != NULLPTR) {
+ if (pft != nullptr) {
if (pft->IsVariableLengthType()) {
return variableLengthFieldPosition(pft, offsetPosition, offsetSize,
pdxStreamlen);
@@ -464,20 +464,20 @@ PdxTypePtr PdxType::isContains(PdxTypePtr first, PdxTypePtr second) {
bool matched = false;
for (; j < static_cast<int>(first->m_pdxFieldTypes->size()); j++) {
PdxFieldTypePtr firstPdt = first->m_pdxFieldTypes->at(j);
- // PdxFieldType* firstType = firstPdt.ptr();
- // PdxFieldType* secondType = secondPdt.ptr();
+ // PdxFieldType* firstType = firstPdt.get();
+ // PdxFieldType* secondType = secondPdt.get();
if (firstPdt->equals(secondPdt)) {
matched = true;
break;
}
}
- if (!matched) return NULLPTR;
+ if (!matched) return nullptr;
}
return first;
}
PdxTypePtr PdxType::clone() {
- PdxTypePtr clone(new PdxType(m_className, false));
+ auto clone = std::make_shared<PdxType>(m_className, false);
clone->m_geodeTypeId = 0;
clone->m_numberOfVarLenFields = m_numberOfVarLenFields;
@@ -491,25 +491,25 @@ PdxTypePtr PdxType::clone() {
PdxTypePtr PdxType::isLocalTypeContains(PdxTypePtr otherType) {
if (m_pdxFieldTypes->size() >= otherType->m_pdxFieldTypes->size()) {
- return isContains(PdxTypePtr(this), otherType);
+ return isContains(shared_from_this(), otherType);
}
- return NULLPTR;
+ return nullptr;
}
PdxTypePtr PdxType::isRemoteTypeContains(PdxTypePtr remoteType) {
if (m_pdxFieldTypes->size() <= remoteType->m_pdxFieldTypes->size()) {
- return isContains(remoteType, PdxTypePtr(this));
+ return isContains(remoteType, shared_from_this());
}
- return NULLPTR;
+ return nullptr;
}
PdxTypePtr PdxType::mergeVersion(PdxTypePtr otherVersion) {
// int nTotalFields = otherVersion->m_pdxFieldTypes->size();
- PdxTypePtr contains = NULLPTR;
+ PdxTypePtr contains = nullptr;
- if (isLocalTypeContains(otherVersion) != NULLPTR) return PdxTypePtr(this);
+ if (isLocalTypeContains(otherVersion) != nullptr) return shared_from_this();
- if (isRemoteTypeContains(otherVersion) != NULLPTR) return otherVersion;
+ if (isRemoteTypeContains(otherVersion) != nullptr) return otherVersion;
// need to create new one, clone of local
PdxTypePtr newone = clone();
@@ -529,13 +529,13 @@ PdxTypePtr PdxType::mergeVersion(PdxTypePtr otherVersion) {
}
}
if (!found) {
- PdxFieldTypePtr newFt(new PdxFieldType(
+ auto newFt = std::make_shared< PdxFieldType>(
(*it)->getFieldName(), (*it)->getClassName(), (*it)->getTypeId(),
static_cast<int32_t>(newone->m_pdxFieldTypes->size()), // sequence id
(*it)->IsVariableLengthType(), (*it)->getFixedSize(),
((*it)->IsVariableLengthType()
? varLenFields++ /*it increase after that*/
- : 0)));
+ : 0));
newone->m_pdxFieldTypes->push_back(
newFt); // fieldnameVsPFT will happen after that
}
@@ -554,7 +554,7 @@ void PdxType::generatePositionMap() {
int lastVarLenSeqId = 0;
int prevFixedSizeOffsets = 0;
// set offsets from back first
- PdxFieldTypePtr previousField = NULLPTR;
+ PdxFieldTypePtr previousField = nullptr;
for (int i = static_cast<int>(m_pdxFieldTypes->size()) - 1; i >= 0; i--) {
PdxFieldTypePtr tmpft = m_pdxFieldTypes->at(i);
@@ -577,7 +577,7 @@ void PdxType::generatePositionMap() {
tmpft->setVarLenOffsetIndex(-1); // Pdx header length
// relative offset is subtracted from var len offsets
tmpft->setRelativeOffset(-tmpft->getFixedSize());
- if (previousField != NULLPTR) { // boundary condition
+ if (previousField != nullptr) { // boundary condition
tmpft->setRelativeOffset(-tmpft->getFixedSize() +
previousField->getRelativeOffset());
}
@@ -606,9 +606,9 @@ void PdxType::generatePositionMap() {
}
bool PdxType::Equals(PdxTypePtr otherObj) {
- if (otherObj == NULLPTR) return false;
+ if (otherObj == nullptr) return false;
- PdxType* ot = dynamic_cast<PdxType*>(otherObj.ptr());
+ PdxType* ot = dynamic_cast<PdxType*>(otherObj.get());
if (ot == NULL) return false;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/PdxType.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxType.hpp b/src/cppcache/src/PdxType.hpp
index 157e01a..cefafa2 100644
--- a/src/cppcache/src/PdxType.hpp
+++ b/src/cppcache/src/PdxType.hpp
@@ -102,6 +102,10 @@ class PdxType : public Serializable,
PdxTypePtr isLocalTypeContains(PdxTypePtr otherType);
PdxTypePtr isRemoteTypeContains(PdxTypePtr localType);
+ PdxTypePtr shared_from_this() {
+ return std::static_pointer_cast<PdxType>(Serializable::shared_from_this());
+ }
+
public:
PdxType();
@@ -172,7 +176,7 @@ class PdxType : public Serializable,
if (iter != m_fieldNameVsPdxType.end()) {
return (*iter).second;
}
- return NULLPTR;
+ return nullptr;
}
bool isLocal() const { return m_isLocal; }
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/PdxTypeRegistry.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxTypeRegistry.cpp b/src/cppcache/src/PdxTypeRegistry.cpp
index d3d1fba..6f34b9f 100644
--- a/src/cppcache/src/PdxTypeRegistry.cpp
+++ b/src/cppcache/src/PdxTypeRegistry.cpp
@@ -39,9 +39,9 @@ TypeNameVsPdxType* PdxTypeRegistry::localTypeToPdxType = NULL;
// *PdxTypeRegistry::preserveData = NULL;
PreservedHashMap PdxTypeRegistry::preserveData;
-CacheableHashMapPtr PdxTypeRegistry::enumToInt = NULLPTR;
+CacheableHashMapPtr PdxTypeRegistry::enumToInt = nullptr;
-CacheableHashMapPtr PdxTypeRegistry::intToEnum = NULLPTR;
+CacheableHashMapPtr PdxTypeRegistry::intToEnum = nullptr;
ACE_RW_Thread_Mutex PdxTypeRegistry::g_readerWriterLock;
@@ -94,7 +94,7 @@ int32_t PdxTypeRegistry::getPDXIdForType(const char* type, const char* poolname,
// WriteGuard guard(g_readerWriterLock);
if (checkIfThere) {
PdxTypePtr lpdx = getLocalPdxType(type);
- if (lpdx != NULLPTR) {
+ if (lpdx != nullptr) {
int id = lpdx->getTypeId();
if (id != 0) {
return id;
@@ -147,9 +147,9 @@ void PdxTypeRegistry::clear() {
if (localTypeToPdxType != NULL) localTypeToPdxType->clear();
- if (intToEnum != NULLPTR) intToEnum->clear();
+ if (intToEnum != nullptr) intToEnum->clear();
- if (enumToInt != NULLPTR) enumToInt->clear();
+ if (enumToInt != nullptr) enumToInt->clear();
if (pdxTypeToTypeIdMap != NULL) pdxTypeToTypeIdMap->clear();
}
@@ -167,14 +167,14 @@ void PdxTypeRegistry::addPdxType(int32_t typeId, PdxTypePtr pdxType) {
PdxTypePtr PdxTypeRegistry::getPdxType(int32_t typeId) {
ReadGuard guard(g_readerWriterLock);
- PdxTypePtr retValue = NULLPTR;
+ PdxTypePtr retValue = nullptr;
TypeIdVsPdxType::iterator iter;
iter = typeIdToPdxType->find(typeId);
if (iter != typeIdToPdxType->end()) {
retValue = (*iter).second;
return retValue;
}
- return NULLPTR;
+ return nullptr;
}
void PdxTypeRegistry::addLocalPdxType(const char* localType,
@@ -186,14 +186,14 @@ void PdxTypeRegistry::addLocalPdxType(const char* localType,
PdxTypePtr PdxTypeRegistry::getLocalPdxType(const char* localType) {
ReadGuard guard(g_readerWriterLock);
- PdxTypePtr localTypePtr = NULLPTR;
+ PdxTypePtr localTypePtr = nullptr;
TypeNameVsPdxType::iterator it;
it = localTypeToPdxType->find(localType);
if (it != localTypeToPdxType->end()) {
localTypePtr = (*it).second;
return localTypePtr;
}
- return NULLPTR;
+ return nullptr;
}
void PdxTypeRegistry::setMergedType(int32_t remoteTypeId, PdxTypePtr mergedType) {
@@ -203,7 +203,7 @@ void PdxTypeRegistry::setMergedType(int32_t remoteTypeId, PdxTypePtr mergedType)
}
PdxTypePtr PdxTypeRegistry::getMergedType(int32_t remoteTypeId) {
- PdxTypePtr retVal = NULLPTR;
+ PdxTypePtr retVal = nullptr;
TypeIdVsPdxType::iterator it;
it = remoteTypeIdToMergedPdxType->find(remoteTypeId);
if (it != remoteTypeIdToMergedPdxType->end()) {
@@ -251,20 +251,21 @@ PdxRemotePreservedDataPtr PdxTypeRegistry::getPreserveData(
PdxRemotePreservedDataPtr retValPtr = iter.second();
return retValPtr;
}
- return NULLPTR;
+ return nullptr;
}
int32_t PdxTypeRegistry::getEnumValue(EnumInfoPtr ei) {
+ // TODO locking - naive concurrent optimization?
CacheableHashMapPtr tmp;
tmp = enumToInt;
if (tmp->contains(ei)) {
- CacheableInt32Ptr val = tmp->operator[](ei);
+ auto val = std::static_pointer_cast<CacheableInt32>(tmp->operator[](ei));
return val->value();
}
WriteGuard guard(g_readerWriterLock);
tmp = enumToInt;
if (tmp->contains(ei)) {
- CacheableInt32Ptr val = tmp->operator[](ei);
+ auto val = std::static_pointer_cast<CacheableInt32>(tmp->operator[](ei));
return val->value();
}
int val = SerializationRegistry::GetEnumValue(ei);
@@ -275,30 +276,33 @@ int32_t PdxTypeRegistry::getEnumValue(EnumInfoPtr ei) {
}
EnumInfoPtr PdxTypeRegistry::getEnum(int32_t enumVal) {
+ // TODO locking - naive concurrent optimization?
EnumInfoPtr ret;
CacheableHashMapPtr tmp;
+ auto enumValPtr = CacheableInt32::create(enumVal);
tmp = intToEnum;
- if (tmp->contains(CacheableInt32::create(enumVal))) {
- ret = tmp->operator[](CacheableInt32::create(enumVal));
+ if (tmp->contains(enumValPtr)) {
+ ret = std::static_pointer_cast<EnumInfo>(tmp->operator[](enumValPtr));
}
- if (ret != NULLPTR) {
+ if (ret != nullptr) {
return ret;
}
WriteGuard guard(g_readerWriterLock);
tmp = intToEnum;
- if (tmp->contains(CacheableInt32::create(enumVal))) {
- ret = tmp->operator[](CacheableInt32::create(enumVal));
+ if (tmp->contains(enumValPtr)) {
+ ret = std::static_pointer_cast<EnumInfo>(tmp->operator[](enumValPtr));
}
- if (ret != NULLPTR) {
+ if (ret != nullptr) {
return ret;
}
- ret = SerializationRegistry::GetEnum(enumVal);
+ ret = std::static_pointer_cast<EnumInfo>(
+ SerializationRegistry::GetEnum(enumVal));
tmp = intToEnum;
- tmp->update(CacheableInt32::create(enumVal), ret);
+ tmp->update(enumValPtr, ret);
intToEnum = tmp;
return ret;
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/PdxWrapper.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxWrapper.cpp b/src/cppcache/src/PdxWrapper.cpp
index 6943567..815ac7d 100644
--- a/src/cppcache/src/PdxWrapper.cpp
+++ b/src/cppcache/src/PdxWrapper.cpp
@@ -43,7 +43,7 @@ PdxWrapper::PdxWrapper(void *userObject, const char *className) {
m_serializer = SerializationRegistry::getPdxSerializer();
- if (m_serializer == NULLPTR) {
+ if (m_serializer == nullptr) {
LOGERROR("No registered PDX serializer found for PdxWrapper");
throw IllegalArgumentException(
"No registered PDX serializer found for PdxWrapper");
@@ -75,7 +75,7 @@ PdxWrapper::PdxWrapper(const char *className) {
m_serializer = SerializationRegistry::getPdxSerializer();
- if (m_serializer == NULLPTR) {
+ if (m_serializer == nullptr) {
LOGERROR(
"No registered PDX serializer found for PdxWrapper deserialization");
throw IllegalArgumentException(
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/PdxWriterWithTypeCollector.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PdxWriterWithTypeCollector.cpp b/src/cppcache/src/PdxWriterWithTypeCollector.cpp
index 0b394e1..ab01cb2 100644
--- a/src/cppcache/src/PdxWriterWithTypeCollector.cpp
+++ b/src/cppcache/src/PdxWriterWithTypeCollector.cpp
@@ -41,7 +41,7 @@ PdxWriterWithTypeCollector::PdxWriterWithTypeCollector(
}
void PdxWriterWithTypeCollector::initialize() {
- m_pdxType = new PdxType(m_domainClassName, true);
+ m_pdxType = std::make_shared<PdxType>(m_domainClassName, true);
}
PdxWriterWithTypeCollector::~PdxWriterWithTypeCollector() {}
@@ -99,7 +99,7 @@ bool PdxWriterWithTypeCollector::isFieldWritingStarted() {
PdxWriterPtr PdxWriterWithTypeCollector::writeUnreadFields(
PdxUnreadFieldsPtr unread) {
PdxLocalWriter::writeUnreadFields(unread);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxWriterWithTypeCollector::writeChar(const char* fieldName,
@@ -107,7 +107,7 @@ PdxWriterPtr PdxWriterWithTypeCollector::writeChar(const char* fieldName,
m_pdxType->addFixedLengthTypeField(fieldName, "char", PdxFieldTypes::CHAR,
PdxTypes::CHAR_SIZE);
PdxLocalWriter::writeChar(fieldName, value);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxWriterWithTypeCollector::writeWideChar(const char* fieldName,
@@ -115,7 +115,7 @@ PdxWriterPtr PdxWriterWithTypeCollector::writeWideChar(const char* fieldName,
m_pdxType->addFixedLengthTypeField(fieldName, "char", PdxFieldTypes::CHAR,
PdxTypes::CHAR_SIZE);
PdxLocalWriter::writeWideChar(fieldName, value);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxWriterWithTypeCollector::writeBoolean(const char* fieldName,
@@ -123,7 +123,7 @@ PdxWriterPtr PdxWriterWithTypeCollector::writeBoolean(const char* fieldName,
m_pdxType->addFixedLengthTypeField(
fieldName, "boolean", PdxFieldTypes::BOOLEAN, PdxTypes::BOOLEAN_SIZE);
PdxLocalWriter::writeBoolean(fieldName, value);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxWriterWithTypeCollector::writeByte(const char* fieldName,
@@ -131,7 +131,7 @@ PdxWriterPtr PdxWriterWithTypeCollector::writeByte(const char* fieldName,
m_pdxType->addFixedLengthTypeField(fieldName, "byte", PdxFieldTypes::BYTE,
PdxTypes::BYTE_SIZE);
PdxLocalWriter::writeByte(fieldName, value);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxWriterWithTypeCollector::writeShort(const char* fieldName,
@@ -139,7 +139,7 @@ PdxWriterPtr PdxWriterWithTypeCollector::writeShort(const char* fieldName,
m_pdxType->addFixedLengthTypeField(fieldName, "short", PdxFieldTypes::SHORT,
PdxTypes::SHORT_SIZE);
PdxLocalWriter::writeShort(fieldName, value);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxWriterWithTypeCollector::writeInt(const char* fieldName,
@@ -147,7 +147,7 @@ PdxWriterPtr PdxWriterWithTypeCollector::writeInt(const char* fieldName,
m_pdxType->addFixedLengthTypeField(fieldName, "int", PdxFieldTypes::INT,
PdxTypes::INTEGER_SIZE);
PdxLocalWriter::writeInt(fieldName, value);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxWriterWithTypeCollector::writeLong(const char* fieldName,
@@ -155,7 +155,7 @@ PdxWriterPtr PdxWriterWithTypeCollector::writeLong(const char* fieldName,
m_pdxType->addFixedLengthTypeField(fieldName, "long", PdxFieldTypes::LONG,
PdxTypes::LONG_SIZE);
PdxLocalWriter::writeLong(fieldName, value);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxWriterWithTypeCollector::writeFloat(const char* fieldName,
@@ -163,7 +163,7 @@ PdxWriterPtr PdxWriterWithTypeCollector::writeFloat(const char* fieldName,
m_pdxType->addFixedLengthTypeField(fieldName, "float", PdxFieldTypes::FLOAT,
PdxTypes::FLOAT_SIZE);
PdxLocalWriter::writeFloat(fieldName, value);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxWriterWithTypeCollector::writeDouble(const char* fieldName,
@@ -171,7 +171,7 @@ PdxWriterPtr PdxWriterWithTypeCollector::writeDouble(const char* fieldName,
m_pdxType->addFixedLengthTypeField(fieldName, "double", PdxFieldTypes::DOUBLE,
PdxTypes::DOUBLE_SIZE);
PdxLocalWriter::writeDouble(fieldName, value);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxWriterWithTypeCollector::writeDate(const char* fieldName,
@@ -179,7 +179,7 @@ PdxWriterPtr PdxWriterWithTypeCollector::writeDate(const char* fieldName,
m_pdxType->addFixedLengthTypeField(fieldName, "Date", PdxFieldTypes::DATE,
PdxTypes::DATE_SIZE);
PdxLocalWriter::writeDate(fieldName, date);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxWriterWithTypeCollector::writeString(const char* fieldName,
@@ -187,7 +187,7 @@ PdxWriterPtr PdxWriterWithTypeCollector::writeString(const char* fieldName,
m_pdxType->addVariableLengthTypeField(fieldName, "String",
PdxFieldTypes::STRING);
PdxLocalWriter::writeString(fieldName, value);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxWriterWithTypeCollector::writeWideString(const char* fieldName,
@@ -195,7 +195,7 @@ PdxWriterPtr PdxWriterWithTypeCollector::writeWideString(const char* fieldName,
m_pdxType->addVariableLengthTypeField(fieldName, "String",
PdxFieldTypes::STRING);
PdxLocalWriter::writeWideString(fieldName, value);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxWriterWithTypeCollector::writeObject(const char* fieldName,
@@ -203,7 +203,7 @@ PdxWriterPtr PdxWriterWithTypeCollector::writeObject(const char* fieldName,
m_pdxType->addVariableLengthTypeField(fieldName, "Serializable",
PdxFieldTypes::OBJECT);
PdxLocalWriter::writeObject(fieldName, value);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxWriterWithTypeCollector::writeBooleanArray(
@@ -211,7 +211,7 @@ PdxWriterPtr PdxWriterWithTypeCollector::writeBooleanArray(
m_pdxType->addVariableLengthTypeField(fieldName, "bool[]",
PdxFieldTypes::BOOLEAN_ARRAY);
PdxLocalWriter::writeBooleanArray(fieldName, array, length);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxWriterWithTypeCollector::writeCharArray(const char* fieldName,
@@ -220,7 +220,7 @@ PdxWriterPtr PdxWriterWithTypeCollector::writeCharArray(const char* fieldName,
m_pdxType->addVariableLengthTypeField(fieldName, "char[]",
PdxFieldTypes::CHAR_ARRAY);
PdxLocalWriter::writeCharArray(fieldName, array, length);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxWriterWithTypeCollector::writeWideCharArray(
@@ -228,7 +228,7 @@ PdxWriterPtr PdxWriterWithTypeCollector::writeWideCharArray(
m_pdxType->addVariableLengthTypeField(fieldName, "char[]",
PdxFieldTypes::CHAR_ARRAY);
PdxLocalWriter::writeWideCharArray(fieldName, array, length);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxWriterWithTypeCollector::writeByteArray(const char* fieldName,
@@ -237,7 +237,7 @@ PdxWriterPtr PdxWriterWithTypeCollector::writeByteArray(const char* fieldName,
m_pdxType->addVariableLengthTypeField(fieldName, "byte[]",
PdxFieldTypes::BYTE_ARRAY);
PdxLocalWriter::writeByteArray(fieldName, array, length);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxWriterWithTypeCollector::writeShortArray(const char* fieldName,
@@ -246,7 +246,7 @@ PdxWriterPtr PdxWriterWithTypeCollector::writeShortArray(const char* fieldName,
m_pdxType->addVariableLengthTypeField(fieldName, "short[]",
PdxFieldTypes::SHORT_ARRAY);
PdxLocalWriter::writeShortArray(fieldName, array, length);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxWriterWithTypeCollector::writeIntArray(const char* fieldName,
@@ -255,7 +255,7 @@ PdxWriterPtr PdxWriterWithTypeCollector::writeIntArray(const char* fieldName,
m_pdxType->addVariableLengthTypeField(fieldName, "int[]",
PdxFieldTypes::INT_ARRAY);
PdxLocalWriter::writeIntArray(fieldName, array, length);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxWriterWithTypeCollector::writeLongArray(const char* fieldName,
@@ -264,7 +264,7 @@ PdxWriterPtr PdxWriterWithTypeCollector::writeLongArray(const char* fieldName,
m_pdxType->addVariableLengthTypeField(fieldName, "long[]",
PdxFieldTypes::LONG_ARRAY);
PdxLocalWriter::writeLongArray(fieldName, array, length);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxWriterWithTypeCollector::writeFloatArray(const char* fieldName,
@@ -273,7 +273,7 @@ PdxWriterPtr PdxWriterWithTypeCollector::writeFloatArray(const char* fieldName,
m_pdxType->addVariableLengthTypeField(fieldName, "float[]",
PdxFieldTypes::FLOAT_ARRAY);
PdxLocalWriter::writeFloatArray(fieldName, array, length);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxWriterWithTypeCollector::writeDoubleArray(const char* fieldName,
@@ -282,7 +282,7 @@ PdxWriterPtr PdxWriterWithTypeCollector::writeDoubleArray(const char* fieldName,
m_pdxType->addVariableLengthTypeField(fieldName, "double[]",
PdxFieldTypes::DOUBLE_ARRAY);
PdxLocalWriter::writeDoubleArray(fieldName, array, length);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxWriterWithTypeCollector::writeStringArray(const char* fieldName,
@@ -291,7 +291,7 @@ PdxWriterPtr PdxWriterWithTypeCollector::writeStringArray(const char* fieldName,
m_pdxType->addVariableLengthTypeField(fieldName, "String[]",
PdxFieldTypes::STRING_ARRAY);
PdxLocalWriter::writeStringArray(fieldName, array, length);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxWriterWithTypeCollector::writeWideStringArray(
@@ -299,7 +299,7 @@ PdxWriterPtr PdxWriterWithTypeCollector::writeWideStringArray(
m_pdxType->addVariableLengthTypeField(fieldName, "String[]",
PdxFieldTypes::STRING_ARRAY);
PdxLocalWriter::writeWideStringArray(fieldName, array, length);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxWriterWithTypeCollector::writeObjectArray(
@@ -307,7 +307,7 @@ PdxWriterPtr PdxWriterWithTypeCollector::writeObjectArray(
m_pdxType->addVariableLengthTypeField(fieldName, "Object[]",
PdxFieldTypes::OBJECT_ARRAY);
PdxLocalWriter::writeObjectArray(fieldName, array);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxWriterWithTypeCollector::writeArrayOfByteArrays(
@@ -317,19 +317,19 @@ PdxWriterPtr PdxWriterWithTypeCollector::writeArrayOfByteArrays(
PdxFieldTypes::ARRAY_OF_BYTE_ARRAYS);
PdxLocalWriter::writeArrayOfByteArrays(fieldName, byteArrays, arrayLength,
elementLength);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
PdxWriterPtr PdxWriterWithTypeCollector::markIdentityField(
const char* fieldName) {
PdxFieldTypePtr pft = m_pdxType->getPdxField(fieldName);
- if (pft == NULLPTR) {
+ if (pft == nullptr) {
throw IllegalStateException(
"Field, must be written to PdxWriter before calling "
"MarkIdentityField ");
}
pft->setIdentityField(true);
- return PdxWriterPtr(this);
+ return shared_from_this();
}
} // namespace client
} // namespace geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/Pool.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/Pool.cpp b/src/cppcache/src/Pool.cpp
index 54ad10a..be14fb0 100644
--- a/src/cppcache/src/Pool.cpp
+++ b/src/cppcache/src/Pool.cpp
@@ -73,7 +73,7 @@ RegionServicePtr Pool::createSecureUserCache(PropertiesPtr credentials) {
if (this->getMultiuserAuthentication()) {
CachePtr realCache = CacheFactory::getAnyInstance();
- if (!(realCache != NULLPTR && realCache->m_cacheImpl != NULL)) {
+ if (!(realCache != nullptr && realCache->m_cacheImpl != NULL)) {
throw IllegalStateException("cache has not been created yet.");
;
}
@@ -82,21 +82,19 @@ RegionServicePtr Pool::createSecureUserCache(PropertiesPtr credentials) {
throw IllegalStateException("cache has been closed. ");
}
- if (credentials != NULLPTR && credentials.ptr() == NULL) {
+ if (credentials != nullptr && credentials.get() == NULL) {
LOGDEBUG("Pool::createSecureUserCache creds are null");
- credentials = NULLPTR;
+ credentials = nullptr;
}
- PoolPtr tmpPool(this);
// TODO: this will return cache with userattribtes
- ProxyCachePtr userCache(new ProxyCache(credentials, tmpPool));
- return userCache;
+ return std::make_shared<ProxyCache>(credentials, shared_from_this());
}
throw IllegalStateException(
"This operation is only allowed when attached pool is in "
"multiuserSecureMode");
- // return NULLPTR;
+ // return nullptr;
}
bool Pool::getPRSingleHopEnabled() const {
return m_attrs->getPRSingleHopEnabled();
@@ -110,12 +108,12 @@ int Pool::getPendingEventCount() const {
throw IllegalStateException(
"This operation should only be called by durable client");
}
- PoolPtr currPool(this);
- ThinClientPoolHADMPtr poolHADM = dynCast<ThinClientPoolHADMPtr>(currPool);
- if (poolHADM->isReadyForEvent()) {
+ const auto poolHADM = dynamic_cast<const ThinClientPoolHADM*>(this);
+ if (nullptr == poolHADM || poolHADM->isReadyForEvent()) {
LOGERROR("This operation should only be called before readyForEvents.");
throw IllegalStateException(
"This operation should only be called before readyForEvents");
}
+
return poolHADM->getPrimaryServerQueueSize();
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/PoolAttributes.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PoolAttributes.cpp b/src/cppcache/src/PoolAttributes.cpp
index 97834b3..80d5879 100644
--- a/src/cppcache/src/PoolAttributes.cpp
+++ b/src/cppcache/src/PoolAttributes.cpp
@@ -44,8 +44,7 @@ PoolAttributes::PoolAttributes()
m_serverGrp(PoolFactory::DEFAULT_SERVER_GROUP) {}
PoolAttributesPtr PoolAttributes::clone() {
- PoolAttributesPtr ptr(new PoolAttributes(*this));
- return ptr;
+ return std::make_shared<PoolAttributes>(*this);
}
/** Return true if all the attributes are equal to those of other. */
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/PoolFactory.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PoolFactory.cpp b/src/cppcache/src/PoolFactory.cpp
index 5bc5861..36bde60 100644
--- a/src/cppcache/src/PoolFactory.cpp
+++ b/src/cppcache/src/PoolFactory.cpp
@@ -116,7 +116,7 @@ PoolPtr PoolFactory::create(const char* name) {
{
ACE_Guard<ACE_Recursive_Thread_Mutex> guard(connectionPoolsLock);
- if (PoolManager::find(name) != NULLPTR) {
+ if (PoolManager::find(name) != nullptr) {
throw IllegalStateException("Pool with the same name already exists");
}
// Create a clone of Attr;
@@ -155,23 +155,25 @@ PoolPtr PoolFactory::create(const char* name) {
if (copyAttrs
->getThreadLocalConnectionSetting() /*&& !copyAttrs->getPRSingleHopEnabled()*/) {
// TODO: what should we do for sticky connections
- poolDM = new ThinClientPoolStickyDM(name, copyAttrs, tccm);
+ poolDM =
+ std::make_shared<ThinClientPoolStickyDM>(name, copyAttrs, tccm);
} else {
LOGDEBUG("ThinClientPoolDM created ");
- poolDM = new ThinClientPoolDM(name, copyAttrs, tccm);
+ poolDM = std::make_shared<ThinClientPoolDM>(name, copyAttrs, tccm);
}
} else {
LOGDEBUG("ThinClientPoolHADM created ");
if (copyAttrs
->getThreadLocalConnectionSetting() /*&& !copyAttrs->getPRSingleHopEnabled()*/) {
- poolDM = new ThinClientPoolStickyHADM(name, copyAttrs, tccm);
+ poolDM =
+ std::make_shared<ThinClientPoolStickyHADM>(name, copyAttrs, tccm);
} else {
- poolDM = new ThinClientPoolHADM(name, copyAttrs, tccm);
+ poolDM = std::make_shared<ThinClientPoolHADM>(name, copyAttrs, tccm);
}
}
connectionPools->insert(CacheableString::create(name),
- staticCast<PoolPtr>(poolDM));
+ std::static_pointer_cast<GF_UNWRAP_SP(PoolPtr)>(poolDM));
}
// TODO: poolDM->init() should not throw exceptions!
@@ -180,7 +182,7 @@ PoolPtr PoolFactory::create(const char* name) {
poolDM->init();
}
- return staticCast<PoolPtr>(poolDM);
+ return std::static_pointer_cast<GF_UNWRAP_SP(PoolPtr)>(poolDM);
}
void PoolFactory::addCheck(const char* host, int port) {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/PoolManager.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/PoolManager.cpp b/src/cppcache/src/PoolManager.cpp
index 9470d60..acad2d8 100644
--- a/src/cppcache/src/PoolManager.cpp
+++ b/src/cppcache/src/PoolManager.cpp
@@ -50,8 +50,7 @@ void PoolManager::close(bool keepAlive) {
for (HashMapOfPools::Iterator iter = connectionPools->begin();
iter != connectionPools->end(); ++iter) {
- PoolPtr currPool(iter.second());
- poolsList.push_back(currPool);
+ poolsList.push_back(iter.second());
}
for (std::vector<PoolPtr>::iterator iter = poolsList.begin();
@@ -73,16 +72,16 @@ PoolPtr PoolManager::find(const char* name) {
HashMapOfPools::Iterator iter =
connectionPools->find(CacheableString::create(name));
- PoolPtr poolPtr = NULLPTR;
+ PoolPtr poolPtr = nullptr;
if (iter != connectionPools->end()) {
poolPtr = iter.second();
- GF_DEV_ASSERT(poolPtr != NULLPTR);
+ GF_DEV_ASSERT(poolPtr != nullptr);
}
return poolPtr;
} else {
- return NULLPTR;
+ return nullptr;
}
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/Properties.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/Properties.cpp b/src/cppcache/src/Properties.cpp
index 9a28725..a381653 100644
--- a/src/cppcache/src/Properties.cpp
+++ b/src/cppcache/src/Properties.cpp
@@ -42,7 +42,7 @@ class ACE_Equal_To<apache::geode::client::CacheableKeyPtr> {
public:
int operator()(const apache::geode::client::CacheableKeyPtr& lhs,
const apache::geode::client::CacheableKeyPtr& rhs) const {
- return (*lhs.ptr() == *rhs.ptr());
+ return (*lhs.get() == *rhs.get());
}
};
ACE_END_VERSIONED_NAMESPACE_DECL
@@ -95,23 +95,23 @@ CacheableStringPtr Properties::find(const char* key) {
CacheablePtr value;
int status = MAP->find(keyptr, value);
if (status != 0) {
- return NULLPTR;
+ return nullptr;
}
- if (value == NULLPTR) {
- return NULLPTR;
+ if (value == nullptr) {
+ return nullptr;
}
return value->toString();
}
CacheablePtr Properties::find(const CacheableKeyPtr& key) {
- if (key == NULLPTR) {
+ if (key == nullptr) {
throw NullPointerException("Properties::find: Null key given.");
}
CacheableKeyCacheableMapGuard guard(MAP->mutex());
CacheablePtr value;
int status = MAP->find(key, value);
if (status != 0) {
- return NULLPTR;
+ return nullptr;
}
return value;
}
@@ -138,7 +138,7 @@ void Properties::insert(const char* key, const int value) {
}
void Properties::insert(const CacheableKeyPtr& key, const CacheablePtr& value) {
- if (key == NULLPTR) {
+ if (key == nullptr) {
throw NullPointerException("Properties::insert: Null key given.");
}
MAP->rebind(key, value);
@@ -153,7 +153,7 @@ void Properties::remove(const char* key) {
}
void Properties::remove(const CacheableKeyPtr& key) {
- if (key == NULLPTR) {
+ if (key == nullptr) {
throw NullPointerException("Properties::remove: Null key given.");
}
MAP->unbind(key);
@@ -175,7 +175,7 @@ void Properties::foreach (Visitor& visitor) const {
}
void Properties::addAll(const PropertiesPtr& other) {
- if (other == NULLPTR) return;
+ if (other == nullptr) return;
class Copier : public Visitor {
Properties& m_lhs;
@@ -290,14 +290,14 @@ void Properties::toData(DataOutput& output) const {
while (iter != MAP->end()) {
// changed
CacheableString* csPtr =
- dynamic_cast<CacheableString*>(((*iter).ext_id_).ptr());
+ dynamic_cast<CacheableString*>(((*iter).ext_id_).get());
if (csPtr == NULL) {
output.writeObject((*iter).ext_id_); // changed
} else {
output.writeNativeString(csPtr->asChar());
}
- csPtr = dynamic_cast<CacheableString*>(((*iter).int_id_).ptr());
+ csPtr = dynamic_cast<CacheableString*>(((*iter).int_id_).get());
if (csPtr == NULL) {
output.writeObject((*iter).int_id_); // changed
} else {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/ProxyCache.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ProxyCache.cpp b/src/cppcache/src/ProxyCache.cpp
index 0b3b92b..1e9bc54 100644
--- a/src/cppcache/src/ProxyCache.cpp
+++ b/src/cppcache/src/ProxyCache.cpp
@@ -57,9 +57,9 @@ bool ProxyCache::isClosed() const { return m_isProxyCacheClosed; }
void ProxyCache::close() {
LOGDEBUG("ProxyCache::close: isProxyCacheClosed = %d", m_isProxyCacheClosed);
if (!m_isProxyCacheClosed) {
- if (m_remoteQueryService != NULLPTR) {
+ if (m_remoteQueryService != nullptr) {
ProxyRemoteQueryService* prqs =
- static_cast<ProxyRemoteQueryService*>(m_remoteQueryService.ptr());
+ static_cast<ProxyRemoteQueryService*>(m_remoteQueryService.get());
prqs->closeCqs(false);
}
@@ -70,8 +70,8 @@ void ProxyCache::close() {
// send message to server
PoolPtr userAttachedPool = m_userAttributes->getPool();
PoolPtr pool = PoolManager::find(userAttachedPool->getName());
- if (pool != NULLPTR && pool.ptr() == userAttachedPool.ptr()) {
- ThinClientPoolDMPtr poolDM(static_cast<ThinClientPoolDM*>(pool.ptr()));
+ if (pool != nullptr && pool.get() == userAttachedPool.get()) {
+ auto poolDM = std::static_pointer_cast<ThinClientPoolDM>(pool);
if (!poolDM->isDestroyed()) {
poolDM->sendUserCacheCloseMessage(false);
}
@@ -88,17 +88,16 @@ RegionPtr ProxyCache::getRegion(const char* path) {
RegionPtr result;
CachePtr realCache = CacheFactory::getAnyInstance();
- if (realCache != NULLPTR && !realCache->isClosed()) {
- CacheRegionHelper::getCacheImpl(realCache.ptr())->getRegion(path, result);
+ if (realCache != nullptr && !realCache->isClosed()) {
+ CacheRegionHelper::getCacheImpl(realCache.get())->getRegion(path, result);
}
- if (result != NULLPTR) {
+ if (result != nullptr) {
PoolPtr userAttachedPool = m_userAttributes->getPool();
PoolPtr pool = PoolManager::find(result->getAttributes()->getPoolName());
- if (pool != NULLPTR && pool.ptr() == userAttachedPool.ptr() &&
+ if (pool != nullptr && pool.get() == userAttachedPool.get() &&
!pool->isDestroyed()) {
- ProxyRegionPtr pRegion(new ProxyRegion(this, result));
- return pRegion;
+ return std::make_shared<ProxyRegion>(shared_from_this(), result);
}
throw IllegalArgumentException(
"The Region argument is not attached with the pool, which used to "
@@ -121,8 +120,9 @@ RegionPtr ProxyCache::getRegion(const char* path) {
QueryServicePtr ProxyCache::getQueryService() {
if (!m_isProxyCacheClosed) {
- if (m_remoteQueryService != NULLPTR) return m_remoteQueryService;
- QueryServicePtr prqsPtr(new ProxyRemoteQueryService(this));
+ if (m_remoteQueryService != nullptr) return m_remoteQueryService;
+ auto prqsPtr =
+ std::make_shared<ProxyRemoteQueryService>(this->shared_from_this());
m_remoteQueryService = prqsPtr;
return prqsPtr;
}
@@ -136,7 +136,7 @@ void ProxyCache::rootRegions(VectorOfRegion& regions) {
RegionPtr result;
CachePtr realCache = CacheFactory::getAnyInstance();
- if (realCache != NULLPTR && !realCache->isClosed()) {
+ if (realCache != nullptr && !realCache->isClosed()) {
VectorOfRegion tmp;
// this can cause issue when pool attached with region in multiuserSecure
// mode
@@ -147,7 +147,8 @@ void ProxyCache::rootRegions(VectorOfRegion& regions) {
RegionPtr reg = tmp.at(i);
if (strcmp(m_userAttributes->getPool()->getName(),
reg->getAttributes()->getPoolName()) == 0) {
- ProxyRegionPtr pRegion(new ProxyRegion(this, reg));
+ auto pRegion =
+ std::make_shared<ProxyRegion>(shared_from_this(), reg);
regions.push_back(pRegion);
}
}
@@ -157,17 +158,14 @@ void ProxyCache::rootRegions(VectorOfRegion& regions) {
}
ProxyCache::ProxyCache(PropertiesPtr credentials, PoolPtr pool) {
- m_remoteQueryService = NULLPTR;
+ m_remoteQueryService = nullptr;
m_isProxyCacheClosed = false;
- UserAttributesPtr userAttr;
- userAttr = new UserAttributes(credentials, pool, this);
- m_userAttributes = userAttr;
+ m_userAttributes = std::make_shared<UserAttributes>(credentials, pool, this);
}
ProxyCache::~ProxyCache() {}
PdxInstanceFactoryPtr ProxyCache::createPdxInstanceFactory(
const char* className) {
- PdxInstanceFactoryPtr pIFPtr(new PdxInstanceFactoryImpl(className));
- return pIFPtr;
+ return std::make_shared<PdxInstanceFactoryImpl>(className);
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/ProxyCache.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ProxyCache.hpp b/src/cppcache/src/ProxyCache.hpp
index 043318d..23d085c 100644
--- a/src/cppcache/src/ProxyCache.hpp
+++ b/src/cppcache/src/ProxyCache.hpp
@@ -52,7 +52,9 @@ class FunctionServiceImpl;
* <p>A cache can have multiple root regions, each with a different name.
*
*/
-class CPPCACHE_EXPORT ProxyCache : public RegionService {
+class CPPCACHE_EXPORT ProxyCache
+ : public RegionService,
+ public std::enable_shared_from_this<ProxyCache> {
/**
* @brief public methods
*/
@@ -79,7 +81,7 @@ class CPPCACHE_EXPORT ProxyCache : public RegionService {
/** Look up a region with the full path from root.
* @param path the region's path, such as <code>RootA/Sub1/Sub1A</code>.
- * @returns region, or NULLPTR if no such region exists.
+ * @returns region, or nullptr if no such region exists.
*/
virtual RegionPtr getRegion(const char* path);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/ProxyRegion.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ProxyRegion.hpp b/src/cppcache/src/ProxyRegion.hpp
index bcb755d..ec7c710 100644
--- a/src/cppcache/src/ProxyRegion.hpp
+++ b/src/cppcache/src/ProxyRegion.hpp
@@ -68,7 +68,7 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
return m_realRegion->getFullPath();
}
- /** 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 {
@@ -87,7 +87,7 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
*/
virtual AttributesMutatorPtr getAttributesMutator() const {
unSupportedOperation("Region.getAttributesMutator()");
- return NULLPTR;
+ return nullptr;
}
// virtual void updateAccessOrModifiedTime() = 0;
@@ -104,7 +104,7 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
*
* @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
@@ -114,7 +114,7 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
* This operation is not distributed.
*/
virtual void invalidateRegion(
- const UserDataPtr& aCallbackArgument = NULLPTR) {
+ const UserDataPtr& aCallbackArgument = nullptr) {
unSupportedOperation("Region.invalidateRegion()");
}
@@ -128,7 +128,7 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
*
* @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
@@ -138,7 +138,7 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
*/
virtual void localInvalidateRegion(
- const UserDataPtr& aCallbackArgument = NULLPTR) {
+ const UserDataPtr& aCallbackArgument = nullptr) {
unSupportedOperation("Region.localInvalidateRegion()");
}
@@ -156,7 +156,7 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
*
* @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
@@ -176,7 +176,7 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
* @throws TimeoutException if operation timed out
* @see invalidateRegion
*/
- virtual void destroyRegion(const UserDataPtr& aCallbackArgument = NULLPTR) {
+ virtual void destroyRegion(const UserDataPtr& aCallbackArgument = nullptr) {
GuardUserAttribures gua(m_proxyCache);
m_realRegion->destroyRegion(aCallbackArgument);
}
@@ -189,7 +189,7 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
* @see CacheListener#afterRegionClear
* @see CacheWriter#beforeRegionClear
*/
- virtual void clear(const UserDataPtr& aCallbackArgument = NULLPTR) {
+ virtual void clear(const UserDataPtr& aCallbackArgument = nullptr) {
GuardUserAttribures gua(m_proxyCache);
m_realRegion->clear(aCallbackArgument);
}
@@ -201,7 +201,7 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
* @see CacheListener#afterRegionClear
* @see CacheWriter#beforeRegionClear
*/
- virtual void localClear(const UserDataPtr& aCallbackArgument = NULLPTR) {
+ virtual void localClear(const UserDataPtr& aCallbackArgument = nullptr) {
unSupportedOperation("localClear()");
}
@@ -215,7 +215,7 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
*
* @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
@@ -225,35 +225,34 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
* @see localInvalidateRegion
*/
virtual void localDestroyRegion(
- const UserDataPtr& aCallbackArgument = NULLPTR) {
+ const UserDataPtr& aCallbackArgument = nullptr) {
unSupportedOperation("Region.localDestroyRegion()");
}
- /** 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) {
LOGDEBUG("ProxyRegion getSubregion");
RegionPtr rPtr = m_realRegion->getSubregion(path);
- if (rPtr == NULLPTR) return rPtr;
+ if (rPtr == nullptr) return rPtr;
- RegionPtr prPtr(new ProxyRegion(m_proxyCache.ptr(), rPtr));
- return prPtr;
+ return std::make_shared<ProxyRegion>(m_proxyCache, rPtr);
}
/** Creates a subregion with the specified attributes */
virtual RegionPtr createSubregion(
const char* subregionName, const RegionAttributesPtr& aRegionAttributes) {
unSupportedOperation("createSubregion()");
- return NULLPTR;
+ return nullptr;
/*LOGDEBUG("ProxyRegion getSubregion");
RegionPtr rPtr = m_realRegion->createSubregion(subregionName,
aRegionAttributes);
- if(rPtr == NULLPTR)
+ if(rPtr == nullptr)
return rPtr;
- RegionPtr prPtr( new ProxyRegion(m_proxyCache.ptr(), rPtr));
+ auto prPtr = std::make_shared<ProxyRegion>(m_proxyCache.get(), rPtr);
return prPtr;*/
}
@@ -270,8 +269,8 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
if (realVectorRegion.size() > 0) {
for (int32_t i = 0; i < realVectorRegion.size(); i++) {
- RegionPtr prPtr(
- new ProxyRegion(m_proxyCache.ptr(), realVectorRegion.at(i)));
+ auto prPtr =
+ std::make_shared<ProxyRegion>(m_proxyCache, realVectorRegion.at(i));
sr.push_back(prPtr);
}
}
@@ -310,7 +309,7 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
* @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
@@ -329,7 +328,7 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
*region
**/
virtual CacheablePtr get(const CacheableKeyPtr& key,
- const UserDataPtr& aCallbackArgument = NULLPTR) {
+ const UserDataPtr& aCallbackArgument = nullptr) {
GuardUserAttribures gua(m_proxyCache);
return m_realRegion->get(key, aCallbackArgument);
}
@@ -337,7 +336,7 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
/** 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);
}
@@ -364,7 +363,7 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
* @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
@@ -382,7 +381,7 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
* @throws OutOfMemoryException if not enoough memory for the value
*/
virtual void put(const CacheableKeyPtr& key, const CacheablePtr& value,
- const UserDataPtr& aCallbackArgument = NULLPTR) {
+ const UserDataPtr& aCallbackArgument = nullptr) {
GuardUserAttribures gua(m_proxyCache);
return m_realRegion->put(key, value, aCallbackArgument);
}
@@ -390,21 +389,21 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
/** 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);
}
@@ -424,14 +423,14 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
* @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) {
+ const UserDataPtr& aCallbackArgument = nullptr) {
GuardUserAttribures gua(m_proxyCache);
return m_realRegion->putAll(map, timeout, aCallbackArgument);
}
@@ -454,35 +453,35 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
* @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) {
+ const UserDataPtr& aCallbackArgument = nullptr) {
unSupportedOperation("Region.localPut()");
}
/** 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);
}
@@ -504,12 +503,12 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
*
* @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
@@ -530,7 +529,7 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
* @throws EntryExistsException if an entry with this key already exists
*/
virtual void create(const CacheableKeyPtr& key, const CacheablePtr& value,
- const UserDataPtr& aCallbackArgument = NULLPTR) {
+ const UserDataPtr& aCallbackArgument = nullptr) {
GuardUserAttribures gua(m_proxyCache);
m_realRegion->create(key, value, aCallbackArgument);
}
@@ -538,21 +537,21 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
/** 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);
}
@@ -567,14 +566,14 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
*
* @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
@@ -583,28 +582,28 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
*/
virtual void localCreate(const CacheableKeyPtr& key,
const CacheablePtr& value,
- const UserDataPtr& aCallbackArgument = NULLPTR) {
+ const UserDataPtr& aCallbackArgument = nullptr) {
unSupportedOperation("Region.localCreate()");
}
/** 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);
}
@@ -620,9 +619,9 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
*
* @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
@@ -631,14 +630,14 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
* @see CacheListener::afterInvalidate
*/
virtual void invalidate(const CacheableKeyPtr& key,
- const UserDataPtr& aCallbackArgument = NULLPTR) {
+ const UserDataPtr& aCallbackArgument = nullptr) {
GuardUserAttribures gua(m_proxyCache);
m_realRegion->invalidate(key, aCallbackArgument);
}
/** 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);
}
@@ -652,9 +651,9 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
*
* @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
@@ -663,14 +662,14 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
* @see CacheListener::afterInvalidate
*/
virtual void localInvalidate(const CacheableKeyPtr& key,
- const UserDataPtr& aCallbackArgument = NULLPTR) {
+ const UserDataPtr& aCallbackArgument = nullptr) {
unSupportedOperation("Region.localInvalidate()");
}
/** 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);
}
@@ -693,8 +692,8 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
* @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
@@ -717,14 +716,14 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
* @see CacheWriter::beforeDestroy
*/
virtual void destroy(const CacheableKeyPtr& key,
- const UserDataPtr& aCallbackArgument = NULLPTR) {
+ const UserDataPtr& aCallbackArgument = nullptr) {
GuardUserAttribures gua(m_proxyCache);
m_realRegion->destroy(key, aCallbackArgument);
}
/** 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);
}
@@ -742,8 +741,8 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
*
* @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
@@ -753,14 +752,14 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
* @see CacheWriter::beforeDestroy
*/
virtual void localDestroy(const CacheableKeyPtr& key,
- const UserDataPtr& aCallbackArgument = NULLPTR) {
+ const UserDataPtr& aCallbackArgument = nullptr) {
unSupportedOperation("Region.localDestroy()");
}
/** 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);
}
@@ -783,11 +782,11 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
* <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
@@ -813,7 +812,7 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
* @see CacheWriter::beforeDestroy
*/
virtual bool remove(const CacheableKeyPtr& key, const CacheablePtr& value,
- const UserDataPtr& aCallbackArgument = NULLPTR) {
+ const UserDataPtr& aCallbackArgument = nullptr) {
GuardUserAttribures gua(m_proxyCache);
return m_realRegion->remove(key, value, aCallbackArgument);
}
@@ -821,21 +820,21 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
/** 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);
}
@@ -859,8 +858,8 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
* @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
@@ -887,14 +886,14 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
*/
virtual bool removeEx(const CacheableKeyPtr& key,
- const UserDataPtr& aCallbackArgument = NULLPTR) {
+ const UserDataPtr& aCallbackArgument = nullptr) {
GuardUserAttribures gua(m_proxyCache);
return m_realRegion->removeEx(key, aCallbackArgument);
}
/** 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);
}
@@ -915,8 +914,8 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
* @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
@@ -927,7 +926,7 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
*/
virtual bool localRemove(const CacheableKeyPtr& key,
const CacheablePtr& value,
- const UserDataPtr& aCallbackArgument = NULLPTR) {
+ const UserDataPtr& aCallbackArgument = nullptr) {
unSupportedOperation("Region.localRemove()");
return false;
}
@@ -935,21 +934,21 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
/** 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);
}
@@ -968,8 +967,8 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
*
* @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
@@ -979,7 +978,7 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
* @see CacheWriter::beforeDestroy
*/
virtual bool localRemoveEx(const CacheableKeyPtr& key,
- const UserDataPtr& aCallbackArgument = NULLPTR) {
+ const UserDataPtr& aCallbackArgument = nullptr) {
unSupportedOperation("Region.localRemoveEx()");
return false;
}
@@ -987,7 +986,7 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
/** 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);
}
@@ -1186,7 +1185,7 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
* ( {@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
@@ -1213,7 +1212,7 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
* @throws TimeoutException if operation timed out
*/
virtual void registerAllKeys(bool isDurable = false,
- VectorOfCacheableKeyPtr resultKeys = NULLPTR,
+ VectorOfCacheableKeyPtr resultKeys = nullptr,
bool getInitialValues = false,
bool receiveValues = true) {
unSupportedOperation("Region.registerAllKeys()");
@@ -1250,7 +1249,7 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
*
* @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
@@ -1283,7 +1282,7 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
* @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) {
unSupportedOperation("Region.registerRegex()");
@@ -1331,21 +1330,21 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
*
* @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
@@ -1362,7 +1361,7 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
HashMapOfCacheablePtr values,
HashMapOfExceptionPtr exceptions,
bool addToLocalCache = false,
- const UserDataPtr& aCallbackArgument = NULLPTR) {
+ const UserDataPtr& aCallbackArgument = nullptr) {
GuardUserAttribures gua(m_proxyCache);
m_realRegion->getAll(keys, values, exceptions, false /*TODO:*/,
aCallbackArgument);
@@ -1446,7 +1445,7 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
* @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,
@@ -1468,7 +1467,7 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
* @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
@@ -1484,7 +1483,7 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
* @see destroy
*/
virtual void removeAll(const VectorOfCacheableKey& keys,
- const UserDataPtr& aCallbackArgument = NULLPTR) {
+ const UserDataPtr& aCallbackArgument = nullptr) {
GuardUserAttribures gua(m_proxyCache);
m_realRegion->removeAll(keys, aCallbackArgument);
}
@@ -1497,9 +1496,8 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
virtual const PoolPtr& getPool() { return m_realRegion->getPool(); }
- ProxyRegion(ProxyCache* proxyCache, RegionPtr realRegion) {
- ProxyCachePtr pcp(proxyCache);
- m_proxyCache = pcp;
+ ProxyRegion(const ProxyCachePtr& proxyCache, const RegionPtr& realRegion) {
+ m_proxyCache = proxyCache;
m_realRegion = realRegion;
}
@@ -1514,6 +1512,8 @@ class CPPCACHE_EXPORT ProxyRegion : public Region {
ProxyRegion(const ProxyRegion&);
ProxyRegion& operator=(const ProxyRegion&);
friend class FunctionService;
+
+ FRIEND_STD_SHARED_PTR(ProxyRegion)
};
typedef SharedPtr<ProxyRegion> ProxyRegionPtr;
[39/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from clicache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/CqQuery.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CqQuery.cpp b/src/clicache/src/CqQuery.cpp
index eb50ad7..25c93d9 100644
--- a/src/clicache/src/CqQuery.cpp
+++ b/src/clicache/src/CqQuery.cpp
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-//#include "geode_includes.hpp"
+
#include "CqQuery.hpp"
#include "Query.hpp"
#include "CqAttributes.hpp"
@@ -34,6 +34,7 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
generic<class TKey, class TResult>
ICqResults<TResult>^ CqQuery<TKey, TResult>::ExecuteWithInitialResults()
@@ -45,30 +46,21 @@ namespace Apache
ICqResults<TResult>^ CqQuery<TKey, TResult>::ExecuteWithInitialResults(System::UInt32 timeout)
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
-
- apache::geode::client::CqResultsPtr& nativeptr =
- NativePtr->executeWithInitialResults(timeout);
- if (nativeptr.get() == NULL) return nullptr;
-
- apache::geode::client::ResultSet* resultptr = dynamic_cast<apache::geode::client::ResultSet*>(
- nativeptr.ptr( ) );
- if ( resultptr == NULL )
+ try
{
- apache::geode::client::StructSet* structptr = dynamic_cast<apache::geode::client::StructSet*>(
- nativeptr.ptr( ) );
- if ( structptr == NULL )
+ auto nativeptr = m_nativeptr->get()->executeWithInitialResults(timeout);
+
+ if (auto structptr = std::dynamic_pointer_cast<native::StructSet>(nativeptr))
{
- return nullptr;
+ return StructSet<TResult>::Create(structptr);
}
- return StructSet<TResult>::Create(structptr);
+
+ return nullptr;
}
- /*else
+ finally
{
- return ResultSet::Create(resultptr);
- }*/
-
- return nullptr;
-
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -77,7 +69,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->execute();
+ try
+ {
+ m_nativeptr->get()->execute();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -85,59 +84,103 @@ namespace Apache
generic<class TKey, class TResult>
String^ CqQuery<TKey, TResult>::QueryString::get( )
{
- return ManagedString::Get( NativePtr->getQueryString( ) );
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getQueryString( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TResult>
String^ CqQuery<TKey, TResult>::Name::get( )
{
- return ManagedString::Get( NativePtr->getName( ) );
+ try
+ {
+ return ManagedString::Get( m_nativeptr->get()->getName( ) );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TResult>
Query<TResult>^ CqQuery<TKey, TResult>::GetQuery( )
{
- return Query<TResult>::Create(NativePtr->getQuery().get());
+ try
+ {
+ return Query<TResult>::Create(m_nativeptr->get()->getQuery());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TResult>
CqAttributes<TKey, TResult>^ CqQuery<TKey, TResult>::GetCqAttributes( )
{
- return CqAttributes<TKey, TResult>::Create(NativePtr->getCqAttributes( ).get());
+ try
+ {
+ return CqAttributes<TKey, TResult>::Create(m_nativeptr->get()->getCqAttributes( ));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TResult>
CqAttributesMutator<TKey, TResult>^ CqQuery<TKey, TResult>::GetCqAttributesMutator( )
{
- return CqAttributesMutator<TKey, TResult>::Create(NativePtr->getCqAttributesMutator().get());
+ try
+ {
+ return CqAttributesMutator<TKey, TResult>::Create(m_nativeptr->get()->getCqAttributesMutator());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TResult>
CqStatistics^ CqQuery<TKey, TResult>::GetStatistics( )
{
- return CqStatistics::Create(NativePtr->getStatistics().get());
+ try
+ {
+ return CqStatistics::Create(m_nativeptr->get()->getStatistics());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TKey, class TResult>
CqStateType CqQuery<TKey, TResult>::GetState( )
{
- apache::geode::client::CqState::StateType st = NativePtr->getState( );
- CqStateType state;
- switch (st)
+ try
{
- case apache::geode::client::CqState::STOPPED: {
+ auto st = m_nativeptr->get()->getState();
+ CqStateType state;
+ switch (st)
+ {
+ case native::CqState::STOPPED: {
state = CqStateType::STOPPED;
break;
}
- case apache::geode::client::CqState::RUNNING: {
+ case native::CqState::RUNNING: {
state = CqStateType::RUNNING;
break;
}
- case apache::geode::client::CqState::CLOSED: {
+ case native::CqState::CLOSED: {
state = CqStateType::CLOSED;
break;
}
- case apache::geode::client::CqState::CLOSING: {
+ case native::CqState::CLOSING: {
state = CqStateType::CLOSING;
break;
}
@@ -145,8 +188,13 @@ namespace Apache
state = CqStateType::INVALID;
break;
}
+ }
+ return state;
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
}
- return state;
}
generic<class TKey, class TResult>
@@ -154,7 +202,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->stop( );
+ try
+ {
+ m_nativeptr->get()->stop( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -164,7 +219,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->close( );
+ try
+ {
+ m_nativeptr->get()->close( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -174,7 +236,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return NativePtr->isRunning( );
+ try
+ {
+ return m_nativeptr->get()->isRunning( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -184,21 +253,34 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return NativePtr->isStopped( );
+ try
+ {
+ return m_nativeptr->get()->isStopped( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
generic<class TKey, class TResult>
- bool CqQuery<TKey, TResult>::IsClosed( )
- {
- _GF_MG_EXCEPTION_TRY2/* due to auto replace */
+ bool CqQuery<TKey, TResult>::IsClosed()
+ {
+ _GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return NativePtr->isClosed( );
+ try
+ {
+ return m_nativeptr->get()->isClosed();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
- _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ _GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
+ }
} // namespace Client
} // namespace Geode
} // namespace Apache
-
- } //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/CqQuery.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CqQuery.hpp b/src/clicache/src/CqQuery.hpp
index 97f3d47..8cbf9f8 100644
--- a/src/clicache/src/CqQuery.hpp
+++ b/src/clicache/src/CqQuery.hpp
@@ -19,8 +19,10 @@
#include "geode_defs.hpp"
#include "CqState.hpp"
+#include "begin_native.hpp"
#include <geode/CqQuery.hpp>
-//#include "impl/NativeWrapper.hpp"
+#include "end_native.hpp"
+#include "native_shared_ptr.hpp"
using namespace System;
@@ -31,6 +33,7 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
generic<class TResult>
interface class ICqResults;
@@ -63,7 +66,6 @@ namespace Apache
/// </remarks>
generic<class TKey, class TResult>
public ref class CqQuery sealed
- : public Internal::SBWrap<apache::geode::client::CqQuery>
{
public:
@@ -166,13 +168,10 @@ namespace Apache
/// <returns>
/// The managed wrapper object; null if the native pointer is null.
/// </returns>
- inline static CqQuery<TKey, TResult>^ Create( apache::geode::client::CqQuery* nativeptr )
+ inline static CqQuery<TKey, TResult>^ Create( native::CqQueryPtr nativeptr )
{
- if (nativeptr == nullptr)
- {
- return nullptr;
- }
- return gcnew CqQuery<TKey, TResult>( nativeptr );
+ return __nullptr == nativeptr ? nullptr :
+ gcnew CqQuery<TKey, TResult>( nativeptr );
}
@@ -182,8 +181,13 @@ namespace Apache
/// Private constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline CqQuery( apache::geode::client::CqQuery* nativeptr )
- : SBWrap( nativeptr ) { }
+ inline CqQuery( native::CqQueryPtr nativeptr )
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::CqQuery>(nativeptr);
+ }
+
+
+ native_shared_ptr<native::CqQuery>^ m_nativeptr;
};
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/CqServiceStatistics.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CqServiceStatistics.cpp b/src/clicache/src/CqServiceStatistics.cpp
index c52a85c..6a9da4c 100644
--- a/src/clicache/src/CqServiceStatistics.cpp
+++ b/src/clicache/src/CqServiceStatistics.cpp
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-//#include "geode_includes.hpp"
#include "CqServiceStatistics.hpp"
@@ -25,28 +24,63 @@ namespace Apache
{
namespace Client
{
+ using namespace System;
- System::UInt32 CqServiceStatistics::numCqsActive( )
- {
- return NativePtr->numCqsActive( );
- }
- System::UInt32 CqServiceStatistics::numCqsCreated( )
- {
- return NativePtr->numCqsCreated( );
- }
- System::UInt32 CqServiceStatistics::numCqsClosed( )
- {
- return NativePtr->numCqsClosed( );
- }
- System::UInt32 CqServiceStatistics::numCqsStopped( )
- {
- return NativePtr->numCqsStopped( );
- }
- System::UInt32 CqServiceStatistics::numCqsOnClient( )
- {
- return NativePtr->numCqsOnClient( );
+ System::UInt32 CqServiceStatistics::numCqsActive()
+ {
+ try
+ {
+ return m_nativeptr->get()->numCqsActive();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+ System::UInt32 CqServiceStatistics::numCqsCreated()
+ {
+ try
+ {
+ return m_nativeptr->get()->numCqsCreated();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+ System::UInt32 CqServiceStatistics::numCqsClosed()
+ {
+ try
+ {
+ return m_nativeptr->get()->numCqsClosed();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+ System::UInt32 CqServiceStatistics::numCqsStopped()
+ {
+ try
+ {
+ return m_nativeptr->get()->numCqsStopped();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+ System::UInt32 CqServiceStatistics::numCqsOnClient()
+ {
+ try
+ {
+ return m_nativeptr->get()->numCqsOnClient();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
} // namespace Client
} // namespace Geode
} // namespace Apache
-
- } //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/CqServiceStatistics.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CqServiceStatistics.hpp b/src/clicache/src/CqServiceStatistics.hpp
index fc8f235..d711d8a 100644
--- a/src/clicache/src/CqServiceStatistics.hpp
+++ b/src/clicache/src/CqServiceStatistics.hpp
@@ -18,9 +18,10 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/CqServiceStatistics.hpp>
-#include "impl/NativeWrapper.hpp"
-
+#include "end_native.hpp"
+#include "native_shared_ptr.hpp"
namespace Apache
{
@@ -28,12 +29,12 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
/// <summary>
/// Defines common statistical information for cqservice
/// </summary>
public ref class CqServiceStatistics sealed
- : public Internal::SBWrap<apache::geode::client::CqServiceStatistics>
{
public:
@@ -75,13 +76,10 @@ namespace Apache
/// <returns>
/// The managed wrapper object; null if the native pointer is null.
/// </returns>
- inline static CqServiceStatistics^ Create( apache::geode::client::CqServiceStatistics* nativeptr )
+ inline static CqServiceStatistics^ Create( apache::geode::client::CqServiceStatisticsPtr nativeptr )
{
- if (nativeptr == nullptr)
- {
- return nullptr;
- }
- return gcnew CqServiceStatistics( nativeptr );
+ return __nullptr == nativeptr ? nullptr :
+ gcnew CqServiceStatistics( nativeptr );
}
@@ -91,8 +89,12 @@ namespace Apache
/// Private constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline CqServiceStatistics( apache::geode::client::CqServiceStatistics* nativeptr )
- : SBWrap( nativeptr ) { }
+ inline CqServiceStatistics( apache::geode::client::CqServiceStatisticsPtr nativeptr )
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::CqServiceStatistics>(nativeptr);
+ }
+
+ native_shared_ptr<native::CqServiceStatistics>^ m_nativeptr;
};
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/CqState.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CqState.cpp b/src/clicache/src/CqState.cpp
index 5f99fed..0a83a1d 100644
--- a/src/clicache/src/CqState.cpp
+++ b/src/clicache/src/CqState.cpp
@@ -32,59 +32,59 @@ namespace Apache
String^ CqState::ToString()
{
- return ManagedString::Get(NativePtr->toString());
+ return ManagedString::Get(m_nativeptr->toString());
}
bool CqState::IsRunning()
{
- return NativePtr->isRunning();
+ return m_nativeptr->isRunning();
}
bool CqState::IsStopped()
{
- return NativePtr->isStopped();
+ return m_nativeptr->isStopped();
}
bool CqState::IsClosed()
{
- return NativePtr->isClosed();
+ return m_nativeptr->isClosed();
}
bool CqState::IsClosing()
{
- return NativePtr->isClosing();
+ return m_nativeptr->isClosing();
}
void CqState::SetState( CqStateType state )
{
- apache::geode::client::CqState::StateType st =apache::geode::client::CqState::INVALID;
- if(state == CqStateType::STOPPED)
- st = apache::geode::client::CqState::STOPPED;
- else if(state == CqStateType::RUNNING)
- st = apache::geode::client::CqState::RUNNING;
- else if(state == CqStateType::CLOSED)
- st = apache::geode::client::CqState::CLOSED;
- else if(state == CqStateType::CLOSING)
- st = apache::geode::client::CqState::CLOSING;
-
- NativePtr->setState( st );
+ apache::geode::client::CqState::StateType st =apache::geode::client::CqState::INVALID;
+ if(state == CqStateType::STOPPED)
+ st = apache::geode::client::CqState::STOPPED;
+ else if(state == CqStateType::RUNNING)
+ st = apache::geode::client::CqState::RUNNING;
+ else if(state == CqStateType::CLOSED)
+ st = apache::geode::client::CqState::CLOSED;
+ else if(state == CqStateType::CLOSING)
+ st = apache::geode::client::CqState::CLOSING;
+
+ m_nativeptr->setState( st );
}
CqStateType CqState::GetState( )
{
- apache::geode::client::CqState::StateType st = NativePtr->getState( );
- CqStateType state;
- if(st==apache::geode::client::CqState::STOPPED)
- state = CqStateType::STOPPED;
- else if(st==apache::geode::client::CqState::RUNNING)
- state = CqStateType::RUNNING;
- else if(st==apache::geode::client::CqState::CLOSED)
- state = CqStateType::CLOSED;
- else if(st==apache::geode::client::CqState::CLOSING)
- state = CqStateType::CLOSING;
- else
- state = CqStateType::INVALID;
- return state;
+ apache::geode::client::CqState::StateType st = m_nativeptr->getState( );
+ CqStateType state;
+ if(st==apache::geode::client::CqState::STOPPED)
+ state = CqStateType::STOPPED;
+ else if(st==apache::geode::client::CqState::RUNNING)
+ state = CqStateType::RUNNING;
+ else if(st==apache::geode::client::CqState::CLOSED)
+ state = CqStateType::CLOSED;
+ else if(st==apache::geode::client::CqState::CLOSING)
+ state = CqStateType::CLOSING;
+ else
+ state = CqStateType::INVALID;
+ return state;
} // namespace Client
} // namespace Geode
} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/CqState.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CqState.hpp b/src/clicache/src/CqState.hpp
index 52ab2bb..21ad5e6 100644
--- a/src/clicache/src/CqState.hpp
+++ b/src/clicache/src/CqState.hpp
@@ -18,8 +18,11 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/CqState.hpp>
-#include "impl/NativeWrapper.hpp"
+#include "end_native.hpp"
+
+
using namespace System;
@@ -29,6 +32,7 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
/// <summary>
/// Enumerated type for cq state
@@ -50,7 +54,6 @@ namespace Apache
/// Static class containing convenience methods for <c>CqState</c>.
/// </summary>
public ref class CqState sealed
- : public Internal::UMWrap<apache::geode::client::CqState>
{
public:
@@ -66,7 +69,7 @@ namespace Apache
/// <summary>
/// Returns true if the CQ is in Stopped state.
- /// </summary>
+ /// </summary>
bool IsStopped();
/// <summary>
@@ -76,20 +79,24 @@ namespace Apache
/// <summary>
/// Returns true if the CQ is in Closing state.
- /// </summary>
+ /// </summary>
bool IsClosing();
- void SetState(CqStateType state);
- CqStateType GetState();
-
- internal:
+ void SetState(CqStateType state);
+ CqStateType GetState();
+
+ internal:
/// <summary>
/// Internal constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline CqState( apache::geode::client::CqState* nativeptr )
- : UMWrap( nativeptr, false ) { }
-
+ inline CqState( native::CqState* nativeptr )
+ : m_nativeptr(nativeptr)
+ {
+ }
+
+ private:
+ native::CqState* m_nativeptr;
};
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/CqStatistics.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CqStatistics.cpp b/src/clicache/src/CqStatistics.cpp
index 8378f20..ad19481 100644
--- a/src/clicache/src/CqStatistics.cpp
+++ b/src/clicache/src/CqStatistics.cpp
@@ -15,34 +15,62 @@
* limitations under the License.
*/
-//#include "geode_includes.hpp"
#include "CqStatistics.hpp"
-
namespace Apache
{
namespace Geode
{
namespace Client
{
+ using namespace System;
+
+ System::UInt32 CqStatistics::numInserts()
+ {
+ try
+ {
+ return m_nativeptr->get()->numInserts();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+ System::UInt32 CqStatistics::numDeletes()
+ {
+ try
+ {
+ return m_nativeptr->get()->numDeletes();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+ System::UInt32 CqStatistics::numUpdates()
+ {
+ try
+ {
+ return m_nativeptr->get()->numUpdates();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
+ System::UInt32 CqStatistics::numEvents()
+ {
+ try
+ {
+ return m_nativeptr->get()->numEvents();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
- System::UInt32 CqStatistics::numInserts( )
- {
- return NativePtr->numInserts( );
- }
- System::UInt32 CqStatistics::numDeletes( )
- {
- return NativePtr->numDeletes( );
- }
- System::UInt32 CqStatistics::numUpdates( )
- {
- return NativePtr->numUpdates( );
- }
- System::UInt32 CqStatistics::numEvents( )
- {
- return NativePtr->numEvents( );
} // namespace Client
} // namespace Geode
} // namespace Apache
- } //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/CqStatistics.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/CqStatistics.hpp b/src/clicache/src/CqStatistics.hpp
index 69b6416..05aa23c 100644
--- a/src/clicache/src/CqStatistics.hpp
+++ b/src/clicache/src/CqStatistics.hpp
@@ -18,8 +18,10 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/CqStatistics.hpp>
-#include "impl/NativeWrapper.hpp"
+#include "end_native.hpp"
+#include "native_shared_ptr.hpp"
namespace Apache
@@ -28,12 +30,12 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
/// <summary>
/// Defines common statistical information for a cq.
/// </summary>
public ref class CqStatistics sealed
- : public Internal::SBWrap<apache::geode::client::CqStatistics>
{
public:
@@ -67,13 +69,10 @@ namespace Apache
/// <returns>
/// The managed wrapper object; null if the native pointer is null.
/// </returns>
- inline static CqStatistics^ Create( apache::geode::client::CqStatistics* nativeptr )
+ inline static CqStatistics^ Create( apache::geode::client::CqStatisticsPtr nativeptr )
{
- if (nativeptr == nullptr)
- {
- return nullptr;
- }
- return gcnew CqStatistics( nativeptr );
+ return __nullptr == nativeptr ? nullptr :
+ gcnew CqStatistics( nativeptr );
}
@@ -83,8 +82,13 @@ namespace Apache
/// Private constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline CqStatistics( apache::geode::client::CqStatistics* nativeptr )
- : SBWrap( nativeptr ) { }
+ inline CqStatistics( apache::geode::client::CqStatisticsPtr nativeptr )
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::CqStatistics>(nativeptr);
+ }
+
+ native_shared_ptr<native::CqStatistics>^ m_nativeptr;
+
};
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/DataInput.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/DataInput.cpp b/src/clicache/src/DataInput.cpp
index ea32707..e6d7ac1 100644
--- a/src/clicache/src/DataInput.cpp
+++ b/src/clicache/src/DataInput.cpp
@@ -15,14 +15,15 @@
* limitations under the License.
*/
-//#include "geode_includes.hpp"
-#include "DataInput.hpp"
+#include "begin_native.hpp"
#include <geode/Cache.hpp>
-//#include "CacheFactory.hpp"
-#include "Cache.hpp"
-#include <vcclr.h>
-//#include <geode/GeodeTypeIds.hpp>
#include <GeodeTypeIdsImpl.hpp>
+#include "end_native.hpp"
+
+#include <vcclr.h>
+
+#include "DataInput.hpp"
+#include "Cache.hpp"
#include "CacheableString.hpp"
#include "CacheableHashMap.hpp"
#include "CacheableStack.hpp"
@@ -31,7 +32,6 @@
#include "CacheableIDentityHashMap.hpp"
#include "CacheableDate.hpp"
#include "CacheableObjectArray.hpp"
-
#include "Serializable.hpp"
#include "impl/PdxHelper.hpp"
@@ -45,6 +45,7 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
DataInput::DataInput(System::Byte* buffer, int size)
{
@@ -53,13 +54,20 @@ namespace Apache
if (buffer != nullptr && size > 0) {
_GF_MG_EXCEPTION_TRY2
- SetPtr(new apache::geode::client::DataInput(buffer, size), true);
+ m_nativeptr = gcnew native_conditional_unique_ptr<native::DataInput>(std::make_unique<native::DataInput>(buffer, size));
m_cursor = 0;
m_isManagedObject = false;
m_forStringDecode = gcnew array<Char>(100);
- m_buffer = const_cast<System::Byte*>(NativePtr->currentBufferPosition());
- m_bufferLength = NativePtr->getBytesRemaining();
+ try
+ {
+ m_buffer = const_cast<System::Byte*>(m_nativeptr->get()->currentBufferPosition());
+ m_bufferLength = m_nativeptr->get()->getBytesRemaining();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -80,14 +88,21 @@ namespace Apache
GF_NEW(m_buffer, System::Byte[len]);
pin_ptr<const Byte> pin_buffer = &buffer[0];
memcpy(m_buffer, (void*)pin_buffer, len);
- SetPtr(new apache::geode::client::DataInput(m_buffer, len), true);
+ m_nativeptr = gcnew native_conditional_unique_ptr<native::DataInput>(std::unique_ptr<native::DataInput>(new native::DataInput(m_buffer, len)));
m_cursor = 0;
m_isManagedObject = false;
m_forStringDecode = gcnew array<Char>(100);
- m_buffer = const_cast<System::Byte*>(NativePtr->currentBufferPosition());
- m_bufferLength = NativePtr->getBytesRemaining();
+ try
+ {
+ m_buffer = const_cast<System::Byte*>(m_nativeptr->get()->currentBufferPosition());
+ m_bufferLength = m_nativeptr->get()->getBytesRemaining();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -114,10 +129,17 @@ namespace Apache
GF_NEW(m_buffer, System::Byte[len]);
pin_ptr<const Byte> pin_buffer = &buffer[0];
memcpy(m_buffer, (void*)pin_buffer, len);
- SetPtr(new apache::geode::client::DataInput(m_buffer, len), true);
+ m_nativeptr = gcnew native_conditional_unique_ptr<native::DataInput>(std::unique_ptr<native::DataInput>(new native::DataInput(m_buffer, len)));
- m_buffer = const_cast<System::Byte*>(NativePtr->currentBufferPosition());
- m_bufferLength = NativePtr->getBytesRemaining();
+ try
+ {
+ m_buffer = const_cast<System::Byte*>(m_nativeptr->get()->currentBufferPosition());
+ m_bufferLength = m_nativeptr->get()->getBytesRemaining();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -619,6 +641,8 @@ namespace Apache
Object^ DataInput::ReadInternalObject()
{
+ try
+ {
//Log::Debug("DataInput::ReadInternalObject m_cursor " + m_cursor);
bool findinternal = false;
int8_t typeId = ReadByte();
@@ -635,11 +659,11 @@ namespace Apache
System::Byte* cacheBuffer = m_buffer;
unsigned int cacheBufferLength = m_bufferLength;
Object^ ret = Internal::PdxHelper::DeserializePdx(this, false);
- int tmp = NativePtr->getBytesRemaining();
+ int tmp = m_nativeptr->get()->getBytesRemaining();
m_cursor = cacheBufferLength - tmp;
m_buffer = cacheBuffer;
m_bufferLength = cacheBufferLength;
- NativePtr->rewindCursor(m_cursor);
+ m_nativeptr->get()->rewindCursor(m_cursor);
if (ret != nullptr)
{
@@ -735,6 +759,11 @@ namespace Apache
newObj->FromData(this);
m_ispdxDesrialization = isPdxDeserialization;
return newObj;
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
Object^ DataInput::readDotNetObjectArray()
@@ -850,7 +879,14 @@ namespace Apache
AdvanceUMCursor();
SetBuffer();
- return NativePtr->getBytesRead();
+ try
+ {
+ return m_nativeptr->get()->getBytesRead();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
System::UInt32 DataInput::BytesReadInternally::get()
@@ -862,8 +898,14 @@ namespace Apache
{
AdvanceUMCursor();
SetBuffer();
- return NativePtr->getBytesRemaining();
- //return m_bufferLength - m_cursor;
+ try
+ {
+ return m_nativeptr->get()->getBytesRemaining();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
void DataInput::AdvanceCursor(System::Int32 offset)
@@ -874,24 +916,35 @@ namespace Apache
void DataInput::RewindCursor(System::Int32 offset)
{
AdvanceUMCursor();
- NativePtr->rewindCursor(offset);
+ try
+ {
+ m_nativeptr->get()->rewindCursor(offset);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
SetBuffer();
- //m_cursor -= offset;
}
void DataInput::Reset()
{
AdvanceUMCursor();
- NativePtr->reset();
+ try
+ {
+ m_nativeptr->get()->reset();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
SetBuffer();
- // m_cursor = 0;
}
void DataInput::Cleanup()
{
//TODO:
//GF_SAFE_DELETE_ARRAY(m_buffer);
- InternalCleanup();
}
void DataInput::ReadDictionary(System::Collections::IDictionary^ dict)
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/DataInput.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/DataInput.hpp b/src/clicache/src/DataInput.hpp
index 35bc6b5..8797381 100644
--- a/src/clicache/src/DataInput.hpp
+++ b/src/clicache/src/DataInput.hpp
@@ -18,12 +18,13 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/DataInput.hpp>
-#include "impl/NativeWrapper.hpp"
+#include "end_native.hpp"
+
+#include "native_conditional_unique_ptr.hpp"
#include "Log.hpp"
#include "ExceptionTypes.hpp"
-//#include "../../CacheableDate.hpp"
-
using namespace System;
using namespace System::Collections::Generic;
@@ -35,6 +36,8 @@ namespace Apache
namespace Client
{
+ namespace native = apache::geode::client;
+
interface class IGeodeSerializable;
/// <summary>
@@ -42,7 +45,6 @@ namespace Apache
/// strings, <c>IGeodeSerializable</c> objects from a byte stream.
/// </summary>
public ref class DataInput sealed
- : public Client::Internal::UMWrap<apache::geode::client::DataInput>
{
public:
@@ -211,17 +213,6 @@ namespace Apache
/// Reset the cursor to the start of buffer.
/// </summary>
void Reset();
-
- /// <summary>
- /// Get the underlying native unmanaged pointer.
- /// </summary>
- property IntPtr NativeIntPtr
- {
- inline IntPtr get()
- {
- return IntPtr(_NativePtr);
- }
- }
/// <summary>
/// Read a dictionary from the stream in a given dictionary instance.
@@ -287,6 +278,11 @@ namespace Apache
internal:
+ native::DataInput* GetNative()
+ {
+ return m_nativeptr->get();
+ }
+
void setPdxdeserialization(bool val)
{
m_ispdxDesrialization = true;
@@ -307,7 +303,13 @@ namespace Apache
const char * GetPoolName()
{
- return _NativePtr->getPoolName();
+ try
+ {
+ return m_nativeptr->get()->getPoolName();
+ }
+ finally {
+ GC::KeepAlive(m_nativeptr);
+ }
}
Object^ ReadDotNetTypes(int8_t typeId);
@@ -504,13 +506,26 @@ namespace Apache
System::Byte* GetBytes(System::Byte* src, System::UInt32 size)
{
- return NativePtr->getBufferCopyFrom(src, size);
+ try
+ {
+ return m_nativeptr->get()->getBufferCopyFrom(src, size);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
void AdvanceUMCursor()
{
- NativePtr->advanceCursor(m_cursor);
+ try {
+ m_nativeptr->get()->advanceCursor(m_cursor);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
m_cursor = 0;
m_bufferLength = 0;
}
@@ -532,7 +547,14 @@ namespace Apache
void ResetPdx(int offset)
{
- NativePtr->reset(offset);
+ try
+ {
+ m_nativeptr->get()->reset(offset);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
SetBuffer();
}
@@ -540,9 +562,16 @@ namespace Apache
void SetBuffer()
{
- m_buffer = const_cast<System::Byte*> (NativePtr->currentBufferPosition());
- m_cursor = 0;
- m_bufferLength = NativePtr->getBytesRemaining();
+ try
+ {
+ m_buffer = const_cast<System::Byte*> (m_nativeptr->get()->currentBufferPosition());
+ m_cursor = 0;
+ m_bufferLength = m_nativeptr->get()->getBytesRemaining();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
String^ DecodeBytes(int length)
@@ -628,8 +657,8 @@ namespace Apache
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
inline DataInput( apache::geode::client::DataInput* nativeptr, bool managedObject )
- : UMWrap(nativeptr, false)
{
+ m_nativeptr = gcnew native_conditional_unique_ptr<native::DataInput>(nativeptr);
m_ispdxDesrialization = false;
m_isRootObjectPdx = false;
m_cursor = 0;
@@ -646,20 +675,6 @@ namespace Apache
DataInput( System::Byte* buffer, int size );
- /* inline DataInput( apache::geode::client::DataInput* nativeptr )
- : UMWrap(nativeptr, false)
- {
- m_cursor = 0;
- m_isManagedObject = false;
- m_buffer = const_cast<System::Byte*>(nativeptr->currentBufferPosition());
- if ( m_buffer != NULL) {
- m_bufferLength = nativeptr->getBytesRemaining();
- }
- else {
- m_bufferLength = 0;
- }
- }*/
-
bool IsManagedObject()
{
return m_isManagedObject;
@@ -683,6 +698,8 @@ namespace Apache
int m_cursor;
bool m_isManagedObject;
array<Char>^ m_forStringDecode;
+
+ native_conditional_unique_ptr<native::DataInput>^ m_nativeptr;
void Cleanup( );
};
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/DataOutput.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/DataOutput.cpp b/src/clicache/src/DataOutput.cpp
index 3ea133d..8ced074 100644
--- a/src/clicache/src/DataOutput.cpp
+++ b/src/clicache/src/DataOutput.cpp
@@ -15,15 +15,18 @@
* limitations under the License.
*/
-//#include "geode_includes.hpp"
-#include "DataOutput.hpp"
+#include "begin_native.hpp"
#include <GeodeTypeIdsImpl.hpp>
+#include "end_native.hpp"
+
#include <vcclr.h>
+#include "DataOutput.hpp"
#include "IGeodeSerializable.hpp"
#include "CacheableObjectArray.hpp"
#include "impl/PdxHelper.hpp"
#include "impl/PdxWrapper.hpp"
+
using namespace System;
using namespace System::Runtime::InteropServices;
using namespace apache::geode::client;
@@ -731,23 +734,36 @@ namespace Apache
{
//first set native one
WriteBytesToUMDataOutput();
- NativePtr->rewindCursor(offset);
+ try
+ {
+ m_nativeptr->get()->rewindCursor(offset);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
SetBuffer();
}
array<Byte>^ DataOutput::GetBuffer()
{
- WriteBytesToUMDataOutput();
- SetBuffer();
-
- int buffLen = NativePtr->getBufferLength();
- array<Byte>^ buffer = gcnew array<Byte>(buffLen);
+ try
+ {
+ WriteBytesToUMDataOutput();
+ SetBuffer();
+ int buffLen = m_nativeptr->get()->getBufferLength();
+ array<Byte>^ buffer = gcnew array<Byte>(buffLen);
- if (buffLen > 0) {
- pin_ptr<Byte> pin_buffer = &buffer[0];
- memcpy((void*)pin_buffer, NativePtr->getBuffer(), buffLen);
+ if (buffLen > 0) {
+ pin_ptr<Byte> pin_buffer = &buffer[0];
+ memcpy((void*)pin_buffer, m_nativeptr->get()->getBuffer(), buffLen);
+ }
+ return buffer;
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
}
- return buffer;
}
System::UInt32 DataOutput::BufferLength::get()
@@ -756,13 +772,27 @@ namespace Apache
WriteBytesToUMDataOutput();
SetBuffer();
- return NativePtr->getBufferLength();
+ try
+ {
+ return m_nativeptr->get()->getBufferLength();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
void DataOutput::Reset()
{
WriteBytesToUMDataOutput();
- NativePtr->reset();
+ try
+ {
+ m_nativeptr->get()->reset();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
SetBuffer();
}
@@ -784,7 +814,14 @@ namespace Apache
void DataOutput::WriteBytesToUMDataOutput()
{
- NativePtr->advanceCursor(m_cursor);
+ try
+ {
+ m_nativeptr->get()->advanceCursor(m_cursor);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
m_cursor = 0;
m_remainingBufferLength = 0;
m_bytes = nullptr;
@@ -876,8 +913,7 @@ namespace Apache
void DataOutput::WriteDoubleArray(array<double>^ doubleArray)
{
WriteObject<double>(doubleArray);
- } // namespace Client
- } // namespace Geode
- } // namespace Apache
-
-}
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/DataOutput.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/DataOutput.hpp b/src/clicache/src/DataOutput.hpp
index f57179f..81e610d 100644
--- a/src/clicache/src/DataOutput.hpp
+++ b/src/clicache/src/DataOutput.hpp
@@ -18,8 +18,11 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/DataOutput.hpp>
-//#include "impl/NativeWrapper.hpp"
+#include "end_native.hpp"
+
+#include "native_conditional_unique_ptr.hpp"
#include "Log.hpp"
#include "ExceptionTypes.hpp"
#include "Serializable.hpp"
@@ -39,6 +42,7 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
interface class IGeodeSerializable;
@@ -48,7 +52,6 @@ namespace Apache
/// This class is intentionally not thread safe.
/// </summary>
public ref class DataOutput sealed
- : public Client::Internal::UMWrap<apache::geode::client::DataOutput>
{
private:
System::Int32 m_cursor;
@@ -56,18 +59,27 @@ namespace Apache
System::Byte * m_bytes;
System::Int32 m_remainingBufferLength;
bool m_ispdxSerialization;
+ native_conditional_unique_ptr<native::DataOutput>^ m_nativeptr;
+
public:
/// <summary>
/// Default constructor.
/// </summary>
inline DataOutput( )
- : UMWrap( new apache::geode::client::DataOutput( ), true )
{
+ m_nativeptr = gcnew native_conditional_unique_ptr<native::DataOutput>(std::make_unique<native::DataOutput>());
m_isManagedObject = true;
m_cursor = 0;
- m_bytes = const_cast<System::Byte *>(NativePtr->getCursor());
- m_remainingBufferLength = (System::Int32)NativePtr->getRemainingBufferLength();
+ try
+ {
+ m_bytes = const_cast<System::Byte *>(m_nativeptr->get()->getCursor());
+ m_remainingBufferLength = (System::Int32)m_nativeptr->get()->getRemainingBufferLength();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
m_ispdxSerialization = false;
}
@@ -278,17 +290,6 @@ namespace Apache
/// Reset the cursor to the start of the buffer.
/// </summary>
void Reset( );
-
- /// <summary>
- /// Get the underlying native unmanaged pointer.
- /// </summary>
- property IntPtr NativeIntPtr
- {
- inline IntPtr get()
- {
- return IntPtr(_NativePtr);
- }
- }
/// <summary>
/// Write a Dictionary to the DataOutput.
@@ -364,6 +365,11 @@ namespace Apache
internal:
+ native::DataOutput* GetNative()
+ {
+ return m_nativeptr->get();
+ }
+
void WriteDotNetObjectArray(Object^ objectArray);
/// <summary>
@@ -393,7 +399,14 @@ namespace Apache
System::Int32 GetBufferLengthPdx()
{
- return (System::Int32)NativePtr->getBufferLength();
+ try
+ {
+ return (System::Int32)m_nativeptr->get()->getBufferLength();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
void WriteString(String^ value);
@@ -405,7 +418,14 @@ namespace Apache
const char * GetPoolName()
{
- return _NativePtr->getPoolName();
+ try
+ {
+ return m_nativeptr->get()->getPoolName();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
void WriteStringArray(array<String^>^ strArray);
@@ -543,13 +563,27 @@ namespace Apache
void SetBuffer()
{
m_cursor = 0;
- m_bytes = const_cast<System::Byte *>(NativePtr->getCursor());
- m_remainingBufferLength = (System::Int32)NativePtr->getRemainingBufferLength();
+ try
+ {
+ m_bytes = const_cast<System::Byte *>(m_nativeptr->get()->getCursor());
+ m_remainingBufferLength = (System::Int32)m_nativeptr->get()->getRemainingBufferLength();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
System::Byte* GetStartBufferPosition()
{
- return const_cast<System::Byte *>( NativePtr->getBuffer());;
+ try
+ {
+ return const_cast<System::Byte *>( m_nativeptr->get()->getBuffer());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ };
}
inline void EnsureCapacity( System::Int32 size )
@@ -558,14 +592,19 @@ namespace Apache
if ( bytesLeft < size ) {
try
{
- NativePtr->ensureCapacity(m_cursor + size);
- m_bytes = const_cast<System::Byte *>( NativePtr->getCursor());
- m_remainingBufferLength = (System::Int32)NativePtr->getRemainingBufferLength();
+ auto p = m_nativeptr->get();
+ p->ensureCapacity(m_cursor + size);
+ m_bytes = const_cast<System::Byte *>( p->getCursor());
+ m_remainingBufferLength = (System::Int32)p->getRemainingBufferLength();
}
catch(apache::geode::client::OutOfMemoryException ex )
{
throw gcnew OutOfMemoryException(ex);
}
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
}
@@ -579,12 +618,26 @@ namespace Apache
System::Byte* GetBytes(System::Byte* src, System::UInt32 size)
{
- return NativePtr->getBufferCopyFrom(src, size);
+ try
+ {
+ return m_nativeptr->get()->getBufferCopyFrom(src, size);
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
System::Int32 GetRemainingBufferLength()
{
- return (System::Int32) NativePtr->getRemainingBufferLength();
+ try
+ {
+ return (System::Int32) m_nativeptr->get()->getRemainingBufferLength();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
/// <summary>
@@ -592,8 +645,8 @@ namespace Apache
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
inline DataOutput( apache::geode::client::DataOutput* nativeptr, bool managedObject )
- : UMWrap( nativeptr, false )
{
+ m_nativeptr = gcnew native_conditional_unique_ptr<native::DataOutput>(nativeptr);
m_isManagedObject = managedObject;
m_cursor = 0;
m_bytes = const_cast<System::Byte *>(nativeptr->getCursor());
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/DiskPolicyType.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/DiskPolicyType.hpp b/src/clicache/src/DiskPolicyType.hpp
index 03d66d8..e9d3953 100644
--- a/src/clicache/src/DiskPolicyType.hpp
+++ b/src/clicache/src/DiskPolicyType.hpp
@@ -20,7 +20,10 @@
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/DiskPolicyType.hpp>
+#include "end_native.hpp"
+
using namespace System;
[28/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from cppcache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/Region.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/Region.cpp b/src/clicache/src/Region.cpp
index 917f182..6100412 100644
--- a/src/clicache/src/Region.cpp
+++ b/src/clicache/src/Region.cpp
@@ -51,7 +51,7 @@ namespace Apache
apache::geode::client::UserDataPtr callbackptr(
Serializable::GetUnmanagedValueGeneric<Object^>(callbackArg));
apache::geode::client::CacheablePtr nativeptr(this->get(keyptr, callbackptr));
- if (nativeptr == NULLPTR)
+ if (nativeptr == nullptr)
{
throw gcnew KeyNotFoundException("The given key was not present in the region.");
}
@@ -111,7 +111,7 @@ namespace Apache
{
apache::geode::client::CacheableKeyPtr keyptr(Serializable::GetUnmanagedValueGeneric<TKey>(key));
apache::geode::client::CacheablePtr nativeptr(this->get(keyptr));
- if (nativeptr == NULLPTR)
+ if (nativeptr == nullptr)
{
throw gcnew KeyNotFoundException("The given key was not present in the region.");
}
@@ -184,15 +184,15 @@ namespace Apache
generic<class TKey, class TValue>
bool Region<TKey, TValue>::AreValuesEqual(apache::geode::client::CacheablePtr& val1, apache::geode::client::CacheablePtr& val2)
{
- if (val1 == NULLPTR && val2 == NULLPTR)
+ if (val1 == nullptr && val2 == nullptr)
{
return true;
}
- else if ((val1 == NULLPTR && val2 != NULLPTR) || (val1 != NULLPTR && val2 == NULLPTR))
+ else if ((val1 == nullptr && val2 != nullptr) || (val1 != nullptr && val2 == nullptr))
{
return false;
}
- else if (val1 != NULLPTR && val2 != NULLPTR)
+ else if (val1 != nullptr && val2 != nullptr)
{
if (val1->classId() != val2->classId() || val1->typeId() != val2->typeId())
{
@@ -221,7 +221,7 @@ namespace Apache
apache::geode::client::CacheableKeyPtr keyptr(Serializable::GetUnmanagedValueGeneric<TKey>(keyValuePair.Key));
apache::geode::client::CacheablePtr nativeptr(this->get(keyptr));
//This means that key is not present.
- if (nativeptr == NULLPTR) {
+ if (nativeptr == nullptr) {
return false;
}
TValue value = Serializable::GetManagedValueGeneric<TValue>(nativeptr);
@@ -246,7 +246,7 @@ namespace Apache
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
apache::geode::client::CacheableKeyPtr keyptr(Serializable::GetUnmanagedValueGeneric<TKey>(key));
apache::geode::client::CacheablePtr nativeptr(this->get(keyptr));
- if (nativeptr == NULLPTR) {
+ if (nativeptr == nullptr) {
val = TValue();
return false;
}
@@ -540,11 +540,11 @@ namespace Apache
Serializable::GetUnmanagedValueGeneric<TKey>(item));
}
- apache::geode::client::HashMapOfCacheablePtr valuesPtr(NULLPTR);
+ apache::geode::client::HashMapOfCacheablePtr valuesPtr(nullptr);
if (values != nullptr) {
valuesPtr = new apache::geode::client::HashMapOfCacheable();
}
- apache::geode::client::HashMapOfExceptionPtr exceptionsPtr(NULLPTR);
+ apache::geode::client::HashMapOfExceptionPtr exceptionsPtr(nullptr);
if (exceptions != nullptr) {
exceptionsPtr = new apache::geode::client::HashMapOfException();
}
@@ -591,11 +591,11 @@ namespace Apache
Serializable::GetUnmanagedValueGeneric<TKey>(item));
}
- apache::geode::client::HashMapOfCacheablePtr valuesPtr(NULLPTR);
+ apache::geode::client::HashMapOfCacheablePtr valuesPtr(nullptr);
if (values != nullptr) {
valuesPtr = new apache::geode::client::HashMapOfCacheable();
}
- apache::geode::client::HashMapOfExceptionPtr exceptionsPtr(NULLPTR);
+ apache::geode::client::HashMapOfExceptionPtr exceptionsPtr(nullptr);
if (exceptions != nullptr) {
exceptionsPtr = new apache::geode::client::HashMapOfException();
}
@@ -677,7 +677,7 @@ namespace Apache
apache::geode::client::RegionPtr& nativeptr(NativePtr->getParentRegion());
- return Region::Create(nativeptr.ptr());
+ return Region::Create(nativeptr.get());
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -689,7 +689,7 @@ namespace Apache
apache::geode::client::RegionAttributesPtr& nativeptr(NativePtr->getAttributes());
- return Apache::Geode::Client::RegionAttributes<TKey, TValue>::Create(nativeptr.ptr());
+ return Apache::Geode::Client::RegionAttributes<TKey, TValue>::Create(nativeptr.get());
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -702,7 +702,7 @@ namespace Apache
apache::geode::client::AttributesMutatorPtr& nativeptr(
NativePtr->getAttributesMutator());
- return Apache::Geode::Client::AttributesMutator<TKey, TValue>::Create(nativeptr.ptr());
+ return Apache::Geode::Client::AttributesMutator<TKey, TValue>::Create(nativeptr.get());
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -713,7 +713,7 @@ namespace Apache
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
apache::geode::client::CacheStatisticsPtr& nativeptr(NativePtr->getStatistics());
- return Apache::Geode::Client::CacheStatistics::Create(nativeptr.ptr());
+ return Apache::Geode::Client::CacheStatistics::Create(nativeptr.get());
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -726,7 +726,7 @@ namespace Apache
ManagedString mg_path(path);
apache::geode::client::RegionPtr& nativeptr(
NativePtr->getSubregion(mg_path.CharPtr));
- return Region::Create(nativeptr.ptr());
+ return Region::Create(nativeptr.get());
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -743,8 +743,8 @@ namespace Apache
GetNativePtrFromSBWrapGeneric<apache::geode::client::RegionAttributes>(attributes));
apache::geode::client::RegionPtr& nativeptr(NativePtr->createSubregion(
- mg_subregionName.CharPtr, p_attrs /*NULLPTR*/));
- return Region::Create(nativeptr.ptr());
+ mg_subregionName.CharPtr, p_attrs /*nullptr*/));
+ return Region::Create(nativeptr.get());
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
@@ -763,7 +763,7 @@ namespace Apache
for (System::Int32 index = 0; index < vsr.size(); index++)
{
apache::geode::client::RegionPtr& nativeptr(vsr[index]);
- subRegions[index] = Region<TKey, TValue>::Create(nativeptr.ptr());
+ subRegions[index] = Region<TKey, TValue>::Create(nativeptr.get());
}
System::Collections::Generic::ICollection<IRegion<TKey, TValue>^>^ collection =
(System::Collections::Generic::ICollection<IRegion<TKey, TValue>^>^)subRegions;
@@ -779,7 +779,7 @@ namespace Apache
apache::geode::client::CacheableKeyPtr keyptr(Serializable::GetUnmanagedValueGeneric<TKey>(key));
apache::geode::client::RegionEntryPtr& nativeptr(NativePtr->getEntry(keyptr));
- return RegionEntry<TKey, TValue>::Create(nativeptr.ptr());
+ return RegionEntry<TKey, TValue>::Create(nativeptr.get());
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -796,7 +796,7 @@ namespace Apache
for (System::Int32 index = 0; index < vc.size(); index++)
{
apache::geode::client::RegionEntryPtr& nativeptr(vc[index]);
- entryarr[index] = RegionEntry<TKey, TValue>::Create(nativeptr.ptr());
+ entryarr[index] = RegionEntry<TKey, TValue>::Create(nativeptr.get());
}
System::Collections::Generic::ICollection<RegionEntry<TKey, TValue>^>^ collection =
(System::Collections::Generic::ICollection<RegionEntry<TKey, TValue>^>^)entryarr;
@@ -814,15 +814,15 @@ namespace Apache
apache::geode::client::RegionServicePtr& nativeptr(NativePtr->getRegionService());
- apache::geode::client::Cache* realCache = dynamic_cast<apache::geode::client::Cache*>(nativeptr.ptr());
+ apache::geode::client::Cache* realCache = dynamic_cast<apache::geode::client::Cache*>(nativeptr.get());
if (realCache != NULL)
{
- return Apache::Geode::Client::Cache::Create(((apache::geode::client::CachePtr)nativeptr).ptr());
+ return Apache::Geode::Client::Cache::Create(((apache::geode::client::CachePtr)nativeptr).get());
}
else
{
- return Apache::Geode::Client::AuthenticatedCache::Create(nativeptr.ptr());
+ return Apache::Geode::Client::AuthenticatedCache::Create(nativeptr.get());
}
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
@@ -989,8 +989,7 @@ namespace Apache
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
if (resultKeys != nullptr) {
- apache::geode::client::VectorOfCacheableKeyPtr mg_keys(
- new apache::geode::client::VectorOfCacheableKey());
+ auto mg_keys = std::make_shared<apache::geode::client::VectorOfCacheableKey>();
NativePtr->registerAllKeys(isDurable, mg_keys, getInitialValues, receiveValues);
@@ -1000,7 +999,7 @@ namespace Apache
}
}
else {
- NativePtr->registerAllKeys(isDurable, NULLPTR, getInitialValues, receiveValues);
+ NativePtr->registerAllKeys(isDurable, nullptr, getInitialValues, receiveValues);
}
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
@@ -1097,8 +1096,7 @@ namespace Apache
ManagedString mg_regex(regex);
if (resultKeys != nullptr) {
- apache::geode::client::VectorOfCacheableKeyPtr mg_keys(
- new apache::geode::client::VectorOfCacheableKey());
+ auto mg_keys = std::make_shared<apache::geode::client::VectorOfCacheableKey>();
NativePtr->registerRegex(mg_regex.CharPtr, isDurable,
mg_keys, getInitialValues, receiveValues);
@@ -1109,7 +1107,7 @@ namespace Apache
}
else {
NativePtr->registerRegex(mg_regex.CharPtr, isDurable,
- NULLPTR, getInitialValues, receiveValues);
+ nullptr, getInitialValues, receiveValues);
}
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
@@ -1138,14 +1136,14 @@ namespace Apache
apache::geode::client::SelectResultsPtr& nativeptr = NativePtr->query(
mg_predicate.CharPtr, DEFAULT_QUERY_RESPONSE_TIMEOUT);
- if (nativeptr.ptr() == NULL) return nullptr;
+ if (nativeptr.get() == NULL) return nullptr;
apache::geode::client::ResultSet* resultptr = dynamic_cast<apache::geode::client::ResultSet*>(
- nativeptr.ptr());
+ nativeptr.get());
if (resultptr == NULL)
{
apache::geode::client::StructSet* structptr = dynamic_cast<apache::geode::client::StructSet*>(
- nativeptr.ptr());
+ nativeptr.get());
if (structptr == NULL)
{
return nullptr;
@@ -1170,14 +1168,14 @@ namespace Apache
apache::geode::client::SelectResultsPtr& nativeptr = NativePtr->query(
mg_predicate.CharPtr, timeout);
- if (nativeptr.ptr() == NULL) return nullptr;
+ if (nativeptr.get() == NULL) return nullptr;
apache::geode::client::ResultSet* resultptr = dynamic_cast<apache::geode::client::ResultSet*>(
- nativeptr.ptr());
+ nativeptr.get());
if (resultptr == NULL)
{
apache::geode::client::StructSet* structptr = dynamic_cast<apache::geode::client::StructSet*>(
- nativeptr.ptr());
+ nativeptr.get());
if (structptr == NULL)
{
return nullptr;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/RegionAttributes.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/RegionAttributes.cpp b/src/clicache/src/RegionAttributes.cpp
index 558dc7c..fe4d12b 100644
--- a/src/clicache/src/RegionAttributes.cpp
+++ b/src/clicache/src/RegionAttributes.cpp
@@ -353,7 +353,7 @@ namespace Apache
{
apache::geode::client::PropertiesPtr& nativeptr(
NativePtr->getPersistenceProperties());
- return Properties<String^, String^>::Create<String^, String^>(nativeptr.ptr());
+ return Properties<String^, String^>::Create<String^, String^>(nativeptr.get());
}
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/RegionFactory.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/RegionFactory.cpp b/src/clicache/src/RegionFactory.cpp
index 08f2e2d..93a5e7a 100644
--- a/src/clicache/src/RegionFactory.cpp
+++ b/src/clicache/src/RegionFactory.cpp
@@ -135,7 +135,7 @@ namespace Apache
PersistenceManagerGeneric<TKey, TValue>^ clg = gcnew PersistenceManagerGeneric<TKey, TValue>();
clg->SetPersistenceManager(persistenceManager);
persistenceManagerptr = new apache::geode::client::ManagedPersistenceManagerGeneric( /*clg,*/ persistenceManager);
- ((apache::geode::client::ManagedPersistenceManagerGeneric*)persistenceManagerptr.ptr())->setptr(clg);
+ ((apache::geode::client::ManagedPersistenceManagerGeneric*)persistenceManagerptr.get())->setptr(clg);
}
apache::geode::client::PropertiesPtr configptr(GetNativePtr<apache::geode::client::Properties>( config ) );
NativePtr->setPersistenceManager( persistenceManagerptr, configptr );
@@ -263,7 +263,7 @@ namespace Apache
CacheLoaderGeneric<TKey, TValue>^ clg = gcnew CacheLoaderGeneric<TKey, TValue>();
clg->SetCacheLoader(cacheLoader);
loaderptr = new apache::geode::client::ManagedCacheLoaderGeneric( /*clg,*/ cacheLoader );
- ((apache::geode::client::ManagedCacheLoaderGeneric*)loaderptr.ptr())->setptr(clg);
+ ((apache::geode::client::ManagedCacheLoaderGeneric*)loaderptr.get())->setptr(clg);
}
NativePtr->setCacheLoader( loaderptr );
return this;
@@ -277,7 +277,7 @@ namespace Apache
CacheWriterGeneric<TKey, TValue>^ cwg = gcnew CacheWriterGeneric<TKey, TValue>();
cwg->SetCacheWriter(cacheWriter);
writerptr = new apache::geode::client::ManagedCacheWriterGeneric( /*cwg,*/ cacheWriter );
- ((apache::geode::client::ManagedCacheWriterGeneric*)writerptr.ptr())->setptr(cwg);
+ ((apache::geode::client::ManagedCacheWriterGeneric*)writerptr.get())->setptr(cwg);
}
NativePtr->setCacheWriter( writerptr );
return this;
@@ -291,7 +291,7 @@ namespace Apache
CacheListenerGeneric<TKey, TValue>^ clg = gcnew CacheListenerGeneric<TKey, TValue>();
clg->SetCacheListener(cacheListener);
listenerptr = new apache::geode::client::ManagedCacheListenerGeneric( /*clg,*/ cacheListener );
- ((apache::geode::client::ManagedCacheListenerGeneric*)listenerptr.ptr())->setptr(clg);
+ ((apache::geode::client::ManagedCacheListenerGeneric*)listenerptr.get())->setptr(clg);
/*
listenerptr = new apache::geode::client::ManagedCacheListenerGeneric(
(Client::ICacheListener<Object^, Object^>^)cacheListener);
@@ -312,13 +312,13 @@ namespace Apache
FixedPartitionResolverGeneric<TKey, TValue>^ prg = gcnew FixedPartitionResolverGeneric<TKey, TValue>();
prg->SetPartitionResolver(resolver);
resolverptr = new apache::geode::client::ManagedFixedPartitionResolverGeneric( resolver );
- ((apache::geode::client::ManagedFixedPartitionResolverGeneric*)resolverptr.ptr())->setptr(prg);
+ ((apache::geode::client::ManagedFixedPartitionResolverGeneric*)resolverptr.get())->setptr(prg);
}
else {
PartitionResolverGeneric<TKey, TValue>^ prg = gcnew PartitionResolverGeneric<TKey, TValue>();
prg->SetPartitionResolver(partitionresolver);
resolverptr = new apache::geode::client::ManagedPartitionResolverGeneric( partitionresolver );
- ((apache::geode::client::ManagedPartitionResolverGeneric*)resolverptr.ptr())->setptr(prg);
+ ((apache::geode::client::ManagedPartitionResolverGeneric*)resolverptr.get())->setptr(prg);
}
}
NativePtr->setPartitionResolver( resolverptr );
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/ResultCollector.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/ResultCollector.cpp b/src/clicache/src/ResultCollector.cpp
index c5d8bf1..13220eb 100644
--- a/src/clicache/src/ResultCollector.cpp
+++ b/src/clicache/src/ResultCollector.cpp
@@ -37,7 +37,7 @@ namespace Apache
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
apache::geode::client::Serializable * result = SafeGenericMSerializableConvert((IGeodeSerializable^)rs);
- NativePtr->addResult( result==NULL ? (NULLPTR) : (apache::geode::client::CacheablePtr(result)) );
+ NativePtr->addResult( result==NULL ? (nullptr) : (apache::geode::client::CacheablePtr(result)) );
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/ResultSet.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/ResultSet.cpp b/src/clicache/src/ResultSet.cpp
index 9ddcf6f..d3a83e7 100644
--- a/src/clicache/src/ResultSet.cpp
+++ b/src/clicache/src/ResultSet.cpp
@@ -46,7 +46,7 @@ namespace Apache
generic<class TResult>
/*IGeodeSerializable^*/TResult ResultSet<TResult>::default::get( size_t index )
{
- //return SafeUMSerializableConvertGeneric(NativePtr->operator[](static_cast<System::Int32>(index)).ptr());
+ //return SafeUMSerializableConvertGeneric(NativePtr->operator[](static_cast<System::Int32>(index)).get());
return (Serializable::GetManagedValueGeneric<TResult>(NativePtr->operator[](static_cast<System::Int32>(index))));
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/Serializable.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/Serializable.cpp b/src/clicache/src/Serializable.cpp
index 0d27fbb..a6ca57c 100644
--- a/src/clicache/src/Serializable.cpp
+++ b/src/clicache/src/Serializable.cpp
@@ -227,7 +227,7 @@ namespace Apache
IGeodeSerializable^ Serializable::GetPDXTypeById(const char* poolName, System::Int32 typeId)
{
SerializablePtr sPtr = apache::geode::client::SerializationRegistry::GetPDXTypeById(poolName, typeId);
- return SafeUMSerializableConvertGeneric(sPtr.ptr());
+ return SafeUMSerializableConvertGeneric(sPtr.get());
}
int Serializable::GetEnumValue(Internal::EnumInfo^ ei)
@@ -239,7 +239,7 @@ namespace Apache
Internal::EnumInfo^ Serializable::GetEnum(int val)
{
SerializablePtr sPtr = apache::geode::client::SerializationRegistry::GetEnum(val);
- return (Internal::EnumInfo^)SafeUMSerializableConvertGeneric(sPtr.ptr());
+ return (Internal::EnumInfo^)SafeUMSerializableConvertGeneric(sPtr.get());
}
void Serializable::RegisterPdxType(PdxTypeFactoryMethod^ creationMethod)
@@ -611,7 +611,7 @@ namespace Apache
generic<class TValue>
TValue Serializable::GetManagedValueGeneric(apache::geode::client::SerializablePtr val)
{
- if (val == NULLPTR)
+ if (val == nullptr)
{
return TValue();
}
@@ -689,7 +689,7 @@ namespace Apache
{
//TODO::
Apache::Geode::Client::CacheableDate^ ret = static_cast<Apache::Geode::Client::CacheableDate ^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableDate^>(val.ptr()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableDate^>(val.get()));
System::DateTime dt(ret->Value.Ticks);
return safe_cast<TValue>(dt);
@@ -699,13 +699,13 @@ namespace Apache
case apache::geode::client::GeodeTypeIdsImpl::CacheableUserData4:
{
//TODO::split
- IGeodeSerializable^ ret = SafeUMSerializableConvertGeneric(val.ptr());
+ IGeodeSerializable^ ret = SafeUMSerializableConvertGeneric(val.get());
return safe_cast<TValue>(ret);
//return TValue();
}
case apache::geode::client::GeodeTypeIdsImpl::PDX:
{
- IPdxSerializable^ ret = SafeUMSerializablePDXConvert(val.ptr());
+ IPdxSerializable^ ret = SafeUMSerializablePDXConvert(val.get());
PdxWrapper^ pdxWrapper = dynamic_cast<PdxWrapper^>(ret);
@@ -719,49 +719,49 @@ namespace Apache
case apache::geode::client::GeodeTypeIds::CacheableBytes:
{
Apache::Geode::Client::CacheableBytes^ ret = safe_cast<Apache::Geode::Client::CacheableBytes ^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableBytes^>(val.ptr()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableBytes^>(val.get()));
return safe_cast<TValue>(ret->Value);
}
case apache::geode::client::GeodeTypeIds::CacheableDoubleArray:
{
Apache::Geode::Client::CacheableDoubleArray^ ret = safe_cast<Apache::Geode::Client::CacheableDoubleArray ^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableDoubleArray^>(val.ptr()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableDoubleArray^>(val.get()));
return safe_cast<TValue>(ret->Value);
}
case apache::geode::client::GeodeTypeIds::CacheableFloatArray:
{
Apache::Geode::Client::CacheableFloatArray^ ret = safe_cast<Apache::Geode::Client::CacheableFloatArray^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableFloatArray^>(val.ptr()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableFloatArray^>(val.get()));
return safe_cast<TValue>(ret->Value);
}
case apache::geode::client::GeodeTypeIds::CacheableInt16Array:
{
Apache::Geode::Client::CacheableInt16Array^ ret = safe_cast<Apache::Geode::Client::CacheableInt16Array^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableInt16Array^>(val.ptr()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableInt16Array^>(val.get()));
return safe_cast<TValue>(ret->Value);
}
case apache::geode::client::GeodeTypeIds::CacheableInt32Array:
{
Apache::Geode::Client::CacheableInt32Array^ ret = safe_cast<Apache::Geode::Client::CacheableInt32Array^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableInt32Array^>(val.ptr()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableInt32Array^>(val.get()));
return safe_cast<TValue>(ret->Value);
}
case apache::geode::client::GeodeTypeIds::CacheableInt64Array:
{
Apache::Geode::Client::CacheableInt64Array^ ret = safe_cast<Apache::Geode::Client::CacheableInt64Array^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableInt64Array^>(val.ptr()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableInt64Array^>(val.get()));
return safe_cast<TValue>(ret->Value);
}
case apache::geode::client::GeodeTypeIds::CacheableStringArray:
{
Apache::Geode::Client::CacheableStringArray^ ret = safe_cast<Apache::Geode::Client::CacheableStringArray^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableStringArray^>(val.ptr()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableStringArray^>(val.get()));
/* array<String^>^ str = gcnew array<String^>(ret->GetValues()->Length);
for(int i=0; i<ret->GetValues()->Length; i++ ) {
@@ -773,100 +773,100 @@ namespace Apache
case apache::geode::client::GeodeTypeIds::CacheableArrayList://Ilist generic
{
Apache::Geode::Client::CacheableArrayList^ ret = safe_cast<Apache::Geode::Client::CacheableArrayList^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableArrayList^>(val.ptr()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableArrayList^>(val.get()));
return safe_cast<TValue>(ret->Value);
}
case apache::geode::client::GeodeTypeIds::CacheableLinkedList://LinkedList generic
{
Apache::Geode::Client::CacheableLinkedList^ ret = safe_cast<Apache::Geode::Client::CacheableLinkedList^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableLinkedList^>(val.ptr()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableLinkedList^>(val.get()));
return safe_cast<TValue>(ret->Value);
}
case apache::geode::client::GeodeTypeIds::CacheableHashTable://collection::hashtable
{
Apache::Geode::Client::CacheableHashTable^ ret = safe_cast<Apache::Geode::Client::CacheableHashTable^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableHashTable^>(val.ptr()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableHashTable^>(val.get()));
return safe_cast<TValue>(ret->Value);
}
case apache::geode::client::GeodeTypeIds::CacheableHashMap://generic dictionary
{
Apache::Geode::Client::CacheableHashMap^ ret = safe_cast<Apache::Geode::Client::CacheableHashMap^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableHashMap^>(val.ptr()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableHashMap^>(val.get()));
return safe_cast<TValue>(ret->Value);
}
case apache::geode::client::GeodeTypeIds::CacheableIdentityHashMap:
{
Apache::Geode::Client::CacheableIdentityHashMap^ ret = static_cast<Apache::Geode::Client::CacheableIdentityHashMap^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableIdentityHashMap^>(val.ptr()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableIdentityHashMap^>(val.get()));
return safe_cast<TValue>(ret->Value);
}
case apache::geode::client::GeodeTypeIds::CacheableHashSet://no need of it, default case should work
{
Apache::Geode::Client::CacheableHashSet^ ret = static_cast<Apache::Geode::Client::CacheableHashSet^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableHashSet^>(val.ptr()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableHashSet^>(val.get()));
return safe_cast<TValue>(ret);
}
case apache::geode::client::GeodeTypeIds::CacheableLinkedHashSet://no need of it, default case should work
{
Apache::Geode::Client::CacheableLinkedHashSet^ ret = static_cast<Apache::Geode::Client::CacheableLinkedHashSet^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableLinkedHashSet^>(val.ptr()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableLinkedHashSet^>(val.get()));
return safe_cast<TValue>(ret);
}
case apache::geode::client::GeodeTypeIds::CacheableFileName:
{
Apache::Geode::Client::CacheableFileName^ ret = static_cast<Apache::Geode::Client::CacheableFileName^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableFileName^>(val.ptr()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableFileName^>(val.get()));
return safe_cast<TValue>(ret);
}
case apache::geode::client::GeodeTypeIds::CacheableObjectArray:
{
Apache::Geode::Client::CacheableObjectArray^ ret = static_cast<Apache::Geode::Client::CacheableObjectArray^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableObjectArray^>(val.ptr()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableObjectArray^>(val.get()));
return safe_cast<TValue>(ret);
}
case apache::geode::client::GeodeTypeIds::CacheableVector://collection::arraylist
{
Apache::Geode::Client::CacheableVector^ ret = static_cast<Apache::Geode::Client::CacheableVector^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableVector^>(val.ptr()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableVector^>(val.get()));
return safe_cast<TValue>(ret->Value);
}
case apache::geode::client::GeodeTypeIds::CacheableUndefined:
{
Apache::Geode::Client::CacheableUndefined^ ret = static_cast<Apache::Geode::Client::CacheableUndefined^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableUndefined^>(val.ptr()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableUndefined^>(val.get()));
return safe_cast<TValue>(ret);
}
case apache::geode::client::GeodeTypeIds::Struct:
{
- return safe_cast<TValue>(Apache::Geode::Client::Struct::Create(val.ptr()));
+ return safe_cast<TValue>(Apache::Geode::Client::Struct::Create(val.get()));
}
case apache::geode::client::GeodeTypeIds::CacheableStack:
{
Apache::Geode::Client::CacheableStack^ ret = static_cast<Apache::Geode::Client::CacheableStack^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableStack^>(val.ptr()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableStack^>(val.get()));
return safe_cast<TValue>(ret->Value);
}
case 7: //GeodeClassIds::CacheableManagedObject
{
Apache::Geode::Client::CacheableObject^ ret = static_cast<Apache::Geode::Client::CacheableObject^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableObject^>(val.ptr()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableObject^>(val.get()));
return safe_cast<TValue>(ret);
}
case 8://GeodeClassIds::CacheableManagedObjectXml
{
Apache::Geode::Client::CacheableObjectXml^ ret = static_cast<Apache::Geode::Client::CacheableObjectXml^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableObjectXml^>(val.ptr()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableObjectXml^>(val.get()));
return safe_cast<TValue>(ret);
}
/* TODO: replace with IDictionary<K, V>
case apache::geode::client::GeodeTypeIds::Properties:
{
Apache::Geode::Client::Properties^ ret = safe_cast<Apache::Geode::Client::Properties^>
- ( SafeGenericUMSerializableConvert<Apache::Geode::Client::Properties^>(val.ptr()));
+ ( SafeGenericUMSerializableConvert<Apache::Geode::Client::Properties^>(val.get()));
return safe_cast<TValue>(ret);
}*/
@@ -874,21 +874,21 @@ namespace Apache
case apache::geode::client::GeodeTypeIds::BooleanArray:
{
Apache::Geode::Client::BooleanArray^ ret = safe_cast<Apache::Geode::Client::BooleanArray^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::BooleanArray^>(val.ptr()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::BooleanArray^>(val.get()));
return safe_cast<TValue>(ret->Value);
}
case apache::geode::client::GeodeTypeIds::CharArray:
{
Apache::Geode::Client::CharArray^ ret = safe_cast<Apache::Geode::Client::CharArray^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CharArray^>(val.ptr()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CharArray^>(val.get()));
return safe_cast<TValue>(ret->Value);
}
case 0://UserFunctionExecutionException unregistered
{
Apache::Geode::Client::UserFunctionExecutionException^ ret = static_cast<Apache::Geode::Client::UserFunctionExecutionException^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::UserFunctionExecutionException^>(val.ptr()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::UserFunctionExecutionException^>(val.get()));
return safe_cast<TValue>(ret);
}
default:
@@ -905,7 +905,7 @@ namespace Apache
//System::Type^ managedType = key->GetType();
return GetUnmanagedValueGeneric(key->GetType(), key);
}
- return NULLPTR;
+ return nullptr;
}
generic<class TKey>
@@ -916,7 +916,7 @@ namespace Apache
//System::Type^ managedType = key->GetType();
return GetUnmanagedValueGeneric(key->GetType(), key, isAciiChar);
}
- return NULLPTR;
+ return nullptr;
}
void Serializable::RegisterPdxSerializer(IPdxSerializer^ pdxSerializer)
@@ -1271,7 +1271,7 @@ namespace Apache
String^ Serializable::GetString(apache::geode::client::CacheableStringPtr cStr)//apache::geode::client::CacheableString*
{
- if (cStr == NULLPTR) {
+ if (cStr == nullptr) {
return nullptr;
}
else if (cStr->isWideString()) {
@@ -1287,7 +1287,7 @@ namespace Apache
//byte
Byte Serializable::getByte(apache::geode::client::SerializablePtr nativeptr)
{
- apache::geode::client::CacheableByte* ci = static_cast<apache::geode::client::CacheableByte*>(nativeptr.ptr());
+ apache::geode::client::CacheableByte* ci = static_cast<apache::geode::client::CacheableByte*>(nativeptr.get());
return ci->value();
}
@@ -1299,7 +1299,7 @@ namespace Apache
//boolean
bool Serializable::getBoolean(apache::geode::client::SerializablePtr nativeptr)
{
- apache::geode::client::CacheableBoolean* ci = static_cast<apache::geode::client::CacheableBoolean*>(nativeptr.ptr());
+ apache::geode::client::CacheableBoolean* ci = static_cast<apache::geode::client::CacheableBoolean*>(nativeptr.get());
return ci->value();
}
@@ -1311,7 +1311,7 @@ namespace Apache
//widechar
Char Serializable::getChar(apache::geode::client::SerializablePtr nativeptr)
{
- apache::geode::client::CacheableWideChar* ci = static_cast<apache::geode::client::CacheableWideChar*>(nativeptr.ptr());
+ apache::geode::client::CacheableWideChar* ci = static_cast<apache::geode::client::CacheableWideChar*>(nativeptr.get());
return ci->value();
}
@@ -1323,7 +1323,7 @@ namespace Apache
//double
double Serializable::getDouble(apache::geode::client::SerializablePtr nativeptr)
{
- apache::geode::client::CacheableDouble* ci = static_cast<apache::geode::client::CacheableDouble*>(nativeptr.ptr());
+ apache::geode::client::CacheableDouble* ci = static_cast<apache::geode::client::CacheableDouble*>(nativeptr.get());
return ci->value();
}
@@ -1335,7 +1335,7 @@ namespace Apache
//float
float Serializable::getFloat(apache::geode::client::SerializablePtr nativeptr)
{
- apache::geode::client::CacheableFloat* ci = static_cast<apache::geode::client::CacheableFloat*>(nativeptr.ptr());
+ apache::geode::client::CacheableFloat* ci = static_cast<apache::geode::client::CacheableFloat*>(nativeptr.get());
return ci->value();
}
@@ -1347,7 +1347,7 @@ namespace Apache
//int16
System::Int16 Serializable::getInt16(apache::geode::client::SerializablePtr nativeptr)
{
- apache::geode::client::CacheableInt16* ci = static_cast<apache::geode::client::CacheableInt16*>(nativeptr.ptr());
+ apache::geode::client::CacheableInt16* ci = static_cast<apache::geode::client::CacheableInt16*>(nativeptr.get());
return ci->value();
}
@@ -1359,7 +1359,7 @@ namespace Apache
//int32
System::Int32 Serializable::getInt32(apache::geode::client::SerializablePtr nativeptr)
{
- apache::geode::client::CacheableInt32* ci = static_cast<apache::geode::client::CacheableInt32*>(nativeptr.ptr());
+ apache::geode::client::CacheableInt32* ci = static_cast<apache::geode::client::CacheableInt32*>(nativeptr.get());
return ci->value();
}
@@ -1371,7 +1371,7 @@ namespace Apache
//int64
System::Int64 Serializable::getInt64(apache::geode::client::SerializablePtr nativeptr)
{
- apache::geode::client::CacheableInt64* ci = static_cast<apache::geode::client::CacheableInt64*>(nativeptr.ptr());
+ apache::geode::client::CacheableInt64* ci = static_cast<apache::geode::client::CacheableInt64*>(nativeptr.get());
return ci->value();
}
@@ -1383,7 +1383,7 @@ namespace Apache
//cacheable ascii string
String^ Serializable::getASCIIString(apache::geode::client::SerializablePtr nativeptr)
{
- //apache::geode::client::CacheableString* ci = static_cast<apache::geode::client::CacheableString*>(nativeptr.ptr());
+ //apache::geode::client::CacheableString* ci = static_cast<apache::geode::client::CacheableString*>(nativeptr.get());
//return GetString(ci);
return GetString(nativeptr->toString());
}
@@ -1401,7 +1401,7 @@ namespace Apache
//cacheable ascii string huge
String^ Serializable::getASCIIStringHuge(apache::geode::client::SerializablePtr nativeptr)
{
- //apache::geode::client::CacheableString* ci = static_cast<apache::geode::client::CacheableString*>(nativeptr.ptr());
+ //apache::geode::client::CacheableString* ci = static_cast<apache::geode::client::CacheableString*>(nativeptr.get());
//return GetString(ci);
return GetString(nativeptr->toString());
}
@@ -1414,7 +1414,7 @@ namespace Apache
//cacheable string
String^ Serializable::getUTFString(apache::geode::client::SerializablePtr nativeptr)
{
- //apache::geode::client::CacheableString* ci = static_cast<apache::geode::client::CacheableString*>(nativeptr.ptr());
+ //apache::geode::client::CacheableString* ci = static_cast<apache::geode::client::CacheableString*>(nativeptr.get());
//return GetString(ci);
return GetString(nativeptr->toString());
}
@@ -1427,7 +1427,7 @@ namespace Apache
//cacheable string huge
String^ Serializable::getUTFStringHuge(apache::geode::client::SerializablePtr nativeptr)
{
- //apache::geode::client::CacheableString* ci = static_cast<apache::geode::client::CacheableString*>(nativeptr.ptr());
+ //apache::geode::client::CacheableString* ci = static_cast<apache::geode::client::CacheableString*>(nativeptr.get());
//return GetString(ci);
return GetString(nativeptr->toString());
}
@@ -1476,7 +1476,7 @@ namespace Apache
/*
static String^ GetString(apache::geode::client::CacheableStringPtr cStr)//apache::geode::client::CacheableString*
{
- if (cStr == NULLPTR) {
+ if (cStr == nullptr) {
return nullptr;
}
else if (cStr->isWideString()) {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/Serializable.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/Serializable.hpp b/src/clicache/src/Serializable.hpp
index c7f5b44..9c5dc4d 100644
--- a/src/clicache/src/Serializable.hpp
+++ b/src/clicache/src/Serializable.hpp
@@ -390,7 +390,7 @@ namespace Apache
/*
static String^ GetString(apache::geode::client::CacheableStringPtr cStr)//apache::geode::client::CacheableString*
{
- if (cStr == NULLPTR) {
+ if (cStr == nullptr) {
return nullptr;
}
else if (cStr->isWideString()) {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/Struct.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/Struct.cpp b/src/clicache/src/Struct.cpp
index 297ca6a..6613ec0 100644
--- a/src/clicache/src/Struct.cpp
+++ b/src/clicache/src/Struct.cpp
@@ -34,7 +34,7 @@ namespace Apache
Object^ Struct::default::get( size_t index )
{
/* return SafeUMSerializableConvertGeneric(static_cast<apache::geode::client::Struct*>(
- NativePtr())->operator[](static_cast<System::Int32>(index)).ptr());*/
+ NativePtr())->operator[](static_cast<System::Int32>(index)).get());*/
return (Serializable::GetManagedValueGeneric<Object^>(static_cast<apache::geode::client::Struct*>(
NativePtr())->operator[](static_cast<System::Int32>(index))));
}
@@ -43,7 +43,7 @@ namespace Apache
{
ManagedString mg_fieldName( fieldName );
/*return SafeUMSerializableConvertGeneric(static_cast<apache::geode::client::Struct*>(
- NativePtr())->operator[](mg_fieldName.CharPtr).ptr());*/
+ NativePtr())->operator[](mg_fieldName.CharPtr).get());*/
return (Serializable::GetManagedValueGeneric</*TResult*/Object^>(static_cast<apache::geode::client::Struct*>(
NativePtr())->operator[](mg_fieldName.CharPtr)));
@@ -52,7 +52,7 @@ namespace Apache
StructSet<Object^>^ Struct::Set::get( )
{
return StructSet</*TResult*/Object^>::Create(static_cast<apache::geode::client::Struct*>(
- NativePtr())->getStructSet().ptr());
+ NativePtr())->getStructSet().get());
}
@@ -69,7 +69,7 @@ namespace Apache
Object^ Struct/*<TResult>*/::Next( )
{
/*return SafeUMSerializableConvertGeneric(static_cast<apache::geode::client::Struct*>(
- NativePtr())->next().ptr());*/
+ NativePtr())->next().get());*/
return (Serializable::GetManagedValueGeneric</*TResult*/Object^>(static_cast<apache::geode::client::Struct*>(
NativePtr())->next()));
} // namespace Client
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/StructSet.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/StructSet.cpp b/src/clicache/src/StructSet.cpp
index 1922ffe..4810d6b 100644
--- a/src/clicache/src/StructSet.cpp
+++ b/src/clicache/src/StructSet.cpp
@@ -45,7 +45,7 @@ namespace Apache
generic<class TResult>
/*Apache::Geode::Client::IGeodeSerializable^*/ TResult StructSet<TResult>::default::get( size_t index )
{
- //return SafeUMSerializableConvertGeneric((NativePtr->operator[](static_cast<System::Int32>(index))).ptr());
+ //return SafeUMSerializableConvertGeneric((NativePtr->operator[](static_cast<System::Int32>(index))).get());
return Serializable::GetManagedValueGeneric<TResult>((NativePtr->operator[](static_cast<System::Int32>(index))));
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/impl/CacheLoader.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/CacheLoader.hpp b/src/clicache/src/impl/CacheLoader.hpp
index ecb9c52..45f1506 100644
--- a/src/clicache/src/impl/CacheLoader.hpp
+++ b/src/clicache/src/impl/CacheLoader.hpp
@@ -63,7 +63,7 @@ namespace Apache
virtual apache::geode::client::CacheablePtr load( const apache::geode::client::RegionPtr& region,
const apache::geode::client::CacheableKeyPtr& key, const apache::geode::client::UserDataPtr& helper )
{
- IRegion<TKey, TValue>^ gregion = Region<TKey, TValue>::Create(region.ptr());
+ IRegion<TKey, TValue>^ gregion = Region<TKey, TValue>::Create(region.get());
TKey gkey = Serializable::GetManagedValueGeneric<TKey>(key);
@@ -75,7 +75,7 @@ namespace Apache
virtual void close( const apache::geode::client::RegionPtr& region )
{
- IRegion<TKey, TValue>^ gregion = Region<TKey, TValue>::Create(region.ptr());
+ IRegion<TKey, TValue>^ gregion = Region<TKey, TValue>::Create(region.get());
m_loader->Close(gregion);
}
};
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/impl/ManagedAuthInitialize.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedAuthInitialize.cpp b/src/clicache/src/impl/ManagedAuthInitialize.cpp
index 69b1a62..67fef16 100644
--- a/src/clicache/src/impl/ManagedAuthInitialize.cpp
+++ b/src/clicache/src/impl/ManagedAuthInitialize.cpp
@@ -175,7 +175,7 @@ namespace apache
{
try {
Apache::Geode::Client::Properties<String^, String^>^ mprops =
- Apache::Geode::Client::Properties<String^, String^>::Create<String^, String^>(securityprops.ptr());
+ Apache::Geode::Client::Properties<String^, String^>::Create<String^, String^>(securityprops.get());
String^ mg_server = Apache::Geode::Client::ManagedString::Get(server);
return PropertiesPtr(m_getCredentials->Invoke(mprops, mg_server)->NativePtr());
@@ -186,7 +186,7 @@ namespace apache
catch (System::Exception^ ex) {
Apache::Geode::Client::GeodeException::ThrowNative(ex);
}
- return NULLPTR;
+ return nullptr;
}
void ManagedAuthInitializeGeneric::close()
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/impl/ManagedCacheListener.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCacheListener.cpp b/src/clicache/src/impl/ManagedCacheListener.cpp
index bb637cd..56292ba 100644
--- a/src/clicache/src/impl/ManagedCacheListener.cpp
+++ b/src/clicache/src/impl/ManagedCacheListener.cpp
@@ -331,7 +331,7 @@ namespace apache
{
try {
Apache::Geode::Client::IRegion<Object^, Object^>^ mregion =
- Apache::Geode::Client::Region<Object^, Object^>::Create(region.ptr());
+ Apache::Geode::Client::Region<Object^, Object^>::Create(region.get());
m_managedptr->Close(mregion);
}
@@ -346,7 +346,7 @@ namespace apache
{
try {
Apache::Geode::Client::IRegion<Object^, Object^>^ mregion =
- Apache::Geode::Client::Region<Object^, Object^>::Create(region.ptr());
+ Apache::Geode::Client::Region<Object^, Object^>::Create(region.get());
m_managedptr->AfterRegionDisconnected(mregion);
}
catch (Apache::Geode::Client::GeodeException^ ex) {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/impl/ManagedCacheLoader.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCacheLoader.cpp b/src/clicache/src/impl/ManagedCacheLoader.cpp
index 1119a35..cba68db 100644
--- a/src/clicache/src/impl/ManagedCacheLoader.cpp
+++ b/src/clicache/src/impl/ManagedCacheLoader.cpp
@@ -224,7 +224,7 @@ namespace apache
ICacheableKey^ mkey = SafeGenericUMKeyConvert( key.ptr( ) );
- IGeodeSerializable^ mcallbackArg = SafeGenericUMSerializableConvert(aCallbackArgument.ptr());
+ IGeodeSerializable^ mcallbackArg = SafeGenericUMSerializableConvert(aCallbackArgument.get());
*/
/*
@@ -239,7 +239,7 @@ namespace apache
catch (System::Exception^ ex) {
Apache::Geode::Client::GeodeException::ThrowNative(ex);
}
- return NULLPTR;
+ return nullptr;
}
void ManagedCacheLoaderGeneric::close(const RegionPtr& region)
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/impl/ManagedCacheWriter.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCacheWriter.cpp b/src/clicache/src/impl/ManagedCacheWriter.cpp
index b5cee21..e9077ae 100644
--- a/src/clicache/src/impl/ManagedCacheWriter.cpp
+++ b/src/clicache/src/impl/ManagedCacheWriter.cpp
@@ -298,7 +298,7 @@ namespace apache
{
try {
Apache::Geode::Client::IRegion<Object^, Object^>^ mregion =
- Apache::Geode::Client::Region<Object^, Object^>::Create(rp.ptr());
+ Apache::Geode::Client::Region<Object^, Object^>::Create(rp.get());
m_managedptr->Close(reinterpret_cast<Apache::Geode::Client::Region<Object^, Object^>^>(mregion));
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/impl/ManagedCacheableDelta.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCacheableDelta.cpp b/src/clicache/src/impl/ManagedCacheableDelta.cpp
index 259198b..fb58f5a 100644
--- a/src/clicache/src/impl/ManagedCacheableDelta.cpp
+++ b/src/clicache/src/impl/ManagedCacheableDelta.cpp
@@ -213,7 +213,7 @@ namespace apache
catch (System::Exception^ ex) {
Apache::Geode::Client::GeodeException::ThrowNative(ex);
}
- return NULLPTR;
+ return nullptr;
}
bool ManagedCacheableDeltaGeneric::operator ==(const apache::geode::client::CacheableKey& other) const
@@ -240,7 +240,7 @@ namespace apache
bool ManagedCacheableDeltaGeneric::operator == (const ManagedCacheableDeltaGeneric& other) const
{
try {
- return m_managedptr->Equals(other.ptr());
+ return m_managedptr->Equals(other.get());
}
catch (Apache::Geode::Client::GeodeException^ ex) {
ex->ThrowNative();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/impl/ManagedCacheableDeltaBytes.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCacheableDeltaBytes.cpp b/src/clicache/src/impl/ManagedCacheableDeltaBytes.cpp
index 8734ac5..494671d 100644
--- a/src/clicache/src/impl/ManagedCacheableDeltaBytes.cpp
+++ b/src/clicache/src/impl/ManagedCacheableDeltaBytes.cpp
@@ -230,7 +230,7 @@ namespace apache
catch (System::Exception^ ex) {
Apache::Geode::Client::GeodeException::ThrowNative(ex);
}
- return NULLPTR;
+ return nullptr;
}
Apache::Geode::Client::IGeodeDelta^
@@ -288,10 +288,10 @@ namespace apache
Apache::Geode::Client::IGeodeSerializable^ obj =
Apache::Geode::Client::Serializable::GetTypeFactoryMethodGeneric(m_classId)();
obj->FromData(%mg_input);
- bool ret = obj->Equals(other.ptr());
+ bool ret = obj->Equals(other.get());
Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytesGeneric::equal return VAL = " + ret);
return ret;
- //return obj->Equals(other.ptr());
+ //return obj->Equals(other.get());
}
catch (Apache::Geode::Client::GeodeException^ ex) {
ex->ThrowNative();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/impl/ManagedCacheableKey.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCacheableKey.cpp b/src/clicache/src/impl/ManagedCacheableKey.cpp
index 9305e7b..e990c20 100644
--- a/src/clicache/src/impl/ManagedCacheableKey.cpp
+++ b/src/clicache/src/impl/ManagedCacheableKey.cpp
@@ -160,7 +160,7 @@ namespace apache
catch (System::Exception^ ex) {
Apache::Geode::Client::GeodeException::ThrowNative(ex);
}
- return NULLPTR;
+ return nullptr;
}
bool ManagedCacheableKeyGeneric::operator ==(const apache::geode::client::CacheableKey& other) const
@@ -191,7 +191,7 @@ namespace apache
try {
return static_cast<Apache::Geode::Client::ICacheableKey^>(
(Apache::Geode::Client::IGeodeSerializable^)(Apache::Geode::Client::IGeodeSerializable^)m_managedptr)->Equals(
- static_cast<Apache::Geode::Client::ICacheableKey^>(other.ptr()));
+ static_cast<Apache::Geode::Client::ICacheableKey^>(other.get()));
}
catch (Apache::Geode::Client::GeodeException^ ex) {
ex->ThrowNative();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/impl/ManagedCacheableKeyBytes.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCacheableKeyBytes.cpp b/src/clicache/src/impl/ManagedCacheableKeyBytes.cpp
index 02f27e2..d8c5b56 100644
--- a/src/clicache/src/impl/ManagedCacheableKeyBytes.cpp
+++ b/src/clicache/src/impl/ManagedCacheableKeyBytes.cpp
@@ -173,7 +173,7 @@ namespace apache
catch (System::Exception^ ex) {
Apache::Geode::Client::GeodeException::ThrowNative(ex);
}
- return NULLPTR;
+ return nullptr;
}
bool ManagedCacheableKeyBytesGeneric::operator ==(const apache::geode::client::CacheableKey& other) const
@@ -214,10 +214,10 @@ namespace apache
Apache::Geode::Client::IGeodeSerializable^ obj =
Apache::Geode::Client::Serializable::GetTypeFactoryMethodGeneric(m_classId)();
obj->FromData(%mg_input);
- bool ret = obj->Equals(other.ptr());
+ bool ret = obj->Equals(other.get());
Apache::Geode::Client::Log::Debug("ManagedCacheableKeyBytesGeneric::equal return VAL = " + ret);
return ret;
- //return obj->Equals(other.ptr());
+ //return obj->Equals(other.get());
}
catch (Apache::Geode::Client::GeodeException^ ex) {
ex->ThrowNative();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/impl/ManagedCqStatusListener.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCqStatusListener.hpp b/src/clicache/src/impl/ManagedCqStatusListener.hpp
index b0f5591..344e0c6 100644
--- a/src/clicache/src/impl/ManagedCqStatusListener.hpp
+++ b/src/clicache/src/impl/ManagedCqStatusListener.hpp
@@ -82,7 +82,7 @@ namespace apache {
/// 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.
/// </summary>
virtual void onError(const apache::geode::client::CqEvent& ev);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/impl/ManagedFixedPartitionResolver.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedFixedPartitionResolver.cpp b/src/clicache/src/impl/ManagedFixedPartitionResolver.cpp
index 23310f5..26f3f3b 100644
--- a/src/clicache/src/impl/ManagedFixedPartitionResolver.cpp
+++ b/src/clicache/src/impl/ManagedFixedPartitionResolver.cpp
@@ -225,7 +225,7 @@ namespace apache
catch (System::Exception^ ex) {
Apache::Geode::Client::GeodeException::ThrowNative(ex);
}
- return NULLPTR;
+ return nullptr;
}
const char* ManagedFixedPartitionResolverGeneric::getName()
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/impl/ManagedPartitionResolver.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedPartitionResolver.cpp b/src/clicache/src/impl/ManagedPartitionResolver.cpp
index 5958ce5..51279c5 100644
--- a/src/clicache/src/impl/ManagedPartitionResolver.cpp
+++ b/src/clicache/src/impl/ManagedPartitionResolver.cpp
@@ -229,7 +229,7 @@ namespace apache
catch (System::Exception^ ex) {
Apache::Geode::Client::GeodeException::ThrowNative(ex);
}
- return NULLPTR;
+ return nullptr;
}
const char* ManagedPartitionResolverGeneric::getName()
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/impl/ManagedResultCollector.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedResultCollector.cpp b/src/clicache/src/impl/ManagedResultCollector.cpp
index 8874eec..2ac9e0a 100644
--- a/src/clicache/src/impl/ManagedResultCollector.cpp
+++ b/src/clicache/src/impl/ManagedResultCollector.cpp
@@ -149,7 +149,7 @@ namespace apache
void ManagedResultCollectorGeneric::addResult(CacheablePtr& result)
{
try {
- //Apache::Geode::Client::IGeodeSerializable^ res = SafeUMSerializableConvertGeneric(result.ptr());
+ //Apache::Geode::Client::IGeodeSerializable^ res = SafeUMSerializableConvertGeneric(result.get());
Object^ rs = Apache::Geode::Client::Serializable::GetManagedValueGeneric<Object^>(result);
m_managedptr->AddResult(rs);
//m_managedptr->AddResult( SafeUMSerializableConvert( result.ptr( ) ) );
@@ -190,7 +190,7 @@ namespace apache
ex_str += mg_exStr.CharPtr;
throw apache::geode::client::IllegalArgumentException(ex_str.c_str());
}
- return NULLPTR;
+ return nullptr;
}
void ManagedResultCollectorGeneric::endResults()
{
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/impl/ManagedTransactionListener.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedTransactionListener.cpp b/src/clicache/src/impl/ManagedTransactionListener.cpp
index be829bd..99a683b 100644
--- a/src/clicache/src/impl/ManagedTransactionListener.cpp
+++ b/src/clicache/src/impl/ManagedTransactionListener.cpp
@@ -204,7 +204,7 @@ namespace apache
{
try {
Apache::Geode::Client::Log::Error("ManagedTransactionListenerGeneric::afterCommit in");
- Apache::Geode::Client::TransactionEvent mevent(te.ptr());
+ Apache::Geode::Client::TransactionEvent mevent(te.get());
m_managedptr->AfterCommit(%mevent);
Apache::Geode::Client::Log::Error("ManagedTransactionListenerGeneric::afterCommit in");
@@ -219,7 +219,7 @@ namespace apache
void ManagedTransactionListenerGeneric::afterFailedCommit(apache::geode::client::TransactionEventPtr& te)
{
try {
- Apache::Geode::Client::TransactionEvent mevent(te.ptr());
+ Apache::Geode::Client::TransactionEvent mevent(te.get());
m_managedptr->AfterFailedCommit(%mevent);
}
catch (Apache::Geode::Client::GeodeException^ ex) {
@@ -232,7 +232,7 @@ namespace apache
void ManagedTransactionListenerGeneric::afterRollback(apache::geode::client::TransactionEventPtr& te)
{
try {
- Apache::Geode::Client::TransactionEvent mevent(te.ptr());
+ Apache::Geode::Client::TransactionEvent mevent(te.get());
m_managedptr->AfterRollback(%mevent);
}
catch (Apache::Geode::Client::GeodeException^ ex) {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/impl/ManagedTransactionWriter.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedTransactionWriter.cpp b/src/clicache/src/impl/ManagedTransactionWriter.cpp
index f319667..bde9cbe 100644
--- a/src/clicache/src/impl/ManagedTransactionWriter.cpp
+++ b/src/clicache/src/impl/ManagedTransactionWriter.cpp
@@ -204,7 +204,7 @@ namespace apache
void ManagedTransactionWriterGeneric::beforeCommit(apache::geode::client::TransactionEventPtr& te)
{
try {
- Apache::Geode::Client::TransactionEvent mevent(te.ptr());
+ Apache::Geode::Client::TransactionEvent mevent(te.get());
m_managedptr->BeforeCommit(%mevent);
}
catch (Apache::Geode::Client::GeodeException^ ex) {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/impl/ManagedVisitor.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedVisitor.cpp b/src/clicache/src/impl/ManagedVisitor.cpp
index 101f11e..3ab01a1 100644
--- a/src/clicache/src/impl/ManagedVisitor.cpp
+++ b/src/clicache/src/impl/ManagedVisitor.cpp
@@ -34,8 +34,8 @@ namespace apache
{
using namespace Apache::Geode::Client;
try {
- ICacheableKey^ mg_key(SafeGenericUMKeyConvert<ICacheableKey^>(key.ptr()));
- IGeodeSerializable^ mg_value(SafeUMSerializableConvertGeneric(value.ptr()));
+ ICacheableKey^ mg_key(SafeGenericUMKeyConvert<ICacheableKey^>(key.get()));
+ IGeodeSerializable^ mg_value(SafeUMSerializableConvertGeneric(value.get()));
m_visitor->Invoke(mg_key, (Apache::Geode::Client::IGeodeSerializable^)mg_value);
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/impl/PdxHelper.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/PdxHelper.cpp b/src/clicache/src/impl/PdxHelper.cpp
index 769710d..03929b2 100644
--- a/src/clicache/src/impl/PdxHelper.cpp
+++ b/src/clicache/src/impl/PdxHelper.cpp
@@ -45,7 +45,7 @@ namespace Apache
CacheImpl* getCacheImpl()
{
CachePtr cache = CacheFactory::getAnyInstance();
- if (cache == NULLPTR)
+ if (cache == nullptr)
{
throw gcnew IllegalStateException("cache has not been created yet.");;
}
@@ -53,7 +53,7 @@ namespace Apache
{
throw gcnew IllegalStateException("cache has been closed. ");
}
- return CacheRegionHelper::getCacheImpl(cache.ptr());
+ return CacheRegionHelper::getCacheImpl(cache.get());
}
void PdxHelper::SerializePdx(DataOutput^ dataOutput, IPdxSerializable^ pdxObject)
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/impl/PdxInstanceImpl.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/PdxInstanceImpl.cpp b/src/clicache/src/impl/PdxInstanceImpl.cpp
index e4c181e..57027df 100755
--- a/src/clicache/src/impl/PdxInstanceImpl.cpp
+++ b/src/clicache/src/impl/PdxInstanceImpl.cpp
@@ -86,7 +86,7 @@ namespace Apache
//dataInput->ResetPdx(0);
CachePtr cache = CacheFactory::getAnyInstance();
- if (cache == NULLPTR)
+ if (cache == nullptr)
{
throw gcnew IllegalStateException("cache has not been created yet.");;
}
@@ -94,7 +94,7 @@ namespace Apache
{
throw gcnew IllegalStateException("cache has been closed. ");
}
- CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cache.ptr());
+ CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cache.get());
if (cacheImpl != NULL) {
Utils::updateStatOpTime(cacheImpl->m_cacheStats->getStat(),
cacheImpl->m_cacheStats->getPdxInstanceDeserializationTimeId(),
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/impl/PdxManagedCacheableKey.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/PdxManagedCacheableKey.cpp b/src/clicache/src/impl/PdxManagedCacheableKey.cpp
index 646329e..003a3f4 100644
--- a/src/clicache/src/impl/PdxManagedCacheableKey.cpp
+++ b/src/clicache/src/impl/PdxManagedCacheableKey.cpp
@@ -153,7 +153,7 @@ namespace apache
catch (System::Exception^ ex) {
Apache::Geode::Client::GeodeException::ThrowNative(ex);
}
- return NULLPTR;
+ return nullptr;
}
bool PdxManagedCacheableKey::operator ==(const apache::geode::client::CacheableKey& other) const
@@ -180,7 +180,7 @@ namespace apache
bool PdxManagedCacheableKey::operator ==(const PdxManagedCacheableKey& other) const
{
try {
- return ((Apache::Geode::Client::IPdxSerializable^)m_managedptr)->Equals((other.ptr()));
+ return ((Apache::Geode::Client::IPdxSerializable^)m_managedptr)->Equals((other.get()));
}
catch (Apache::Geode::Client::GeodeException^ ex) {
ex->ThrowNative();
@@ -295,7 +295,7 @@ namespace apache
catch (System::Exception^ ex) {
Apache::Geode::Client::GeodeException::ThrowNative(ex);
}
- return NULLPTR;
+ return nullptr;
}
} // namespace client
} // namespace geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/impl/PdxManagedCacheableKeyBytes.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/PdxManagedCacheableKeyBytes.cpp b/src/clicache/src/impl/PdxManagedCacheableKeyBytes.cpp
index 3f619e3..5cc34de 100644
--- a/src/clicache/src/impl/PdxManagedCacheableKeyBytes.cpp
+++ b/src/clicache/src/impl/PdxManagedCacheableKeyBytes.cpp
@@ -176,7 +176,7 @@ namespace apache
catch (System::Exception^ ex) {
Apache::Geode::Client::GeodeException::ThrowNative(ex);
}
- return NULLPTR;
+ return nullptr;
}
bool PdxManagedCacheableKeyBytes::operator ==(const apache::geode::client::CacheableKey& other) const
@@ -219,10 +219,10 @@ namespace apache
Apache::Geode::Client::Serializable::GetTypeFactoryMethodGeneric(m_classId)();
obj->FromData(%mg_input);*/
Apache::Geode::Client::IPdxSerializable^ obj = getManagedObject();
- bool ret = obj->Equals(other.ptr());
+ bool ret = obj->Equals(other.get());
// Apache::Geode::Client::Log::Debug("PdxManagedCacheableKeyBytes::equal return VAL = " + ret);
return ret;
- //return obj->Equals(other.ptr());
+ //return obj->Equals(other.get());
}
catch (Apache::Geode::Client::GeodeException^ ex) {
ex->ThrowNative();
@@ -364,7 +364,7 @@ namespace apache
catch (System::Exception^ ex) {
Apache::Geode::Client::GeodeException::ThrowNative(ex);
}
- return NULLPTR;
+ return nullptr;
}
} // namespace client
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/impl/PersistenceManagerProxy.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/PersistenceManagerProxy.hpp b/src/clicache/src/impl/PersistenceManagerProxy.hpp
index 80a5452..fbbbb5e 100644
--- a/src/clicache/src/impl/PersistenceManagerProxy.hpp
+++ b/src/clicache/src/impl/PersistenceManagerProxy.hpp
@@ -64,8 +64,8 @@ namespace Apache
virtual void init(const RegionPtr& region, PropertiesPtr& diskProperties)
{
- IRegion<TKey, TValue>^ gRegion = Region<TKey, TValue>::Create(region.ptr());
- Properties<String^, String^>^ gProps = Properties<String^, String^>::Create<String^, String^>(diskProperties.ptr());
+ IRegion<TKey, TValue>^ gRegion = Region<TKey, TValue>::Create(region.get());
+ Properties<String^, String^>^ gProps = Properties<String^, String^>::Create<String^, String^>(diskProperties.get());
m_persistenceManager->Init(gRegion, gProps);
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/clicache/src/impl/SafeConvert.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/SafeConvert.hpp b/src/clicache/src/impl/SafeConvert.hpp
index 007a8a7..8f8d091 100644
--- a/src/clicache/src/impl/SafeConvert.hpp
+++ b/src/clicache/src/impl/SafeConvert.hpp
@@ -394,7 +394,7 @@ namespace Apache
inline static apache::geode::client::CacheableKey* SafeGenericMKeyConvert( TKey mg_obj )
{
if (mg_obj == nullptr) return NULL;
- apache::geode::client::CacheableKey* obj = Apache::Geode::Client::Serializable::GetUnmanagedValueGeneric<TKey>( mg_obj ).ptr();
+ apache::geode::client::CacheableKey* obj = Apache::Geode::Client::Serializable::GetUnmanagedValueGeneric<TKey>( mg_obj ).get();
if (obj != nullptr)
{
return obj;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/AttributesFactory.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/AttributesFactory.hpp b/src/cppcache/include/geode/AttributesFactory.hpp
index 2775ea5..8ccb973 100644
--- a/src/cppcache/include/geode/AttributesFactory.hpp
+++ b/src/cppcache/include/geode/AttributesFactory.hpp
@@ -60,18 +60,18 @@ namespace client {
* <h3>Attributes</h3>
* <h4>Callbacks</h4>
* <dl>
- * <dt>{@link CacheLoader} [<em>default:</em> NULLPTR]</dt>
+ * <dt>{@link CacheLoader} [<em>default:</em> nullptr]</dt>
* <dd>User-implemented plug-in for loading data on cache misses.<br>
* {@link #setCacheLoader} {@link RegionAttributes#getCacheLoader}
* {@link AttributesMutator#setCacheLoader}</dd>
*
- * <dt>{@link CacheWriter} [<em>default:</em> NULLPTR]</dt>
+ * <dt>{@link CacheWriter} [<em>default:</em> nullptr]</dt>
* <dd>User-implemented plug-in for intercepting cache modifications, e.g.
* for writing to an external data source.<br>
* {@link #setCacheWriter} {@link RegionAttributes#getCacheWriter}
* {@link AttributesMutator#setCacheWriter}</dd>
*
- * <dt>{@link CacheListener} [<em>default:</em> NULLPTR]</dt>
+ * <dt>{@link CacheListener} [<em>default:</em> nullptr]</dt>
* <dd>User-implemented plug-in for receiving and handling cache related
* events.<br>
* {@link #setCacheListener} {@link RegionAttributes#getCacheListener}
@@ -179,23 +179,23 @@ class CPPCACHE_EXPORT AttributesFactory : public SharedBase {
// CALLBACKS
/** Sets the cache loader for the next <code>RegionAttributes</code> created.
- * @param cacheLoader the cache loader or NULLPTR if no loader
+ * @param cacheLoader the cache loader or nullptr if no loader
*/
void setCacheLoader(const CacheLoaderPtr& cacheLoader);
/** Sets the cache writer for the next <code>RegionAttributes</code> created.
- * @param cacheWriter the cache writer or NULLPTR if no cache writer
+ * @param cacheWriter the cache writer or nullptr if no cache writer
*/
void setCacheWriter(const CacheWriterPtr& cacheWriter);
/** Sets the CacheListener for the next <code>RegionAttributes</code> created.
- * @param aListener a user defined CacheListener, NULLPTR if no listener
+ * @param aListener a user defined CacheListener, nullptr if no listener
*/
void setCacheListener(const CacheListenerPtr& aListener);
/** Sets the PartitionResolver for the next <code>RegionAttributes</code>
* created.
- * @param aResolver a user defined PartitionResolver, NULLPTR if no resolver
+ * @param aResolver a user defined PartitionResolver, nullptr if no resolver
*/
void setPartitionResolver(const PartitionResolverPtr& aResolver);
@@ -265,15 +265,15 @@ class CPPCACHE_EXPORT AttributesFactory : public SharedBase {
* this must be used to set the PersistenceManager.
*/
void setPersistenceManager(const char* libpath, const char* factoryFuncName,
- const PropertiesPtr& config = NULLPTR);
+ const PropertiesPtr& config = nullptr);
/** Sets the PersistenceManager for the next <code>RegionAttributes</code>
* created.
- * @param persistenceManager a user defined PersistenceManager, NULLPTR if no
+ * @param persistenceManager a user defined PersistenceManager, nullptr if no
* resolver
*/
void setPersistenceManager(const PersistenceManagerPtr& persistenceManager,
- const PropertiesPtr& config = NULLPTR);
+ const PropertiesPtr& config = nullptr);
public:
// DISTRIBUTION ATTRIBUTES
@@ -369,7 +369,7 @@ class CPPCACHE_EXPORT AttributesFactory : public SharedBase {
* @throws IllegalStateException if the current settings violate the
* compatibility rules
*/
- RegionAttributesPtr createRegionAttributes();
+ std::unique_ptr<RegionAttributes> createRegionAttributes();
private:
RegionAttributes m_regionAttributes;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/Cache.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/Cache.hpp b/src/cppcache/include/geode/Cache.hpp
index e29c9f2..569c85a 100644
--- a/src/cppcache/include/geode/Cache.hpp
+++ b/src/cppcache/include/geode/Cache.hpp
@@ -42,6 +42,7 @@ namespace client {
class CacheFactory;
class CacheRegionHelper;
class Pool;
+class CacheImpl;
/**
* @class Cache Cache.hpp
@@ -56,7 +57,8 @@ class Pool;
* <p>A cache can have multiple root regions, each with a different name.
*
*/
-class CPPCACHE_EXPORT Cache : public GeodeCache {
+class CPPCACHE_EXPORT Cache : public GeodeCache,
+ public std::enable_shared_from_this<Cache> {
/**
* @brief public methods
*/
@@ -131,7 +133,7 @@ class CPPCACHE_EXPORT Cache : public GeodeCache {
* Cache#createAuthenticatedView(PropertiesPtr).
*
* @param path the region's name, such as <code>AuthRegion</code>.
- * @returns region, or NULLPTR if no such region exists.
+ * @returns region, or nullptr if no such region exists.
*/
virtual RegionPtr getRegion(const char* path);
@@ -228,14 +230,12 @@ class CPPCACHE_EXPORT Cache : public GeodeCache {
/**
* @brief constructors
*/
- Cache(const char* name, DistributedSystemPtr sys, bool ignorePdxUnreadFields,
- bool readPdxSerialized);
Cache(const char* name, DistributedSystemPtr sys, const char* id_data,
bool ignorePdxUnreadFields, bool readPdxSerialized);
- CacheImpl* m_cacheImpl;
+ std::unique_ptr<CacheImpl> m_cacheImpl;
protected:
- Cache() { m_cacheImpl = NULL; }
+ Cache();
static bool isPoolInMultiuserMode(RegionPtr regionPtr);
@@ -245,6 +245,8 @@ class CPPCACHE_EXPORT Cache : public GeodeCache {
friend class FunctionService;
friend class CacheXmlCreation;
friend class RegionXmlCreation;
+
+ FRIEND_STD_SHARED_PTR(Cache)
};
} // namespace client
} // namespace geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/CacheFactory.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/CacheFactory.hpp b/src/cppcache/include/geode/CacheFactory.hpp
index c58cd73..5d519bb 100644
--- a/src/cppcache/include/geode/CacheFactory.hpp
+++ b/src/cppcache/include/geode/CacheFactory.hpp
@@ -45,7 +45,9 @@ class CppCacheLibrary;
* For the default values for the pool attributes see {@link PoolFactory}.
* To create additional {@link Pool}s see {@link PoolManager}
*/
-class CPPCACHE_EXPORT CacheFactory : public SharedBase {
+class CPPCACHE_EXPORT CacheFactory
+ : public SharedBase,
+ public std::enable_shared_from_this<CacheFactory> {
public:
/**
* To create the instance of {@link CacheFactory}
@@ -53,7 +55,7 @@ class CPPCACHE_EXPORT CacheFactory : public SharedBase {
* Properties which are applicable at client level.
*/
static CacheFactoryPtr createCacheFactory(
- const PropertiesPtr& dsProps = NULLPTR);
+ const PropertiesPtr& dsProps = nullptr);
/**
* To create the instance of {@link Cache}.
@@ -466,9 +468,9 @@ class CPPCACHE_EXPORT CacheFactory : public SharedBase {
PoolFactoryPtr getPoolFactory();
- CachePtr create(const char* name, DistributedSystemPtr system = NULLPTR,
+ CachePtr create(const char* name, DistributedSystemPtr system = nullptr,
const char* cacheXml = 0,
- const CacheAttributesPtr& attrs = NULLPTR);
+ const CacheAttributesPtr& attrs = nullptr);
static void create_(const char* name, DistributedSystemPtr& system,
const char* id_data, CachePtr& cptr,
@@ -477,8 +479,14 @@ class CPPCACHE_EXPORT CacheFactory : public SharedBase {
// no instances allowed
CacheFactory();
CacheFactory(const PropertiesPtr dsProps);
+
+ public:
+ // TODO shared_ptr - this should be private, fix friend
~CacheFactory();
+ private:
+ FRIEND_STD_SHARED_PTR(CacheFactory)
+
PoolPtr determineDefaultPool(CachePtr cachePtr);
static CachePtr getAnyInstance(bool throwException);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/CacheListener.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/CacheListener.hpp b/src/cppcache/include/geode/CacheListener.hpp
index 14f7789..87ff012 100644
--- a/src/cppcache/include/geode/CacheListener.hpp
+++ b/src/cppcache/include/geode/CacheListener.hpp
@@ -87,7 +87,7 @@ class CPPCACHE_EXPORT CacheListener : public SharedBase {
/** Handles the event of a new key being added to a region. The entry
* did not previously exist in this region in the local cache (even with a
- * NULLPTR value).
+ * nullptr value).
*
* @param event denotes the event object associated with the entry creation
* This function does not throw any exception.
@@ -101,7 +101,7 @@ class CPPCACHE_EXPORT CacheListener : public SharedBase {
* entry
* previously existed in this region in the local cache, but its previous
* value
- * may have been NULLPTR.
+ * may have been nullptr.
*
* @param event EntryEvent denotes the event object associated with updating
* the entry
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/CacheLoader.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/CacheLoader.hpp b/src/cppcache/include/geode/CacheLoader.hpp
index 71c9042..b205f79 100644
--- a/src/cppcache/include/geode/CacheLoader.hpp
+++ b/src/cppcache/include/geode/CacheLoader.hpp
@@ -44,7 +44,7 @@ namespace client {
* Allows data to be loaded from a 3rd party data source and placed
* into the region
* When {@link Region::get} is called for a region
- * entry that has a <code>NULLPTR</code> value, the
+ * entry that has a <code>nullptr</code> value, the
* {@link CacheLoader::load} method of the
* region's cache loader is invoked. The <code>load</code> method
* creates the value for the desired key by performing an operation such
@@ -62,8 +62,8 @@ class CPPCACHE_EXPORT CacheLoader : public SharedBase {
* by the invocation of {@link Region::get} that triggered this load.
* @param rp a Region Pointer for which this is called.
* @param key the key for the cacheable
- * @param helper any related user data, or NULLPTR
- * @return the value supplied for this key, or NULLPTR if no value can be
+ * @param helper any related user data, or nullptr
+ * @return the value supplied for this key, or nullptr if no value can be
* supplied.
*
*@see Region::get .
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/CacheWriter.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/CacheWriter.hpp b/src/cppcache/include/geode/CacheWriter.hpp
index b520a34..457ef24 100644
--- a/src/cppcache/include/geode/CacheWriter.hpp
+++ b/src/cppcache/include/geode/CacheWriter.hpp
@@ -94,7 +94,7 @@ class CPPCACHE_EXPORT CacheWriter : public SharedBase {
* <code>put</code>
* or a <code>get</code> that causes the loader to update an existing entry.
* The entry previously existed in the cache where the operation was
- * initiated, although the old value may have been NULLPTR. The entry being
+ * initiated, although the old value may have been nullptr. The entry being
* updated may or may not exist in the local cache where the CacheWriter is
* installed.
*
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/Cacheable.inl
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/Cacheable.inl b/src/cppcache/include/geode/Cacheable.inl
index 4f7d61f..cfde539 100644
--- a/src/cppcache/include/geode/Cacheable.inl
+++ b/src/cppcache/include/geode/Cacheable.inl
@@ -39,7 +39,7 @@ inline CacheablePtr Cacheable::create( const PRIM value )
template <typename TVALUE>
inline CacheablePtr createValue( const SharedPtr< TVALUE >& value )
{
- return CacheablePtr( value );
+ return std::dynamic_pointer_cast<Cacheable>(value);
}
template <typename TVALUE>
[11/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from cppcache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/CacheImpl.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CacheImpl.cpp b/src/cppcache/src/CacheImpl.cpp
index 22b9e24..abfab22 100644
--- a/src/cppcache/src/CacheImpl.cpp
+++ b/src/cppcache/src/CacheImpl.cpp
@@ -49,7 +49,7 @@ volatile bool CacheImpl::s_networkhop = false;
volatile int CacheImpl::s_blacklistBucketTimeout = 0;
ACE_Recursive_Thread_Mutex CacheImpl::s_nwHopLock;
volatile int8_t CacheImpl::s_serverGroupFlag = 0;
-MemberListForVersionStampPtr CacheImpl::s_versionStampMemIdList = NULLPTR;
+MemberListForVersionStampPtr CacheImpl::s_versionStampMemIdList = nullptr;
#define DEFAULT_LRU_MAXIMUM_ENTRIES 100000
@@ -59,7 +59,7 @@ ExpiryTaskManager* getCacheImplExpiryTaskManager() {
CacheImpl::CacheImpl(Cache* c, const char* name, DistributedSystemPtr sys,
const char* id_data, bool iPUF, bool readPdxSerialized)
- : m_defaultPool(NULLPTR),
+ : m_defaultPool(nullptr),
m_ignorePdxUnreadFields(iPUF),
m_readPdxSerialized(readPdxSerialized),
m_closed(false),
@@ -67,13 +67,13 @@ CacheImpl::CacheImpl(Cache* c, const char* name, DistributedSystemPtr sys,
m_distributedSystem(sys),
m_implementee(c),
m_cond(m_mutex),
- m_attributes(NULLPTR),
+ m_attributes(nullptr),
m_evictionControllerPtr(NULL),
m_tcrConnectionManager(NULL),
- m_remoteQueryServicePtr(NULLPTR),
+ m_remoteQueryServicePtr(nullptr),
m_destroyPending(false),
m_initDone(false),
- m_adminRegion(NULLPTR) {
+ m_adminRegion(nullptr) {
m_cacheTXManager = InternalCacheTransactionManager2PCPtr(
new InternalCacheTransactionManager2PCImpl(c));
@@ -106,7 +106,7 @@ CacheImpl::CacheImpl(Cache* c, const char* name, DistributedSystemPtr sys,
CacheImpl::CacheImpl(Cache* c, const char* name, DistributedSystemPtr sys,
bool iPUF, bool readPdxSerialized)
- : m_defaultPool(NULLPTR),
+ : m_defaultPool(nullptr),
m_ignorePdxUnreadFields(iPUF),
m_readPdxSerialized(readPdxSerialized),
m_closed(false),
@@ -114,13 +114,13 @@ CacheImpl::CacheImpl(Cache* c, const char* name, DistributedSystemPtr sys,
m_distributedSystem(sys),
m_implementee(c),
m_cond(m_mutex),
- m_attributes(NULLPTR),
+ m_attributes(nullptr),
m_evictionControllerPtr(NULL),
m_tcrConnectionManager(NULL),
- m_remoteQueryServicePtr(NULLPTR),
+ m_remoteQueryServicePtr(nullptr),
m_destroyPending(false),
m_initDone(false),
- m_adminRegion(NULLPTR) {
+ m_adminRegion(nullptr) {
m_cacheTXManager = InternalCacheTransactionManager2PCPtr(
new InternalCacheTransactionManager2PCImpl(c));
@@ -155,18 +155,18 @@ void CacheImpl::initServices() {
PdxTypeRegistry::init();
CacheImpl::s_versionStampMemIdList =
MemberListForVersionStampPtr(new MemberListForVersionStamp());
- if (!m_initDone && m_attributes != NULLPTR && m_attributes->getEndpoints()) {
+ if (!m_initDone && m_attributes != nullptr && m_attributes->getEndpoints()) {
if (PoolManager::getAll().size() > 0 && getCacheMode()) {
LOGWARN(
"At least one pool has been created so ignoring cache level "
"redundancy setting");
}
m_tcrConnectionManager->init();
- m_remoteQueryServicePtr = new RemoteQueryService(this);
+ m_remoteQueryServicePtr = std::make_shared<RemoteQueryService>(this);
// StartAdminRegion
SystemProperties* prop = DistributedSystem::getSystemProperties();
if (prop && prop->statisticsEnabled()) {
- m_adminRegion = new AdminRegion(this);
+ m_adminRegion = AdminRegion::create(this);
}
m_initDone = true;
}
@@ -195,12 +195,13 @@ void CacheImpl::netDown() {
m_tcrConnectionManager->netDown();
const HashMapOfPools& pools = PoolManager::getAll();
- PoolPtr currPool = NULLPTR;
+ PoolPtr currPool = nullptr;
for (HashMapOfPools::Iterator itr = pools.begin(); itr != pools.end();
itr++) {
currPool = itr.second();
try {
- ThinClientPoolHADMPtr poolHADM = dynCast<ThinClientPoolHADMPtr>(currPool);
+ ThinClientPoolHADMPtr poolHADM =
+ std::dynamic_pointer_cast<ThinClientPoolHADM>(currPool);
poolHADM->netDown();
} catch (const ClassCastException&) {
// Expect a ClassCastException for non-HA PoolDMs.
@@ -216,7 +217,7 @@ CacheImpl::RegionKind CacheImpl::getRegionKind(
RegionKind regionKind = CPP_REGION;
const char* endpoints = NULL;
- if (m_attributes != NULLPTR &&
+ if (m_attributes != nullptr &&
(endpoints = m_attributes->getEndpoints()) != NULL &&
(m_attributes->getRedundancyLevel() > 0 ||
m_tcrConnectionManager->isDurable())) {
@@ -233,7 +234,7 @@ CacheImpl::RegionKind CacheImpl::getRegionKind(
}
} else if (rattrs->getPoolName()) {
PoolPtr pPtr = PoolManager::find(rattrs->getPoolName());
- if ((pPtr != NULLPTR && (pPtr->getSubscriptionRedundancy() > 0 ||
+ if ((pPtr != nullptr && (pPtr->getSubscriptionRedundancy() > 0 ||
pPtr->getSubscriptionEnabled())) ||
m_tcrConnectionManager->isDurable()) {
regionKind = THINCLIENT_HA_REGION; // As of now ThinClinetHARegion deals
@@ -257,16 +258,16 @@ int CacheImpl::removeRegion(const char* name) {
}
QueryServicePtr CacheImpl::getQueryService(bool noInit) {
- if (m_defaultPool != NULLPTR) {
+ if (m_defaultPool != nullptr) {
if (m_defaultPool->isDestroyed()) {
throw IllegalStateException("Pool has been destroyed.");
}
return m_defaultPool->getQueryService();
}
- if (m_remoteQueryServicePtr == NULLPTR) {
+ if (m_remoteQueryServicePtr == nullptr) {
m_tcrConnectionManager->init();
- m_remoteQueryServicePtr = new RemoteQueryService(this);
+ m_remoteQueryServicePtr = std::make_shared<RemoteQueryService>(this);
}
if (!noInit) {
m_remoteQueryServicePtr->init();
@@ -280,7 +281,7 @@ QueryServicePtr CacheImpl::getQueryService(const char* poolName) {
}
PoolPtr pool = PoolManager::find(poolName);
- if (pool != NULLPTR) {
+ if (pool != nullptr) {
if (pool->isDestroyed()) {
throw IllegalStateException("Pool has been destroyed.");
}
@@ -314,7 +315,7 @@ const char* CacheImpl::getName() const {
bool CacheImpl::isClosed() const { return m_closed; }
void CacheImpl::setAttributes(const CacheAttributesPtr& attrs) {
- if (m_attributes == NULLPTR && attrs != NULLPTR) {
+ if (m_attributes == nullptr && attrs != nullptr) {
m_attributes = attrs;
}
}
@@ -331,7 +332,7 @@ void CacheImpl::sendNotificationCloseMsgs() {
for (HashMapOfPools::Iterator iter = pools.begin(); iter != pools.end();
++iter) {
ThinClientPoolHADM* pool =
- dynamic_cast<ThinClientPoolHADM*>(iter.second().ptr());
+ dynamic_cast<ThinClientPoolHADM*>(iter.second().get());
if (pool != NULL) {
pool->sendNotificationCloseMsgs();
}
@@ -353,15 +354,15 @@ void CacheImpl::close(bool keepalive) {
if (m_closed || (!m_initialized)) return;
// Close the distribution manager used for queries.
- if (m_remoteQueryServicePtr != NULLPTR) {
+ if (m_remoteQueryServicePtr != nullptr) {
m_remoteQueryServicePtr->close();
- m_remoteQueryServicePtr = NULLPTR;
+ m_remoteQueryServicePtr = nullptr;
}
// Close AdminRegion
- if (m_adminRegion != NULLPTR) {
+ if (m_adminRegion != nullptr) {
m_adminRegion->close();
- m_adminRegion = NULLPTR;
+ m_adminRegion = nullptr;
}
// The TCCM gets destroyed when CacheImpl is destroyed, but after that there
@@ -380,10 +381,11 @@ void CacheImpl::close(bool keepalive) {
++q) {
// TODO: remove dynamic_cast here by having RegionInternal in the regions
// map
- RegionInternal* rImpl = dynamic_cast<RegionInternal*>((*q).int_id_.ptr());
+ RegionInternalPtr rImpl =
+ std::dynamic_pointer_cast<RegionInternal>((*q).int_id_);
if (rImpl != NULL) {
rImpl->destroyRegionNoThrow(
- NULLPTR, false,
+ nullptr, false,
CacheEventFlags::LOCAL | CacheEventFlags::CACHE_CLOSE);
}
}
@@ -413,7 +415,7 @@ void CacheImpl::close(bool keepalive) {
LOGDEBUG("CacheImpl::close( ): destroyed regions.");
GF_SAFE_DELETE(m_tcrConnectionManager);
- m_cacheTXManager = NULLPTR;
+ m_cacheTXManager = nullptr;
m_closed = true;
LOGFINE("Cache closed.");
@@ -450,10 +452,10 @@ void CacheImpl::createRegion(const char* name,
if (!m_initDone) {
if (!(aRegionAttributes->getPoolName())) {
m_tcrConnectionManager->init();
- m_remoteQueryServicePtr = new RemoteQueryService(this);
+ m_remoteQueryServicePtr = std::make_shared<RemoteQueryService>(this);
SystemProperties* prop = DistributedSystem::getSystemProperties();
if (prop && prop->statisticsEnabled()) {
- m_adminRegion = new AdminRegion(this);
+ m_adminRegion = AdminRegion::create(this);
}
}
m_initDone = true;
@@ -463,7 +465,7 @@ void CacheImpl::createRegion(const char* name,
if (m_closed || m_destroyPending) {
throw CacheClosedException("Cache::createRegion: cache closed");
}
- if (aRegionAttributes == NULLPTR) {
+ if (aRegionAttributes == nullptr) {
throw IllegalArgumentException(
"Cache::createRegion: RegionAttributes is null");
}
@@ -475,7 +477,7 @@ void CacheImpl::createRegion(const char* name,
}
validateRegionAttributes(name, aRegionAttributes);
- RegionInternal* rpImpl = NULL;
+ RegionInternalPtr rpImpl = nullptr;
{
// For multi threading and the operations between bind and find seems to be
// hard to be atomic since a regionImpl needs to be valid before it can be
@@ -491,7 +493,7 @@ void CacheImpl::createRegion(const char* name,
throw RegionExistsException(buffer);
}
- CacheStatisticsPtr csptr(new CacheStatistics);
+ auto csptr = std::make_shared<CacheStatistics>();
try {
rpImpl = createRegion_internal(namestr.c_str(), NULL, aRegionAttributes,
csptr, false);
@@ -519,7 +521,7 @@ void CacheImpl::createRegion(const char* name,
namestr.c_str());
throw UnknownException(buffer);
}
- if (rpImpl == NULL) {
+ if (rpImpl == nullptr) {
char buffer[256];
ACE_OS::snprintf(buffer, 256,
"Cache::createRegion: Failed to create Region \"%s\"",
@@ -531,7 +533,7 @@ void CacheImpl::createRegion(const char* name,
// Instantiate a PersistenceManager object if DiskPolicy is overflow
if (aRegionAttributes->getDiskPolicy() == DiskPolicyType::OVERFLOWS) {
PersistenceManagerPtr pmPtr = aRegionAttributes->getPersistenceManager();
- if (pmPtr == NULLPTR) {
+ if (pmPtr == nullptr) {
throw NullPointerException(
"PersistenceManager could not be instantiated");
}
@@ -551,10 +553,10 @@ void CacheImpl::createRegion(const char* name,
const char* poolName = aRegionAttributes->getPoolName();
if (poolName != NULL) {
PoolPtr pool = PoolManager::find(poolName);
- if (pool != NULLPTR && !pool->isDestroyed() &&
+ if (pool != nullptr && !pool->isDestroyed() &&
pool->getPRSingleHopEnabled()) {
ThinClientPoolDM* poolDM =
- dynamic_cast<ThinClientPoolDM*>(pool.ptr());
+ dynamic_cast<ThinClientPoolDM*>(pool.get());
if ((poolDM != NULL) &&
(poolDM->getClientMetaDataService() != NULL)) {
LOGFINE(
@@ -591,7 +593,7 @@ void CacheImpl::createRegion(const char* name,
void CacheImpl::getRegion(const char* path, RegionPtr& rptr) {
TryReadGuard guardCacheDestroy(m_destroyCacheMutex, m_destroyPending);
if (m_destroyPending) {
- rptr = NULLPTR;
+ rptr = nullptr;
return;
}
@@ -600,7 +602,7 @@ void CacheImpl::getRegion(const char* path, RegionPtr& rptr) {
if (path != NULL) {
pathstr = path;
}
- rptr = NULLPTR;
+ rptr = nullptr;
std::string slash("/");
if ((path == (void*)NULL) || (pathstr == slash) || (pathstr.length() < 1)) {
LOGERROR("Cache::getRegion: path [%s] is not valid.", pathstr.c_str());
@@ -621,40 +623,40 @@ void CacheImpl::getRegion(const char* path, RegionPtr& rptr) {
return;
}
std::string remainder = fullname.substr(stepname.length() + 1);
- if (region != NULLPTR) {
+ if (region != nullptr) {
rptr = region->getSubregion(remainder.c_str());
} else {
- rptr = NULLPTR;
+ rptr = nullptr;
return; // Return null if the parent region was not found.
}
}
}
-RegionInternal* CacheImpl::createRegion_internal(
- const std::string& name, RegionInternal* rootRegion,
+std::shared_ptr<RegionInternal> CacheImpl::createRegion_internal(
+ const std::string& name, const std::shared_ptr<RegionInternal>& rootRegion,
const RegionAttributesPtr& attrs, const CacheStatisticsPtr& csptr,
bool shared) {
- if (attrs == NULLPTR) {
+ if (attrs == nullptr) {
throw IllegalArgumentException(
"createRegion: "
"RegionAttributes is null");
}
- RegionInternal* rptr = NULL;
+ RegionInternalPtr rptr = nullptr;
RegionKind regionKind = getRegionKind(attrs);
const char* poolName = attrs->getPoolName();
const char* regionEndpoints = attrs->getEndpoints();
const char* cacheEndpoints =
- m_attributes == NULLPTR ? NULL : m_attributes->getEndpoints();
+ m_attributes == nullptr ? NULL : m_attributes->getEndpoints();
- /*if(m_defaultPool != NULLPTR && (poolName == NULL || strlen(poolName) == 0))
+ /*if(m_defaultPool != nullptr && (poolName == NULL || strlen(poolName) == 0))
{
attrs->setPoolName(m_defaultPool->getName());
}*/
if (poolName != NULL) {
PoolPtr pool = PoolManager::find(poolName);
- if (pool != NULLPTR && !pool->isDestroyed()) {
+ if (pool != nullptr && !pool->isDestroyed()) {
bool isMultiUserSecureMode = pool->getMultiuserAuthentication();
if (isMultiUserSecureMode && (attrs->getCachingEnabled())) {
LOGERROR(
@@ -680,31 +682,30 @@ RegionInternal* CacheImpl::createRegion_internal(
"specified");
}
- DeleteObject<RegionInternal> delrptr(rptr);
if (regionKind == THINCLIENT_REGION) {
LOGINFO("Creating region %s with region endpoints %s", name.c_str(),
attrs->getEndpoints());
- GF_NEW(rptr,
- ThinClientRegion(name, this, rootRegion, attrs, csptr, shared));
- ((ThinClientRegion*)rptr)->initTCR();
- delrptr.noDelete();
+ auto tmp = std::make_shared<ThinClientRegion>(name, this, rootRegion, attrs,
+ csptr, shared);
+ tmp->initTCR();
+ rptr = tmp;
} else if (regionKind == THINCLIENT_HA_REGION) {
LOGINFO("Creating region %s with subscriptions enabled", name.c_str());
- GF_NEW(rptr,
- ThinClientHARegion(name, this, rootRegion, attrs, csptr, shared));
- ((ThinClientHARegion*)rptr)->initTCR();
- delrptr.noDelete();
+ auto tmp = std::make_shared<ThinClientHARegion>(name, this, rootRegion,
+ attrs, csptr, shared);
+ tmp->initTCR();
+ rptr = tmp;
} else if (regionKind == THINCLIENT_POOL_REGION) {
LOGINFO("Creating region %s attached to pool %s", name.c_str(),
attrs->getPoolName());
- GF_NEW(rptr,
- ThinClientPoolRegion(name, this, rootRegion, attrs, csptr, shared));
- ((ThinClientPoolRegion*)rptr)->initTCR();
- delrptr.noDelete();
+ auto tmp = std::make_shared<ThinClientPoolRegion>(name, this, rootRegion,
+ attrs, csptr, shared);
+ tmp->initTCR();
+ rptr = tmp;
} else {
LOGINFO("Creating local region %s", name.c_str());
- GF_NEW(rptr, LocalRegion(name, this, rootRegion, attrs, csptr, shared));
- delrptr.noDelete();
+ rptr = std::make_shared<LocalRegion>(name, this, rootRegion, attrs, csptr,
+ shared);
}
return rptr;
}
@@ -750,7 +751,7 @@ void CacheImpl::readyForEvents() {
const HashMapOfPools& pools = PoolManager::getAll();
if (pools.empty()) throw IllegalStateException("No pools found.");
- PoolPtr currPool = NULLPTR;
+ PoolPtr currPool = nullptr;
for (HashMapOfPools::Iterator itr = pools.begin(); itr != pools.end();
itr++) {
currPool = itr.second();
@@ -758,7 +759,7 @@ void CacheImpl::readyForEvents() {
try {
try {
ThinClientPoolHADMPtr poolHADM =
- dynCast<ThinClientPoolHADMPtr>(currPool);
+ std::dynamic_pointer_cast<ThinClientPoolHADM>(currPool);
poolHADM->readyForEvents();
} catch (const ClassCastException&) {
// Expect a ClassCastException for non-HA PoolDMs.
@@ -788,7 +789,7 @@ bool CacheImpl::getEndpointStatus(const std::string& endpoint) {
? endpoint
: Utils::convertHostToCanonicalForm(endpoint.c_str());
ThinClientPoolDMPtr currPool =
- staticCast<ThinClientPoolDMPtr>(pools.begin().second());
+ std::static_pointer_cast<GF_UNWRAP_SP(ThinClientPoolDMPtr)>(pools.begin().second());
ACE_Guard<ACE_Recursive_Thread_Mutex> guard(currPool->m_endpointsLock);
for (ACE_Map_Manager<std::string, TcrEndpoint*,
ACE_Recursive_Thread_Mutex>::iterator itr =
@@ -814,7 +815,7 @@ void CacheImpl::processMarker() {
q != m_regions->end(); ++q) {
if (!(*q).int_id_->isDestroyed()) {
ThinClientHARegion* tcrHARegion =
- dynamic_cast<ThinClientHARegion*>((*q).int_id_.ptr());
+ dynamic_cast<ThinClientHARegion*>((*q).int_id_.get());
if (tcrHARegion != NULL) {
TcrMessage* regionMsg = new TcrMessageClientMarker(true);
tcrHARegion->receiveNotification(regionMsg);
@@ -824,7 +825,7 @@ void CacheImpl::processMarker() {
iter != subregions.end(); ++iter) {
if (!(*iter)->isDestroyed()) {
ThinClientHARegion* subregion =
- dynamic_cast<ThinClientHARegion*>((*iter).ptr());
+ dynamic_cast<ThinClientHARegion*>((*iter).get());
if (subregion != NULL) {
regionMsg = new TcrMessageClientMarker(true);
subregion->receiveNotification(regionMsg);
@@ -838,10 +839,10 @@ void CacheImpl::processMarker() {
int CacheImpl::getPoolSize(const char* poolName) {
PoolPtr pool = PoolManager::find(poolName);
- if (pool == NULLPTR) {
+ if (pool == nullptr) {
return -1;
} else {
- ThinClientPoolDM* dm = dynamic_cast<ThinClientPoolDM*>(pool.ptr());
+ ThinClientPoolDM* dm = dynamic_cast<ThinClientPoolDM*>(pool.get());
if (dm) {
return dm->m_poolSize;
} else {
@@ -852,8 +853,7 @@ int CacheImpl::getPoolSize(const char* poolName) {
RegionFactoryPtr CacheImpl::createRegionFactory(
RegionShortcut preDefinedRegion) {
- RegionFactoryPtr rfPtr(new RegionFactory(preDefinedRegion));
- return rfPtr;
+ return std::make_shared<RegionFactory>(preDefinedRegion);
}
void CacheImpl::setRegionShortcut(AttributesFactoryPtr attrFact,
@@ -882,21 +882,21 @@ std::map<std::string, RegionAttributesPtr> CacheImpl::getRegionShortcut() {
{
// PROXY
- RegionAttributesPtr regAttr_PROXY(new RegionAttributes());
+ auto regAttr_PROXY = std::make_shared<RegionAttributes>();
regAttr_PROXY->setCachingEnabled(false);
preDefined["PROXY"] = regAttr_PROXY;
}
{
// CACHING_PROXY
- RegionAttributesPtr regAttr_CACHING_PROXY(new RegionAttributes());
+ auto regAttr_CACHING_PROXY = std::make_shared<RegionAttributes>();
regAttr_CACHING_PROXY->setCachingEnabled(true);
preDefined["CACHING_PROXY"] = regAttr_CACHING_PROXY;
}
{
// CACHING_PROXY_ENTRY_LRU
- RegionAttributesPtr regAttr_CACHING_PROXY_LRU(new RegionAttributes());
+ auto regAttr_CACHING_PROXY_LRU = std::make_shared<RegionAttributes>();
regAttr_CACHING_PROXY_LRU->setCachingEnabled(true);
regAttr_CACHING_PROXY_LRU->setLruEntriesLimit(DEFAULT_LRU_MAXIMUM_ENTRIES);
preDefined["CACHING_PROXY_ENTRY_LRU"] = regAttr_CACHING_PROXY_LRU;
@@ -904,13 +904,13 @@ std::map<std::string, RegionAttributesPtr> CacheImpl::getRegionShortcut() {
{
// LOCAL
- RegionAttributesPtr regAttr_LOCAL(new RegionAttributes());
+ auto regAttr_LOCAL = std::make_shared<RegionAttributes>();
preDefined["LOCAL"] = regAttr_LOCAL;
}
{
// LOCAL_ENTRY_LRU
- RegionAttributesPtr regAttr_LOCAL_LRU(new RegionAttributes());
+ auto regAttr_LOCAL_LRU = std::make_shared<RegionAttributes>();
regAttr_LOCAL_LRU->setLruEntriesLimit(DEFAULT_LRU_MAXIMUM_ENTRIES);
preDefined["LOCAL_ENTRY_LRU"] = regAttr_LOCAL_LRU;
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/CacheImpl.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CacheImpl.hpp b/src/cppcache/src/CacheImpl.hpp
index 84dc954..7ce8550 100644
--- a/src/cppcache/src/CacheImpl.hpp
+++ b/src/cppcache/src/CacheImpl.hpp
@@ -235,11 +235,11 @@ class CPPCACHE_EXPORT CacheImpl : private NonCopyable, private NonAssignable {
QueryServicePtr getQueryService(const char* poolName);
- RegionInternal* createRegion_internal(const std::string& name,
- RegionInternal* rootRegion,
- const RegionAttributesPtr& attrs,
- const CacheStatisticsPtr& csptr,
- bool shared);
+ std::shared_ptr<RegionInternal> createRegion_internal(
+ const std::string& name,
+ const std::shared_ptr<RegionInternal>& rootRegion,
+ const RegionAttributesPtr& attrs, const CacheStatisticsPtr& csptr,
+ bool shared);
/**
* Send the "client ready" message to the server.
@@ -260,7 +260,7 @@ class CPPCACHE_EXPORT CacheImpl : private NonCopyable, private NonAssignable {
static inline CacheImpl* getInstance() { return s_instance; };
bool getCacheMode() {
- return m_attributes == NULLPTR ? false : m_attributes->m_cacheMode;
+ return m_attributes == nullptr ? false : m_attributes->m_cacheMode;
}
bool getPdxIgnoreUnreadFields() { return m_ignorePdxUnreadFields; }
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/CacheRegionHelper.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CacheRegionHelper.hpp b/src/cppcache/src/CacheRegionHelper.hpp
index 7d04d55..7e26e1a 100644
--- a/src/cppcache/src/CacheRegionHelper.hpp
+++ b/src/cppcache/src/CacheRegionHelper.hpp
@@ -40,7 +40,7 @@ class CacheRegionHelper {
*/
public:
inline static CacheImpl* getCacheImpl(const Cache* cache) {
- return cache->m_cacheImpl;
+ return cache->m_cacheImpl.get();
}
inline static DistributedSystemImpl* getDistributedSystemImpl() {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/CacheTransactionManagerImpl.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CacheTransactionManagerImpl.cpp b/src/cppcache/src/CacheTransactionManagerImpl.cpp
index 14d5ca4..bdea6db 100644
--- a/src/cppcache/src/CacheTransactionManagerImpl.cpp
+++ b/src/cppcache/src/CacheTransactionManagerImpl.cpp
@@ -81,7 +81,7 @@ void CacheTransactionManagerImpl::commit() {
if (err != GF_NOERR) {
// err = rollback(txState, false);
- // noteCommitFailure(txState, NULLPTR);
+ // noteCommitFailure(txState, nullptr);
GfErrTypeThrowException("Error while committing", err);
} else {
switch (reply.getMessageType()) {
@@ -89,7 +89,7 @@ void CacheTransactionManagerImpl::commit() {
break;
}
case TcrMessage::EXCEPTION: {
- // noteCommitFailure(txState, NULLPTR);
+ // noteCommitFailure(txState, nullptr);
const char* exceptionMsg = reply.getException();
err = ThinClientRegion::handleServerException(
"CacheTransactionManager::commit", exceptionMsg);
@@ -97,12 +97,12 @@ void CacheTransactionManagerImpl::commit() {
break;
}
case TcrMessage::COMMIT_ERROR: {
- // noteCommitFailure(txState, NULLPTR);
+ // noteCommitFailure(txState, nullptr);
GfErrTypeThrowException("Commit Failed", GF_COMMIT_CONFLICT_EXCEPTION);
break;
}
default: {
- // noteCommitFailure(txState, NULLPTR);
+ // noteCommitFailure(txState, nullptr);
LOGERROR("Unknown message type in commit reply %d",
reply.getMessageType());
GfErrTypeThrowException("Commit Failed", GF_MSG);
@@ -111,12 +111,12 @@ void CacheTransactionManagerImpl::commit() {
}
}
- TXCommitMessagePtr commit = staticCast<TXCommitMessagePtr>(reply.getValue());
+ TXCommitMessagePtr commit = std::static_pointer_cast<GF_UNWRAP_SP(TXCommitMessagePtr)>(reply.getValue());
txCleaner.clean();
commit->apply(m_cache);
/*
- if(m_writer != NULLPTR)
+ if(m_writer != nullptr)
{
try
{
@@ -305,8 +305,8 @@ GfErrType CacheTransactionManagerImpl::rollback(TXState* txState,
/* if(err == GF_NOERR && callListener)
{
// TXCommitMessagePtr commit =
- staticCast<TXCommitMessagePtr>(reply.getValue());
- noteRollbackSuccess(txState, NULLPTR);
+ std::static_pointer_cast<GF_UNWRAP_SP(TXCommitMessagePtr)>(reply.getValue());
+ noteRollbackSuccess(txState, nullptr);
}
*/
return err;
@@ -330,14 +330,14 @@ TransactionIdPtr CacheTransactionManagerImpl::suspend() {
TXState* txState = TSSTXStateWrapper::s_geodeTSSTXState->getTXState();
if (txState == NULL) {
LOGFINE("Transaction not in progress. Returning NULL transaction Id.");
- return NULLPTR;
+ return nullptr;
}
// get the current connection that this transaction is using
TcrConnection* conn = TssConnectionWrapper::s_geodeTSSConn->getConnection();
if (conn == NULL) {
LOGFINE("Thread local connection is null. Returning NULL transaction Id.");
- return NULLPTR;
+ return nullptr;
}
// get the endpoint info from the connection
@@ -380,8 +380,8 @@ void CacheTransactionManagerImpl::resume(TransactionIdPtr transactionId) {
}
// get the transaction state of the suspended transaction
- TXState* txState =
- removeSuspendedTx((static_cast<TXIdPtr>(transactionId))->getId());
+ TXState* txState = removeSuspendedTx(
+ (std::static_pointer_cast<TXId>(transactionId))->getId());
if (txState == NULL) {
GfErrTypeThrowException(
"Could not get transaction state for the transaction id.",
@@ -392,7 +392,8 @@ void CacheTransactionManagerImpl::resume(TransactionIdPtr transactionId) {
}
bool CacheTransactionManagerImpl::isSuspended(TransactionIdPtr transactionId) {
- return isSuspendedTx((static_cast<TXIdPtr>(transactionId))->getId());
+ return isSuspendedTx(
+ (std::static_pointer_cast<TXId>(transactionId))->getId());
}
bool CacheTransactionManagerImpl::tryResume(TransactionIdPtr transactionId) {
return tryResume(transactionId, true);
@@ -406,8 +407,8 @@ bool CacheTransactionManagerImpl::tryResume(TransactionIdPtr transactionId,
}
// get the transaction state of the suspended transaction
- TXState* txState =
- removeSuspendedTx((static_cast<TXIdPtr>(transactionId))->getId());
+ TXState* txState = removeSuspendedTx(
+ (std::static_pointer_cast<TXId>(transactionId))->getId());
if (txState == NULL) return false;
resumeTxUsingTxState(txState, cancelExpiryTask);
@@ -426,7 +427,8 @@ bool CacheTransactionManagerImpl::tryResume(TransactionIdPtr transactionId,
// get the transaction state of the suspended transaction
TXState* txState = removeSuspendedTxUntil(
- (static_cast<TXIdPtr>(transactionId))->getId(), waitTimeInMillisec);
+ (std::static_pointer_cast<TXId>(transactionId))->getId(),
+ waitTimeInMillisec);
if (txState == NULL) return false;
resumeTxUsingTxState(txState);
@@ -474,7 +476,7 @@ void CacheTransactionManagerImpl::resumeTxUsingTxState(TXState* txState,
}
bool CacheTransactionManagerImpl::exists(TransactionIdPtr transactionId) {
- return findTx((static_cast<TXIdPtr>(transactionId))->getId());
+ return findTx((std::static_pointer_cast<TXId>(transactionId))->getId());
}
bool CacheTransactionManagerImpl::exists() {
@@ -566,7 +568,7 @@ bool CacheTransactionManagerImpl::isSuspendedTx(int32_t txId) {
TransactionIdPtr CacheTransactionManagerImpl::getTransactionId() {
TXState* txState = TSSTXStateWrapper::s_geodeTSSTXState->getTXState();
if (txState == NULL) {
- return NULLPTR;
+ return nullptr;
} else {
return txState->getTransactionId();
}
@@ -585,7 +587,7 @@ TransactionWriterPtr CacheTransactionManagerImpl::getWriter()
void CacheTransactionManagerImpl::addListener(TransactionListenerPtr aListener)
{
- if(aListener == NULLPTR)
+ if(aListener == nullptr)
{
GfErrTypeThrowException("Trying to add null listener.",
GF_CACHE_ILLEGAL_ARGUMENT_EXCEPTION);
@@ -599,7 +601,7 @@ GF_CACHE_ILLEGAL_ARGUMENT_EXCEPTION);
void CacheTransactionManagerImpl::removeListener(TransactionListenerPtr
aListener)
{
- if(aListener == NULLPTR)
+ if(aListener == nullptr)
{
GfErrTypeThrowException("Trying to remove null listener.",
GF_CACHE_ILLEGAL_ARGUMENT_EXCEPTION);
@@ -614,7 +616,7 @@ void CacheTransactionManagerImpl::noteCommitFailure(TXState* txState, const
TXCommitMessagePtr& commitMessage)
{
VectorOfEntryEvent events;
- if(commitMessage!= NULLPTR)
+ if(commitMessage!= nullptr)
{
events = commitMessage->getEvents(m_cache);
}
@@ -625,7 +627,7 @@ TransactionEvent(txState->getTransactionId(), CachePtr(m_cache), events));
m_listeners.end() != iter; iter++)
{
TransactionListenerPtr listener =
-staticCast<TransactionListenerPtr>(*iter);
+std::static_pointer_cast<GF_UNWRAP_SP(TransactionListenerPtr)>(*iter);
listener->afterFailedCommit(event);
}
}
@@ -634,7 +636,7 @@ void CacheTransactionManagerImpl::noteCommitSuccess(TXState* txState, const
TXCommitMessagePtr& commitMessage)
{
VectorOfEntryEvent events;
- if(commitMessage!= NULLPTR)
+ if(commitMessage!= nullptr)
{
events = commitMessage->getEvents(m_cache);
}
@@ -645,7 +647,7 @@ TransactionEvent(txState->getTransactionId(), CachePtr(m_cache), events));
m_listeners.end() != iter; iter++)
{
TransactionListenerPtr listener =
-staticCast<TransactionListenerPtr>(*iter);
+std::static_pointer_cast<GF_UNWRAP_SP(TransactionListenerPtr)>(*iter);
listener->afterCommit(event);
}
}
@@ -654,7 +656,7 @@ void CacheTransactionManagerImpl::noteRollbackSuccess(TXState* txState, const
TXCommitMessagePtr& commitMessage)
{
VectorOfEntryEvent events;
- if(commitMessage!= NULLPTR)
+ if(commitMessage!= nullptr)
{
events = commitMessage->getEvents(m_cache);
}
@@ -665,7 +667,7 @@ TransactionEvent(txState->getTransactionId(), CachePtr(m_cache), events));
m_listeners.end() != iter; iter++)
{
TransactionListenerPtr listener =
-staticCast<TransactionListenerPtr>(*iter);
+std::static_pointer_cast<GF_UNWRAP_SP(TransactionListenerPtr)>(*iter);
listener->afterRollback(event);
}
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/CacheTransactionManagerImpl.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CacheTransactionManagerImpl.hpp b/src/cppcache/src/CacheTransactionManagerImpl.hpp
index e728531..3be1bcb 100644
--- a/src/cppcache/src/CacheTransactionManagerImpl.hpp
+++ b/src/cppcache/src/CacheTransactionManagerImpl.hpp
@@ -67,11 +67,11 @@ class CacheTransactionManagerImpl
// virtual void removeListener(TransactionListenerPtr aListener);
inline static int32_t hasher(const SharedBasePtr& p) {
- return static_cast<int32_t>(reinterpret_cast<intptr_t>(p.ptr()));
+ return static_cast<int32_t>(reinterpret_cast<intptr_t>(p.get()));
}
inline static bool equal_to(const SharedBasePtr& x, const SharedBasePtr& y) {
- return x.ptr() == y.ptr();
+ return x.get() == y.get();
}
TXState* getSuspendedTx(int32_t txId);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/CacheXmlParser.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CacheXmlParser.cpp b/src/cppcache/src/CacheXmlParser.cpp
index 836f9e9..05a9d9d 100644
--- a/src/cppcache/src/CacheXmlParser.cpp
+++ b/src/cppcache/src/CacheXmlParser.cpp
@@ -268,7 +268,7 @@ LibraryPersistenceManagerFn CacheXmlParser::managedPersistenceManagerFn = NULL;
CacheXmlParser::CacheXmlParser()
: m_cacheCreation(NULL),
m_nestedRegions(0),
- m_config(NULLPTR),
+ m_config(nullptr),
m_parserMessage(""),
m_flagCacheXmlException(false),
m_flagIllegalStateException(false),
@@ -610,7 +610,7 @@ void CacheXmlParser::startPool(const xmlChar** atts) {
if (strcmp(name, NAME) == 0) {
poolName = value;
} else {
- setPoolInfo(factory.ptr(), name, value);
+ setPoolInfo(factory.get(), name, value);
}
++attrsCount;
}
@@ -625,7 +625,7 @@ void CacheXmlParser::startPool(const xmlChar** atts) {
PoolXmlCreation* poolxml = new PoolXmlCreation(poolName, factory);
_stack.push(poolxml);
- _stack.push(factory.ptr());
+ _stack.push(factory.get());
}
void CacheXmlParser::endPool() {
@@ -1215,7 +1215,7 @@ void CacheXmlParser::startPersistenceProperties(const xmlChar** atts) {
"XML:Incorrect number of attributes provided for <property>";
throw CacheXmlException(s.c_str());
} else {
- if (m_config == NULLPTR) {
+ if (m_config == nullptr) {
m_config = Properties::create();
}
}
@@ -1672,10 +1672,10 @@ void CacheXmlParser::endPersistenceManager() {
_stack.pop();
AttributesFactory* attrsFactory =
reinterpret_cast<AttributesFactory*>(_stack.top());
- if (m_config != NULLPTR) {
+ if (m_config != nullptr) {
attrsFactory->setPersistenceManager(libraryName, libraryFunctionName,
m_config);
- m_config = NULLPTR;
+ m_config = nullptr;
} else {
attrsFactory->setPersistenceManager(libraryName, libraryFunctionName);
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/CacheableEnum.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CacheableEnum.cpp b/src/cppcache/src/CacheableEnum.cpp
index 7db7f6c..b08c6ac 100644
--- a/src/cppcache/src/CacheableEnum.cpp
+++ b/src/cppcache/src/CacheableEnum.cpp
@@ -27,8 +27,8 @@ namespace client {
CacheableEnum::~CacheableEnum() {}
CacheableEnum::CacheableEnum()
- : m_enumClassName(NULLPTR),
- m_enumName(NULLPTR),
+ : m_enumClassName(nullptr),
+ m_enumName(nullptr),
m_ordinal(-1),
m_hashcode(0) {}
@@ -58,7 +58,7 @@ Serializable* CacheableEnum::fromData(apache::geode::client::DataInput& input) {
m_enumClassName = enumVal->getEnumClassName();
m_enumName = enumVal->getEnumName();
m_ordinal = enumVal->getEnumOrdinal();
- return enumVal.ptr();
+ return enumVal.get();
}
int32_t CacheableEnum::hashcode() const {
@@ -67,9 +67,9 @@ int32_t CacheableEnum::hashcode() const {
int prime = 31;
localHash =
prime * localHash +
- ((m_enumClassName != NULLPTR ? m_enumClassName->hashcode() : 0));
+ ((m_enumClassName != nullptr ? m_enumClassName->hashcode() : 0));
localHash = prime * localHash +
- ((m_enumName != NULLPTR ? m_enumName->hashcode() : 0));
+ ((m_enumName != nullptr ? m_enumName->hashcode() : 0));
m_hashcode = localHash;
}
return m_hashcode;
@@ -87,11 +87,11 @@ bool CacheableEnum::operator==(const CacheableKey& other) const {
if (m_ordinal != otherEnum->m_ordinal) {
return false;
}
- if (m_enumClassName == NULLPTR) {
- return (otherEnum->m_enumClassName == NULLPTR);
+ if (m_enumClassName == nullptr) {
+ return (otherEnum->m_enumClassName == nullptr);
}
- if (m_enumName == NULLPTR) {
- return (otherEnum->m_enumName == NULLPTR);
+ if (m_enumName == nullptr) {
+ return (otherEnum->m_enumName == nullptr);
}
if (strcmp(m_enumClassName->asChar(), otherEnum->m_enumClassName->asChar()) !=
0) {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/CacheableObjectPartList.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CacheableObjectPartList.cpp b/src/cppcache/src/CacheableObjectPartList.cpp
index 7bec1b2..0ca8deb 100644
--- a/src/cppcache/src/CacheableObjectPartList.cpp
+++ b/src/cppcache/src/CacheableObjectPartList.cpp
@@ -53,7 +53,7 @@ Serializable* CacheableObjectPartList::fromData(DataInput& input) {
"CacheableObjectPartList: "
"hasKeys is false and m_keys is also NULL");
}
- if (m_resultKeys != NULLPTR) {
+ if (m_resultKeys != nullptr) {
m_resultKeys->push_back(key);
}
// input.readBoolean(&isException);
@@ -66,15 +66,16 @@ Serializable* CacheableObjectPartList::fromData(DataInput& input) {
input.advanceCursor(skipLen);
// input.readObject(exMsgPtr, true);// Changed
input.readNativeString(exMsgPtr);
- if (m_exceptions != NULLPTR) {
+ if (m_exceptions != nullptr) {
const char* exMsg = exMsgPtr->asChar();
if (strstr(exMsg,
"org.apache.geode.security."
"NotAuthorizedException") != NULL) {
- ex = new NotAuthorizedException(
+ ex = std::make_shared<NotAuthorizedException>(
"Authorization exception at server:", exMsg);
} else {
- ex = new CacheServerException("Exception at remote server:", exMsg);
+ ex = std::make_shared<CacheServerException>(
+ "Exception at remote server:", exMsg);
}
m_exceptions->insert(key, ex);
}
@@ -108,10 +109,10 @@ Serializable* CacheableObjectPartList::fromData(DataInput& input) {
}
// if value has already been received via notification or put by
// another thread, then return that
- if (oldValue != NULLPTR && !CacheableToken::isInvalid(oldValue)) {
+ if (oldValue != nullptr && !CacheableToken::isInvalid(oldValue)) {
value = oldValue;
}
- if (m_values != NULLPTR) {
+ if (m_values != nullptr) {
m_values->insert(key, value);
}
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/CacheableObjectPartList.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CacheableObjectPartList.hpp b/src/cppcache/src/CacheableObjectPartList.hpp
index f124b39..fbff1bb 100644
--- a/src/cppcache/src/CacheableObjectPartList.hpp
+++ b/src/cppcache/src/CacheableObjectPartList.hpp
@@ -64,9 +64,9 @@ class CacheableObjectPartList : public Cacheable {
inline CacheableObjectPartList()
: m_keys(NULL),
m_keysOffset(NULL),
- m_values(NULLPTR),
- m_exceptions(NULLPTR),
- m_resultKeys(NULLPTR),
+ m_values(nullptr),
+ m_exceptions(nullptr),
+ m_resultKeys(nullptr),
m_region(NULL),
m_updateCountMap(NULL),
m_destroyTracker(0),
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/CacheableToken.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CacheableToken.cpp b/src/cppcache/src/CacheableToken.cpp
index 131d405..50de562 100644
--- a/src/cppcache/src/CacheableToken.cpp
+++ b/src/cppcache/src/CacheableToken.cpp
@@ -27,26 +27,14 @@ using namespace apache::geode::client;
//---- statics
-CacheableTokenPtr* CacheableToken::invalidToken = 0;
-CacheableTokenPtr* CacheableToken::destroyedToken = 0;
-CacheableTokenPtr* CacheableToken::overflowedToken = 0;
-CacheableTokenPtr* CacheableToken::tombstoneToken = 0;
-
-void CacheableToken::init() {
- if (CacheableToken::invalidToken == 0) {
- CacheableToken::invalidToken = new CacheableTokenPtr();
- *CacheableToken::invalidToken = new CacheableToken(CacheableToken::INVALID);
- CacheableToken::destroyedToken = new CacheableTokenPtr();
- *CacheableToken::destroyedToken =
- new CacheableToken(CacheableToken::DESTROYED);
- CacheableToken::overflowedToken = new CacheableTokenPtr();
- *CacheableToken::overflowedToken =
- new CacheableToken(CacheableToken::OVERFLOWED);
- CacheableToken::tombstoneToken = new CacheableTokenPtr();
- *CacheableToken::tombstoneToken =
- new CacheableToken(CacheableToken::TOMBSTONE);
- }
-}
+CacheableTokenPtr CacheableToken::invalidToken =
+ std::make_shared<CacheableToken>(CacheableToken::INVALID);
+CacheableTokenPtr CacheableToken::destroyedToken =
+ std::make_shared<CacheableToken>(CacheableToken::DESTROYED);
+CacheableTokenPtr CacheableToken::overflowedToken =
+ std::make_shared<CacheableToken>(CacheableToken::OVERFLOWED);
+CacheableTokenPtr CacheableToken::tombstoneToken =
+ std::make_shared<CacheableToken>(CacheableToken::TOMBSTONE);
//----- serialization
@@ -60,22 +48,7 @@ void CacheableToken::toData(DataOutput& output) const {
Serializable* CacheableToken::fromData(DataInput& input) {
input.readInt(reinterpret_cast<int32_t*>(&m_value));
- switch (m_value) {
- case INVALID:
- return invalidToken->ptr();
- case DESTROYED:
- return destroyedToken->ptr();
- case OVERFLOWED:
- return overflowedToken->ptr();
- case TOMBSTONE:
- return tombstoneToken->ptr();
-
- default:
- GF_D_ASSERT(false);
- // we really can't be returning new instances all the time..
- // because we wish to test tokens with pointer identity.
- return this;
- }
+ return this;
}
int32_t CacheableToken::classId() const { return 0; }
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/CacheableToken.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CacheableToken.hpp b/src/cppcache/src/CacheableToken.hpp
index afa1091..b071a80 100644
--- a/src/cppcache/src/CacheableToken.hpp
+++ b/src/cppcache/src/CacheableToken.hpp
@@ -38,18 +38,16 @@ class CPPCACHE_EXPORT CacheableToken : public Cacheable {
TokenType m_value;
- static CacheableTokenPtr* invalidToken;
- static CacheableTokenPtr* destroyedToken;
- static CacheableTokenPtr* overflowedToken;
- static CacheableTokenPtr* tombstoneToken;
+ static CacheableTokenPtr invalidToken;
+ static CacheableTokenPtr destroyedToken;
+ static CacheableTokenPtr overflowedToken;
+ static CacheableTokenPtr tombstoneToken;
public:
- inline static CacheableTokenPtr& invalid() { return *invalidToken; }
-
- inline static CacheableTokenPtr& destroyed() { return *destroyedToken; }
-
- inline static CacheableTokenPtr& overflowed() { return *overflowedToken; }
- inline static CacheableTokenPtr& tombstone() { return *tombstoneToken; }
+ inline static CacheableTokenPtr& invalid() { return invalidToken; }
+ inline static CacheableTokenPtr& destroyed() { return destroyedToken; }
+ inline static CacheableTokenPtr& overflowed() { return overflowedToken; }
+ inline static CacheableTokenPtr& tombstone() { return tombstoneToken; }
/**
*@brief serialize this object
**/
@@ -81,6 +79,8 @@ class CPPCACHE_EXPORT CacheableToken : public Cacheable {
virtual ~CacheableToken();
+ FRIEND_STD_SHARED_PTR(CacheableToken)
+
inline bool isInvalid() { return m_value == INVALID; }
inline bool isDestroyed() { return m_value == DESTROYED; }
@@ -90,26 +90,23 @@ class CPPCACHE_EXPORT CacheableToken : public Cacheable {
inline bool isTombstone() { return m_value == TOMBSTONE; }
static bool isToken(const CacheablePtr& ptr) {
- return (*invalidToken == ptr) || (*destroyedToken == ptr) ||
- (*overflowedToken == ptr) || (*tombstoneToken == ptr);
+ return (invalidToken == ptr) || (destroyedToken == ptr) ||
+ (overflowedToken == ptr) || (tombstoneToken == ptr);
}
- static bool isInvalid(const CacheablePtr& ptr) {
- return *invalidToken == ptr;
- }
+ static bool isInvalid(const CacheablePtr& ptr) { return invalidToken == ptr; }
static bool isDestroyed(const CacheablePtr& ptr) {
- return *destroyedToken == ptr;
+ return destroyedToken == ptr;
}
static bool isOverflowed(const CacheablePtr& ptr) {
- return *overflowedToken == ptr;
+ return overflowedToken == ptr;
}
static bool isTombstone(const CacheablePtr& ptr) {
- return *tombstoneToken == ptr;
+ return tombstoneToken == ptr;
}
- static void init();
/**
* Display this object as 'string', which depend on the implementation in
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/CachedDeserializableHelper.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CachedDeserializableHelper.hpp b/src/cppcache/src/CachedDeserializableHelper.hpp
index d15ff27..799fcca 100644
--- a/src/cppcache/src/CachedDeserializableHelper.hpp
+++ b/src/cppcache/src/CachedDeserializableHelper.hpp
@@ -62,7 +62,7 @@ class CachedDeserializableHelper : public Cacheable,
int32_t arrayLen;
input.readArrayLen(&arrayLen);
input.readObject(m_intermediate);
- return m_intermediate.ptr();
+ return m_intermediate.get();
}
/**
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/ClientMetadata.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ClientMetadata.cpp b/src/cppcache/src/ClientMetadata.cpp
index 89a4242..7bdba2b 100644
--- a/src/cppcache/src/ClientMetadata.cpp
+++ b/src/cppcache/src/ClientMetadata.cpp
@@ -29,8 +29,8 @@ ClientMetadata::ClientMetadata(
int totalNumBuckets, CacheableStringPtr colocatedWith,
ThinClientPoolDM* tcrdm,
std::vector<FixedPartitionAttributesImplPtr>* fpaSet)
- : m_partitionNames(NULLPTR),
- m_previousOne(NULLPTR),
+ : m_partitionNames(nullptr),
+ m_previousOne(nullptr),
m_totalNumBuckets(totalNumBuckets),
m_colocatedWith(colocatedWith),
m_tcrdm(tcrdm) {
@@ -62,8 +62,8 @@ ClientMetadata::ClientMetadata(
}
ClientMetadata::ClientMetadata(ClientMetadata& other) {
- m_partitionNames = NULLPTR;
- m_previousOne = NULLPTR;
+ m_partitionNames = nullptr;
+ m_previousOne = nullptr;
m_totalNumBuckets = other.m_totalNumBuckets;
for (int item = 0; item < m_totalNumBuckets; item++) {
BucketServerLocationsType empty;
@@ -79,10 +79,10 @@ ClientMetadata::ClientMetadata(ClientMetadata& other) {
}
ClientMetadata::ClientMetadata()
- : m_partitionNames(NULLPTR),
- m_previousOne(NULLPTR),
+ : m_partitionNames(nullptr),
+ m_previousOne(nullptr),
m_totalNumBuckets(0),
- m_colocatedWith(NULLPTR),
+ m_colocatedWith(nullptr),
m_tcrdm(NULL) {}
ClientMetadata::~ClientMetadata() {}
@@ -182,10 +182,10 @@ void ClientMetadata::updateBucketServerLocations(
bucketServerLocations.begin();
iter != bucketServerLocations.end(); ++iter) {
CacheableStringArrayPtr groups = (*iter)->getServerGroups();
- if ((groups != NULLPTR) && (groups->length() > 0)) {
+ if ((groups != nullptr) && (groups->length() > 0)) {
bool added = false;
for (int i = 0; i < groups->length(); i++) {
- CacheableStringPtr cs = groups[i];
+ CacheableStringPtr cs = (*groups)[i];
if (cs->length() > 0) {
std::string str = cs->toString();
if ((ACE_OS::strcmp(str.c_str(), serverGroup.c_str()) == 0)) {
@@ -208,7 +208,7 @@ void ClientMetadata::updateBucketServerLocations(
}
}
if (!added) {
- (*iter)->setServername(NULLPTR);
+ (*iter)->setServername(nullptr);
if ((*iter)->isPrimary()) {
primaries.push_back(*iter);
} else {
@@ -370,7 +370,7 @@ BucketServerLocationPtr ClientMetadata::advisePrimaryServerLocation(
return location;
}
}
- return NULLPTR;
+ return nullptr;
}
BucketServerLocationPtr ClientMetadata::adviseRandomServerLocation() {
@@ -380,10 +380,10 @@ BucketServerLocationPtr ClientMetadata::adviseRandomServerLocation() {
checkBucketId(random);
std::vector<BucketServerLocationPtr> locations =
m_bucketServerLocationsList[random];
- if (locations.size() == 0) return NULLPTR;
+ if (locations.size() == 0) return nullptr;
return locations.at(0);
}
- return NULLPTR;
+ return nullptr;
}
} // namespace client
} // namespace geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/ClientMetadataService.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ClientMetadataService.cpp b/src/cppcache/src/ClientMetadataService.cpp
index 310dcc0..eaf93f4 100644
--- a/src/cppcache/src/ClientMetadataService.cpp
+++ b/src/cppcache/src/ClientMetadataService.cpp
@@ -41,7 +41,7 @@ ClientMetadataService::~ClientMetadataService() {
}
}
-ClientMetadataService::ClientMetadataService(PoolPtr pool)
+ClientMetadataService::ClientMetadataService(Pool* pool)
/* adongre
* CID 28928: Uninitialized scalar field (UNINIT_CTOR)
*/
@@ -59,7 +59,7 @@ int ClientMetadataService::svc() {
LOGINFO("ClientMetadataService started for pool %s", m_pool->getName());
while (m_run) {
m_regionQueueSema.acquire();
- ThinClientPoolDM* tcrdm = dynamic_cast<ThinClientPoolDM*>(m_pool.ptr());
+ ThinClientPoolDM* tcrdm = dynamic_cast<ThinClientPoolDM*>(m_pool);
CacheImpl* cache = tcrdm->getConnectionManager().getCacheImpl();
while (true) {
std::string* regionFullPath = m_regionQueue->get();
@@ -102,7 +102,7 @@ int ClientMetadataService::svc() {
void ClientMetadataService::getClientPRMetadata(const char* regionFullPath) {
if (regionFullPath == NULL) return;
- ThinClientPoolDM* tcrdm = dynamic_cast<ThinClientPoolDM*>(m_pool.ptr());
+ ThinClientPoolDM* tcrdm = dynamic_cast<ThinClientPoolDM*>(m_pool);
if (tcrdm == NULL) {
throw IllegalArgumentException(
"ClientMetaData: pool cast to ThinClientPoolDM failed");
@@ -113,7 +113,7 @@ void ClientMetadataService::getClientPRMetadata(const char* regionFullPath) {
// this message to server and get metadata from server.
TcrMessageReply reply(true, NULL);
std::string path(regionFullPath);
- ClientMetadataPtr cptr = NULLPTR;
+ ClientMetadataPtr cptr = nullptr;
{
ReadGuard guard(m_regionMetadataLock);
RegionMetadataMapType::iterator itr = m_regionMetaDataMap.find(path);
@@ -122,43 +122,43 @@ void ClientMetadataService::getClientPRMetadata(const char* regionFullPath) {
}
// cptr = m_regionMetaDataMap[path];
}
- ClientMetadataPtr newCptr = NULLPTR;
+ ClientMetadataPtr newCptr = nullptr;
{
// ACE_Guard< ACE_Recursive_Thread_Mutex > guard( m_regionMetadataLock );
- if (cptr == NULLPTR) {
+ if (cptr == nullptr) {
TcrMessageGetClientPartitionAttributes request(regionFullPath);
GfErrType err = tcrdm->sendSyncRequest(request, reply);
if (err == GF_NOERR &&
reply.getMessageType() ==
TcrMessage::RESPONSE_CLIENT_PARTITION_ATTRIBUTES) {
- cptr =
- new ClientMetadata(reply.getNumBuckets(), reply.getColocatedWith(),
- tcrdm, reply.getFpaSet());
+ cptr = std::make_shared<ClientMetadata>(reply.getNumBuckets(),
+ reply.getColocatedWith(), tcrdm,
+ reply.getFpaSet());
if (m_bucketWaitTimeout > 0 && reply.getNumBuckets() > 0) {
WriteGuard guard(m_PRbucketStatusLock);
m_bucketStatus[regionFullPath] = new PRbuckets(reply.getNumBuckets());
}
LOGDEBUG("ClientMetadata buckets %d ", reply.getNumBuckets());
- if (cptr != NULLPTR) {
+ if (cptr != nullptr) {
// m_regionMetaDataMap[regionFullPath] = cptr;
}
}
}
}
- if (cptr == NULLPTR) {
+ if (cptr == nullptr) {
return;
}
CacheableStringPtr colocatedWith;
- if (cptr != NULLPTR) {
+ if (cptr != nullptr) {
colocatedWith = cptr->getColocatedWith();
}
- if (colocatedWith == NULLPTR) {
+ if (colocatedWith == nullptr) {
newCptr = SendClientPRMetadata(regionFullPath, cptr);
// now we will get new instance so assign it again
- if (newCptr != NULLPTR) {
- cptr->setPreviousone(NULLPTR);
+ if (newCptr != nullptr) {
+ cptr->setPreviousone(nullptr);
newCptr->setPreviousone(cptr);
WriteGuard guard(m_regionMetadataLock);
m_regionMetaDataMap[path] = newCptr;
@@ -171,8 +171,8 @@ void ClientMetadataService::getClientPRMetadata(const char* regionFullPath) {
}
newCptr = SendClientPRMetadata(colocatedWith->asChar(), cptr);
- if (newCptr != NULLPTR) {
- cptr->setPreviousone(NULLPTR);
+ if (newCptr != nullptr) {
+ cptr->setPreviousone(nullptr);
newCptr->setPreviousone(cptr);
// now we will get new instance so assign it again
WriteGuard guard(m_regionMetadataLock);
@@ -185,7 +185,7 @@ void ClientMetadataService::getClientPRMetadata(const char* regionFullPath) {
ClientMetadataPtr ClientMetadataService::SendClientPRMetadata(
const char* regionPath, ClientMetadataPtr cptr) {
- ThinClientPoolDM* tcrdm = dynamic_cast<ThinClientPoolDM*>(m_pool.ptr());
+ ThinClientPoolDM* tcrdm = dynamic_cast<ThinClientPoolDM*>(m_pool);
if (tcrdm == NULL) {
throw IllegalArgumentException(
"ClientMetaData: pool cast to ThinClientPoolDM failed");
@@ -195,22 +195,22 @@ ClientMetadataPtr ClientMetadataService::SendClientPRMetadata(
// send this message to server and get metadata from server.
LOGFINE("Now sending GET_CLIENT_PR_METADATA for getting from server: %s",
regionPath);
- RegionPtr region = NULLPTR;
+ RegionPtr region = nullptr;
GfErrType err = tcrdm->sendSyncRequest(request, reply);
if (err == GF_NOERR &&
reply.getMessageType() == TcrMessage::RESPONSE_CLIENT_PR_METADATA) {
tcrdm->getConnectionManager().getCacheImpl()->getRegion(regionPath, region);
- if (region != NULLPTR) {
- LocalRegion* lregion = dynamic_cast<LocalRegion*>(region.ptr());
+ if (region != nullptr) {
+ LocalRegion* lregion = dynamic_cast<LocalRegion*>(region.get());
lregion->getRegionStats()->incMetaDataRefreshCount();
}
std::vector<BucketServerLocationsType>* metadata = reply.getMetadata();
- if (metadata == NULL) return NULLPTR;
+ if (metadata == NULL) return nullptr;
if (metadata->empty()) {
delete metadata;
- return NULLPTR;
+ return nullptr;
}
- ClientMetadata* newCptr = new ClientMetadata(*(cptr.ptr()));
+ auto newCptr = std::make_shared<ClientMetadata>(*cptr);
for (std::vector<BucketServerLocationsType>::iterator iter =
metadata->begin();
iter != metadata->end(); ++iter) {
@@ -220,10 +220,9 @@ ClientMetadataPtr ClientMetadataService::SendClientPRMetadata(
}
}
delete metadata;
- ClientMetadataPtr newCMDPtr(newCptr);
- return newCMDPtr;
+ return newCptr;
}
- return NULLPTR;
+ return nullptr;
}
void ClientMetadataService::getBucketServerLocation(
@@ -231,20 +230,20 @@ void ClientMetadataService::getBucketServerLocation(
const CacheablePtr& value, const UserDataPtr& aCallbackArgument,
bool isPrimary, BucketServerLocationPtr& serverLocation, int8_t& version) {
// ACE_Guard< ACE_Recursive_Thread_Mutex > guard( m_regionMetadataLock );
- if (region != NULLPTR) {
+ if (region != nullptr) {
ReadGuard guard(m_regionMetadataLock);
LOGDEBUG(
"ClientMetadataService::getBucketServerLocation m_regionMetaDataMap "
"size is %d",
m_regionMetaDataMap.size());
std::string path(region->getFullPath());
- ClientMetadataPtr cptr = NULLPTR;
+ ClientMetadataPtr cptr = nullptr;
RegionMetadataMapType::iterator itr = m_regionMetaDataMap.find(path);
if (itr != m_regionMetaDataMap.end()) {
cptr = itr->second;
}
// ClientMetadataPtr cptr = m_regionMetaDataMap[path];
- if (cptr == NULLPTR) {
+ if (cptr == nullptr) {
// serverLocation = BucketServerLocation();
return;
}
@@ -252,20 +251,20 @@ void ClientMetadataService::getBucketServerLocation(
const PartitionResolverPtr& resolver =
region->getAttributes()->getPartitionResolver();
- EntryEvent event(region, key, value, NULLPTR, aCallbackArgument, false);
+ EntryEvent event(region, key, value, nullptr, aCallbackArgument, false);
int bucketId = 0;
- if (resolver == NULLPTR) {
+ if (resolver == nullptr) {
resolvekey = key;
} else {
resolvekey = resolver->getRoutingObject(event);
- if (resolvekey == NULLPTR) {
+ if (resolvekey == nullptr) {
throw IllegalStateException(
"The RoutingObject returned by PartitionResolver is null.");
}
}
FixedPartitionResolverPtr fpResolver(
- dynamic_cast<FixedPartitionResolver*>(resolver.ptr()));
- if (fpResolver != NULLPTR) {
+ dynamic_cast<FixedPartitionResolver*>(resolver.get()));
+ if (fpResolver != nullptr) {
const char* partition = fpResolver->getPartitionName(event);
if (partition == NULL) {
throw IllegalStateException(
@@ -293,7 +292,7 @@ void ClientMetadataService::removeBucketServerLocation(
m_regionMetaDataMap.begin();
regionMetadataIter != m_regionMetaDataMap.end(); regionMetadataIter++) {
ClientMetadataPtr cptr = (*regionMetadataIter).second;
- if (cptr != NULLPTR) {
+ if (cptr != nullptr) {
// Yogesh has commented out this as it was causing a SIGV
// cptr->removeBucketServerLocation(serverLocation);
}
@@ -308,7 +307,7 @@ ClientMetadataPtr ClientMetadataService::getClientMetadata(
if (regionMetadataIter != m_regionMetaDataMap.end()) {
return (*regionMetadataIter).second;
}
- return NULLPTR;
+ return nullptr;
}
/*const PartitionResolverPtr& ClientMetadataService::getResolver(const
@@ -326,7 +325,7 @@ ClientMetadataService::getServerLocation(ClientMetadataPtr cptr, int bucketId,
bool tryPrimary)
{
LOGFINE("Inside getServerLocation");
-if (cptr == NULLPTR) {
+if (cptr == nullptr) {
LOGDEBUG("MetaData does not exist");
return BucketServerLocation();
}
@@ -342,7 +341,7 @@ void ClientMetadataService::populateDummyServers(const char* regionName,
void ClientMetadataService::enqueueForMetadataRefresh(
const char* regionFullPath, int8_t serverGroupFlag) {
- ThinClientPoolDM* tcrdm = dynamic_cast<ThinClientPoolDM*>(m_pool.ptr());
+ ThinClientPoolDM* tcrdm = dynamic_cast<ThinClientPoolDM*>(m_pool);
if (tcrdm == NULL) {
throw IllegalArgumentException(
"ClientMetaData: pool cast to ThinClientPoolDM failed");
@@ -350,7 +349,7 @@ void ClientMetadataService::enqueueForMetadataRefresh(
RegionPtr region;
tcrdm->getConnectionManager().getCacheImpl()->getRegion(regionFullPath,
region);
- LocalRegion* lregion = dynamic_cast<LocalRegion*>(region.ptr());
+ LocalRegion* lregion = dynamic_cast<LocalRegion*>(region.get());
std::string serverGroup = tcrdm->getServerGroup();
if (serverGroup.length() != 0) {
@@ -363,8 +362,8 @@ void ClientMetadataService::enqueueForMetadataRefresh(
}
}
- if (region != NULLPTR) {
- ThinClientRegion* tcrRegion = dynamic_cast<ThinClientRegion*>(region.ptr());
+ if (region != nullptr) {
+ ThinClientRegion* tcrRegion = dynamic_cast<ThinClientRegion*>(region.get());
{
TryWriteGuard guardRegionMetaDataRefresh(
tcrRegion->getMataDataMutex(), tcrRegion->getMetaDataRefreshed());
@@ -386,7 +385,7 @@ ClientMetadataService::getServerToFilterMap(const VectorOfCacheableKey* keys,
const RegionPtr& region,
bool isPrimary) {
// const char* regionFullPath = region->getFullPath();
- ClientMetadataPtr cptr = NULLPTR;
+ ClientMetadataPtr cptr = nullptr;
{
ReadGuard guard(m_regionMetadataLock);
RegionMetadataMapType::iterator cptrIter =
@@ -396,7 +395,7 @@ ClientMetadataService::getServerToFilterMap(const VectorOfCacheableKey* keys,
cptr = cptrIter->second;
}
- if (cptr == NULLPTR || keys == NULL) {
+ if (cptr == nullptr || keys == NULL) {
// enqueueForMetadataRefresh(region->getFullPath());
return NULL;
// //serverLocation = BucketServerLocation();
@@ -404,9 +403,9 @@ ClientMetadataService::getServerToFilterMap(const VectorOfCacheableKey* keys,
}
}
// int totalNumberOfBuckets = cptr->getTotalNumBuckets();
- HashMapT<BucketServerLocationPtr, VectorOfCacheableKeyPtr>* result =
+ auto* result =
new HashMapT<BucketServerLocationPtr, VectorOfCacheableKeyPtr>();
- VectorOfCacheableKeyPtr keysWhichLeft(new VectorOfCacheableKey());
+ auto keysWhichLeft = std::make_shared<VectorOfCacheableKey>();
std::map<int, BucketServerLocationPtr> buckets;
@@ -418,27 +417,27 @@ ClientMetadataService::getServerToFilterMap(const VectorOfCacheableKey* keys,
region->getAttributes()->getPartitionResolver();
CacheableKeyPtr resolveKey;
- if (resolver == NULLPTR) {
+ if (resolver == nullptr) {
// client has not registered PartitionResolver
// Assuming even PR at server side is not using PartitionResolver
resolveKey = key;
} else {
- EntryEvent event(region, key, NULLPTR, NULLPTR, NULLPTR, false);
+ EntryEvent event(region, key, nullptr, nullptr, nullptr, false);
resolveKey = resolver->getRoutingObject(event);
}
int bucketId = std::abs(resolveKey->hashcode() %
cptr->getTotalNumBuckets());
- VectorOfCacheableKeyPtr keyList = NULLPTR;
+ VectorOfCacheableKeyPtr keyList = nullptr;
std::map<int, BucketServerLocationPtr>::iterator bucketsIter =
buckets.find(bucketId);
if (bucketsIter == buckets.end()) {
int8_t version = -1;
- // BucketServerLocationPtr serverLocation(new BucketServerLocation());
- BucketServerLocationPtr serverLocation = NULLPTR;
+ // auto serverLocation = std::make_shared<BucketServerLocation>();
+ BucketServerLocationPtr serverLocation = nullptr;
cptr->getServerLocation(bucketId, isPrimary, serverLocation, version);
- if (serverLocation == NULLPTR) { //:if server not returns all buckets,
+ if (serverLocation == nullptr) { //:if server not returns all buckets,
// need to confiem with PR team about
// this why??
keysWhichLeft->push_back(key);
@@ -447,7 +446,7 @@ ClientMetadataService::getServerToFilterMap(const VectorOfCacheableKey* keys,
keysWhichLeft->push_back(key);
continue;
}
- // if(serverLocation == NULLPTR)
+ // if(serverLocation == nullptr)
// continue;// need to fix
buckets[bucketId] = serverLocation;
HashMapT<BucketServerLocationPtr, VectorOfCacheableKeyPtr>::Iterator
@@ -455,7 +454,7 @@ ClientMetadataService::getServerToFilterMap(const VectorOfCacheableKey* keys,
// keyList = (*result)[serverLocation];
if (itrRes == result->end()) {
- keyList = new VectorOfCacheableKey();
+ keyList = std::make_shared<VectorOfCacheableKey>();
result->insert(serverLocation, keyList);
} else {
keyList = itrRes.second();
@@ -508,7 +507,7 @@ void ClientMetadataService::markPrimaryBucketForTimeout(
false /*look for secondary host*/, serverLocation,
version);
- if (serverLocation != NULLPTR && serverLocation->isValid()) {
+ if (serverLocation != nullptr && serverLocation->isValid()) {
LOGDEBUG("Server host and port are %s:%d",
serverLocation->getServerName().c_str(),
serverLocation->getPort());
@@ -532,24 +531,24 @@ ClientMetadataService::groupByBucketOnClientSide(const RegionPtr& region,
new HashMapT<CacheableInt32Ptr, CacheableHashSetPtr>();
for (CacheableVector::Iterator itr = (*keySet)->begin();
itr != (*keySet)->end(); ++itr) {
- CacheableKeyPtr key = dynCast<CacheableKeyPtr>(*itr);
+ CacheableKeyPtr key = std::dynamic_pointer_cast<CacheableKey>(*itr);
PartitionResolverPtr resolver =
region->getAttributes()->getPartitionResolver();
CacheableKeyPtr resolvekey;
- EntryEvent event(region, key, NULLPTR, NULLPTR, NULLPTR, false);
+ EntryEvent event(region, key, nullptr, nullptr, nullptr, false);
int bucketId = -1;
- if (resolver == NULLPTR) {
+ if (resolver == nullptr) {
resolvekey = key;
} else {
resolvekey = resolver->getRoutingObject(event);
- if (resolvekey == NULLPTR) {
+ if (resolvekey == nullptr) {
throw IllegalStateException(
"The RoutingObject returned by PartitionResolver is null.");
}
}
FixedPartitionResolverPtr fpResolver(
- dynamic_cast<FixedPartitionResolver*>(resolver.ptr()));
- if (fpResolver != NULLPTR) {
+ dynamic_cast<FixedPartitionResolver*>(resolver.get()));
+ if (fpResolver != nullptr) {
const char* partition = fpResolver->getPartitionName(event);
if (partition == NULL) {
throw IllegalStateException(
@@ -585,7 +584,7 @@ ClientMetadataService::getServerToFilterMapFESHOP(
CacheableVectorPtr* routingKeys, const RegionPtr& region, bool isPrimary) {
ClientMetadataPtr cptr = getClientMetadata(region->getFullPath());
- if (cptr == NULLPTR /*|| cptr->adviseRandomServerLocation() == NULLPTR*/) {
+ if (cptr == nullptr /*|| cptr->adviseRandomServerLocation() == nullptr*/) {
enqueueForMetadataRefresh(region->getFullPath(), 0);
return NULL;
}
@@ -633,7 +632,8 @@ ClientMetadataService::getServerToFilterMapFESHOP(
keys = iter.second();
}
HashMapT<CacheableInt32Ptr, CacheableHashSetPtr>::Iterator
- bucketToKeysiter = bucketToKeysMap->find(*bucket);
+ bucketToKeysiter = bucketToKeysMap->find(
+ std::static_pointer_cast<CacheableInt32>(*bucket));
if (bucketToKeysiter != bucketToKeysMap->end()) {
CacheableHashSetPtr bkeys = bucketToKeysiter.second();
for (CacheableHashSet::Iterator itr = bkeys->begin();
@@ -697,7 +697,7 @@ BucketServerLocationPtr ClientMetadataService::findNextServer(
int random = randgen(nodeSize);
return nodesOfEqualSize.at(random);
}
- return NULLPTR;
+ return nullptr;
}
bool ClientMetadataService::AreBucketSetsEqual(
@@ -744,7 +744,7 @@ ClientMetadataService::pruneNodes(ClientMetadataPtr& metadata,
for (CacheableHashSet::Iterator bucketId = buckets->begin();
bucketId != buckets->end(); ++bucketId) {
- CacheableInt32Ptr bID = *bucketId;
+ CacheableInt32Ptr bID = std::static_pointer_cast<CacheableInt32>(*bucketId);
std::vector<BucketServerLocationPtr> locations =
metadata->adviseServerLocations(bID->value());
if (locations.size() == 0) {
@@ -809,7 +809,7 @@ ClientMetadataService::pruneNodes(ClientMetadataPtr& metadata,
while (!AreBucketSetsEqual(currentBucketSet, buckets)) {
BucketServerLocationPtr server =
findNextServer(serverToBucketsMap, currentBucketSet);
- if (server == NULLPTR) {
+ if (server == nullptr) {
LOGDEBUG(
"ClientMetadataService::pruneNodes findNextServer returned no "
"server");
@@ -855,7 +855,7 @@ ClientMetadataService::pruneNodes(ClientMetadataPtr& metadata,
prunedServerToBucketsMap->begin();
for (CacheableHashSet::Iterator itr = bucketSetWithoutServer->begin();
itr != bucketSetWithoutServer->end(); ++itr) {
- CacheableInt32Ptr buckstId = *itr;
+ CacheableInt32Ptr buckstId = std::static_pointer_cast<CacheableInt32>(*itr);
itrRes2.second()->insert(buckstId);
}
@@ -867,7 +867,7 @@ HashMapT<BucketServerLocationPtr, CacheableHashSetPtr>*
ClientMetadataService::groupByServerToAllBuckets(const RegionPtr& region,
bool optimizeForWrite) {
ClientMetadataPtr cptr = getClientMetadata(region->getFullPath());
- if (cptr == NULLPTR) {
+ if (cptr == nullptr) {
enqueueForMetadataRefresh(region->getFullPath(), false);
return NULL;
}
@@ -889,10 +889,11 @@ ClientMetadataService::groupByServerToBuckets(ClientMetadataPtr& metadata,
CacheableHashSetPtr bucketsWithoutServer = CacheableHashSet::create();
for (CacheableHashSet::Iterator itr = bucketSet->begin();
itr != bucketSet->end(); ++itr) {
- CacheableInt32Ptr bucketId = *itr;
+ CacheableInt32Ptr bucketId =
+ std::static_pointer_cast<CacheableInt32>(*itr);
BucketServerLocationPtr serverLocation =
metadata->advisePrimaryServerLocation(bucketId->value());
- if (serverLocation == NULLPTR) {
+ if (serverLocation == nullptr) {
bucketsWithoutServer->insert(bucketId);
continue;
} else if (!serverLocation->isValid()) {
@@ -949,7 +950,7 @@ void ClientMetadataService::markPrimaryBucketForTimeoutButLookSecondaryBucket(
getBucketServerLocation(region, key, value, aCallbackArgument, true,
serverLocation, version);
- ClientMetadataPtr cptr = NULLPTR;
+ ClientMetadataPtr cptr = nullptr;
{
ReadGuard guard(m_regionMetadataLock);
RegionMetadataMapType::iterator cptrIter =
@@ -959,7 +960,7 @@ void ClientMetadataService::markPrimaryBucketForTimeoutButLookSecondaryBucket(
cptr = cptrIter->second;
}
- if (cptr == NULLPTR) {
+ if (cptr == nullptr) {
return;
}
}
@@ -994,7 +995,7 @@ bool ClientMetadataService::isBucketMarkedForTimeout(const char* regionFullPath,
if (bs != m_bucketStatus.end()) {
bool m = bs->second->isBucketTimedOut(bucketid, m_bucketWaitTimeout);
if (m == true) {
- ThinClientPoolDM* tcrdm = dynamic_cast<ThinClientPoolDM*>(m_pool.ptr());
+ ThinClientPoolDM* tcrdm = dynamic_cast<ThinClientPoolDM*>(m_pool);
CacheImpl* cache = tcrdm->getConnectionManager().getCacheImpl();
cache->setBlackListBucketTimeouts();
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/ClientMetadataService.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ClientMetadataService.hpp b/src/cppcache/src/ClientMetadataService.hpp
index 99ddd23..c39a69a 100644
--- a/src/cppcache/src/ClientMetadataService.hpp
+++ b/src/cppcache/src/ClientMetadataService.hpp
@@ -106,7 +106,7 @@ class ClientMetadataService : public ACE_Task_Base,
private NonAssignable {
public:
~ClientMetadataService();
- ClientMetadataService(PoolPtr pool);
+ ClientMetadataService(Pool* pool);
inline void start() {
m_run = true;
@@ -198,7 +198,7 @@ class ClientMetadataService : public ACE_Task_Base,
ACE_Semaphore m_regionQueueSema;
RegionMetadataMapType m_regionMetaDataMap;
volatile bool m_run;
- PoolPtr m_pool;
+ Pool* m_pool;
Queue<std::string>* m_regionQueue;
ACE_RW_Thread_Mutex m_PRbucketStatusLock;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/ClientProxyMembershipID.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ClientProxyMembershipID.cpp b/src/cppcache/src/ClientProxyMembershipID.cpp
index 4e05265..07e6a9b 100644
--- a/src/cppcache/src/ClientProxyMembershipID.cpp
+++ b/src/cppcache/src/ClientProxyMembershipID.cpp
@@ -376,7 +376,7 @@ Serializable* ClientProxyMembershipID::fromData(DataInput& input) {
input.readInt(&dcport); // port
input.readInt(&vPID); // pid
input.read(&vmKind); // vmkind
- CacheableStringArrayPtr aStringArray(CacheableStringArray::create());
+ auto aStringArray = CacheableStringArray::create();
aStringArray->fromData(input);
input.readObject(dsName); // name
input.readObject(uniqueTag); // unique tag
@@ -386,7 +386,7 @@ Serializable* ClientProxyMembershipID::fromData(DataInput& input) {
readVersion(splitbrain, input);
if (vmKind != ClientProxyMembershipID::LONER_DM_TYPE) {
- vmViewId = atoi(uniqueTag.ptr()->asChar());
+ vmViewId = atoi(uniqueTag.get()->asChar());
initObjectVars(hostname->asChar(), hostAddr, len, true, hostPort,
durableClientId->asChar(), durableClntTimeOut, dcport, vPID,
vmKind, splitbrain, dsName->asChar(), NULL, vmViewId);
@@ -431,7 +431,7 @@ Serializable* ClientProxyMembershipID::readEssentialData(DataInput& input) {
input.readObject(uniqueTag); // unique tag
} else {
input.readObject(vmViewIdstr);
- vmViewId = atoi(vmViewIdstr.ptr()->asChar());
+ vmViewId = atoi(vmViewIdstr.get()->asChar());
}
input.readObject(dsName); // name
@@ -461,25 +461,22 @@ void ClientProxyMembershipID::increaseSynchCounter() { ++synch_counter; }
// Compares two membershipIds. This is based on the compareTo function
// of InternalDistributedMember class of Java.
// Any change to the java function should be reflected here as well.
-int16_t ClientProxyMembershipID::compareTo(DSMemberForVersionStampPtr other) {
- if (other.operator==(this)) {
+int16_t ClientProxyMembershipID::compareTo(
+ const DSMemberForVersionStamp& other) const {
+ if (this == &other) {
return 0;
}
- if (other.ptr() == NULL) {
- throw ClassCastException(
- "ClientProxyMembershipID.compare(): comparing with a null value");
- }
- ClientProxyMembershipIDPtr otherMember =
- dynCast<ClientProxyMembershipIDPtr>(other);
+ const ClientProxyMembershipID& otherMember =
+ static_cast<const ClientProxyMembershipID&>(other);
uint32_t myPort = getHostPort();
- uint32_t otherPort = otherMember->getHostPort();
+ uint32_t otherPort = otherMember.getHostPort();
if (myPort < otherPort) return -1;
if (myPort > otherPort) return 1;
uint8_t* myAddr = getHostAddr();
- uint8_t* otherAddr = otherMember->getHostAddr();
+ uint8_t* otherAddr = otherMember.getHostAddr();
// Discard null cases
if (myAddr == NULL && otherAddr == NULL) {
if (myPort < otherPort) {
@@ -500,11 +497,11 @@ int16_t ClientProxyMembershipID::compareTo(DSMemberForVersionStampPtr other) {
}
std::string myUniqueTag = getUniqueTag();
- std::string otherUniqueTag = otherMember->getUniqueTag();
+ std::string otherUniqueTag = otherMember.getUniqueTag();
if (myUniqueTag.empty() && otherUniqueTag.empty()) {
- if (m_vmViewId < otherMember->m_vmViewId) {
+ if (m_vmViewId < otherMember.m_vmViewId) {
return -1;
- } else if (m_vmViewId > otherMember->m_vmViewId) {
+ } else if (m_vmViewId > otherMember.m_vmViewId) {
return 1;
} // else they're the same, so continue
} else if (myUniqueTag.empty()) {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/ClientProxyMembershipID.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ClientProxyMembershipID.hpp b/src/cppcache/src/ClientProxyMembershipID.hpp
index 86b7150..347cc52 100644
--- a/src/cppcache/src/ClientProxyMembershipID.hpp
+++ b/src/cppcache/src/ClientProxyMembershipID.hpp
@@ -85,7 +85,7 @@ class ClientProxyMembershipID : public DSMemberForVersionStamp {
uint32_t getHostAddrLen() const { return m_hostAddrLen; }
uint32_t getHostPort() const { return m_hostPort; }
virtual std::string getHashKey();
- virtual int16_t compareTo(DSMemberForVersionStampPtr);
+ virtual int16_t compareTo(const DSMemberForVersionStamp&) const;
virtual int32_t hashcode() const {
uint32_t result = 0;
char hostInfo[255] = {0};
@@ -101,19 +101,8 @@ class ClientProxyMembershipID : public DSMemberForVersionStamp {
}
virtual bool operator==(const CacheableKey& other) const {
- CacheableKey& otherCopy = const_cast<CacheableKey&>(other);
- DSMemberForVersionStamp& temp =
- dynamic_cast<DSMemberForVersionStamp&>(otherCopy);
- DSMemberForVersionStampPtr obj = NULLPTR;
- obj = DSMemberForVersionStampPtr(&temp);
-
- DSMemberForVersionStampPtr callerPtr = NULLPTR;
- callerPtr = DSMemberForVersionStampPtr(this);
- if (callerPtr->compareTo(obj) == 0) {
- return true;
- } else {
- return false;
- }
+ return (this->compareTo(
+ dynamic_cast<const DSMemberForVersionStamp&>(other)) == 0);
}
Serializable* readEssentialData(DataInput& input);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/ConcurrentEntriesMap.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ConcurrentEntriesMap.cpp b/src/cppcache/src/ConcurrentEntriesMap.cpp
index d988026..b2fd1fc 100644
--- a/src/cppcache/src/ConcurrentEntriesMap.cpp
+++ b/src/cppcache/src/ConcurrentEntriesMap.cpp
@@ -81,7 +81,7 @@ GfErrType ConcurrentEntriesMap::create(const CacheableKeyPtr& key,
GfErrType err = GF_NOERR;
if ((err = segmentFor(key)->create(key, newValue, me, oldValue, updateCount,
destroyTracker, versionTag)) == GF_NOERR &&
- oldValue == NULLPTR) {
+ oldValue == nullptr) {
++m_size;
}
return err;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/ConcurrentEntriesMap.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/ConcurrentEntriesMap.hpp b/src/cppcache/src/ConcurrentEntriesMap.hpp
index 7bceedd..37691ee 100644
--- a/src/cppcache/src/ConcurrentEntriesMap.hpp
+++ b/src/cppcache/src/ConcurrentEntriesMap.hpp
@@ -71,7 +71,8 @@ class CPPCACHE_EXPORT ConcurrentEntriesMap : public EntriesMap {
*/
ConcurrentEntriesMap(EntryFactory* entryFactory,
bool concurrencyChecksEnabled,
- RegionInternal* region = NULL, uint8_t concurrency = 16);
+ RegionInternal* region = nullptr,
+ uint8_t concurrency = 16);
/**
* Initialize segments with proper EntryFactory.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/CppCacheLibrary.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CppCacheLibrary.cpp b/src/cppcache/src/CppCacheLibrary.cpp
index 93c0fec..50cd260 100644
--- a/src/cppcache/src/CppCacheLibrary.cpp
+++ b/src/cppcache/src/CppCacheLibrary.cpp
@@ -30,7 +30,6 @@
#include "LRUExpMapEntry.hpp"
#include <geode/CacheFactory.hpp>
#include "SerializationRegistry.hpp"
-#include "CacheableToken.hpp"
#include <geode/DataOutput.hpp>
#include "TcrMessage.hpp"
#include "Utils.hpp"
@@ -38,15 +37,18 @@
#include <string>
-using namespace apache::geode::client;
+// called during DLL initialization
+void initLibDllEntry(void) { apache::geode::client::CppCacheLibrary::initLib(); }
+
+extern "C" {
+void DllMainGetPath(char* result, int maxLen);
+}
namespace apache {
namespace geode {
namespace client {
-void gf_log_libinit();
-} // namespace client
-} // namespace geode
-} // namespace apache
+
+ void gf_log_libinit();
CppCacheLibrary::CppCacheLibrary() {
// TODO: This should catch any exceptions, log it, and bail out..
@@ -58,7 +60,6 @@ CppCacheLibrary::CppCacheLibrary() {
ExpEntryFactory::init();
LRUExpEntryFactory::init();
CacheFactory::init();
- CacheableToken::init();
SerializationRegistry::init();
// PdxTypeRegistry::init();
// log( "Finished initializing CppCacheLibrary." );
@@ -96,13 +97,6 @@ void CppCacheLibrary::closeLib(void) {
// using geode.
}
-// called during DLL initialization
-void initLibDllEntry(void) { CppCacheLibrary::initLib(); }
-
-extern "C" {
-void DllMainGetPath(char* result, int maxLen);
-}
-
// Returns pathname of product's lib directory, adds 'addon' to it if 'addon' is
// not null.
std::string CppCacheLibrary::getProductLibDir(const char* addon) {
@@ -200,3 +194,7 @@ std::string CppCacheLibrary::getProductDir() {
}
}
+
+} // namespace client
+} // namespace geode
+} // namespace apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/CqAttributesFactory.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CqAttributesFactory.cpp b/src/cppcache/src/CqAttributesFactory.cpp
index f2cdbe0..2c75ca1 100644
--- a/src/cppcache/src/CqAttributesFactory.cpp
+++ b/src/cppcache/src/CqAttributesFactory.cpp
@@ -21,37 +21,31 @@
using namespace apache::geode::client;
CqAttributesFactory::CqAttributesFactory() {
- m_cqAttributes = new CqAttributesImpl();
+ m_cqAttributes = std::make_shared<CqAttributesImpl>();
}
-CqAttributesFactory::CqAttributesFactory(CqAttributesPtr &cqAttributes) {
- CqAttributesImpl *cqImpl = new CqAttributesImpl();
- m_cqAttributes = cqImpl;
- VectorOfCqListener vl;
- CqAttributesImpl *cqAttr =
- dynamic_cast<CqAttributesImpl *>(cqAttributes.ptr());
- cqAttr->getCqListeners(vl);
- cqImpl->setCqListeners(vl);
+CqAttributesFactory::CqAttributesFactory(const CqAttributesPtr &cqAttributes) {
+ m_cqAttributes = std::make_shared<CqAttributesImpl>();
+ CqAttributesImpl::listener_container_type vl;
+ std::static_pointer_cast<CqAttributesImpl>(cqAttributes)->getCqListeners(vl);
+ std::static_pointer_cast<CqAttributesImpl>(m_cqAttributes)
+ ->setCqListeners(vl);
}
void CqAttributesFactory::addCqListener(const CqListenerPtr &cqListener) {
- if (cqListener == NULLPTR) {
+ if (cqListener == nullptr) {
throw IllegalArgumentException("addCqListener parameter was null");
}
- CqAttributesImpl *cqImpl =
- dynamic_cast<CqAttributesImpl *>(m_cqAttributes.ptr());
- CqListenerPtr listener = dynCast<CqListenerPtr>(cqListener);
- cqImpl->addCqListener(listener);
+ std::static_pointer_cast<CqAttributesImpl>(m_cqAttributes)
+ ->addCqListener(cqListener);
}
-void CqAttributesFactory::initCqListeners(VectorOfCqListener &cqListeners) {
- CqAttributesImpl *cqImpl =
- dynamic_cast<CqAttributesImpl *>(m_cqAttributes.ptr());
- cqImpl->setCqListeners(cqListeners);
+void CqAttributesFactory::initCqListeners(
+ const CqAttributesImpl::listener_container_type &cqListeners) {
+ std::static_pointer_cast<CqAttributesImpl>(m_cqAttributes)
+ ->setCqListeners(cqListeners);
}
CqAttributesPtr CqAttributesFactory::create() {
- CqAttributesImpl *cqImpl =
- dynamic_cast<CqAttributesImpl *>(m_cqAttributes.ptr());
- CqAttributesPtr ptr(cqImpl->clone());
- return ptr;
+ return CqAttributesPtr(
+ std::static_pointer_cast<CqAttributesImpl>(m_cqAttributes)->clone());
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/CqAttributesImpl.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CqAttributesImpl.cpp b/src/cppcache/src/CqAttributesImpl.cpp
index c10bb13..53494d4 100644
--- a/src/cppcache/src/CqAttributesImpl.cpp
+++ b/src/cppcache/src/CqAttributesImpl.cpp
@@ -17,17 +17,13 @@
#include "CqAttributesImpl.hpp"
#include <geode/ExceptionTypes.hpp>
using namespace apache::geode::client;
-void CqAttributesImpl::getCqListeners(VectorOfCqListener& vl) {
+void CqAttributesImpl::getCqListeners(listener_container_type& vl) {
ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
- vl.clear();
- // vl.reserve(m_cqListeners.size());
vl = m_cqListeners;
- // for(size_t i=0; i < m_cqListeners.size(); i++)
- // vl[i] = m_cqListeners[i];
}
-void CqAttributesImpl::addCqListener(CqListenerPtr& cql) {
- if (cql == NULLPTR) {
+void CqAttributesImpl::addCqListener(const CqListenerPtr& cql) {
+ if (cql == nullptr) {
throw IllegalArgumentException("addCqListener parameter was null");
}
ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
@@ -35,25 +31,27 @@ void CqAttributesImpl::addCqListener(CqListenerPtr& cql) {
}
CqAttributesImpl* CqAttributesImpl::clone() {
- CqAttributesImpl* ptr = new CqAttributesImpl();
- ptr->setCqListeners(m_cqListeners);
- return ptr;
+ auto clone = new CqAttributesImpl();
+ clone->setCqListeners(m_cqListeners);
+ return clone;
}
-void CqAttributesImpl::setCqListeners(VectorOfCqListener& addedListeners) {
+void CqAttributesImpl::setCqListeners(
+ const listener_container_type& addedListeners) {
if (addedListeners.empty() == true) {
LOGWARN("setCqListeners parameter had a null element, nothing to be set");
return;
}
- VectorOfCqListener oldListeners(m_cqListeners);
+
+ decltype(m_cqListeners) oldListeners(m_cqListeners);
{
ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
m_cqListeners = addedListeners;
}
if (!oldListeners.empty()) {
- for (int32_t i = 0; i < oldListeners.length(); i++) {
+ for (auto l : oldListeners) {
try {
- oldListeners[i]->close();
+ l->close();
// Handle client side exceptions.
} catch (Exception& ex) {
LOGWARN("Exception occured while closing CQ Listener %s Error",
@@ -64,17 +62,16 @@ void CqAttributesImpl::setCqListeners(VectorOfCqListener& addedListeners) {
}
}
-void CqAttributesImpl::removeCqListener(CqListenerPtr& cql) {
- if (cql == NULLPTR) {
+void CqAttributesImpl::removeCqListener(const CqListenerPtr& cql) {
+ if (cql == nullptr) {
throw IllegalArgumentException("removeCqListener parameter was null");
}
ACE_Guard<ACE_Recursive_Thread_Mutex> _guard(m_mutex);
if (!m_cqListeners.empty()) {
- for (int32_t i = 0; i < m_cqListeners.size(); i++) {
- if (m_cqListeners.at(i) == cql) {
- m_cqListeners.erase(i);
- }
- }
+ m_cqListeners.erase(
+ std::remove_if(m_cqListeners.begin(), m_cqListeners.end(),
+ [cql](CqListenerPtr l) -> bool { return cql == l; }),
+ m_cqListeners.end());
try {
cql->close();
// Handle client side exceptions.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/src/CqAttributesImpl.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CqAttributesImpl.hpp b/src/cppcache/src/CqAttributesImpl.hpp
index 0a09258..c32d8fa 100644
--- a/src/cppcache/src/CqAttributesImpl.hpp
+++ b/src/cppcache/src/CqAttributesImpl.hpp
@@ -49,13 +49,7 @@ namespace client {
*/
class CPPCACHE_EXPORT CqAttributesImpl : public CqAttributes {
public:
- /**
- * Get the CqListeners set with the CQ.
- * Returns all the Listener associated with this CQ.
- * @see CqListener
- * @return VectorOfCqListener of CqListnerPtr
- */
- void getCqListeners(VectorOfCqListener& vl);
+ void getCqListeners(listener_container_type& vl);
/**
* Get the CqListener set with the CQ.
@@ -65,13 +59,13 @@ class CPPCACHE_EXPORT CqAttributesImpl : public CqAttributes {
* @return CqListener Object, returns null if there is no CqListener.
*/
CqListenerPtr getCqListener();
- void addCqListener(CqListenerPtr& cql);
- void setCqListeners(VectorOfCqListener& addedListeners);
- void removeCqListener(CqListenerPtr& cql);
+ void addCqListener(const CqListenerPtr& cql);
+ void setCqListeners(const listener_container_type& addedListeners);
+ void removeCqListener(const CqListenerPtr& cql);
CqAttributesImpl* clone();
private:
- VectorOfCqListener m_cqListeners;
+ listener_container_type m_cqListeners;
bool m_dataPolicyHasBeenSet;
ACE_Recursive_Thread_Mutex m_mutex;
};
[32/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from clicache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/StatisticDescriptor.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/StatisticDescriptor.cpp b/src/clicache/src/StatisticDescriptor.cpp
index 0731102..6e0075c 100644
--- a/src/clicache/src/StatisticDescriptor.cpp
+++ b/src/clicache/src/StatisticDescriptor.cpp
@@ -16,8 +16,6 @@
*/
-
-//#include "geode_includes.hpp"
#include "StatisticDescriptor.hpp"
#include "impl/ManagedString.hpp"
@@ -31,34 +29,34 @@ namespace Apache
System::Int32 StatisticDescriptor::ID::get( )
{
- return NativePtr->getId();
+ return m_nativeptr->getId();
}
String^ StatisticDescriptor::Name::get( )
{
- return ManagedString::Get( NativePtr->getName() );
+ return ManagedString::Get( m_nativeptr->getName() );
}
String^ StatisticDescriptor::Description::get( )
{
- return ManagedString::Get( NativePtr->getDescription() );
+ return ManagedString::Get( m_nativeptr->getDescription() );
}
int8_t StatisticDescriptor::IsCounter::get( )
{
- return NativePtr->isCounter();
+ return m_nativeptr->isCounter();
}
int8_t StatisticDescriptor::IsLargerBetter::get( )
{
- return NativePtr->isLargerBetter();
+ return m_nativeptr->isLargerBetter();
}
- String^ StatisticDescriptor::Unit::get( )
+ String^ StatisticDescriptor::Unit::get()
{
- return ManagedString::Get( NativePtr->getUnit() );
+ return ManagedString::Get(m_nativeptr->getUnit());
+ }
} // namespace Client
} // namespace Geode
} // namespace Apache
- } //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/StatisticDescriptor.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/StatisticDescriptor.hpp b/src/clicache/src/StatisticDescriptor.hpp
index fdd06cf..6715045 100644
--- a/src/clicache/src/StatisticDescriptor.hpp
+++ b/src/clicache/src/StatisticDescriptor.hpp
@@ -20,8 +20,11 @@
#pragma once
#include "geode_defs.hpp"
-#include "impl/NativeWrapper.hpp"
+#include "begin_native.hpp"
#include <geode/statistics/StatisticDescriptor.hpp>
+#include "end_native.hpp"
+
+using namespace System;
namespace Apache
{
@@ -43,7 +46,6 @@ namespace Apache
/// StatisticDescriptors are naturally ordered by their name.
/// </para>
public ref class StatisticDescriptor sealed
- : public Internal::UMWrap<apache::geode::statistics::StatisticDescriptor>
{
public:
/// <summary>
@@ -110,8 +112,13 @@ namespace Apache
inline static StatisticDescriptor^ Create(
apache::geode::statistics::StatisticDescriptor* nativeptr)
{
- return (nativeptr != nullptr ?
- gcnew StatisticDescriptor(nativeptr) : nullptr);
+ return __nullptr == nativeptr ? nullptr :
+ gcnew StatisticDescriptor( nativeptr );
+ }
+
+ apache::geode::statistics::StatisticDescriptor* GetNative()
+ {
+ return m_nativeptr;
}
private:
@@ -120,7 +127,11 @@ namespace Apache
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
inline StatisticDescriptor(apache::geode::statistics::StatisticDescriptor* nativeptr)
- : UMWrap(nativeptr, false) { }
+ : m_nativeptr( nativeptr )
+ {
+ }
+
+ apache::geode::statistics::StatisticDescriptor* m_nativeptr;
};
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/Statistics.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/Statistics.cpp b/src/clicache/src/Statistics.cpp
index ce00f17..e042873 100644
--- a/src/clicache/src/Statistics.cpp
+++ b/src/clicache/src/Statistics.cpp
@@ -37,7 +37,7 @@ namespace Apache
void Statistics::Close()
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->close();
+ m_nativeptr->close();
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -45,7 +45,7 @@ namespace Apache
{
ManagedString mg_name( name );
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return NativePtr->nameToId(mg_name.CharPtr);
+ return m_nativeptr->nameToId(mg_name.CharPtr);
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -53,46 +53,46 @@ namespace Apache
{
ManagedString mg_name( name );
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return StatisticDescriptor::Create(NativePtr->nameToDescriptor(mg_name.CharPtr));
+ return StatisticDescriptor::Create(m_nativeptr->nameToDescriptor(mg_name.CharPtr));
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
System::Int64 Statistics::UniqueId::get( )
{
- return NativePtr->getUniqueId();
+ return m_nativeptr->getUniqueId();
}
StatisticsType^ Statistics::Type::get( )
{
- return StatisticsType::Create(NativePtr->getType());
+ return StatisticsType::Create(m_nativeptr->getType());
}
String^ Statistics::TextId::get()
{
- return ManagedString::Get(NativePtr->getTextId());
+ return ManagedString::Get(m_nativeptr->getTextId());
}
System::Int64 Statistics::NumericId::get()
{
- return NativePtr->getNumericId();
+ return m_nativeptr->getNumericId();
}
bool Statistics::IsAtomic::get()
{
- return NativePtr->isAtomic();
+ return m_nativeptr->isAtomic();
}
bool Statistics::IsShared::get()
{
- return NativePtr->isShared();
+ return m_nativeptr->isShared();
}
bool Statistics::IsClosed::get()
{
- return NativePtr->isClosed();
+ return m_nativeptr->isClosed();
}
void Statistics::SetInt(System::Int32 id, System::Int32 value)
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->setInt(id, value);
+ m_nativeptr->setInt(id, value);
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -100,28 +100,28 @@ namespace Apache
{
ManagedString mg_name( name );
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->setInt((char*)mg_name.CharPtr, value);
+ m_nativeptr->setInt((char*)mg_name.CharPtr, value);
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
void Statistics::SetInt(StatisticDescriptor^ descriptor, System::Int32 value)
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->setInt(GetNativePtr<apache::geode::statistics::StatisticDescriptor>(descriptor),value);
+ m_nativeptr->setInt(descriptor->GetNative(), value);
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
void Statistics::SetLong(System::Int32 id, System::Int64 value)
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->setLong(id, value);
+ m_nativeptr->setLong(id, value);
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
void Statistics::SetLong(StatisticDescriptor^ descriptor, System::Int64 value)
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->setLong(GetNativePtr<apache::geode::statistics::StatisticDescriptor>(descriptor),value);
+ m_nativeptr->setLong(descriptor->GetNative(), value);
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -129,14 +129,14 @@ namespace Apache
{
ManagedString mg_name( name );
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->setLong((char*)mg_name.CharPtr, value);
+ m_nativeptr->setLong((char*)mg_name.CharPtr, value);
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
void Statistics::SetDouble(System::Int32 id, double value)
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->setDouble(id, value);
+ m_nativeptr->setDouble(id, value);
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -144,28 +144,28 @@ namespace Apache
{
ManagedString mg_name( name );
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->setDouble((char*)mg_name.CharPtr, value);
+ m_nativeptr->setDouble((char*)mg_name.CharPtr, value);
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
void Statistics::SetDouble(StatisticDescriptor^ descriptor, double value)
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- NativePtr->setDouble(GetNativePtr<apache::geode::statistics::StatisticDescriptor>(descriptor), value);
+ m_nativeptr->setDouble(descriptor->GetNative(), value);
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
System::Int32 Statistics::GetInt(System::Int32 id)
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return NativePtr->getInt(id);
+ return m_nativeptr->getInt(id);
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
System::Int32 Statistics::GetInt(StatisticDescriptor^ descriptor)
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return NativePtr->getInt(GetNativePtr<apache::geode::statistics::StatisticDescriptor>(descriptor));
+ return m_nativeptr->getInt(descriptor->GetNative());
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -173,20 +173,20 @@ namespace Apache
{
ManagedString mg_name( name );
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return NativePtr->getInt((char*)mg_name.CharPtr);
+ return m_nativeptr->getInt((char*)mg_name.CharPtr);
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
System::Int64 Statistics::GetLong(System::Int32 id)
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return NativePtr->getLong(id);
+ return m_nativeptr->getLong(id);
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
System::Int64 Statistics::GetLong(StatisticDescriptor^ descriptor)
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return NativePtr->getLong(GetNativePtr<apache::geode::statistics::StatisticDescriptor>(descriptor));
+ return m_nativeptr->getLong(descriptor->GetNative());
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -194,21 +194,21 @@ namespace Apache
{
ManagedString mg_name( name );
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return NativePtr->getLong((char*)mg_name.CharPtr);
+ return m_nativeptr->getLong((char*)mg_name.CharPtr);
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
double Statistics::GetDouble(System::Int32 id)
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return NativePtr->getDouble(id);
+ return m_nativeptr->getDouble(id);
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
double Statistics::GetDouble(StatisticDescriptor^ descriptor)
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return NativePtr->getDouble(GetNativePtr<apache::geode::statistics::StatisticDescriptor>(descriptor));
+ return m_nativeptr->getDouble(descriptor->GetNative());
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -216,28 +216,28 @@ namespace Apache
{
ManagedString mg_name( name );
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return NativePtr->getDouble((char*)mg_name.CharPtr);
+ return m_nativeptr->getDouble((char*)mg_name.CharPtr);
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
System::Int64 Statistics::GetRawBits(StatisticDescriptor^ descriptor)
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return NativePtr->getRawBits(GetNativePtr<apache::geode::statistics::StatisticDescriptor>(descriptor));
+ return m_nativeptr->getRawBits(descriptor->GetNative());
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
System::Int32 Statistics::IncInt(System::Int32 id, System::Int32 delta)
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return NativePtr->incInt(id,delta);
+ return m_nativeptr->incInt(id,delta);
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
System::Int32 Statistics::IncInt(StatisticDescriptor^ descriptor, System::Int32 delta)
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return NativePtr->incInt(GetNativePtr<apache::geode::statistics::StatisticDescriptor>(descriptor),delta);
+ return m_nativeptr->incInt(descriptor->GetNative(),delta);
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -245,21 +245,21 @@ namespace Apache
{
ManagedString mg_name( name );
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return NativePtr->incInt((char*)mg_name.CharPtr,delta);
+ return m_nativeptr->incInt((char*)mg_name.CharPtr,delta);
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
System::Int64 Statistics::IncLong(System::Int32 id, System::Int64 delta)
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return NativePtr->incLong(id,delta);
+ return m_nativeptr->incLong(id,delta);
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
System::Int64 Statistics::IncLong(StatisticDescriptor^ descriptor, System::Int64 delta)
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return NativePtr->incLong(GetNativePtr<apache::geode::statistics::StatisticDescriptor>(descriptor),delta);
+ return m_nativeptr->incLong(descriptor->GetNative(),delta);
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -267,21 +267,21 @@ namespace Apache
{
ManagedString mg_name( name );
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return NativePtr->incLong((char*)mg_name.CharPtr,delta);
+ return m_nativeptr->incLong((char*)mg_name.CharPtr,delta);
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
double Statistics::IncDouble(System::Int32 id, double delta)
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return NativePtr->incDouble(id,delta);
+ return m_nativeptr->incDouble(id,delta);
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
double Statistics::IncDouble(StatisticDescriptor^ descriptor, double delta)
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return NativePtr->incDouble(GetNativePtr<apache::geode::statistics::StatisticDescriptor>(descriptor),delta);
+ return m_nativeptr->incDouble(descriptor->GetNative(),delta);
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -289,7 +289,7 @@ namespace Apache
{
ManagedString mg_name( name );
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return NativePtr->incDouble((char*)mg_name.CharPtr,delta);
+ return m_nativeptr->incDouble((char*)mg_name.CharPtr,delta);
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/Statistics.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/Statistics.hpp b/src/clicache/src/Statistics.hpp
index 74d44b3..0a39bac 100644
--- a/src/clicache/src/Statistics.hpp
+++ b/src/clicache/src/Statistics.hpp
@@ -20,10 +20,13 @@
#pragma once
#include "geode_defs.hpp"
-#include "impl/NativeWrapper.hpp"
+#include "begin_native.hpp"
#include <geode/statistics/Statistics.hpp>
#include <geode/statistics/StatisticDescriptor.hpp>
#include <geode/statistics/StatisticsType.hpp>
+#include "end_native.hpp"
+
+using namespace System;
namespace Apache
{
@@ -39,13 +42,7 @@ namespace Apache
/// An instantiation of an existing <c>StatisticsType</c> object with methods for
/// setting, incrementing and getting individual <c>StatisticDescriptor</c> values.
/// </summary>
- /// <para>
- /// The class is purposefully inherited from UMWrapN and not UMWrap as the destructor
- /// of the class is protected, and so it is now not called from inside the InternalCleanup
- /// method.
- /// </para>
public ref class Statistics sealed
- : public Internal::UMWrapN<apache::geode::statistics::Statistics>
{
public:
@@ -520,8 +517,8 @@ namespace Apache
inline static Statistics^ Create(
apache::geode::statistics::Statistics* nativeptr )
{
- return ( nativeptr != nullptr ?
- gcnew Statistics( nativeptr ) : nullptr );
+ return __nullptr == nativeptr ? nullptr :
+ gcnew Statistics( nativeptr );
}
private:
@@ -530,7 +527,11 @@ namespace Apache
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
inline Statistics( apache::geode::statistics::Statistics* nativeptr )
- : UMWrapN( nativeptr, false ) { }
+ : m_nativeptr( nativeptr )
+ {
+ }
+ private:
+ apache::geode::statistics::Statistics* m_nativeptr;
};
} // namespace Client
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/StatisticsFactory.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/StatisticsFactory.cpp b/src/clicache/src/StatisticsFactory.cpp
index d07e943..dd100e1 100644
--- a/src/clicache/src/StatisticsFactory.cpp
+++ b/src/clicache/src/StatisticsFactory.cpp
@@ -56,7 +56,7 @@ namespace Apache
ManagedString mg_units( units );
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return StatisticDescriptor::Create(NativePtr->createIntCounter(mg_name.CharPtr, mg_description.CharPtr, mg_units.CharPtr, largerBetter));
+ return StatisticDescriptor::Create(m_nativeptr->createIntCounter(mg_name.CharPtr, mg_description.CharPtr, mg_units.CharPtr, largerBetter));
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -73,7 +73,7 @@ namespace Apache
ManagedString mg_units( units );
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return StatisticDescriptor::Create(NativePtr->createLongCounter(mg_name.CharPtr, mg_description.CharPtr, mg_units.CharPtr, largerBetter));
+ return StatisticDescriptor::Create(m_nativeptr->createLongCounter(mg_name.CharPtr, mg_description.CharPtr, mg_units.CharPtr, largerBetter));
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -90,7 +90,7 @@ namespace Apache
ManagedString mg_units( units );
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return StatisticDescriptor::Create(NativePtr->createDoubleCounter(mg_name.CharPtr, mg_description.CharPtr, mg_units.CharPtr, largerBetter));
+ return StatisticDescriptor::Create(m_nativeptr->createDoubleCounter(mg_name.CharPtr, mg_description.CharPtr, mg_units.CharPtr, largerBetter));
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -108,7 +108,7 @@ namespace Apache
ManagedString mg_units( units );
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return StatisticDescriptor::Create(NativePtr->createIntGauge(mg_name.CharPtr, mg_description.CharPtr, mg_units.CharPtr, largerBetter));
+ return StatisticDescriptor::Create(m_nativeptr->createIntGauge(mg_name.CharPtr, mg_description.CharPtr, mg_units.CharPtr, largerBetter));
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -125,7 +125,7 @@ namespace Apache
ManagedString mg_units( units );
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return StatisticDescriptor::Create(NativePtr->createLongGauge(mg_name.CharPtr, mg_description.CharPtr, mg_units.CharPtr, largerBetter));
+ return StatisticDescriptor::Create(m_nativeptr->createLongGauge(mg_name.CharPtr, mg_description.CharPtr, mg_units.CharPtr, largerBetter));
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -142,7 +142,7 @@ namespace Apache
ManagedString mg_units( units );
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return StatisticDescriptor::Create(NativePtr->createDoubleGauge(mg_name.CharPtr, mg_description.CharPtr, mg_units.CharPtr, largerBetter));
+ return StatisticDescriptor::Create(m_nativeptr->createDoubleGauge(mg_name.CharPtr, mg_description.CharPtr, mg_units.CharPtr, largerBetter));
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -157,9 +157,9 @@ namespace Apache
apache::geode::statistics::StatisticDescriptor ** nativedescriptors = new apache::geode::statistics::StatisticDescriptor*[statsLength];
for (System::Int32 index = 0; index < statsLength; index++)
{
- nativedescriptors[index] = GetNativePtr<apache::geode::statistics::StatisticDescriptor>(stats[index]);
+ nativedescriptors[index] = stats[index]->GetNative();
}
- return StatisticsType::Create(NativePtr->createType(mg_name.CharPtr, mg_description.CharPtr, nativedescriptors, statsLength));
+ return StatisticsType::Create(m_nativeptr->createType(mg_name.CharPtr, mg_description.CharPtr, nativedescriptors, statsLength));
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -169,7 +169,7 @@ namespace Apache
ManagedString mg_name( name );
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return StatisticsType::Create(NativePtr->findType(mg_name.CharPtr));
+ return StatisticsType::Create(m_nativeptr->findType(mg_name.CharPtr));
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -178,7 +178,7 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return Statistics::Create(NativePtr->createStatistics(GetNativePtr<apache::geode::statistics::StatisticsType>(type)));
+ return Statistics::Create(m_nativeptr->createStatistics(type->GetNative()));
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -188,7 +188,7 @@ namespace Apache
ManagedString mg_text( textId );
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return Statistics::Create(NativePtr->createStatistics(GetNativePtr<apache::geode::statistics::StatisticsType>(type),(char*)mg_text.CharPtr));
+ return Statistics::Create(m_nativeptr->createStatistics(type->GetNative(),(char*)mg_text.CharPtr));
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -198,7 +198,7 @@ namespace Apache
ManagedString mg_text( textId );
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return Statistics::Create(NativePtr->createStatistics(GetNativePtr<apache::geode::statistics::StatisticsType>(type),(char*)mg_text.CharPtr, numericId));
+ return Statistics::Create(m_nativeptr->createStatistics(type->GetNative(),(char*)mg_text.CharPtr, numericId));
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -207,7 +207,7 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return Statistics::Create(NativePtr->createAtomicStatistics(GetNativePtr<apache::geode::statistics::StatisticsType>(type)));
+ return Statistics::Create(m_nativeptr->createAtomicStatistics(type->GetNative()));
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -217,7 +217,7 @@ namespace Apache
ManagedString mg_text( textId );
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return Statistics::Create(NativePtr->createAtomicStatistics(GetNativePtr<apache::geode::statistics::StatisticsType>(type),(char*)mg_text.CharPtr));
+ return Statistics::Create(m_nativeptr->createAtomicStatistics(type->GetNative(),(char*)mg_text.CharPtr));
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -227,7 +227,7 @@ namespace Apache
ManagedString mg_text( textId );
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return Statistics::Create(NativePtr->createAtomicStatistics(GetNativePtr<apache::geode::statistics::StatisticsType>(type),(char*)mg_text.CharPtr, numericId));
+ return Statistics::Create(m_nativeptr->createAtomicStatistics(type->GetNative(),(char*)mg_text.CharPtr, numericId));
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -235,23 +235,21 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return Statistics::Create(NativePtr->findFirstStatisticsByType(GetNativePtr<apache::geode::statistics::StatisticsType>(type)));
+ return Statistics::Create(m_nativeptr->findFirstStatisticsByType(type->GetNative()));
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
String^ StatisticsFactory::Name::get( )
{
- return ManagedString::Get( NativePtr->getName() );
+ return ManagedString::Get( m_nativeptr->getName() );
}
- System::Int64 StatisticsFactory::ID::get( )
+ System::Int64 StatisticsFactory::ID::get()
{
- return NativePtr->getId();
+ return m_nativeptr->getId();
+ }
} // namespace Client
} // namespace Geode
} // namespace Apache
-
- } //namespace
-
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/StatisticsFactory.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/StatisticsFactory.hpp b/src/clicache/src/StatisticsFactory.hpp
index 341b9a5..7a5d330 100644
--- a/src/clicache/src/StatisticsFactory.hpp
+++ b/src/clicache/src/StatisticsFactory.hpp
@@ -20,11 +20,14 @@
#pragma once
#include "geode_defs.hpp"
-#include "impl/NativeWrapper.hpp"
+#include "begin_native.hpp"
#include <geode/statistics/StatisticsFactory.hpp>
#include <geode/statistics/StatisticsType.hpp>
#include <geode/statistics/StatisticDescriptor.hpp>
#include <geode/statistics/Statistics.hpp>
+#include "end_native.hpp"
+
+using namespace System;
namespace Apache
{
@@ -54,7 +57,6 @@ namespace Apache
/// is, exceeds its maximum value).
/// </para>
public ref class StatisticsFactory sealed
- : public Internal::UMWrap<apache::geode::statistics::StatisticsFactory>
{
protected:
StatisticsFactory(){}
@@ -248,8 +250,8 @@ namespace Apache
inline static StatisticsFactory^ Create(
apache::geode::statistics::StatisticsFactory* nativeptr)
{
- return (nativeptr != nullptr ?
- gcnew StatisticsFactory(nativeptr) : nullptr);
+ return __nullptr == nativeptr ? nullptr :
+ gcnew StatisticsFactory( nativeptr );
}
private:
@@ -258,7 +260,11 @@ namespace Apache
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
inline StatisticsFactory(apache::geode::statistics::StatisticsFactory* nativeptr)
- : UMWrap(nativeptr, false) { }
+ : m_nativeptr( nativeptr )
+ {
+ }
+
+ apache::geode::statistics::StatisticsFactory* m_nativeptr;
};
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/StatisticsType.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/StatisticsType.cpp b/src/clicache/src/StatisticsType.cpp
index 24722c7..117f7ee 100644
--- a/src/clicache/src/StatisticsType.cpp
+++ b/src/clicache/src/StatisticsType.cpp
@@ -35,21 +35,21 @@ namespace Apache
String^ StatisticsType::Name::get()
{
- return ManagedString::Get( NativePtr->getName() );
+ return ManagedString::Get( m_nativeptr->getName() );
}
String^ StatisticsType::Description::get()
{
- return ManagedString::Get( NativePtr->getDescription() );
+ return ManagedString::Get( m_nativeptr->getDescription() );
}
array<StatisticDescriptor^>^ StatisticsType::Statistics::get()
{
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- apache::geode::statistics::StatisticDescriptor ** nativedescriptors = NativePtr->getStatistics();
- array<StatisticDescriptor^>^ descriptors = gcnew array<StatisticDescriptor^>(NativePtr->getDescriptorsCount());
- for (int item = 0; item < NativePtr->getDescriptorsCount(); item++)
+ apache::geode::statistics::StatisticDescriptor ** nativedescriptors = m_nativeptr->getStatistics();
+ array<StatisticDescriptor^>^ descriptors = gcnew array<StatisticDescriptor^>(m_nativeptr->getDescriptorsCount());
+ for (int item = 0; item < m_nativeptr->getDescriptorsCount(); item++)
{
descriptors[item] = StatisticDescriptor::Create(nativedescriptors[item]);
}
@@ -62,7 +62,7 @@ namespace Apache
{
ManagedString mg_name( name );
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return NativePtr->nameToId(mg_name.CharPtr);
+ return m_nativeptr->nameToId(mg_name.CharPtr);
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
@@ -70,13 +70,13 @@ namespace Apache
{
ManagedString mg_name( name );
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return StatisticDescriptor::Create(NativePtr->nameToDescriptor(mg_name.CharPtr));
+ return StatisticDescriptor::Create(m_nativeptr->nameToDescriptor(mg_name.CharPtr));
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
System::Int32 StatisticsType::DescriptorsCount::get()
{
- return NativePtr->getDescriptorsCount();
+ return m_nativeptr->getDescriptorsCount();
} // namespace Client
} // namespace Geode
} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/StatisticsType.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/StatisticsType.hpp b/src/clicache/src/StatisticsType.hpp
index dce3f65..6644b34 100644
--- a/src/clicache/src/StatisticsType.hpp
+++ b/src/clicache/src/StatisticsType.hpp
@@ -20,9 +20,12 @@
#pragma once
#include "geode_defs.hpp"
-#include "impl/NativeWrapper.hpp"
+#include "begin_native.hpp"
#include <geode/statistics/StatisticsType.hpp>
#include <geode/statistics/StatisticDescriptor.hpp>
+#include "end_native.hpp"
+
+using namespace System;
namespace Apache
{
@@ -30,7 +33,6 @@ namespace Apache
{
namespace Client
{
-
ref class StatisticDescriptor;
/// <summary>
@@ -41,13 +43,7 @@ namespace Apache
/// To get an instance of this interface use an instance of
/// <see cref="StatisticsFactory" /> class.
/// </para>
- /// <para>
- /// The class is purposefully inherited from UMWrapN and not UMWrap as the destructor
- /// of the class is protected, and so it is now not called from inside the InternalCleanup
- /// method.
- /// </para>
public ref class StatisticsType sealed
- : public Internal::UMWrap<apache::geode::statistics::StatisticsType>
{
public:
/// <summary>
@@ -119,8 +115,13 @@ namespace Apache
inline static StatisticsType^ Create(
apache::geode::statistics::StatisticsType* nativeptr )
{
- return ( nativeptr != nullptr ?
- gcnew StatisticsType( nativeptr ) : nullptr );
+ return __nullptr == nativeptr ? nullptr :
+ gcnew StatisticsType( nativeptr );
+ }
+
+ apache::geode::statistics::StatisticsType* GetNative()
+ {
+ return m_nativeptr;
}
private:
@@ -129,7 +130,11 @@ namespace Apache
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
inline StatisticsType( apache::geode::statistics::StatisticsType* nativeptr )
- : UMWrap( nativeptr, false ) { }
+ : m_nativeptr( nativeptr )
+ {
+ }
+
+ apache::geode::statistics::StatisticsType* m_nativeptr;
};
} // namespace Client
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/Struct.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/Struct.cpp b/src/clicache/src/Struct.cpp
index 6613ec0..213703f 100644
--- a/src/clicache/src/Struct.cpp
+++ b/src/clicache/src/Struct.cpp
@@ -15,8 +15,11 @@
* limitations under the License.
*/
-//#include "geode_includes.hpp"
+ //#include "geode_includes.hpp"
+#include "begin_native.hpp"
#include <geode/Struct.hpp>
+#include "end_native.hpp"
+
#include "Struct.hpp"
#include "StructSet.hpp"
#include "ExceptionTypes.hpp"
@@ -30,50 +33,85 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
- Object^ Struct::default::get( size_t index )
+ Object^ Struct::default::get(size_t index)
{
- /* return SafeUMSerializableConvertGeneric(static_cast<apache::geode::client::Struct*>(
- NativePtr())->operator[](static_cast<System::Int32>(index)).get());*/
- return (Serializable::GetManagedValueGeneric<Object^>(static_cast<apache::geode::client::Struct*>(
- NativePtr())->operator[](static_cast<System::Int32>(index))));
+ try
+ {
+ return (Serializable::GetManagedValueGeneric<Object^>(
+ static_cast<native::Struct*>(m_nativeptr->get())->operator[](static_cast<System::Int32>(index))));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
- Object^ Struct::default::get( String^ fieldName )
+ Object^ Struct::default::get(String^ fieldName)
{
- ManagedString mg_fieldName( fieldName );
- /*return SafeUMSerializableConvertGeneric(static_cast<apache::geode::client::Struct*>(
- NativePtr())->operator[](mg_fieldName.CharPtr).get());*/
-
- return (Serializable::GetManagedValueGeneric</*TResult*/Object^>(static_cast<apache::geode::client::Struct*>(
- NativePtr())->operator[](mg_fieldName.CharPtr)));
+ ManagedString mg_fieldName(fieldName);
+ try
+ {
+ return (Serializable::GetManagedValueGeneric<Object^>(
+ static_cast<native::Struct*>(m_nativeptr->get())->operator[](mg_fieldName.CharPtr)));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
- StructSet<Object^>^ Struct::Set::get( )
+ StructSet<Object^>^ Struct::Set::get()
{
- return StructSet</*TResult*/Object^>::Create(static_cast<apache::geode::client::Struct*>(
- NativePtr())->getStructSet().get());
+ try
+ {
+ return StructSet</*TResult*/Object^>::Create(
+ static_cast<native::Struct*>(m_nativeptr->get())->getStructSet());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
-
- bool Struct/*<TResult>*/::HasNext( )
+
+ bool Struct/*<TResult>*/::HasNext()
{
- return static_cast<apache::geode::client::Struct*>(NativePtr())->hasNext();
+ try
+ {
+ return static_cast<native::Struct*>(m_nativeptr->get())->hasNext();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
- size_t Struct/*<TResult>*/::Length::get( )
+ size_t Struct/*<TResult>*/::Length::get()
{
- return static_cast<apache::geode::client::Struct*>(NativePtr())->length();
+ try
+ {
+ return static_cast<native::Struct*>(m_nativeptr->get())->length();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
- Object^ Struct/*<TResult>*/::Next( )
+ Object^ Struct/*<TResult>*/::Next()
{
- /*return SafeUMSerializableConvertGeneric(static_cast<apache::geode::client::Struct*>(
- NativePtr())->next().get());*/
- return (Serializable::GetManagedValueGeneric</*TResult*/Object^>(static_cast<apache::geode::client::Struct*>(
- NativePtr())->next()));
+ try
+ {
+ return (Serializable::GetManagedValueGeneric<Object^>(
+ static_cast<native::Struct*>(m_nativeptr->get())->next()));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
} // namespace Client
} // namespace Geode
} // namespace Apache
-
- } //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/Struct.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/Struct.hpp b/src/clicache/src/Struct.hpp
index fabb3be..9b43820 100644
--- a/src/clicache/src/Struct.hpp
+++ b/src/clicache/src/Struct.hpp
@@ -20,7 +20,10 @@
#include "geode_defs.hpp"
#include "Serializable.hpp"
+#include "begin_native.hpp"
#include <geode/Struct.hpp>
+#include "end_native.hpp"
+
using namespace System;
@@ -114,18 +117,18 @@ namespace Apache
/// Private constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline Apache::Geode::Client::Struct/*<TResult>*/( ::apache::geode::client::Serializable* nativeptr )
+ inline Apache::Geode::Client::Struct/*<TResult>*/( apache::geode::client::SerializablePtr nativeptr )
: Apache::Geode::Client::Serializable( nativeptr ) { }
inline Apache::Geode::Client::Struct/*<TResult>*/( )
- : Apache::Geode::Client::Serializable( ::apache::geode::client::Struct::createDeserializable()) { }
+ : Apache::Geode::Client::Serializable( std::shared_ptr<apache::geode::client::Serializable>(apache::geode::client::Struct::createDeserializable())) { }
internal:
/// <summary>
/// Factory function to register wrapper
/// </summary>
- inline static Apache::Geode::Client::IGeodeSerializable^ /*Struct^*/ /*<TResult>*/ Create( ::apache::geode::client::Serializable* obj )
+ inline static Apache::Geode::Client::IGeodeSerializable^ /*Struct^*/ /*<TResult>*/ Create( ::apache::geode::client::SerializablePtr obj )
{
return ( obj != nullptr ?
gcnew Apache::Geode::Client::Struct/*<TResult>*/( obj ) : nullptr );
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/StructSet.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/StructSet.cpp b/src/clicache/src/StructSet.cpp
index 4810d6b..725ff71 100644
--- a/src/clicache/src/StructSet.cpp
+++ b/src/clicache/src/StructSet.cpp
@@ -33,33 +33,57 @@ namespace Apache
generic<class TResult>
bool StructSet<TResult>::IsModifiable::get( )
{
- return NativePtr->isModifiable( );
+ try
+ {
+ return m_nativeptr->get()->isModifiable( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TResult>
System::Int32 StructSet<TResult>::Size::get( )
{
- return NativePtr->size( );
+ try
+ {
+ return m_nativeptr->get()->size( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TResult>
- /*Apache::Geode::Client::IGeodeSerializable^*/ TResult StructSet<TResult>::default::get( size_t index )
+ TResult StructSet<TResult>::default::get( size_t index )
{
- //return SafeUMSerializableConvertGeneric((NativePtr->operator[](static_cast<System::Int32>(index))).get());
- return Serializable::GetManagedValueGeneric<TResult>((NativePtr->operator[](static_cast<System::Int32>(index))));
+ try
+ {
+ return Serializable::GetManagedValueGeneric<TResult>((m_nativeptr->get()->operator[](static_cast<System::Int32>(index))));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TResult>
SelectResultsIterator<TResult>^ StructSet<TResult>::GetIterator( )
{
- apache::geode::client::SelectResultsIterator* nativeptr =
- new apache::geode::client::SelectResultsIterator(NativePtr->getIterator());
- return SelectResultsIterator<TResult>::Create( nativeptr );
+ try
+ {
+ return SelectResultsIterator<TResult>::Create(std::make_unique<apache::geode::client::SelectResultsIterator>(m_nativeptr->get()->getIterator()));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
generic<class TResult>
- System::Collections::Generic::IEnumerator</*Apache::Geode::Client::IGeodeSerializable^*/TResult>^
- StructSet<TResult>::GetEnumerator( )
+ System::Collections::Generic::IEnumerator<TResult>^ StructSet<TResult>::GetEnumerator( )
{
return GetIterator( );
}
@@ -77,17 +101,30 @@ namespace Apache
_GF_MG_EXCEPTION_TRY2/* due to auto replace */
- return NativePtr->getFieldIndex( mg_fieldName.CharPtr );
+ try
+ {
+ return m_nativeptr->get()->getFieldIndex( mg_fieldName.CharPtr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2/* due to auto replace */
}
generic<class TResult>
- String^ StructSet<TResult>::GetFieldName( size_t index )
+ String^ StructSet<TResult>::GetFieldName(size_t index)
{
- return ManagedString::Get( NativePtr->getFieldName( static_cast<System::Int32> (index) ) );
+ try
+ {
+ return ManagedString::Get(m_nativeptr->get()->getFieldName(static_cast<System::Int32> (index)));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ }
} // namespace Client
} // namespace Geode
} // namespace Apache
-
- } //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/StructSet.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/StructSet.hpp b/src/clicache/src/StructSet.hpp
index 3ca6de2..ae81b76 100644
--- a/src/clicache/src/StructSet.hpp
+++ b/src/clicache/src/StructSet.hpp
@@ -18,8 +18,11 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/StructSet.hpp>
-#include "impl/NativeWrapper.hpp"
+#include "end_native.hpp"
+
+#include "native_shared_ptr.hpp"
#include "ICqResults.hpp"
@@ -32,6 +35,7 @@ namespace Apache
namespace Client
{
+ namespace native = apache::geode::client;
interface class IGeodeSerializable;
generic<class TResult>
@@ -42,7 +46,7 @@ namespace Apache
/// </summary>
generic<class TResult>
public ref class StructSet sealed
- : public Internal::SBWrap<apache::geode::client::StructSet>, public ICqResults<TResult>
+ : public ICqResults<TResult>
{
public:
@@ -138,9 +142,10 @@ namespace Apache
/// <returns>
/// The managed wrapper object; null if the native pointer is null.
/// </returns>
- inline static StructSet<TResult>^ Create(apache::geode::client::StructSet* nativeptr)
+ inline static StructSet<TResult>^ Create(native::StructSetPtr nativeptr)
{
- return (nativeptr != nullptr ? gcnew StructSet<TResult>(nativeptr) : nullptr);
+ return __nullptr == nativeptr ? nullptr :
+ gcnew StructSet<TResult>( nativeptr );
}
@@ -153,8 +158,12 @@ namespace Apache
/// Private constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline StructSet(apache::geode::client::StructSet* nativeptr)
- : SBWrap(nativeptr) { }
+ inline StructSet(native::StructSetPtr nativeptr)
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::StructSet>(nativeptr);
+ }
+
+ native_shared_ptr<native::StructSet>^ m_nativeptr;
};
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/SystemProperties.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/SystemProperties.cpp b/src/clicache/src/SystemProperties.cpp
index 3df6b09..8683548 100644
--- a/src/clicache/src/SystemProperties.cpp
+++ b/src/clicache/src/SystemProperties.cpp
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-//#include "geode_includes.hpp"
#include "SystemProperties.hpp"
#include "impl/SafeConvert.hpp"
@@ -27,216 +26,193 @@ namespace Apache
{
namespace Client
{
-
- SystemProperties::SystemProperties( Properties<String^, String^>^ properties )
- {
- _GF_MG_EXCEPTION_TRY2
-
- SetPtr(new apache::geode::client::SystemProperties(apache::geode::client::PropertiesPtr(
- GetNativePtr<apache::geode::client::Properties>(properties))), true);
-
- _GF_MG_EXCEPTION_CATCH_ALL2
- }
-
- SystemProperties::SystemProperties( Properties<String^, String^>^ properties,
- String^ configFile )
- {
- _GF_MG_EXCEPTION_TRY2
-
- ManagedString mg_configFile( configFile );
- apache::geode::client::PropertiesPtr propertiesptr(
- GetNativePtr<apache::geode::client::Properties>( properties ) );
- SetPtr( new apache::geode::client::SystemProperties( propertiesptr,
- mg_configFile.CharPtr ), true );
-
- _GF_MG_EXCEPTION_CATCH_ALL2
- }
+ namespace native = apache::geode::client;
void SystemProperties::LogSettings( )
{
- NativePtr->logSettings( );
+ m_nativeptr->logSettings( );
}
System::Int32 SystemProperties::StatisticsSampleInterval::get( )
{
- return NativePtr->statisticsSampleInterval( );
+ return m_nativeptr->statisticsSampleInterval( );
}
bool SystemProperties::StatisticsEnabled::get( )
{
- return NativePtr->statisticsEnabled( );
+ return m_nativeptr->statisticsEnabled( );
}
String^ SystemProperties::StatisticsArchiveFile::get( )
{
- return ManagedString::Get( NativePtr->statisticsArchiveFile( ) );
+ return ManagedString::Get( m_nativeptr->statisticsArchiveFile( ) );
}
String^ SystemProperties::LogFileName::get( )
{
- return ManagedString::Get( NativePtr->logFilename( ) );
+ return ManagedString::Get( m_nativeptr->logFilename( ) );
}
LogLevel SystemProperties::GFLogLevel::get( )
{
- return static_cast<LogLevel>( NativePtr->logLevel( ) );
+ return static_cast<LogLevel>( m_nativeptr->logLevel( ) );
}
bool SystemProperties::HeapLRULimitEnabled::get( )
{
- return NativePtr->heapLRULimitEnabled( );
+ return m_nativeptr->heapLRULimitEnabled( );
}
size_t SystemProperties::HeapLRULimit::get( )
{
- return NativePtr->heapLRULimit( );
+ return m_nativeptr->heapLRULimit( );
}
System::Int32 SystemProperties::HeapLRUDelta::get( )
{
- return NativePtr->heapLRUDelta( );
+ return m_nativeptr->heapLRUDelta( );
}
System::Int32 SystemProperties::MaxSocketBufferSize::get( )
{
- return NativePtr->maxSocketBufferSize( );
+ return m_nativeptr->maxSocketBufferSize( );
}
System::Int32 SystemProperties::PingInterval::get( )
{
- return NativePtr->pingInterval( );
+ return m_nativeptr->pingInterval( );
}
System::Int32 SystemProperties::RedundancyMonitorInterval::get( )
{
- return NativePtr->redundancyMonitorInterval( );
+ return m_nativeptr->redundancyMonitorInterval( );
}
System::Int32 SystemProperties::NotifyAckInterval::get( )
{
- return NativePtr->notifyAckInterval( );
+ return m_nativeptr->notifyAckInterval( );
}
System::Int32 SystemProperties::NotifyDupCheckLife::get( )
{
- return NativePtr->notifyDupCheckLife( );
+ return m_nativeptr->notifyDupCheckLife( );
}
bool SystemProperties::DebugStackTraceEnabled::get( )
{
- return NativePtr->debugStackTraceEnabled( );
+ return m_nativeptr->debugStackTraceEnabled( );
}
bool SystemProperties::CrashDumpEnabled::get( )
{
- return NativePtr->crashDumpEnabled();
+ return m_nativeptr->crashDumpEnabled();
}
bool SystemProperties::AppDomainEnabled::get( )
{
- return NativePtr->isAppDomainEnabled();
+ return m_nativeptr->isAppDomainEnabled();
}
String^ SystemProperties::Name::get( )
{
- return ManagedString::Get( NativePtr->name( ) );
+ return ManagedString::Get( m_nativeptr->name( ) );
}
String^ SystemProperties::CacheXmlFile::get( )
{
- return ManagedString::Get( NativePtr->cacheXMLFile( ) );
+ return ManagedString::Get( m_nativeptr->cacheXMLFile( ) );
}
System::Int32 SystemProperties::LogFileSizeLimit::get( )
{
- return NativePtr->logFileSizeLimit( );
+ return m_nativeptr->logFileSizeLimit( );
}
System::Int32 SystemProperties::LogDiskSpaceLimit::get( )
{
- return NativePtr->logDiskSpaceLimit( );
+ return m_nativeptr->logDiskSpaceLimit( );
}
System::Int32 SystemProperties::StatsFileSizeLimit::get( )
{
- return NativePtr->statsFileSizeLimit( );
+ return m_nativeptr->statsFileSizeLimit( );
}
System::Int32 SystemProperties::StatsDiskSpaceLimit::get( )
{
- return NativePtr->statsDiskSpaceLimit( );
+ return m_nativeptr->statsDiskSpaceLimit( );
}
System::UInt32 SystemProperties::MaxQueueSize::get( )
{
- return NativePtr->maxQueueSize( );
+ return m_nativeptr->maxQueueSize( );
}
bool SystemProperties::SSLEnabled::get( )
{
- return NativePtr->sslEnabled();
+ return m_nativeptr->sslEnabled();
}
String^ SystemProperties::SSLKeyStore::get()
{
- return ManagedString::Get(NativePtr->sslKeyStore());
+ return ManagedString::Get(m_nativeptr->sslKeyStore());
}
String^ SystemProperties::SSLTrustStore::get()
{
- return ManagedString::Get(NativePtr->sslTrustStore());
+ return ManagedString::Get(m_nativeptr->sslTrustStore());
}
// adongre
String^ SystemProperties::SSLKeystorePassword::get()
{
- return ManagedString::Get(NativePtr->sslKeystorePassword());
+ return ManagedString::Get(m_nativeptr->sslKeystorePassword());
}
bool SystemProperties::IsSecurityOn::get( )
{
- return NativePtr->isSecurityOn( );
+ return m_nativeptr->isSecurityOn( );
}
Properties<String^, String^>^ SystemProperties::GetSecurityProperties::get( )
{
- return Properties<String^, String^>::Create<String^, String^>( NativePtr->getSecurityProperties( ).ptr( ) );
+ return Properties<String^, String^>::Create(m_nativeptr->getSecurityProperties());
}
String^ SystemProperties::DurableClientId::get( )
{
- return ManagedString::Get( NativePtr->durableClientId( ) );
+ return ManagedString::Get( m_nativeptr->durableClientId( ) );
}
System::UInt32 SystemProperties::DurableTimeout::get( )
{
- return NativePtr->durableTimeout( );
+ return m_nativeptr->durableTimeout( );
}
System::UInt32 SystemProperties::ConnectTimeout::get( )
{
- return NativePtr->connectTimeout( );
+ return m_nativeptr->connectTimeout( );
}
String^ SystemProperties::ConflateEvents::get( )
{
- return ManagedString::Get( NativePtr->conflateEvents( ) );
+ return ManagedString::Get( m_nativeptr->conflateEvents( ) );
}
System::UInt32 SystemProperties::SuspendedTxTimeout::get( )
{
- return NativePtr->suspendedTxTimeout( );
+ return m_nativeptr->suspendedTxTimeout( );
}
bool SystemProperties::ReadTimeoutUnitInMillis::get( )
{
- return NativePtr->readTimeoutUnitInMillis( );
+ return m_nativeptr->readTimeoutUnitInMillis( );
}
bool SystemProperties::OnClientDisconnectClearPdxTypeIds::get( )
{
- return NativePtr->onClientDisconnectClearPdxTypeIds( );
+ return m_nativeptr->onClientDisconnectClearPdxTypeIds( );
} // namespace Client
} // namespace Geode
} // namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/SystemProperties.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/SystemProperties.hpp b/src/clicache/src/SystemProperties.hpp
index 7a64771..507035b 100644
--- a/src/clicache/src/SystemProperties.hpp
+++ b/src/clicache/src/SystemProperties.hpp
@@ -18,8 +18,10 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/SystemProperties.hpp>
-#include "impl/NativeWrapper.hpp"
+#include "end_native.hpp"
+
#include "Log.hpp"
#include "Properties.hpp"
@@ -31,6 +33,7 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
/// <summary>
/// A class for internal use, that encapsulates the properties that can be
@@ -38,34 +41,10 @@ namespace Apache
/// or a geode.properties file.
/// </summary>
public ref class SystemProperties sealed
- : public Internal::UMWrap<apache::geode::client::SystemProperties>
{
public:
/// <summary>
- /// Constructor. Sets the default (hard-coded) values first, and then overwrites those with
- /// any values found in the given properties.
- /// </summary>
- /// <param name="properties">initialize with the given properties</param>
- //generic <class TPropKey, class TPropValue>
- SystemProperties(Properties<String^, String^>^ properties);
-
- /// <summary>
- /// Constructor.
- /// <ol>
- /// <li>Sets the default (hard-coded) values.</li>
- /// <li>Overwrites those with any values from <c>systemDefault/geode.properties</c></li>
- /// <li>Overwrites those with any values from the given file (if it exists)
- /// or the local <c>./geode.properties</c> (if the given file does not exist).</li>
- /// <li>Overwrites those with any values found in the given properties.</li>
- /// </ol>
- /// </summary>
- /// <param name="properties">these overwrite any other values already set</param>
- /// <param name="configFile">see summary</param>
- //generic <class TPropKey, class TPropValue>
- SystemProperties(Properties<String^, String^>^ properties, String^ configFile);
-
- /// <summary>
/// Prints all settings to the process log.
/// </summary>
void LogSettings();
@@ -423,7 +402,7 @@ namespace Apache
/// the managed wrapper object, or null if the native pointer is null.
/// </returns>
inline static SystemProperties^ Create(
- apache::geode::client::SystemProperties* nativeptr)
+ native::SystemProperties* nativeptr)
{
return (nativeptr != nullptr ?
gcnew SystemProperties(nativeptr) : nullptr);
@@ -436,8 +415,12 @@ namespace Apache
/// Private constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline SystemProperties(apache::geode::client::SystemProperties* nativeptr)
- : UMWrap(nativeptr, false) { }
+ inline SystemProperties(native::SystemProperties* nativeptr)
+ : m_nativeptr(nativeptr)
+ {
+ }
+
+ native::SystemProperties* m_nativeptr;
};
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/TransactionEvent.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/TransactionEvent.cpp b/src/clicache/src/TransactionEvent.cpp
index e8367e1..d4d694c 100644
--- a/src/clicache/src/TransactionEvent.cpp
+++ b/src/clicache/src/TransactionEvent.cpp
@@ -43,7 +43,7 @@ namespace Apache
NativePtr->getCache( ) );
return Apache::Geode::Client::Cache::Create(
- nativeptr.ptr( ) );
+ nativeptr.get() );
}
generic<class TKey, class TValue>
@@ -53,7 +53,7 @@ namespace Apache
NativePtr->getTransactionId( ) );
return Apache::Geode::Client::TransactionId::Create(
- nativeptr.ptr( ) );
+ nativeptr.get() );
}
generic<class TKey, class TValue>
@@ -67,7 +67,7 @@ namespace Apache
for( System::Int32 index = 0; index < vee.size( ); index++ )
{
apache::geode::client::EntryEventPtr& nativeptr( vee[ index ] );
- EntryEvent<TKey, TValue> entryEvent( nativeptr.ptr( ) );
+ EntryEvent<TKey, TValue> entryEvent( nativeptr.get() );
events[ index ] = (%entryEvent);
}
return events;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/TransactionEvent.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/TransactionEvent.hpp b/src/clicache/src/TransactionEvent.hpp
index b04bf76..80680c2 100644
--- a/src/clicache/src/TransactionEvent.hpp
+++ b/src/clicache/src/TransactionEvent.hpp
@@ -20,7 +20,7 @@
#include "geode_defs.hpp"
#include <cppcache/TransactionEvent.hpp>
-#include "impl/NativeWrapper.hpp"
+
//#include "TransactionId.hpp"
//#include "Cache.hpp"
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/TransactionId.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/TransactionId.hpp b/src/clicache/src/TransactionId.hpp
index 628e17f..29ceeb8 100644
--- a/src/clicache/src/TransactionId.hpp
+++ b/src/clicache/src/TransactionId.hpp
@@ -18,8 +18,11 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/TransactionId.hpp>
-#include "impl/NativeWrapper.hpp"
+#include "end_native.hpp"
+
+
using namespace System;
@@ -29,19 +32,24 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
/// <summary>
/// This class encapsulates Id of a transaction.
/// </summary>
public ref class TransactionId sealed
- : public Internal::SBWrap<apache::geode::client::TransactionId>
{
internal:
- inline static TransactionId^ Create( apache::geode::client::TransactionId* nativeptr )
+ inline static TransactionId^ Create(native::TransactionIdPtr nativeptr )
+ {
+ return __nullptr == nativeptr ? nullptr :
+ gcnew TransactionId( nativeptr );
+ }
+
+ std::shared_ptr<native::TransactionId> GetNative()
{
- return ( nativeptr != nullptr ?
- gcnew TransactionId( nativeptr ) : nullptr );
+ return m_nativeptr->get_shared_ptr();
}
private:
@@ -50,8 +58,12 @@ namespace Apache
/// Private constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline TransactionId( apache::geode::client::TransactionId* nativeptr )
- : SBWrap( nativeptr ) { }
+ inline TransactionId( native::TransactionIdPtr nativeptr )
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::TransactionId>(nativeptr);
+ }
+
+ native_shared_ptr<native::TransactionId>^ m_nativeptr;
};
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/UserFunctionExecutionException.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/UserFunctionExecutionException.cpp b/src/clicache/src/UserFunctionExecutionException.cpp
index 27a1ffe..306919e 100644
--- a/src/clicache/src/UserFunctionExecutionException.cpp
+++ b/src/clicache/src/UserFunctionExecutionException.cpp
@@ -28,49 +28,69 @@ namespace Apache
namespace Client
{
- // IGeodeSerializable methods
-
- void UserFunctionExecutionException::ToData( DataOutput^ output )
+ // IGeodeSerializable methods
+
+ void UserFunctionExecutionException::ToData(DataOutput^ output)
+ {
+ throw gcnew IllegalStateException("UserFunctionExecutionException::ToData is not intended for use.");
+ }
+
+ IGeodeSerializable^ UserFunctionExecutionException::FromData(DataInput^ input)
+ {
+ throw gcnew IllegalStateException("UserFunctionExecutionException::FromData is not intended for use.");
+ return this;
+ }
+
+ System::UInt32 UserFunctionExecutionException::ObjectSize::get()
+ {
+ _GF_MG_EXCEPTION_TRY2
+ throw gcnew IllegalStateException("UserFunctionExecutionException::ObjectSize is not intended for use.");
+ try
{
- throw gcnew IllegalStateException("UserFunctionExecutionException::ToData is not intended for use.");
+ return m_nativeptr->get()->objectSize();
}
-
- IGeodeSerializable^ UserFunctionExecutionException::FromData( DataInput^ input )
+ finally
{
- throw gcnew IllegalStateException("UserFunctionExecutionException::FromData is not intended for use.");
- return this;
- }
+ GC::KeepAlive(m_nativeptr);
+ }
- System::UInt32 UserFunctionExecutionException::ObjectSize::get( )
- {
- _GF_MG_EXCEPTION_TRY2
- throw gcnew IllegalStateException("UserFunctionExecutionException::ObjectSize is not intended for use.");
- return NativePtr->objectSize( );
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
- _GF_MG_EXCEPTION_CATCH_ALL2
- }
+ String^ UserFunctionExecutionException::Message::get()
+ {
+ _GF_MG_EXCEPTION_TRY2
- String^ UserFunctionExecutionException::Message::get()
+ try
{
- _GF_MG_EXCEPTION_TRY2
+ auto value = m_nativeptr->get()->getMessage();
+ return CacheableString::GetString(value.get());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
- apache::geode::client::CacheableStringPtr value = NativePtr->getMessage( );
- return CacheableString::GetString( value.ptr( ) );
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
- _GF_MG_EXCEPTION_CATCH_ALL2
- }
+ String^ UserFunctionExecutionException::Name::get()
+ {
+ _GF_MG_EXCEPTION_TRY2
- String^ UserFunctionExecutionException::Name::get()
+ try
{
- _GF_MG_EXCEPTION_TRY2
-
- apache::geode::client::CacheableStringPtr value = NativePtr->getName( );
- return CacheableString::GetString( value.ptr( ) );
+ auto value = m_nativeptr->get()->getName();
+ return CacheableString::GetString(value.get());
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
- _GF_MG_EXCEPTION_CATCH_ALL2
+ _GF_MG_EXCEPTION_CATCH_ALL2
+ }
} // namespace Client
} // namespace Geode
} // namespace Apache
-}
-
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/UserFunctionExecutionException.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/UserFunctionExecutionException.hpp b/src/clicache/src/UserFunctionExecutionException.hpp
index 42f752c..dd9e74d 100644
--- a/src/clicache/src/UserFunctionExecutionException.hpp
+++ b/src/clicache/src/UserFunctionExecutionException.hpp
@@ -19,7 +19,12 @@
#pragma once
#include "geode_defs.hpp"
-#include "geode/UserFunctionExecutionException.hpp"
+
+#include "begin_native.hpp"
+#include <geode/UserFunctionExecutionException.hpp>
+#include "end_native.hpp"
+
+#include "native_shared_ptr.hpp"
#include "IGeodeSerializable.hpp"
#include "DataInput.hpp"
#include "DataOutput.hpp"
@@ -32,12 +37,13 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
/// <summary>
/// UserFunctionExecutionException class is used to encapsulate geode sendException in case of Function execution.
/// </summary>
public ref class UserFunctionExecutionException sealed
- : public Internal::SBWrap<apache::geode::client::UserFunctionExecutionException>, public IGeodeSerializable
+ : public IGeodeSerializable
{
public:
// IGeodeSerializable members
@@ -123,8 +129,12 @@ namespace Apache
/// Private constructor to wrap a native object pointer.
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline UserFunctionExecutionException(apache::geode::client::UserFunctionExecutionException* nativeptr)
- : SBWrap(nativeptr) { }
+ inline UserFunctionExecutionException(apache::geode::client::UserFunctionExecutionExceptionPtr nativeptr)
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::UserFunctionExecutionException>(nativeptr);
+ }
+
+ native_shared_ptr<native::UserFunctionExecutionException>^ m_nativeptr;
};
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/Utils.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/Utils.cpp b/src/clicache/src/Utils.cpp
index 3fc28df..e293b52 100644
--- a/src/clicache/src/Utils.cpp
+++ b/src/clicache/src/Utils.cpp
@@ -16,9 +16,10 @@
*/
-//#include "geode_includes.hpp"
#include "gfcli/Utils.hpp"
+#include "begin_native.hpp"
#include <Utils.hpp>
+#include "end_native.hpp"
namespace Apache
{
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/begin_native.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/begin_native.hpp b/src/clicache/src/begin_native.hpp
new file mode 100644
index 0000000..14d9d47
--- /dev/null
+++ b/src/clicache/src/begin_native.hpp
@@ -0,0 +1,22 @@
+#if defined(__begin_native__hpp__)
+#error Including begin_native.hpp mulitple times without end_native.hpp
+#endif
+#define __begin_native__hpp__
+
+#pragma push_macro("_ALLOW_KEYWORD_MACROS")
+#undef _ALLOW_KEYWORD_MACROS
+#define _ALLOW_KEYWORD_MACROS
+
+#pragma push_macro("nullptr")
+#undef nullptr
+#define nullptr __nullptr
+
+#pragma warning(push)
+
+// Disable XML warnings
+#pragma warning(disable: 4635)
+#pragma warning(disable: 4638)
+#pragma warning(disable: 4641)
+
+// Disable native code generation warning
+#pragma warning(disable: 4793)
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/end_native.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/end_native.hpp b/src/clicache/src/end_native.hpp
new file mode 100644
index 0000000..1af8380
--- /dev/null
+++ b/src/clicache/src/end_native.hpp
@@ -0,0 +1,6 @@
+#pragma pop_macro("nullptr")
+#pragma pop_macro("_ALLOW_KEYWORD_MACROS")
+
+#pragma warning(pop)
+
+#undef __begin_native__hpp__
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/geode_defs.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/geode_defs.hpp b/src/clicache/src/geode_defs.hpp
index 6a1c4e3..2424f77 100644
--- a/src/clicache/src/geode_defs.hpp
+++ b/src/clicache/src/geode_defs.hpp
@@ -39,9 +39,6 @@
/// This namespace contains all the Geode .NET classes and utility classes.
/// @namespace Apache::Geode::Client
-/// This namespace contains all the Geode .NET API classes and enumerations.
-
-/// @namespace Apache::Geode::Client
/// This namespace contains all the Geode .NET Generics API classes and enumerations.
/// @namespace Apache::Geode::Client::Internal
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/AppDomainContext.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/AppDomainContext.hpp b/src/clicache/src/impl/AppDomainContext.hpp
index 7c0e185..cd6a00f 100644
--- a/src/clicache/src/impl/AppDomainContext.hpp
+++ b/src/clicache/src/impl/AppDomainContext.hpp
@@ -19,7 +19,9 @@
#include <functional>
#include <vcclr.h>
+#include "begin_native.hpp"
#include <AppDomainContext.hpp>
+#include "end_native.hpp"
namespace Apache
{
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/AssemblyInfo.cpp.in
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/AssemblyInfo.cpp.in b/src/clicache/src/impl/AssemblyInfo.cpp.in
index 6d08fd4..a885a22 100644
--- a/src/clicache/src/impl/AssemblyInfo.cpp.in
+++ b/src/clicache/src/impl/AssemblyInfo.cpp.in
@@ -43,3 +43,4 @@ using namespace System::Security::Permissions;
[assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)];
[assembly:InternalsVisibleToAttribute("UnitTests@STRONG_NAME_PUBLIC_KEY_ATTRIBUTE@")];
+[assembly:InternalsVisibleToAttribute("cli-unit-tests@STRONG_NAME_PUBLIC_KEY_ATTRIBUTE@")];
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/AuthenticatedCache.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/AuthenticatedCache.cpp b/src/clicache/src/impl/AuthenticatedCache.cpp
index d6c9eae..55b11c4 100644
--- a/src/clicache/src/impl/AuthenticatedCache.cpp
+++ b/src/clicache/src/impl/AuthenticatedCache.cpp
@@ -36,14 +36,28 @@ namespace Apache
bool AuthenticatedCache::IsClosed::get( )
{
- return NativePtr->isClosed( );
+ try
+ {
+ return m_nativeptr->get()->isClosed( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
void AuthenticatedCache::Close( )
{
_GF_MG_EXCEPTION_TRY2
- NativePtr->close( );
+ try
+ {
+ m_nativeptr->get()->close( );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -54,11 +68,16 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- ManagedString mg_path( path );
- apache::geode::client::RegionPtr& nativeptr(
- NativePtr->getRegion( mg_path.CharPtr ) );
-
- return Client::Region<TKey, TValue>::Create( nativeptr.ptr( ) );
+ try
+ {
+ ManagedString mg_path( path );
+ auto nativeptr = m_nativeptr->get()->getRegion( mg_path.CharPtr );
+ return Client::Region<TKey, TValue>::Create( nativeptr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -68,7 +87,14 @@ namespace Apache
{
_GF_MG_EXCEPTION_TRY2
- return Client::QueryService<TKey, TResult>::Create( NativePtr->getQueryService( ).ptr( ) );
+ try
+ {
+ return Client::QueryService<TKey, TResult>::Create(m_nativeptr->get()->getQueryService( ));
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -77,23 +103,28 @@ namespace Apache
array<IRegion<TKey, TValue>^>^ AuthenticatedCache::RootRegions( )
{
apache::geode::client::VectorOfRegion vrr;
- NativePtr->rootRegions( vrr );
- array<IRegion<TKey, TValue>^>^ rootRegions =
- gcnew array<IRegion<TKey, TValue>^>( vrr.size( ) );
+ try
+ {
+ m_nativeptr->get()->rootRegions( vrr );
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
+ auto rootRegions = gcnew array<IRegion<TKey, TValue>^>( vrr.size( ) );
for( System::Int32 index = 0; index < vrr.size( ); index++ )
{
- apache::geode::client::RegionPtr& nativeptr( vrr[ index ] );
- rootRegions[ index ] = Client::Region<TKey, TValue>::Create( nativeptr.ptr( ) );
+ auto& nativeptr( vrr[ index ] );
+ rootRegions[ index ] = Client::Region<TKey, TValue>::Create( nativeptr );
}
return rootRegions;
}
- IPdxInstanceFactory^ AuthenticatedCache::CreatePdxInstanceFactory(String^ className)
- {
- return gcnew Internal::PdxInstanceFactoryImpl(className);;
+ IPdxInstanceFactory^ AuthenticatedCache::CreatePdxInstanceFactory(String^ className)
+ {
+ return gcnew Internal::PdxInstanceFactoryImpl(className);
+ }
} // namespace Client
} // namespace Geode
} // namespace Apache
-
-}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/AuthenticatedCache.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/AuthenticatedCache.hpp b/src/clicache/src/impl/AuthenticatedCache.hpp
index 1f7f7c3..7f0028f 100644
--- a/src/clicache/src/impl/AuthenticatedCache.hpp
+++ b/src/clicache/src/impl/AuthenticatedCache.hpp
@@ -18,11 +18,13 @@
#pragma once
#include "../geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/RegionService.hpp>
-#include "NativeWrapper.hpp"
+#include "end_native.hpp"
+
+#include "../native_shared_ptr.hpp"
#include "../RegionShortcut.hpp"
#include "../RegionFactory.hpp"
-//#include "../geode_includes.hpp"
#include "../IRegionService.hpp"
#include "../Region.hpp"
@@ -34,12 +36,7 @@ namespace Apache
{
namespace Client
{
-
- //ref class DistributedSystem;
- //ref class Region;
- //ref class RegionAttributes;
- //ref class QueryService;
- //ref class FunctionService;
+ namespace native = apache::geode::client;
/// <summary>
/// Provides a distributed cache.
@@ -59,7 +56,7 @@ namespace Apache
/// </para>
/// </remarks>
public ref class AuthenticatedCache
- : public IRegionService, Internal::SBWrap<apache::geode::client::RegionService>
+ : public IRegionService
{
public:
@@ -145,10 +142,15 @@ namespace Apache
/// <returns>
/// The managed wrapper object; null if the native pointer is null.
/// </returns>
- inline static AuthenticatedCache^ Create( apache::geode::client::RegionService* nativeptr )
+ inline static AuthenticatedCache^ Create( native::RegionServicePtr nativeptr )
{
- return ( nativeptr != nullptr ?
- gcnew AuthenticatedCache( nativeptr ) : nullptr );
+ return __nullptr == nativeptr ? nullptr :
+ gcnew AuthenticatedCache( nativeptr );
+ }
+
+ std::shared_ptr<native::RegionService> GetNative()
+ {
+ return m_nativeptr->get_shared_ptr();
}
private:
@@ -157,8 +159,11 @@ namespace Apache
/// Private constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline AuthenticatedCache( apache::geode::client::RegionService* nativeptr )
- : SBWrap( nativeptr ) { }
+ inline AuthenticatedCache( native::RegionServicePtr nativeptr )
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::RegionService>(nativeptr);
+ }
+ native_shared_ptr<native::RegionService>^ m_nativeptr;
};
} // namespace Client
} // namespace Geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/CacheListener.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/CacheListener.hpp b/src/clicache/src/impl/CacheListener.hpp
index ab100b9..d06a34c 100644
--- a/src/clicache/src/impl/CacheListener.hpp
+++ b/src/clicache/src/impl/CacheListener.hpp
@@ -49,62 +49,60 @@ namespace Apache
virtual void AfterUpdate(Apache::Geode::Client::EntryEvent<Object^, Object^>^ event) override
{
- EntryEvent<TKey, TValue> gevent(Client::GetNativePtr<apache::geode::client::EntryEvent>(event));
+ EntryEvent<TKey, TValue> gevent(event->GetNative());
m_listener->AfterUpdate(%gevent);
}
virtual void AfterCreate(Apache::Geode::Client::EntryEvent<Object^, Object^>^ event) override
{
- EntryEvent<TKey, TValue> gevent(Client::GetNativePtr<apache::geode::client::EntryEvent>(event));
+ EntryEvent<TKey, TValue> gevent(event->GetNative());
m_listener->AfterCreate(%gevent);
}
virtual void AfterInvalidate(Apache::Geode::Client::EntryEvent<Object^, Object^>^ event) override
{
- EntryEvent<TKey, TValue> gevent(Client::GetNativePtr<apache::geode::client::EntryEvent>(event));
+ EntryEvent<TKey, TValue> gevent(event->GetNative());
m_listener->AfterInvalidate(%gevent);
}
virtual void AfterDestroy(Apache::Geode::Client::EntryEvent<Object^, Object^>^ event) override
{
- EntryEvent<TKey, TValue> gevent(Client::GetNativePtr<apache::geode::client::EntryEvent>(event));
+ EntryEvent<TKey, TValue> gevent(event->GetNative());
m_listener->AfterDestroy(%gevent);
}
virtual void AfterRegionLive(Apache::Geode::Client::RegionEvent<Object^, Object^>^ event) override
{
- RegionEvent<TKey, TValue> gevent(Client::GetNativePtr<apache::geode::client::RegionEvent>(event));
+ RegionEvent<TKey, TValue> gevent(event->GetNative());
m_listener->AfterRegionLive(%gevent);
}
virtual void AfterRegionClear(Apache::Geode::Client::RegionEvent<Object^, Object^>^ event) override
{
- RegionEvent<TKey, TValue> gevent(Client::GetNativePtr<apache::geode::client::RegionEvent>(event));
+ RegionEvent<TKey, TValue> gevent(event->GetNative());
m_listener->AfterRegionClear(%gevent);
}
virtual void AfterRegionDestroy(Apache::Geode::Client::RegionEvent<Object^, Object^>^ event) override
{
- RegionEvent<TKey, TValue> gevent(Client::GetNativePtr<apache::geode::client::RegionEvent>(event));
+ RegionEvent<TKey, TValue> gevent(event->GetNative());
m_listener->AfterRegionDestroy(%gevent);
}
virtual void AfterRegionInvalidate(Apache::Geode::Client::RegionEvent<Object^, Object^>^ event) override
{
- RegionEvent<TKey, TValue> gevent(Client::GetNativePtr<apache::geode::client::RegionEvent>(event));
+ RegionEvent<TKey, TValue> gevent(event->GetNative());
m_listener->AfterRegionInvalidate(%gevent);
}
- virtual void AfterRegionDisconnected(Apache::Geode::Client::IRegion<Object^, Object^>^ event) override
+ virtual void AfterRegionDisconnected(Apache::Geode::Client::IRegion<Object^, Object^>^ region) override
{
- Apache::Geode::Client::IRegion<TKey, TValue>^ gevent = Apache::Geode::Client::Region<TKey, TValue>::Create(Apache::Geode::Client::GetNativePtr<apache::geode::client::Region>(reinterpret_cast<Apache::Geode::Client::Region<Object^, Object^>^>(event)));
- m_listener->AfterRegionDisconnected(gevent);
+ m_listener->AfterRegionDisconnected((IRegion<TKey, TValue>^) region);
}
- virtual void Close(Apache::Geode::Client::IRegion<Object^, Object^>^ event) override
+ virtual void Close(Apache::Geode::Client::IRegion<Object^, Object^>^ region) override
{
- Apache::Geode::Client::IRegion<TKey, TValue>^ gevent = Apache::Geode::Client::Region<TKey, TValue>::Create(Apache::Geode::Client::GetNativePtr<apache::geode::client::Region>(reinterpret_cast<Apache::Geode::Client::Region<Object^, Object^>^>(event)));
- m_listener->Close(gevent);
+ m_listener->Close((IRegion<TKey, TValue>^) region);
}
};
} // namespace Client
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/CacheLoader.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/CacheLoader.hpp b/src/clicache/src/impl/CacheLoader.hpp
index 45f1506..9f8a049 100644
--- a/src/clicache/src/impl/CacheLoader.hpp
+++ b/src/clicache/src/impl/CacheLoader.hpp
@@ -63,7 +63,7 @@ namespace Apache
virtual apache::geode::client::CacheablePtr load( const apache::geode::client::RegionPtr& region,
const apache::geode::client::CacheableKeyPtr& key, const apache::geode::client::UserDataPtr& helper )
{
- IRegion<TKey, TValue>^ gregion = Region<TKey, TValue>::Create(region.get());
+ IRegion<TKey, TValue>^ gregion = Region<TKey, TValue>::Create(region);
TKey gkey = Serializable::GetManagedValueGeneric<TKey>(key);
@@ -75,7 +75,7 @@ namespace Apache
virtual void close( const apache::geode::client::RegionPtr& region )
{
- IRegion<TKey, TValue>^ gregion = Region<TKey, TValue>::Create(region.get());
+ IRegion<TKey, TValue>^ gregion = Region<TKey, TValue>::Create(region);
m_loader->Close(gregion);
}
};
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/CacheWriter.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/CacheWriter.hpp b/src/clicache/src/impl/CacheWriter.hpp
index c26b03f..e5f238a 100644
--- a/src/clicache/src/impl/CacheWriter.hpp
+++ b/src/clicache/src/impl/CacheWriter.hpp
@@ -49,38 +49,37 @@ namespace Apache
virtual bool BeforeUpdate( Apache::Geode::Client::EntryEvent<Object^, Object^>^ ev ) override
{
- EntryEvent<TKey, TValue> gevent(Client::GetNativePtr<apache::geode::client::EntryEvent>(ev));
+ EntryEvent<TKey, TValue> gevent(ev->GetNative());
return m_writer->BeforeUpdate(%gevent);
}
virtual bool BeforeCreate(Apache::Geode::Client::EntryEvent<Object^, Object^>^ ev) override
{
- EntryEvent<TKey, TValue> gevent(Client::GetNativePtr<apache::geode::client::EntryEvent>(ev));
+ EntryEvent<TKey, TValue> gevent(ev->GetNative());
return m_writer->BeforeCreate(%gevent);
}
virtual bool BeforeDestroy(Apache::Geode::Client::EntryEvent<Object^, Object^>^ ev) override
{
- EntryEvent<TKey, TValue> gevent(Client::GetNativePtr<apache::geode::client::EntryEvent>(ev));
+ EntryEvent<TKey, TValue> gevent(ev->GetNative());
return m_writer->BeforeDestroy(%gevent);
}
virtual bool BeforeRegionClear( Apache::Geode::Client::RegionEvent<Object^, Object^>^ ev ) override
{
- RegionEvent<TKey, TValue> gevent(Client::GetNativePtr<apache::geode::client::RegionEvent>(ev));
+ RegionEvent<TKey, TValue> gevent(ev->GetNative());
return m_writer->BeforeRegionClear(%gevent);
}
virtual bool BeforeRegionDestroy(Apache::Geode::Client::RegionEvent<Object^, Object^>^ ev) override
{
- RegionEvent<TKey, TValue> gevent(Client::GetNativePtr<apache::geode::client::RegionEvent>(ev));
+ RegionEvent<TKey, TValue> gevent(ev->GetNative());
return m_writer->BeforeRegionDestroy(%gevent);
}
virtual void Close(Apache::Geode::Client::Region<Object^, Object^>^ region) override
{
- IRegion<TKey, TValue>^ gregion = Apache::Geode::Client::Region<TKey, TValue>::Create(Client::GetNativePtr<apache::geode::client::Region>(region));
- m_writer->Close(gregion);
+ m_writer->Close((IRegion<TKey, TValue>^) region);
}
};
} // namespace Client
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/CqListenerProxy.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/CqListenerProxy.hpp b/src/clicache/src/impl/CqListenerProxy.hpp
index 3ecf477..86ae462 100644
--- a/src/clicache/src/impl/CqListenerProxy.hpp
+++ b/src/clicache/src/impl/CqListenerProxy.hpp
@@ -47,14 +47,14 @@ namespace Apache
virtual void OnEvent( Apache::Geode::Client::CqEvent<Object^, Object^>^ ev)
{
//TODO:split---Done
- CqEvent<TKey, TResult> gevent(GetNativePtr<apache::geode::client::CqEvent>(ev));
+ CqEvent<TKey, TResult> gevent(ev->GetNative());
m_listener->OnEvent(%gevent);
}
virtual void OnError(Apache::Geode::Client::CqEvent<Object^, Object^>^ ev)
{
//TODO::split--Done
- CqEvent<TKey, TResult> gevent(GetNativePtr<apache::geode::client::CqEvent>(ev));
+ CqEvent<TKey, TResult> gevent(ev->GetNative());
m_listener->OnError(%gevent);
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/CqStatusListenerProxy.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/CqStatusListenerProxy.hpp b/src/clicache/src/impl/CqStatusListenerProxy.hpp
index d2b4004..4ddcb2f 100644
--- a/src/clicache/src/impl/CqStatusListenerProxy.hpp
+++ b/src/clicache/src/impl/CqStatusListenerProxy.hpp
@@ -44,14 +44,14 @@ namespace Apache
virtual void OnEvent(Apache::Geode::Client::CqEvent<Object^, Object^>^ ev)
{
//TODO:split---Done
- CqEvent<TKey, TResult> gevent(GetNativePtr<apache::geode::client::CqEvent>(ev));
+ CqEvent<TKey, TResult> gevent(ev->GetNative());
m_listener->OnEvent(%gevent);
}
virtual void OnError( Apache::Geode::Client::CqEvent<Object^, Object^>^ ev)
{
//TODO::split--Done
- CqEvent<TKey, TResult> gevent(GetNativePtr<apache::geode::client::CqEvent>(ev));
+ CqEvent<TKey, TResult> gevent(ev->GetNative());
m_listener->OnError(%gevent);
}
[31/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from clicache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedAuthInitialize.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedAuthInitialize.cpp b/src/clicache/src/impl/ManagedAuthInitialize.cpp
index 67fef16..4ad28bb 100644
--- a/src/clicache/src/impl/ManagedAuthInitialize.cpp
+++ b/src/clicache/src/impl/ManagedAuthInitialize.cpp
@@ -174,11 +174,10 @@ namespace apache
securityprops, const char* server)
{
try {
- Apache::Geode::Client::Properties<String^, String^>^ mprops =
- Apache::Geode::Client::Properties<String^, String^>::Create<String^, String^>(securityprops.get());
+ auto mprops = Apache::Geode::Client::Properties<String^, String^>::Create(securityprops);
String^ mg_server = Apache::Geode::Client::ManagedString::Get(server);
- return PropertiesPtr(m_getCredentials->Invoke(mprops, mg_server)->NativePtr());
+ return m_getCredentials->Invoke(mprops, mg_server)->GetNative();
}
catch (Apache::Geode::Client::GeodeException^ ex) {
ex->ThrowNative();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedAuthInitialize.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedAuthInitialize.hpp b/src/clicache/src/impl/ManagedAuthInitialize.hpp
index 45c9e05..482a9e7 100644
--- a/src/clicache/src/impl/ManagedAuthInitialize.hpp
+++ b/src/clicache/src/impl/ManagedAuthInitialize.hpp
@@ -18,7 +18,10 @@
#pragma once
#include "../geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/AuthInitialize.hpp>
+#include "end_native.hpp"
+
#include <vcclr.h>
#include "../IAuthInitialize.hpp"
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedCacheListener.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCacheListener.cpp b/src/clicache/src/impl/ManagedCacheListener.cpp
index 56292ba..171eeb4 100644
--- a/src/clicache/src/impl/ManagedCacheListener.cpp
+++ b/src/clicache/src/impl/ManagedCacheListener.cpp
@@ -331,7 +331,7 @@ namespace apache
{
try {
Apache::Geode::Client::IRegion<Object^, Object^>^ mregion =
- Apache::Geode::Client::Region<Object^, Object^>::Create(region.get());
+ Apache::Geode::Client::Region<Object^, Object^>::Create(region);
m_managedptr->Close(mregion);
}
@@ -346,7 +346,7 @@ namespace apache
{
try {
Apache::Geode::Client::IRegion<Object^, Object^>^ mregion =
- Apache::Geode::Client::Region<Object^, Object^>::Create(region.get());
+ Apache::Geode::Client::Region<Object^, Object^>::Create(region);
m_managedptr->AfterRegionDisconnected(mregion);
}
catch (Apache::Geode::Client::GeodeException^ ex) {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedCacheListener.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCacheListener.hpp b/src/clicache/src/impl/ManagedCacheListener.hpp
index 0e32e6d..ccc80d7 100644
--- a/src/clicache/src/impl/ManagedCacheListener.hpp
+++ b/src/clicache/src/impl/ManagedCacheListener.hpp
@@ -19,7 +19,10 @@
#include "../geode_defs.hpp"
#include <vcclr.h>
+#include "begin_native.hpp"
#include <geode/CacheListener.hpp>
+#include "end_native.hpp"
+
#include "../ICacheListener.hpp"
namespace apache {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedCacheLoader.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCacheLoader.cpp b/src/clicache/src/impl/ManagedCacheLoader.cpp
index cba68db..21e9657 100644
--- a/src/clicache/src/impl/ManagedCacheLoader.cpp
+++ b/src/clicache/src/impl/ManagedCacheLoader.cpp
@@ -218,19 +218,6 @@ namespace apache
const CacheableKeyPtr& key, const UserDataPtr& aCallbackArgument)
{
try {
- /*
- Region<Object^, Object^>^ mregion =
- Region<Object^, Object^>::Create( region.ptr( ) );
-
- ICacheableKey^ mkey = SafeGenericUMKeyConvert( key.ptr( ) );
-
- IGeodeSerializable^ mcallbackArg = SafeGenericUMSerializableConvert(aCallbackArgument.get());
- */
-
- /*
- return apache::geode::client::CacheablePtr(SafeMSerializableConvert(
- m_managedptr->Load(mregion, mkey, mcallbackArg)));
- */
return m_managedptr->load(region, key, aCallbackArgument);
}
catch (Apache::Geode::Client::GeodeException^ ex) {
@@ -247,7 +234,7 @@ namespace apache
try {
/*
Apache::Geode::Client::Region^ mregion =
- Apache::Geode::Client::Region::Create( region.ptr( ) );
+ Apache::Geode::Client::Region::Create( region.get() );
*/
m_managedptr->close(region);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedCacheLoader.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCacheLoader.hpp b/src/clicache/src/impl/ManagedCacheLoader.hpp
index b59d8d5..4d09d49 100644
--- a/src/clicache/src/impl/ManagedCacheLoader.hpp
+++ b/src/clicache/src/impl/ManagedCacheLoader.hpp
@@ -19,7 +19,10 @@
#include "../geode_defs.hpp"
#include <vcclr.h>
+#include "begin_native.hpp"
#include <geode/CacheLoader.hpp>
+#include "end_native.hpp"
+
#include "../ICacheLoader.hpp"
#include "CacheLoader.hpp"
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedCacheWriter.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCacheWriter.cpp b/src/clicache/src/impl/ManagedCacheWriter.cpp
index e9077ae..646cf7e 100644
--- a/src/clicache/src/impl/ManagedCacheWriter.cpp
+++ b/src/clicache/src/impl/ManagedCacheWriter.cpp
@@ -298,7 +298,7 @@ namespace apache
{
try {
Apache::Geode::Client::IRegion<Object^, Object^>^ mregion =
- Apache::Geode::Client::Region<Object^, Object^>::Create(rp.get());
+ Apache::Geode::Client::Region<Object^, Object^>::Create(rp);
m_managedptr->Close(reinterpret_cast<Apache::Geode::Client::Region<Object^, Object^>^>(mregion));
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedCacheWriter.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCacheWriter.hpp b/src/clicache/src/impl/ManagedCacheWriter.hpp
index 9120a8d..0b6eba1 100644
--- a/src/clicache/src/impl/ManagedCacheWriter.hpp
+++ b/src/clicache/src/impl/ManagedCacheWriter.hpp
@@ -19,7 +19,10 @@
#include "../geode_defs.hpp"
#include <vcclr.h>
+#include "begin_native.hpp"
#include <geode/CacheWriter.hpp>
+#include "end_native.hpp"
+
#include "../ICacheWriter.hpp"
using namespace System;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedCacheableDelta.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCacheableDelta.cpp b/src/clicache/src/impl/ManagedCacheableDelta.cpp
index fb58f5a..75fc5cf 100644
--- a/src/clicache/src/impl/ManagedCacheableDelta.cpp
+++ b/src/clicache/src/impl/ManagedCacheableDelta.cpp
@@ -15,12 +15,14 @@
* limitations under the License.
*/
-//#include "../geode_includes.hpp"
+#include "begin_native.hpp"
+#include <GeodeTypeIdsImpl.hpp>
+#include "end_native.hpp"
+
#include "ManagedCacheableDelta.hpp"
#include "../DataInput.hpp"
#include "../DataOutput.hpp"
#include "../CacheableString.hpp"
-#include <GeodeTypeIdsImpl.hpp>
#include "../ExceptionTypes.hpp"
#include "SafeConvert.hpp"
@@ -240,7 +242,7 @@ namespace apache
bool ManagedCacheableDeltaGeneric::operator == (const ManagedCacheableDeltaGeneric& other) const
{
try {
- return m_managedptr->Equals(other.get());
+ return m_managedptr->Equals(other.ptr());
}
catch (Apache::Geode::Client::GeodeException^ ex) {
ex->ThrowNative();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedCacheableDelta.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCacheableDelta.hpp b/src/clicache/src/impl/ManagedCacheableDelta.hpp
index cb8e14d..a531178 100644
--- a/src/clicache/src/impl/ManagedCacheableDelta.hpp
+++ b/src/clicache/src/impl/ManagedCacheableDelta.hpp
@@ -19,7 +19,10 @@
#include "../geode_defs.hpp"
#include <vcclr.h>
+#include "begin_native.hpp"
#include <geode/Delta.hpp>
+#include "end_native.hpp"
+
#include "../IGeodeDelta.hpp"
#include "../IGeodeSerializable.hpp"
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedCacheableDeltaBytes.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCacheableDeltaBytes.cpp b/src/clicache/src/impl/ManagedCacheableDeltaBytes.cpp
index 494671d..e7f590c 100644
--- a/src/clicache/src/impl/ManagedCacheableDeltaBytes.cpp
+++ b/src/clicache/src/impl/ManagedCacheableDeltaBytes.cpp
@@ -15,12 +15,14 @@
* limitations under the License.
*/
-//#include "../geode_includes.hpp"
+#include "begin_native.hpp"
+#include <GeodeTypeIdsImpl.hpp>
+#include "end_native.hpp"
+
#include "ManagedCacheableDeltaBytes.hpp"
#include "../DataInput.hpp"
#include "../DataOutput.hpp"
#include "../CacheableString.hpp"
-#include <GeodeTypeIdsImpl.hpp>
#include "../ExceptionTypes.hpp"
#include "SafeConvert.hpp"
@@ -36,7 +38,7 @@ namespace apache
void ManagedCacheableDeltaBytesGeneric::toData(DataOutput& output) const
{
- Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytesGeneric::toData: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((int)this) + " with its domain ID: " + m_domainId);
+ Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytesGeneric::toData: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((uint64_t) this) + " with its domain ID: " + m_domainId);
try {
output.writeBytesOnly(m_bytes, m_size);
}
@@ -158,7 +160,7 @@ namespace apache
void ManagedCacheableDeltaBytesGeneric::toDelta(DataOutput& output) const
{
try {
- Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytes::toDelta: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((int)this) + " with its domain ID: " + m_domainId);
+ Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytes::toDelta: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((uint64_t) this) + " with its domain ID: " + m_domainId);
Apache::Geode::Client::IGeodeDelta^ deltaObj = this->getManagedObject();
Apache::Geode::Client::DataOutput mg_output(&output, true);
deltaObj->ToDelta(%mg_output);
@@ -184,7 +186,7 @@ namespace apache
dynamic_cast <Apache::Geode::Client::IGeodeSerializable^> (deltaObj);
if (managedptr != nullptr)
{
- Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytes::fromDelta: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((int)this) + " with its domain ID: " + m_domainId);
+ Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytes::fromDelta: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((uint64_t) this) + " with its domain ID: " + m_domainId);
Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytes::fromDelta: classid " + managedptr->ClassId + " : " + managedptr->ToString());
apache::geode::client::DataOutput dataOut;
Apache::Geode::Client::DataOutput mg_output(&dataOut, true);
@@ -288,7 +290,7 @@ namespace apache
Apache::Geode::Client::IGeodeSerializable^ obj =
Apache::Geode::Client::Serializable::GetTypeFactoryMethodGeneric(m_classId)();
obj->FromData(%mg_input);
- bool ret = obj->Equals(other.get());
+ bool ret = obj->Equals(other.ptr());
Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytesGeneric::equal return VAL = " + ret);
return ret;
//return obj->Equals(other.get());
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedCacheableDeltaBytes.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCacheableDeltaBytes.hpp b/src/clicache/src/impl/ManagedCacheableDeltaBytes.hpp
index aab663f..905d08a 100644
--- a/src/clicache/src/impl/ManagedCacheableDeltaBytes.hpp
+++ b/src/clicache/src/impl/ManagedCacheableDeltaBytes.hpp
@@ -19,7 +19,10 @@
#include "../geode_defs.hpp"
#include <vcclr.h>
+#include "begin_native.hpp"
#include <geode/Delta.hpp>
+#include "end_native.hpp"
+
#include "../Log.hpp"
#include "../DataOutput.hpp"
@@ -78,7 +81,7 @@ namespace apache
if (managedptr != nullptr)
{
m_classId = managedptr->ClassId;
- Apache::Geode::Client::Log::Finer("ManagedCacheableDeltaBytes::Constructor: current AppDomain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((int)this) + " with its AppDomain ID: " + m_domainId);
+ Apache::Geode::Client::Log::Finer("ManagedCacheableDeltaBytes::Constructor: current AppDomain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((uint64_t) this) + " with its AppDomain ID: " + m_domainId);
Apache::Geode::Client::Log::Finer("ManagedCacheableDeltaBytes::Constructor: class ID " + managedptr->ClassId + " : " + managedptr->ToString() + " storeBytes:" + storeBytes);
if (storeBytes)
{
@@ -111,7 +114,7 @@ namespace apache
if(managedptr != nullptr)
{
m_classId = managedptr->ClassId;
- Apache::Geode::Client::Log::Fine("ManagedCacheableDeltaBytes::Constructor: current AppDomain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((int)this) + " with its AppDomain ID: " + m_domainId);
+ Apache::Geode::Client::Log::Fine("ManagedCacheableDeltaBytes::Constructor: current AppDomain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((uint64_t) this) + " with its AppDomain ID: " + m_domainId);
Apache::Geode::Client::Log::Fine("ManagedCacheableDeltaBytes::Constructor: class ID " + managedptr->ClassId + " : " + managedptr->ToString());
apache::geode::client::DataOutput dataOut;
Apache::Geode::Client::DataOutput mg_output( &dataOut);
@@ -206,7 +209,7 @@ namespace apache
inline ~ManagedCacheableDeltaBytesGeneric()
{
- Apache::Geode::Client::Log::Finer("ManagedCacheableDeltaBytes::Destructor current AppDomain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((int)this) + " with its AppDomain ID: " + m_domainId);
+ Apache::Geode::Client::Log::Finer("ManagedCacheableDeltaBytes::Destructor current AppDomain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((uint64_t) this) + " with its AppDomain ID: " + m_domainId);
GF_SAFE_DELETE(m_bytes);
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedCacheableKey.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCacheableKey.cpp b/src/clicache/src/impl/ManagedCacheableKey.cpp
index e990c20..d30d41e 100644
--- a/src/clicache/src/impl/ManagedCacheableKey.cpp
+++ b/src/clicache/src/impl/ManagedCacheableKey.cpp
@@ -15,13 +15,15 @@
* limitations under the License.
*/
-//#include "../geode_includes.hpp"
+#include "begin_native.hpp"
+#include <GeodeTypeIdsImpl.hpp>
+#include "end_native.hpp"
+
#include "../ICacheableKey.hpp"
#include "ManagedCacheableKey.hpp"
#include "../DataInput.hpp"
#include "../DataOutput.hpp"
#include "../CacheableString.hpp"
-#include <GeodeTypeIdsImpl.hpp>
#include "../ExceptionTypes.hpp"
#include "../Log.hpp"
@@ -191,7 +193,7 @@ namespace apache
try {
return static_cast<Apache::Geode::Client::ICacheableKey^>(
(Apache::Geode::Client::IGeodeSerializable^)(Apache::Geode::Client::IGeodeSerializable^)m_managedptr)->Equals(
- static_cast<Apache::Geode::Client::ICacheableKey^>(other.get()));
+ static_cast<Apache::Geode::Client::ICacheableKey^>(other.ptr()));
}
catch (Apache::Geode::Client::GeodeException^ ex) {
ex->ThrowNative();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedCacheableKey.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCacheableKey.hpp b/src/clicache/src/impl/ManagedCacheableKey.hpp
index 9c7ea09..27fa215 100644
--- a/src/clicache/src/impl/ManagedCacheableKey.hpp
+++ b/src/clicache/src/impl/ManagedCacheableKey.hpp
@@ -19,8 +19,11 @@
#include "../geode_defs.hpp"
#include <vcclr.h>
+#include "begin_native.hpp"
#include <geode/CacheableKey.hpp>
#include <GeodeTypeIdsImpl.hpp>
+#include "end_native.hpp"
+
#include "../IGeodeSerializable.hpp"
using namespace System;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedCacheableKeyBytes.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCacheableKeyBytes.cpp b/src/clicache/src/impl/ManagedCacheableKeyBytes.cpp
index d8c5b56..5d39280 100644
--- a/src/clicache/src/impl/ManagedCacheableKeyBytes.cpp
+++ b/src/clicache/src/impl/ManagedCacheableKeyBytes.cpp
@@ -15,13 +15,15 @@
* limitations under the License.
*/
-//#include "../geode_includes.hpp"
+#include "begin_native.hpp"
+#include <GeodeTypeIdsImpl.hpp>
+#include "end_native.hpp"
+
#include "ManagedCacheableKeyBytes.hpp"
#include "../DataInput.hpp"
#include "../DataOutput.hpp"
#include "../Serializable.hpp"
#include "../CacheableString.hpp"
-#include <GeodeTypeIdsImpl.hpp>
#include "../ExceptionTypes.hpp"
#include "ManagedString.hpp"
@@ -36,7 +38,7 @@ namespace apache
{
void ManagedCacheableKeyBytesGeneric::toData(apache::geode::client::DataOutput& output) const
{
- Apache::Geode::Client::Log::Debug("ManagedCacheableKeyBytesGeneric::toData: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((int)this) + " with its domain ID: " + m_domainId);
+ Apache::Geode::Client::Log::Debug("ManagedCacheableKeyBytesGeneric::toData: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((uint64_t) this) + " with its domain ID: " + m_domainId);
try {
//TODO: I think this should work as it is
output.writeBytesOnly(m_bytes, m_size);
@@ -214,7 +216,7 @@ namespace apache
Apache::Geode::Client::IGeodeSerializable^ obj =
Apache::Geode::Client::Serializable::GetTypeFactoryMethodGeneric(m_classId)();
obj->FromData(%mg_input);
- bool ret = obj->Equals(other.get());
+ bool ret = obj->Equals(other.ptr());
Apache::Geode::Client::Log::Debug("ManagedCacheableKeyBytesGeneric::equal return VAL = " + ret);
return ret;
//return obj->Equals(other.get());
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedCacheableKeyBytes.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCacheableKeyBytes.hpp b/src/clicache/src/impl/ManagedCacheableKeyBytes.hpp
index 3a23a94..e0b4ecf 100644
--- a/src/clicache/src/impl/ManagedCacheableKeyBytes.hpp
+++ b/src/clicache/src/impl/ManagedCacheableKeyBytes.hpp
@@ -19,7 +19,10 @@
#include "../geode_defs.hpp"
#include <vcclr.h>
+#include "begin_native.hpp"
#include <geode/CacheableKey.hpp>
+#include "end_native.hpp"
+
#include "../Log.hpp"
#include "../DataOutput.hpp"
@@ -174,7 +177,7 @@ namespace apache
Apache::Geode::Client::Log::Fine(
"ManagedCacheableKeyBytes::Destructor current AppDomain ID: " +
System::Threading::Thread::GetDomainID() + " for object: " +
- System::Convert::ToString((int)this) + " with its AppDomain ID: " + m_domainId);
+ System::Convert::ToString((UInt64) this) + " with its AppDomain ID: " + m_domainId);
GF_SAFE_DELETE(m_bytes);
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedCqListener.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCqListener.hpp b/src/clicache/src/impl/ManagedCqListener.hpp
index 5dfbbc8..f5a3267 100644
--- a/src/clicache/src/impl/ManagedCqListener.hpp
+++ b/src/clicache/src/impl/ManagedCqListener.hpp
@@ -18,7 +18,10 @@
#pragma once
#include "../geode_defs.hpp"
#include <vcclr.h>
+#include "begin_native.hpp"
#include <geode/CqListener.hpp>
+#include "end_native.hpp"
+
//#include "../ICqListener.hpp"
#include "../ICqListener.hpp"
#include "CqListenerProxy.hpp"
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedCqStatusListener.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCqStatusListener.hpp b/src/clicache/src/impl/ManagedCqStatusListener.hpp
index 344e0c6..42a2988 100644
--- a/src/clicache/src/impl/ManagedCqStatusListener.hpp
+++ b/src/clicache/src/impl/ManagedCqStatusListener.hpp
@@ -19,7 +19,10 @@
#pragma once
#include "../geode_defs.hpp"
#include <vcclr.h>
+#include "begin_native.hpp"
#include <geode/CqStatusListener.hpp>
+#include "end_native.hpp"
+
#include "../ICqStatusListener.hpp"
#include "CqStatusListenerProxy.hpp"
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedFixedPartitionResolver.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedFixedPartitionResolver.hpp b/src/clicache/src/impl/ManagedFixedPartitionResolver.hpp
index 941fb7e..aba0bf0 100644
--- a/src/clicache/src/impl/ManagedFixedPartitionResolver.hpp
+++ b/src/clicache/src/impl/ManagedFixedPartitionResolver.hpp
@@ -19,7 +19,10 @@
#include "../geode_defs.hpp"
#include <vcclr.h>
+#include "begin_native.hpp"
#include <geode/FixedPartitionResolver.hpp>
+#include "end_native.hpp"
+
#include "FixedPartitionResolver.hpp"
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedPartitionResolver.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedPartitionResolver.hpp b/src/clicache/src/impl/ManagedPartitionResolver.hpp
index 2ff9cae..9640cf9 100644
--- a/src/clicache/src/impl/ManagedPartitionResolver.hpp
+++ b/src/clicache/src/impl/ManagedPartitionResolver.hpp
@@ -19,7 +19,10 @@
#include "../geode_defs.hpp"
#include <vcclr.h>
+#include "begin_native.hpp"
#include <geode/PartitionResolver.hpp>
+#include "end_native.hpp"
+
#include "PartitionResolver.hpp"
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedPersistenceManager.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedPersistenceManager.hpp b/src/clicache/src/impl/ManagedPersistenceManager.hpp
index 6648cc9..6f19e0a 100644
--- a/src/clicache/src/impl/ManagedPersistenceManager.hpp
+++ b/src/clicache/src/impl/ManagedPersistenceManager.hpp
@@ -19,7 +19,10 @@
#pragma once
#include "../geode_defs.hpp"
#include <vcclr.h>
+#include "begin_native.hpp"
#include <geode/PersistenceManager.hpp>
+#include "end_native.hpp"
+
#include "PersistenceManagerProxy.hpp"
namespace apache {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedResultCollector.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedResultCollector.cpp b/src/clicache/src/impl/ManagedResultCollector.cpp
index 2ac9e0a..91a353d 100644
--- a/src/clicache/src/impl/ManagedResultCollector.cpp
+++ b/src/clicache/src/impl/ManagedResultCollector.cpp
@@ -149,10 +149,8 @@ namespace apache
void ManagedResultCollectorGeneric::addResult(CacheablePtr& result)
{
try {
- //Apache::Geode::Client::IGeodeSerializable^ res = SafeUMSerializableConvertGeneric(result.get());
Object^ rs = Apache::Geode::Client::Serializable::GetManagedValueGeneric<Object^>(result);
m_managedptr->AddResult(rs);
- //m_managedptr->AddResult( SafeUMSerializableConvert( result.ptr( ) ) );
}
catch (Apache::Geode::Client::GeodeException^ ex) {
ex->ThrowNative();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedResultCollector.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedResultCollector.hpp b/src/clicache/src/impl/ManagedResultCollector.hpp
index bc1223f..a4eb34d 100644
--- a/src/clicache/src/impl/ManagedResultCollector.hpp
+++ b/src/clicache/src/impl/ManagedResultCollector.hpp
@@ -18,7 +18,10 @@
#pragma once
#include "../geode_defs.hpp"
#include <vcclr.h>
+#include "begin_native.hpp"
#include <geode/ResultCollector.hpp>
+#include "end_native.hpp"
+
//#include "../ResultCollector.hpp"
//#include "../IResultCollector.hpp"
//#include "../../../IResultCollector.hpp"
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedVisitor.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedVisitor.cpp b/src/clicache/src/impl/ManagedVisitor.cpp
index 3ab01a1..3808ea8 100644
--- a/src/clicache/src/impl/ManagedVisitor.cpp
+++ b/src/clicache/src/impl/ManagedVisitor.cpp
@@ -34,8 +34,8 @@ namespace apache
{
using namespace Apache::Geode::Client;
try {
- ICacheableKey^ mg_key(SafeGenericUMKeyConvert<ICacheableKey^>(key.get()));
- IGeodeSerializable^ mg_value(SafeUMSerializableConvertGeneric(value.get()));
+ ICacheableKey^ mg_key(SafeGenericUMKeyConvert<ICacheableKey^>(key));
+ IGeodeSerializable^ mg_value(SafeUMSerializableConvertGeneric(value));
m_visitor->Invoke(mg_key, (Apache::Geode::Client::IGeodeSerializable^)mg_value);
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedVisitor.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedVisitor.hpp b/src/clicache/src/impl/ManagedVisitor.hpp
index 229a482..a9f5947 100644
--- a/src/clicache/src/impl/ManagedVisitor.hpp
+++ b/src/clicache/src/impl/ManagedVisitor.hpp
@@ -19,7 +19,10 @@
#include "../geode_defs.hpp"
#include <vcclr.h>
+#include "begin_native.hpp"
#include <geode/Properties.hpp>
+#include "end_native.hpp"
+
#include "../Properties.hpp"
//using namespace apache::geode::client;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/MemoryPressureHandler.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/MemoryPressureHandler.cpp b/src/clicache/src/impl/MemoryPressureHandler.cpp
index bf3d80d..080fa3a 100644
--- a/src/clicache/src/impl/MemoryPressureHandler.cpp
+++ b/src/clicache/src/impl/MemoryPressureHandler.cpp
@@ -65,12 +65,11 @@ namespace Apache
return 0;
}
- int MemoryPressureHandler::handle_close( ACE_HANDLE handle,
- ACE_Reactor_Mask close_mask )
+ int MemoryPressureHandler::handle_close(ACE_HANDLE handle,
+ ACE_Reactor_Mask close_mask)
{
return 0;
+ }
} // namespace Client
} // namespace Geode
} // namespace Apache
-
- } //namespace
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/MemoryPressureHandler.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/MemoryPressureHandler.hpp b/src/clicache/src/impl/MemoryPressureHandler.hpp
index 59d2232..c8ac0e7 100644
--- a/src/clicache/src/impl/MemoryPressureHandler.hpp
+++ b/src/clicache/src/impl/MemoryPressureHandler.hpp
@@ -17,8 +17,10 @@
#pragma once
+#include "begin_native.hpp"
#include <geode/geode_globals.hpp>
#include <ExpiryTaskManager.hpp>
+#include "end_native.hpp"
namespace Apache
{
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/NativeWrapper.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/NativeWrapper.hpp b/src/clicache/src/impl/NativeWrapper.hpp
deleted file mode 100644
index dad7b6a..0000000
--- a/src/clicache/src/impl/NativeWrapper.hpp
+++ /dev/null
@@ -1,528 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-
-
-#include "../geode_defs.hpp"
-
-using namespace System;
-
-namespace Apache
-{
- namespace Geode
- {
- namespace Client
- {
-
- namespace Internal
- {
-
- /// <summary>
- /// Internal class used to keep a reference of the managed object
- /// alive while a method on the native object is in progress
- /// (fix for bug #309)
- /// </summary>
- template <typename TNative, typename TManaged>
- public value class ManagedPtrWrap
- {
- public:
- inline ManagedPtrWrap(TNative* nativePtr, TManaged^ mgObj) :
- m_nativePtr(nativePtr), m_mgObj(mgObj) { }
- inline TNative* operator->()
- {
- return m_nativePtr;
- }
- inline TNative* operator()()
- {
- return m_nativePtr;
- }
-
- private:
- TNative* m_nativePtr;
- TManaged^ m_mgObj;
- };
-
- /// <summary>
- /// Internal class to wrap native object pointers that derive from
- /// <c>SharedBase</c>; <c>NTYPE</c> is the native class.
- /// </summary>
- /// <remarks>
- /// <para>
- /// This is a convenience template class to wrap native class objects
- /// that derive from <c>SharedBase</c>.
- /// The native class objects can be of two kinds -- one that derive from
- /// SharedBase and are handled using smart pointers, and the second that
- /// do not derive from SharedBase. For the first category we have to invoke
- /// <c>preserveSB()</c> and <c>releaseSB()</c> on the native object during
- /// construction and dispose/finalization of the wrapped object.
- /// </para><para>
- /// All the managed wrapper classes that wrap corresponding native classes
- /// deriving from <c>SharedBase</c> should derive from this class.
- /// </para><para>
- /// <b>IMPORTANT:</b> Direct assignment of m_nativeptr has been disabled,
- /// rather the classes deriving from this should use
- /// <c>SBWrap.SetPtr</c> or <c>SBWrap._SetNativePtr</c>
- /// </para><para>
- /// This class is intentionally <b>not</b> thread-safe.
- /// </para>
- /// </remarks>
- template<typename NTYPE>
- public ref class SBWrap
- {
- public:
-
- /// <summary>
- /// The dispose function.
- /// </summary>
- inline ~SBWrap( )
- {
- InternalCleanup( );
- }
-
- /// <summary>
- /// The finalizer, for the case dispose is not called.
- /// </summary>
- inline !SBWrap( )
- {
- InternalCleanup( );
- }
-
-
- internal:
-
- /// <summary>
- /// Default constructor initializes the native pointer to null.
- /// </summary>
- inline SBWrap( ): m_nativeptr( nullptr ) { }
-
- /// <summary>
- /// Constructor to wrap the given native pointer.
- /// </summary>
- inline SBWrap( NTYPE* nativeptr ): m_nativeptr( nativeptr )
- {
- if (nativeptr != nullptr)
- {
- nativeptr->preserveSB( );
- }
- }
-
- /// <summary>
- /// Get the reference to underlying native object.
- /// </summary>
- /// <returns>
- /// The native pointer wrapped inside ManagedPtrWrap object.
- /// </returns>
- property ManagedPtrWrap< NTYPE, SBWrap<NTYPE> > NativePtr
- {
- inline ManagedPtrWrap< NTYPE, SBWrap<NTYPE> > get()
- {
- return ManagedPtrWrap< NTYPE, SBWrap<NTYPE> >(m_nativeptr, this);
- }
- }
-
- /// <summary>
- /// Get the underlying native pointer.
- /// DO NOT USE UNLESS YOU KNOW WHAT YOU ARE DOING. SEE BUG #309.
- /// </summary>
- /// <returns>The native pointer.</returns>
- property NTYPE* _NativePtr
- {
- inline NTYPE* get()
- {
- return m_nativeptr;
- }
- }
-
-
- protected:
-
- /// <summary>
- /// Used to set the native pointer to a new object. This should only be
- /// used when you know that the underlying object is NULL.
- /// </summary>
- inline void SetPtr( NTYPE* nativeptr )
- {
- if (nativeptr != nullptr)
- {
- nativeptr->preserveSB( );
- }
- m_nativeptr = nativeptr;
- }
-
- /// <summary>
- /// Used to assign the native pointer to a new object.
- /// </summary>
- /// <remarks>
- /// Note the order of preserveSB() and releaseSB(). This handles the
- /// corner case when <c>m_nativeptr</c> is same as <c>nativeptr</c>.
- /// </remarks>
- inline void AssignPtr( NTYPE* nativeptr )
- {
- if (nativeptr != nullptr) {
- nativeptr->preserveSB();
- }
- if (m_nativeptr != nullptr) {
- m_nativeptr->releaseSB();
- }
- m_nativeptr = nativeptr;
- }
-
- /// <summary>
- /// Set the native pointer to the new object without doing a
- /// preserveSB(). DO NOT USE UNLESS YOU KNOW WHAT YOU ARE DOING.
- /// </summary>
- inline void _SetNativePtr( NTYPE* nativeptr )
- {
- m_nativeptr = nativeptr;
- }
-
- /// <summary>
- /// Internal cleanup function invoked by dispose/finalizer.
- /// </summary>
- inline void InternalCleanup( )
- {
- if (m_nativeptr != nullptr)
- {
- m_nativeptr->releaseSB( );
- m_nativeptr = nullptr;
- }
- }
-
-
- private:
-
- NTYPE* m_nativeptr;
- };
-
-
- /// <summary>
- /// Internal class to wrap native object pointers that do not derive from
- /// <c>SharedBase</c>; <c>NTYPE</c> is the native class.
- /// </summary>
- /// <remarks>
- /// <para>
- /// This is a convenience template class to wrap native class objects
- /// that do not derive from SharedBase.
- /// </para><para>
- /// The constructors (and <c>SetPtr</c> method) of this class require a
- /// boolean parameter that informs whether or not to take ownership
- /// of the native object. When the ownership is taken, then the
- /// native object is destroyed when the wrapper object is
- /// disposed/finalized, otherwise it is not.
- /// </para><para>
- /// All the managed wrapper classes that wrap corresponding native classes
- /// not deriving from <c>SharedBase</c> should derive from this class.
- /// </para><para>
- /// <b>IMPORTANT</b>: Direct assignment of m_nativeptr has been disabled,
- /// rather the classes deriving from this should use <c>UMWrap.SetPtr</c>
- /// that also requires a boolean parameter to indicate whether or not
- /// to take ownership of the native object.
- /// </para><para>
- /// This class is intentionally <b>not</b> thread-safe.
- /// </para>
- /// </remarks>
- template<typename NTYPE>
- public ref class UMWrap
- {
- public:
-
- /// <summary>
- /// The dispose function.
- /// </summary>
- inline ~UMWrap( )
- {
- InternalCleanup( );
- }
-
- /// <summary>
- /// The finalizer, for the case dispose is not called.
- /// </summary>
- inline !UMWrap( )
- {
- InternalCleanup( );
- }
-
-
- internal:
-
- /// <summary>
- /// Default constructor assigns null to the native pointer and takes
- /// ownership of the object.
- /// </summary>
- inline UMWrap( )
- : m_nativeptr( nullptr ), m_own( true ) { }
-
- /// <summary>
- /// Constructor to wrap the given native object and inform about
- /// the ownership of the native object.
- /// </summary>
- inline UMWrap( NTYPE* nativeptr, bool own )
- : m_nativeptr( nativeptr ), m_own( own )
- {
- if (!own)
- {
- GC::SuppressFinalize( this );
- }
- }
-
- /// <summary>
- /// Get the reference to underlying native object.
- /// </summary>
- /// <returns>
- /// The native pointer wrapped inside NativePtrWrap object.
- /// </returns>
- property ManagedPtrWrap< NTYPE, UMWrap<NTYPE> > NativePtr
- {
- inline ManagedPtrWrap< NTYPE, UMWrap<NTYPE> > get()
- {
- return ManagedPtrWrap< NTYPE, UMWrap<NTYPE> >(m_nativeptr, this);
- }
- }
-
- /// <summary>
- /// Get the underlying native pointer.
- /// DO NOT USE UNLESS YOU KNOW WHAT YOU ARE DOING. SEE BUG #309.
- /// </summary>
- /// <returns>The native pointer.</returns>
- property NTYPE* _NativePtr
- {
- inline NTYPE* get()
- {
- return m_nativeptr;
- }
- }
-
-
- protected:
-
- /// <summary>
- /// Get or set the ownership of this object.
- /// </summary>
- /// <returns>True if the native object is owned by this object.</returns>
- property bool Own
- {
- inline bool get( )
- {
- return m_own;
- }
- inline void set( bool own )
- {
- if (m_own != own)
- {
- if (own)
- {
- GC::ReRegisterForFinalize( this );
- }
- else
- {
- GC::SuppressFinalize( this );
- }
- }
- m_own = own;
- }
- }
-
- /// <summary>
- /// Used to set the native pointer to a new object. This should only
- /// be used when you know that the underlying object is NULL
- /// or you do not own it.
- /// </summary>
- inline void SetPtr( NTYPE* nativeptr, bool own )
- {
- m_nativeptr = nativeptr;
- m_own = own;
- }
-
- /// <summary>
- /// Internal cleanup function invoked by dispose/finalizer.
- /// </summary>
- inline void InternalCleanup( )
- {
- if (m_own && m_nativeptr != nullptr)
- {
- delete m_nativeptr;
- m_nativeptr = nullptr;
- }
- }
-
-
- private:
-
- NTYPE* m_nativeptr;
- bool m_own;
- };
-
- /// <summary>
- /// Internal class to wrap native object pointers that do not derive from
- /// <c>SharedBase</c>; <c>NTYPE</c> is the native class.
- /// </summary>
- /// <remarks>
- /// <para>
- /// This is a convenience template class to wrap native class objects
- /// that do not derive from SharedBase.
- /// </para><para>
- /// The constructors (and <c>SetPtr</c> method) of this class require a
- /// boolean parameter that informs whether or not to take ownership
- /// of the native object. Even if the ownership is taken, the
- /// native object is purposefully not destroyed as the class that impelements
- /// it has the protected or the private destructor.
- /// </para><para>
- /// All the managed wrapper classes that wrap corresponding native classes
- /// not deriving from <c>SharedBase</c> should derive from this class.
- /// </para><para>
- /// <b>IMPORTANT</b>: Direct assignment of m_nativeptr has been disabled,
- /// rather the classes deriving from this should use <c>UMWrap.SetPtr</c>
- /// that also requires a boolean parameter to indicate whether or not
- /// to take ownership of the native object.
- /// </para><para>
- /// This class is intentionally <b>not</b> thread-safe.
- /// </para>
- /// </remarks>
- template<typename NTYPE>
- public ref class UMWrapN
- {
- public:
-
- /// <summary>
- /// The dispose function.
- /// </summary>
- inline ~UMWrapN( )
- {
- InternalCleanup( );
- }
-
- /// <summary>
- /// The finalizer, for the case dispose is not called.
- /// </summary>
- inline !UMWrapN( )
- {
- InternalCleanup( );
- }
-
- internal:
-
- /// <summary>
- /// Default constructor assigns null to the native pointer and takes
- /// ownership of the object.
- /// </summary>
- inline UMWrapN( )
- : m_nativeptr( nullptr ), m_own( true ) { }
-
- /// <summary>
- /// Constructor to wrap the given native object and inform about
- /// the ownership of the native object.
- /// </summary>
- inline UMWrapN( NTYPE* nativeptr, bool own )
- : m_nativeptr( nativeptr ), m_own( own )
- {
- if (!own)
- {
- GC::SuppressFinalize( this );
- }
- }
-
- /// <summary>
- /// Get the reference to underlying native object.
- /// </summary>
- /// <returns>
- /// The native pointer wrapped inside NativePtrWrap object.
- /// </returns>
- property ManagedPtrWrap< NTYPE, UMWrapN<NTYPE> > NativePtr
- {
- inline ManagedPtrWrap< NTYPE, UMWrapN<NTYPE> > get()
- {
- return ManagedPtrWrap< NTYPE, UMWrapN<NTYPE> >(m_nativeptr, this);
- }
- }
-
- /// <summary>
- /// Get the underlying native pointer.
- /// DO NOT USE UNLESS YOU KNOW WHAT YOU ARE DOING. SEE BUG #309.
- /// </summary>
- /// <returns>The native pointer.</returns>
- property NTYPE* _NativePtr
- {
- inline NTYPE* get()
- {
- return m_nativeptr;
- }
- }
-
- protected:
-
- /// <summary>
- /// Get or set the ownership of this object.
- /// </summary>
- /// <returns>True if the native object is owned by this object.</returns>
- property bool Own
- {
- inline bool get( )
- {
- return m_own;
- }
- inline void set( bool own )
- {
- if (m_own != own)
- {
- if (own)
- {
- GC::ReRegisterForFinalize( this );
- }
- else
- {
- GC::SuppressFinalize( this );
- }
- }
- m_own = own;
- }
- }
-
- /// <summary>
- /// Used to set the native pointer to a new object. This should only
- /// be used when you know that the underlying object is NULL
- /// or you do not own it.
- /// </summary>
- inline void SetPtr( NTYPE* nativeptr, bool own )
- {
- m_nativeptr = nativeptr;
- m_own = own;
- }
-
- /// <summary>
- /// Internal cleanup function invoked by dispose/finalizer.
- /// </summary>
- inline void InternalCleanup( )
- {
- if (m_own && m_nativeptr != nullptr)
- {
- // No deletion of m_nativeptr as the destructor is protected or private.
- }
- }
-
- private:
-
- NTYPE* m_nativeptr;
- bool m_own;
- };
- } // namespace Client
- } // namespace Geode
-} // namespace Apache
-
-}
-
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/PdxFieldType.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/PdxFieldType.cpp b/src/clicache/src/impl/PdxFieldType.cpp
index 3fe80ee..c319ccd 100644
--- a/src/clicache/src/impl/PdxFieldType.cpp
+++ b/src/clicache/src/impl/PdxFieldType.cpp
@@ -17,7 +17,10 @@
#pragma once
#include "PdxFieldType.hpp"
+#include "begin_native.hpp"
#include <geode/GeodeTypeIds.hpp>
+#include "end_native.hpp"
+
using namespace System;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/PdxHelper.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/PdxHelper.cpp b/src/clicache/src/impl/PdxHelper.cpp
index 03929b2..1d35467 100644
--- a/src/clicache/src/impl/PdxHelper.cpp
+++ b/src/clicache/src/impl/PdxHelper.cpp
@@ -17,6 +17,12 @@
#pragma once
+#include "begin_native.hpp"
+#include <CacheImpl.hpp>
+#include <CacheRegionHelper.hpp>
+#include <geode/Cache.hpp>
+#include "end_native.hpp"
+
#include "PdxHelper.hpp"
#include "PdxTypeRegistry.hpp"
#include "PdxWriterWithTypeCollector.hpp"
@@ -27,9 +33,7 @@
#include "PdxWrapper.hpp"
#include "../Log.hpp"
#include "PdxInstanceImpl.hpp"
-#include <CacheImpl.hpp>
-#include <CacheRegionHelper.hpp>
-#include <geode/Cache.hpp>
+
using namespace System;
namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/PdxHelper.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/PdxHelper.hpp b/src/clicache/src/impl/PdxHelper.hpp
index 43d51bb..80b2b80 100644
--- a/src/clicache/src/impl/PdxHelper.hpp
+++ b/src/clicache/src/impl/PdxHelper.hpp
@@ -17,7 +17,10 @@
#pragma once
//#include "../DataOutput.hpp"
+#include "begin_native.hpp"
#include <geode/DataOutput.hpp>
+#include "end_native.hpp"
+
#include "../IPdxSerializable.hpp"
using namespace System;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/PdxInstanceImpl.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/PdxInstanceImpl.cpp b/src/clicache/src/impl/PdxInstanceImpl.cpp
index 57027df..b4092f9 100755
--- a/src/clicache/src/impl/PdxInstanceImpl.cpp
+++ b/src/clicache/src/impl/PdxInstanceImpl.cpp
@@ -16,6 +16,13 @@
*/
#pragma once
+
+#include "begin_native.hpp"
+#include <CacheRegionHelper.hpp>
+#include <geode/Cache.hpp>
+#include <CacheImpl.hpp>
+#include "end_native.hpp"
+
#include "PdxInstanceImpl.hpp"
#include "PdxHelper.hpp"
#include "PdxTypeRegistry.hpp"
@@ -24,10 +31,8 @@
#include "PdxLocalWriter.hpp"
#include "../DataInput.hpp"
#include "DotNetTypes.hpp"
-#include <CacheRegionHelper.hpp>
-#include <geode/Cache.hpp>
-#include <CacheImpl.hpp>
#include "PdxType.hpp"
+
using namespace System::Text;
namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/PdxManagedCacheableKey.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/PdxManagedCacheableKey.cpp b/src/clicache/src/impl/PdxManagedCacheableKey.cpp
index 003a3f4..81fa5d2 100644
--- a/src/clicache/src/impl/PdxManagedCacheableKey.cpp
+++ b/src/clicache/src/impl/PdxManagedCacheableKey.cpp
@@ -17,11 +17,15 @@
*/
#pragma once
+
+#include "begin_native.hpp"
+#include <GeodeTypeIdsImpl.hpp>
+#include "end_native.hpp"
+
#include "PdxManagedCacheableKey.hpp"
#include "../DataInput.hpp"
#include "../DataOutput.hpp"
#include "../CacheableString.hpp"
-#include <GeodeTypeIdsImpl.hpp>
#include "../ExceptionTypes.hpp"
#include "ManagedString.hpp"
#include "PdxHelper.hpp"
@@ -180,7 +184,7 @@ namespace apache
bool PdxManagedCacheableKey::operator ==(const PdxManagedCacheableKey& other) const
{
try {
- return ((Apache::Geode::Client::IPdxSerializable^)m_managedptr)->Equals((other.get()));
+ return ((Apache::Geode::Client::IPdxSerializable^)m_managedptr)->Equals((other.ptr()));
}
catch (Apache::Geode::Client::GeodeException^ ex) {
ex->ThrowNative();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/PdxManagedCacheableKey.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/PdxManagedCacheableKey.hpp b/src/clicache/src/impl/PdxManagedCacheableKey.hpp
index 7280539..859319b 100644
--- a/src/clicache/src/impl/PdxManagedCacheableKey.hpp
+++ b/src/clicache/src/impl/PdxManagedCacheableKey.hpp
@@ -17,13 +17,18 @@
#pragma once
-#include "../geode_defs.hpp"
-#include <vcclr.h>
+#include "begin_native.hpp"
#include <geode/CacheableKey.hpp>
+#include <geode/Delta.hpp>
#include <GeodeTypeIdsImpl.hpp>
+#include "end_native.hpp"
+
+#include "../geode_defs.hpp"
+#include <vcclr.h>
+
#include "../IPdxSerializable.hpp"
-#include <geode/Delta.hpp>
#include "../IGeodeDelta.hpp"
+
using namespace System;
using namespace apache::geode::client;
namespace Apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/PdxManagedCacheableKeyBytes.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/PdxManagedCacheableKeyBytes.cpp b/src/clicache/src/impl/PdxManagedCacheableKeyBytes.cpp
index 5cc34de..cabe7d9 100644
--- a/src/clicache/src/impl/PdxManagedCacheableKeyBytes.cpp
+++ b/src/clicache/src/impl/PdxManagedCacheableKeyBytes.cpp
@@ -15,13 +15,15 @@
* limitations under the License.
*/
-//#include "../geode_includes.hpp"
+#include "begin_native.hpp"
+#include <GeodeTypeIdsImpl.hpp>
+#include "end_native.hpp"
+
#include "PdxManagedCacheableKeyBytes.hpp"
#include "../DataInput.hpp"
#include "../DataOutput.hpp"
#include "../Serializable.hpp"
#include "../CacheableString.hpp"
-#include <GeodeTypeIdsImpl.hpp>
#include "../ExceptionTypes.hpp"
#include "ManagedString.hpp"
#include "SafeConvert.hpp"
@@ -36,7 +38,7 @@ namespace apache
{
void PdxManagedCacheableKeyBytes::toData(apache::geode::client::DataOutput& output) const
{
- // Apache::Geode::Client::Log::Debug("PdxManagedCacheableKeyBytes::toData: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((int)this) + " with its domain ID: " + m_domainId );
+ // Apache::Geode::Client::Log::Debug("PdxManagedCacheableKeyBytes::toData: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((uint64_t) this) + " with its domain ID: " + m_domainId );
try {
//TODO: I think this should work as it is
output.writeBytesOnly(m_bytes, m_size);
@@ -219,7 +221,7 @@ namespace apache
Apache::Geode::Client::Serializable::GetTypeFactoryMethodGeneric(m_classId)();
obj->FromData(%mg_input);*/
Apache::Geode::Client::IPdxSerializable^ obj = getManagedObject();
- bool ret = obj->Equals(other.get());
+ bool ret = obj->Equals(other.ptr());
// Apache::Geode::Client::Log::Debug("PdxManagedCacheableKeyBytes::equal return VAL = " + ret);
return ret;
//return obj->Equals(other.get());
@@ -289,7 +291,7 @@ namespace apache
void PdxManagedCacheableKeyBytes::toDelta(DataOutput& output) const
{
try {
- Apache::Geode::Client::Log::Debug("PdxManagedCacheableKeyBytes::toDelta: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((int)this) + " with its domain ID: " + m_domainId);
+ Apache::Geode::Client::Log::Debug("PdxManagedCacheableKeyBytes::toDelta: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((uint64_t) this) + " with its domain ID: " + m_domainId);
Apache::Geode::Client::IGeodeDelta^ deltaObj = dynamic_cast<Apache::Geode::Client::IGeodeDelta^>(this->getManagedObject());
Apache::Geode::Client::DataOutput mg_output(&output, true);
deltaObj->ToDelta(%mg_output);
@@ -315,7 +317,7 @@ namespace apache
dynamic_cast <Apache::Geode::Client::IPdxSerializable^> (deltaObj);
// if(managedptr != nullptr)
{
- Apache::Geode::Client::Log::Debug("PdxManagedCacheableKeyBytes::fromDelta: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((int)this) + " with its domain ID: " + m_domainId);
+ Apache::Geode::Client::Log::Debug("PdxManagedCacheableKeyBytes::fromDelta: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((uint64_t) this) + " with its domain ID: " + m_domainId);
//Apache::Geode::Client::Log::Debug("PdxManagedCacheableKeyBytes::fromDelta: classid " + managedptr->ClassId + " : " + managedptr->ToString());
apache::geode::client::DataOutput dataOut;
Apache::Geode::Client::DataOutput mg_output(&dataOut, true);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/PdxManagedCacheableKeyBytes.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/PdxManagedCacheableKeyBytes.hpp b/src/clicache/src/impl/PdxManagedCacheableKeyBytes.hpp
index 787df4d..f9c1c9f 100644
--- a/src/clicache/src/impl/PdxManagedCacheableKeyBytes.hpp
+++ b/src/clicache/src/impl/PdxManagedCacheableKeyBytes.hpp
@@ -19,11 +19,17 @@
#include "../geode_defs.hpp"
#include <vcclr.h>
+#include "begin_native.hpp"
#include <geode/CacheableKey.hpp>
+#include "end_native.hpp"
+
#include "../Log.hpp"
#include "../DataOutput.hpp"
#include "PdxHelper.hpp"
+#include "begin_native.hpp"
#include <geode/Delta.hpp>
+#include "end_native.hpp"
+
using namespace System;
@@ -204,7 +210,7 @@ namespace apache
Apache::Geode::Client::Log::Fine(
"ManagedCacheableKeyBytes::Destructor current AppDomain ID: " +
System::Threading::Thread::GetDomainID() + " for object: " +
- System::Convert::ToString((int)this) + " with its AppDomain ID: " + m_domainId);
+ System::Convert::ToString((uint64_t) this) + " with its AppDomain ID: " + m_domainId);
GF_SAFE_DELETE(m_bytes);
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/PdxReaderWithTypeCollector.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/PdxReaderWithTypeCollector.cpp b/src/clicache/src/impl/PdxReaderWithTypeCollector.cpp
index 4aa9a21..b6107a5 100644
--- a/src/clicache/src/impl/PdxReaderWithTypeCollector.cpp
+++ b/src/clicache/src/impl/PdxReaderWithTypeCollector.cpp
@@ -16,7 +16,10 @@
*/
#include "PdxReaderWithTypeCollector.hpp"
+#include "begin_native.hpp"
#include <geode/GeodeTypeIds.hpp>
+#include "end_native.hpp"
+
#include "../GeodeClassIds.hpp"
using namespace System;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/PdxWriterWithTypeCollector.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/PdxWriterWithTypeCollector.cpp b/src/clicache/src/impl/PdxWriterWithTypeCollector.cpp
index 0c180aa..d95dbf5 100644
--- a/src/clicache/src/impl/PdxWriterWithTypeCollector.cpp
+++ b/src/clicache/src/impl/PdxWriterWithTypeCollector.cpp
@@ -17,7 +17,10 @@
#include "PdxWriterWithTypeCollector.hpp"
#include "../DataOutput.hpp"
+#include "begin_native.hpp"
#include <geode/GeodeTypeIds.hpp>
+#include "end_native.hpp"
+
#include "../GeodeClassIds.hpp"
#include "PdxHelper.hpp"
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/PersistenceManagerProxy.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/PersistenceManagerProxy.hpp b/src/clicache/src/impl/PersistenceManagerProxy.hpp
index fbbbb5e..a88d0bd 100644
--- a/src/clicache/src/impl/PersistenceManagerProxy.hpp
+++ b/src/clicache/src/impl/PersistenceManagerProxy.hpp
@@ -64,8 +64,8 @@ namespace Apache
virtual void init(const RegionPtr& region, PropertiesPtr& diskProperties)
{
- IRegion<TKey, TValue>^ gRegion = Region<TKey, TValue>::Create(region.get());
- Properties<String^, String^>^ gProps = Properties<String^, String^>::Create<String^, String^>(diskProperties.get());
+ auto gRegion = Region<TKey, TValue>::Create(region);
+ auto gProps = Properties<String^, String^>::Create(diskProperties);
m_persistenceManager->Init(gRegion, gProps);
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/RegionImpl.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/RegionImpl.hpp b/src/clicache/src/impl/RegionImpl.hpp
index 1eb891f..81d6dda 100644
--- a/src/clicache/src/impl/RegionImpl.hpp
+++ b/src/clicache/src/impl/RegionImpl.hpp
@@ -19,8 +19,11 @@
#include "../geode_defs.hpp"
#include "../../../IRegion.hpp"
+#include "begin_native.hpp"
#include <geode/Cache.hpp>
-#include "NativeWrapper.hpp"
+#include "end_native.hpp"
+
+
//#include "CacheableHashMap.hpp"
//#include "Log.hpp"
#include "../ExceptionTypes.hpp"
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/SafeConvert.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/SafeConvert.hpp b/src/clicache/src/impl/SafeConvert.hpp
index 8f8d091..69fe885 100644
--- a/src/clicache/src/impl/SafeConvert.hpp
+++ b/src/clicache/src/impl/SafeConvert.hpp
@@ -18,7 +18,7 @@
#pragma once
#include "../geode_defs.hpp"
-#include "NativeWrapper.hpp"
+
#include "ManagedCacheableKey.hpp"
#include "ManagedCacheableDelta.hpp"
#include "ManagedCacheableKeyBytes.hpp"
@@ -39,6 +39,7 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
interface class IPdxSerializable;
public ref class SafeConvertClassGeneric
@@ -58,67 +59,47 @@ namespace Apache
/// to managed <see cref="IGeodeSerializable" /> object.
/// </summary>
inline static Apache::Geode::Client::IGeodeSerializable^
- SafeUMSerializableConvertGeneric( apache::geode::client::Serializable* obj )
+ SafeUMSerializableConvertGeneric(native::SerializablePtr obj)
{
-
if (obj == nullptr) return nullptr;
-
- apache::geode::client::ManagedCacheableKeyGeneric* mg_obj = nullptr;
- apache::geode::client::ManagedCacheableKeyBytesGeneric* mg_bytesObj = nullptr;
- if(!SafeConvertClassGeneric::isAppDomainEnabled)
- mg_obj = dynamic_cast<apache::geode::client::ManagedCacheableKeyGeneric*>( obj );
- else
- mg_bytesObj = dynamic_cast<apache::geode::client::ManagedCacheableKeyBytesGeneric*>( obj );
-
- apache::geode::client::ManagedCacheableDeltaGeneric* mg_obj_delta = nullptr;
- apache::geode::client::ManagedCacheableDeltaBytesGeneric* mg_bytesObj_delta = nullptr;
-
- if (mg_obj != nullptr)
- {
- return mg_obj->ptr( );
- }
- else if(mg_bytesObj != nullptr)
- {
- return mg_bytesObj->ptr();
- }
- else
+ if (SafeConvertClassGeneric::isAppDomainEnabled)
{
- if(!SafeConvertClassGeneric::isAppDomainEnabled)
- mg_obj_delta = dynamic_cast<apache::geode::client::ManagedCacheableDeltaGeneric*>( obj );
- else
- mg_bytesObj_delta = dynamic_cast<apache::geode::client::ManagedCacheableDeltaBytesGeneric*>( obj );
-
- if( mg_obj_delta != nullptr )
+ if (auto mg_bytesObj = std::dynamic_pointer_cast<native::ManagedCacheableKeyBytesGeneric>(obj))
{
- return dynamic_cast<Apache::Geode::Client::IGeodeSerializable^>(mg_obj_delta->ptr( ));
+ return mg_bytesObj->ptr();
}
- else if(mg_bytesObj_delta != nullptr)
+ if (auto mg_bytesObj_delta = std::dynamic_pointer_cast<native::ManagedCacheableDeltaBytesGeneric>(obj))
{
- return dynamic_cast<Apache::Geode::Client::IGeodeSerializable^>(mg_bytesObj_delta->ptr( ));
+ return dynamic_cast<Apache::Geode::Client::IGeodeSerializable^>(mg_bytesObj_delta->ptr());
}
- else
+ }
+ else {
+ if (auto mg_obj = std::dynamic_pointer_cast<native::ManagedCacheableKeyGeneric>(obj))
{
- if ( obj->typeId( ) == 0 ) {
- //Special case for UserFunctionExecutionException which is not registered.
- apache::geode::client::UserFunctionExecutionException* mg_UFEEobj = nullptr;
- mg_UFEEobj = dynamic_cast<apache::geode::client::UserFunctionExecutionException*>( obj );
- if (mg_UFEEobj != nullptr)
- {
- return gcnew UserFunctionExecutionException(mg_UFEEobj);
- }
- }
-
- WrapperDelegateGeneric^ wrapperMethod =
- Apache::Geode::Client::Serializable::GetWrapperGeneric( obj->typeId( ) );
- if (wrapperMethod != nullptr)
- {
- return wrapperMethod( obj );
- }
+ return mg_obj->ptr();
+ }
+ if (auto mg_obj_delta = std::dynamic_pointer_cast<native::ManagedCacheableDeltaGeneric>(obj))
+ {
+ return dynamic_cast<Apache::Geode::Client::IGeodeSerializable^>(mg_obj_delta->ptr());
+ }
+ }
- return gcnew Apache::Geode::Client::Serializable( obj );
+ if (obj->typeId() == 0)
+ {
+ if (auto mg_UFEEobj = std::dynamic_pointer_cast<native::UserFunctionExecutionException>(obj))
+ {
+ return gcnew UserFunctionExecutionException(mg_UFEEobj);
}
}
+
+ auto wrapperMethod = Apache::Geode::Client::Serializable::GetWrapperGeneric( obj->typeId( ) );
+ if (wrapperMethod != nullptr)
+ {
+ return wrapperMethod( obj );
+ }
+
+ return gcnew Apache::Geode::Client::Serializable( obj );
}
/// <summary>
@@ -127,7 +108,7 @@ namespace Apache
/// <remarks>
/// <para>
/// Consider the scenario that we have both native objects of class
- /// <c>apache::geode::client::Serializable</c> and managed objects of class
+ /// <c>native::Serializable</c> and managed objects of class
/// <see cref="IGeodeSerializable" /> in a Region.
/// </para><para>
/// The former would be passed wrapped inside the
@@ -149,8 +130,8 @@ namespace Apache
inline static NativeType* SafeM2UMConvertGeneric( ManagedType^ mg_obj )
{
/*
- *return SafeM2UMConvertGeneric<IGeodeSerializable, apache::geode::client::ManagedCacheableKey,
- apache::geode::client::Serializable, Serializable>( mg_obj );
+ *return SafeM2UMConvertGeneric<IGeodeSerializable, native::ManagedCacheableKey,
+ native::Serializable, Serializable>( mg_obj );
*/
//TODO: need to look this further for all types
if (mg_obj == nullptr) return NULL;
@@ -168,15 +149,15 @@ namespace Apache
dynamic_cast<Apache::Geode::Client::IGeodeDelta^> (mg_obj);
if(sDelta != nullptr){
if(!SafeConvertClassGeneric::isAppDomainEnabled)
- return new apache::geode::client::ManagedCacheableDeltaGeneric( sDelta);
+ return new native::ManagedCacheableDeltaGeneric( sDelta);
else
- return new apache::geode::client::ManagedCacheableDeltaBytesGeneric( sDelta, true);
+ return new native::ManagedCacheableDeltaBytesGeneric( sDelta, true);
}
else{
if(!SafeConvertClassGeneric::isAppDomainEnabled)
return new ManagedWrapper(mg_obj, mg_obj->GetHashCode(), mg_obj->ClassId);
else
- return new apache::geode::client::ManagedCacheableKeyBytesGeneric( mg_obj, true);
+ return new native::ManagedCacheableKeyBytesGeneric( mg_obj, true);
}
}
//if (mg_obj == nullptr) return NULL;
@@ -190,83 +171,66 @@ namespace Apache
}
generic<class TValue>
- inline static TValue SafeGenericUMSerializableConvert( apache::geode::client::Serializable* obj )
+ inline static TValue SafeGenericUMSerializableConvert( native::SerializablePtr obj )
{
if (obj == nullptr) return TValue();
- apache::geode::client::ManagedCacheableKeyGeneric* mg_obj = nullptr;
- apache::geode::client::ManagedCacheableKeyBytesGeneric* mg_bytesObj = nullptr;
-
- if(!SafeConvertClassGeneric::isAppDomainEnabled)
- mg_obj = dynamic_cast<apache::geode::client::ManagedCacheableKeyGeneric*>( obj );
- else
- mg_bytesObj = dynamic_cast<apache::geode::client::ManagedCacheableKeyBytesGeneric*>( obj );
-
- apache::geode::client::ManagedCacheableDeltaGeneric* mg_obj_delta = nullptr;
- apache::geode::client::ManagedCacheableDeltaBytesGeneric* mg_bytesObj_delta = nullptr;
-
- if (mg_obj != nullptr)
- {
- return (TValue)mg_obj->ptr( );
- }
- else if(mg_bytesObj != nullptr)
- {
- return (TValue)mg_bytesObj->ptr();
- }
- else
+ if (SafeConvertClassGeneric::isAppDomainEnabled)
{
- if(!SafeConvertClassGeneric::isAppDomainEnabled)
- mg_obj_delta = dynamic_cast<apache::geode::client::ManagedCacheableDeltaGeneric*>( obj );
- else
- mg_bytesObj_delta = dynamic_cast<apache::geode::client::ManagedCacheableDeltaBytesGeneric*>( obj );
-
- if( mg_obj_delta != nullptr )
+ if (auto mg_bytesObj = std::dynamic_pointer_cast<native::ManagedCacheableKeyBytesGeneric>(obj))
{
- return safe_cast<TValue>(mg_obj_delta->ptr( ));
+ return (TValue)mg_bytesObj->ptr();
}
- else if(mg_bytesObj_delta != nullptr)
+ if (auto mg_bytesObj_delta = std::dynamic_pointer_cast<native::ManagedCacheableDeltaBytesGeneric>(obj))
{
- return safe_cast<TValue>(mg_bytesObj_delta->ptr( ));
+ return safe_cast<TValue>(mg_bytesObj_delta->ptr());
+ }
+ } else {
+ if (auto mg_obj = std::dynamic_pointer_cast<native::ManagedCacheableKeyGeneric>(obj))
+ {
+ return (TValue)mg_obj->ptr();
}
- else
- {
- if ( obj->typeId( ) == 0 ) {
- apache::geode::client::UserFunctionExecutionException* mg_UFEEobj = nullptr;
- mg_UFEEobj = dynamic_cast<apache::geode::client::UserFunctionExecutionException*>( obj );
- if (mg_UFEEobj != nullptr)
- {
- return safe_cast<TValue> (gcnew UserFunctionExecutionException(mg_UFEEobj));
- }
- }
- WrapperDelegateGeneric^ wrapperMethod =
- Apache::Geode::Client::Serializable::GetWrapperGeneric( obj->typeId( ) );
- if (wrapperMethod != nullptr)
- {
- return safe_cast<TValue>(wrapperMethod( obj ));
- }
- return safe_cast<TValue>(gcnew Apache::Geode::Client::Serializable( obj ));
+ if (auto mg_obj_delta = std::dynamic_pointer_cast<native::ManagedCacheableDeltaGeneric>(obj))
+ {
+ return safe_cast<TValue>(mg_obj_delta->ptr());
+ }
+ }
+
+ if (obj->typeId() == 0)
+ {
+ if (auto mg_UFEEobj = std::dynamic_pointer_cast<native::UserFunctionExecutionException>(obj))
+ {
+ return safe_cast<TValue> (gcnew UserFunctionExecutionException(mg_UFEEobj));
}
}
+
+ auto wrapperMethod = Apache::Geode::Client::Serializable::GetWrapperGeneric( obj->typeId( ) );
+ if (wrapperMethod != nullptr)
+ {
+ return safe_cast<TValue>(wrapperMethod( obj ));
+ }
+
+ return safe_cast<TValue>(gcnew Apache::Geode::Client::Serializable( obj ));
}
/// <summary>
/// Helper function to convert managed <see cref="IGeodeSerializable" />
- /// object to native <c>apache::geode::client::Serializable</c> object using
+ /// object to native <c>native::Serializable</c> object using
/// <c>SafeM2UMConvert</c>.
/// </summary>
- inline static apache::geode::client::Serializable* SafeMSerializableConvertGeneric(
+ inline static native::Serializable* SafeMSerializableConvertGeneric(
Apache::Geode::Client::IGeodeSerializable^ mg_obj )
{
//it is called for cacheables types only
return SafeM2UMConvertGeneric<Apache::Geode::Client::IGeodeSerializable,
- apache::geode::client::ManagedCacheableKeyGeneric, apache::geode::client::Serializable,
+ native::ManagedCacheableKeyGeneric, native::Serializable,
Apache::Geode::Client::Serializable>( mg_obj );
}
generic<class TValue>
- inline static apache::geode::client::Cacheable* SafeGenericM2UMConvert( TValue mg_val )
+ inline static native::Cacheable* SafeGenericM2UMConvert( TValue mg_val )
{
if (mg_val == nullptr) return NULL;
@@ -288,9 +252,9 @@ namespace Apache
{
//TODO:: probably need to do for appdomain
if(!SafeConvertClassGeneric::isAppDomainEnabled)
- return new apache::geode::client::PdxManagedCacheableKey(pdxType);
+ return new native::PdxManagedCacheableKey(pdxType);
else
- return new apache::geode::client::PdxManagedCacheableKeyBytes(pdxType, true);
+ return new native::PdxManagedCacheableKeyBytes(pdxType, true);
}
Apache::Geode::Client::IGeodeDelta^ sDelta =
@@ -298,9 +262,9 @@ namespace Apache
if(sDelta != nullptr)
{
if(!SafeConvertClassGeneric::isAppDomainEnabled)
- return new apache::geode::client::ManagedCacheableDeltaGeneric( sDelta);
+ return new native::ManagedCacheableDeltaGeneric( sDelta);
else
- return new apache::geode::client::ManagedCacheableDeltaBytesGeneric( sDelta, true);
+ return new native::ManagedCacheableDeltaBytesGeneric( sDelta, true);
}
else
{
@@ -310,11 +274,11 @@ namespace Apache
{
if(!SafeConvertClassGeneric::isAppDomainEnabled)
{
- return new apache::geode::client::ManagedCacheableKeyGeneric( tmpIGFS );
+ return new native::ManagedCacheableKeyGeneric( tmpIGFS );
}
else
{
- return new apache::geode::client::ManagedCacheableKeyBytesGeneric( tmpIGFS, true);
+ return new native::ManagedCacheableKeyBytesGeneric( tmpIGFS, true);
}
}
@@ -322,89 +286,76 @@ namespace Apache
{
//TODO:: probably need to do for appdomain
if(!SafeConvertClassGeneric::isAppDomainEnabled)
- return new apache::geode::client::PdxManagedCacheableKey(gcnew PdxWrapper(mg_obj));
+ return new native::PdxManagedCacheableKey(gcnew PdxWrapper(mg_obj));
else
- return new apache::geode::client::PdxManagedCacheableKeyBytes(gcnew PdxWrapper(mg_obj), true);
+ return new native::PdxManagedCacheableKeyBytes(gcnew PdxWrapper(mg_obj), true);
}
throw gcnew Apache::Geode::Client::IllegalStateException(String::Format("Unable to map object type {0}. Possible Object type may not be registered or PdxSerializer is not registered. ", mg_obj->GetType()));
}
}
generic<class TValue>
- inline static apache::geode::client::Cacheable* SafeGenericMSerializableConvert( TValue mg_obj )
+ inline static native::Cacheable* SafeGenericMSerializableConvert( TValue mg_obj )
{
return SafeGenericM2UMConvert<TValue>( mg_obj );
}
- inline static IPdxSerializable^ SafeUMSerializablePDXConvert( apache::geode::client::Serializable* obj )
+ inline static IPdxSerializable^ SafeUMSerializablePDXConvert( native::SerializablePtr obj )
{
- apache::geode::client::PdxManagedCacheableKey* mg_obj = nullptr;
-
- mg_obj = dynamic_cast<apache::geode::client::PdxManagedCacheableKey*>( obj );
-
- if(mg_obj != nullptr)
+ if(auto mg_obj = std::dynamic_pointer_cast<native::PdxManagedCacheableKey>( obj ))
return mg_obj->ptr();
- apache::geode::client::PdxManagedCacheableKeyBytes* mg_bytes = dynamic_cast<apache::geode::client::PdxManagedCacheableKeyBytes*>( obj );
-
- if(mg_bytes != nullptr)
+ if(auto mg_bytes = std::dynamic_pointer_cast<native::PdxManagedCacheableKeyBytes>( obj ))
return mg_bytes->ptr();
throw gcnew IllegalStateException("Not be able to deserialize managed type");
}
/// <summary>
- /// Helper function to convert native <c>apache::geode::client::CacheableKey</c> object
+ /// Helper function to convert native <c>native::CacheableKey</c> object
/// to managed <see cref="ICacheableKey" /> object.
/// </summary>
generic<class TKey>
- inline static Client::ICacheableKey^ SafeGenericUMKeyConvert( apache::geode::client::CacheableKey* obj )
+ inline static Client::ICacheableKey^ SafeGenericUMKeyConvert( native::CacheableKeyPtr obj )
{
//All cacheables will be ManagedCacheableKey only
if (obj == nullptr) return nullptr;
- apache::geode::client::ManagedCacheableKeyGeneric* mg_obj = nullptr;
- apache::geode::client::ManagedCacheableKeyBytesGeneric* mg_bytesObj = nullptr;
-
- if (!SafeConvertClassGeneric::isAppDomainEnabled)
- mg_obj = dynamic_cast<apache::geode::client::ManagedCacheableKeyGeneric*>( obj );
- else
- mg_bytesObj = dynamic_cast<apache::geode::client::ManagedCacheableKeyBytesGeneric*>( obj );
-
- if (mg_obj != nullptr)
+
+ if (SafeConvertClassGeneric::isAppDomainEnabled)
{
- return (Client::ICacheableKey^)mg_obj->ptr( );
+ if (auto mg_bytesObj = std::dynamic_pointer_cast<native::ManagedCacheableKeyBytesGeneric>(obj))
+ {
+ return (Client::ICacheableKey^)mg_bytesObj->ptr( );
+ }
}
- else if(mg_bytesObj != nullptr)
+ if (auto mg_obj = std::dynamic_pointer_cast<native::ManagedCacheableKeyGeneric>(obj))
{
- return (Client::ICacheableKey^)mg_bytesObj->ptr( );
+ return (Client::ICacheableKey^)mg_obj->ptr( );
}
- else
+
+ auto wrapperMethod = Apache::Geode::Client::Serializable::GetWrapperGeneric( obj->typeId( ) );
+ if (wrapperMethod != nullptr)
{
- WrapperDelegateGeneric^ wrapperMethod =
- Apache::Geode::Client::Serializable::GetWrapperGeneric( obj->typeId( ) );
- if (wrapperMethod != nullptr)
- {
- return (Client::ICacheableKey^)wrapperMethod( obj );
- }
- return gcnew Client::CacheableKey( obj );
+ return (Client::ICacheableKey^)wrapperMethod( obj );
}
+ return gcnew Client::CacheableKey( obj );
}
generic <class TKey>
- inline static apache::geode::client::CacheableKey* SafeGenericMKeyConvert( TKey mg_obj )
+ inline static native::CacheableKey* SafeGenericMKeyConvert( TKey mg_obj )
{
if (mg_obj == nullptr) return NULL;
- apache::geode::client::CacheableKey* obj = Apache::Geode::Client::Serializable::GetUnmanagedValueGeneric<TKey>( mg_obj ).get();
- if (obj != nullptr)
+ auto obj = Apache::Geode::Client::Serializable::GetUnmanagedValueGeneric<TKey>( mg_obj );
+ if (obj.get() != nullptr)
{
- return obj;
+ return obj.get();
}
else
{
if(!SafeConvertClassGeneric::isAppDomainEnabled)
- return new apache::geode::client::ManagedCacheableKeyGeneric( SafeUMSerializableConvertGeneric(obj) );
+ return new native::ManagedCacheableKeyGeneric( SafeUMSerializableConvertGeneric(obj) );
else
- return new apache::geode::client::ManagedCacheableKeyBytesGeneric( SafeUMSerializableConvertGeneric(obj), true );
+ return new native::ManagedCacheableKeyBytesGeneric( SafeUMSerializableConvertGeneric(obj), true );
}
}
@@ -413,41 +364,16 @@ namespace Apache
{
if (mg_obj == nullptr) return NULL;
//for cacheables types
- //return new apache::geode::client::ManagedCacheableKey(mg_obj, mg_obj->GetHashCode(), mg_obj->ClassId);
+ //return new native::ManagedCacheableKey(mg_obj, mg_obj->GetHashCode(), mg_obj->ClassId);
{
if(!SafeConvertClassGeneric::isAppDomainEnabled)
- return new apache::geode::client::ManagedCacheableKeyGeneric( mg_obj, mg_obj->GetHashCode(), mg_obj->ClassId );
+ return new native::ManagedCacheableKeyGeneric( mg_obj, mg_obj->GetHashCode(), mg_obj->ClassId );
else
- return new apache::geode::client::ManagedCacheableKeyBytesGeneric( mg_obj, true );
+ return new native::ManagedCacheableKeyBytesGeneric( mg_obj, true );
}
}
- template<typename NativeType> //where NativeType : apache::geode::client::SharedPtr<NativeType>
- //generic<typename ManagedType> where ManagedType : Internal::SBWrap<apache::geode::client::RegionAttributes>
- inline static NativeType* GetNativePtrFromSBWrap( Apache::Geode::Client::Internal::SBWrap<NativeType>^ mg_obj )
- {
- return (mg_obj != nullptr ? mg_obj->_NativePtr : NULL);
- }
-
- template<typename NativeType> //where NativeType : apache::geode::client::SharedPtr<NativeType>
- //generic<typename ManagedType> where ManagedType : Internal::SBWrap<apache::geode::client::RegionAttributes>
- inline static NativeType* GetNativePtrFromSBWrapGeneric( Apache::Geode::Client::Internal::SBWrap<NativeType>^ mg_obj )
- {
- return (mg_obj != nullptr ? mg_obj->_NativePtr : NULL);
- }
-
- template<typename NativeType>
- inline static NativeType* GetNativePtrFromUMWrap( Apache::Geode::Client::Internal::UMWrap<NativeType>^ mg_obj )
- {
- return (mg_obj != nullptr ? mg_obj->_NativePtr : NULL);
- }
-
- template<typename NativeType>
- inline static NativeType* GetNativePtrFromUMWrapGeneric( Apache::Geode::Client::Internal::UMWrap<NativeType>^ mg_obj )
- {
- return (mg_obj != nullptr ? mg_obj->_NativePtr : NULL);
} // namespace Client
} // namespace Geode
} // namespace Apache
-}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/native_conditional_unique_ptr.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/native_conditional_unique_ptr.hpp b/src/clicache/src/native_conditional_unique_ptr.hpp
new file mode 100644
index 0000000..aff0b47
--- /dev/null
+++ b/src/clicache/src/native_conditional_unique_ptr.hpp
@@ -0,0 +1,42 @@
+#pragma once
+
+#include <memory>
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ template <class _T>
+ public ref class native_conditional_unique_ptr sealed {
+ private:
+ std::unique_ptr<_T>* owned_ptr;
+ _T* unowned_ptr;
+
+ public:
+ native_conditional_unique_ptr(std::unique_ptr<_T> ptr) :
+ owned_ptr(new std::unique_ptr<_T>(std::move(ptr))),
+ unowned_ptr(__nullptr) {}
+
+ native_conditional_unique_ptr(_T* ptr) :
+ owned_ptr(__nullptr),
+ unowned_ptr(ptr) {}
+
+ ~native_conditional_unique_ptr() {
+ native_conditional_unique_ptr::!native_conditional_unique_ptr();
+ }
+
+ !native_conditional_unique_ptr() {
+ delete owned_ptr;
+ }
+
+ inline _T* get() {
+ return __nullptr == owned_ptr ? unowned_ptr : owned_ptr->get();
+ }
+
+ };
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/native_shared_ptr.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/native_shared_ptr.hpp b/src/clicache/src/native_shared_ptr.hpp
new file mode 100644
index 0000000..0e40ff9
--- /dev/null
+++ b/src/clicache/src/native_shared_ptr.hpp
@@ -0,0 +1,39 @@
+#pragma once
+
+#include <memory>
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ template <class _T>
+ public ref class native_shared_ptr sealed {
+ private:
+ std::shared_ptr<_T>* ptr;
+
+ public:
+ native_shared_ptr(const std::shared_ptr<_T>& ptr) : ptr(new std::shared_ptr<_T>(ptr)) {}
+
+ ~native_shared_ptr() {
+ native_shared_ptr::!native_shared_ptr();
+ }
+
+ !native_shared_ptr() {
+ delete ptr;
+ }
+
+ inline _T* get() {
+ return ptr->get();
+ }
+
+ inline std::shared_ptr<_T> get_shared_ptr() {
+ return *ptr;
+ }
+
+ };
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/native_unique_ptr.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/native_unique_ptr.hpp b/src/clicache/src/native_unique_ptr.hpp
new file mode 100644
index 0000000..bd8ff5f
--- /dev/null
+++ b/src/clicache/src/native_unique_ptr.hpp
@@ -0,0 +1,35 @@
+#pragma once
+
+#include <memory>
+
+namespace Apache
+{
+ namespace Geode
+ {
+ namespace Client
+ {
+
+ template <class _T>
+ public ref class native_unique_ptr sealed {
+ private:
+ std::unique_ptr<_T>* ptr;
+
+ public:
+ native_unique_ptr(std::unique_ptr<_T> ptr) : ptr(new std::unique_ptr<_T>(std::move(ptr))) {}
+
+ ~native_unique_ptr() {
+ native_unique_ptr::!native_unique_ptr();
+ }
+
+ !native_unique_ptr() {
+ delete ptr;
+ }
+
+ inline _T* get() {
+ return ptr->get();
+ }
+
+ };
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/test/AssemblyInfo.cpp.in
----------------------------------------------------------------------
diff --git a/src/clicache/test/AssemblyInfo.cpp.in b/src/clicache/test/AssemblyInfo.cpp.in
new file mode 100644
index 0000000..e3bbb9e
--- /dev/null
+++ b/src/clicache/test/AssemblyInfo.cpp.in
@@ -0,0 +1,32 @@
+using namespace System::Reflection;
+using namespace System::Runtime::CompilerServices;
+using namespace System::Runtime::InteropServices;
+
+//
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+//
+[assembly:AssemblyTitleAttribute("cliunittests")];
+[assembly:AssemblyDescriptionAttribute("")];
+[assembly:AssemblyConfigurationAttribute("")];
+[assembly:AssemblyCompanyAttribute("")];
+[assembly:AssemblyProductAttribute("cliunittests")];
+[assembly:AssemblyCopyrightAttribute("Copyright (c) 2017")];
+[assembly:AssemblyTrademarkAttribute("")];
+[assembly:AssemblyCultureAttribute("")];
+
+//
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the value or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+
+[assembly:AssemblyVersionAttribute("1.0.*")];
+[assembly:ComVisible(false)];
+
[42/46] geode-native git commit: GEODE-2741: Backs out workaround for
.NET Environment.Exit issues.
Posted by jb...@apache.org.
GEODE-2741: Backs out workaround for .NET Environment.Exit issues.
Project: http://git-wip-us.apache.org/repos/asf/geode-native/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode-native/commit/9a06e168
Tree: http://git-wip-us.apache.org/repos/asf/geode-native/tree/9a06e168
Diff: http://git-wip-us.apache.org/repos/asf/geode-native/diff/9a06e168
Branch: refs/heads/develop
Commit: 9a06e1681438c01e3f721f4a3f7b7576bedefd2a
Parents: 6027574
Author: Jacob Barrett <jb...@pivotal.io>
Authored: Tue May 16 13:24:16 2017 +0000
Committer: Jacob Barrett <jb...@pivotal.io>
Committed: Tue May 16 13:24:16 2017 +0000
----------------------------------------------------------------------
src/cppcache/include/geode/CacheFactory.hpp | 1 +
src/cppcache/src/CacheFactory.cpp | 5 ++---
2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode-native/blob/9a06e168/src/cppcache/include/geode/CacheFactory.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/CacheFactory.hpp b/src/cppcache/include/geode/CacheFactory.hpp
index ab3cbe0..5d519bb 100644
--- a/src/cppcache/include/geode/CacheFactory.hpp
+++ b/src/cppcache/include/geode/CacheFactory.hpp
@@ -494,6 +494,7 @@ class CPPCACHE_EXPORT CacheFactory
bool closeOk, CachePtr& cptr);
// Set very first time some creates cache
+ static CacheFactoryPtr default_CacheFactory;
static PoolPtr createOrGetDefaultPool();
static void* m_cacheMap;
static void init();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/9a06e168/src/cppcache/src/CacheFactory.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/src/CacheFactory.cpp b/src/cppcache/src/CacheFactory.cpp
index 43da0d0..ec332e5 100644
--- a/src/cppcache/src/CacheFactory.cpp
+++ b/src/cppcache/src/CacheFactory.cpp
@@ -55,8 +55,7 @@ typedef std::map<std::string, CachePtr> StringToCachePtrMap;
void* CacheFactory::m_cacheMap = (void*)NULL;
-// TODO: Why can't this be a shared_ptr?
-CacheFactory* default_CacheFactory = nullptr;
+CacheFactoryPtr CacheFactory::default_CacheFactory = nullptr;
PoolPtr CacheFactory::createOrGetDefaultPool() {
ACE_Guard<ACE_Recursive_Thread_Mutex> connectGuard(*g_disconnectLock);
@@ -226,7 +225,7 @@ CachePtr CacheFactory::create() {
cache = getAnyInstance(false);
if (cache == nullptr) {
- default_CacheFactory = this;
+ default_CacheFactory = shared_from_this();
Cache_CreatedFromCacheFactory = true;
cache = create(DEFAULT_CACHE_NAME, dsPtr,
dsPtr->getSystemProperties()->cacheXMLFile(), nullptr);
[33/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from clicache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/Serializable.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/Serializable.cpp b/src/clicache/src/Serializable.cpp
index a6ca57c..34ed0c7 100644
--- a/src/clicache/src/Serializable.cpp
+++ b/src/clicache/src/Serializable.cpp
@@ -15,23 +15,20 @@
* limitations under the License.
*/
+#include "begin_native.hpp"
#include <SerializationRegistry.hpp>
+#include "end_native.hpp"
+
+#include <msclr/lock.h>
-//#include "geode_includes.hpp"
#include "Serializable.hpp"
#include "impl/DelegateWrapper.hpp"
#include "DataOutput.hpp"
#include "DataInput.hpp"
-//#include "CacheableString.hpp"
#include "CacheableStringArray.hpp"
-//#include "Log.hpp"
-//
#include "CacheableBuiltins.hpp"
-//#include "ExceptionTypes.hpp"
#include "impl/SafeConvert.hpp"
-//#include <GeodeTypeIds.hpp>
-//#include "CacheableHashMap.hpp"
#include "CacheableHashTable.hpp"
#include "Struct.hpp"
#include "CacheableUndefined.hpp"
@@ -46,12 +43,9 @@
#include "IPdxSerializer.hpp"
#include "impl/DotNetTypes.hpp"
#pragma warning(disable:4091)
-#include <msclr/lock.h>
+
using namespace System::Reflection;
using namespace System::Reflection::Emit;
-//#include "CacheableArrayList.hpp"
-//#include "CacheableVector.hpp"
-//#include "impl/PdxManagedCacheableKey.hpp"
using namespace System;
using namespace System::Collections::Generic;
@@ -64,6 +58,7 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
void Apache::Geode::Client::Serializable::ToData(
Apache::Geode::Client::DataOutput^ output)
@@ -71,13 +66,21 @@ namespace Apache
if (output->IsManagedObject()) {
output->WriteBytesToUMDataOutput();
}
- apache::geode::client::DataOutput* nativeOutput =
- GetNativePtr<apache::geode::client::DataOutput>(output);
- NativePtr->toData(*nativeOutput);
+ try
+ {
+ auto nativeOutput = output->GetNative();
+ m_nativeptr->get()->toData(*nativeOutput);
+ }
+ finally
+ {
+ GC::KeepAlive(output);
+ GC::KeepAlive(m_nativeptr);
+ }
if (output->IsManagedObject()) {
output->SetBuffer();
}
}
+
Apache::Geode::Client::IGeodeSerializable^
Apache::Geode::Client::Serializable::FromData(
Apache::Geode::Client::DataInput^ input)
@@ -85,41 +88,75 @@ namespace Apache
if (input->IsManagedObject()) {
input->AdvanceUMCursor();
}
- apache::geode::client::DataInput* nativeInput =
- GetNativePtr<apache::geode::client::DataInput>(input);
- AssignSP(NativePtr->fromData(*nativeInput));
- if (input->IsManagedObject()) {
- input->SetBuffer();
+ auto* nativeInput = input->GetNative();
+
+ try
+ {
+ auto temp = m_nativeptr->get()->fromData(*nativeInput);
+ if (temp != m_nativeptr->get())
+ {
+ m_nativeptr->get_shared_ptr().reset(temp);
+ }
+
+ if (input->IsManagedObject()) {
+ input->SetBuffer();
+ }
+ return this;
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
}
- return this;
}
System::UInt32 Apache::Geode::Client::Serializable::ObjectSize::get()
{
- return NativePtr->objectSize();
+ try
+ {
+ return m_nativeptr->get()->objectSize();
+ }
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
+ }
}
System::UInt32 Apache::Geode::Client::Serializable::ClassId::get()
{
- int8_t typeId = NativePtr->typeId();
- if (typeId == apache::geode::client::GeodeTypeIdsImpl::CacheableUserData ||
- typeId == apache::geode::client::GeodeTypeIdsImpl::CacheableUserData2 ||
- typeId == apache::geode::client::GeodeTypeIdsImpl::CacheableUserData4) {
- return NativePtr->classId();
+ try
+ {
+ auto n = m_nativeptr->get();
+ int8_t typeId = n->typeId();
+ if (typeId == native::GeodeTypeIdsImpl::CacheableUserData ||
+ typeId == native::GeodeTypeIdsImpl::CacheableUserData2 ||
+ typeId == native::GeodeTypeIdsImpl::CacheableUserData4) {
+ return n->classId();
+ }
+ else {
+ return typeId + 0x80000000 + (0x20000000 * n->DSFID());
+ }
}
- else {
- return typeId + 0x80000000 + (0x20000000 * NativePtr->DSFID());
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
}
}
String^ Apache::Geode::Client::Serializable::ToString()
{
- apache::geode::client::CacheableStringPtr& cStr = NativePtr->toString();
- if (cStr->isWideString()) {
- return ManagedString::Get(cStr->asWChar());
+ try
+ {
+ auto cStr = m_nativeptr->get()->toString();
+ if (cStr->isWideString()) {
+ return ManagedString::Get(cStr->asWChar());
+ }
+ else {
+ return ManagedString::Get(cStr->asChar());
+ }
}
- else {
- return ManagedString::Get(cStr->asChar());
+ finally
+ {
+ GC::KeepAlive(m_nativeptr);
}
}
@@ -220,26 +257,26 @@ namespace Apache
System::Int32 Serializable::GetPDXIdForType(const char* poolName, IGeodeSerializable^ pdxType)
{
- apache::geode::client::CacheablePtr kPtr(SafeMSerializableConvertGeneric(pdxType));
- return apache::geode::client::SerializationRegistry::GetPDXIdForType(poolName, kPtr);
+ native::CacheablePtr kPtr(SafeMSerializableConvertGeneric(pdxType));
+ return native::SerializationRegistry::GetPDXIdForType(poolName, kPtr);
}
IGeodeSerializable^ Serializable::GetPDXTypeById(const char* poolName, System::Int32 typeId)
{
- SerializablePtr sPtr = apache::geode::client::SerializationRegistry::GetPDXTypeById(poolName, typeId);
- return SafeUMSerializableConvertGeneric(sPtr.get());
+ SerializablePtr sPtr = native::SerializationRegistry::GetPDXTypeById(poolName, typeId);
+ return SafeUMSerializableConvertGeneric(sPtr);
}
int Serializable::GetEnumValue(Internal::EnumInfo^ ei)
{
- apache::geode::client::CacheablePtr kPtr(SafeMSerializableConvertGeneric(ei));
- return apache::geode::client::SerializationRegistry::GetEnumValue(kPtr);
+ native::CacheablePtr kPtr(SafeMSerializableConvertGeneric(ei));
+ return native::SerializationRegistry::GetEnumValue(kPtr);
}
Internal::EnumInfo^ Serializable::GetEnum(int val)
{
- SerializablePtr sPtr = apache::geode::client::SerializationRegistry::GetEnum(val);
- return (Internal::EnumInfo^)SafeUMSerializableConvertGeneric(sPtr.get());
+ SerializablePtr sPtr = native::SerializationRegistry::GetEnum(val);
+ return (Internal::EnumInfo^)SafeUMSerializableConvertGeneric(sPtr);
}
void Serializable::RegisterPdxType(PdxTypeFactoryMethod^ creationMethod)
@@ -478,13 +515,13 @@ namespace Apache
{
if (!appDomainEnable)
{
- apache::geode::client::SerializationRegistry::addType(apache::geode::client::GeodeTypeIdsImpl::PDX,
- &apache::geode::client::PdxManagedCacheableKey::CreateDeserializable);
+ native::SerializationRegistry::addType(native::GeodeTypeIdsImpl::PDX,
+ &native::PdxManagedCacheableKey::CreateDeserializable);
}
else
{
- apache::geode::client::SerializationRegistry::addType(apache::geode::client::GeodeTypeIdsImpl::PDX,
- &apache::geode::client::PdxManagedCacheableKeyBytes::CreateDeserializable);
+ native::SerializationRegistry::addType(native::GeodeTypeIdsImpl::PDX,
+ &native::PdxManagedCacheableKeyBytes::CreateDeserializable);
}
}
@@ -518,7 +555,7 @@ namespace Apache
_GF_MG_EXCEPTION_TRY2
- apache::geode::client::Serializable::registerType((apache::geode::client::TypeFactoryMethod)
+ native::Serializable::registerType((native::TypeFactoryMethod)
System::Runtime::InteropServices::Marshal::
GetFunctionPointerForDelegate(nativeDelegate).ToPointer());
@@ -556,21 +593,21 @@ namespace Apache
{
if (tmp->ClassId < 0xa0000000)
{
- apache::geode::client::SerializationRegistry::addType(typeId,
- (apache::geode::client::TypeFactoryMethod)System::Runtime::InteropServices::
+ native::SerializationRegistry::addType(typeId,
+ (native::TypeFactoryMethod)System::Runtime::InteropServices::
Marshal::GetFunctionPointerForDelegate(
nativeDelegate).ToPointer());
}
else
{//special case for CacheableUndefined type
- apache::geode::client::SerializationRegistry::addType2(typeId,
- (apache::geode::client::TypeFactoryMethod)System::Runtime::InteropServices::
+ native::SerializationRegistry::addType2(typeId,
+ (native::TypeFactoryMethod)System::Runtime::InteropServices::
Marshal::GetFunctionPointerForDelegate(
nativeDelegate).ToPointer());
}
}
- catch (apache::geode::client::IllegalStateException&)
+ catch (native::IllegalStateException&)
{
//ignore it as this is internal only
}
@@ -581,7 +618,7 @@ namespace Apache
BuiltInDelegatesGeneric->Remove(typeId);
_GF_MG_EXCEPTION_TRY2
- apache::geode::client::SerializationRegistry::removeType(typeId);
+ native::SerializationRegistry::removeType(typeId);
_GF_MG_EXCEPTION_CATCH_ALL2
}
@@ -609,7 +646,7 @@ namespace Apache
}
generic<class TValue>
- TValue Serializable::GetManagedValueGeneric(apache::geode::client::SerializablePtr val)
+ TValue Serializable::GetManagedValueGeneric(native::SerializablePtr val)
{
if (val == nullptr)
{
@@ -620,7 +657,7 @@ namespace Apache
//Log::Debug("Serializable::GetManagedValueGeneric typeid = " + typeId);
switch (typeId)
{
- case apache::geode::client::GeodeTypeIds::CacheableByte:
+ case native::GeodeTypeIds::CacheableByte:
{
return (TValue)(int8_t)safe_cast<int8_t>(Serializable::getByte(val));
/* if (TValue::typeid == System::SByte::typeid) {
@@ -631,31 +668,31 @@ namespace Apache
}
return safe_cast<TValue>(Serializable::getByte(val));*/
}
- case apache::geode::client::GeodeTypeIds::CacheableBoolean:
+ case native::GeodeTypeIds::CacheableBoolean:
{
return safe_cast<TValue>(Serializable::getBoolean(val));
}
- case apache::geode::client::GeodeTypeIds::CacheableWideChar:
+ case native::GeodeTypeIds::CacheableWideChar:
{
return safe_cast<TValue>(Serializable::getChar(val));
}
- case apache::geode::client::GeodeTypeIds::CacheableDouble:
+ case native::GeodeTypeIds::CacheableDouble:
{
return safe_cast<TValue>(Serializable::getDouble(val));
}
- case apache::geode::client::GeodeTypeIds::CacheableASCIIString:
- case apache::geode::client::GeodeTypeIds::CacheableASCIIStringHuge:
- case apache::geode::client::GeodeTypeIds::CacheableString:
- case apache::geode::client::GeodeTypeIds::CacheableStringHuge:
+ case native::GeodeTypeIds::CacheableASCIIString:
+ case native::GeodeTypeIds::CacheableASCIIStringHuge:
+ case native::GeodeTypeIds::CacheableString:
+ case native::GeodeTypeIds::CacheableStringHuge:
{
//TODO: need to look all strings types
return safe_cast<TValue>(Serializable::getASCIIString(val));
}
- case apache::geode::client::GeodeTypeIds::CacheableFloat:
+ case native::GeodeTypeIds::CacheableFloat:
{
return safe_cast<TValue>(Serializable::getFloat(val));
}
- case apache::geode::client::GeodeTypeIds::CacheableInt16:
+ case native::GeodeTypeIds::CacheableInt16:
{
/* if (TValue::typeid == System::Int16::typeid) {
return (TValue)(System::Int16)safe_cast<System::Int16>(Serializable::getInt16(val));
@@ -665,7 +702,7 @@ namespace Apache
}*/
return safe_cast<TValue>(Serializable::getInt16(val));
}
- case apache::geode::client::GeodeTypeIds::CacheableInt32:
+ case native::GeodeTypeIds::CacheableInt32:
{
/* if (TValue::typeid == System::Int32::typeid) {
return (TValue)(System::Int32)safe_cast<System::Int32>(Serializable::getInt32(val));
@@ -675,7 +712,7 @@ namespace Apache
} */
return safe_cast<TValue>(Serializable::getInt32(val));
}
- case apache::geode::client::GeodeTypeIds::CacheableInt64:
+ case native::GeodeTypeIds::CacheableInt64:
{
/*if (TValue::typeid == System::Int64::typeid) {
return (TValue)(System::Int64)safe_cast<System::Int64>(Serializable::getInt64(val));
@@ -685,27 +722,27 @@ namespace Apache
}*/
return safe_cast<TValue>(Serializable::getInt64(val));
}
- case apache::geode::client::GeodeTypeIds::CacheableDate:
+ case native::GeodeTypeIds::CacheableDate:
{
//TODO::
Apache::Geode::Client::CacheableDate^ ret = static_cast<Apache::Geode::Client::CacheableDate ^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableDate^>(val.get()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableDate^>(val));
System::DateTime dt(ret->Value.Ticks);
return safe_cast<TValue>(dt);
}
- case apache::geode::client::GeodeTypeIdsImpl::CacheableUserData:
- case apache::geode::client::GeodeTypeIdsImpl::CacheableUserData2:
- case apache::geode::client::GeodeTypeIdsImpl::CacheableUserData4:
+ case native::GeodeTypeIdsImpl::CacheableUserData:
+ case native::GeodeTypeIdsImpl::CacheableUserData2:
+ case native::GeodeTypeIdsImpl::CacheableUserData4:
{
//TODO::split
- IGeodeSerializable^ ret = SafeUMSerializableConvertGeneric(val.get());
+ IGeodeSerializable^ ret = SafeUMSerializableConvertGeneric(val);
return safe_cast<TValue>(ret);
//return TValue();
}
- case apache::geode::client::GeodeTypeIdsImpl::PDX:
+ case native::GeodeTypeIdsImpl::PDX:
{
- IPdxSerializable^ ret = SafeUMSerializablePDXConvert(val.get());
+ IPdxSerializable^ ret = SafeUMSerializablePDXConvert(val);
PdxWrapper^ pdxWrapper = dynamic_cast<PdxWrapper^>(ret);
@@ -716,52 +753,52 @@ namespace Apache
return safe_cast<TValue>(ret);
}
- case apache::geode::client::GeodeTypeIds::CacheableBytes:
+ case native::GeodeTypeIds::CacheableBytes:
{
Apache::Geode::Client::CacheableBytes^ ret = safe_cast<Apache::Geode::Client::CacheableBytes ^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableBytes^>(val.get()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableBytes^>(val));
return safe_cast<TValue>(ret->Value);
}
- case apache::geode::client::GeodeTypeIds::CacheableDoubleArray:
+ case native::GeodeTypeIds::CacheableDoubleArray:
{
Apache::Geode::Client::CacheableDoubleArray^ ret = safe_cast<Apache::Geode::Client::CacheableDoubleArray ^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableDoubleArray^>(val.get()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableDoubleArray^>(val));
return safe_cast<TValue>(ret->Value);
}
- case apache::geode::client::GeodeTypeIds::CacheableFloatArray:
+ case native::GeodeTypeIds::CacheableFloatArray:
{
Apache::Geode::Client::CacheableFloatArray^ ret = safe_cast<Apache::Geode::Client::CacheableFloatArray^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableFloatArray^>(val.get()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableFloatArray^>(val));
return safe_cast<TValue>(ret->Value);
}
- case apache::geode::client::GeodeTypeIds::CacheableInt16Array:
+ case native::GeodeTypeIds::CacheableInt16Array:
{
Apache::Geode::Client::CacheableInt16Array^ ret = safe_cast<Apache::Geode::Client::CacheableInt16Array^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableInt16Array^>(val.get()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableInt16Array^>(val));
return safe_cast<TValue>(ret->Value);
}
- case apache::geode::client::GeodeTypeIds::CacheableInt32Array:
+ case native::GeodeTypeIds::CacheableInt32Array:
{
Apache::Geode::Client::CacheableInt32Array^ ret = safe_cast<Apache::Geode::Client::CacheableInt32Array^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableInt32Array^>(val.get()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableInt32Array^>(val));
return safe_cast<TValue>(ret->Value);
}
- case apache::geode::client::GeodeTypeIds::CacheableInt64Array:
+ case native::GeodeTypeIds::CacheableInt64Array:
{
Apache::Geode::Client::CacheableInt64Array^ ret = safe_cast<Apache::Geode::Client::CacheableInt64Array^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableInt64Array^>(val.get()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableInt64Array^>(val));
return safe_cast<TValue>(ret->Value);
}
- case apache::geode::client::GeodeTypeIds::CacheableStringArray:
+ case native::GeodeTypeIds::CacheableStringArray:
{
Apache::Geode::Client::CacheableStringArray^ ret = safe_cast<Apache::Geode::Client::CacheableStringArray^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableStringArray^>(val.get()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableStringArray^>(val));
/* array<String^>^ str = gcnew array<String^>(ret->GetValues()->Length);
for(int i=0; i<ret->GetValues()->Length; i++ ) {
@@ -770,125 +807,125 @@ namespace Apache
return safe_cast<TValue>(ret->GetValues());
}
- case apache::geode::client::GeodeTypeIds::CacheableArrayList://Ilist generic
+ case native::GeodeTypeIds::CacheableArrayList://Ilist generic
{
Apache::Geode::Client::CacheableArrayList^ ret = safe_cast<Apache::Geode::Client::CacheableArrayList^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableArrayList^>(val.get()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableArrayList^>(val));
return safe_cast<TValue>(ret->Value);
}
- case apache::geode::client::GeodeTypeIds::CacheableLinkedList://LinkedList generic
+ case native::GeodeTypeIds::CacheableLinkedList://LinkedList generic
{
Apache::Geode::Client::CacheableLinkedList^ ret = safe_cast<Apache::Geode::Client::CacheableLinkedList^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableLinkedList^>(val.get()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableLinkedList^>(val));
return safe_cast<TValue>(ret->Value);
}
- case apache::geode::client::GeodeTypeIds::CacheableHashTable://collection::hashtable
+ case native::GeodeTypeIds::CacheableHashTable://collection::hashtable
{
Apache::Geode::Client::CacheableHashTable^ ret = safe_cast<Apache::Geode::Client::CacheableHashTable^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableHashTable^>(val.get()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableHashTable^>(val));
return safe_cast<TValue>(ret->Value);
}
- case apache::geode::client::GeodeTypeIds::CacheableHashMap://generic dictionary
+ case native::GeodeTypeIds::CacheableHashMap://generic dictionary
{
Apache::Geode::Client::CacheableHashMap^ ret = safe_cast<Apache::Geode::Client::CacheableHashMap^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableHashMap^>(val.get()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableHashMap^>(val));
return safe_cast<TValue>(ret->Value);
}
- case apache::geode::client::GeodeTypeIds::CacheableIdentityHashMap:
+ case native::GeodeTypeIds::CacheableIdentityHashMap:
{
Apache::Geode::Client::CacheableIdentityHashMap^ ret = static_cast<Apache::Geode::Client::CacheableIdentityHashMap^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableIdentityHashMap^>(val.get()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableIdentityHashMap^>(val));
return safe_cast<TValue>(ret->Value);
}
- case apache::geode::client::GeodeTypeIds::CacheableHashSet://no need of it, default case should work
+ case native::GeodeTypeIds::CacheableHashSet://no need of it, default case should work
{
Apache::Geode::Client::CacheableHashSet^ ret = static_cast<Apache::Geode::Client::CacheableHashSet^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableHashSet^>(val.get()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableHashSet^>(val));
return safe_cast<TValue>(ret);
}
- case apache::geode::client::GeodeTypeIds::CacheableLinkedHashSet://no need of it, default case should work
+ case native::GeodeTypeIds::CacheableLinkedHashSet://no need of it, default case should work
{
Apache::Geode::Client::CacheableLinkedHashSet^ ret = static_cast<Apache::Geode::Client::CacheableLinkedHashSet^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableLinkedHashSet^>(val.get()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableLinkedHashSet^>(val));
return safe_cast<TValue>(ret);
}
- case apache::geode::client::GeodeTypeIds::CacheableFileName:
+ case native::GeodeTypeIds::CacheableFileName:
{
Apache::Geode::Client::CacheableFileName^ ret = static_cast<Apache::Geode::Client::CacheableFileName^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableFileName^>(val.get()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableFileName^>(val));
return safe_cast<TValue>(ret);
}
- case apache::geode::client::GeodeTypeIds::CacheableObjectArray:
+ case native::GeodeTypeIds::CacheableObjectArray:
{
Apache::Geode::Client::CacheableObjectArray^ ret = static_cast<Apache::Geode::Client::CacheableObjectArray^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableObjectArray^>(val.get()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableObjectArray^>(val));
return safe_cast<TValue>(ret);
}
- case apache::geode::client::GeodeTypeIds::CacheableVector://collection::arraylist
+ case native::GeodeTypeIds::CacheableVector://collection::arraylist
{
Apache::Geode::Client::CacheableVector^ ret = static_cast<Apache::Geode::Client::CacheableVector^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableVector^>(val.get()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableVector^>(val));
return safe_cast<TValue>(ret->Value);
}
- case apache::geode::client::GeodeTypeIds::CacheableUndefined:
+ case native::GeodeTypeIds::CacheableUndefined:
{
Apache::Geode::Client::CacheableUndefined^ ret = static_cast<Apache::Geode::Client::CacheableUndefined^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableUndefined^>(val.get()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableUndefined^>(val));
return safe_cast<TValue>(ret);
}
- case apache::geode::client::GeodeTypeIds::Struct:
+ case native::GeodeTypeIds::Struct:
{
- return safe_cast<TValue>(Apache::Geode::Client::Struct::Create(val.get()));
+ return safe_cast<TValue>(Apache::Geode::Client::Struct::Create(val));
}
- case apache::geode::client::GeodeTypeIds::CacheableStack:
+ case native::GeodeTypeIds::CacheableStack:
{
Apache::Geode::Client::CacheableStack^ ret = static_cast<Apache::Geode::Client::CacheableStack^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableStack^>(val.get()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableStack^>(val));
return safe_cast<TValue>(ret->Value);
}
case 7: //GeodeClassIds::CacheableManagedObject
{
Apache::Geode::Client::CacheableObject^ ret = static_cast<Apache::Geode::Client::CacheableObject^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableObject^>(val.get()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableObject^>(val));
return safe_cast<TValue>(ret);
}
case 8://GeodeClassIds::CacheableManagedObjectXml
{
Apache::Geode::Client::CacheableObjectXml^ ret = static_cast<Apache::Geode::Client::CacheableObjectXml^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableObjectXml^>(val.get()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableObjectXml^>(val));
return safe_cast<TValue>(ret);
}
/* TODO: replace with IDictionary<K, V>
- case apache::geode::client::GeodeTypeIds::Properties:
+ case native::GeodeTypeIds::Properties:
{
Apache::Geode::Client::Properties^ ret = safe_cast<Apache::Geode::Client::Properties^>
- ( SafeGenericUMSerializableConvert<Apache::Geode::Client::Properties^>(val.get()));
+ ( SafeGenericUMSerializableConvert<Apache::Geode::Client::Properties^>(val));
return safe_cast<TValue>(ret);
}*/
- case apache::geode::client::GeodeTypeIds::BooleanArray:
+ case native::GeodeTypeIds::BooleanArray:
{
Apache::Geode::Client::BooleanArray^ ret = safe_cast<Apache::Geode::Client::BooleanArray^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::BooleanArray^>(val.get()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::BooleanArray^>(val));
return safe_cast<TValue>(ret->Value);
}
- case apache::geode::client::GeodeTypeIds::CharArray:
+ case native::GeodeTypeIds::CharArray:
{
Apache::Geode::Client::CharArray^ ret = safe_cast<Apache::Geode::Client::CharArray^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CharArray^>(val.get()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CharArray^>(val));
return safe_cast<TValue>(ret->Value);
}
case 0://UserFunctionExecutionException unregistered
{
Apache::Geode::Client::UserFunctionExecutionException^ ret = static_cast<Apache::Geode::Client::UserFunctionExecutionException^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::UserFunctionExecutionException^>(val.get()));
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::UserFunctionExecutionException^>(val));
return safe_cast<TValue>(ret);
}
default:
@@ -898,7 +935,7 @@ namespace Apache
}
generic<class TKey>
- apache::geode::client::CacheableKeyPtr Serializable::GetUnmanagedValueGeneric(TKey key)
+ native::CacheableKeyPtr Serializable::GetUnmanagedValueGeneric(TKey key)
{
//System::Type^ managedType = TKey::typeid;
if (key != nullptr) {
@@ -909,7 +946,7 @@ namespace Apache
}
generic<class TKey>
- apache::geode::client::CacheableKeyPtr Serializable::GetUnmanagedValueGeneric(TKey key, bool isAciiChar)
+ native::CacheableKeyPtr Serializable::GetUnmanagedValueGeneric(TKey key, bool isAciiChar)
{
//System::Type^ managedType = TKey::typeid;
if (key != nullptr) {
@@ -1025,251 +1062,173 @@ namespace Apache
bool Serializable::IsObjectAndPdxSerializerRegistered(String^ className)
{
return PdxSerializer != nullptr;
- // return CreateObject(className) != nullptr;
- /* if(PdxSerializer != nullptr)
- {
- FactoryMethod^ retVal = nullptr;
- PdxSerializerObjectDelegateMap->TryGetValue(className, retVal);
- return retVal != nullptr;
- }*/
- //return false;
}
generic<class TKey>
- apache::geode::client::CacheableKeyPtr Serializable::GetUnmanagedValueGeneric(
+ native::CacheableKeyPtr Serializable::GetUnmanagedValueGeneric(
Type^ managedType, TKey key)
{
return GetUnmanagedValueGeneric(managedType, key, false);
}
generic<class TKey>
- apache::geode::client::CacheableKeyPtr Serializable::GetUnmanagedValueGeneric(
+ native::CacheableKeyPtr Serializable::GetUnmanagedValueGeneric(
Type^ managedType, TKey key, bool isAsciiChar)
{
Byte typeId = Apache::Geode::Client::Serializable::GetManagedTypeMappingGeneric(managedType);
switch (typeId)
{
- case apache::geode::client::GeodeTypeIds::CacheableByte: {
+ case native::GeodeTypeIds::CacheableByte: {
return Serializable::getCacheableByte((SByte)key);
- /* if( managedType == System::SByte::typeid )
- {
- return Serializable::getCacheableByte((SByte)key);
- }
- else
- {
- return Serializable::getCacheableByte((Byte)key);
- }*/
}
- case apache::geode::client::GeodeTypeIds::CacheableBoolean:
+ case native::GeodeTypeIds::CacheableBoolean:
return Serializable::getCacheableBoolean((bool)key);
- case apache::geode::client::GeodeTypeIds::CacheableWideChar:
+ case native::GeodeTypeIds::CacheableWideChar:
return Serializable::getCacheableWideChar((Char)key);
- case apache::geode::client::GeodeTypeIds::CacheableDouble:
+ case native::GeodeTypeIds::CacheableDouble:
return Serializable::getCacheableDouble((double)key);
- case apache::geode::client::GeodeTypeIds::CacheableASCIIString: {
+ case native::GeodeTypeIds::CacheableASCIIString: {
if (isAsciiChar)
return Serializable::getCacheableASCIIString2((String^)key);
else
return Serializable::getCacheableASCIIString((String^)key);
}
- case apache::geode::client::GeodeTypeIds::CacheableFloat:
+ case native::GeodeTypeIds::CacheableFloat:
return Serializable::getCacheableFloat((float)key);
- case apache::geode::client::GeodeTypeIds::CacheableInt16: {
- /*if( managedType == System::Int16::typeid )
- {
- return Serializable::getCacheableInt16((System::Int16)key);
- }
- else
- {
- return Serializable::getCacheableInt16((System::UInt16)key);
- }*/
+ case native::GeodeTypeIds::CacheableInt16: {
return Serializable::getCacheableInt16((System::Int16)key);
}
- case apache::geode::client::GeodeTypeIds::CacheableInt32: {
- /* if( managedType == System::Int32::typeid )
- {
- return Serializable::getCacheableInt32((System::Int32)key);
- }
- else
- {
- return Serializable::getCacheableInt32((System::Int32)key);
- }*/
+ case native::GeodeTypeIds::CacheableInt32: {
return Serializable::getCacheableInt32((System::Int32)key);
}
- case apache::geode::client::GeodeTypeIds::CacheableInt64: {
- /*if( managedType == System::Int64::typeid )
- {
- return Serializable::getCacheableInt64((System::Int64)key);
- }
- else
- {
- return Serializable::getCacheableInt64((System::UInt64)key);
- }*/
+ case native::GeodeTypeIds::CacheableInt64: {
return Serializable::getCacheableInt64((System::Int64)key);
}
- case apache::geode::client::GeodeTypeIds::CacheableBytes:
+ case native::GeodeTypeIds::CacheableBytes:
{
- apache::geode::client::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableBytes::Create((array<Byte>^)key)));
- return kPtr;
- /*if( managedType == Type::GetType("System.Byte[]") ) {
- apache::geode::client::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableBytes::Create((array<Byte>^)key)));
- return kPtr;
- }
- else {
- apache::geode::client::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableBytes::Create(getSByteArray((array<SByte>^)key))));
- return kPtr;
- }*/
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableBytes::Create((array<Byte>^)key)));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
- case apache::geode::client::GeodeTypeIds::CacheableDoubleArray:
+ case native::GeodeTypeIds::CacheableDoubleArray:
{
- apache::geode::client::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableDoubleArray::Create((array<Double>^)key)));
- return kPtr;
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableDoubleArray::Create((array<Double>^)key)));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
- case apache::geode::client::GeodeTypeIds::CacheableFloatArray:
+ case native::GeodeTypeIds::CacheableFloatArray:
{
- apache::geode::client::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableFloatArray::Create((array<float>^)key)));
- return kPtr;
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableFloatArray::Create((array<float>^)key)));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
- case apache::geode::client::GeodeTypeIds::CacheableInt16Array:
+ case native::GeodeTypeIds::CacheableInt16Array:
{
- apache::geode::client::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableInt16Array::Create((array<Int16>^)key)));
- return kPtr;
- /* if( managedType == Type::GetType("System.Int16[]") ) {
- apache::geode::client::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableInt16Array::Create((array<Int16>^)key)));
- return kPtr;
- }
- else {
- apache::geode::client::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableInt16Array::Create(getInt16Array((array<System::UInt16>^)key))));
- return kPtr;
- } */
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableInt16Array::Create((array<Int16>^)key)));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
- case apache::geode::client::GeodeTypeIds::CacheableInt32Array:
+ case native::GeodeTypeIds::CacheableInt32Array:
{
- apache::geode::client::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableInt32Array::Create((array<Int32>^)key)));
- return kPtr;
- /* if( managedType == Type::GetType("System.Int32[]") ) {
- apache::geode::client::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableInt32Array::Create((array<Int32>^)key)));
- return kPtr;
- }
- else {
- apache::geode::client::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableInt32Array::Create(getInt32Array((array<System::UInt32>^)key))));
- return kPtr;
- } */
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableInt32Array::Create((array<Int32>^)key)));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
- case apache::geode::client::GeodeTypeIds::CacheableInt64Array:
+ case native::GeodeTypeIds::CacheableInt64Array:
{
- apache::geode::client::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableInt64Array::Create((array<Int64>^)key)));
- return kPtr;
- /*if( managedType == Type::GetType("System.Int64[]") ) {
- apache::geode::client::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableInt64Array::Create((array<Int64>^)key)));
- return kPtr;
- }
- else {
- apache::geode::client::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableInt64Array::Create(getInt64Array((array<System::UInt64>^)key))));
- return kPtr;
- } */
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableInt64Array::Create((array<Int64>^)key)));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
- case apache::geode::client::GeodeTypeIds::CacheableStringArray:
+ case native::GeodeTypeIds::CacheableStringArray:
{
- apache::geode::client::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableStringArray::Create((array<String^>^)key)));
- return kPtr;
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableStringArray::Create((array<String^>^)key)));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
- case apache::geode::client::GeodeTypeIds::CacheableFileName:
+ case native::GeodeTypeIds::CacheableFileName:
{
- apache::geode::client::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)(Apache::Geode::Client::CacheableFileName^)key));
- return kPtr;
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)(Apache::Geode::Client::CacheableFileName^)key));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
- case apache::geode::client::GeodeTypeIds::CacheableHashTable://collection::hashtable
+ case native::GeodeTypeIds::CacheableHashTable://collection::hashtable
{
- apache::geode::client::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableHashTable::Create((System::Collections::Hashtable^)key)));
- return kPtr;
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableHashTable::Create((System::Collections::Hashtable^)key)));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
- case apache::geode::client::GeodeTypeIds::CacheableHashMap://generic dictionary
+ case native::GeodeTypeIds::CacheableHashMap://generic dictionary
{
- apache::geode::client::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableHashMap::Create((System::Collections::IDictionary^)key)));
- return kPtr;
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableHashMap::Create((System::Collections::IDictionary^)key)));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
- case apache::geode::client::GeodeTypeIds::CacheableVector://collection::arraylist
+ case native::GeodeTypeIds::CacheableVector://collection::arraylist
{
- apache::geode::client::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)CacheableVector::Create((System::Collections::IList^)key)));
- return kPtr;
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)CacheableVector::Create((System::Collections::IList^)key)));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
- case apache::geode::client::GeodeTypeIds::CacheableArrayList://generic ilist
+ case native::GeodeTypeIds::CacheableArrayList://generic ilist
{
- apache::geode::client::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableArrayList::Create((System::Collections::IList^)key)));
- return kPtr;
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableArrayList::Create((System::Collections::IList^)key)));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
- case apache::geode::client::GeodeTypeIds::CacheableLinkedList://generic linked list
+ case native::GeodeTypeIds::CacheableLinkedList://generic linked list
{
- apache::geode::client::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableLinkedList::Create((System::Collections::Generic::LinkedList<Object^>^)key)));
- return kPtr;
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableLinkedList::Create((System::Collections::Generic::LinkedList<Object^>^)key)));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
- case apache::geode::client::GeodeTypeIds::CacheableStack:
+ case native::GeodeTypeIds::CacheableStack:
{
- apache::geode::client::CacheablePtr kPtr(SafeGenericMSerializableConvert(Apache::Geode::Client::CacheableStack::Create((System::Collections::ICollection^)key)));
- return kPtr;
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert(Apache::Geode::Client::CacheableStack::Create((System::Collections::ICollection^)key)));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
case 7: //GeodeClassIds::CacheableManagedObject
{
- apache::geode::client::CacheablePtr kPtr(SafeGenericMSerializableConvert((Apache::Geode::Client::CacheableObject^)key));
- return kPtr;
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((Apache::Geode::Client::CacheableObject^)key));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
case 8://GeodeClassIds::CacheableManagedObjectXml
{
- apache::geode::client::CacheablePtr kPtr(SafeGenericMSerializableConvert((Apache::Geode::Client::CacheableObjectXml^)key));
- return kPtr;
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((Apache::Geode::Client::CacheableObjectXml^)key));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
- case apache::geode::client::GeodeTypeIds::CacheableObjectArray:
+ case native::GeodeTypeIds::CacheableObjectArray:
{
- apache::geode::client::CacheablePtr kPtr(SafeGenericMSerializableConvert((Apache::Geode::Client::CacheableObjectArray^)key));
- return kPtr;
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((Apache::Geode::Client::CacheableObjectArray^)key));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
- case apache::geode::client::GeodeTypeIds::CacheableIdentityHashMap:
+ case native::GeodeTypeIds::CacheableIdentityHashMap:
{
- apache::geode::client::CacheablePtr kPtr(SafeGenericMSerializableConvert(Apache::Geode::Client::CacheableIdentityHashMap::Create((System::Collections::IDictionary^)key)));
- return kPtr;
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert(Apache::Geode::Client::CacheableIdentityHashMap::Create((System::Collections::IDictionary^)key)));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
- case apache::geode::client::GeodeTypeIds::CacheableHashSet://no need of it, default case should work
+ case native::GeodeTypeIds::CacheableHashSet://no need of it, default case should work
{
- apache::geode::client::CacheablePtr kPtr(SafeGenericMSerializableConvert((Apache::Geode::Client::CacheableHashSet^)key));
- return kPtr;
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((Apache::Geode::Client::CacheableHashSet^)key));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
- case apache::geode::client::GeodeTypeIds::CacheableLinkedHashSet://no need of it, default case should work
+ case native::GeodeTypeIds::CacheableLinkedHashSet://no need of it, default case should work
{
- apache::geode::client::CacheablePtr kPtr(SafeGenericMSerializableConvert((Apache::Geode::Client::CacheableLinkedHashSet^)key));
- return kPtr;
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((Apache::Geode::Client::CacheableLinkedHashSet^)key));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
- case apache::geode::client::GeodeTypeIds::CacheableDate:
+ case native::GeodeTypeIds::CacheableDate:
{
- apache::geode::client::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableDate::Create((System::DateTime)key)));
- return kPtr;
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableDate::Create((System::DateTime)key)));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
- case apache::geode::client::GeodeTypeIds::BooleanArray:
+ case native::GeodeTypeIds::BooleanArray:
{
- apache::geode::client::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::BooleanArray::Create((array<bool>^)key)));
- return kPtr;
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::BooleanArray::Create((array<bool>^)key)));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
- case apache::geode::client::GeodeTypeIds::CharArray:
+ case native::GeodeTypeIds::CharArray:
{
- apache::geode::client::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CharArray::Create((array<Char>^)key)));
- return kPtr;
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CharArray::Create((array<Char>^)key)));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
default:
{
- apache::geode::client::CacheablePtr kPtr(SafeGenericMSerializableConvert(key));
- /*IGeodeSerializable^ ct = safe_cast<IGeodeSerializable^>(key);
- if(ct != nullptr) {
- apache::geode::client::CacheablePtr kPtr(SafeGenericMSerializableConvert(ct));
- return kPtr;
- }*/
- //throw gcnew System::Exception("not found typeid");
- return kPtr;
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert(key));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
}
}
} //
- String^ Serializable::GetString(apache::geode::client::CacheableStringPtr cStr)//apache::geode::client::CacheableString*
+ String^ Serializable::GetString(native::CacheableStringPtr cStr)//native::CacheableString*
{
if (cStr == nullptr) {
return nullptr;
@@ -1285,196 +1244,196 @@ namespace Apache
// These are the new static methods to get/put data from c++
//byte
- Byte Serializable::getByte(apache::geode::client::SerializablePtr nativeptr)
+ Byte Serializable::getByte(native::SerializablePtr nativeptr)
{
- apache::geode::client::CacheableByte* ci = static_cast<apache::geode::client::CacheableByte*>(nativeptr.get());
+ native::CacheableByte* ci = static_cast<native::CacheableByte*>(nativeptr.get());
return ci->value();
}
- apache::geode::client::CacheableKeyPtr Serializable::getCacheableByte(SByte val)
+ native::CacheableKeyPtr Serializable::getCacheableByte(SByte val)
{
- return apache::geode::client::CacheableByte::create(val);
+ return native::CacheableByte::create(val);
}
//boolean
- bool Serializable::getBoolean(apache::geode::client::SerializablePtr nativeptr)
+ bool Serializable::getBoolean(native::SerializablePtr nativeptr)
{
- apache::geode::client::CacheableBoolean* ci = static_cast<apache::geode::client::CacheableBoolean*>(nativeptr.get());
+ native::CacheableBoolean* ci = static_cast<native::CacheableBoolean*>(nativeptr.get());
return ci->value();
}
- apache::geode::client::CacheableKeyPtr Serializable::getCacheableBoolean(bool val)
+ native::CacheableKeyPtr Serializable::getCacheableBoolean(bool val)
{
- return apache::geode::client::CacheableBoolean::create(val);
+ return native::CacheableBoolean::create(val);
}
//widechar
- Char Serializable::getChar(apache::geode::client::SerializablePtr nativeptr)
+ Char Serializable::getChar(native::SerializablePtr nativeptr)
{
- apache::geode::client::CacheableWideChar* ci = static_cast<apache::geode::client::CacheableWideChar*>(nativeptr.get());
+ native::CacheableWideChar* ci = static_cast<native::CacheableWideChar*>(nativeptr.get());
return ci->value();
}
- apache::geode::client::CacheableKeyPtr Serializable::getCacheableWideChar(Char val)
+ native::CacheableKeyPtr Serializable::getCacheableWideChar(Char val)
{
- return apache::geode::client::CacheableWideChar::create(val);
+ return native::CacheableWideChar::create(val);
}
//double
- double Serializable::getDouble(apache::geode::client::SerializablePtr nativeptr)
+ double Serializable::getDouble(native::SerializablePtr nativeptr)
{
- apache::geode::client::CacheableDouble* ci = static_cast<apache::geode::client::CacheableDouble*>(nativeptr.get());
+ native::CacheableDouble* ci = static_cast<native::CacheableDouble*>(nativeptr.get());
return ci->value();
}
- apache::geode::client::CacheableKeyPtr Serializable::getCacheableDouble(double val)
+ native::CacheableKeyPtr Serializable::getCacheableDouble(double val)
{
- return apache::geode::client::CacheableDouble::create(val);
+ return native::CacheableDouble::create(val);
}
//float
- float Serializable::getFloat(apache::geode::client::SerializablePtr nativeptr)
+ float Serializable::getFloat(native::SerializablePtr nativeptr)
{
- apache::geode::client::CacheableFloat* ci = static_cast<apache::geode::client::CacheableFloat*>(nativeptr.get());
+ native::CacheableFloat* ci = static_cast<native::CacheableFloat*>(nativeptr.get());
return ci->value();
}
- apache::geode::client::CacheableKeyPtr Serializable::getCacheableFloat(float val)
+ native::CacheableKeyPtr Serializable::getCacheableFloat(float val)
{
- return apache::geode::client::CacheableFloat::create(val);
+ return native::CacheableFloat::create(val);
}
//int16
- System::Int16 Serializable::getInt16(apache::geode::client::SerializablePtr nativeptr)
+ System::Int16 Serializable::getInt16(native::SerializablePtr nativeptr)
{
- apache::geode::client::CacheableInt16* ci = static_cast<apache::geode::client::CacheableInt16*>(nativeptr.get());
+ native::CacheableInt16* ci = static_cast<native::CacheableInt16*>(nativeptr.get());
return ci->value();
}
- apache::geode::client::CacheableKeyPtr Serializable::getCacheableInt16(int val)
+ native::CacheableKeyPtr Serializable::getCacheableInt16(int val)
{
- return apache::geode::client::CacheableInt16::create(val);
+ return native::CacheableInt16::create(val);
}
//int32
- System::Int32 Serializable::getInt32(apache::geode::client::SerializablePtr nativeptr)
+ System::Int32 Serializable::getInt32(native::SerializablePtr nativeptr)
{
- apache::geode::client::CacheableInt32* ci = static_cast<apache::geode::client::CacheableInt32*>(nativeptr.get());
+ native::CacheableInt32* ci = static_cast<native::CacheableInt32*>(nativeptr.get());
return ci->value();
}
- apache::geode::client::CacheableKeyPtr Serializable::getCacheableInt32(System::Int32 val)
+ native::CacheableKeyPtr Serializable::getCacheableInt32(System::Int32 val)
{
- return apache::geode::client::CacheableInt32::create(val);
+ return native::CacheableInt32::create(val);
}
//int64
- System::Int64 Serializable::getInt64(apache::geode::client::SerializablePtr nativeptr)
+ System::Int64 Serializable::getInt64(native::SerializablePtr nativeptr)
{
- apache::geode::client::CacheableInt64* ci = static_cast<apache::geode::client::CacheableInt64*>(nativeptr.get());
+ native::CacheableInt64* ci = static_cast<native::CacheableInt64*>(nativeptr.get());
return ci->value();
}
- apache::geode::client::CacheableKeyPtr Serializable::getCacheableInt64(System::Int64 val)
+ native::CacheableKeyPtr Serializable::getCacheableInt64(System::Int64 val)
{
- return apache::geode::client::CacheableInt64::create(val);
+ return native::CacheableInt64::create(val);
}
//cacheable ascii string
- String^ Serializable::getASCIIString(apache::geode::client::SerializablePtr nativeptr)
+ String^ Serializable::getASCIIString(native::SerializablePtr nativeptr)
{
- //apache::geode::client::CacheableString* ci = static_cast<apache::geode::client::CacheableString*>(nativeptr.get());
+ //native::CacheableString* ci = static_cast<native::CacheableString*>(nativeptr.get());
//return GetString(ci);
return GetString(nativeptr->toString());
}
- apache::geode::client::CacheableKeyPtr Serializable::getCacheableASCIIString(String^ val)
+ native::CacheableKeyPtr Serializable::getCacheableASCIIString(String^ val)
{
return GetCacheableString(val);
}
- apache::geode::client::CacheableKeyPtr Serializable::getCacheableASCIIString2(String^ val)
+ native::CacheableKeyPtr Serializable::getCacheableASCIIString2(String^ val)
{
return GetCacheableString2(val);
}
//cacheable ascii string huge
- String^ Serializable::getASCIIStringHuge(apache::geode::client::SerializablePtr nativeptr)
+ String^ Serializable::getASCIIStringHuge(native::SerializablePtr nativeptr)
{
- //apache::geode::client::CacheableString* ci = static_cast<apache::geode::client::CacheableString*>(nativeptr.get());
+ //native::CacheableString* ci = static_cast<native::CacheableString*>(nativeptr.get());
//return GetString(ci);
return GetString(nativeptr->toString());
}
- apache::geode::client::CacheableKeyPtr Serializable::getCacheableASCIIStringHuge(String^ val)
+ native::CacheableKeyPtr Serializable::getCacheableASCIIStringHuge(String^ val)
{
return GetCacheableString(val);
}
//cacheable string
- String^ Serializable::getUTFString(apache::geode::client::SerializablePtr nativeptr)
+ String^ Serializable::getUTFString(native::SerializablePtr nativeptr)
{
- //apache::geode::client::CacheableString* ci = static_cast<apache::geode::client::CacheableString*>(nativeptr.get());
+ //native::CacheableString* ci = static_cast<native::CacheableString*>(nativeptr.get());
//return GetString(ci);
return GetString(nativeptr->toString());
}
- apache::geode::client::CacheableKeyPtr Serializable::getCacheableUTFString(String^ val)
+ native::CacheableKeyPtr Serializable::getCacheableUTFString(String^ val)
{
return GetCacheableString(val);
}
//cacheable string huge
- String^ Serializable::getUTFStringHuge(apache::geode::client::SerializablePtr nativeptr)
+ String^ Serializable::getUTFStringHuge(native::SerializablePtr nativeptr)
{
- //apache::geode::client::CacheableString* ci = static_cast<apache::geode::client::CacheableString*>(nativeptr.get());
+ //native::CacheableString* ci = static_cast<native::CacheableString*>(nativeptr.get());
//return GetString(ci);
return GetString(nativeptr->toString());
}
- apache::geode::client::CacheableKeyPtr Serializable::getCacheableUTFStringHuge(String^ val)
+ native::CacheableKeyPtr Serializable::getCacheableUTFStringHuge(String^ val)
{
return GetCacheableString(val);
}
- apache::geode::client::CacheableStringPtr Serializable::GetCacheableString(String^ value)
+ native::CacheableStringPtr Serializable::GetCacheableString(String^ value)
{
- apache::geode::client::CacheableStringPtr cStr;
+ native::CacheableStringPtr cStr;
size_t len = 0;
if (value != nullptr) {
len = value->Length;
pin_ptr<const wchar_t> pin_value = PtrToStringChars(value);
- cStr = apache::geode::client::CacheableString::create(pin_value, Convert::ToInt32(len));
+ cStr = native::CacheableString::create(pin_value, Convert::ToInt32(len));
}
else {
- cStr = (apache::geode::client::CacheableString*)
- apache::geode::client::CacheableString::createDeserializable();
+ cStr.reset(static_cast<native::CacheableString *>(
+ native::CacheableString::createDeserializable()));
}
return cStr;
}
- apache::geode::client::CacheableStringPtr Serializable::GetCacheableString2(String^ value)
+ native::CacheableStringPtr Serializable::GetCacheableString2(String^ value)
{
- apache::geode::client::CacheableStringPtr cStr;
+ native::CacheableStringPtr cStr;
size_t len = 0;
if (value != nullptr) {
len = value->Length;
const char* chars =
(const char*)(Marshal::StringToHGlobalAnsi(value)).ToPointer();
- cStr = apache::geode::client::CacheableString::create(chars, Convert::ToInt32(len));
+ cStr = native::CacheableString::create(chars, Convert::ToInt32(len));
Marshal::FreeHGlobal(IntPtr((void*)chars));
}
else {
- cStr = (apache::geode::client::CacheableString*)
- apache::geode::client::CacheableString::createDeserializable();
+ cStr.reset(static_cast<native::CacheableString*>(
+ native::CacheableString::createDeserializable()));
}
return cStr;
}
/*
- static String^ GetString(apache::geode::client::CacheableStringPtr cStr)//apache::geode::client::CacheableString*
+ static String^ GetString(native::CacheableStringPtr cStr)//native::CacheableString*
{
if (cStr == nullptr) {
return nullptr;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/Serializable.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/Serializable.hpp b/src/clicache/src/Serializable.hpp
index 9c5dc4d..999dc80 100644
--- a/src/clicache/src/Serializable.hpp
+++ b/src/clicache/src/Serializable.hpp
@@ -18,12 +18,15 @@
#pragma once
#include "geode_defs.hpp"
+#include "begin_native.hpp"
#include <geode/CacheableKey.hpp>
#include <geode/CacheableBuiltins.hpp>
+#include "end_native.hpp"
+
#include "IGeodeSerializable.hpp"
#include "IGeodeDelta.hpp"
#include "impl/ManagedString.hpp"
-#include "impl/NativeWrapper.hpp"
+#include "native_shared_ptr.hpp"
#include "impl/EnumInfo.hpp"
#include "Log.hpp"
#include <vcclr.h>
@@ -38,18 +41,19 @@ namespace Apache
{
namespace Client
{
+ namespace native = apache::geode::client;
interface class IPdxSerializable;
interface class IPdxSerializer;
/// <summary>
/// Signature of native function delegates passed to native
- /// <c>apache::geode::client::Serializable::registerType</c>.
+ /// <c>native::Serializable::registerType</c>.
/// Such functions should return an empty instance of the type they
/// represent. The instance will typically be initialized immediately
/// after creation by a call to native
- /// <c>apache::geode::client::Serializable::fromData</c>.
+ /// <c>native::Serializable::fromData</c>.
/// </summary>
- delegate apache::geode::client::Serializable* TypeFactoryNativeMethodGeneric();
+ delegate native::Serializable* TypeFactoryNativeMethodGeneric();
/// <summary>
/// Signature of function delegates passed to
@@ -62,13 +66,13 @@ namespace Apache
/// </summary>
public delegate Apache::Geode::Client::IGeodeSerializable^ TypeFactoryMethodGeneric();
/// <summary>
- /// Delegate to wrap a native <c>apache::geode::client::Serializable</c> type.
+ /// Delegate to wrap a native <c>native::Serializable</c> type.
/// </summary>
/// <remarks>
/// This delegate should return an object of type <c>IGeodeSerializable</c>
/// given a native object.
/// </remarks>
- delegate Apache::Geode::Client::IGeodeSerializable^ WrapperDelegateGeneric(apache::geode::client::Serializable* obj);
+ delegate Apache::Geode::Client::IGeodeSerializable^ WrapperDelegateGeneric(native::SerializablePtr obj);
/// <summary>
/// Signature of function delegates passed to
@@ -80,12 +84,11 @@ namespace Apache
public delegate Apache::Geode::Client::IPdxSerializable^ PdxTypeFactoryMethod();
/// <summary>
- /// This class wraps the native C++ <c>apache::geode::client::Serializable</c> objects
+ /// This class wraps the native C++ <c>native::Serializable</c> objects
/// as managed <see cref="IGeodeSerializable" /> objects.
/// </summary>
public ref class Serializable
- : public Apache::Geode::Client::Internal::SBWrap<apache::geode::client::Serializable>,
- public Apache::Geode::Client::IGeodeSerializable
+ : public Apache::Geode::Client::IGeodeSerializable
{
public:
/// <summary>
@@ -314,81 +317,81 @@ namespace Apache
static Dictionary<String^, PdxTypeFactoryMethod^>^ PdxDelegateMap =
gcnew Dictionary<String^, PdxTypeFactoryMethod^>();
- static String^ GetString(apache::geode::client::CacheableStringPtr cStr);//apache::geode::client::CacheableString*
+ static String^ GetString(native::CacheableStringPtr cStr);//native::CacheableString*
// These are the new static methods to get/put data from c++
//byte
- static Byte getByte(apache::geode::client::SerializablePtr nativeptr);
+ static Byte getByte(native::SerializablePtr nativeptr);
- static apache::geode::client::CacheableKeyPtr getCacheableByte(SByte val);
+ static native::CacheableKeyPtr getCacheableByte(SByte val);
//boolean
- static bool getBoolean(apache::geode::client::SerializablePtr nativeptr);
+ static bool getBoolean(native::SerializablePtr nativeptr);
- static apache::geode::client::CacheableKeyPtr getCacheableBoolean(bool val);
+ static native::CacheableKeyPtr getCacheableBoolean(bool val);
//widechar
- static Char getChar(apache::geode::client::SerializablePtr nativeptr);
+ static Char getChar(native::SerializablePtr nativeptr);
- static apache::geode::client::CacheableKeyPtr getCacheableWideChar(Char val);
+ static native::CacheableKeyPtr getCacheableWideChar(Char val);
//double
- static double getDouble(apache::geode::client::SerializablePtr nativeptr);
+ static double getDouble(native::SerializablePtr nativeptr);
- static apache::geode::client::CacheableKeyPtr getCacheableDouble(double val);
+ static native::CacheableKeyPtr getCacheableDouble(double val);
//float
- static float getFloat(apache::geode::client::SerializablePtr nativeptr);
+ static float getFloat(native::SerializablePtr nativeptr);
- static apache::geode::client::CacheableKeyPtr getCacheableFloat(float val);
+ static native::CacheableKeyPtr getCacheableFloat(float val);
//int16
- static System::Int16 getInt16(apache::geode::client::SerializablePtr nativeptr);
+ static System::Int16 getInt16(native::SerializablePtr nativeptr);
- static apache::geode::client::CacheableKeyPtr getCacheableInt16(int val);
+ static native::CacheableKeyPtr getCacheableInt16(int val);
//int32
- static System::Int32 getInt32(apache::geode::client::SerializablePtr nativeptr);
+ static System::Int32 getInt32(native::SerializablePtr nativeptr);
- static apache::geode::client::CacheableKeyPtr getCacheableInt32(System::Int32 val);
+ static native::CacheableKeyPtr getCacheableInt32(System::Int32 val);
//int64
- static System::Int64 getInt64(apache::geode::client::SerializablePtr nativeptr);
+ static System::Int64 getInt64(native::SerializablePtr nativeptr);
- static apache::geode::client::CacheableKeyPtr getCacheableInt64(System::Int64 val);
+ static native::CacheableKeyPtr getCacheableInt64(System::Int64 val);
//cacheable ascii string
- static String^ getASCIIString(apache::geode::client::SerializablePtr nativeptr);
+ static String^ getASCIIString(native::SerializablePtr nativeptr);
- static apache::geode::client::CacheableKeyPtr getCacheableASCIIString(String^ val);
+ static native::CacheableKeyPtr getCacheableASCIIString(String^ val);
- static apache::geode::client::CacheableKeyPtr getCacheableASCIIString2(String^ val);
+ static native::CacheableKeyPtr getCacheableASCIIString2(String^ val);
//cacheable ascii string huge
- static String^ getASCIIStringHuge(apache::geode::client::SerializablePtr nativeptr);
+ static String^ getASCIIStringHuge(native::SerializablePtr nativeptr);
- static apache::geode::client::CacheableKeyPtr getCacheableASCIIStringHuge(String^ val);
+ static native::CacheableKeyPtr getCacheableASCIIStringHuge(String^ val);
//cacheable string
- static String^ getUTFString(apache::geode::client::SerializablePtr nativeptr);
+ static String^ getUTFString(native::SerializablePtr nativeptr);
- static apache::geode::client::CacheableKeyPtr getCacheableUTFString(String^ val);
+ static native::CacheableKeyPtr getCacheableUTFString(String^ val);
//cacheable string huge
- static String^ getUTFStringHuge(apache::geode::client::SerializablePtr nativeptr);
+ static String^ getUTFStringHuge(native::SerializablePtr nativeptr);
- static apache::geode::client::CacheableKeyPtr getCacheableUTFStringHuge(String^ val);
+ static native::CacheableKeyPtr getCacheableUTFStringHuge(String^ val);
- static apache::geode::client::CacheableStringPtr GetCacheableString(String^ value);
+ static native::CacheableStringPtr GetCacheableString(String^ value);
- static apache::geode::client::CacheableStringPtr GetCacheableString2(String^ value);
+ static native::CacheableStringPtr GetCacheableString2(String^ value);
/*
- static String^ GetString(apache::geode::client::CacheableStringPtr cStr)//apache::geode::client::CacheableString*
+ static String^ GetString(native::CacheableStringPtr cStr)//native::CacheableString*
{
if (cStr == nullptr) {
return nullptr;
@@ -415,14 +418,16 @@ namespace Apache
/// Default constructor.
/// </summary>
inline Apache::Geode::Client::Serializable()
- : Apache::Geode::Client::Internal::SBWrap<apache::geode::client::Serializable>() { }
+ :Serializable(__nullptr) { }
/// <summary>
/// Internal constructor to wrap a native object pointer
/// </summary>
/// <param name="nativeptr">The native object pointer</param>
- inline Apache::Geode::Client::Serializable(apache::geode::client::Serializable* nativeptr)
- : Client::Internal::SBWrap<apache::geode::client::Serializable>(nativeptr) { }
+ inline Apache::Geode::Client::Serializable(native::SerializablePtr nativeptr)
+ {
+ m_nativeptr = gcnew native_shared_ptr<native::Serializable>(nativeptr);
+ }
/// <summary>
/// Register an instance factory method for a given type and typeId.
@@ -446,20 +451,20 @@ namespace Apache
static void UnregisterTypeGeneric(Byte typeId);
generic<class TValue>
- static TValue GetManagedValueGeneric(apache::geode::client::SerializablePtr val);
+ static TValue GetManagedValueGeneric(native::SerializablePtr val);
generic<class TKey>
- static apache::geode::client::CacheableKeyPtr GetUnmanagedValueGeneric(TKey key);
+ static native::CacheableKeyPtr GetUnmanagedValueGeneric(TKey key);
generic<class TKey>
- static apache::geode::client::CacheableKeyPtr GetUnmanagedValueGeneric(TKey key, bool isAciiChar);
+ static native::CacheableKeyPtr GetUnmanagedValueGeneric(TKey key, bool isAciiChar);
generic<class TKey>
- static apache::geode::client::CacheableKeyPtr GetUnmanagedValueGeneric(
+ static native::CacheableKeyPtr GetUnmanagedValueGeneric(
Type^ managedType, TKey key);
generic<class TKey>
- static apache::geode::client::CacheableKeyPtr GetUnmanagedValueGeneric(
+ static native::CacheableKeyPtr GetUnmanagedValueGeneric(
Type^ managedType, TKey key, bool isAsciiChar);
/// <summary>
@@ -477,29 +482,6 @@ namespace Apache
}
/// <summary>
- /// Used to assign the native Serializable pointer to a new object.
- /// </summary>
- /// <remarks>
- /// Note the order of preserveSB() and releaseSB(). This handles the
- /// corner case when <c>m_nativeptr</c> is same as <c>nativeptr</c>.
- /// </remarks>
- inline void AssignSP(apache::geode::client::Serializable* nativeptr)
- {
- AssignPtr(nativeptr);
- }
-
- /// <summary>
- /// Used to assign the native Serializable pointer to a new object.
- /// </summary>
- inline void SetSP(apache::geode::client::Serializable* nativeptr)
- {
- if (nativeptr != nullptr) {
- nativeptr->preserveSB();
- }
- _SetNativePtr(nativeptr);
- }
-
- /// <summary>
/// Static list of <c>TypeFactoryNativeMethod</c> delegates created
/// from registered managed <c>TypeFactoryMethod</c> delegates.
/// This is so that the underlying managed objects do not get GCed.
@@ -608,7 +590,7 @@ namespace Apache
/// <summary>
/// Static method to register a managed wrapper for a native
- /// <c>apache::geode::client::Serializable</c> type.
+ /// <c>native::Serializable</c> type.
/// </summary>
/// <param name="wrapperMethod">
/// A factory delegate of the managed wrapper class that returns the
@@ -630,7 +612,7 @@ namespace Apache
/// Static method to lookup the wrapper delegate for a given typeId.
/// </summary>
/// <param name="typeId">
- /// The typeId of the native <c>apache::geode::client::Serializable</c> type.
+ /// The typeId of the native <c>native::Serializable</c> type.
/// </param>
/// <returns>
/// If a managed wrapper is registered for the given typeId then the
@@ -651,55 +633,58 @@ namespace Apache
{
Dictionary<Object^, Object^>^ dic = gcnew Dictionary<Object^, Object^>();
- ManagedTypeMappingGeneric[dic->GetType()] = apache::geode::client::GeodeTypeIds::CacheableHashMap;
- ManagedTypeMappingGeneric[dic->GetType()->GetGenericTypeDefinition()] = apache::geode::client::GeodeTypeIds::CacheableHashMap;
+ ManagedTypeMappingGeneric[dic->GetType()] = native::GeodeTypeIds::CacheableHashMap;
+ ManagedTypeMappingGeneric[dic->GetType()->GetGenericTypeDefinition()] = native::GeodeTypeIds::CacheableHashMap;
}
{
System::Collections::ArrayList^ arr = gcnew System::Collections::ArrayList();
- ManagedTypeMappingGeneric[arr->GetType()] = apache::geode::client::GeodeTypeIds::CacheableVector;
+ ManagedTypeMappingGeneric[arr->GetType()] = native::GeodeTypeIds::CacheableVector;
}
{
System::Collections::Generic::LinkedList<Object^>^ linketList = gcnew System::Collections::Generic::LinkedList<Object^>();
- ManagedTypeMappingGeneric[linketList->GetType()] = apache::geode::client::GeodeTypeIds::CacheableLinkedList;
- ManagedTypeMappingGeneric[linketList->GetType()->GetGenericTypeDefinition()] = apache::geode::client::GeodeTypeIds::CacheableLinkedList;
+ ManagedTypeMappingGeneric[linketList->GetType()] = native::GeodeTypeIds::CacheableLinkedList;
+ ManagedTypeMappingGeneric[linketList->GetType()->GetGenericTypeDefinition()] = native::GeodeTypeIds::CacheableLinkedList;
}
{
System::Collections::Generic::IList<Object^>^ iList = gcnew System::Collections::Generic::List<Object^>();
- ManagedTypeMappingGeneric[iList->GetType()] = apache::geode::client::GeodeTypeIds::CacheableArrayList;
- ManagedTypeMappingGeneric[iList->GetType()->GetGenericTypeDefinition()] = apache::geode::client::GeodeTypeIds::CacheableArrayList;
+ ManagedTypeMappingGeneric[iList->GetType()] = native::GeodeTypeIds::CacheableArrayList;
+ ManagedTypeMappingGeneric[iList->GetType()->GetGenericTypeDefinition()] = native::GeodeTypeIds::CacheableArrayList;
}
//TODO: Linked list, non generic stack, some other map types and see if more
{
System::Collections::Generic::Stack<Object^>^ stack = gcnew System::Collections::Generic::Stack<Object^>();
- ManagedTypeMappingGeneric[stack->GetType()] = apache::geode::client::GeodeTypeIds::CacheableStack;
- ManagedTypeMappingGeneric[stack->GetType()->GetGenericTypeDefinition()] = apache::geode::client::GeodeTypeIds::CacheableStack;
+ ManagedTypeMappingGeneric[stack->GetType()] = native::GeodeTypeIds::CacheableStack;
+ ManagedTypeMappingGeneric[stack->GetType()->GetGenericTypeDefinition()] = native::GeodeTypeIds::CacheableStack;
}
{
- ManagedTypeMappingGeneric[SByte::typeid] = apache::geode::client::GeodeTypeIds::CacheableByte;
- ManagedTypeMappingGeneric[Boolean::typeid] = apache::geode::client::GeodeTypeIds::CacheableBoolean;
- ManagedTypeMappingGeneric[Char::typeid] = apache::geode::client::GeodeTypeIds::CacheableWideChar;
- ManagedTypeMappingGeneric[Double::typeid] = apache::geode::client::GeodeTypeIds::CacheableDouble;
- ManagedTypeMappingGeneric[String::typeid] = apache::geode::client::GeodeTypeIds::CacheableASCIIString;
- ManagedTypeMappingGeneric[float::typeid] = apache::geode::client::GeodeTypeIds::CacheableFloat;
- ManagedTypeMappingGeneric[Int16::typeid] = apache::geode::client::GeodeTypeIds::CacheableInt16;
- ManagedTypeMappingGeneric[Int32::typeid] = apache::geode::client::GeodeTypeIds::CacheableInt32;
- ManagedTypeMappingGeneric[Int64::typeid] = apache::geode::client::GeodeTypeIds::CacheableInt64;
- ManagedTypeMappingGeneric[Type::GetType("System.Byte[]")] = apache::geode::client::GeodeTypeIds::CacheableBytes;
- ManagedTypeMappingGeneric[Type::GetType("System.Double[]")] = apache::geode::client::GeodeTypeIds::CacheableDoubleArray;
- ManagedTypeMappingGeneric[Type::GetType("System.Single[]")] = apache::geode::client::GeodeTypeIds::CacheableFloatArray;
- ManagedTypeMappingGeneric[Type::GetType("System.Int16[]")] = apache::geode::client::GeodeTypeIds::CacheableInt16Array;
- ManagedTypeMappingGeneric[Type::GetType("System.Int32[]")] = apache::geode::client::GeodeTypeIds::CacheableInt32Array;
- ManagedTypeMappingGeneric[Type::GetType("System.Int64[]")] = apache::geode::client::GeodeTypeIds::CacheableInt64Array;
- ManagedTypeMappingGeneric[Type::GetType("System.String[]")] = apache::geode::client::GeodeTypeIds::CacheableStringArray;
- ManagedTypeMappingGeneric[Type::GetType("System.DateTime")] = apache::geode::client::GeodeTypeIds::CacheableDate;
- ManagedTypeMappingGeneric[Type::GetType("System.Collections.Hashtable")] = apache::geode::client::GeodeTypeIds::CacheableHashTable;
+ ManagedTypeMappingGeneric[SByte::typeid] = native::GeodeTypeIds::CacheableByte;
+ ManagedTypeMappingGeneric[Boolean::typeid] = native::GeodeTypeIds::CacheableBoolean;
+ ManagedTypeMappingGeneric[Char::typeid] = native::GeodeTypeIds::CacheableWideChar;
+ ManagedTypeMappingGeneric[Double::typeid] = native::GeodeTypeIds::CacheableDouble;
+ ManagedTypeMappingGeneric[String::typeid] = native::GeodeTypeIds::CacheableASCIIString;
+ ManagedTypeMappingGeneric[float::typeid] = native::GeodeTypeIds::CacheableFloat;
+ ManagedTypeMappingGeneric[Int16::typeid] = native::GeodeTypeIds::CacheableInt16;
+ ManagedTypeMappingGeneric[Int32::typeid] = native::GeodeTypeIds::CacheableInt32;
+ ManagedTypeMappingGeneric[Int64::typeid] = native::GeodeTypeIds::CacheableInt64;
+ ManagedTypeMappingGeneric[Type::GetType("System.Byte[]")] = native::GeodeTypeIds::CacheableBytes;
+ ManagedTypeMappingGeneric[Type::GetType("System.Double[]")] = native::GeodeTypeIds::CacheableDoubleArray;
+ ManagedTypeMappingGeneric[Type::GetType("System.Single[]")] = native::GeodeTypeIds::CacheableFloatArray;
+ ManagedTypeMappingGeneric[Type::GetType("System.Int16[]")] = native::GeodeTypeIds::CacheableInt16Array;
+ ManagedTypeMappingGeneric[Type::GetType("System.Int32[]")] = native::GeodeTypeIds::CacheableInt32Array;
+ ManagedTypeMappingGeneric[Type::GetType("System.Int64[]")] = native::GeodeTypeIds::CacheableInt64Array;
+ ManagedTypeMappingGeneric[Type::GetType("System.String[]")] = native::GeodeTypeIds::CacheableStringArray;
+ ManagedTypeMappingGeneric[Type::GetType("System.DateTime")] = native::GeodeTypeIds::CacheableDate;
+ ManagedTypeMappingGeneric[Type::GetType("System.Collections.Hashtable")] = native::GeodeTypeIds::CacheableHashTable;
}
}
+
+ protected:
+ native_shared_ptr<native::Serializable>^ m_nativeptr;
};
} // namespace Client
} // namespace Geode
[44/46] geode-native git commit: GEODE-2741: Fixes potential memory
leak on exception.
Posted by jb...@apache.org.
GEODE-2741: Fixes potential memory leak on exception.
Project: http://git-wip-us.apache.org/repos/asf/geode-native/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode-native/commit/3cb20df0
Tree: http://git-wip-us.apache.org/repos/asf/geode-native/tree/3cb20df0
Diff: http://git-wip-us.apache.org/repos/asf/geode-native/diff/3cb20df0
Branch: refs/heads/develop
Commit: 3cb20df08f6b5d624b75609e54354a077b5fcc03
Parents: c6fdafe
Author: Jacob Barrett <jb...@pivotal.io>
Authored: Tue May 16 22:29:14 2017 +0000
Committer: Jacob Barrett <jb...@pivotal.io>
Committed: Tue May 16 22:29:14 2017 +0000
----------------------------------------------------------------------
src/clicache/src/Serializable.cpp | 1577 ++++++++++++++++----------------
1 file changed, 779 insertions(+), 798 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode-native/blob/3cb20df0/src/clicache/src/Serializable.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/Serializable.cpp b/src/clicache/src/Serializable.cpp
index 34ed0c7..5771095 100644
--- a/src/clicache/src/Serializable.cpp
+++ b/src/clicache/src/Serializable.cpp
@@ -646,847 +646,828 @@ namespace Apache
}
generic<class TValue>
- TValue Serializable::GetManagedValueGeneric(native::SerializablePtr val)
+ TValue Serializable::GetManagedValueGeneric(native::SerializablePtr val)
+ {
+ if (val == nullptr)
{
- if (val == nullptr)
- {
- return TValue();
- }
+ return TValue();
+ }
- Byte typeId = val->typeId();
- //Log::Debug("Serializable::GetManagedValueGeneric typeid = " + typeId);
- switch (typeId)
- {
- case native::GeodeTypeIds::CacheableByte:
- {
- return (TValue)(int8_t)safe_cast<int8_t>(Serializable::getByte(val));
- /* if (TValue::typeid == System::SByte::typeid) {
- return (TValue)(int8_t)safe_cast<int8_t>(Serializable::getByte(val));
- }
- else {
- return (TValue)(System::Byte)safe_cast<int8_t>(Serializable::getByte(val));
- }
- return safe_cast<TValue>(Serializable::getByte(val));*/
- }
- case native::GeodeTypeIds::CacheableBoolean:
- {
- return safe_cast<TValue>(Serializable::getBoolean(val));
- }
- case native::GeodeTypeIds::CacheableWideChar:
- {
- return safe_cast<TValue>(Serializable::getChar(val));
- }
- case native::GeodeTypeIds::CacheableDouble:
- {
- return safe_cast<TValue>(Serializable::getDouble(val));
- }
- case native::GeodeTypeIds::CacheableASCIIString:
- case native::GeodeTypeIds::CacheableASCIIStringHuge:
- case native::GeodeTypeIds::CacheableString:
- case native::GeodeTypeIds::CacheableStringHuge:
- {
- //TODO: need to look all strings types
- return safe_cast<TValue>(Serializable::getASCIIString(val));
- }
- case native::GeodeTypeIds::CacheableFloat:
- {
- return safe_cast<TValue>(Serializable::getFloat(val));
- }
- case native::GeodeTypeIds::CacheableInt16:
- {
- /* if (TValue::typeid == System::Int16::typeid) {
- return (TValue)(System::Int16)safe_cast<System::Int16>(Serializable::getInt16(val));
- }
- else {
- return (TValue)(System::UInt16)safe_cast<System::Int16>(Serializable::getInt16(val));
- }*/
- return safe_cast<TValue>(Serializable::getInt16(val));
- }
- case native::GeodeTypeIds::CacheableInt32:
- {
- /* if (TValue::typeid == System::Int32::typeid) {
- return (TValue)(System::Int32)safe_cast<System::Int32>(Serializable::getInt32(val));
- }
- else {
- return (TValue)(System::UInt32)safe_cast<System::Int32>(Serializable::getInt32(val));
- } */
- return safe_cast<TValue>(Serializable::getInt32(val));
- }
- case native::GeodeTypeIds::CacheableInt64:
- {
- /*if (TValue::typeid == System::Int64::typeid) {
- return (TValue)(System::Int64)safe_cast<System::Int64>(Serializable::getInt64(val));
+ Byte typeId = val->typeId();
+ //Log::Debug("Serializable::GetManagedValueGeneric typeid = " + typeId);
+ switch (typeId)
+ {
+ case native::GeodeTypeIds::CacheableByte:
+ {
+ return (TValue)(int8_t)safe_cast<int8_t>(Serializable::getByte(val));
+ /* if (TValue::typeid == System::SByte::typeid) {
+ return (TValue)(int8_t)safe_cast<int8_t>(Serializable::getByte(val));
}
else {
- return (TValue)(System::UInt64)safe_cast<System::Int64>(Serializable::getInt64(val));
+ return (TValue)(System::Byte)safe_cast<int8_t>(Serializable::getByte(val));
+ }
+ return safe_cast<TValue>(Serializable::getByte(val));*/
+ }
+ case native::GeodeTypeIds::CacheableBoolean:
+ {
+ return safe_cast<TValue>(Serializable::getBoolean(val));
+ }
+ case native::GeodeTypeIds::CacheableWideChar:
+ {
+ return safe_cast<TValue>(Serializable::getChar(val));
+ }
+ case native::GeodeTypeIds::CacheableDouble:
+ {
+ return safe_cast<TValue>(Serializable::getDouble(val));
+ }
+ case native::GeodeTypeIds::CacheableASCIIString:
+ case native::GeodeTypeIds::CacheableASCIIStringHuge:
+ case native::GeodeTypeIds::CacheableString:
+ case native::GeodeTypeIds::CacheableStringHuge:
+ {
+ //TODO: need to look all strings types
+ return safe_cast<TValue>(Serializable::getASCIIString(val));
+ }
+ case native::GeodeTypeIds::CacheableFloat:
+ {
+ return safe_cast<TValue>(Serializable::getFloat(val));
+ }
+ case native::GeodeTypeIds::CacheableInt16:
+ {
+ /* if (TValue::typeid == System::Int16::typeid) {
+ return (TValue)(System::Int16)safe_cast<System::Int16>(Serializable::getInt16(val));
+ }
+ else {
+ return (TValue)(System::UInt16)safe_cast<System::Int16>(Serializable::getInt16(val));
}*/
- return safe_cast<TValue>(Serializable::getInt64(val));
- }
- case native::GeodeTypeIds::CacheableDate:
- {
- //TODO::
- Apache::Geode::Client::CacheableDate^ ret = static_cast<Apache::Geode::Client::CacheableDate ^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableDate^>(val));
+ return safe_cast<TValue>(Serializable::getInt16(val));
+ }
+ case native::GeodeTypeIds::CacheableInt32:
+ {
+ /* if (TValue::typeid == System::Int32::typeid) {
+ return (TValue)(System::Int32)safe_cast<System::Int32>(Serializable::getInt32(val));
+ }
+ else {
+ return (TValue)(System::UInt32)safe_cast<System::Int32>(Serializable::getInt32(val));
+ } */
+ return safe_cast<TValue>(Serializable::getInt32(val));
+ }
+ case native::GeodeTypeIds::CacheableInt64:
+ {
+ /*if (TValue::typeid == System::Int64::typeid) {
+ return (TValue)(System::Int64)safe_cast<System::Int64>(Serializable::getInt64(val));
+ }
+ else {
+ return (TValue)(System::UInt64)safe_cast<System::Int64>(Serializable::getInt64(val));
+ }*/
+ return safe_cast<TValue>(Serializable::getInt64(val));
+ }
+ case native::GeodeTypeIds::CacheableDate:
+ {
+ //TODO::
+ Apache::Geode::Client::CacheableDate^ ret = static_cast<Apache::Geode::Client::CacheableDate ^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableDate^>(val));
- System::DateTime dt(ret->Value.Ticks);
- return safe_cast<TValue>(dt);
- }
- case native::GeodeTypeIdsImpl::CacheableUserData:
- case native::GeodeTypeIdsImpl::CacheableUserData2:
- case native::GeodeTypeIdsImpl::CacheableUserData4:
+ System::DateTime dt(ret->Value.Ticks);
+ return safe_cast<TValue>(dt);
+ }
+ case native::GeodeTypeIdsImpl::CacheableUserData:
+ case native::GeodeTypeIdsImpl::CacheableUserData2:
+ case native::GeodeTypeIdsImpl::CacheableUserData4:
+ {
+ //TODO::split
+ IGeodeSerializable^ ret = SafeUMSerializableConvertGeneric(val);
+ return safe_cast<TValue>(ret);
+ //return TValue();
+ }
+ case native::GeodeTypeIdsImpl::PDX:
+ {
+ IPdxSerializable^ ret = SafeUMSerializablePDXConvert(val);
+
+ PdxWrapper^ pdxWrapper = dynamic_cast<PdxWrapper^>(ret);
+
+ if (pdxWrapper != nullptr)
{
- //TODO::split
- IGeodeSerializable^ ret = SafeUMSerializableConvertGeneric(val);
- return safe_cast<TValue>(ret);
- //return TValue();
+ return safe_cast<TValue>(pdxWrapper->GetObject());
}
- case native::GeodeTypeIdsImpl::PDX:
- {
- IPdxSerializable^ ret = SafeUMSerializablePDXConvert(val);
- PdxWrapper^ pdxWrapper = dynamic_cast<PdxWrapper^>(ret);
+ return safe_cast<TValue>(ret);
+ }
+ case native::GeodeTypeIds::CacheableBytes:
+ {
+ Apache::Geode::Client::CacheableBytes^ ret = safe_cast<Apache::Geode::Client::CacheableBytes ^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableBytes^>(val));
- if (pdxWrapper != nullptr)
- {
- return safe_cast<TValue>(pdxWrapper->GetObject());
- }
+ return safe_cast<TValue>(ret->Value);
+ }
+ case native::GeodeTypeIds::CacheableDoubleArray:
+ {
+ Apache::Geode::Client::CacheableDoubleArray^ ret = safe_cast<Apache::Geode::Client::CacheableDoubleArray ^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableDoubleArray^>(val));
- return safe_cast<TValue>(ret);
- }
- case native::GeodeTypeIds::CacheableBytes:
- {
- Apache::Geode::Client::CacheableBytes^ ret = safe_cast<Apache::Geode::Client::CacheableBytes ^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableBytes^>(val));
+ return safe_cast<TValue>(ret->Value);
+ }
+ case native::GeodeTypeIds::CacheableFloatArray:
+ {
+ Apache::Geode::Client::CacheableFloatArray^ ret = safe_cast<Apache::Geode::Client::CacheableFloatArray^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableFloatArray^>(val));
- return safe_cast<TValue>(ret->Value);
- }
- case native::GeodeTypeIds::CacheableDoubleArray:
- {
- Apache::Geode::Client::CacheableDoubleArray^ ret = safe_cast<Apache::Geode::Client::CacheableDoubleArray ^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableDoubleArray^>(val));
+ return safe_cast<TValue>(ret->Value);
+ }
+ case native::GeodeTypeIds::CacheableInt16Array:
+ {
+ Apache::Geode::Client::CacheableInt16Array^ ret = safe_cast<Apache::Geode::Client::CacheableInt16Array^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableInt16Array^>(val));
- return safe_cast<TValue>(ret->Value);
- }
- case native::GeodeTypeIds::CacheableFloatArray:
- {
- Apache::Geode::Client::CacheableFloatArray^ ret = safe_cast<Apache::Geode::Client::CacheableFloatArray^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableFloatArray^>(val));
+ return safe_cast<TValue>(ret->Value);
+ }
+ case native::GeodeTypeIds::CacheableInt32Array:
+ {
+ Apache::Geode::Client::CacheableInt32Array^ ret = safe_cast<Apache::Geode::Client::CacheableInt32Array^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableInt32Array^>(val));
- return safe_cast<TValue>(ret->Value);
- }
- case native::GeodeTypeIds::CacheableInt16Array:
- {
- Apache::Geode::Client::CacheableInt16Array^ ret = safe_cast<Apache::Geode::Client::CacheableInt16Array^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableInt16Array^>(val));
+ return safe_cast<TValue>(ret->Value);
+ }
+ case native::GeodeTypeIds::CacheableInt64Array:
+ {
+ Apache::Geode::Client::CacheableInt64Array^ ret = safe_cast<Apache::Geode::Client::CacheableInt64Array^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableInt64Array^>(val));
- return safe_cast<TValue>(ret->Value);
- }
- case native::GeodeTypeIds::CacheableInt32Array:
- {
- Apache::Geode::Client::CacheableInt32Array^ ret = safe_cast<Apache::Geode::Client::CacheableInt32Array^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableInt32Array^>(val));
+ return safe_cast<TValue>(ret->Value);
+ }
+ case native::GeodeTypeIds::CacheableStringArray:
+ {
+ Apache::Geode::Client::CacheableStringArray^ ret = safe_cast<Apache::Geode::Client::CacheableStringArray^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableStringArray^>(val));
- return safe_cast<TValue>(ret->Value);
- }
- case native::GeodeTypeIds::CacheableInt64Array:
- {
- Apache::Geode::Client::CacheableInt64Array^ ret = safe_cast<Apache::Geode::Client::CacheableInt64Array^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableInt64Array^>(val));
+ /* array<String^>^ str = gcnew array<String^>(ret->GetValues()->Length);
+ for(int i=0; i<ret->GetValues()->Length; i++ ) {
+ str[i] = ret->GetValues()[i];
+ }*/
- return safe_cast<TValue>(ret->Value);
- }
- case native::GeodeTypeIds::CacheableStringArray:
- {
- Apache::Geode::Client::CacheableStringArray^ ret = safe_cast<Apache::Geode::Client::CacheableStringArray^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableStringArray^>(val));
+ return safe_cast<TValue>(ret->GetValues());
+ }
+ case native::GeodeTypeIds::CacheableArrayList://Ilist generic
+ {
+ Apache::Geode::Client::CacheableArrayList^ ret = safe_cast<Apache::Geode::Client::CacheableArrayList^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableArrayList^>(val));
- /* array<String^>^ str = gcnew array<String^>(ret->GetValues()->Length);
- for(int i=0; i<ret->GetValues()->Length; i++ ) {
- str[i] = ret->GetValues()[i];
- }*/
+ return safe_cast<TValue>(ret->Value);
+ }
+ case native::GeodeTypeIds::CacheableLinkedList://LinkedList generic
+ {
+ Apache::Geode::Client::CacheableLinkedList^ ret = safe_cast<Apache::Geode::Client::CacheableLinkedList^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableLinkedList^>(val));
- return safe_cast<TValue>(ret->GetValues());
- }
- case native::GeodeTypeIds::CacheableArrayList://Ilist generic
- {
- Apache::Geode::Client::CacheableArrayList^ ret = safe_cast<Apache::Geode::Client::CacheableArrayList^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableArrayList^>(val));
+ return safe_cast<TValue>(ret->Value);
+ }
+ case native::GeodeTypeIds::CacheableHashTable://collection::hashtable
+ {
+ Apache::Geode::Client::CacheableHashTable^ ret = safe_cast<Apache::Geode::Client::CacheableHashTable^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableHashTable^>(val));
- return safe_cast<TValue>(ret->Value);
- }
- case native::GeodeTypeIds::CacheableLinkedList://LinkedList generic
- {
- Apache::Geode::Client::CacheableLinkedList^ ret = safe_cast<Apache::Geode::Client::CacheableLinkedList^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableLinkedList^>(val));
+ return safe_cast<TValue>(ret->Value);
+ }
+ case native::GeodeTypeIds::CacheableHashMap://generic dictionary
+ {
+ Apache::Geode::Client::CacheableHashMap^ ret = safe_cast<Apache::Geode::Client::CacheableHashMap^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableHashMap^>(val));
- return safe_cast<TValue>(ret->Value);
- }
- case native::GeodeTypeIds::CacheableHashTable://collection::hashtable
- {
- Apache::Geode::Client::CacheableHashTable^ ret = safe_cast<Apache::Geode::Client::CacheableHashTable^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableHashTable^>(val));
+ return safe_cast<TValue>(ret->Value);
+ }
+ case native::GeodeTypeIds::CacheableIdentityHashMap:
+ {
+ Apache::Geode::Client::CacheableIdentityHashMap^ ret = static_cast<Apache::Geode::Client::CacheableIdentityHashMap^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableIdentityHashMap^>(val));
+ return safe_cast<TValue>(ret->Value);
+ }
+ case native::GeodeTypeIds::CacheableHashSet://no need of it, default case should work
+ {
+ Apache::Geode::Client::CacheableHashSet^ ret = static_cast<Apache::Geode::Client::CacheableHashSet^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableHashSet^>(val));
+ return safe_cast<TValue>(ret);
+ }
+ case native::GeodeTypeIds::CacheableLinkedHashSet://no need of it, default case should work
+ {
+ Apache::Geode::Client::CacheableLinkedHashSet^ ret = static_cast<Apache::Geode::Client::CacheableLinkedHashSet^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableLinkedHashSet^>(val));
+ return safe_cast<TValue>(ret);
+ }
+ case native::GeodeTypeIds::CacheableFileName:
+ {
+ Apache::Geode::Client::CacheableFileName^ ret = static_cast<Apache::Geode::Client::CacheableFileName^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableFileName^>(val));
+ return safe_cast<TValue>(ret);
+ }
+ case native::GeodeTypeIds::CacheableObjectArray:
+ {
+ Apache::Geode::Client::CacheableObjectArray^ ret = static_cast<Apache::Geode::Client::CacheableObjectArray^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableObjectArray^>(val));
+ return safe_cast<TValue>(ret);
+ }
+ case native::GeodeTypeIds::CacheableVector://collection::arraylist
+ {
+ Apache::Geode::Client::CacheableVector^ ret = static_cast<Apache::Geode::Client::CacheableVector^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableVector^>(val));
+ return safe_cast<TValue>(ret->Value);
+ }
+ case native::GeodeTypeIds::CacheableUndefined:
+ {
+ Apache::Geode::Client::CacheableUndefined^ ret = static_cast<Apache::Geode::Client::CacheableUndefined^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableUndefined^>(val));
+ return safe_cast<TValue>(ret);
+ }
+ case native::GeodeTypeIds::Struct:
+ {
+ return safe_cast<TValue>(Apache::Geode::Client::Struct::Create(val));
+ }
+ case native::GeodeTypeIds::CacheableStack:
+ {
+ Apache::Geode::Client::CacheableStack^ ret = static_cast<Apache::Geode::Client::CacheableStack^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableStack^>(val));
+ return safe_cast<TValue>(ret->Value);
+ }
+ case 7: //GeodeClassIds::CacheableManagedObject
+ {
+ Apache::Geode::Client::CacheableObject^ ret = static_cast<Apache::Geode::Client::CacheableObject^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableObject^>(val));
+ return safe_cast<TValue>(ret);
+ }
+ case 8://GeodeClassIds::CacheableManagedObjectXml
+ {
+ Apache::Geode::Client::CacheableObjectXml^ ret = static_cast<Apache::Geode::Client::CacheableObjectXml^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableObjectXml^>(val));
+ return safe_cast<TValue>(ret);
+ }
+ /* TODO: replace with IDictionary<K, V>
+ case native::GeodeTypeIds::Properties:
+ {
+ Apache::Geode::Client::Properties^ ret = safe_cast<Apache::Geode::Client::Properties^>
+ ( SafeGenericUMSerializableConvert<Apache::Geode::Client::Properties^>(val));
- return safe_cast<TValue>(ret->Value);
- }
- case native::GeodeTypeIds::CacheableHashMap://generic dictionary
- {
- Apache::Geode::Client::CacheableHashMap^ ret = safe_cast<Apache::Geode::Client::CacheableHashMap^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableHashMap^>(val));
+ return safe_cast<TValue>(ret);
+ }*/
- return safe_cast<TValue>(ret->Value);
- }
- case native::GeodeTypeIds::CacheableIdentityHashMap:
- {
- Apache::Geode::Client::CacheableIdentityHashMap^ ret = static_cast<Apache::Geode::Client::CacheableIdentityHashMap^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableIdentityHashMap^>(val));
- return safe_cast<TValue>(ret->Value);
- }
- case native::GeodeTypeIds::CacheableHashSet://no need of it, default case should work
- {
- Apache::Geode::Client::CacheableHashSet^ ret = static_cast<Apache::Geode::Client::CacheableHashSet^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableHashSet^>(val));
- return safe_cast<TValue>(ret);
- }
- case native::GeodeTypeIds::CacheableLinkedHashSet://no need of it, default case should work
- {
- Apache::Geode::Client::CacheableLinkedHashSet^ ret = static_cast<Apache::Geode::Client::CacheableLinkedHashSet^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableLinkedHashSet^>(val));
- return safe_cast<TValue>(ret);
- }
- case native::GeodeTypeIds::CacheableFileName:
- {
- Apache::Geode::Client::CacheableFileName^ ret = static_cast<Apache::Geode::Client::CacheableFileName^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableFileName^>(val));
- return safe_cast<TValue>(ret);
- }
- case native::GeodeTypeIds::CacheableObjectArray:
- {
- Apache::Geode::Client::CacheableObjectArray^ ret = static_cast<Apache::Geode::Client::CacheableObjectArray^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableObjectArray^>(val));
- return safe_cast<TValue>(ret);
- }
- case native::GeodeTypeIds::CacheableVector://collection::arraylist
- {
- Apache::Geode::Client::CacheableVector^ ret = static_cast<Apache::Geode::Client::CacheableVector^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableVector^>(val));
- return safe_cast<TValue>(ret->Value);
- }
- case native::GeodeTypeIds::CacheableUndefined:
- {
- Apache::Geode::Client::CacheableUndefined^ ret = static_cast<Apache::Geode::Client::CacheableUndefined^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableUndefined^>(val));
- return safe_cast<TValue>(ret);
- }
- case native::GeodeTypeIds::Struct:
- {
- return safe_cast<TValue>(Apache::Geode::Client::Struct::Create(val));
- }
- case native::GeodeTypeIds::CacheableStack:
- {
- Apache::Geode::Client::CacheableStack^ ret = static_cast<Apache::Geode::Client::CacheableStack^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableStack^>(val));
- return safe_cast<TValue>(ret->Value);
- }
- case 7: //GeodeClassIds::CacheableManagedObject
- {
- Apache::Geode::Client::CacheableObject^ ret = static_cast<Apache::Geode::Client::CacheableObject^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableObject^>(val));
- return safe_cast<TValue>(ret);
- }
- case 8://GeodeClassIds::CacheableManagedObjectXml
- {
- Apache::Geode::Client::CacheableObjectXml^ ret = static_cast<Apache::Geode::Client::CacheableObjectXml^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CacheableObjectXml^>(val));
- return safe_cast<TValue>(ret);
- }
- /* TODO: replace with IDictionary<K, V>
- case native::GeodeTypeIds::Properties:
+ case native::GeodeTypeIds::BooleanArray:
{
- Apache::Geode::Client::Properties^ ret = safe_cast<Apache::Geode::Client::Properties^>
- ( SafeGenericUMSerializableConvert<Apache::Geode::Client::Properties^>(val));
+ Apache::Geode::Client::BooleanArray^ ret = safe_cast<Apache::Geode::Client::BooleanArray^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::BooleanArray^>(val));
- return safe_cast<TValue>(ret);
+ return safe_cast<TValue>(ret->Value);
+ }
+ case native::GeodeTypeIds::CharArray:
+ {
+ Apache::Geode::Client::CharArray^ ret = safe_cast<Apache::Geode::Client::CharArray^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::CharArray^>(val));
+
+ return safe_cast<TValue>(ret->Value);
+ }
+ case 0://UserFunctionExecutionException unregistered
+ {
+ Apache::Geode::Client::UserFunctionExecutionException^ ret = static_cast<Apache::Geode::Client::UserFunctionExecutionException^>
+ (SafeGenericUMSerializableConvert<Apache::Geode::Client::UserFunctionExecutionException^>(val));
+ return safe_cast<TValue>(ret);
+ }
+ default:
+ throw gcnew System::Exception("not found typeid");
+ }
+ throw gcnew System::Exception("not found typeid");
+ }
+
+ generic<class TKey>
+ native::CacheableKeyPtr Serializable::GetUnmanagedValueGeneric(TKey key)
+ {
+ //System::Type^ managedType = TKey::typeid;
+ if (key != nullptr) {
+ //System::Type^ managedType = key->GetType();
+ return GetUnmanagedValueGeneric(key->GetType(), key);
+ }
+ return nullptr;
+ }
+
+ generic<class TKey>
+ native::CacheableKeyPtr Serializable::GetUnmanagedValueGeneric(TKey key, bool isAciiChar)
+ {
+ //System::Type^ managedType = TKey::typeid;
+ if (key != nullptr) {
+ //System::Type^ managedType = key->GetType();
+ return GetUnmanagedValueGeneric(key->GetType(), key, isAciiChar);
+ }
+ return nullptr;
+ }
+
+ void Serializable::RegisterPdxSerializer(IPdxSerializer^ pdxSerializer)
+ {
+ /*if(PdxSerializer != nullptr )
+ {
+ throw gcnew IllegalStateException("IPdxSerializer is already registered: " + PdxSerializer->GetType());
}*/
+ PdxSerializer = pdxSerializer;
+ }
- case native::GeodeTypeIds::BooleanArray:
- {
- Apache::Geode::Client::BooleanArray^ ret = safe_cast<Apache::Geode::Client::BooleanArray^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::BooleanArray^>(val));
+ void Serializable::SetPdxTypeMapper(IPdxTypeMapper^ pdxTypeMapper)
+ {
+ if (pdxTypeMapper != nullptr)
+ PdxTypeMapper = pdxTypeMapper;
+ }
- return safe_cast<TValue>(ret->Value);
- }
- case native::GeodeTypeIds::CharArray:
- {
- Apache::Geode::Client::CharArray^ ret = safe_cast<Apache::Geode::Client::CharArray^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::CharArray^>(val));
+ String^ Serializable::GetPdxTypeName(String^ localTypeName)
+ {
+ if (PdxTypeMapper == nullptr)
+ return localTypeName;
+ IDictionary<String^, String^>^ tmp = LocalTypeNameToPdx;
+ String^ pdxTypeName = nullptr;
+ tmp->TryGetValue(localTypeName, pdxTypeName);
- return safe_cast<TValue>(ret->Value);
- }
- case 0://UserFunctionExecutionException unregistered
+ if (pdxTypeName != nullptr)
+ return pdxTypeName;
+
+ {
+ msclr::lock lockInstance(LockObj);
+ tmp->TryGetValue(localTypeName, pdxTypeName);
+
+ if (pdxTypeName != nullptr)
+ return pdxTypeName;
+ if (PdxTypeMapper != nullptr)
{
- Apache::Geode::Client::UserFunctionExecutionException^ ret = static_cast<Apache::Geode::Client::UserFunctionExecutionException^>
- (SafeGenericUMSerializableConvert<Apache::Geode::Client::UserFunctionExecutionException^>(val));
- return safe_cast<TValue>(ret);
- }
- default:
- throw gcnew System::Exception("not found typeid");
+ pdxTypeName = PdxTypeMapper->ToPdxTypeName(localTypeName);
+ if (pdxTypeName == nullptr)
+ {
+ throw gcnew IllegalStateException("PdxTypeName should not be null for local type " + localTypeName);
+ }
+
+ Dictionary<String^, String^>^ localToPdx = gcnew Dictionary<String^, String^>(LocalTypeNameToPdx);
+ localToPdx[localTypeName] = pdxTypeName;
+ LocalTypeNameToPdx = localToPdx;
+ Dictionary<String^, String^>^ pdxToLocal = gcnew Dictionary<String^, String^>(PdxTypeNameToLocal);
+ localToPdx[pdxTypeName] = localTypeName;
+ PdxTypeNameToLocal = pdxToLocal;
}
- throw gcnew System::Exception("not found typeid");
}
+ return pdxTypeName;
+ }
+
+ String^ Serializable::GetLocalTypeName(String^ pdxTypeName)
+ {
+ if (PdxTypeMapper == nullptr)
+ return pdxTypeName;
+
+ IDictionary<String^, String^>^ tmp = PdxTypeNameToLocal;
+ String^ localTypeName = nullptr;
+ tmp->TryGetValue(pdxTypeName, localTypeName);
+
+ if (localTypeName != nullptr)
+ return localTypeName;
+
+ {
+ msclr::lock lockInstance(LockObj);
+ tmp->TryGetValue(pdxTypeName, localTypeName);
- generic<class TKey>
- native::CacheableKeyPtr Serializable::GetUnmanagedValueGeneric(TKey key)
+ if (localTypeName != nullptr)
+ return localTypeName;
+ if (PdxTypeMapper != nullptr)
{
- //System::Type^ managedType = TKey::typeid;
- if (key != nullptr) {
- //System::Type^ managedType = key->GetType();
- return GetUnmanagedValueGeneric(key->GetType(), key);
+ localTypeName = PdxTypeMapper->FromPdxTypeName(pdxTypeName);
+ if (localTypeName == nullptr)
+ {
+ throw gcnew IllegalStateException("LocalTypeName should not be null for pdx type " + pdxTypeName);
}
- return nullptr;
+
+ Dictionary<String^, String^>^ localToPdx = gcnew Dictionary<String^, String^>(LocalTypeNameToPdx);
+ localToPdx[localTypeName] = pdxTypeName;
+ LocalTypeNameToPdx = localToPdx;
+ Dictionary<String^, String^>^ pdxToLocal = gcnew Dictionary<String^, String^>(PdxTypeNameToLocal);
+ localToPdx[pdxTypeName] = localTypeName;
+ PdxTypeNameToLocal = pdxToLocal;
}
+ }
+ return localTypeName;
+ }
- generic<class TKey>
- native::CacheableKeyPtr Serializable::GetUnmanagedValueGeneric(TKey key, bool isAciiChar)
- {
- //System::Type^ managedType = TKey::typeid;
- if (key != nullptr) {
- //System::Type^ managedType = key->GetType();
- return GetUnmanagedValueGeneric(key->GetType(), key, isAciiChar);
- }
- return nullptr;
- }
+ void Serializable::Clear()
+ {
+ PdxTypeMapper = nullptr;
+ LocalTypeNameToPdx->Clear();
+ PdxTypeNameToLocal->Clear();
+ ClassNameVsCreateNewObjectDelegate->Clear();
+ ClassNameVsType->Clear();
+ ClassNameVsCreateNewObjectArrayDelegate->Clear();
+ }
- void Serializable::RegisterPdxSerializer(IPdxSerializer^ pdxSerializer)
- {
- /*if(PdxSerializer != nullptr )
- {
- throw gcnew IllegalStateException("IPdxSerializer is already registered: " + PdxSerializer->GetType());
- }*/
- PdxSerializer = pdxSerializer;
- }
+ IPdxSerializer^ Serializable::GetPdxSerializer()
+ {
+ return PdxSerializer;
+ }
- void Serializable::SetPdxTypeMapper(IPdxTypeMapper^ pdxTypeMapper)
- {
- if (pdxTypeMapper != nullptr)
- PdxTypeMapper = pdxTypeMapper;
- }
+ bool Serializable::IsObjectAndPdxSerializerRegistered(String^ className)
+ {
+ return PdxSerializer != nullptr;
+ }
- String^ Serializable::GetPdxTypeName(String^ localTypeName)
- {
- if (PdxTypeMapper == nullptr)
- return localTypeName;
- IDictionary<String^, String^>^ tmp = LocalTypeNameToPdx;
- String^ pdxTypeName = nullptr;
- tmp->TryGetValue(localTypeName, pdxTypeName);
-
- if (pdxTypeName != nullptr)
- return pdxTypeName;
-
- {
- msclr::lock lockInstance(LockObj);
- tmp->TryGetValue(localTypeName, pdxTypeName);
-
- if (pdxTypeName != nullptr)
- return pdxTypeName;
- if (PdxTypeMapper != nullptr)
- {
- pdxTypeName = PdxTypeMapper->ToPdxTypeName(localTypeName);
- if (pdxTypeName == nullptr)
- {
- throw gcnew IllegalStateException("PdxTypeName should not be null for local type " + localTypeName);
- }
-
- Dictionary<String^, String^>^ localToPdx = gcnew Dictionary<String^, String^>(LocalTypeNameToPdx);
- localToPdx[localTypeName] = pdxTypeName;
- LocalTypeNameToPdx = localToPdx;
- Dictionary<String^, String^>^ pdxToLocal = gcnew Dictionary<String^, String^>(PdxTypeNameToLocal);
- localToPdx[pdxTypeName] = localTypeName;
- PdxTypeNameToLocal = pdxToLocal;
- }
- }
- return pdxTypeName;
- }
+ generic<class TKey>
+ native::CacheableKeyPtr Serializable::GetUnmanagedValueGeneric(
+ Type^ managedType, TKey key)
+ {
+ return GetUnmanagedValueGeneric(managedType, key, false);
+ }
- String^ Serializable::GetLocalTypeName(String^ pdxTypeName)
- {
- if (PdxTypeMapper == nullptr)
- return pdxTypeName;
-
- IDictionary<String^, String^>^ tmp = PdxTypeNameToLocal;
- String^ localTypeName = nullptr;
- tmp->TryGetValue(pdxTypeName, localTypeName);
-
- if (localTypeName != nullptr)
- return localTypeName;
-
- {
- msclr::lock lockInstance(LockObj);
- tmp->TryGetValue(pdxTypeName, localTypeName);
-
- if (localTypeName != nullptr)
- return localTypeName;
- if (PdxTypeMapper != nullptr)
- {
- localTypeName = PdxTypeMapper->FromPdxTypeName(pdxTypeName);
- if (localTypeName == nullptr)
- {
- throw gcnew IllegalStateException("LocalTypeName should not be null for pdx type " + pdxTypeName);
- }
-
- Dictionary<String^, String^>^ localToPdx = gcnew Dictionary<String^, String^>(LocalTypeNameToPdx);
- localToPdx[localTypeName] = pdxTypeName;
- LocalTypeNameToPdx = localToPdx;
- Dictionary<String^, String^>^ pdxToLocal = gcnew Dictionary<String^, String^>(PdxTypeNameToLocal);
- localToPdx[pdxTypeName] = localTypeName;
- PdxTypeNameToLocal = pdxToLocal;
- }
- }
- return localTypeName;
- }
+ generic<class TKey>
+ native::CacheableKeyPtr Serializable::GetUnmanagedValueGeneric(
+ Type^ managedType, TKey key, bool isAsciiChar)
+ {
+ Byte typeId = Apache::Geode::Client::Serializable::GetManagedTypeMappingGeneric(managedType);
- void Serializable::Clear()
- {
- PdxTypeMapper = nullptr;
- LocalTypeNameToPdx->Clear();
- PdxTypeNameToLocal->Clear();
- ClassNameVsCreateNewObjectDelegate->Clear();
- ClassNameVsType->Clear();
- ClassNameVsCreateNewObjectArrayDelegate->Clear();
- }
+ switch (typeId)
+ {
+ case native::GeodeTypeIds::CacheableByte: {
+ return Serializable::getCacheableByte((SByte)key);
+ }
+ case native::GeodeTypeIds::CacheableBoolean:
+ return Serializable::getCacheableBoolean((bool)key);
+ case native::GeodeTypeIds::CacheableWideChar:
+ return Serializable::getCacheableWideChar((Char)key);
+ case native::GeodeTypeIds::CacheableDouble:
+ return Serializable::getCacheableDouble((double)key);
+ case native::GeodeTypeIds::CacheableASCIIString: {
+ if (isAsciiChar)
+ return Serializable::getCacheableASCIIString2((String^)key);
+ else
+ return Serializable::getCacheableASCIIString((String^)key);
+ }
+ case native::GeodeTypeIds::CacheableFloat:
+ return Serializable::getCacheableFloat((float)key);
+ case native::GeodeTypeIds::CacheableInt16: {
+ return Serializable::getCacheableInt16((System::Int16)key);
+ }
+ case native::GeodeTypeIds::CacheableInt32: {
+ return Serializable::getCacheableInt32((System::Int32)key);
+ }
+ case native::GeodeTypeIds::CacheableInt64: {
+ return Serializable::getCacheableInt64((System::Int64)key);
+ }
+ case native::GeodeTypeIds::CacheableBytes:
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableBytes::Create((array<Byte>^)key)));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CacheableDoubleArray:
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableDoubleArray::Create((array<Double>^)key)));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CacheableFloatArray:
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableFloatArray::Create((array<float>^)key)));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CacheableInt16Array:
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableInt16Array::Create((array<Int16>^)key)));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CacheableInt32Array:
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableInt32Array::Create((array<Int32>^)key)));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CacheableInt64Array:
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableInt64Array::Create((array<Int64>^)key)));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CacheableStringArray:
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableStringArray::Create((array<String^>^)key)));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CacheableFileName:
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)(Apache::Geode::Client::CacheableFileName^)key));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CacheableHashTable://collection::hashtable
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableHashTable::Create((System::Collections::Hashtable^)key)));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CacheableHashMap://generic dictionary
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableHashMap::Create((System::Collections::IDictionary^)key)));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CacheableVector://collection::arraylist
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)CacheableVector::Create((System::Collections::IList^)key)));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CacheableArrayList://generic ilist
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableArrayList::Create((System::Collections::IList^)key)));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CacheableLinkedList://generic linked list
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableLinkedList::Create((System::Collections::Generic::LinkedList<Object^>^)key)));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CacheableStack:
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert(Apache::Geode::Client::CacheableStack::Create((System::Collections::ICollection^)key)));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case 7: //GeodeClassIds::CacheableManagedObject
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((Apache::Geode::Client::CacheableObject^)key));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case 8://GeodeClassIds::CacheableManagedObjectXml
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((Apache::Geode::Client::CacheableObjectXml^)key));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CacheableObjectArray:
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((Apache::Geode::Client::CacheableObjectArray^)key));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CacheableIdentityHashMap:
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert(Apache::Geode::Client::CacheableIdentityHashMap::Create((System::Collections::IDictionary^)key)));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CacheableHashSet://no need of it, default case should work
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((Apache::Geode::Client::CacheableHashSet^)key));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CacheableLinkedHashSet://no need of it, default case should work
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((Apache::Geode::Client::CacheableLinkedHashSet^)key));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CacheableDate:
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableDate::Create((System::DateTime)key)));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::BooleanArray:
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::BooleanArray::Create((array<bool>^)key)));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ case native::GeodeTypeIds::CharArray:
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CharArray::Create((array<Char>^)key)));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ default:
+ {
+ native::CacheablePtr kPtr(SafeGenericMSerializableConvert(key));
+ return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
+ }
+ }
+ } //
- IPdxSerializer^ Serializable::GetPdxSerializer()
- {
- return PdxSerializer;
- }
+ String^ Serializable::GetString(native::CacheableStringPtr cStr)//native::CacheableString*
+ {
+ if (cStr == nullptr) {
+ return nullptr;
+ }
+ else if (cStr->isWideString()) {
+ return ManagedString::Get(cStr->asWChar());
+ }
+ else {
+ return ManagedString::Get(cStr->asChar());
+ }
+ }
- bool Serializable::IsObjectAndPdxSerializerRegistered(String^ className)
- {
- return PdxSerializer != nullptr;
- }
+ // These are the new static methods to get/put data from c++
- generic<class TKey>
- native::CacheableKeyPtr Serializable::GetUnmanagedValueGeneric(
- Type^ managedType, TKey key)
- {
- return GetUnmanagedValueGeneric(managedType, key, false);
- }
+ //byte
+ Byte Serializable::getByte(native::SerializablePtr nativeptr)
+ {
+ native::CacheableByte* ci = static_cast<native::CacheableByte*>(nativeptr.get());
+ return ci->value();
+ }
+
+ native::CacheableKeyPtr Serializable::getCacheableByte(SByte val)
+ {
+ return native::CacheableByte::create(val);
+ }
+
+ //boolean
+ bool Serializable::getBoolean(native::SerializablePtr nativeptr)
+ {
+ native::CacheableBoolean* ci = static_cast<native::CacheableBoolean*>(nativeptr.get());
+ return ci->value();
+ }
- generic<class TKey>
- native::CacheableKeyPtr Serializable::GetUnmanagedValueGeneric(
- Type^ managedType, TKey key, bool isAsciiChar)
- {
- Byte typeId = Apache::Geode::Client::Serializable::GetManagedTypeMappingGeneric(managedType);
-
- switch (typeId)
- {
- case native::GeodeTypeIds::CacheableByte: {
- return Serializable::getCacheableByte((SByte)key);
- }
- case native::GeodeTypeIds::CacheableBoolean:
- return Serializable::getCacheableBoolean((bool)key);
- case native::GeodeTypeIds::CacheableWideChar:
- return Serializable::getCacheableWideChar((Char)key);
- case native::GeodeTypeIds::CacheableDouble:
- return Serializable::getCacheableDouble((double)key);
- case native::GeodeTypeIds::CacheableASCIIString: {
- if (isAsciiChar)
- return Serializable::getCacheableASCIIString2((String^)key);
- else
- return Serializable::getCacheableASCIIString((String^)key);
- }
- case native::GeodeTypeIds::CacheableFloat:
- return Serializable::getCacheableFloat((float)key);
- case native::GeodeTypeIds::CacheableInt16: {
- return Serializable::getCacheableInt16((System::Int16)key);
- }
- case native::GeodeTypeIds::CacheableInt32: {
- return Serializable::getCacheableInt32((System::Int32)key);
- }
- case native::GeodeTypeIds::CacheableInt64: {
- return Serializable::getCacheableInt64((System::Int64)key);
- }
- case native::GeodeTypeIds::CacheableBytes:
- {
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableBytes::Create((array<Byte>^)key)));
- return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
- }
- case native::GeodeTypeIds::CacheableDoubleArray:
- {
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableDoubleArray::Create((array<Double>^)key)));
- return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
- }
- case native::GeodeTypeIds::CacheableFloatArray:
- {
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableFloatArray::Create((array<float>^)key)));
- return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
- }
- case native::GeodeTypeIds::CacheableInt16Array:
- {
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableInt16Array::Create((array<Int16>^)key)));
- return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
- }
- case native::GeodeTypeIds::CacheableInt32Array:
- {
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableInt32Array::Create((array<Int32>^)key)));
- return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
- }
- case native::GeodeTypeIds::CacheableInt64Array:
- {
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableInt64Array::Create((array<Int64>^)key)));
- return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
- }
- case native::GeodeTypeIds::CacheableStringArray:
- {
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableStringArray::Create((array<String^>^)key)));
- return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
- }
- case native::GeodeTypeIds::CacheableFileName:
- {
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)(Apache::Geode::Client::CacheableFileName^)key));
- return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
- }
- case native::GeodeTypeIds::CacheableHashTable://collection::hashtable
- {
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableHashTable::Create((System::Collections::Hashtable^)key)));
- return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
- }
- case native::GeodeTypeIds::CacheableHashMap://generic dictionary
- {
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableHashMap::Create((System::Collections::IDictionary^)key)));
- return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
- }
- case native::GeodeTypeIds::CacheableVector://collection::arraylist
- {
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)CacheableVector::Create((System::Collections::IList^)key)));
- return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
- }
- case native::GeodeTypeIds::CacheableArrayList://generic ilist
- {
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableArrayList::Create((System::Collections::IList^)key)));
- return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
- }
- case native::GeodeTypeIds::CacheableLinkedList://generic linked list
- {
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableLinkedList::Create((System::Collections::Generic::LinkedList<Object^>^)key)));
- return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
- }
- case native::GeodeTypeIds::CacheableStack:
- {
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert(Apache::Geode::Client::CacheableStack::Create((System::Collections::ICollection^)key)));
- return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
- }
- case 7: //GeodeClassIds::CacheableManagedObject
- {
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((Apache::Geode::Client::CacheableObject^)key));
- return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
- }
- case 8://GeodeClassIds::CacheableManagedObjectXml
- {
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((Apache::Geode::Client::CacheableObjectXml^)key));
- return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
- }
- case native::GeodeTypeIds::CacheableObjectArray:
- {
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((Apache::Geode::Client::CacheableObjectArray^)key));
- return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
- }
- case native::GeodeTypeIds::CacheableIdentityHashMap:
- {
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert(Apache::Geode::Client::CacheableIdentityHashMap::Create((System::Collections::IDictionary^)key)));
- return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
- }
- case native::GeodeTypeIds::CacheableHashSet://no need of it, default case should work
- {
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((Apache::Geode::Client::CacheableHashSet^)key));
- return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
- }
- case native::GeodeTypeIds::CacheableLinkedHashSet://no need of it, default case should work
- {
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((Apache::Geode::Client::CacheableLinkedHashSet^)key));
- return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
- }
- case native::GeodeTypeIds::CacheableDate:
- {
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CacheableDate::Create((System::DateTime)key)));
- return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
- }
- case native::GeodeTypeIds::BooleanArray:
- {
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::BooleanArray::Create((array<bool>^)key)));
- return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
- }
- case native::GeodeTypeIds::CharArray:
- {
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert((IGeodeSerializable^)Apache::Geode::Client::CharArray::Create((array<Char>^)key)));
- return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
- }
- default:
- {
- native::CacheablePtr kPtr(SafeGenericMSerializableConvert(key));
- return std::dynamic_pointer_cast<native::CacheableKey>(kPtr);
- }
- }
- } //
-
- String^ Serializable::GetString(native::CacheableStringPtr cStr)//native::CacheableString*
- {
- if (cStr == nullptr) {
- return nullptr;
- }
- else if (cStr->isWideString()) {
- return ManagedString::Get(cStr->asWChar());
- }
- else {
- return ManagedString::Get(cStr->asChar());
- }
- }
-
- // These are the new static methods to get/put data from c++
-
- //byte
- Byte Serializable::getByte(native::SerializablePtr nativeptr)
- {
- native::CacheableByte* ci = static_cast<native::CacheableByte*>(nativeptr.get());
- return ci->value();
- }
-
- native::CacheableKeyPtr Serializable::getCacheableByte(SByte val)
- {
- return native::CacheableByte::create(val);
- }
-
- //boolean
- bool Serializable::getBoolean(native::SerializablePtr nativeptr)
- {
- native::CacheableBoolean* ci = static_cast<native::CacheableBoolean*>(nativeptr.get());
- return ci->value();
- }
-
- native::CacheableKeyPtr Serializable::getCacheableBoolean(bool val)
- {
- return native::CacheableBoolean::create(val);
- }
-
- //widechar
- Char Serializable::getChar(native::SerializablePtr nativeptr)
- {
- native::CacheableWideChar* ci = static_cast<native::CacheableWideChar*>(nativeptr.get());
- return ci->value();
- }
-
- native::CacheableKeyPtr Serializable::getCacheableWideChar(Char val)
- {
- return native::CacheableWideChar::create(val);
- }
-
- //double
- double Serializable::getDouble(native::SerializablePtr nativeptr)
- {
- native::CacheableDouble* ci = static_cast<native::CacheableDouble*>(nativeptr.get());
- return ci->value();
- }
-
- native::CacheableKeyPtr Serializable::getCacheableDouble(double val)
- {
- return native::CacheableDouble::create(val);
- }
-
- //float
- float Serializable::getFloat(native::SerializablePtr nativeptr)
- {
- native::CacheableFloat* ci = static_cast<native::CacheableFloat*>(nativeptr.get());
- return ci->value();
- }
-
- native::CacheableKeyPtr Serializable::getCacheableFloat(float val)
- {
- return native::CacheableFloat::create(val);
- }
-
- //int16
- System::Int16 Serializable::getInt16(native::SerializablePtr nativeptr)
- {
- native::CacheableInt16* ci = static_cast<native::CacheableInt16*>(nativeptr.get());
- return ci->value();
- }
-
- native::CacheableKeyPtr Serializable::getCacheableInt16(int val)
- {
- return native::CacheableInt16::create(val);
- }
-
- //int32
- System::Int32 Serializable::getInt32(native::SerializablePtr nativeptr)
- {
- native::CacheableInt32* ci = static_cast<native::CacheableInt32*>(nativeptr.get());
- return ci->value();
- }
-
- native::CacheableKeyPtr Serializable::getCacheableInt32(System::Int32 val)
- {
- return native::CacheableInt32::create(val);
- }
-
- //int64
- System::Int64 Serializable::getInt64(native::SerializablePtr nativeptr)
- {
- native::CacheableInt64* ci = static_cast<native::CacheableInt64*>(nativeptr.get());
- return ci->value();
- }
-
- native::CacheableKeyPtr Serializable::getCacheableInt64(System::Int64 val)
- {
- return native::CacheableInt64::create(val);
- }
-
- //cacheable ascii string
- String^ Serializable::getASCIIString(native::SerializablePtr nativeptr)
- {
- //native::CacheableString* ci = static_cast<native::CacheableString*>(nativeptr.get());
- //return GetString(ci);
- return GetString(nativeptr->toString());
- }
-
- native::CacheableKeyPtr Serializable::getCacheableASCIIString(String^ val)
- {
- return GetCacheableString(val);
- }
-
- native::CacheableKeyPtr Serializable::getCacheableASCIIString2(String^ val)
- {
- return GetCacheableString2(val);
- }
-
- //cacheable ascii string huge
- String^ Serializable::getASCIIStringHuge(native::SerializablePtr nativeptr)
- {
- //native::CacheableString* ci = static_cast<native::CacheableString*>(nativeptr.get());
- //return GetString(ci);
- return GetString(nativeptr->toString());
- }
-
- native::CacheableKeyPtr Serializable::getCacheableASCIIStringHuge(String^ val)
- {
- return GetCacheableString(val);
- }
-
- //cacheable string
- String^ Serializable::getUTFString(native::SerializablePtr nativeptr)
- {
- //native::CacheableString* ci = static_cast<native::CacheableString*>(nativeptr.get());
- //return GetString(ci);
- return GetString(nativeptr->toString());
- }
-
- native::CacheableKeyPtr Serializable::getCacheableUTFString(String^ val)
- {
- return GetCacheableString(val);
- }
-
- //cacheable string huge
- String^ Serializable::getUTFStringHuge(native::SerializablePtr nativeptr)
- {
- //native::CacheableString* ci = static_cast<native::CacheableString*>(nativeptr.get());
- //return GetString(ci);
- return GetString(nativeptr->toString());
- }
-
- native::CacheableKeyPtr Serializable::getCacheableUTFStringHuge(String^ val)
- {
- return GetCacheableString(val);
- }
-
- native::CacheableStringPtr Serializable::GetCacheableString(String^ value)
- {
- native::CacheableStringPtr cStr;
- size_t len = 0;
- if (value != nullptr) {
- len = value->Length;
- pin_ptr<const wchar_t> pin_value = PtrToStringChars(value);
- cStr = native::CacheableString::create(pin_value, Convert::ToInt32(len));
- }
- else {
- cStr.reset(static_cast<native::CacheableString *>(
- native::CacheableString::createDeserializable()));
- }
-
- return cStr;
- }
-
- native::CacheableStringPtr Serializable::GetCacheableString2(String^ value)
- {
- native::CacheableStringPtr cStr;
- size_t len = 0;
- if (value != nullptr) {
- len = value->Length;
- const char* chars =
- (const char*)(Marshal::StringToHGlobalAnsi(value)).ToPointer();
- cStr = native::CacheableString::create(chars, Convert::ToInt32(len));
- Marshal::FreeHGlobal(IntPtr((void*)chars));
- }
- else {
- cStr.reset(static_cast<native::CacheableString*>(
- native::CacheableString::createDeserializable()));
- }
-
- return cStr;
- }
-
- /*
- static String^ GetString(native::CacheableStringPtr cStr)//native::CacheableString*
- {
- if (cStr == nullptr) {
- return nullptr;
- }
- else if (cStr->isWideString()) {
- return ManagedString::Get(cStr->asWChar());
- }
- else {
- return ManagedString::Get(cStr->asChar());
- }
- }
- */
-
- array<Byte>^ Serializable::getSByteArray(array<SByte>^ sArray)
- {
- array<Byte>^ dArray = gcnew array<Byte>(sArray->Length);
- for (int index = 0; index < dArray->Length; index++)
- {
- dArray[index] = sArray[index];
- }
- return dArray;
- }
-
- array<System::Int16>^ Serializable::getInt16Array(array<System::UInt16>^ sArray)
- {
- array<System::Int16>^ dArray = gcnew array<System::Int16>(sArray->Length);
- for (int index = 0; index < dArray->Length; index++)
- {
- dArray[index] = sArray[index];
- }
- return dArray;
- }
-
- array<System::Int32>^ Serializable::getInt32Array(array<System::UInt32>^ sArray)
- {
- array<System::Int32>^ dArray = gcnew array<System::Int32>(sArray->Length);
- for (int index = 0; index < dArray->Length; index++)
- {
- dArray[index] = sArray[index];
- }
- return dArray;
- }
-
- array<System::Int64>^ Serializable::getInt64Array(array<System::UInt64>^ sArray)
- {
- array<System::Int64>^ dArray = gcnew array<System::Int64>(sArray->Length);
- for (int index = 0; index < dArray->Length; index++)
- {
- dArray[index] = sArray[index];
- }
- return dArray;
- } // namespace Client
- } // namespace Geode
- } // namespace Apache
-
-}
+ native::CacheableKeyPtr Serializable::getCacheableBoolean(bool val)
+ {
+ return native::CacheableBoolean::create(val);
+ }
+
+ //widechar
+ Char Serializable::getChar(native::SerializablePtr nativeptr)
+ {
+ native::CacheableWideChar* ci = static_cast<native::CacheableWideChar*>(nativeptr.get());
+ return ci->value();
+ }
+
+ native::CacheableKeyPtr Serializable::getCacheableWideChar(Char val)
+ {
+ return native::CacheableWideChar::create(val);
+ }
+
+ //double
+ double Serializable::getDouble(native::SerializablePtr nativeptr)
+ {
+ native::CacheableDouble* ci = static_cast<native::CacheableDouble*>(nativeptr.get());
+ return ci->value();
+ }
+
+ native::CacheableKeyPtr Serializable::getCacheableDouble(double val)
+ {
+ return native::CacheableDouble::create(val);
+ }
+
+ //float
+ float Serializable::getFloat(native::SerializablePtr nativeptr)
+ {
+ native::CacheableFloat* ci = static_cast<native::CacheableFloat*>(nativeptr.get());
+ return ci->value();
+ }
+
+ native::CacheableKeyPtr Serializable::getCacheableFloat(float val)
+ {
+ return native::CacheableFloat::create(val);
+ }
+
+ //int16
+ System::Int16 Serializable::getInt16(native::SerializablePtr nativeptr)
+ {
+ native::CacheableInt16* ci = static_cast<native::CacheableInt16*>(nativeptr.get());
+ return ci->value();
+ }
+
+ native::CacheableKeyPtr Serializable::getCacheableInt16(int val)
+ {
+ return native::CacheableInt16::create(val);
+ }
+
+ //int32
+ System::Int32 Serializable::getInt32(native::SerializablePtr nativeptr)
+ {
+ native::CacheableInt32* ci = static_cast<native::CacheableInt32*>(nativeptr.get());
+ return ci->value();
+ }
+
+ native::CacheableKeyPtr Serializable::getCacheableInt32(System::Int32 val)
+ {
+ return native::CacheableInt32::create(val);
+ }
+
+ //int64
+ System::Int64 Serializable::getInt64(native::SerializablePtr nativeptr)
+ {
+ native::CacheableInt64* ci = static_cast<native::CacheableInt64*>(nativeptr.get());
+ return ci->value();
+ }
+
+ native::CacheableKeyPtr Serializable::getCacheableInt64(System::Int64 val)
+ {
+ return native::CacheableInt64::create(val);
+ }
+
+ //cacheable ascii string
+ String^ Serializable::getASCIIString(native::SerializablePtr nativeptr)
+ {
+ return GetString(nativeptr->toString());
+ }
+
+ native::CacheableKeyPtr Serializable::getCacheableASCIIString(String^ val)
+ {
+ return GetCacheableString(val);
+ }
+
+ native::CacheableKeyPtr Serializable::getCacheableASCIIString2(String^ val)
+ {
+ return GetCacheableString2(val);
+ }
+
+ //cacheable ascii string huge
+ String^ Serializable::getASCIIStringHuge(native::SerializablePtr nativeptr)
+ {
+ return GetString(nativeptr->toString());
+ }
+
+ native::CacheableKeyPtr Serializable::getCacheableASCIIStringHuge(String^ val)
+ {
+ return GetCacheableString(val);
+ }
+
+ //cacheable string
+ String^ Serializable::getUTFString(native::SerializablePtr nativeptr)
+ {
+ return GetString(nativeptr->toString());
+ }
+
+ native::CacheableKeyPtr Serializable::getCacheableUTFString(String^ val)
+ {
+ return GetCacheableString(val);
+ }
+
+ //cacheable string huge
+ String^ Serializable::getUTFStringHuge(native::SerializablePtr nativeptr)
+ {
+ return GetString(nativeptr->toString());
+ }
+
+ native::CacheableKeyPtr Serializable::getCacheableUTFStringHuge(String^ val)
+ {
+ return GetCacheableString(val);
+ }
+
+ native::CacheableStringPtr Serializable::GetCacheableString(String^ value)
+ {
+ native::CacheableStringPtr cStr;
+ size_t len = 0;
+ if (value != nullptr) {
+ len = value->Length;
+ pin_ptr<const wchar_t> pin_value = PtrToStringChars(value);
+ cStr = native::CacheableString::create(pin_value, Convert::ToInt32(len));
+ }
+ else {
+ cStr.reset(static_cast<native::CacheableString *>(
+ native::CacheableString::createDeserializable()));
+ }
+
+ return cStr;
+ }
+
+ native::CacheableStringPtr Serializable::GetCacheableString2(String^ value)
+ {
+ native::CacheableStringPtr cStr;
+ size_t len = 0;
+ if (value != nullptr) {
+ len = value->Length;
+ const char* chars = (const char*)(Marshal::StringToHGlobalAnsi(value)).ToPointer();
+ try
+ {
+ cStr = native::CacheableString::create(chars, Convert::ToInt32(len));
+ }
+ finally
+ {
+ Marshal::FreeHGlobal(IntPtr((void*)chars));
+ }
+ }
+ else {
+ cStr.reset(static_cast<native::CacheableString*>(
+ native::CacheableString::createDeserializable()));
+ }
+
+ return cStr;
+ }
+
+ array<Byte>^ Serializable::getSByteArray(array<SByte>^ sArray)
+ {
+ array<Byte>^ dArray = gcnew array<Byte>(sArray->Length);
+ for (int index = 0; index < dArray->Length; index++)
+ {
+ dArray[index] = sArray[index];
+ }
+ return dArray;
+ }
+
+ array<System::Int16>^ Serializable::getInt16Array(array<System::UInt16>^ sArray)
+ {
+ array<System::Int16>^ dArray = gcnew array<System::Int16>(sArray->Length);
+ for (int index = 0; index < dArray->Length; index++)
+ {
+ dArray[index] = sArray[index];
+ }
+ return dArray;
+ }
+
+ array<System::Int32>^ Serializable::getInt32Array(array<System::UInt32>^ sArray)
+ {
+ array<System::Int32>^ dArray = gcnew array<System::Int32>(sArray->Length);
+ for (int index = 0; index < dArray->Length; index++)
+ {
+ dArray[index] = sArray[index];
+ }
+ return dArray;
+ }
+
+ array<System::Int64>^ Serializable::getInt64Array(array<System::UInt64>^ sArray)
+ {
+ array<System::Int64>^ dArray = gcnew array<System::Int64>(sArray->Length);
+ for (int index = 0; index < dArray->Length; index++)
+ {
+ dArray[index] = sArray[index];
+ }
+ return dArray;
+ }
+ } // namespace Client
+ } // namespace Geode
+} // namespace Apache
[26/46] geode-native git commit: GEODE-2741: Remove custom shared
pointer from cppcache
Posted by jb...@apache.org.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/RegionAttributes.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/RegionAttributes.hpp b/src/cppcache/include/geode/RegionAttributes.hpp
index f526f93..85d7319 100644
--- a/src/cppcache/include/geode/RegionAttributes.hpp
+++ b/src/cppcache/include/geode/RegionAttributes.hpp
@@ -76,28 +76,28 @@ class CPPCACHE_EXPORT RegionAttributes : public Serializable {
public:
/** Gets the cache loader for the region.
* @return a pointer that points to the region's ,
- * <code>CacheLoader</code> , NULLPTR if there is no CacheLoader for this
+ * <code>CacheLoader</code> , nullptr if there is no CacheLoader for this
* region.
*/
CacheLoaderPtr getCacheLoader();
/** Gets the cache writer for the region.
* @return a pointer that points to the region's ,
- * <code>CacheWriter</code> , NULLPTR if there is no CacheWriter for this
+ * <code>CacheWriter</code> , nullptr if there is no CacheWriter for this
* region
*/
CacheWriterPtr getCacheWriter();
/** Gets the cache listener for the region.
* @return a pointer that points to the region's ,
- * <code>CacheListener</code> , NULLPTR if there is no CacheListener defined
+ * <code>CacheListener</code> , nullptr if there is no CacheListener defined
* for this region.
*/
CacheListenerPtr getCacheListener();
/** Gets the partition resolver for the partition region.
* @return a pointer that points to the region's ,
- * <code>PartitionResolver</code> , NULLPTR if there is no PartitionResolver
+ * <code>PartitionResolver</code> , nullptr if there is no PartitionResolver
* defined
* for this region.
*/
@@ -292,7 +292,7 @@ class CPPCACHE_EXPORT RegionAttributes : public Serializable {
/** Gets the persistence for the region.
* @return a pointer that points to the region's ,
- * <code>PersistenceManager</code> , NULLPTR if there is no PersistenceManager
+ * <code>PersistenceManager</code> , nullptr if there is no PersistenceManager
* for this
* region.
*/
@@ -395,6 +395,8 @@ class CPPCACHE_EXPORT RegionAttributes : public Serializable {
private:
const RegionAttributes& operator=(const RegionAttributes&);
+
+ FRIEND_STD_SHARED_PTR(RegionAttributes)
};
} // namespace client
} // namespace geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/RegionEntry.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/RegionEntry.hpp b/src/cppcache/include/geode/RegionEntry.hpp
index c6b3e7d..0f50951 100644
--- a/src/cppcache/include/geode/RegionEntry.hpp
+++ b/src/cppcache/include/geode/RegionEntry.hpp
@@ -59,7 +59,7 @@ class CPPCACHE_EXPORT RegionEntry : public SharedBase {
/** Returns the value of this entry in the local cache. Does not invoke
* a <code>CacheLoader</code>,
*
- * @return the value or <code>NULLPTR</code> if this entry is invalid
+ * @return the value or <code>nullptr</code> if this entry is invalid
*/
CacheablePtr getValue();
@@ -67,7 +67,7 @@ class CPPCACHE_EXPORT RegionEntry : public SharedBase {
*
* @return the Region that contains this entry
*/
- void getRegion(RegionPtr& region);
+ void getRegion(Region* region);
/** Returns the statistics for this entry.
*
@@ -95,9 +95,9 @@ class CPPCACHE_EXPORT RegionEntry : public SharedBase {
* @brief constructors
* created by region
*/
- RegionEntry(const RegionPtr& region, const CacheableKeyPtr& key,
+ RegionEntry(Region* region, const CacheableKeyPtr& key,
const CacheablePtr& value);
- RegionPtr m_region;
+ Region* m_region;
CacheableKeyPtr m_key;
CacheablePtr m_value;
CacheStatisticsPtr m_statistics;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/RegionFactory.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/RegionFactory.hpp b/src/cppcache/include/geode/RegionFactory.hpp
index d411ab0..b2729a2 100644
--- a/src/cppcache/include/geode/RegionFactory.hpp
+++ b/src/cppcache/include/geode/RegionFactory.hpp
@@ -31,7 +31,9 @@ namespace apache {
namespace geode {
namespace client {
class CacheImpl;
-class CPPCACHE_EXPORT RegionFactory : public SharedBase {
+class CPPCACHE_EXPORT RegionFactory
+ : public SharedBase,
+ public std::enable_shared_from_this<RegionFactory> {
public:
/*
* To create the (@link Region}.
@@ -44,26 +46,26 @@ class CPPCACHE_EXPORT RegionFactory : public SharedBase {
RegionPtr create(const char* name);
/** Sets the cache loader for the next <code>RegionAttributes</code> created.
- * @param cacheLoader the cache loader or NULLPTR if no loader
+ * @param cacheLoader the cache loader or nullptr if no loader
* @return a reference to <code>this</code>
*/
RegionFactoryPtr setCacheLoader(const CacheLoaderPtr& cacheLoader);
/** Sets the cache writer for the next <code>RegionAttributes</code> created.
- * @param cacheWriter the cache writer or NULLPTR if no cache writer
+ * @param cacheWriter the cache writer or nullptr if no cache writer
* @return a reference to <code>this</code>
*/
RegionFactoryPtr setCacheWriter(const CacheWriterPtr& cacheWriter);
/** Sets the CacheListener for the next <code>RegionAttributes</code> created.
- * @param aListener a user defined CacheListener, NULLPTR if no listener
+ * @param aListener a user defined CacheListener, nullptr if no listener
* @return a reference to <code>this</code>
*/
RegionFactoryPtr setCacheListener(const CacheListenerPtr& aListener);
/** Sets the PartitionResolver for the next <code>RegionAttributes</code>
* created.
- * @param aResolver a user defined PartitionResolver, NULLPTR if no resolver
+ * @param aResolver a user defined PartitionResolver, nullptr if no resolver
* @return a reference to <code>this</code>
*/
RegionFactoryPtr setPartitionResolver(const PartitionResolverPtr& aResolver);
@@ -149,17 +151,17 @@ class CPPCACHE_EXPORT RegionFactory : public SharedBase {
*/
RegionFactoryPtr setPersistenceManager(const char* libpath,
const char* factoryFuncName,
- const PropertiesPtr& config = NULLPTR);
+ const PropertiesPtr& config = nullptr);
/** Sets the PersistenceManager for the next <code>RegionAttributes</code>
* created.
- * @param persistenceManager a user defined PersistenceManager, NULLPTR if no
+ * @param persistenceManager a user defined PersistenceManager, nullptr if no
* persistenceManager
* @return a reference to <code>this</code>
*/
RegionFactoryPtr setPersistenceManager(
const PersistenceManagerPtr& persistenceManager,
- const PropertiesPtr& config = NULLPTR);
+ const PropertiesPtr& config = nullptr);
// MAP ATTRIBUTES
/** Sets the entry initial capacity for the next <code>RegionAttributes</code>
@@ -263,6 +265,7 @@ class CPPCACHE_EXPORT RegionFactory : public SharedBase {
~RegionFactory();
friend class CacheImpl;
+ FRIEND_STD_SHARED_PTR(RegionFactory)
};
} // namespace client
} // namespace geode
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/RegionService.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/RegionService.hpp b/src/cppcache/include/geode/RegionService.hpp
index 8f8ae67..f031141 100644
--- a/src/cppcache/include/geode/RegionService.hpp
+++ b/src/cppcache/include/geode/RegionService.hpp
@@ -87,7 +87,7 @@ class CPPCACHE_EXPORT RegionService : public SharedBase {
/** Look up a region with the name.
*
* @param name the region's name, such as <code>root</code>.
- * @returns region, or NULLPTR if no such region exists.
+ * @returns region, or nullptr if no such region exists.
*/
virtual RegionPtr getRegion(const char* name) = 0;
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/SelectResultsIterator.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/SelectResultsIterator.hpp b/src/cppcache/include/geode/SelectResultsIterator.hpp
index b51cdd0..1a61c96 100644
--- a/src/cppcache/include/geode/SelectResultsIterator.hpp
+++ b/src/cppcache/include/geode/SelectResultsIterator.hpp
@@ -56,7 +56,7 @@ class CPPCACHE_EXPORT SelectResultsIterator : public SharedBase {
/**
* Get the next item from the SelectResultsIterator.
*
- * @returns a smart pointer to the next item from the iterator or NULLPTR if
+ * @returns a smart pointer to the next item from the iterator or nullptr if
* no further items are available.
*/
const SerializablePtr next();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/Serializable.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/Serializable.hpp b/src/cppcache/include/geode/Serializable.hpp
index 5a16d7d..2305f09 100644
--- a/src/cppcache/include/geode/Serializable.hpp
+++ b/src/cppcache/include/geode/Serializable.hpp
@@ -50,7 +50,9 @@ typedef PdxSerializable* (*TypeFactoryMethodPdx)();
* in the cache that can be serialized.
*/
-class CPPCACHE_EXPORT Serializable : public SharedBase {
+class CPPCACHE_EXPORT Serializable
+ : public SharedBase,
+ public std::enable_shared_from_this<Serializable> {
public:
/**
*@brief serialize this object
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/Serializer.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/Serializer.hpp b/src/cppcache/include/geode/Serializer.hpp
index 3c40e3d..19d9965 100644
--- a/src/cppcache/include/geode/Serializer.hpp
+++ b/src/cppcache/include/geode/Serializer.hpp
@@ -325,7 +325,7 @@ inline uint32_t objectSize(const _VectorOfCacheable& value) {
uint32_t objectSize = 0;
for (_VectorOfCacheable::Iterator iter = value.begin(); iter != value.end();
++iter) {
- if (*iter != NULLPTR) {
+ if (*iter != nullptr) {
objectSize += (*iter)->objectSize();
}
}
@@ -366,7 +366,7 @@ inline uint32_t objectSize(const _HashMapOfCacheable& value) {
for (_HashMapOfCacheable::Iterator iter = value.begin(); iter != value.end();
++iter) {
objectSize += iter.first()->objectSize();
- if (iter.second() != NULLPTR) {
+ if (iter.second() != nullptr) {
objectSize += iter.second()->objectSize();
}
}
@@ -406,7 +406,7 @@ inline uint32_t objectSize(const _HashSetOfCacheableKey& value) {
uint32_t objectSize = 0;
for (_HashSetOfCacheableKey::Iterator iter = value.begin();
iter != value.end(); ++iter) {
- if (*iter != NULLPTR) {
+ if (*iter != nullptr) {
objectSize += (*iter)->objectSize();
}
}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/SharedBase.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/SharedBase.hpp b/src/cppcache/include/geode/SharedBase.hpp
index 97cb0ae..642ed0a 100644
--- a/src/cppcache/include/geode/SharedBase.hpp
+++ b/src/cppcache/include/geode/SharedBase.hpp
@@ -3,8 +3,6 @@
#ifndef GEODE_SHAREDBASE_H_
#define GEODE_SHAREDBASE_H_
-// SharedBase.hpp -*- mode: c++ -*-
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -34,58 +32,23 @@ namespace client {
/**
* @class SharedBase SharedBase.hpp
*
- * This abstract base class is the base class of all user objects
- * that have the shared capability of reference counting.
+ * This abstract base class is the base class of all user objects.
*/
class CPPCACHE_EXPORT SharedBase {
public:
/** Constructor. */
- inline SharedBase() : m_refCount(0) {}
-
- /** Atomically increment reference count */
- void preserveSB() const;
-
- /**
- * Atomically decrement reference count, the SharedBase object is
- * automatically deleted when its reference count goes to zero
- */
- void releaseSB() const;
+ inline SharedBase() {}
- /** @return the reference count */
- inline int32_t refCount() { return m_refCount; }
+ void operator=(const SharedBase& rhs) = delete;
protected:
inline SharedBase(bool noInit) {}
virtual ~SharedBase() {}
-
- private:
- mutable volatile int32_t m_refCount;
-
- void operator=(const SharedBase& rhs);
};
-/**
- * Class encapsulating a NULL SharedBase smart pointer. This is for passing
- * NULL pointers implicitly to copy constructor of <code>SharedPtr</code>
- * class.
- */
-class CPPCACHE_EXPORT NullSharedBase : public SharedBase {
- public:
- static const NullSharedBase* const s_instancePtr;
-
- private:
- NullSharedBase() {}
- // never defined
- NullSharedBase(const NullSharedBase&);
- NullSharedBase& operator=(const NullSharedBase&);
-
- friend class SharedBase; // just to get rid of warning with gcc3.x
-};
} // namespace client
} // namespace geode
} // namespace apache
-#define NULLPTR ::apache::geode::client::NullSharedBase::s_instancePtr
-
#endif // GEODE_SHAREDBASE_H_
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/SharedPtr.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/SharedPtr.hpp b/src/cppcache/include/geode/SharedPtr.hpp
index 99d5632..610b08e 100644
--- a/src/cppcache/include/geode/SharedPtr.hpp
+++ b/src/cppcache/include/geode/SharedPtr.hpp
@@ -1,8 +1,3 @@
-#pragma once
-
-#ifndef GEODE_SHAREDPTR_H_
-#define GEODE_SHAREDPTR_H_
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -20,264 +15,22 @@
* limitations under the License.
*/
+#pragma once
+
+#ifndef GEODE_SHAREDPTR_H_
+#define GEODE_SHAREDPTR_H_
+
+// TODO shared_ptr - remove this file.
+
#include "SharedBase.hpp"
-#include "Assert.hpp"
-#include "TypeHelper.hpp"
-#include <typeinfo>
#include "SharedPtrHelper.hpp"
-/** @file
-*/
-
namespace apache {
namespace geode {
namespace client {
-#if GF_DEVEL_ASSERTS == 1
-#define GF_CHECK_NPE(x) \
- if (x != NULL) { \
- } else \
- apache::geode::client::SPEHelper::throwNullPointerException( \
- typeid(*this).name())
-#else
-#define GF_CHECK_NPE(x)
-#endif
-
-class MapEntry;
-class MapEntryImpl;
-
-template <class Target>
-/** Defines a reference counted shared pointer
-*/
-class SharedPtr {
- public:
- /** Constructor. */
- inline SharedPtr() : m_ptr(NULL) {}
-
- /** Constructor for the NULL pointer */
- inline SharedPtr(const NullSharedBase* ptr) : m_ptr(NULL) {}
-
- /** Explicit copy constructor, given a pointer.
- * @throws ClassCastException if <code>Target</code> pointer cannot be
- * converted to <code>SharedBase</code> pointer (dynamic_cast to
- * <code>SharedBase*</code> fails).
- */
- inline explicit SharedPtr(const Target* ptr)
- : m_ptr(const_cast<Target*>(ptr)) {
- if (NULL != m_ptr) getSB(m_ptr)->preserveSB();
- }
-
- /** Constructor, given another SharedPtr. */
- inline SharedPtr(const SharedPtr& other) : m_ptr(other.m_ptr) {
- if (NULL != m_ptr) getSB(m_ptr)->preserveSB();
- }
-
- /** Constructor, given another SharedPtr.
- * @throws ClassCastException if <code>Other</code> pointer cannot be
- * converted to <code>Target</code> pointer (dynamic_cast to
- * <code>Target*</code> fails).
- */
- template <class Other>
- inline SharedPtr(const SharedPtr<Other>& other)
- : m_ptr(getTarget<Target>(other.ptr())) {
- if (NULL != m_ptr) getSB(m_ptr)->preserveSB();
- }
-
- /** Destructor. */
- inline ~SharedPtr() {
- if (NULL != m_ptr) getSB(m_ptr)->releaseSB();
-
- m_ptr = NULL;
- }
-
- inline Target* operator->() const {
- GF_CHECK_NPE(m_ptr);
- GF_DEV_ASSERT(getSB(m_ptr)->refCount() > 0);
-
- return m_ptr;
- }
-
- inline Target& operator*() const {
- GF_CHECK_NPE(m_ptr);
- return *m_ptr;
- }
-
- /** Assigns a pointer.
- * @throws ClassCastException if <code>Target</code> pointer cannot be
- * converted to <code>SharedBase</code> pointer (dynamic_cast to
- * <code>SharedBase*</code> fails).
- */
- inline SharedPtr& operator=(Target* other) {
- if (NULL != other) getSB(other)->preserveSB();
-
- if (NULL != m_ptr) getSB(m_ptr)->releaseSB();
-
- m_ptr = other;
-
- return *this;
- }
-
- inline SharedPtr& operator=(const SharedPtr& other) {
- Target* otherPtr = other.m_ptr;
-
- if (NULL != otherPtr) {
- getSB(otherPtr)->preserveSB();
- }
- if (NULL != m_ptr) {
- getSB(m_ptr)->releaseSB();
- }
- m_ptr = otherPtr;
-
- GF_DEV_ASSERT(otherPtr == other.m_ptr);
-
- return *this;
- }
-
- /** Assigns a pointer of type <code>Other</code> from a <code>SharedPtr</code>
- * object.
- * @throws ClassCastException if <code>Other</code> pointer cannot be
- * converted to <code>Target</code> pointer (dynamic_cast to
- * <code>Target*</code> fails).
- */
- template <class Other>
- inline SharedPtr& operator=(const SharedPtr<Other>& other) {
- Other* otherPtr = other.ptr();
-
- Target* otherTargetPtr = getTarget<Target>(otherPtr);
-
- if (NULL != otherPtr) {
- getSB(otherPtr)->preserveSB();
- }
- if (NULL != m_ptr) {
- getSB(m_ptr)->releaseSB();
- }
- m_ptr = otherTargetPtr;
-
- GF_DEV_ASSERT(otherPtr == other.ptr());
-
- return *this;
- }
-
- inline SharedPtr& operator=(const NullSharedBase* nullOther) {
- if (m_ptr != NULL) {
- getSB(m_ptr)->releaseSB();
- }
- m_ptr = NULL;
- return *this;
- }
-
- /** Assigns a pointer of type <code>Other</code>.
- * @throws ClassCastException if <code>Other</code> pointer cannot be
- * converted to <code>Target</code> pointer (dynamic_cast to
- * <code>Target*</code> fails),
- * or if <code>Other</code> pointer cannot be converted to
- * <code>SharedBase</code> pointer (dynamic_cast to <code>SharedBase*</code>
- * fails).
- */
- template <class Other>
- inline SharedPtr& operator=(Other* other) {
- Target* otherTargetPtr = getTarget<Target>(other);
-
- if (NULL != other) {
- getSB(other)->preserveSB();
- }
- if (NULL != m_ptr) {
- getSB(m_ptr)->releaseSB();
- }
- m_ptr = otherTargetPtr;
-
- return *this;
- }
-
- inline bool operator==(const Target* other) const { return m_ptr == other; }
-
- inline bool operator!=(const Target* other) const { return m_ptr != other; }
-
- inline bool operator==(const NullSharedBase* nullOther) const {
- return m_ptr == NULL;
- }
-
- inline bool operator!=(const NullSharedBase* nullOther) const {
- return m_ptr != NULL;
- }
-
- inline bool operator==(const SharedPtr& other) const {
- return m_ptr == other.m_ptr;
- }
-
- inline bool operator!=(const SharedPtr& other) const {
- return m_ptr != other.m_ptr;
- }
-
- template <class Other>
- inline bool operator==(const SharedPtr<Other>& other) {
- return ((const void*)m_ptr) == ((const void*)other.ptr());
- }
-
- template <class Other>
- inline bool operator!=(const SharedPtr<Other>& other) {
- return !operator==(other);
- }
-
- inline Target* ptr() const { return m_ptr; }
-
- private:
- /** this constructor deliberately skips touching m_ptr or anything */
- inline explicit SharedPtr(bool noInit) {}
-
- Target* m_ptr;
-
- friend class MapEntry;
- friend class MapEntryImpl;
-};
-
typedef SharedPtr<SharedBase> SharedBasePtr;
-/** Statically cast the underlying pointer to the given type. The behaviour
- * is similar to <code>static_cast</code>.
- *
- * Make use of this cast with care since it does not offer protection
- * against incorrect casts. For most purposes <code>dynCast</code> is the
- * better choice and this should be used only where the programmer knows
- * the cast to be safe.
- *
- * Setting the macro <code>GF_DEBUG_ASSERTS</code> enables dynamic checking
- * of the cast throwing an <code>AssertionException</code> if the cast fails.
- */
-template <class TargetSP, class Other>
-TargetSP staticCast(const SharedPtr<Other>& other) {
- GF_D_ASSERT((other.ptr() == NULL) ||
- (dynamic_cast<GF_UNWRAP_SP(TargetSP)*>(other.ptr()) != NULL));
-
- return TargetSP(static_cast<GF_UNWRAP_SP(TargetSP)*>(other.ptr()));
-}
-
-/** Dynamically cast the underlying pointer to the given type and throw
- * <code>ClassCastException</code> if the cast fails.
- */
-template <class TargetSP, class Other>
-TargetSP dynCast(const SharedPtr<Other>& other) {
- GF_UNWRAP_SP(TargetSP) * otherPtr;
-
- if ((other.ptr() == NULL)) {
- return NULLPTR;
- } else if ((otherPtr = dynamic_cast<GF_UNWRAP_SP(TargetSP)*>(other.ptr())) !=
- NULL) {
- return TargetSP(otherPtr);
- } else {
- SPEHelper::throwClassCastException(
- "dynCast: cast failed", typeid(other).name(), typeid(TargetSP).name());
- return NULLPTR;
- }
-}
-
-/**
- * Dynamically check if the underlying pointer is of the given SharedPtr type.
- */
-template <class TargetSP, class Other>
-bool instanceOf(const SharedPtr<Other>& other) {
- return (dynamic_cast<GF_UNWRAP_SP(TargetSP)*>(other.ptr()) != NULL);
-}
} // namespace client
} // namespace geode
} // namespace apache
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/SharedPtrHelper.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/SharedPtrHelper.hpp b/src/cppcache/include/geode/SharedPtrHelper.hpp
index a276f14..177770b 100644
--- a/src/cppcache/include/geode/SharedPtrHelper.hpp
+++ b/src/cppcache/include/geode/SharedPtrHelper.hpp
@@ -1,8 +1,3 @@
-#pragma once
-
-#ifndef GEODE_SHAREDPTRHELPER_H_
-#define GEODE_SHAREDPTRHELPER_H_
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -20,9 +15,17 @@
* limitations under the License.
*/
+#pragma once
+
+#ifndef GEODE_SHAREDPTRHELPER_H_
+#define GEODE_SHAREDPTRHELPER_H_
+
+// TODO shared_ptr - remove this file.
+
+#include <typeinfo>
+
#include "geode_globals.hpp"
#include "TypeHelper.hpp"
-#include <typeinfo>
namespace apache {
namespace geode {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/Struct.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/Struct.hpp b/src/cppcache/include/geode/Struct.hpp
index b88bf31..13411f0 100644
--- a/src/cppcache/include/geode/Struct.hpp
+++ b/src/cppcache/include/geode/Struct.hpp
@@ -61,7 +61,7 @@ class CPPCACHE_EXPORT Struct : public Serializable {
* Get the field value for the given index number.
*
* @param index the index number of the field value to get.
- * @returns A smart pointer to the field value or NULLPTR if index out of
+ * @returns A smart pointer to the field value or nullptr if index out of
* bounds.
*/
const SerializablePtr operator[](int32_t index) const;
@@ -100,7 +100,7 @@ class CPPCACHE_EXPORT Struct : public Serializable {
/**
* Get the next field value item available in this Struct.
*
- * @returns A smart pointer to the next item in the Struct or NULLPTR if no
+ * @returns A smart pointer to the next item in the Struct or nullptr if no
* more available.
*/
const SerializablePtr next();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/SystemProperties.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/SystemProperties.hpp b/src/cppcache/include/geode/SystemProperties.hpp
index 5db43c7..7dc6131 100644
--- a/src/cppcache/include/geode/SystemProperties.hpp
+++ b/src/cppcache/include/geode/SystemProperties.hpp
@@ -299,28 +299,28 @@ class CPPCACHE_EXPORT SystemProperties {
/** Return the security auth library */
inline const char* authInitLibrary() const {
- return (m_AuthIniLoaderLibrary == NULLPTR
+ return (m_AuthIniLoaderLibrary == nullptr
? ""
: m_AuthIniLoaderLibrary->asChar());
}
/** Return the security auth factory */
inline const char* authInitFactory() const {
- return (m_AuthIniLoaderFactory == NULLPTR
+ return (m_AuthIniLoaderFactory == nullptr
? ""
: m_AuthIniLoaderFactory->asChar());
}
/** Return the security diffie hellman secret key algo */
const char* securityClientDhAlgo() {
- return (m_securityClientDhAlgo == NULLPTR
+ return (m_securityClientDhAlgo == nullptr
? ""
: m_securityClientDhAlgo->asChar());
}
/** Return the keystore (.pem file ) path */
const char* securityClientKsPath() {
- return (m_securityClientKsPath == NULLPTR
+ return (m_securityClientKsPath == nullptr
? ""
: m_securityClientKsPath->asChar());
}
@@ -336,8 +336,8 @@ class CPPCACHE_EXPORT SystemProperties {
* @return bool value.
*/
inline bool isSecurityOn() const {
- return (m_AuthIniLoaderFactory != NULLPTR &&
- m_AuthIniLoaderLibrary != NULLPTR);
+ return (m_AuthIniLoaderFactory != nullptr &&
+ m_AuthIniLoaderLibrary != nullptr);
}
/** Checks whether list of endpoint is shuffeled or not.
@@ -352,7 +352,7 @@ class CPPCACHE_EXPORT SystemProperties {
* @return bool flag to indicate whether DH for credentials is on.
*/
bool isDhOn() {
- return isSecurityOn() && m_securityClientDhAlgo != NULLPTR &&
+ return isSecurityOn() && m_securityClientDhAlgo != nullptr &&
m_securityClientDhAlgo->length() > 0;
}
@@ -489,7 +489,7 @@ class CPPCACHE_EXPORT SystemProperties {
/** Gets the authInitialize loader for the system.
* @return a pointer that points to the system's ,
- * <code>AuthLoader</code> , NULLPTR if there is no AuthLoader for this
+ * <code>AuthLoader</code> , nullptr if there is no AuthLoader for this
* system.
*/
AuthInitializePtr getAuthLoader();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/TypeHelper.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/TypeHelper.hpp b/src/cppcache/include/geode/TypeHelper.hpp
index b96684e..149ea80 100644
--- a/src/cppcache/include/geode/TypeHelper.hpp
+++ b/src/cppcache/include/geode/TypeHelper.hpp
@@ -25,22 +25,23 @@
*/
#include "geode_globals.hpp"
+#include <memory>
namespace apache {
namespace geode {
namespace client {
-// Forward declaration of SharedPtr<T>
-template <typename Target>
-class SharedPtr;
-// Forward declaration of SharedArrayPtr<T, ID>
-template <typename Target, int8_t TYPEID>
-class SharedArrayPtr;
+// TODO share_ptr - remove this and replace with explicit std::shared_ptr defs.
+template <class Target>
+using SharedPtr = std::shared_ptr<Target>;
// Forward declaration of CacheableArrayType<T, ID>
template <typename Target, int8_t TYPEID>
class CacheableArrayType;
+template <typename TObj, int8_t TYPEID>
+using SharedArrayPtr = SharedPtr<CacheableArrayType<TObj, TYPEID>>;
+
/**
* @brief Helper type traits and other structs/classes to determine type
* information at compile time using typename.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/VectorOfSharedBase.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/VectorOfSharedBase.hpp b/src/cppcache/include/geode/VectorOfSharedBase.hpp
index 8976af3..537fb4c 100644
--- a/src/cppcache/include/geode/VectorOfSharedBase.hpp
+++ b/src/cppcache/include/geode/VectorOfSharedBase.hpp
@@ -121,7 +121,7 @@ class CPPCACHE_EXPORT VectorOfSharedBase {
/** copy constructor */
VectorOfSharedBase(const VectorOfSharedBase& other);
- /** destructor, sets all SharedPtr elements to NULLPTR */
+ /** destructor, sets all SharedPtr elements to nullptr */
~VectorOfSharedBase();
/** assignment operator */
@@ -157,7 +157,7 @@ class CPPCACHE_EXPORT VectorOfSharedBase {
/** inserts or erases elements at the end such that size becomes n.
* Not to be confused with reserve which simply allocates the space,
* resize fills the space with active elements. */
- void resize(int32_t n, const SharedBasePtr& t = NULLPTR);
+ void resize(int32_t n, const SharedBasePtr& t = nullptr);
/** insert object at the given index. */
void insert(int32_t index, const SharedBasePtr& t);
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/VectorT.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/VectorT.hpp b/src/cppcache/include/geode/VectorT.hpp
index 48cd8fb..b223112 100644
--- a/src/cppcache/include/geode/VectorT.hpp
+++ b/src/cppcache/include/geode/VectorT.hpp
@@ -1,8 +1,3 @@
-#pragma once
-
-#ifndef GEODE_VECTORT_H_
-#define GEODE_VECTORT_H_
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -20,6 +15,13 @@
* limitations under the License.
*/
+#pragma once
+
+#ifndef GEODE_VECTORT_H_
+#define GEODE_VECTORT_H_
+
+// TODO shared_ptr - replace with std::vector
+
#include "geode_globals.hpp"
#include "VectorOfSharedBase.hpp"
#include "Cacheable.hpp"
@@ -51,7 +53,7 @@ class VectorT {
public:
inline const PTR_TYPE operator*() const {
- return staticCast<PTR_TYPE>(*m_iter);
+ return std::static_pointer_cast<GF_UNWRAP_SP(PTR_TYPE)>(*m_iter);
}
inline Iterator& operator++() {
@@ -95,20 +97,22 @@ class VectorT {
/** Return the n'th element */
inline PTR_TYPE operator[](int32_t n) {
- return staticCast<PTR_TYPE>(m_vector[n]);
+ return std::static_pointer_cast<GF_UNWRAP_SP(PTR_TYPE)>(m_vector[n]);
}
/** Return the n'th element */
inline const PTR_TYPE operator[](int32_t n) const {
- return staticCast<PTR_TYPE>(m_vector[n]);
+ return std::static_pointer_cast<GF_UNWRAP_SP(PTR_TYPE)>(m_vector[n]);
}
/** Return the n'th element with bounds checking. */
- inline PTR_TYPE at(int32_t n) { return staticCast<PTR_TYPE>(m_vector.at(n)); }
+ inline PTR_TYPE at(int32_t n) {
+ return std::static_pointer_cast<GF_UNWRAP_SP(PTR_TYPE)>(m_vector.at(n));
+ }
/** Return the n'th element with bounds checking. */
inline const PTR_TYPE at(int32_t n) const {
- return staticCast<PTR_TYPE>(m_vector.at(n));
+ return std::static_pointer_cast<GF_UNWRAP_SP(PTR_TYPE)>(m_vector.at(n));
}
/** Get an iterator pointing to the start of vector. */
@@ -129,7 +133,7 @@ class VectorT {
/** copy constructor */
inline VectorT(const VectorT& other) : m_vector(other.m_vector) {}
- /** destructor, sets all SharedPtr elements to NULLPTR */
+ /** destructor, sets all SharedPtr elements to nullptr */
inline ~VectorT() {
// destructor of m_vector field does all the work.
}
@@ -144,19 +148,23 @@ class VectorT {
inline void reserve(int32_t n) { m_vector.reserve(n); }
/** returns the first element. */
- inline PTR_TYPE front() { return staticCast<PTR_TYPE>(m_vector.front()); }
+ inline PTR_TYPE front() {
+ return std::static_pointer_cast<GF_UNWRAP_SP(PTR_TYPE)>(m_vector.front());
+ }
/** returns the first element. */
inline const PTR_TYPE front() const {
- return staticCast<PTR_TYPE>(m_vector.front());
+ return std::static_pointer_cast<GF_UNWRAP_SP(PTR_TYPE)>(m_vector.front());
}
/** returns the last element. */
- inline PTR_TYPE back() { return staticCast<PTR_TYPE>(m_vector.back()); }
+ inline PTR_TYPE back() {
+ return std::static_pointer_cast<GF_UNWRAP_SP(PTR_TYPE)>(m_vector.back());
+ }
/** returns the last element. */
inline const PTR_TYPE back() const {
- return staticCast<PTR_TYPE>(m_vector.back());
+ return std::static_pointer_cast<GF_UNWRAP_SP(PTR_TYPE)>(m_vector.back());
}
/** insert a new element at the end. */
@@ -174,7 +182,7 @@ class VectorT {
/** inserts or erases elements at the end such that size becomes n.
* Not to be confused with reserve which simply allocates the space,
* resize fills the space with active elements. */
- inline void resize(int32_t n, const PTR_TYPE& t = NULLPTR) {
+ inline void resize(int32_t n, const PTR_TYPE& t = nullptr) {
m_vector.resize(n, t);
}
@@ -192,8 +200,6 @@ typedef VectorT<CacheableKeyPtr> _VectorOfCacheableKey;
typedef VectorT<RegionEntryPtr> VectorOfRegionEntry;
typedef VectorT<RegionPtr> VectorOfRegion;
typedef VectorT<CacheableStringPtr> VectorOfCacheableString;
-typedef VectorT<CqListenerPtr> VectorOfCqListener;
-typedef VectorT<CqQueryPtr> VectorOfCqQuery;
/**
* A vector of <code>Cacheable</code> objects that also extends
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/include/geode/geode_base.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/geode_base.hpp b/src/cppcache/include/geode/geode_base.hpp
index eeeca7c..369f830 100644
--- a/src/cppcache/include/geode/geode_base.hpp
+++ b/src/cppcache/include/geode/geode_base.hpp
@@ -1,8 +1,3 @@
-#pragma once
-
-#ifndef GEODE_BASE_H_
-#define GEODE_BASE_H_
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -20,6 +15,11 @@
* limitations under the License.
*/
+#pragma once
+
+#ifndef GEODE_BASE_H_
+#define GEODE_BASE_H_
+
#if defined(_WIN32)
/** Library Export */
#define LIBEXP __declspec(dllexport)
@@ -314,4 +314,22 @@ void operator delete[](void *p);
x = NULL; \
}
+// TODO shared_ptre - make C+11 library dependent or make constructor destructor
+// public
+#if defined(__clang__)
+#define FRIEND_STD_SHARED_PTR(_T) \
+ friend std::__libcpp_compressed_pair_imp<std::allocator<_T>, _T, 1>; \
+ friend std::__shared_ptr_emplace<_T, std::allocator<_T> >; \
+ friend std::default_delete<_T>;
+#elif defined(__GNUC__) || defined(__SUNPRO_CC)
+#define FRIEND_STD_SHARED_PTR(_T) \
+ friend __gnu_cxx::new_allocator<_T>;
+#elif defined(_MSC_VER)
+#define FRIEND_STD_SHARED_PTR(_T) \
+ friend std::_Ref_count_obj<_T>; \
+ friend std::default_delete<_T>;
+#else
+#define FRIEND_STD_SHARED_PTR(_T)
+#endif
+
#endif // GEODE_BASE_H_
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/BuiltinCacheableWrappers.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/BuiltinCacheableWrappers.hpp b/src/cppcache/integration-test/BuiltinCacheableWrappers.hpp
index 6140394..be32e3f 100644
--- a/src/cppcache/integration-test/BuiltinCacheableWrappers.hpp
+++ b/src/cppcache/integration-test/BuiltinCacheableWrappers.hpp
@@ -182,7 +182,7 @@ class CacheableBooleanWrapper : public CacheableWrapper {
public:
// Constructor and factory function
- inline CacheableBooleanWrapper() : CacheableWrapper(NULLPTR) {}
+ inline CacheableBooleanWrapper() : CacheableWrapper(nullptr) {}
static CacheableWrapper* create() { return new CacheableBooleanWrapper(); }
@@ -201,7 +201,7 @@ class CacheableBooleanWrapper : public CacheableWrapper {
virtual uint32_t getCheckSum(const CacheablePtr object) const {
const CacheableBoolean* obj =
- dynamic_cast<const CacheableBoolean*>(object.ptr());
+ dynamic_cast<const CacheableBoolean*>(object.get());
ASSERT(obj != NULL, "getCheckSum: null object.");
return CacheableHelper::crc32<uint8_t>(obj->value() ? 1 : 0);
}
@@ -211,7 +211,7 @@ class CacheableByteWrapper : public CacheableWrapper {
public:
// Constructor and factory function
- inline CacheableByteWrapper() : CacheableWrapper(NULLPTR) {}
+ inline CacheableByteWrapper() : CacheableWrapper(nullptr) {}
static CacheableWrapper* create() { return new CacheableByteWrapper(); }
@@ -229,7 +229,7 @@ class CacheableByteWrapper : public CacheableWrapper {
}
virtual uint32_t getCheckSum(const CacheablePtr object) const {
- const CacheableByte* obj = dynamic_cast<const CacheableByte*>(object.ptr());
+ const CacheableByte* obj = dynamic_cast<const CacheableByte*>(object.get());
ASSERT(obj != NULL, "getCheckSum: null object.");
return CacheableHelper::crc32<uint8_t>(obj->value());
}
@@ -239,7 +239,7 @@ class CacheableDoubleWrapper : public CacheableWrapper {
public:
// Constructor and factory function
- CacheableDoubleWrapper() : CacheableWrapper(NULLPTR) {}
+ CacheableDoubleWrapper() : CacheableWrapper(nullptr) {}
static CacheableWrapper* create() { return new CacheableDoubleWrapper(); }
@@ -258,7 +258,7 @@ class CacheableDoubleWrapper : public CacheableWrapper {
virtual uint32_t getCheckSum(const CacheablePtr object) const {
const CacheableDouble* obj =
- dynamic_cast<const CacheableDouble*>(object.ptr());
+ dynamic_cast<const CacheableDouble*>(object.get());
ASSERT(obj != NULL, "getCheckSum: null object.");
return CacheableHelper::crc32<double>(obj->value());
}
@@ -268,7 +268,7 @@ class CacheableDateWrapper : public CacheableWrapper {
public:
// Constructor and factory function
- CacheableDateWrapper() : CacheableWrapper(NULLPTR) {}
+ CacheableDateWrapper() : CacheableWrapper(nullptr) {}
static CacheableWrapper* create() { return new CacheableDateWrapper(); }
@@ -294,7 +294,7 @@ class CacheableDateWrapper : public CacheableWrapper {
}
virtual uint32_t getCheckSum(const CacheablePtr object) const {
- const CacheableDate* obj = dynamic_cast<const CacheableDate*>(object.ptr());
+ const CacheableDate* obj = dynamic_cast<const CacheableDate*>(object.get());
ASSERT(obj != NULL, "getCheckSum: null object.");
return CacheableHelper::crc32<int64_t>(obj->milliseconds());
}
@@ -304,7 +304,7 @@ class CacheableFileNameWrapper : public CacheableWrapper {
public:
// Constructor and factory function
- CacheableFileNameWrapper() : CacheableWrapper(NULLPTR) {}
+ CacheableFileNameWrapper() : CacheableWrapper(nullptr) {}
static CacheableWrapper* create() { return new CacheableFileNameWrapper(); }
@@ -347,7 +347,7 @@ class CacheableFileNameWrapper : public CacheableWrapper {
virtual uint32_t getCheckSum(const CacheablePtr object) const {
const CacheableFileName* obj =
- dynamic_cast<const CacheableFileName*>(object.ptr());
+ dynamic_cast<const CacheableFileName*>(object.get());
return (obj != NULL
? CacheableHelper::crc32((uint8_t*)obj->asChar(), obj->length())
: 0);
@@ -358,7 +358,7 @@ class CacheableFloatWrapper : public CacheableWrapper {
public:
// Constructor and factory function
- CacheableFloatWrapper() : CacheableWrapper(NULLPTR) {}
+ CacheableFloatWrapper() : CacheableWrapper(nullptr) {}
static CacheableWrapper* create() { return new CacheableFloatWrapper(); }
@@ -377,7 +377,7 @@ class CacheableFloatWrapper : public CacheableWrapper {
virtual uint32_t getCheckSum(const CacheablePtr object) const {
const CacheableFloat* obj =
- dynamic_cast<const CacheableFloat*>(object.ptr());
+ dynamic_cast<const CacheableFloat*>(object.get());
ASSERT(obj != NULL, "getCheckSum: null object.");
return CacheableHelper::crc32<float>(obj->value());
}
@@ -387,7 +387,7 @@ class CacheableInt16Wrapper : public CacheableWrapper {
public:
// Constructor and factory function
- CacheableInt16Wrapper() : CacheableWrapper(NULLPTR) {}
+ CacheableInt16Wrapper() : CacheableWrapper(nullptr) {}
static CacheableWrapper* create() { return new CacheableInt16Wrapper(); }
@@ -406,7 +406,7 @@ class CacheableInt16Wrapper : public CacheableWrapper {
virtual uint32_t getCheckSum(const CacheablePtr object) const {
const CacheableInt16* obj =
- dynamic_cast<const CacheableInt16*>(object.ptr());
+ dynamic_cast<const CacheableInt16*>(object.get());
ASSERT(obj != NULL, "getCheckSum: null object.");
return CacheableHelper::crc32<int16_t>(obj->value());
}
@@ -416,7 +416,7 @@ class CacheableInt32Wrapper : public CacheableWrapper {
public:
// Constructor and factory function
- CacheableInt32Wrapper() : CacheableWrapper(NULLPTR) {}
+ CacheableInt32Wrapper() : CacheableWrapper(nullptr) {}
static CacheableWrapper* create() { return new CacheableInt32Wrapper(); }
@@ -435,7 +435,7 @@ class CacheableInt32Wrapper : public CacheableWrapper {
virtual uint32_t getCheckSum(const CacheablePtr object) const {
const CacheableInt32* obj =
- dynamic_cast<const CacheableInt32*>(object.ptr());
+ dynamic_cast<const CacheableInt32*>(object.get());
ASSERT(obj != NULL, "getCheckSum: null object.");
return CacheableHelper::crc32<int32_t>(obj->value());
}
@@ -445,7 +445,7 @@ class CacheableInt64Wrapper : public CacheableWrapper {
public:
// Constructor and factory function
- CacheableInt64Wrapper() : CacheableWrapper(NULLPTR) {}
+ CacheableInt64Wrapper() : CacheableWrapper(nullptr) {}
static CacheableWrapper* create() { return new CacheableInt64Wrapper(); }
@@ -465,7 +465,7 @@ class CacheableInt64Wrapper : public CacheableWrapper {
virtual uint32_t getCheckSum(const CacheablePtr object) const {
const CacheableInt64* obj =
- dynamic_cast<const CacheableInt64*>(object.ptr());
+ dynamic_cast<const CacheableInt64*>(object.get());
ASSERT(obj != NULL, "getCheckSum: null object.");
return CacheableHelper::crc32<int64_t>(obj->value());
}
@@ -475,7 +475,7 @@ class CacheableStringWrapper : public CacheableWrapper {
public:
// Constructor and factory function
- CacheableStringWrapper() : CacheableWrapper(NULLPTR) {}
+ CacheableStringWrapper() : CacheableWrapper(nullptr) {}
static CacheableWrapper* create() { return new CacheableStringWrapper(); }
@@ -506,7 +506,7 @@ class CacheableStringWrapper : public CacheableWrapper {
virtual uint32_t getCheckSum(const CacheablePtr object) const {
const CacheableString* obj =
- dynamic_cast<const CacheableString*>(object.ptr());
+ dynamic_cast<const CacheableString*>(object.get());
return (obj != NULL
? CacheableHelper::crc32((uint8_t*)obj->asChar(), obj->length())
: 0);
@@ -517,7 +517,7 @@ class CacheableHugeStringWrapper : public CacheableWrapper {
public:
// Constructor and factory function
- CacheableHugeStringWrapper() : CacheableWrapper(NULLPTR) {}
+ CacheableHugeStringWrapper() : CacheableWrapper(nullptr) {}
static CacheableWrapper* create() { return new CacheableHugeStringWrapper(); }
@@ -551,7 +551,7 @@ class CacheableHugeStringWrapper : public CacheableWrapper {
virtual uint32_t getCheckSum(const CacheablePtr object) const {
const CacheableString* obj =
- dynamic_cast<const CacheableString*>(object.ptr());
+ dynamic_cast<const CacheableString*>(object.get());
ASSERT(obj != NULL, "getCheckSum: null object.");
return CacheableHelper::crc32((uint8_t*)obj->asChar(), obj->length());
}
@@ -561,7 +561,7 @@ class CacheableHugeUnicodeStringWrapper : public CacheableWrapper {
public:
// Constructor and factory function
- CacheableHugeUnicodeStringWrapper() : CacheableWrapper(NULLPTR) {}
+ CacheableHugeUnicodeStringWrapper() : CacheableWrapper(nullptr) {}
static CacheableWrapper* create() {
return new CacheableHugeUnicodeStringWrapper();
@@ -597,7 +597,7 @@ class CacheableHugeUnicodeStringWrapper : public CacheableWrapper {
virtual uint32_t getCheckSum(const CacheablePtr object) const {
const CacheableString* obj =
- dynamic_cast<const CacheableString*>(object.ptr());
+ dynamic_cast<const CacheableString*>(object.get());
ASSERT(obj != NULL, "getCheckSum: null object.");
return CacheableHelper::crc32((uint8_t*)obj->asWChar(),
obj->length() * sizeof(wchar_t));
@@ -608,7 +608,7 @@ class CacheableUnicodeStringWrapper : public CacheableWrapper {
public:
// Constructor and factory function
- CacheableUnicodeStringWrapper() : CacheableWrapper(NULLPTR) {}
+ CacheableUnicodeStringWrapper() : CacheableWrapper(nullptr) {}
static CacheableWrapper* create() {
return new CacheableUnicodeStringWrapper();
@@ -641,7 +641,7 @@ class CacheableUnicodeStringWrapper : public CacheableWrapper {
virtual uint32_t getCheckSum(const CacheablePtr object) const {
const CacheableString* obj =
- dynamic_cast<const CacheableString*>(object.ptr());
+ dynamic_cast<const CacheableString*>(object.get());
ASSERT(obj != NULL, "getCheckSum: null object.");
return CacheableHelper::crc32((uint8_t*)obj->asWChar(),
obj->length() * sizeof(wchar_t));
@@ -652,7 +652,7 @@ class CacheableWideCharWrapper : public CacheableWrapper {
public:
// Constructor and factory function
- CacheableWideCharWrapper() : CacheableWrapper(NULLPTR) {}
+ CacheableWideCharWrapper() : CacheableWrapper(nullptr) {}
static CacheableWrapper* create() { return new CacheableWideCharWrapper(); }
@@ -672,7 +672,7 @@ class CacheableWideCharWrapper : public CacheableWrapper {
virtual uint32_t getCheckSum(const CacheablePtr object) const {
const CacheableWideChar* obj =
- dynamic_cast<const CacheableWideChar*>(object.ptr());
+ dynamic_cast<const CacheableWideChar*>(object.get());
ASSERT(obj != NULL, "getCheckSum: null object.");
return CacheableHelper::crc32<wchar_t>(obj->value());
}
@@ -685,7 +685,7 @@ class CacheableHashMapTypeWrapper : public CacheableWrapper {
public:
// Constructor and factory function
- CacheableHashMapTypeWrapper<HMAPTYPE>() : CacheableWrapper(NULLPTR) {}
+ CacheableHashMapTypeWrapper<HMAPTYPE>() : CacheableWrapper(nullptr) {}
static CacheableWrapper* create() {
return new CacheableHashMapTypeWrapper<HMAPTYPE>();
@@ -695,7 +695,7 @@ class CacheableHashMapTypeWrapper : public CacheableWrapper {
virtual void initRandomValue(int32_t maxSize) {
m_cacheableObject = HMAPTYPE::create(maxSize);
- HMAPTYPE* chmp = dynamic_cast<HMAPTYPE*>(m_cacheableObject.ptr());
+ HMAPTYPE* chmp = dynamic_cast<HMAPTYPE*>(m_cacheableObject.get());
ASSERT(chmp != NULL, "initRandomValue: null object.");
std::vector<int8_t> keyTypeIds =
CacheableWrapperFactory::getRegisteredKeyTypes();
@@ -738,8 +738,9 @@ class CacheableHashMapTypeWrapper : public CacheableWrapper {
ASSERT(valWrapper != NULL, "initRandomValue: valWrapper null object.");
keyWrapper->initKey(((*keyIter) << 8) + item, maxSize);
valWrapper->initRandomValue(maxSize);
- chmp->insert(dynCast<CacheableKeyPtr>(keyWrapper->getCacheable()),
- valWrapper->getCacheable());
+ chmp->insert(
+ std::dynamic_pointer_cast<CacheableKey>(keyWrapper->getCacheable()),
+ valWrapper->getCacheable());
delete keyWrapper;
delete valWrapper;
item++;
@@ -748,7 +749,7 @@ class CacheableHashMapTypeWrapper : public CacheableWrapper {
}
virtual uint32_t getCheckSum(const CacheablePtr object) const {
- const HMAPTYPE* obj = dynamic_cast<const HMAPTYPE*>(object.ptr());
+ const HMAPTYPE* obj = dynamic_cast<const HMAPTYPE*>(object.get());
ASSERT(obj != NULL, "getCheckSum: null object.");
uint32_t chksum = 0;
@@ -758,7 +759,7 @@ class CacheableHashMapTypeWrapper : public CacheableWrapper {
CacheableWrapperFactory::createInstance(iter.first()->typeId());
CacheablePtr cwpObj = iter.second();
uint32_t cwpObjCkSum = 0;
- if (cwpObj != NULLPTR) {
+ if (cwpObj != nullptr) {
CacheableWrapper* cwpVal =
CacheableWrapperFactory::createInstance(cwpObj->typeId());
cwpObjCkSum = cwpVal->getCheckSum(cwpObj);
@@ -785,7 +786,7 @@ class CacheableHashSetTypeWrapper : public CacheableWrapper {
public:
// Constructor and factory function
- CacheableHashSetTypeWrapper<HSETTYPE>() : CacheableWrapper(NULLPTR) {}
+ CacheableHashSetTypeWrapper<HSETTYPE>() : CacheableWrapper(nullptr) {}
static CacheableWrapper* create() {
return new CacheableHashSetTypeWrapper<HSETTYPE>();
@@ -806,14 +807,15 @@ class CacheableHashSetTypeWrapper : public CacheableWrapper {
CacheableWrapperFactory::createInstance(keyTypeId);
wrapper->initRandomValue(maxSize);
CacheablePtr cptr = wrapper->getCacheable();
- set->insert(dynCast<CacheableKeyPtr>(wrapper->getCacheable()));
+ set->insert(
+ std::dynamic_pointer_cast<CacheableKey>(wrapper->getCacheable()));
delete wrapper;
}
- m_cacheableObject = set;
+ m_cacheableObject = std::shared_ptr<Serializable>(set);
}
virtual uint32_t getCheckSum(const CacheablePtr object) const {
- const HSETTYPE* obj = dynamic_cast<const HSETTYPE*>(object.ptr());
+ const HSETTYPE* obj = dynamic_cast<const HSETTYPE*>(object.get());
ASSERT(obj != NULL, "getCheckSum: null object.");
uint32_t checkSum = 0;
@@ -838,7 +840,7 @@ class CacheableBytesWrapper : public CacheableWrapper {
public:
// Constructor and factory function
- CacheableBytesWrapper() : CacheableWrapper(NULLPTR) {}
+ CacheableBytesWrapper() : CacheableWrapper(nullptr) {}
static CacheableWrapper* create() { return new CacheableBytesWrapper(); }
@@ -853,7 +855,7 @@ class CacheableBytesWrapper : public CacheableWrapper {
virtual uint32_t getCheckSum(const CacheablePtr object) const {
const CacheableBytes* obj =
- dynamic_cast<const CacheableBytes*>(object.ptr());
+ dynamic_cast<const CacheableBytes*>(object.get());
ASSERT(obj != NULL, "getCheckSum: null object.");
return CacheableHelper::crc32(obj->value(), obj->length());
}
@@ -863,7 +865,7 @@ class CacheableDoubleArrayWrapper : public CacheableWrapper {
public:
// Constructor and factory function
- CacheableDoubleArrayWrapper() : CacheableWrapper(NULLPTR) {}
+ CacheableDoubleArrayWrapper() : CacheableWrapper(nullptr) {}
static CacheableWrapper* create() {
return new CacheableDoubleArrayWrapper();
@@ -881,7 +883,7 @@ class CacheableDoubleArrayWrapper : public CacheableWrapper {
virtual uint32_t getCheckSum(const CacheablePtr object) const {
const CacheableDoubleArray* obj =
- dynamic_cast<const CacheableDoubleArray*>(object.ptr());
+ dynamic_cast<const CacheableDoubleArray*>(object.get());
ASSERT(obj != NULL, "getCheckSum: null object.");
return CacheableHelper::crc32Array(obj->value(), obj->length());
}
@@ -891,7 +893,7 @@ class CacheableFloatArrayWrapper : public CacheableWrapper {
public:
// Constructor and factory function
- CacheableFloatArrayWrapper() : CacheableWrapper(NULLPTR) {}
+ CacheableFloatArrayWrapper() : CacheableWrapper(nullptr) {}
static CacheableWrapper* create() { return new CacheableFloatArrayWrapper(); }
@@ -907,7 +909,7 @@ class CacheableFloatArrayWrapper : public CacheableWrapper {
virtual uint32_t getCheckSum(const CacheablePtr object) const {
const CacheableFloatArray* obj =
- dynamic_cast<const CacheableFloatArray*>(object.ptr());
+ dynamic_cast<const CacheableFloatArray*>(object.get());
ASSERT(obj != NULL, "getCheckSum: null object.");
return CacheableHelper::crc32Array(obj->value(), obj->length());
}
@@ -917,7 +919,7 @@ class CacheableInt16ArrayWrapper : public CacheableWrapper {
public:
// Constructor and factory function
- CacheableInt16ArrayWrapper() : CacheableWrapper(NULLPTR) {}
+ CacheableInt16ArrayWrapper() : CacheableWrapper(nullptr) {}
static CacheableWrapper* create() { return new CacheableInt16ArrayWrapper(); }
@@ -932,7 +934,7 @@ class CacheableInt16ArrayWrapper : public CacheableWrapper {
virtual uint32_t getCheckSum(const CacheablePtr object) const {
const CacheableInt16Array* obj =
- dynamic_cast<const CacheableInt16Array*>(object.ptr());
+ dynamic_cast<const CacheableInt16Array*>(object.get());
ASSERT(obj != NULL, "getCheckSum: null object.");
return CacheableHelper::crc32Array(obj->value(), obj->length());
}
@@ -942,7 +944,7 @@ class CacheableInt32ArrayWrapper : public CacheableWrapper {
public:
// Constructor and factory function
- CacheableInt32ArrayWrapper() : CacheableWrapper(NULLPTR) {}
+ CacheableInt32ArrayWrapper() : CacheableWrapper(nullptr) {}
static CacheableWrapper* create() { return new CacheableInt32ArrayWrapper(); }
@@ -957,7 +959,7 @@ class CacheableInt32ArrayWrapper : public CacheableWrapper {
virtual uint32_t getCheckSum(const CacheablePtr object) const {
const CacheableInt32Array* obj =
- dynamic_cast<const CacheableInt32Array*>(object.ptr());
+ dynamic_cast<const CacheableInt32Array*>(object.get());
ASSERT(obj != NULL, "getCheckSum: null object.");
return CacheableHelper::crc32Array(obj->value(), obj->length());
}
@@ -967,7 +969,7 @@ class CacheableInt64ArrayWrapper : public CacheableWrapper {
public:
// Constructor and factory function
- CacheableInt64ArrayWrapper() : CacheableWrapper(NULLPTR) {}
+ CacheableInt64ArrayWrapper() : CacheableWrapper(nullptr) {}
static CacheableWrapper* create() { return new CacheableInt64ArrayWrapper(); }
@@ -982,7 +984,7 @@ class CacheableInt64ArrayWrapper : public CacheableWrapper {
virtual uint32_t getCheckSum(const CacheablePtr object) const {
const CacheableInt64Array* obj =
- dynamic_cast<const CacheableInt64Array*>(object.ptr());
+ dynamic_cast<const CacheableInt64Array*>(object.get());
ASSERT(obj != NULL, "getCheckSum: null object.");
return CacheableHelper::crc32Array(obj->value(), obj->length());
}
@@ -992,7 +994,7 @@ class CacheableNullStringWrapper : public CacheableWrapper {
public:
// Constructor and factory function
- CacheableNullStringWrapper() : CacheableWrapper(NULLPTR) {}
+ CacheableNullStringWrapper() : CacheableWrapper(nullptr) {}
static CacheableWrapper* create() { return new CacheableNullStringWrapper(); }
@@ -1003,7 +1005,7 @@ class CacheableNullStringWrapper : public CacheableWrapper {
}
virtual uint32_t getCheckSum(const CacheablePtr object) const {
- ASSERT(object == NULLPTR, "getCheckSum: expected null object");
+ ASSERT(object == nullptr, "getCheckSum: expected null object");
return 0;
}
};
@@ -1012,7 +1014,7 @@ class CacheableStringArrayWrapper : public CacheableWrapper {
public:
// Constructor and factory function
- CacheableStringArrayWrapper() : CacheableWrapper(NULLPTR) {}
+ CacheableStringArrayWrapper() : CacheableWrapper(nullptr) {}
static CacheableWrapper* create() {
return new CacheableStringArrayWrapper();
@@ -1046,7 +1048,7 @@ class CacheableStringArrayWrapper : public CacheableWrapper {
virtual uint32_t getCheckSum(const CacheablePtr object) const {
const CacheableStringArray* obj =
- dynamic_cast<const CacheableStringArray*>(object.ptr());
+ dynamic_cast<const CacheableStringArray*>(object.get());
ASSERT(obj != NULL, "getCheckSum: null object.");
uint32_t checkSum = 0;
CacheableStringPtr str;
@@ -1068,14 +1070,15 @@ class CacheableUndefinedWrapper : public CacheableWrapper {
public:
// Constructor and factory function
- CacheableUndefinedWrapper() : CacheableWrapper(NULLPTR) {}
+ CacheableUndefinedWrapper() : CacheableWrapper(nullptr) {}
static CacheableWrapper* create() { return new CacheableUndefinedWrapper(); }
// CacheableWrapper members
virtual void initRandomValue(int32_t maxSize) {
- m_cacheableObject = CacheableUndefined::createDeserializable();
+ m_cacheableObject = std::shared_ptr<Serializable>(
+ CacheableUndefined::createDeserializable());
}
virtual uint32_t getCheckSum(const CacheablePtr object) const { return 0; }
@@ -1086,7 +1089,7 @@ class CacheableVectorTypeWrapper : public CacheableWrapper {
public:
// Constructor and factory function
- CacheableVectorTypeWrapper<VECTTYPE>() : CacheableWrapper(NULLPTR) {}
+ CacheableVectorTypeWrapper<VECTTYPE>() : CacheableWrapper(nullptr) {}
static CacheableWrapper* create() {
return new CacheableVectorTypeWrapper<VECTTYPE>();
@@ -1111,16 +1114,16 @@ class CacheableVectorTypeWrapper : public CacheableWrapper {
delete wrapper;
}
}
- m_cacheableObject = vec;
+ m_cacheableObject = std::shared_ptr<Serializable>(vec);
}
virtual uint32_t getCheckSum(const CacheablePtr object) const {
- const VECTTYPE* vec = dynamic_cast<const VECTTYPE*>(object.ptr());
+ const VECTTYPE* vec = dynamic_cast<const VECTTYPE*>(object.get());
ASSERT(vec != NULL, "getCheckSum: null object.");
uint32_t checkSum = 0;
for (uint32_t index = 0; index < (uint32_t)vec->size(); ++index) {
CacheablePtr obj = vec->at(index);
- if (obj == NULLPTR) {
+ if (obj == nullptr) {
continue;
}
int8_t typeId = obj->typeId();
@@ -1147,7 +1150,7 @@ class CacheableObjectArrayWrapper : public CacheableWrapper {
public:
// Constructor and factory function
- CacheableObjectArrayWrapper() : CacheableWrapper(NULLPTR) {}
+ CacheableObjectArrayWrapper() : CacheableWrapper(nullptr) {}
static CacheableWrapper* create() {
return new CacheableObjectArrayWrapper();
@@ -1172,18 +1175,18 @@ class CacheableObjectArrayWrapper : public CacheableWrapper {
delete wrapper;
}
}
- m_cacheableObject = arr;
+ m_cacheableObject = std::shared_ptr<Serializable>(arr);
}
virtual uint32_t getCheckSum(const CacheablePtr object) const {
const CacheableObjectArray* arr =
- dynamic_cast<const CacheableObjectArray*>(object.ptr());
+ dynamic_cast<const CacheableObjectArray*>(object.get());
ASSERT(arr != NULL, "getCheckSum: null object.");
uint32_t checkSum = 0;
for (uint32_t index = 0; index < static_cast<uint32_t>(arr->size());
++index) {
const CacheablePtr obj = arr->at(index);
- if (obj == NULLPTR) {
+ if (obj == nullptr) {
continue;
}
int8_t typeId = obj->typeId();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/CMakeLists.txt b/src/cppcache/integration-test/CMakeLists.txt
index 71ee174..ff49485 100644
--- a/src/cppcache/integration-test/CMakeLists.txt
+++ b/src/cppcache/integration-test/CMakeLists.txt
@@ -127,7 +127,6 @@ set_property(TEST testAttributesFactory PROPERTY LABELS STABLE QUICK)
set_property(TEST testXmlCacheCreationWithOverFlow PROPERTY LABELS STABLE QUICK)
set_property(TEST testNativeCompareBasic PROPERTY LABELS STABLE QUICK)
set_property(TEST testConnect PROPERTY LABELS STABLE QUICK)
-set_property(TEST testSharedPtr PROPERTY LABELS STABLE QUICK)
set_property(TEST testThinClientRemoveAllLocal PROPERTY LABELS STABLE QUICK)
set_property(TEST testDunit PROPERTY LABELS STABLE QUICK)
set_property(TEST testAttributesMutator PROPERTY LABELS STABLE QUICK)
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/CacheHelper.cpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/CacheHelper.cpp b/src/cppcache/integration-test/CacheHelper.cpp
index b6dd35d..61bfc23 100644
--- a/src/cppcache/integration-test/CacheHelper.cpp
+++ b/src/cppcache/integration-test/CacheHelper.cpp
@@ -77,7 +77,7 @@ CacheHelper& CacheHelper::getHelper() {
CacheHelper::CacheHelper(const char* member_id, const PropertiesPtr& configPtr,
const bool noRootRegion) {
PropertiesPtr pp = configPtr;
- if (pp == NULLPTR) {
+ if (pp == nullptr) {
pp = Properties::create();
}
@@ -102,7 +102,7 @@ CacheHelper::CacheHelper(const char* member_id, const PropertiesPtr& configPtr,
CacheHelper::CacheHelper(const char* member_id, const char* cachexml,
const PropertiesPtr& configPtr) {
PropertiesPtr pp = configPtr;
- if (pp == NULLPTR) {
+ if (pp == nullptr) {
pp = Properties::create();
}
if (cachexml != NULL) {
@@ -119,7 +119,7 @@ CacheHelper::CacheHelper(const char* member_id, const char* cachexml,
CacheHelper::CacheHelper(const PropertiesPtr& configPtr,
const bool noRootRegion) {
PropertiesPtr pp = configPtr;
- if (pp == NULLPTR) {
+ if (pp == nullptr) {
pp = Properties::create();
}
@@ -144,7 +144,7 @@ CacheHelper::CacheHelper(const bool isThinclient,
const PropertiesPtr& configPtr,
const bool noRootRegion) {
PropertiesPtr pp = configPtr;
- if (pp == NULLPTR) {
+ if (pp == nullptr) {
pp = Properties::create();
}
try {
@@ -163,7 +163,7 @@ CacheHelper::CacheHelper(const bool isThinclient, bool pdxIgnoreUnreadFields,
bool pdxReadSerialized, const PropertiesPtr& configPtr,
const bool noRootRegion) {
PropertiesPtr pp = configPtr;
- if (pp == NULLPTR) {
+ if (pp == nullptr) {
pp = Properties::create();
}
try {
@@ -190,7 +190,7 @@ CacheHelper::CacheHelper(const bool isthinClient, const char* poolName,
bool isMultiuserMode, bool prSingleHop,
bool threadLocal) {
PropertiesPtr pp = configPtr;
- if (pp == NULLPTR) {
+ if (pp == nullptr) {
pp = Properties::create();
}
@@ -233,7 +233,7 @@ CacheHelper::CacheHelper(const bool isthinClient, const char* poolName,
CacheHelper::CacheHelper(const int redundancyLevel,
const PropertiesPtr& configPtr) {
PropertiesPtr pp = configPtr;
- if (pp == NULLPTR) {
+ if (pp == nullptr) {
pp = Properties::create();
}
@@ -253,7 +253,7 @@ void CacheHelper::closePool(const char* poolName, bool keepAlive) {
}
void CacheHelper::disconnect(bool keepalive) {
- if (cachePtr == NULLPTR) {
+ if (cachePtr == nullptr) {
return;
}
@@ -265,11 +265,11 @@ void CacheHelper::disconnect(bool keepalive) {
}
// rootRegionPtr->localDestroyRegion();
- rootRegionPtr = NULLPTR;
+ rootRegionPtr = nullptr;
LOG("Destroyed root region.");
try {
LOG("Closing cache.");
- if (cachePtr != NULLPTR) {
+ if (cachePtr != nullptr) {
cachePtr->close(keepalive);
}
LOG("Closing cache complete.");
@@ -280,7 +280,7 @@ void CacheHelper::disconnect(bool keepalive) {
LOG("exception throw while closing cache");
}
- cachePtr = NULLPTR;
+ cachePtr = nullptr;
LOG("Closed cache.");
try {
if (m_doDisconnect) {
@@ -312,7 +312,7 @@ void CacheHelper::createPlainRegion(const char* regionName,
showRegionAttributes(*regAttrs);
// This is using subregions (deprecated) so not placing the new cache API here
regionPtr = rootRegionPtr->createSubregion(regionName, regAttrs);
- ASSERT(regionPtr != NULLPTR, "failed to create region.");
+ ASSERT(regionPtr != nullptr, "failed to create region.");
}
void CacheHelper::createLRURegion(const char* regionName,
@@ -331,7 +331,7 @@ void CacheHelper::createLRURegion(const char* regionName, RegionPtr& regionPtr,
showRegionAttributes(*regAttrs);
// This is using subregions (deprecated) so not placing the new cache API here
regionPtr = rootRegionPtr->createSubregion(regionName, regAttrs);
- ASSERT(regionPtr != NULLPTR, "failed to create region.");
+ ASSERT(regionPtr != nullptr, "failed to create region.");
}
void CacheHelper::createDistRegion(const char* regionName,
@@ -351,7 +351,7 @@ void CacheHelper::createDistRegion(const char* regionName, RegionPtr& regionPtr,
showRegionAttributes(*regAttrs);
// This is using subregions (deprecated) so not placing the new cache API here
regionPtr = rootRegionPtr->createSubregion(regionName, regAttrs);
- ASSERT(regionPtr != NULLPTR, "failed to create region.");
+ ASSERT(regionPtr != nullptr, "failed to create region.");
}
RegionPtr CacheHelper::getRegion(const char* name) {
@@ -366,7 +366,7 @@ RegionPtr CacheHelper::createRegion(const char* name, bool ack, bool caching,
int32_t tombstonetimeout) {
AttributesFactory af;
af.setCachingEnabled(caching);
- if (listener != NULLPTR) {
+ if (listener != nullptr) {
af.setCacheListener(listener);
}
if (concurrencyCheckEnabled) {
@@ -375,7 +375,7 @@ RegionPtr CacheHelper::createRegion(const char* name, bool ack, bool caching,
RegionAttributesPtr rattrsPtr = af.createRegionAttributes();
- CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cachePtr.ptr());
+ CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cachePtr.get());
RegionPtr regionPtr;
cacheImpl->createRegion(name, rattrsPtr, regionPtr);
return regionPtr;
@@ -396,7 +396,7 @@ RegionPtr CacheHelper::createRegion(const char* name, bool ack, bool caching,
RegionAttributesPtr rattrsPtr = af.createRegionAttributes();
- CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cachePtr.ptr());
+ CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cachePtr.get());
RegionPtr regionPtr;
cacheImpl->createRegion(name, rattrsPtr, regionPtr);
return regionPtr;
@@ -507,7 +507,7 @@ void CacheHelper::createPoolWithLocators(const char* name, const char* locators,
createPool(name, locators, serverGroup, subscriptionRedundancy,
clientNotificationEnabled, subscriptionAckInterval,
connections, -1, isMultiuserMode);
- ASSERT(poolPtr != NULLPTR, "Failed to create pool.");
+ ASSERT(poolPtr != nullptr, "Failed to create pool.");
logPoolAttributes(poolPtr);
LOG("Pool created.");
}
@@ -612,7 +612,7 @@ RegionPtr CacheHelper::createPooledRegion(
}
if ((PoolManager::find(poolName)) ==
- NULLPTR) { // Pool does not exist with the same name.
+ nullptr) { // Pool does not exist with the same name.
PoolPtr pptr = poolFacPtr->create(poolName);
}
@@ -630,7 +630,7 @@ RegionPtr CacheHelper::createPooledRegion(
regionFactoryPtr->setRegionIdleTimeout(action, rit);
regionFactoryPtr->setRegionTimeToLive(action, rttl);
regionFactoryPtr->setPoolName(poolName);
- if (cacheListener != NULLPTR) {
+ if (cacheListener != nullptr) {
regionFactoryPtr->setCacheListener(cacheListener);
}
return regionFactoryPtr->create(name);
@@ -648,7 +648,7 @@ RegionPtr CacheHelper::createPooledRegionConcurrencyCheckDisabled(
addServerLocatorEPs(locators, poolFacPtr);
if ((PoolManager::find(poolName)) ==
- NULLPTR) { // Pool does not exist with the same name.
+ nullptr) { // Pool does not exist with the same name.
PoolPtr pptr = poolFacPtr->create(poolName);
}
@@ -667,7 +667,7 @@ RegionPtr CacheHelper::createPooledRegionConcurrencyCheckDisabled(
regionFactoryPtr->setRegionTimeToLive(action, rttl);
regionFactoryPtr->setConcurrencyChecksEnabled(concurrencyCheckEnabled);
regionFactoryPtr->setPoolName(poolName);
- if (cacheListener != NULLPTR) {
+ if (cacheListener != nullptr) {
regionFactoryPtr->setCacheListener(cacheListener);
}
return regionFactoryPtr->create(name);
@@ -697,7 +697,7 @@ RegionPtr CacheHelper::createRegionDiscOverFlow(
}
RegionAttributesPtr rattrsPtr = af.createRegionAttributes();
- CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cachePtr.ptr());
+ CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cachePtr.get());
RegionPtr regionPtr;
cacheImpl->createRegion(name, rattrsPtr, regionPtr);
return regionPtr;
@@ -717,7 +717,7 @@ RegionPtr CacheHelper::createPooledRegionDiscOverFlow(
addServerLocatorEPs(locators, poolFacPtr);
}
if ((PoolManager::find(poolName)) ==
- NULLPTR) { // Pool does not exist with the same name.
+ nullptr) { // Pool does not exist with the same name.
PoolPtr pptr = poolFacPtr->create(poolName);
}
@@ -752,7 +752,7 @@ RegionPtr CacheHelper::createPooledRegionDiscOverFlow(
regionFactoryPtr->setPersistenceManager(
"SqLiteImpl", "createSqLiteInstance", sqLiteProps);
}
- if (cacheListener != NULLPTR) {
+ if (cacheListener != nullptr) {
regionFactoryPtr->setCacheListener(cacheListener);
}
return regionFactoryPtr->create(name);
@@ -772,7 +772,7 @@ RegionPtr CacheHelper::createPooledRegionSticky(
addServerLocatorEPs(locators, poolFacPtr);
if ((PoolManager::find(poolName)) ==
- NULLPTR) { // Pool does not exist with the same name.
+ nullptr) { // Pool does not exist with the same name.
PoolPtr pptr = poolFacPtr->create(poolName);
LOG("createPooledRegionSticky logPoolAttributes");
logPoolAttributes(pptr);
@@ -792,7 +792,7 @@ RegionPtr CacheHelper::createPooledRegionSticky(
regionFactoryPtr->setRegionIdleTimeout(action, rit);
regionFactoryPtr->setRegionTimeToLive(action, rttl);
regionFactoryPtr->setPoolName(poolName);
- if (cacheListener != NULLPTR) {
+ if (cacheListener != nullptr) {
regionFactoryPtr->setCacheListener(cacheListener);
}
return regionFactoryPtr->create(name);
@@ -812,7 +812,7 @@ RegionPtr CacheHelper::createPooledRegionStickySingleHop(
addServerLocatorEPs(locators, poolFacPtr);
if ((PoolManager::find(poolName)) ==
- NULLPTR) { // Pool does not exist with the same name.
+ nullptr) { // Pool does not exist with the same name.
PoolPtr pptr = poolFacPtr->create(poolName);
LOG("createPooledRegionStickySingleHop logPoolAttributes");
logPoolAttributes(pptr);
@@ -832,7 +832,7 @@ RegionPtr CacheHelper::createPooledRegionStickySingleHop(
regionFactoryPtr->setRegionIdleTimeout(action, rit);
regionFactoryPtr->setRegionTimeToLive(action, rttl);
regionFactoryPtr->setPoolName(poolName);
- if (cacheListener != NULLPTR) {
+ if (cacheListener != nullptr) {
regionFactoryPtr->setCacheListener(cacheListener);
}
return regionFactoryPtr->create(name);
@@ -843,7 +843,7 @@ RegionPtr CacheHelper::createSubregion(RegionPtr& parent, const char* name,
const CacheListenerPtr& listener) {
AttributesFactory af;
af.setCachingEnabled(caching);
- if (listener != NULLPTR) {
+ if (listener != nullptr) {
af.setCacheListener(listener);
}
RegionAttributesPtr rattrsPtr = af.createRegionAttributes();
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/CacheHelper.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/CacheHelper.hpp b/src/cppcache/integration-test/CacheHelper.hpp
index 4e85e7c..52de9fe 100644
--- a/src/cppcache/integration-test/CacheHelper.hpp
+++ b/src/cppcache/integration-test/CacheHelper.hpp
@@ -59,33 +59,33 @@ class CacheHelper {
static std::string unitTestOutputFile();
static int getNumLocatorListUpdates(const char* s);
- CacheHelper(const char* member_id, const PropertiesPtr& configPtr = NULLPTR,
+ CacheHelper(const char* member_id, const PropertiesPtr& configPtr = nullptr,
const bool noRootRegion = false);
/** rootRegionPtr will still be null... */
CacheHelper(const char* member_id, const char* cachexml,
- const PropertiesPtr& configPtr = NULLPTR);
+ const PropertiesPtr& configPtr = nullptr);
- CacheHelper(const PropertiesPtr& configPtr = NULLPTR,
+ CacheHelper(const PropertiesPtr& configPtr = nullptr,
const bool noRootRegion = false);
- CacheHelper(const bool isThinclient, const PropertiesPtr& configPtr = NULLPTR,
+ CacheHelper(const bool isThinclient, const PropertiesPtr& configPtr = nullptr,
const bool noRootRegion = false);
CacheHelper(const bool isThinclient, bool pdxIgnoreUnreadFields,
- bool pdxReadSerialized, const PropertiesPtr& configPtr = NULLPTR,
+ bool pdxReadSerialized, const PropertiesPtr& configPtr = nullptr,
const bool noRootRegion = false);
CacheHelper(const bool isthinClient, const char* poolName,
const char* locators, const char* serverGroup,
- const PropertiesPtr& configPtr = NULLPTR, int redundancy = 0,
+ const PropertiesPtr& configPtr = nullptr, int redundancy = 0,
bool clientNotification = false, int subscriptionAckInterval = -1,
int connections = -1, int loadConditioningInterval = -1,
bool isMultiuserMode = false, bool prSingleHop = false,
bool threadLocal = false);
CacheHelper(const int redundancyLevel,
- const PropertiesPtr& configPtr = NULLPTR);
+ const PropertiesPtr& configPtr = nullptr);
virtual ~CacheHelper();
@@ -153,7 +153,7 @@ class CacheHelper {
RegionPtr createRegionAndAttachPool2(
const char* name, bool ack, const char* poolName,
- const PartitionResolverPtr& aResolver = NULLPTR, bool caching = true,
+ const PartitionResolverPtr& aResolver = nullptr, bool caching = true,
int ettl = 0, int eit = 0, int rttl = 0, int rit = 0, int lel = 0,
ExpirationAction::Action action = ExpirationAction::DESTROY);
@@ -168,7 +168,7 @@ class CacheHelper {
const char* poolName = "__TEST_POOL1__", bool caching = true,
bool clientNotificationEnabled = false, int ettl = 0, int eit = 0,
int rttl = 0, int rit = 0, int lel = 0,
- const CacheListenerPtr& cacheListener = NULLPTR,
+ const CacheListenerPtr& cacheListener = nullptr,
ExpirationAction::Action action = ExpirationAction::DESTROY);
RegionPtr createPooledRegionConcurrencyCheckDisabled(
@@ -177,7 +177,7 @@ class CacheHelper {
bool clientNotificationEnabled = false,
bool concurrencyCheckEnabled = true, int ettl = 0, int eit = 0,
int rttl = 0, int rit = 0, int lel = 0,
- const CacheListenerPtr& cacheListener = NULLPTR,
+ const CacheListenerPtr& cacheListener = nullptr,
ExpirationAction::Action action = ExpirationAction::DESTROY);
RegionPtr createRegionDiscOverFlow(
@@ -191,7 +191,7 @@ class CacheHelper {
const char* poolName = "__TEST_POOL1__", bool caching = true,
bool clientNotificationEnabled = false, int ettl = 0, int eit = 0,
int rttl = 0, int rit = 0, int lel = 0,
- const CacheListenerPtr& cacheListener = NULLPTR,
+ const CacheListenerPtr& cacheListener = nullptr,
ExpirationAction::Action action = ExpirationAction::DESTROY);
RegionPtr createPooledRegionSticky(
@@ -199,7 +199,7 @@ class CacheHelper {
const char* poolName = "__TEST_POOL1__", bool caching = true,
bool clientNotificationEnabled = false, int ettl = 0, int eit = 0,
int rttl = 0, int rit = 0, int lel = 0,
- const CacheListenerPtr& cacheListener = NULLPTR,
+ const CacheListenerPtr& cacheListener = nullptr,
ExpirationAction::Action action = ExpirationAction::DESTROY);
RegionPtr createPooledRegionStickySingleHop(
@@ -207,7 +207,7 @@ class CacheHelper {
const char* poolName = "__TEST_POOL1__", bool caching = true,
bool clientNotificationEnabled = false, int ettl = 0, int eit = 0,
int rttl = 0, int rit = 0, int lel = 0,
- const CacheListenerPtr& cacheListener = NULLPTR,
+ const CacheListenerPtr& cacheListener = nullptr,
ExpirationAction::Action action = ExpirationAction::DESTROY);
RegionPtr createSubregion(RegionPtr& parent, const char* name, bool ack,
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/CacheImplHelper.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/CacheImplHelper.hpp b/src/cppcache/integration-test/CacheImplHelper.hpp
index 4af1400..68603be 100644
--- a/src/cppcache/integration-test/CacheImplHelper.hpp
+++ b/src/cppcache/integration-test/CacheImplHelper.hpp
@@ -41,10 +41,10 @@ using namespace unitTests;
class CacheImplHelper : public CacheHelper {
public:
CacheImplHelper(const char* member_id,
- const PropertiesPtr& configPtr = NULLPTR)
+ const PropertiesPtr& configPtr = nullptr)
: CacheHelper(member_id, configPtr) {}
- CacheImplHelper(const PropertiesPtr& configPtr = NULLPTR)
+ CacheImplHelper(const PropertiesPtr& configPtr = nullptr)
: CacheHelper(configPtr) {}
virtual void createRegion(const char* regionName, RegionPtr& regionPtr,
@@ -63,7 +63,7 @@ class CacheImplHelper : public CacheHelper {
CacheImpl* cimpl = TestUtils::getCacheImpl(cachePtr);
ASSERT(cimpl != NULL, "failed to get cacheImpl *.");
cimpl->createRegion(regionName, regAttrs, regionPtr);
- ASSERT(regionPtr != NULLPTR, "failed to create region.");
+ ASSERT(regionPtr != nullptr, "failed to create region.");
}
};
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/DeltaEx.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/DeltaEx.hpp b/src/cppcache/integration-test/DeltaEx.hpp
index e35217f..3937cc2 100644
--- a/src/cppcache/integration-test/DeltaEx.hpp
+++ b/src/cppcache/integration-test/DeltaEx.hpp
@@ -25,6 +25,11 @@
#include <ace/OS.h>
#include "CacheHelper.hpp"
class DeltaEx : public Cacheable, public Delta {
+ private:
+ std::shared_ptr<DeltaEx> shared_from_this() {
+ return std::static_pointer_cast<DeltaEx>(Serializable::shared_from_this());
+ }
+
public:
int counter;
bool isDelta;
@@ -74,7 +79,7 @@ class DeltaEx : public Cacheable, public Delta {
virtual uint32_t objectSize() const { return 0; }
DeltaPtr clone() {
cloneCount++;
- return DeltaPtr(this);
+ return shared_from_this();
}
virtual ~DeltaEx() {}
void setDelta(bool delta) { this->isDelta = delta; }
@@ -82,6 +87,12 @@ class DeltaEx : public Cacheable, public Delta {
};
class PdxDeltaEx : public PdxSerializable, public Delta {
+ private:
+ std::shared_ptr<PdxDeltaEx> shared_from_this() {
+ return std::static_pointer_cast<PdxDeltaEx>(
+ Serializable::shared_from_this());
+ }
+
public:
int m_counter;
bool m_isDelta;
@@ -135,7 +146,7 @@ class PdxDeltaEx : public PdxSerializable, public Delta {
DeltaPtr clone() {
m_cloneCount++;
- return DeltaPtr(this);
+ return shared_from_this();
}
virtual ~PdxDeltaEx() {}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/QueryHelper.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/QueryHelper.hpp b/src/cppcache/integration-test/QueryHelper.hpp
index d122f86..0a280b3 100644
--- a/src/cppcache/integration-test/QueryHelper.hpp
+++ b/src/cppcache/integration-test/QueryHelper.hpp
@@ -70,7 +70,7 @@ class QueryHelper {
virtual void populatePortfolioData(RegionPtr& pregion, int setSize,
int numSets, int32_t objSize = 1,
- CacheableStringArrayPtr nm = NULLPTR);
+ CacheableStringArrayPtr nm = nullptr);
virtual void populatePositionData(RegionPtr& pregion, int setSize,
int numSets);
virtual void populatePortfolioPdxData(RegionPtr& pregion, int setSize,
@@ -161,7 +161,7 @@ void QueryHelper::populatePortfolioData(RegionPtr& rptr, int setSize,
for (int set = 1; set <= numSets; set++) {
for (int current = 1; current <= setSize; current++) {
- CacheablePtr port(new Portfolio(current, objSize, nm));
+ auto port = std::make_shared<Portfolio>(current, objSize, nm);
char portname[100] = {0};
ACE_OS::sprintf(portname, "port%d-%d", set, current);
@@ -187,8 +187,8 @@ void QueryHelper::populatePositionData(RegionPtr& rptr, int setSize,
for (int set = 1; set <= numSets; set++) {
for (int current = 1; current <= setSize; current++) {
- CacheablePtr pos(
- new Position(secIds[current % numSecIds], current * 100));
+ auto pos = std::make_shared<Position>(secIds[current % numSecIds],
+ current * 100);
char posname[100] = {0};
ACE_OS::sprintf(posname, "pos%d-%d", set, current);
@@ -208,7 +208,7 @@ void QueryHelper::populatePortfolioPdxData(RegionPtr& rptr, int setSize,
for (int set = 1; set <= numSets; set++) {
for (int current = 1; current <= setSize; current++) {
- CacheablePtr port(new PortfolioPdx(current, objSize));
+ auto port = std::make_shared<PortfolioPdx>(current, objSize);
char portname[100] = {0};
ACE_OS::sprintf(portname, "port%d-%d", set, current);
@@ -232,8 +232,7 @@ void QueryHelper::populatePositionPdxData(RegionPtr& rptr, int setSize,
for (int set = 1; set <= numSets; set++) {
for (int current = 1; current <= setSize; current++) {
- CacheablePtr pos(
- new PositionPdx(secIds[current % numSecIds], current * 100));
+ auto pos = std::make_shared<PositionPdx>(secIds[current % numSecIds], current * 100);
char posname[100] = {0};
ACE_OS::sprintf(posname, "pos%d-%d", set, current);
@@ -251,7 +250,7 @@ void QueryHelper::populatePDXObject(RegionPtr& rptr) {
LOG("PdxObject Registered Successfully....");
// Creating object of type PdxObject
- CacheablePtr pdxobj(new PdxTests::PdxType());
+ auto pdxobj = std::make_shared<PdxTests::PdxType>();
CacheableKeyPtr keyport = CacheableKey::create("ABC");
// PUT Operation
@@ -262,8 +261,8 @@ void QueryHelper::populatePDXObject(RegionPtr& rptr) {
LOG("localDestroy() operation....Done");
// Remote GET for PdxObject
- // PdxObject *obj2 = dynamic_cast<PdxObject *> ((rptr->get(keyport)).ptr());
- PdxTests::PdxTypePtr obj2 = dynCast<PdxTests::PdxTypePtr>(rptr->get(keyport));
+ // PdxObject *obj2 = dynamic_cast<PdxObject *> ((rptr->get(keyport)).get());
+ auto obj2 = std::dynamic_pointer_cast<PdxTests::PdxType>(rptr->get(keyport));
LOGINFO("get... Result-1: Returned float=%f, String val = %s double=%lf",
obj2->getFloat(), obj2->getString(), obj2->getDouble());
@@ -282,11 +281,11 @@ void QueryHelper::populatePDXObject(RegionPtr& rptr) {
void QueryHelper::getPDXObject(RegionPtr& rptr) {
// Remote GET for PdxObject
- // PdxObject *obj2 = dynamic_cast<PdxObject *> ((rptr->get(keyport)).ptr());
+ // PdxObject *obj2 = dynamic_cast<PdxObject *> ((rptr->get(keyport)).get());
CacheableKeyPtr keyport = CacheableKey::create("ABC");
LOG("Client-2 PdxObject GET OP Start....");
- PdxTests::PdxTypePtr obj2 = dynCast<PdxTests::PdxTypePtr>(rptr->get(keyport));
+ auto obj2 = std::dynamic_pointer_cast<PdxTests::PdxType>(rptr->get(keyport));
LOG("Client-2 PdxObject GET OP Done....");
/*
@@ -304,11 +303,11 @@ void QueryHelper::getPDXObject(RegionPtr& rptr) {
}
bool QueryHelper::verifyRS(SelectResultsPtr& resultSet, int expectedRows) {
- if (!instanceOf<ResultSetPtr>(resultSet)) {
+ if (!std::dynamic_pointer_cast<ResultSet>(resultSet)) {
return false;
}
- ResultSetPtr rsptr = staticCast<ResultSetPtr>(resultSet);
+ ResultSetPtr rsptr = std::static_pointer_cast<GF_UNWRAP_SP(ResultSetPtr)>(resultSet);
int foundRows = 0;
@@ -327,7 +326,7 @@ bool QueryHelper::verifyRS(SelectResultsPtr& resultSet, int expectedRows) {
bool QueryHelper::verifySS(SelectResultsPtr& structSet, int expectedRows,
int expectedFields) {
- if (!instanceOf<StructSetPtr>(structSet)) {
+ if (!std::dynamic_pointer_cast<StructSet>(structSet)) {
if (expectedRows == 0 && expectedFields == 0) {
return true; // quite possible we got a null set back.
}
@@ -335,7 +334,7 @@ bool QueryHelper::verifySS(SelectResultsPtr& structSet, int expectedRows,
return false;
}
- StructSetPtr ssptr = staticCast<StructSetPtr>(structSet);
+ StructSetPtr ssptr = std::static_pointer_cast<GF_UNWRAP_SP(StructSetPtr)>(structSet);
int foundRows = 0;
@@ -344,7 +343,7 @@ bool QueryHelper::verifySS(SelectResultsPtr& structSet, int expectedRows,
SerializablePtr ser = (*iter);
foundRows++;
- Struct* siptr = dynamic_cast<Struct*>(ser.ptr());
+ Struct* siptr = dynamic_cast<Struct*>(ser.get());
if (siptr == NULL) {
printf("siptr is NULL \n\n");
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/TallyListener.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/TallyListener.hpp b/src/cppcache/integration-test/TallyListener.hpp
index cdc6a72..d9c5386 100644
--- a/src/cppcache/integration-test/TallyListener.hpp
+++ b/src/cppcache/integration-test/TallyListener.hpp
@@ -55,7 +55,7 @@ class TallyListener : public CacheListener {
isCallbackCalled(false),
m_lastKey(),
m_lastValue(),
- m_callbackArg(NULLPTR),
+ m_callbackArg(nullptr),
m_ignoreTimeout(false),
m_quiet(false) {
LOG("TallyListener contructor called");
@@ -122,9 +122,9 @@ class TallyListener : public CacheListener {
bool isCallBackArgCalled() { return isCallbackCalled; }
void checkcallbackArg(const EntryEvent& event) {
if (!isListnerInvoked) isListnerInvoked = true;
- if (m_callbackArg != NULLPTR) {
- CacheableKeyPtr callbkArg =
- dynCast<CacheableKeyPtr>(event.getCallbackArgument());
+ if (m_callbackArg != nullptr) {
+ auto callbkArg =
+ std::dynamic_pointer_cast<CacheableKey>(event.getCallbackArgument());
if (strcmp(m_callbackArg->toString()->asChar(),
callbkArg->toString()->asChar()) == 0) {
isCallbackCalled = true;
@@ -170,7 +170,7 @@ void TallyListener::afterCreate(const EntryEvent& event) {
m_lastValue = event.getNewValue();
checkcallbackArg(event);
- CacheableStringPtr strPtr = dynCast<CacheableStringPtr>(event.getNewValue());
+ auto strPtr = std::dynamic_pointer_cast<CacheableString>(event.getNewValue());
char keytext[100];
m_lastKey->logString(keytext, 100);
if (!m_quiet) {
@@ -192,7 +192,7 @@ void TallyListener::afterUpdate(const EntryEvent& event) {
m_lastKey = event.getKey();
m_lastValue = event.getNewValue();
checkcallbackArg(event);
- CacheableStringPtr strPtr = dynCast<CacheableStringPtr>(event.getNewValue());
+ auto strPtr = std::dynamic_pointer_cast<CacheableString>(event.getNewValue());
char keytext[100];
m_lastKey->logString(keytext, 100);
if (!m_quiet) {
http://git-wip-us.apache.org/repos/asf/geode-native/blob/c0098121/src/cppcache/integration-test/TallyWriter.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/integration-test/TallyWriter.hpp b/src/cppcache/integration-test/TallyWriter.hpp
index da3bc7b..e1e49c5 100644
--- a/src/cppcache/integration-test/TallyWriter.hpp
+++ b/src/cppcache/integration-test/TallyWriter.hpp
@@ -54,7 +54,7 @@ class TallyWriter : virtual public CacheWriter {
isWriterfailed(false),
m_lastKey(),
m_lastValue(),
- m_callbackArg(NULLPTR) {
+ m_callbackArg(nullptr) {
LOG("TallyWriter Constructor called");
}
@@ -142,9 +142,9 @@ class TallyWriter : virtual public CacheWriter {
}
void checkcallbackArg(const EntryEvent& event) {
if (!isWriterInvoke) isWriterInvoke = true;
- if (m_callbackArg != NULLPTR) {
- CacheableKeyPtr callbkArg =
- dynCast<CacheableKeyPtr>(event.getCallbackArgument());
+ if (m_callbackArg != nullptr) {
+ auto callbkArg =
+ std::dynamic_pointer_cast<CacheableKey>(event.getCallbackArgument());
if (strcmp(m_callbackArg->toString()->asChar(),
callbkArg->toString()->asChar()) == 0) {
isCallbackCalled = true;