This is an automated email from the ASF dual-hosted git repository.
jbarrett pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode-native.git
The following commit(s) were added to refs/heads/develop by this push:
new 6da068f GEODE-4269: Replaces magic casting readObject. (#184)
6da068f is described below
commit 6da068f8386aaa50276785a122524523a00814bb
Author: Jacob Barrett <[email protected]>
AuthorDate: Wed Jan 10 12:44:00 2018 -0800
GEODE-4269: Replaces magic casting readObject. (#184)
---
cppcache/include/geode/DataInput.hpp | 38 ++++++-----------------
cppcache/include/geode/Serializer.hpp | 2 +-
cppcache/src/CacheableObjectPartList.cpp | 2 +-
cppcache/src/ClientProxyMembershipID.cpp | 15 ++++-----
cppcache/src/EnumInfo.cpp | 5 +--
cppcache/src/FarSideEntryOp.cpp | 2 +-
cppcache/src/GetAllServersRequest.cpp | 2 +-
cppcache/src/PdxLocalReader.cpp | 3 +-
cppcache/src/Properties.cpp | 4 +--
cppcache/src/RegionAttributes.cpp | 3 +-
cppcache/src/RegionCommit.cpp | 9 +++---
cppcache/src/TcrConnection.cpp | 4 +--
cppcache/src/TcrMessage.cpp | 9 +++---
cppcache/src/ThinClientLocatorHelper.cpp | 16 +++++-----
cppcache/src/ThinClientRegion.cpp | 5 +--
cppcache/src/VersionedCacheableObjectPartList.cpp | 2 +-
cppcache/test/DataInputTest.cpp | 13 ++++----
tests/cpp/testobject/BatchObject.cpp | 2 +-
tests/cpp/testobject/DeltaFastAssetAccount.cpp | 4 +--
tests/cpp/testobject/DeltaPSTObject.cpp | 2 +-
tests/cpp/testobject/DeltaTestImpl.cpp | 12 +++----
tests/cpp/testobject/FastAssetAccount.cpp | 4 +--
tests/cpp/testobject/PSTObject.cpp | 2 +-
tests/cpp/testobject/Portfolio.cpp | 14 ++++-----
tests/cpp/testobject/Position.cpp | 10 +++---
tests/cpp/testobject/TestObject1.cpp | 2 +-
tests/cpp/testobject/VariousPdxTypes.cpp | 4 +--
27 files changed, 88 insertions(+), 102 deletions(-)
diff --git a/cppcache/include/geode/DataInput.hpp
b/cppcache/include/geode/DataInput.hpp
index 33060b9..513d318 100644
--- a/cppcache/include/geode/DataInput.hpp
+++ b/cppcache/include/geode/DataInput.hpp
@@ -331,35 +331,6 @@ class _GEODE_EXPORT DataInput {
return value;
}
- /**
- * Read a <code>Serializable</code> object from the <code>DataInput</code>.
- * Null objects are handled.
- * This accepts an argument <code>throwOnError</code> that
- * specifies whether to check the type dynamically and throw a
- * <code>ClassCastException</code> when the cast fails.
- *
- * @param ptr The object to be read which is output by reference.
- * The type of this must match the type of object that
- * the application expects.
- * @param throwOnError Throw a <code>ClassCastException</code> when
- * the type of object does not match <code>ptr</code>.
- * Default is true when <code>GF_DEBUG_ASSERTS</code>
- * macro is set and false in normal case.
- * @throws ClassCastException When <code>dynCast</code> fails
- * for the given <code>ptr</code>.
- * @see dynCast
- * @see staticCast
- */
- template <class PTR>
- inline std::shared_ptr<PTR> readObject(bool throwOnError = false) {
- auto sPtr = readObjectInternal();
- if (throwOnError) {
- return std::dynamic_pointer_cast<PTR>(sPtr);
- } else {
- return std::static_pointer_cast<PTR>(sPtr);
- }
- }
-
inline bool readNativeBool() {
read(); // ignore type id
@@ -376,6 +347,15 @@ class _GEODE_EXPORT DataInput {
}
/**
+ * Read a Serializable object from the DataInput.
+ *
+ * @return Serializable object or <code>nullptr</code>.
+ */
+ inline std::shared_ptr<Serializable> readObject() {
+ return readObjectInternal();
+ }
+
+ /**
* Read a <code>Serializable</code> object from the <code>DataInput</code>.
* Null objects are handled.
*/
diff --git a/cppcache/include/geode/Serializer.hpp
b/cppcache/include/geode/Serializer.hpp
index 1ebd425..2995245 100644
--- a/cppcache/include/geode/Serializer.hpp
+++ b/cppcache/include/geode/Serializer.hpp
@@ -196,7 +196,7 @@ template <typename TObj,
Serializable>::type* = nullptr>
inline void readObject(apache::geode::client::DataInput& input,
std::shared_ptr<TObj>& value) {
- value = input.readObject<TObj>(true);
+ value = std::static_pointer_cast<TObj>(input.readObject());
}
// For arrays
diff --git a/cppcache/src/CacheableObjectPartList.cpp
b/cppcache/src/CacheableObjectPartList.cpp
index e69bbf7..eba1f86 100644
--- a/cppcache/src/CacheableObjectPartList.cpp
+++ b/cppcache/src/CacheableObjectPartList.cpp
@@ -42,7 +42,7 @@ void CacheableObjectPartList::fromData(DataInput& input) {
int32_t keysOffset = (m_keysOffset != nullptr ? *m_keysOffset : 0);
for (int32_t index = keysOffset; index < keysOffset + len; ++index) {
if (hasKeys) {
- key = input.readObject<CacheableKey>(true);
+ key = std::static_pointer_cast<CacheableKey>(input.readObject());
} else if (m_keys != nullptr) {
key = m_keys->operator[](index);
} else {
diff --git a/cppcache/src/ClientProxyMembershipID.cpp
b/cppcache/src/ClientProxyMembershipID.cpp
index f89d261..642aa7e 100644
--- a/cppcache/src/ClientProxyMembershipID.cpp
+++ b/cppcache/src/ClientProxyMembershipID.cpp
@@ -229,16 +229,17 @@ void ClientProxyMembershipID::fromData(DataInput& input) {
input.readBytesOnly(hostAddr, len); // inetaddress
hostPort = input.readInt32(); // port
- hostname = input.readObject<CacheableString>(); // hostname
+ hostname = std::static_pointer_cast<CacheableString>(input.readObject());
splitbrain = input.read(); // splitbrain
dcport = input.readInt32(); // port
vPID = input.readInt32(); // pid
vmKind = input.read(); // vmkind
auto aStringArray = CacheableStringArray::create();
aStringArray->fromData(input);
- dsName = input.readObject<CacheableString>(); // name
- uniqueTag = input.readObject<CacheableString>(); // unique tag
- durableClientId = input.readObject<CacheableString>(); // durable client id
+ dsName = std::static_pointer_cast<CacheableString>(input.readObject());
+ uniqueTag = std::static_pointer_cast<CacheableString>(input.readObject());
+ durableClientId =
+ std::static_pointer_cast<CacheableString>(input.readObject());
auto durableClntTimeOut = std::chrono::seconds(input.readInt32()); //
durable client timeout
int32_t vmViewId = 0;
readVersion(splitbrain, input);
@@ -283,13 +284,13 @@ Serializable*
ClientProxyMembershipID::readEssentialData(DataInput& input) {
const auto vmKind = input.read(); // vmkind
if (vmKind == ClientProxyMembershipID::LONER_DM_TYPE) {
- uniqueTag = input.readObject<CacheableString>(); // unique tag
+ uniqueTag = std::static_pointer_cast<CacheableString>(input.readObject());
} else {
- vmViewIdstr = input.readObject<CacheableString>();
+ vmViewIdstr =
std::static_pointer_cast<CacheableString>(input.readObject());
vmViewId = atoi(vmViewIdstr.get()->value().c_str());
}
- dsName = input.readObject<CacheableString>(); // name
+ dsName = std::static_pointer_cast<CacheableString>(input.readObject());
if (vmKind != ClientProxyMembershipID::LONER_DM_TYPE) {
// initialize the object with the values read and some dummy values
diff --git a/cppcache/src/EnumInfo.cpp b/cppcache/src/EnumInfo.cpp
index 6596025..8cd907e 100644
--- a/cppcache/src/EnumInfo.cpp
+++ b/cppcache/src/EnumInfo.cpp
@@ -74,8 +74,9 @@ void EnumInfo::toData(apache::geode::client::DataOutput
&output) const {
}
void EnumInfo::fromData(apache::geode::client::DataInput &input) {
- m_enumClassName = input.readObject<CacheableString>();
- m_enumName = input.readObject<CacheableString>();
+ m_enumClassName =
+ std::static_pointer_cast<CacheableString>(input.readObject());
+ m_enumName = std::static_pointer_cast<CacheableString>(input.readObject());
m_ordinal = input.readInt32();
}
diff --git a/cppcache/src/FarSideEntryOp.cpp b/cppcache/src/FarSideEntryOp.cpp
index 6596b68..d26507b 100644
--- a/cppcache/src/FarSideEntryOp.cpp
+++ b/cppcache/src/FarSideEntryOp.cpp
@@ -53,7 +53,7 @@ bool FarSideEntryOp::isInvalidate(int8_t op) {
void FarSideEntryOp::fromData(DataInput& input, bool largeModCount,
uint16_t memId) {
- m_key = input.readObject<CacheableKey>();
+ m_key = std::static_pointer_cast<CacheableString>(input.readObject());
m_op = input.read();
if (largeModCount) {
m_modSerialNum = input.readInt32();
diff --git a/cppcache/src/GetAllServersRequest.cpp
b/cppcache/src/GetAllServersRequest.cpp
index 5d4b2bf..0f071ff 100644
--- a/cppcache/src/GetAllServersRequest.cpp
+++ b/cppcache/src/GetAllServersRequest.cpp
@@ -24,5 +24,5 @@ void GetAllServersRequest::toData(DataOutput& output) const {
}
void GetAllServersRequest::fromData(DataInput& input) {
- m_serverGroup = input.readObject<CacheableString>();
+ m_serverGroup =
std::static_pointer_cast<CacheableString>(input.readObject());
}
diff --git a/cppcache/src/PdxLocalReader.cpp b/cppcache/src/PdxLocalReader.cpp
index e2420e0..2165e31 100644
--- a/cppcache/src/PdxLocalReader.cpp
+++ b/cppcache/src/PdxLocalReader.cpp
@@ -302,7 +302,8 @@ bool PdxLocalReader::isIdentityField(const std::string&
fieldName) {
void PdxLocalReader::readCollection(
const std::string& fieldName,
std::shared_ptr<CacheableArrayList>& collection) {
- collection = m_dataInput->readObject<CacheableArrayList>();
+ collection =
+ std::static_pointer_cast<CacheableArrayList>(m_dataInput->readObject());
}
std::shared_ptr<PdxUnreadFields> PdxLocalReader::readUnreadFields() {
LOGDEBUG("readUnreadFields:: %d ignore property %d", m_isDataNeedToPreserve,
diff --git a/cppcache/src/Properties.cpp b/cppcache/src/Properties.cpp
index 1c62772..43d2ec5 100644
--- a/cppcache/src/Properties.cpp
+++ b/cppcache/src/Properties.cpp
@@ -273,8 +273,8 @@ void Properties::toData(DataOutput& output) const {
void Properties::fromData(DataInput& input) {
int32_t mapSize = input.readArrayLen();
for (int i = 0; i < mapSize; i++) {
- auto key = input.readObject<CacheableKey>(true);
- auto val = input.readObject<Cacheable>(true);
+ auto key = std::static_pointer_cast<CacheableKey>(input.readObject());
+ auto val = std::static_pointer_cast<Cacheable>(input.readObject());
MAP->rebind(key, val);
}
}
diff --git a/cppcache/src/RegionAttributes.cpp
b/cppcache/src/RegionAttributes.cpp
index 56352a4..c77477d 100644
--- a/cppcache/src/RegionAttributes.cpp
+++ b/cppcache/src/RegionAttributes.cpp
@@ -375,7 +375,8 @@ void RegionAttributes::fromData(DataInput& in) {
apache::geode::client::impl::readString(in, m_endpoints);
apache::geode::client::impl::readString(in, m_persistenceLibrary);
apache::geode::client::impl::readString(in, m_persistenceFactory);
- m_persistenceProperties = in.readObject<Properties>(true);
+ m_persistenceProperties =
+ std::static_pointer_cast<Properties>(in.readObject());
apache::geode::client::impl::readString(in, m_poolName);
apache::geode::client::impl::readBool(in, &m_isConcurrencyChecksEnabled);
}
diff --git a/cppcache/src/RegionCommit.cpp b/cppcache/src/RegionCommit.cpp
index 25cba9a..fcf68a7 100644
--- a/cppcache/src/RegionCommit.cpp
+++ b/cppcache/src/RegionCommit.cpp
@@ -28,13 +28,14 @@ namespace geode {
namespace client {
void RegionCommit::fromData(DataInput& input) {
- m_regionPath = input.readObject<CacheableString>();
- m_parentRegionPath = input.readObject<CacheableString>();
+ m_regionPath = std::static_pointer_cast<CacheableString>(input.readObject());
+ m_parentRegionPath =
+ std::static_pointer_cast<CacheableString>(input.readObject());
int32_t size = input.readInt32();
if (size > 0) {
const auto largeModCount = input.readBoolean();
- std::shared_ptr<DSMemberForVersionStamp> dsMember;
- dsMember = input.readObject<DSMemberForVersionStamp>();
+ auto dsMember =
+ std::static_pointer_cast<DSMemberForVersionStamp>(input.readObject());
auto memId = m_memberListForVersionStamp.add(dsMember);
for (int i = 0; i < size; i++) {
diff --git a/cppcache/src/TcrConnection.cpp b/cppcache/src/TcrConnection.cpp
index a29666e..6c653e1 100644
--- a/cppcache/src/TcrConnection.cpp
+++ b/cppcache/src/TcrConnection.cpp
@@ -448,8 +448,8 @@ bool TcrConnection::InitTcrConnection(
auto diForClient = cacheImpl->createDataInput(
reinterpret_cast<const uint8_t*>(recvMessage->value()),
recvMessage->length());
- std::shared_ptr<ClientProxyMembershipID> member;
- member = diForClient->readObject<ClientProxyMembershipID>();
+ auto member = std::static_pointer_cast<ClientProxyMembershipID>(
+ diForClient->readObject());
auto memId = cacheImpl->getMemberListForVersionStamp()->add(member);
getEndpointObject()->setDistributedMemberID(memId);
LOGDEBUG("Deserialized distributed member Id %d", memId);
diff --git a/cppcache/src/TcrMessage.cpp b/cppcache/src/TcrMessage.cpp
index 8c7e94c..a3aba11 100644
--- a/cppcache/src/TcrMessage.cpp
+++ b/cppcache/src/TcrMessage.cpp
@@ -369,7 +369,7 @@ inline void TcrMessage::readKeyPart(DataInput& input) {
const auto isObj = input.readBoolean();
if (lenObj > 0) {
if (isObj) {
- m_key = input.readObject<CacheableKey>();
+ m_key = std::static_pointer_cast<CacheableKey>(input.readObject());
} else {
m_key = std::static_pointer_cast<CacheableKey>(
readCacheableString(input, lenObj));
@@ -2914,7 +2914,7 @@ void TcrMessage::readEventIdPart(DataInput& input, bool
skip, int32_t parts) {
GF_D_ASSERT(isObj != 0);
- m_eventid = input.readObject<EventId>();
+ m_eventid = std::static_pointer_cast<EventId>(input.readObject());
}
std::shared_ptr<DSMemberForVersionStamp> TcrMessage::readDSMember(
apache::geode::client::DataInput& input) {
@@ -2979,7 +2979,8 @@ void TcrMessage::readHashMapForGCVersions(
}
void TcrMessage::readHashSetForGCVersions(
- apache::geode::client::DataInput& input,
std::shared_ptr<CacheableHashSet>& value) {
+ apache::geode::client::DataInput& input,
+ std::shared_ptr<CacheableHashSet>& value) {
uint8_t hashsettypeid = input.read();
if (hashsettypeid != GeodeTypeIds::CacheableHashSet) {
throw Exception(
@@ -2991,7 +2992,7 @@ void TcrMessage::readHashSetForGCVersions(
std::shared_ptr<CacheableKey> key;
std::shared_ptr<Cacheable> val;
for (int32_t index = 0; index < len; index++) {
- auto keyPtr = input.readObject<CacheableKey>();
+ auto keyPtr = std::static_pointer_cast<CacheableKey>(input.readObject());
value->insert(keyPtr);
}
}
diff --git a/cppcache/src/ThinClientLocatorHelper.cpp
b/cppcache/src/ThinClientLocatorHelper.cpp
index 104abe7..5f94f8f 100644
--- a/cppcache/src/ThinClientLocatorHelper.cpp
+++ b/cppcache/src/ThinClientLocatorHelper.cpp
@@ -124,7 +124,6 @@ GfErrType ThinClientLocatorHelper::getAllServers(
auto di =
m_poolDM->getConnectionManager().getCacheImpl()->createDataInput(
reinterpret_cast<uint8_t*>(buff), receivedLength);
- std::shared_ptr<GetAllServersResponse> response(nullptr);
/* adongre
* SSL Enabled on Location and not in the client
@@ -136,7 +135,8 @@ GfErrType ThinClientLocatorHelper::getAllServers(
}
di->rewindCursor(1);
- response = di->readObject<GetAllServersResponse>();
+ auto response =
+ std::static_pointer_cast<GetAllServersResponse>(di->readObject());
servers = response->getServers();
return GF_NOERR;
} catch (const AuthenticationRequiredException&) {
@@ -215,7 +215,6 @@ GfErrType
ThinClientLocatorHelper::getEndpointForNewCallBackConn(
}
auto di =
m_poolDM->getConnectionManager().getCacheImpl()->createDataInput(
reinterpret_cast<uint8_t*>(buff), receivedLength);
- std::shared_ptr<QueueConnectionResponse> response(nullptr);
/* adongre
* ssl defect
@@ -227,7 +226,8 @@ GfErrType
ThinClientLocatorHelper::getEndpointForNewCallBackConn(
"SSL is enabled on locator, enable SSL in client as well");
}
di->rewindCursor(1);
- response = di->readObject<QueueConnectionResponse>();
+ auto response =
+ std::static_pointer_cast<QueueConnectionResponse>(di->readObject());
outEndpoint = response->getServers();
return GF_NOERR;
} catch (const AuthenticationRequiredException& excp) {
@@ -316,7 +316,6 @@ GfErrType ThinClientLocatorHelper::getEndpointForNewFwdConn(
}
auto di =
m_poolDM->getConnectionManager().getCacheImpl()->createDataInput(
reinterpret_cast<uint8_t*>(buff), receivedLength);
- std::shared_ptr<ClientConnectionResponse> response;
/* adongre
* SSL is enabled on locator and not in the client
@@ -329,7 +328,8 @@ GfErrType ThinClientLocatorHelper::getEndpointForNewFwdConn(
}
di->rewindCursor(1);
- response = di->readObject<ClientConnectionResponse>();
+ auto response =
+ std::static_pointer_cast<ClientConnectionResponse>(di->readObject());
response->printInfo();
if (!response->serverFound()) {
LOGFINE("Server not found");
@@ -407,7 +407,6 @@ GfErrType ThinClientLocatorHelper::updateLocators(
.getCacheImpl()
->createDataInput(reinterpret_cast<uint8_t*>(buff),
receivedLength);
- auto response = std::make_shared<LocatorListResponse>();
/* adongre
* SSL Enabled on Location and not in the client
@@ -420,7 +419,8 @@ GfErrType ThinClientLocatorHelper::updateLocators(
}
di->rewindCursor(1);
- response = di->readObject<LocatorListResponse>();
+ auto response =
+ std::static_pointer_cast<LocatorListResponse>(di->readObject());
auto locators = response->getLocators();
if (locators.size() > 0) {
RandGen randGen;
diff --git a/cppcache/src/ThinClientRegion.cpp
b/cppcache/src/ThinClientRegion.cpp
index 6efa02c..b17a54b 100644
--- a/cppcache/src/ThinClientRegion.cpp
+++ b/cppcache/src/ThinClientRegion.cpp
@@ -3469,7 +3469,7 @@ void ChunkedQueryResponse::handleChunk(const uint8_t*
chunk, int32_t chunkLen,
// special case for scalar result
partLen = input->readInt32();
input->read();
- auto intVal = input->readObject<CacheableInt32>(true);
+ auto intVal =
std::static_pointer_cast<CacheableInt32>(input->readObject());
m_queryResults->push_back(intVal);
// TODO:
@@ -3925,7 +3925,8 @@ void ChunkedDurableCQListResponse::handleChunk(const
uint8_t* chunk,
// is one byte
for (int i = 0; i < stringParts; i++) {
- m_resultList->push_back(input->readObject<CacheableString>());
+ m_resultList->push_back(
+ std::static_pointer_cast<CacheableString>(input->readObject()));
}
}
diff --git a/cppcache/src/VersionedCacheableObjectPartList.cpp
b/cppcache/src/VersionedCacheableObjectPartList.cpp
index bf367eb..1b83f6e 100644
--- a/cppcache/src/VersionedCacheableObjectPartList.cpp
+++ b/cppcache/src/VersionedCacheableObjectPartList.cpp
@@ -118,7 +118,7 @@ void VersionedCacheableObjectPartList::fromData(DataInput&
input) {
len = static_cast<int32_t>(input.readUnsignedVL());
for (int32_t index = 0; index < len; ++index) {
- auto key = input.readObject<CacheableKey>(true);
+ auto key = std::static_pointer_cast<CacheableKey>(input.readObject());
if (m_resultKeys != nullptr) {
m_resultKeys->push_back(key);
}
diff --git a/cppcache/test/DataInputTest.cpp b/cppcache/test/DataInputTest.cpp
index 8e4d994..3d3594b 100644
--- a/cppcache/test/DataInputTest.cpp
+++ b/cppcache/test/DataInputTest.cpp
@@ -104,11 +104,6 @@ class TestDataInput {
double readDouble() { return m_dataInput.readDouble(); }
- template <class PTR>
- void readObject(std::shared_ptr<PTR> &ptr, bool throwOnError = false) {
- ptr = m_dataInput.readObject<PTR>(throwOnError);
- }
-
bool readNativeBool() { return m_dataInput.readNativeBool(); }
int32_t readNativeInt32() { return m_dataInput.readNativeInt32(); }
@@ -117,6 +112,10 @@ class TestDataInput {
return m_dataInput.readDirectObject(typeId);
}
+ std::shared_ptr<Serializable> readObject() {
+ return m_dataInput.readObject();
+ }
+
void readObject(std::shared_ptr<Serializable> &ptr) {
m_dataInput.readObject(ptr);
}
@@ -478,8 +477,8 @@ TEST_F(DataInputTest, TestReadUTFNarrow) {
TEST_F(DataInputTest, TestReadObjectSharedPtr) {
TestDataInput dataInput(
"57001B596F7520686164206D65206174206D65617420746F726E61646F2E");
- std::shared_ptr<CacheableString> objptr;
- dataInput.readObject(objptr);
+ auto objptr =
+ std::static_pointer_cast<CacheableString>(dataInput.readObject());
EXPECT_EQ("You had me at meat tornado.", objptr->value())
<< "Correct const char *";
}
diff --git a/tests/cpp/testobject/BatchObject.cpp
b/tests/cpp/testobject/BatchObject.cpp
index 256f4a9..0d1ed28 100644
--- a/tests/cpp/testobject/BatchObject.cpp
+++ b/tests/cpp/testobject/BatchObject.cpp
@@ -44,7 +44,7 @@ void BatchObject::fromData(apache::geode::client::DataInput&
input) {
index = input.readInt32();
timestamp = input.readInt64();
batch = input.readInt32();
- byteArray = input.readObject<CacheableBytes>();
+ byteArray = std::static_pointer_cast<CacheableBytes>(input.readObject());
}
std::string BatchObject::toString() const {
char buf[102500];
diff --git a/tests/cpp/testobject/DeltaFastAssetAccount.cpp
b/tests/cpp/testobject/DeltaFastAssetAccount.cpp
index 9903782..4f59701 100644
--- a/tests/cpp/testobject/DeltaFastAssetAccount.cpp
+++ b/tests/cpp/testobject/DeltaFastAssetAccount.cpp
@@ -54,9 +54,9 @@ void DeltaFastAssetAccount::toData(
void DeltaFastAssetAccount::fromData(apache::geode::client::DataInput& input) {
acctId = input.readInt32();
- customerName = input.readObject<CacheableString>();
+ customerName = std::static_pointer_cast<CacheableString>(input.readObject());
netWorth = input.readDouble();
- assets = input.readObject<CacheableHashMap>();
+ assets = std::static_pointer_cast<CacheableHashMap>(input.readObject());
timestamp = input.readInt64();
}
diff --git a/tests/cpp/testobject/DeltaPSTObject.cpp
b/tests/cpp/testobject/DeltaPSTObject.cpp
index 38bb63c..e4e1562 100644
--- a/tests/cpp/testobject/DeltaPSTObject.cpp
+++ b/tests/cpp/testobject/DeltaPSTObject.cpp
@@ -61,7 +61,7 @@ void
DeltaPSTObject::fromData(apache::geode::client::DataInput& input) {
timestamp = input.readInt64();
field1 = input.readInt32();
field2 = input.read();
- valueData = input.readObject<CacheableBytes>();
+ valueData = std::static_pointer_cast<CacheableBytes>(input.readObject());
}
std::string DeltaPSTObject::toString() const {
char buf[102500];
diff --git a/tests/cpp/testobject/DeltaTestImpl.cpp
b/tests/cpp/testobject/DeltaTestImpl.cpp
index e157e72..c656931 100644
--- a/tests/cpp/testobject/DeltaTestImpl.cpp
+++ b/tests/cpp/testobject/DeltaTestImpl.cpp
@@ -68,10 +68,10 @@ DeltaTestImpl::DeltaTestImpl(const DeltaTestImpl& rhs) :
Delta(nullptr) {
void DeltaTestImpl::fromData(DataInput& input) {
intVar = input.readInt32();
- str = input.readObject<CacheableString>();
+ str = std::static_pointer_cast<CacheableString>(input.readObject());
doubleVar = input.readDouble();
- byteArr = input.readObject<CacheableBytes>();
- testObj = input.readObject<TestObject1>();
+ byteArr = std::static_pointer_cast<CacheableBytes>(input.readObject());
+ testObj = std::static_pointer_cast<TestObject1>(input.readObject());
}
void DeltaTestImpl::toData(DataOutput& output) const {
@@ -117,13 +117,13 @@ void DeltaTestImpl::fromDelta(DataInput& input) {
intVar = input.readInt32();
}
if ((deltaBits & STR_MASK) == STR_MASK) {
- str = input.readObject<CacheableString>();
+ str = std::static_pointer_cast<CacheableString>(input.readObject());
}
if ((deltaBits & DOUBLE_MASK) == DOUBLE_MASK) {
doubleVar = input.readDouble();
}
if ((deltaBits & BYTE_ARR_MASK) == BYTE_ARR_MASK) {
- byteArr = input.readObject<CacheableBytes>();
+ byteArr = std::static_pointer_cast<CacheableBytes>(input.readObject());
/*
uint8_t* bytes;
int32_t len;
@@ -133,7 +133,7 @@ void DeltaTestImpl::fromDelta(DataInput& input) {
*/
}
if ((deltaBits & TEST_OBJ_MASK) == TEST_OBJ_MASK) {
- testObj = input.readObject<TestObject1>();
+ testObj = std::static_pointer_cast<TestObject1>(input.readObject());
}
}
diff --git a/tests/cpp/testobject/FastAssetAccount.cpp
b/tests/cpp/testobject/FastAssetAccount.cpp
index 56e5445..693afa9 100644
--- a/tests/cpp/testobject/FastAssetAccount.cpp
+++ b/tests/cpp/testobject/FastAssetAccount.cpp
@@ -59,9 +59,9 @@ void
FastAssetAccount::toData(apache::geode::client::DataOutput& output) const {
void FastAssetAccount::fromData(apache::geode::client::DataInput& input) {
acctId = input.readInt32();
- customerName = input.readObject<CacheableString>();
+ customerName = std::static_pointer_cast<CacheableString>(input.readObject());
netWorth = input.readDouble();
- assets = input.readObject<CacheableHashMap>();
+ assets = std::static_pointer_cast<CacheableHashMap>(input.readObject());
timestamp = input.readInt64();
}
diff --git a/tests/cpp/testobject/PSTObject.cpp
b/tests/cpp/testobject/PSTObject.cpp
index 6477a00..ffb9a8f 100644
--- a/tests/cpp/testobject/PSTObject.cpp
+++ b/tests/cpp/testobject/PSTObject.cpp
@@ -52,7 +52,7 @@ void PSTObject::fromData(apache::geode::client::DataInput&
input) {
timestamp = input.readInt64();
field1 = input.readInt32();
field2 = input.read();
- valueData = input.readObject<CacheableBytes>();
+ valueData = std::static_pointer_cast<CacheableBytes>(input.readObject());
}
std::string PSTObject::toString() const {
char buf[102500];
diff --git a/tests/cpp/testobject/Portfolio.cpp
b/tests/cpp/testobject/Portfolio.cpp
index 2a50699..6f0c9ce 100644
--- a/tests/cpp/testobject/Portfolio.cpp
+++ b/tests/cpp/testobject/Portfolio.cpp
@@ -78,15 +78,15 @@ void Portfolio::toData(DataOutput& output) const {
void Portfolio::fromData(DataInput& input) {
ID = input.readInt32();
- pkid = input.readObject<CacheableString>();
- position1 = input.readObject<Position>();
- position2 = input.readObject<Position>();
- positions = input.readObject<CacheableHashMap>();
- type = input.readObject<CacheableString>();
+ pkid = std::static_pointer_cast<CacheableString>(input.readObject());
+ position1 = std::static_pointer_cast<Position>(input.readObject());
+ position2 = std::static_pointer_cast<Position>(input.readObject());
+ positions = std::static_pointer_cast<CacheableHashMap>(input.readObject());
+ type = std::static_pointer_cast<CacheableString>(input.readObject());
status = input.readUTF();
- names = input.readObject<CacheableStringArray>();
+ names = std::static_pointer_cast<CacheableStringArray>(input.readObject());
input.readBytes(&newVal, &newValSize);
- creationDate = input.readObject<CacheableDate>();
+ creationDate = std::static_pointer_cast<CacheableDate>(input.readObject());
int tmp = 0;
input.readBytes(&arrayNull, &tmp);
input.readBytes(&arrayZeroSize, &tmp);
diff --git a/tests/cpp/testobject/Position.cpp
b/tests/cpp/testobject/Position.cpp
index 6f4182f..7df8c2c 100644
--- a/tests/cpp/testobject/Position.cpp
+++ b/tests/cpp/testobject/Position.cpp
@@ -97,19 +97,19 @@ void Position::toData(apache::geode::client::DataOutput&
output) const {
void Position::fromData(apache::geode::client::DataInput& input) {
avg20DaysVol = input.readInt64();
- bondRating = input.readObject<CacheableString>();
+ bondRating = std::static_pointer_cast<CacheableString>(input.readObject());
convRatio = input.readDouble();
- country = input.readObject<CacheableString>();
+ country = std::static_pointer_cast<CacheableString>(input.readObject());
delta = input.readDouble();
industry = input.readInt64();
issuer = input.readInt64();
mktValue = input.readDouble();
qty = input.readDouble();
- secId = input.readObject<CacheableString>();
- secLinks = input.readObject<CacheableString>();
+ secId = std::static_pointer_cast<CacheableString>(input.readObject());
+ secLinks = std::static_pointer_cast<CacheableString>(input.readObject());
secType = input.readUTF<wchar_t>();
sharesOutstanding = input.readInt32();
- underlyer = input.readObject<CacheableString>();
+ underlyer = std::static_pointer_cast<CacheableString>(input.readObject());
volatility = input.readInt64();
pid = input.readInt32();
}
diff --git a/tests/cpp/testobject/TestObject1.cpp
b/tests/cpp/testobject/TestObject1.cpp
index 77f5791..bd20902 100644
--- a/tests/cpp/testobject/TestObject1.cpp
+++ b/tests/cpp/testobject/TestObject1.cpp
@@ -60,7 +60,7 @@ void TestObject1::fromData(DataInput& input) {
input.readBytes(&bytes, &len);
arr = CacheableBytes::create(bytes, len);
delete bytes;
- name = input.readObject<CacheableString>();
+ name = std::static_pointer_cast<CacheableString>(input.readObject());
identifier = input.readInt32();
}
diff --git a/tests/cpp/testobject/VariousPdxTypes.cpp
b/tests/cpp/testobject/VariousPdxTypes.cpp
index 841eb17..432423c 100644
--- a/tests/cpp/testobject/VariousPdxTypes.cpp
+++ b/tests/cpp/testobject/VariousPdxTypes.cpp
@@ -894,11 +894,11 @@ void PdxInsideIGeodeSerializable::toData(DataOutput
&output) const {
void PdxInsideIGeodeSerializable::fromData(DataInput &input) {
m_i1 = input.readInt32();
- m_npdx = input.readObject<NestedPdx>();
+ m_npdx = std::static_pointer_cast<NestedPdx>(input.readObject());
m_i2 = input.readInt32();
m_s1 = input.readString();
m_s2 = input.readString();
- m_pdx3 = input.readObject<PdxTypes3>();
+ m_pdx3 = std::static_pointer_cast<PdxTypes3>(input.readObject());
m_i3 = input.readInt32();
m_i4 = input.readInt32();
}
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].