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 95303fc GEODE-3993: Remove poolName from DataInput/Output (#261)
95303fc is described below
commit 95303fca05ec88a3d83f40dc21735d73f5e67717
Author: M. Oleske <[email protected]>
AuthorDate: Fri Apr 6 23:43:19 2018 -0700
GEODE-3993: Remove poolName from DataInput/Output (#261)
* Remove default parameter from DataInput/DataOutput ctors
* Removes default constructor from DataOutput.
* Replace poolname with pool.
* Replaced iPUF with ignorePdxUnreadFields.
---
clicache/src/DataInput.cpp | 4 +-
clicache/src/DataInput.hpp | 2 +-
clicache/src/DataOutput.cpp | 4 +-
clicache/src/DataOutput.hpp | 2 +-
clicache/src/Serializable.cpp | 13 +++--
clicache/src/Serializable.hpp | 4 +-
clicache/src/impl/PdxHelper.cpp | 12 ++--
clicache/src/impl/PdxTypeRegistry.cpp | 8 +--
clicache/src/impl/PdxTypeRegistry.hpp | 4 +-
cppcache/include/geode/CacheableBuiltins.hpp | 15 +++--
cppcache/include/geode/DataInput.hpp | 46 ++++++----------
cppcache/include/geode/DataOutput.hpp | 37 +++++--------
cppcache/include/geode/ExceptionTypes.hpp | 6 +-
cppcache/include/geode/PdxWrapper.hpp | 1 -
cppcache/include/geode/Serializer.hpp | 10 ++--
cppcache/integration-test/testSerialization.cpp | 2 +-
cppcache/src/Cache.cpp | 9 ++-
cppcache/src/CacheImpl.cpp | 64 +++++++++++++++-------
cppcache/src/CacheImpl.hpp | 21 ++++---
cppcache/src/CacheableEnum.cpp | 2 +-
cppcache/src/CacheableObjectArray.cpp | 2 +-
cppcache/src/CacheableObjectPartList.cpp | 2 +-
cppcache/src/ClientProxyMembershipID.cpp | 4 +-
cppcache/src/CqService.hpp | 7 ++-
cppcache/src/DataInput.cpp | 9 +++
cppcache/src/DataInputInternal.hpp | 17 ++----
cppcache/src/DataOutput.cpp | 7 +--
cppcache/src/DataOutputInternal.hpp | 20 +++----
cppcache/src/EventId.cpp | 4 +-
cppcache/src/ExpMapEntry.hpp | 4 +-
cppcache/src/FarSideEntryOp.cpp | 6 +-
cppcache/src/LRUEntriesMap.hpp | 4 +-
cppcache/src/LRUExpMapEntry.hpp | 6 +-
cppcache/src/LRUMapEntry.hpp | 4 +-
cppcache/src/MapEntry.hpp | 2 +-
cppcache/src/PdxHelper.cpp | 22 +++-----
cppcache/src/PdxType.cpp | 2 +-
cppcache/src/PdxTypeRegistry.cpp | 11 ++--
cppcache/src/PdxTypeRegistry.hpp | 5 +-
cppcache/src/PoolManagerImpl.cpp | 2 +-
cppcache/src/PreservedDataExpiryHandler.hpp | 3 +-
cppcache/src/Properties.cpp | 2 +-
.../src/PutAllPartialResultServerException.hpp | 3 +-
cppcache/src/RegionAttributes.cpp | 2 +-
cppcache/src/SerializationRegistry.cpp | 34 +++++++-----
cppcache/src/SerializationRegistry.hpp | 8 ++-
cppcache/src/Struct.cpp | 6 +-
cppcache/src/TXCommitMessage.cpp | 4 +-
cppcache/src/TcrMessage.cpp | 34 ++++++------
cppcache/src/TcrMessage.hpp | 2 +-
cppcache/src/ThinClientRegion.cpp | 58 ++++++++++----------
cppcache/src/VersionedCacheableObjectPartList.cpp | 4 +-
cppcache/src/statistics/HostStatSampler.hpp | 4 +-
cppcache/src/statistics/StatArchiveWriter.hpp | 6 +-
cppcache/src/util/exception.hpp | 2 +-
cppcache/test/DataInputTest.cpp | 17 +-----
cppcache/test/TcrMessage_unittest.cpp | 3 +-
tests/cli/QueryHelper/CMakeLists.txt | 1 +
tests/cli/QueryHelper/QueryStringsM.cpp | 8 +--
59 files changed, 295 insertions(+), 312 deletions(-)
diff --git a/clicache/src/DataInput.cpp b/clicache/src/DataInput.cpp
index 0fedeec..58184cd 100644
--- a/clicache/src/DataInput.cpp
+++ b/clicache/src/DataInput.cpp
@@ -1164,11 +1164,11 @@ namespace Apache
}
}
- String^ DataInput::GetPoolName()
+ native::Pool* DataInput::GetPool()
{
try
{
- return
marshal_as<String^>(native::DataInputInternal::getPoolName(*m_nativeptr));
+ return native::DataInputInternal::getPool(*m_nativeptr);
}
finally {
GC::KeepAlive(m_nativeptr);
diff --git a/clicache/src/DataInput.hpp b/clicache/src/DataInput.hpp
index 0d8eeb1..1b3d8df 100644
--- a/clicache/src/DataInput.hpp
+++ b/clicache/src/DataInput.hpp
@@ -308,7 +308,7 @@ namespace Apache
/// </summary>
String^ ReadASCIIHuge( );
- String^ GetPoolName();
+ native::Pool* GetPool();
Object^ ReadDotNetTypes(int8_t typeId);
diff --git a/clicache/src/DataOutput.cpp b/clicache/src/DataOutput.cpp
index 9724f61..d4041a5 100644
--- a/clicache/src/DataOutput.cpp
+++ b/clicache/src/DataOutput.cpp
@@ -936,11 +936,11 @@ namespace Apache
WriteObject<double>(doubleArray);
}
- String^ DataOutput::GetPoolName()
+ native::Pool* DataOutput::GetPool()
{
try
{
- return
marshal_as<String^>(native::DataOutputInternal::getPoolName(*m_nativeptr));
+ return native::DataOutputInternal::getPool(*m_nativeptr);
}
finally
{
diff --git a/clicache/src/DataOutput.hpp b/clicache/src/DataOutput.hpp
index 895b51b..4c13ea7 100644
--- a/clicache/src/DataOutput.hpp
+++ b/clicache/src/DataOutput.hpp
@@ -403,7 +403,7 @@ namespace Apache
return m_cursor;
}
- String^ GetPoolName();
+ native::Pool* GetPool();
void WriteStringArray(array<String^>^ strArray);
diff --git a/clicache/src/Serializable.cpp b/clicache/src/Serializable.cpp
index 9a032ec..3305b1c 100644
--- a/clicache/src/Serializable.cpp
+++ b/clicache/src/Serializable.cpp
@@ -248,16 +248,19 @@ namespace Apache
return
(Apache::Geode::Client::Serializable^)CacheableStringArray::Create(value);
}
- System::Int32 Serializable::GetPDXIdForType(String^ poolName,
IGeodeSerializable^ pdxType, Cache^ cache)
+ System::Int32 Serializable::GetPDXIdForType(native::Pool* pool,
IGeodeSerializable^ pdxType, Cache^ cache)
{
std::shared_ptr<native::Cacheable>
kPtr(SafeMSerializableConvertGeneric(pdxType));
- return
CacheRegionHelper::getCacheImpl(cache->GetNative().get())->getSerializationRegistry()->GetPDXIdForType(cache->GetNative()->getPoolManager().find(marshal_as<std::string>(poolName)),
kPtr);
+ return CacheRegionHelper::getCacheImpl(cache->GetNative().get())
+ ->getSerializationRegistry()
+ ->GetPDXIdForType(pool, kPtr);
}
- IGeodeSerializable^ Serializable::GetPDXTypeById(String^ poolName,
System::Int32 typeId, Cache^ cache)
+ IGeodeSerializable^ Serializable::GetPDXTypeById(native::Pool* pool,
System::Int32 typeId, Cache^ cache)
{
- std::shared_ptr<apache::geode::client::Serializable> sPtr =
-
CacheRegionHelper::getCacheImpl(cache->GetNative().get())->getSerializationRegistry()->GetPDXTypeById(cache->GetNative()->getPoolManager().find(marshal_as<std::string>(poolName)),
typeId);
+ auto sPtr = CacheRegionHelper::getCacheImpl(cache->GetNative().get())
+ ->getSerializationRegistry()
+ ->GetPDXTypeById(pool, typeId);
return SafeUMSerializableConvertGeneric(sPtr);
}
diff --git a/clicache/src/Serializable.hpp b/clicache/src/Serializable.hpp
index 39f808a..5d31596 100644
--- a/clicache/src/Serializable.hpp
+++ b/clicache/src/Serializable.hpp
@@ -249,8 +249,8 @@ namespace Apache
internal:
static std::shared_ptr<CacheableKey>
wrapIGeodeSerializable(IGeodeSerializable^ managedObject);
- static System::Int32 GetPDXIdForType(String^
poolName, IGeodeSerializable^ pdxType, Cache^ cache);
- static IGeodeSerializable^
GetPDXTypeById(String^ poolName, System::Int32 typeId, Cache^ cache);
+ static System::Int32
GetPDXIdForType(native::Pool* pool, IGeodeSerializable^ pdxType, Cache^ cache);
+ static IGeodeSerializable^
GetPDXTypeById(native::Pool* pool, System::Int32 typeId, Cache^ cache);
static void
RegisterPDXManagedCacheableKey(Cache^ cache);
static int GetEnumValue(Internal::EnumInfo^ ei, Cache^ cache);
diff --git a/clicache/src/impl/PdxHelper.cpp b/clicache/src/impl/PdxHelper.cpp
index 2da7a4b..7dee159 100644
--- a/clicache/src/impl/PdxHelper.cpp
+++ b/clicache/src/impl/PdxHelper.cpp
@@ -73,7 +73,7 @@ namespace Apache
PdxType^ piPt = pdxII->getPdxType();
if(piPt != nullptr && piPt->TypeId == 0)//from pdxInstance
factory need to get typeid from server
{
- int typeId =
dataOutput->Cache->GetPdxTypeRegistry()->GetPDXIdForType(piPt,
dataOutput->GetPoolName());
+ int typeId =
dataOutput->Cache->GetPdxTypeRegistry()->GetPDXIdForType(piPt,
dataOutput->GetPool());
pdxII->setPdxId(typeId);
}
PdxLocalWriter^ plw = gcnew PdxLocalWriter(dataOutput, piPt);
@@ -108,7 +108,7 @@ namespace Apache
//get type id from server and
then set it
int nTypeId =
dataOutput->Cache->GetPdxTypeRegistry()->GetPDXIdForType(pdxType,
-
dataOutput->GetPoolName(), nType, true);
+
dataOutput->GetPool(), nType, true);
nType->TypeId = nTypeId;
ptc->EndObjectWriting();//now write typeid
@@ -200,7 +200,7 @@ namespace Apache
{
if(pType == nullptr)
{
- pType =
(PdxType^)(Serializable::GetPDXTypeById(dataInput->GetPoolName(), typeId,
dataInput->Cache));
+ pType =
(PdxType^)(Serializable::GetPDXTypeById(dataInput->GetPool(), typeId,
dataInput->Cache));
pdxLocalType =
dataInput->Cache->GetPdxTypeRegistry()->GetLocalPdxType(pType->PdxClassName);//this
should be fine for IPdxTypeMappers
}
@@ -245,7 +245,7 @@ namespace Apache
//need to know local type and then merge type
pdxLocalType->InitializeType(dataInput->Cache);
pdxLocalType->TypeId =
dataInput->Cache->GetPdxTypeRegistry()->GetPDXIdForType(pdxObject->GetType(),
-
dataInput->GetPoolName(),
+
dataInput->GetPool(),
pdxLocalType, true);
pdxLocalType->IsLocal = true;
dataInput->Cache->GetPdxTypeRegistry()->AddLocalPdxType(pdxClassname,
pdxLocalType);//added local type
@@ -323,7 +323,7 @@ namespace Apache
if(pType == nullptr)
{
- PdxType^ pType =
(PdxType^)(Serializable::GetPDXTypeById(dataInput->GetPoolName(), typeId,
dataInput->Cache));
+ PdxType^ pType =
(PdxType^)(Serializable::GetPDXTypeById(dataInput->GetPool(), typeId,
dataInput->Cache));
//this should be fine for IPdxTypeMapper
dataInput->Cache->GetPdxTypeRegistry()->AddLocalPdxType(pType->PdxClassName,
pType);
dataInput->Cache->GetPdxTypeRegistry()->AddPdxType(pType->TypeId, pType);
@@ -379,7 +379,7 @@ namespace Apache
{//need to create new version
mergedVersion->InitializeType(dataInput->Cache);
if(mergedVersion->TypeId == 0)
- mergedVersion->TypeId =
Serializable::GetPDXIdForType(dataInput->GetPoolName(), mergedVersion,
dataInput->Cache);
+ mergedVersion->TypeId =
Serializable::GetPDXIdForType(dataInput->GetPool(), mergedVersion,
dataInput->Cache);
//
dataInput->Cache->GetPdxTypeRegistry()->AddPdxType(remoteType->TypeId,
mergedVersion);
dataInput->Cache->GetPdxTypeRegistry()->AddPdxType(mergedVersion->TypeId,
mergedVersion);
diff --git a/clicache/src/impl/PdxTypeRegistry.cpp
b/clicache/src/impl/PdxTypeRegistry.cpp
index 0763f3a..f5dc948 100644
--- a/clicache/src/impl/PdxTypeRegistry.cpp
+++ b/clicache/src/impl/PdxTypeRegistry.cpp
@@ -48,7 +48,7 @@ namespace Apache
return preserveData->Count;
}
- Int32 PdxTypeRegistry::GetPDXIdForType(Type^ pdxType, String^
poolname, PdxType^ nType, bool checkIfThere)
+ Int32 PdxTypeRegistry::GetPDXIdForType(Type^ pdxType, native::Pool*
pool, PdxType^ nType, bool checkIfThere)
{
if(checkIfThere)
{
@@ -70,7 +70,7 @@ namespace Apache
return lpdx->TypeId;
}
}
- return Serializable::GetPDXIdForType(poolname, nType, m_cache);
+ return Serializable::GetPDXIdForType(pool, nType, m_cache);
}
finally
{
@@ -79,7 +79,7 @@ namespace Apache
}
- Int32 PdxTypeRegistry::GetPDXIdForType(PdxType^ pType, String^
poolname)
+ Int32 PdxTypeRegistry::GetPDXIdForType(PdxType^ pType, native::Pool*
pool)
{
IDictionary<PdxType^, Int32>^ tmp = pdxTypeToTypeId;
Int32 typeId = 0;
@@ -100,7 +100,7 @@ namespace Apache
return typeId;
}
- typeId = Serializable::GetPDXIdForType(poolname, pType, m_cache);
+ typeId = Serializable::GetPDXIdForType(pool, pType, m_cache);
pType->TypeId = typeId;
IDictionary<PdxType^, Int32>^ newDict = gcnew Dictionary<PdxType^,
Int32>(pdxTypeToTypeId);
diff --git a/clicache/src/impl/PdxTypeRegistry.hpp
b/clicache/src/impl/PdxTypeRegistry.hpp
index 7c3846c..4405c60 100644
--- a/clicache/src/impl/PdxTypeRegistry.hpp
+++ b/clicache/src/impl/PdxTypeRegistry.hpp
@@ -68,9 +68,9 @@ namespace Apache
void clear();
- Int32 GetPDXIdForType(Type^ type, String^ poolname, PdxType^
nType, bool checkIfThere);
+ Int32 GetPDXIdForType(Type^ type, native::Pool* pool, PdxType^
nType, bool checkIfThere);
- Int32 GetPDXIdForType(PdxType^ type, String^ poolname);
+ Int32 GetPDXIdForType(PdxType^ type, native::Pool*);
Int32 GetEnumValue(EnumInfo^ ei);
diff --git a/cppcache/include/geode/CacheableBuiltins.hpp
b/cppcache/include/geode/CacheableBuiltins.hpp
index cfbf118..11beafe 100644
--- a/cppcache/include/geode/CacheableBuiltins.hpp
+++ b/cppcache/include/geode/CacheableBuiltins.hpp
@@ -140,7 +140,8 @@ inline void copyArray(std::shared_ptr<TObj>* dest,
/** Template class for container Cacheable types. */
template <typename TBase, int8_t TYPEID>
-class APACHE_GEODE_EXPORT CacheableContainerType : public Cacheable, public
TBase {
+class APACHE_GEODE_EXPORT CacheableContainerType : public Cacheable,
+ public TBase {
protected:
inline CacheableContainerType() : TBase() {}
@@ -193,10 +194,9 @@ class APACHE_GEODE_EXPORT CacheableContainerType : public
Cacheable, public TBas
#pragma warning(disable : 4231)
#endif
-#define _GEODE_CACHEABLE_KEY_TYPE_DEF_(p, k) \
- extern const char tName_##k[]; \
- template class \
- CacheableKeyType<p, GeodeTypeIds::k, tName_##k>; \
+#define _GEODE_CACHEABLE_KEY_TYPE_DEF_(p, k) \
+ extern const char tName_##k[]; \
+ template class CacheableKeyType<p, GeodeTypeIds::k, tName_##k>; \
typedef CacheableKeyType<p, GeodeTypeIds::k, tName_##k> _##k;
// use a class instead of typedef for bug #283
@@ -230,9 +230,8 @@ class APACHE_GEODE_EXPORT CacheableContainerType : public
Cacheable, public TBas
return k::create(value); \
}
-#define _GEODE_CACHEABLE_CONTAINER_TYPE_DEF_(p, c) \
- template class \
- CacheableContainerType<p, GeodeTypeIds::c>; \
+#define _GEODE_CACHEABLE_CONTAINER_TYPE_DEF_(p, c) \
+ template class CacheableContainerType<p, GeodeTypeIds::c>; \
typedef CacheableContainerType<p, GeodeTypeIds::c> _##c;
// use a class instead of typedef for bug #283
diff --git a/cppcache/include/geode/DataInput.hpp
b/cppcache/include/geode/DataInput.hpp
index 76032cd..1b0f4ad 100644
--- a/cppcache/include/geode/DataInput.hpp
+++ b/cppcache/include/geode/DataInput.hpp
@@ -46,9 +46,9 @@ class CacheableString;
class DataInput;
class Serializable;
class SerializationRegistry;
-class DataInputInternal;
class CacheImpl;
class DataInputInternal;
+class Pool;
/**
* Provide operations for reading primitive data values, byte arrays,
@@ -126,7 +126,7 @@ class APACHE_GEODE_EXPORT DataInput {
* @param len output parameter to hold the length of array read from stream
*/
inline void readBytes(uint8_t** bytes, int32_t* len) {
- int32_t length = readArrayLen();
+ auto length = readArrayLength();
*len = length;
uint8_t* buffer = nullptr;
if (length > 0) {
@@ -149,7 +149,7 @@ class APACHE_GEODE_EXPORT DataInput {
* @param len output parameter to hold the length of array read from stream
*/
inline void readBytes(int8_t** bytes, int32_t* len) {
- int32_t length = readArrayLen();
+ auto length = readArrayLength();
*len = length;
int8_t* buffer = nullptr;
if (length > 0) {
@@ -228,7 +228,7 @@ class APACHE_GEODE_EXPORT DataInput {
* @param len output parameter to hold the 32-bit signed length
* read from stream
*/
- inline int32_t readArrayLen() {
+ inline int32_t readArrayLength() {
const uint8_t code = read();
if (code == 0xFF) {
return -1;
@@ -333,7 +333,6 @@ class APACHE_GEODE_EXPORT DataInput {
inline bool readNativeBool() {
read(); // ignore type id
-
return readBoolean();
}
@@ -398,7 +397,7 @@ class APACHE_GEODE_EXPORT DataInput {
inline std::vector<std::string> readStringArray() {
std::vector<std::string> value;
- int32_t arrLen = readArrayLen();
+ auto arrLen = readArrayLength();
if (arrLen > 0) {
value.reserve(arrLen);
for (int i = 0; i < arrLen; i++) {
@@ -412,7 +411,7 @@ class APACHE_GEODE_EXPORT DataInput {
inline void readArrayOfByteArrays(int8_t*** arrayofBytearr,
int32_t& arrayLength,
int32_t** elementLength) {
- int32_t arrLen = readArrayLen();
+ auto arrLen = readArrayLength();
arrayLength = arrLen;
if (arrLen == -1) {
@@ -431,9 +430,6 @@ class APACHE_GEODE_EXPORT DataInput {
}
}
- /** destructor */
- ~DataInput() {}
-
/**
* Get the pointer to current buffer position. This should be treated
* as readonly and modification of contents using this internal pointer
@@ -487,14 +483,15 @@ class APACHE_GEODE_EXPORT DataInput {
virtual const Cache* getCache();
+ ~DataInput() = default;
+ DataInput() = delete;
+ DataInput(const DataInput&) = delete;
+ DataInput& operator=(const DataInput&) = delete;
+
protected:
/** constructor given a pre-allocated byte array with size */
- DataInput(const uint8_t* m_buffer, size_t len, const CacheImpl* cache)
- : m_buf(m_buffer),
- m_bufHead(m_buffer),
- m_bufLength(len),
- m_poolName(EMPTY_STRING),
- m_cache(cache) {}
+ DataInput(const uint8_t* m_buffer, size_t len, const CacheImpl* cache,
+ Pool* pool);
virtual const SerializationRegistry& getSerializationRegistry() const;
@@ -502,14 +499,14 @@ class APACHE_GEODE_EXPORT DataInput {
const uint8_t* m_buf;
const uint8_t* m_bufHead;
size_t m_bufLength;
- std::reference_wrapper<const std::string> m_poolName;
+ Pool* m_pool;
const CacheImpl* m_cache;
std::shared_ptr<Serializable> readObjectInternal(int8_t typeId = -1);
template <typename mType>
void readObject(mType** value, int32_t& length) {
- int arrayLen = readArrayLen();
+ auto arrayLen = readArrayLength();
length = arrayLen;
mType* objArray;
if (arrayLen > 0) {
@@ -526,7 +523,7 @@ class APACHE_GEODE_EXPORT DataInput {
template <typename T>
std::vector<T> readArray() {
- int arrayLen = readArrayLen();
+ auto arrayLen = readArrayLength();
std::vector<T> objArray;
if (arrayLen >= 0) {
objArray.reserve(arrayLen);
@@ -645,16 +642,7 @@ class APACHE_GEODE_EXPORT DataInput {
value.assign(reinterpret_cast<const wchar_t*>(tmp.data()), tmp.length());
}
- const std::string& getPoolName() const { return m_poolName; }
-
- void setPoolName(const std::string& poolName) {
- m_poolName = std::ref(poolName);
- }
-
- // disable other constructors and assignment
- DataInput() = delete;
- DataInput(const DataInput&) = delete;
- DataInput& operator=(const DataInput&) = delete;
+ Pool* getPool() const { return m_pool; }
friend Cache;
friend CacheImpl;
diff --git a/cppcache/include/geode/DataOutput.hpp
b/cppcache/include/geode/DataOutput.hpp
index 78043ce..2f162e7 100644
--- a/cppcache/include/geode/DataOutput.hpp
+++ b/cppcache/include/geode/DataOutput.hpp
@@ -30,16 +30,14 @@
#include "Serializable.hpp"
#include "CacheableString.hpp"
-/**
- * @file
- */
-
namespace apache {
namespace geode {
namespace client {
+
class SerializationRegistry;
class DataOutputInternal;
class CacheImpl;
+class Pool;
/**
* Provide operations for writing primitive data values, byte arrays,
@@ -393,11 +391,6 @@ class APACHE_GEODE_EXPORT DataOutput {
}
uint8_t getValueAtPos(size_t offset) { return m_bytes[offset]; }
- /** Destruct a DataOutput, including releasing the created buffer. */
- ~DataOutput() {
- reset();
- DataOutput::checkinBuffer(m_bytes, m_size);
- }
/**
* Get a pointer to the internal buffer of <code>DataOutput</code>.
@@ -499,13 +492,21 @@ class APACHE_GEODE_EXPORT DataOutput {
virtual const Cache* getCache();
+ /** Destruct a DataOutput, including releasing the created buffer. */
+ ~DataOutput() {
+ reset();
+ DataOutput::checkinBuffer(m_bytes, m_size);
+ }
+
+ DataOutput() = delete;
+ DataOutput(const DataOutput&) = delete;
+ DataOutput& operator=(const DataOutput&) = delete;
+
protected:
/**
* Construct a new DataOutput.
*/
- DataOutput(const CacheImpl* cache);
-
- DataOutput() : DataOutput(nullptr) {}
+ DataOutput(const CacheImpl* cache, Pool* pool);
virtual const SerializationRegistry& getSerializationRegistry() const;
@@ -527,7 +528,7 @@ class APACHE_GEODE_EXPORT DataOutput {
// flag to indicate we have a big buffer
volatile bool m_haveBigBuffer;
const CacheImpl* m_cache;
- std::reference_wrapper<const std::string> m_poolName;
+ Pool* m_pool;
inline void writeAscii(const std::string& value) {
uint16_t len = static_cast<uint16_t>(
@@ -740,19 +741,11 @@ class APACHE_GEODE_EXPORT DataOutput {
writeNoCheck(static_cast<uint8_t>(value));
}
- const std::string& getPoolName() const { return m_poolName; }
-
- void setPoolName(const std::string& poolName) {
- m_poolName = std::ref(poolName);
- }
+ Pool* getPool() const { return m_pool; }
static uint8_t* checkoutBuffer(size_t* size);
static void checkinBuffer(uint8_t* buffer, size_t size);
- // disable copy constructor and assignment
- DataOutput(const DataOutput&);
- DataOutput& operator=(const DataOutput&);
-
friend Cache;
friend CacheImpl;
friend DataOutputInternal;
diff --git a/cppcache/include/geode/ExceptionTypes.hpp
b/cppcache/include/geode/ExceptionTypes.hpp
index fc8c55a..6cff9ed 100644
--- a/cppcache/include/geode/ExceptionTypes.hpp
+++ b/cppcache/include/geode/ExceptionTypes.hpp
@@ -776,7 +776,8 @@ class APACHE_GEODE_EXPORT CommitConflictException : public
Exception {
* being modified by the transaction.
* This can be thrown while doing transactional operations or during commit.
**/
-class APACHE_GEODE_EXPORT TransactionDataNodeHasDepartedException : public
Exception {
+class APACHE_GEODE_EXPORT TransactionDataNodeHasDepartedException
+ : public Exception {
public:
using Exception::Exception;
virtual ~TransactionDataNodeHasDepartedException() noexcept {}
@@ -789,7 +790,8 @@ class APACHE_GEODE_EXPORT
TransactionDataNodeHasDepartedException : public Excep
*transaction.
* This can be thrown while doing transactional operations or during commit.
**/
-class APACHE_GEODE_EXPORT TransactionDataRebalancedException : public
Exception {
+class APACHE_GEODE_EXPORT TransactionDataRebalancedException
+ : public Exception {
public:
using Exception::Exception;
virtual ~TransactionDataRebalancedException() noexcept {}
diff --git a/cppcache/include/geode/PdxWrapper.hpp
b/cppcache/include/geode/PdxWrapper.hpp
index 341fe75..ec76ec1 100644
--- a/cppcache/include/geode/PdxWrapper.hpp
+++ b/cppcache/include/geode/PdxWrapper.hpp
@@ -44,7 +44,6 @@ class PdxWriter;
* a PdxSerializer registered that can handle the user domain class.
*/
class APACHE_GEODE_EXPORT PdxWrapper : public PdxSerializable {
-
public:
/**
* Constructor which takes the address of the user object to contain for PDX
diff --git a/cppcache/include/geode/Serializer.hpp
b/cppcache/include/geode/Serializer.hpp
index dc8f560..a717072 100644
--- a/cppcache/include/geode/Serializer.hpp
+++ b/cppcache/include/geode/Serializer.hpp
@@ -233,7 +233,7 @@ template <typename TObj>
inline std::vector<TObj> readArrayObject(
apache::geode::client::DataInput& input) {
std::vector<TObj> array;
- int len = input.readArrayLen();
+ int len = input.readArrayLength();
if (len >= 0) {
array.resize(len);
for (auto&& obj : array) {
@@ -246,7 +246,7 @@ inline std::vector<TObj> readArrayObject(
template <typename TObj, typename TLen>
inline void readObject(apache::geode::client::DataInput& input, TObj*& array,
TLen& len) {
- len = input.readArrayLen();
+ len = input.readArrayLength();
if (len > 0) {
_GEODE_NEW(array, TObj[len]);
TObj* startArray = array;
@@ -326,7 +326,7 @@ inline size_t objectSize(const
std::vector<std::shared_ptr<Cacheable>>& value) {
template <typename TObj, typename _tail>
inline void readObject(apache::geode::client::DataInput& input,
std::vector<TObj, _tail>& value) {
- int32_t len = input.readArrayLen();
+ int32_t len = input.readArrayLength();
if (len >= 0) {
TObj obj;
for (int32_t index = 0; index < len; index++) {
@@ -366,7 +366,7 @@ template <typename TKey, typename TValue, typename Hash,
typename KeyEqual,
inline void readObject(
apache::geode::client::DataInput& input,
std::unordered_map<TKey, TValue, Hash, KeyEqual, Allocator>& value) {
- int32_t len = input.readArrayLen();
+ int32_t len = input.readArrayLength();
value.reserve(len);
TKey key;
TValue val;
@@ -401,7 +401,7 @@ template <typename TKey, typename Hash, typename KeyEqual,
typename Allocator>
inline void readObject(
apache::geode::client::DataInput& input,
std::unordered_set<TKey, Hash, KeyEqual, Allocator>& value) {
- int32_t len = input.readArrayLen();
+ int32_t len = input.readArrayLength();
if (len > 0) {
TKey key;
for (int32_t index = 0; index < len; index++) {
diff --git a/cppcache/integration-test/testSerialization.cpp
b/cppcache/integration-test/testSerialization.cpp
index 4c6ccb1..2c06d2e 100644
--- a/cppcache/integration-test/testSerialization.cpp
+++ b/cppcache/integration-test/testSerialization.cpp
@@ -86,7 +86,7 @@ class OtherType : public Serializable {
size_t objectSize() const override { return sizeof(CData); }
void fromData(DataInput& input) override {
- int32_t size = input.readArrayLen();
+ int32_t size = input.readArrayLength();
input.readBytesOnly(reinterpret_cast<uint8_t*>(&m_struct), size);
m_classIdToReturn = input.readInt32();
}
diff --git a/cppcache/src/Cache.cpp b/cppcache/src/Cache.cpp
index 681645e..56e5baf 100644
--- a/cppcache/src/Cache.cpp
+++ b/cppcache/src/Cache.cpp
@@ -139,8 +139,8 @@ Cache::Cache(std::shared_ptr<Properties> dsProp, bool
ignorePdxUnreadFields,
const std::shared_ptr<AuthInitialize>& authInitialize) {
auto distributedSystem = DistributedSystem::create(DEFAULT_DS_NAME, dsProp);
m_cacheImpl = std::unique_ptr<CacheImpl>(
- new CacheImpl(this, std::move(distributedSystem),
- ignorePdxUnreadFields, readPdxSerialized, authInitialize));
+ new CacheImpl(this, std::move(distributedSystem), ignorePdxUnreadFields,
+ readPdxSerialized, authInitialize));
m_cacheImpl->getDistributedSystem().connect(this);
m_typeRegistry =
std::unique_ptr<TypeRegistry>(new TypeRegistry(m_cacheImpl.get()));
@@ -239,12 +239,11 @@ PoolManager& Cache::getPoolManager() const {
std::unique_ptr<DataInput> Cache::createDataInput(const uint8_t* m_buffer,
size_t len) const {
- return std::unique_ptr<DataInput>(
- new DataInput(m_buffer, len, m_cacheImpl.get()));
+ return m_cacheImpl->createDataInput(m_buffer, len);
}
std::unique_ptr<DataOutput> Cache::createDataOutput() const {
- return std::unique_ptr<DataOutput>(new DataOutput(m_cacheImpl.get()));
+ return m_cacheImpl->createDataOutput();
}
} // namespace client
diff --git a/cppcache/src/CacheImpl.cpp b/cppcache/src/CacheImpl.cpp
index 5ae9963..b475ba3 100644
--- a/cppcache/src/CacheImpl.cpp
+++ b/cppcache/src/CacheImpl.cpp
@@ -45,11 +45,10 @@
using namespace apache::geode::client;
-CacheImpl::CacheImpl(Cache* c, DistributedSystem&& distributedSystem, bool
iPUF,
- bool readPdxSerialized,
+CacheImpl::CacheImpl(Cache* c, DistributedSystem&& distributedSystem,
+ bool ignorePdxUnreadFields, bool readPdxSerialized,
const std::shared_ptr<AuthInitialize>& authInitialize)
- : m_defaultPool(nullptr),
- m_ignorePdxUnreadFields(iPUF),
+ : m_ignorePdxUnreadFields(ignorePdxUnreadFields),
m_readPdxSerialized(readPdxSerialized),
m_expiryTaskManager(
std::unique_ptr<ExpiryTaskManager>(new ExpiryTaskManager())),
@@ -96,7 +95,7 @@ void CacheImpl::initServices() {
m_tcrConnectionManager = new TcrConnectionManager(this);
if (!m_initDone && m_attributes != nullptr &&
!m_attributes->getEndpoints().empty()) {
- if (getCache()->getPoolManager().getAll().size() > 0 && getCacheMode()) {
+ if (getPoolManager().getAll().size() > 0 && getCacheMode()) {
LOGWARN(
"At least one pool has been created so ignoring cache level "
"redundancy setting");
@@ -115,7 +114,7 @@ void CacheImpl::initServices() {
void CacheImpl::netDown() {
m_tcrConnectionManager->netDown();
- for (const auto& itr : getCache()->getPoolManager().getAll()) {
+ for (const auto& itr : getPoolManager().getAll()) {
auto currPool = itr.second;
if (auto poolHADM =
std::dynamic_pointer_cast<ThinClientPoolHADM>(currPool)) {
@@ -147,8 +146,7 @@ CacheImpl::RegionKind CacheImpl::getRegionKind(
regionKind = THINCLIENT_REGION;
}
} else if (!regionAttributes.getPoolName().empty()) {
- auto pPtr =
- getCache()->getPoolManager().find(regionAttributes.getPoolName());
+ auto pPtr = getPoolManager().find(regionAttributes.getPoolName());
if ((pPtr != nullptr && (pPtr->getSubscriptionRedundancy() > 0 ||
pPtr->getSubscriptionEnabled())) ||
m_tcrConnectionManager->isDurable()) {
@@ -173,11 +171,11 @@ int CacheImpl::removeRegion(const char* name) {
}
std::shared_ptr<QueryService> CacheImpl::getQueryService(bool noInit) {
- if (m_defaultPool != nullptr) {
- if (m_defaultPool->isDestroyed()) {
+ if (auto&& defaultPool = getPoolManager().getDefaultPool()) {
+ if (defaultPool->isDestroyed()) {
throw IllegalStateException("Pool has been destroyed.");
}
- return m_defaultPool->getQueryService();
+ return defaultPool->getQueryService();
}
if (m_remoteQueryServicePtr == nullptr) {
@@ -194,7 +192,7 @@ std::shared_ptr<QueryService>
CacheImpl::getQueryService(const char* poolName) {
if (poolName == nullptr || strlen(poolName) == 0) {
throw IllegalArgumentException("PoolName is nullptr or not defined..");
}
- auto pool = getCache()->getPoolManager().find(poolName);
+ auto pool = getPoolManager().find(poolName);
if (pool != nullptr) {
if (pool->isDestroyed()) {
@@ -222,9 +220,9 @@ const std::string& CacheImpl::getName() const {
bool CacheImpl::isClosed() const { return m_closed; }
-void CacheImpl::setAttributes(const std::shared_ptr<CacheAttributes>& attrs) {
- if (m_attributes == nullptr && attrs != nullptr) {
- m_attributes = attrs;
+void CacheImpl::setAttributes(const std::shared_ptr<CacheAttributes>&
attributes) {
+ if (m_attributes == nullptr && attributes != nullptr) {
+ m_attributes = attributes;
}
}
@@ -427,7 +425,7 @@ void CacheImpl::createRegion(std::string name,
if (!props.isGridClient()) {
const auto& poolName = regionAttributes.getPoolName();
if (!poolName.empty()) {
- auto pool = getCache()->getPoolManager().find(poolName);
+ auto pool = getPoolManager().find(poolName);
if (pool != nullptr && !pool->isDestroyed() &&
pool->getPRSingleHopEnabled()) {
ThinClientPoolDM* poolDM =
@@ -512,7 +510,7 @@ std::shared_ptr<RegionInternal>
CacheImpl::createRegion_internal(
m_attributes ? m_attributes->getEndpoints() : "";
if (!poolName.empty()) {
- auto pool = getCache()->getPoolManager().find(poolName);
+ auto pool = getPoolManager().find(poolName);
if (pool != nullptr && !pool->isDestroyed()) {
bool isMultiUserSecureMode = pool->getMultiuserAuthentication();
if (isMultiUserSecureMode && (attrs.getCachingEnabled())) {
@@ -605,7 +603,7 @@ void CacheImpl::readyForEvents() {
return;
}
- const auto& pools = getCache()->getPoolManager().getAll();
+ const auto& pools = getPoolManager().getAll();
if (pools.empty()) throw IllegalStateException("No pools found.");
for (const auto& itr : pools) {
const auto& currPool = itr.second;
@@ -623,7 +621,7 @@ void CacheImpl::readyForEvents() {
}
bool CacheImpl::getEndpointStatus(const std::string& endpoint) {
- const auto& pools = getCache()->getPoolManager().getAll();
+ const auto& pools = getPoolManager().getAll();
std::string fullName = endpoint;
if (pools.empty()) {
@@ -678,7 +676,7 @@ void CacheImpl::processMarker() {
}
int CacheImpl::getPoolSize(const char* poolName) {
- if (const auto pool = getCache()->getPoolManager().find(poolName)) {
+ if (const auto pool = getPoolManager().find(poolName)) {
if (const auto dm = std::dynamic_pointer_cast<ThinClientPoolDM>(pool)) {
return dm->m_poolSize;
}
@@ -744,4 +742,30 @@ CacheImpl::getMemberListForVersionStamp() {
return *versionStampMemIdList;
}
+std::unique_ptr<DataOutput> CacheImpl::createDataOutput() const {
+ return CacheImpl::createDataOutput(nullptr);
+}
+
+std::unique_ptr<DataOutput> CacheImpl::createDataOutput(Pool* pool) const {
+ if (!pool) {
+ pool = this->getPoolManager().getDefaultPool().get();
+ }
+
+ return std::unique_ptr<DataOutput>(new DataOutput(this, pool));
+}
+
+std::unique_ptr<DataInput> CacheImpl::createDataInput(const uint8_t* buffer,
+ size_t len) const {
+ return CacheImpl::createDataInput(buffer, len, nullptr);
+}
+
+std::unique_ptr<DataInput> CacheImpl::createDataInput(const uint8_t* buffer,
+ size_t len,
+ Pool* pool) const {
+ if (!pool) {
+ pool = this->getPoolManager().getDefaultPool().get();
+ }
+ return std::unique_ptr<DataInput>(new DataInput(buffer, len, this, pool));
+}
+
void CacheImpl::setCache(Cache* cache) { m_cache = cache; }
diff --git a/cppcache/src/CacheImpl.hpp b/cppcache/src/CacheImpl.hpp
index 6f424c0..7308a89 100644
--- a/cppcache/src/CacheImpl.hpp
+++ b/cppcache/src/CacheImpl.hpp
@@ -85,7 +85,8 @@ class SerializationRegistry;
*
*/
-class APACHE_GEODE_EXPORT CacheImpl : private NonCopyable, private
NonAssignable {
+class APACHE_GEODE_EXPORT CacheImpl : private NonCopyable,
+ private NonAssignable {
/**
* @brief public methods
*/
@@ -136,7 +137,7 @@ class APACHE_GEODE_EXPORT CacheImpl : private NonCopyable,
private NonAssignable
}
/** Set the <code>CacheAttributes</code> for this cache. */
- void setAttributes(const std::shared_ptr<CacheAttributes>& attrs);
+ void setAttributes(const std::shared_ptr<CacheAttributes>& attributes);
/**
* Returns the distributed system that this cache was
@@ -211,6 +212,7 @@ class APACHE_GEODE_EXPORT CacheImpl : private NonCopyable,
private NonAssignable
}
Cache* getCache() const { return m_cache; }
+
TcrConnectionManager& tcrConnectionManager() {
return *m_tcrConnectionManager;
}
@@ -271,20 +273,21 @@ class APACHE_GEODE_EXPORT CacheImpl : private
NonCopyable, private NonAssignable
return m_authInitialize;
}
- virtual std::unique_ptr<DataOutput> createDataOutput() const {
- return std::unique_ptr<DataOutput>(new DataOutput(this));
- }
+ virtual std::unique_ptr<DataOutput> createDataOutput() const;
+
+ virtual std::unique_ptr<DataOutput> createDataOutput(Pool* pool) const;
virtual std::unique_ptr<DataInput> createDataInput(const uint8_t* buffer,
- size_t len) const {
- return std::unique_ptr<DataInput>(new DataInput(buffer, len, this));
- }
+ size_t len) const;
+
+ virtual std::unique_ptr<DataInput> createDataInput(const uint8_t* buffer,
+ size_t len,
+ Pool* pool) const;
private:
std::atomic<bool> m_networkhop;
std::atomic<int> m_blacklistBucketTimeout;
std::atomic<int8_t> m_serverGroupFlag;
- std::shared_ptr<Pool> m_defaultPool;
bool m_ignorePdxUnreadFields;
bool m_readPdxSerialized;
std::unique_ptr<ExpiryTaskManager> m_expiryTaskManager;
diff --git a/cppcache/src/CacheableEnum.cpp b/cppcache/src/CacheableEnum.cpp
index abd2f88..44442f8 100644
--- a/cppcache/src/CacheableEnum.cpp
+++ b/cppcache/src/CacheableEnum.cpp
@@ -52,7 +52,7 @@ void CacheableEnum::toData(apache::geode::client::DataOutput&
output) const {
void CacheableEnum::fromData(apache::geode::client::DataInput& input) {
auto dsId = input.read();
- int32_t arrLen = input.readArrayLen();
+ int32_t arrLen = input.readArrayLength();
int enumId = (dsId << 24) | (arrLen & 0xFFFFFF);
auto enumVal = PdxHelper::getEnum(
enumId,
diff --git a/cppcache/src/CacheableObjectArray.cpp
b/cppcache/src/CacheableObjectArray.cpp
index cb99a70..64d1296 100644
--- a/cppcache/src/CacheableObjectArray.cpp
+++ b/cppcache/src/CacheableObjectArray.cpp
@@ -36,7 +36,7 @@ void CacheableObjectArray::toData(DataOutput& output) const {
}
void CacheableObjectArray::fromData(DataInput& input) {
- int32_t len = input.readArrayLen();
+ int32_t len = input.readArrayLength();
if (len >= 0) {
input.read(); // ignore CLASS typeid
input.readString(); // ignore class name
diff --git a/cppcache/src/CacheableObjectPartList.cpp
b/cppcache/src/CacheableObjectPartList.cpp
index 87d9c37..b31144c 100644
--- a/cppcache/src/CacheableObjectPartList.cpp
+++ b/cppcache/src/CacheableObjectPartList.cpp
@@ -57,7 +57,7 @@ void CacheableObjectPartList::fromData(DataInput& input) {
uint8_t byte = input.read();
if (byte == 2 /* for exception*/) {
- input.advanceCursor(input.readArrayLen());
+ input.advanceCursor(input.readArrayLength());
// input.readObject(exMsgPtr, true);// Changed
auto exMsg = input.readString();
if (exMsg == "org.apache.geode.security.NotAuthorizedException") {
diff --git a/cppcache/src/ClientProxyMembershipID.cpp
b/cppcache/src/ClientProxyMembershipID.cpp
index c52e69c..64e20e0 100644
--- a/cppcache/src/ClientProxyMembershipID.cpp
+++ b/cppcache/src/ClientProxyMembershipID.cpp
@@ -220,7 +220,7 @@ void ClientProxyMembershipID::fromData(DataInput& input) {
std::shared_ptr<CacheableString> hostname, dsName, uniqueTag,
durableClientId;
int8_t splitbrain, vmKind;
- len = input.readArrayLen(); // inetaddress len
+ len = input.readArrayLength(); // inetaddress len
m_hostAddrLocalMem = true;
/* adongre - Coverity II
* CID 29184: Out-of-bounds access (OVERRUN_DYNAMIC)
@@ -268,7 +268,7 @@ Serializable*
ClientProxyMembershipID::readEssentialData(DataInput& input) {
int32_t len, hostPort, vmViewId = 0;
std::shared_ptr<CacheableString> hostname, dsName, uniqueTag, vmViewIdstr;
- len = input.readArrayLen(); // inetaddress len
+ len = input.readArrayLength(); // inetaddress len
m_hostAddrLocalMem = true;
/* adongre - Coverity II
* CID 29183: Out-of-bounds access (OVERRUN_DYNAMIC)
diff --git a/cppcache/src/CqService.hpp b/cppcache/src/CqService.hpp
index 97be244..28f70bf 100644
--- a/cppcache/src/CqService.hpp
+++ b/cppcache/src/CqService.hpp
@@ -58,9 +58,10 @@ namespace client {
*
*/
-class APACHE_GEODE_EXPORT CqService : private NonCopyable,
- private NonAssignable,
- public std::enable_shared_from_this<CqService>
{
+class APACHE_GEODE_EXPORT CqService
+ : private NonCopyable,
+ private NonAssignable,
+ public std::enable_shared_from_this<CqService> {
private:
ThinClientBaseDM* m_tccdm;
statistics::StatisticsFactory* m_statisticsFactory;
diff --git a/cppcache/src/DataInput.cpp b/cppcache/src/DataInput.cpp
index 15046bc..6ff55d7 100644
--- a/cppcache/src/DataInput.cpp
+++ b/cppcache/src/DataInput.cpp
@@ -22,11 +22,20 @@
#include "CacheImpl.hpp"
#include "util/string.hpp"
#include "util/JavaModifiedUtf8.hpp"
+#include <geode/PoolManager.hpp>
namespace apache {
namespace geode {
namespace client {
+DataInput::DataInput(const uint8_t* m_buffer, size_t len,
+ const CacheImpl* cache, Pool* pool)
+ : m_buf(m_buffer),
+ m_bufHead(m_buffer),
+ m_bufLength(len),
+ m_pool(pool),
+ m_cache(cache) {}
+
std::shared_ptr<Serializable> DataInput::readObjectInternal(int8_t typeId) {
return getSerializationRegistry().deserialize(*this, typeId);
}
diff --git a/cppcache/src/DataInputInternal.hpp
b/cppcache/src/DataInputInternal.hpp
index 10952c1..471b78e 100644
--- a/cppcache/src/DataInputInternal.hpp
+++ b/cppcache/src/DataInputInternal.hpp
@@ -29,22 +29,13 @@ namespace client {
class DataInputInternal : public DataInput {
public:
DataInputInternal(const uint8_t* buffer, size_t len)
- : DataInput(buffer, len, nullptr) {}
+ : DataInput(buffer, len, nullptr, nullptr) {}
DataInputInternal(const uint8_t* buffer, size_t len, const CacheImpl* cache)
- : DataInput(buffer, len, cache) {}
+ : DataInput(buffer, len, cache, nullptr) {}
- virtual const Cache* getCache() override {
- throw FatalInternalException("DataInputInternal does not have a Cache");
- }
-
- inline static const std::string& getPoolName(const DataInput& dataInput) {
- return dataInput.getPoolName();
- }
-
- inline static void setPoolName(DataInput& dataInput,
- const std::string& poolName) {
- return dataInput.setPoolName(poolName);
+ inline static Pool* getPool(const DataInput& dataInput) {
+ return dataInput.getPool();
}
};
diff --git a/cppcache/src/DataOutput.cpp b/cppcache/src/DataOutput.cpp
index e31a924..98b9837 100644
--- a/cppcache/src/DataOutput.cpp
+++ b/cppcache/src/DataOutput.cpp
@@ -113,11 +113,8 @@ TSSDataOutput::~TSSDataOutput() {
ACE_TSS<TSSDataOutput> TSSDataOutput::s_tssDataOutput;
-DataOutput::DataOutput(const CacheImpl* cache)
- : m_size(0),
- m_haveBigBuffer(false),
- m_cache(cache),
- m_poolName(EMPTY_STRING) {
+DataOutput::DataOutput(const CacheImpl* cache, Pool* pool)
+ : m_size(0), m_haveBigBuffer(false), m_cache(cache), m_pool(pool) {
m_buf = m_bytes = DataOutput::checkoutBuffer(&m_size);
}
diff --git a/cppcache/src/DataOutputInternal.hpp
b/cppcache/src/DataOutputInternal.hpp
index 21c0bc4..3f6abbf 100644
--- a/cppcache/src/DataOutputInternal.hpp
+++ b/cppcache/src/DataOutputInternal.hpp
@@ -22,6 +22,9 @@
#include <geode/DataOutput.hpp>
+#include "CacheImpl.hpp" // TODO remove
+#include <geode/PoolManager.hpp> // TODO remove
+
namespace apache {
namespace geode {
namespace client {
@@ -30,21 +33,12 @@ class CacheImpl;
class DataOutputInternal : public DataOutput {
public:
- DataOutputInternal() : DataOutput() {}
-
- DataOutputInternal(CacheImpl* cache) : DataOutput(cache) {}
+ DataOutputInternal() : DataOutput(nullptr, nullptr) {}
- virtual const Cache* getCache() override {
- throw FatalInternalException("DataOutputInternal does not have a Cache");
- }
-
- inline static const std::string& getPoolName(const DataOutput& dataOutput) {
- return dataOutput.getPoolName();
- }
+ DataOutputInternal(CacheImpl* cache) : DataOutput(cache, nullptr) {}
- inline static void setPoolName(DataOutput& dataOutput,
- const std::string& poolName) {
- return dataOutput.setPoolName(poolName);
+ inline static Pool* getPool(const DataOutput& dataOutput) {
+ return dataOutput.getPool();
}
};
diff --git a/cppcache/src/EventId.cpp b/cppcache/src/EventId.cpp
index 4bcac1d..8c808a4 100644
--- a/cppcache/src/EventId.cpp
+++ b/cppcache/src/EventId.cpp
@@ -73,9 +73,9 @@ void EventId::toData(DataOutput& output) const {
void EventId::fromData(DataInput& input) {
// TODO: statics being assigned; not thread-safe??
- m_eidMemLen = input.readArrayLen();
+ m_eidMemLen = input.readArrayLength();
input.readBytesOnly(reinterpret_cast<int8_t*>(m_eidMem), m_eidMemLen);
- input.readArrayLen(); // ignore arrayLen
+ input.readArrayLength(); // ignore arrayLen
m_eidThr = getEventIdData(input, input.read());
m_eidSeq = getEventIdData(input, input.read());
m_bucketId = input.readInt32();
diff --git a/cppcache/src/ExpMapEntry.hpp b/cppcache/src/ExpMapEntry.hpp
index 3480521..e6fcde0 100644
--- a/cppcache/src/ExpMapEntry.hpp
+++ b/cppcache/src/ExpMapEntry.hpp
@@ -32,7 +32,7 @@ namespace client {
* This subclass adds expiration times.
*/
class APACHE_GEODE_EXPORT ExpMapEntry : public MapEntryImpl,
- public ExpEntryProperties {
+ public ExpEntryProperties {
public:
virtual ~ExpMapEntry() {}
@@ -60,7 +60,7 @@ class APACHE_GEODE_EXPORT ExpMapEntry : public MapEntryImpl,
};
class APACHE_GEODE_EXPORT VersionedExpMapEntry : public ExpMapEntry,
- public VersionStamp {
+ public VersionStamp {
public:
virtual ~VersionedExpMapEntry() {}
diff --git a/cppcache/src/FarSideEntryOp.cpp b/cppcache/src/FarSideEntryOp.cpp
index a7ccc5a..583e317 100644
--- a/cppcache/src/FarSideEntryOp.cpp
+++ b/cppcache/src/FarSideEntryOp.cpp
@@ -90,7 +90,7 @@ void FarSideEntryOp::fromData(DataInput& input, bool
largeModCount,
}
} else {
// uint8_t* buf = nullptr;
- input.readArrayLen(); // ignore len
+ input.readArrayLength(); // ignore len
input.readObject(m_value);
// input.readBytes(&buf, &len);
@@ -129,10 +129,10 @@ void FarSideEntryOp::skipFilterRoutingInfo(DataInput&
input) {
// memId.fromData(input);
memId.readEssentialData(input);
- int32_t len = input.readArrayLen();
+ int32_t len = input.readArrayLength();
if (input.readBoolean()) {
- len = input.readArrayLen();
+ len = input.readArrayLength();
for (int j = 0; j < len; j++) {
input.readUnsignedVL();
input.readUnsignedVL();
diff --git a/cppcache/src/LRUEntriesMap.hpp b/cppcache/src/LRUEntriesMap.hpp
index 1c83fc7..1ccb3f2 100644
--- a/cppcache/src/LRUEntriesMap.hpp
+++ b/cppcache/src/LRUEntriesMap.hpp
@@ -58,8 +58,8 @@ class EvictionController;
* Fix : Make the class Non Assinable
*/
class APACHE_GEODE_EXPORT LRUEntriesMap : public ConcurrentEntriesMap,
- private NonCopyable,
- private NonAssignable {
+ private NonCopyable,
+ private NonAssignable {
protected:
LRUAction* m_action;
LRUList<MapEntryImpl, MapEntryT<LRUMapEntry, 0, 0> > m_lruList;
diff --git a/cppcache/src/LRUExpMapEntry.hpp b/cppcache/src/LRUExpMapEntry.hpp
index d0a5e53..a14c014 100644
--- a/cppcache/src/LRUExpMapEntry.hpp
+++ b/cppcache/src/LRUExpMapEntry.hpp
@@ -32,8 +32,8 @@ namespace client {
* @brief Hold region mapped entry value and lru information.
*/
class APACHE_GEODE_EXPORT LRUExpMapEntry : public MapEntryImpl,
- public LRUEntryProperties,
- public ExpEntryProperties {
+ public LRUEntryProperties,
+ public ExpEntryProperties {
public:
virtual ~LRUExpMapEntry() {}
@@ -64,7 +64,7 @@ class APACHE_GEODE_EXPORT LRUExpMapEntry : public
MapEntryImpl,
};
class APACHE_GEODE_EXPORT VersionedLRUExpMapEntry : public LRUExpMapEntry,
- public VersionStamp {
+ public VersionStamp {
public:
virtual ~VersionedLRUExpMapEntry() {}
diff --git a/cppcache/src/LRUMapEntry.hpp b/cppcache/src/LRUMapEntry.hpp
index d92528c..7174070 100644
--- a/cppcache/src/LRUMapEntry.hpp
+++ b/cppcache/src/LRUMapEntry.hpp
@@ -60,7 +60,7 @@ namespace client {
*
*/
class APACHE_GEODE_EXPORT LRUMapEntry : public MapEntryImpl,
- public LRUEntryProperties {
+ public LRUEntryProperties {
public:
virtual ~LRUMapEntry() {}
@@ -88,7 +88,7 @@ class APACHE_GEODE_EXPORT LRUMapEntry : public MapEntryImpl,
};
class APACHE_GEODE_EXPORT VersionedLRUMapEntry : public LRUMapEntry,
- public VersionStamp {
+ public VersionStamp {
public:
virtual ~VersionedLRUMapEntry() {}
diff --git a/cppcache/src/MapEntry.hpp b/cppcache/src/MapEntry.hpp
index efed813..c6a7d44 100644
--- a/cppcache/src/MapEntry.hpp
+++ b/cppcache/src/MapEntry.hpp
@@ -261,7 +261,7 @@ class MapEntryImpl : public MapEntry,
};
class APACHE_GEODE_EXPORT VersionedMapEntryImpl : public MapEntryImpl,
- public VersionStamp {
+ public VersionStamp {
public:
virtual ~VersionedMapEntryImpl() {}
diff --git a/cppcache/src/PdxHelper.cpp b/cppcache/src/PdxHelper.cpp
index 0470b9e..bb94636 100644
--- a/cppcache/src/PdxHelper.cpp
+++ b/cppcache/src/PdxHelper.cpp
@@ -65,7 +65,7 @@ void PdxHelper::serializePdx(
0) // from pdxInstance factory need to get typeid from server
{
int typeId = pdxTypeRegistry->getPDXIdForType(
- piPt, DataOutputInternal::getPoolName(output).c_str());
+ piPt, DataOutputInternal::getPool(output));
pdxII->setPdxId(typeId);
}
auto plw = PdxLocalWriter(output, piPt, pdxTypeRegistry);
@@ -92,8 +92,7 @@ void PdxHelper::serializePdx(
nType->InitializeType();
int32_t nTypeId = pdxTypeRegistry->getPDXIdForType(
- className.c_str(), DataOutputInternal::getPoolName(output).c_str(),
- nType, true);
+ className.c_str(), DataOutputInternal::getPool(output), nType, true);
nType->setTypeId(nTypeId);
ptc.endObjectWriting();
@@ -188,9 +187,7 @@ std::shared_ptr<PdxSerializable>
PdxHelper::deserializePdx(DataInput& dataInput,
if (pType == nullptr) {
pType = std::static_pointer_cast<PdxType>(
serializationRegistry->GetPDXTypeById(
- cacheImpl->getCache()->getPoolManager().find(
- DataInputInternal::getPoolName(dataInput)),
- typeId));
+ DataInputInternal::getPool(dataInput), typeId));
pdxLocalType =
pdxTypeRegistry->getLocalPdxType(pType->getPdxClassName());
}
/* adongre - Coverity II
@@ -220,9 +217,8 @@ std::shared_ptr<PdxSerializable>
PdxHelper::deserializePdx(DataInput& dataInput,
// Need to know local type and then merge type
pdxLocalType->InitializeType();
pdxLocalType->setTypeId(pdxTypeRegistry->getPDXIdForType(
- pdxObjectptr->getClassName(),
- DataInputInternal::getPoolName(dataInput).c_str(), pdxLocalType,
- true));
+ pdxObjectptr->getClassName(),
DataInputInternal::getPool(dataInput),
+ pdxLocalType, true));
pdxLocalType->setLocal(true);
pdxTypeRegistry->addLocalPdxType(pdxRealObject->getClassName(),
pdxLocalType); // added local type
@@ -296,9 +292,7 @@ std::shared_ptr<PdxSerializable> PdxHelper::deserializePdx(
// TODO shared_ptr why redef?
auto pType = std::static_pointer_cast<PdxType>(
serializationRegistry->GetPDXTypeById(
- cacheImpl->getCache()->getPoolManager().find(
- DataInputInternal::getPoolName(dataInput)),
- typeId));
+ DataInputInternal::getPool(dataInput), typeId));
pdxTypeRegistry->addLocalPdxType(pType->getPdxClassName(), pType);
pdxTypeRegistry->addPdxType(pType->getTypeId(), pType);
}
@@ -335,9 +329,7 @@ void PdxHelper::createMergedType(std::shared_ptr<PdxType>
localType,
mergedVersion->InitializeType();
if (mergedVersion->getTypeId() == 0) {
mergedVersion->setTypeId(serializaionRegistry->GetPDXIdForType(
- dataInput.getCache()->getPoolManager().find(
- DataInputInternal::getPoolName(dataInput)),
- mergedVersion));
+ DataInputInternal::getPool(dataInput), mergedVersion));
}
// PdxTypeRegistry::AddPdxType(remoteType->TypeId, mergedVersion);
diff --git a/cppcache/src/PdxType.cpp b/cppcache/src/PdxType.cpp
index 379d0e1..fe56b90 100644
--- a/cppcache/src/PdxType.cpp
+++ b/cppcache/src/PdxType.cpp
@@ -100,7 +100,7 @@ void PdxType::fromData(DataInput& input) {
m_varLenFieldIdx = input.readInt32();
- int len = input.readArrayLen();
+ int len = input.readArrayLength();
bool foundVarLenType = false;
diff --git a/cppcache/src/PdxTypeRegistry.cpp b/cppcache/src/PdxTypeRegistry.cpp
index d390585..03a8081 100644
--- a/cppcache/src/PdxTypeRegistry.cpp
+++ b/cppcache/src/PdxTypeRegistry.cpp
@@ -41,8 +41,7 @@ size_t PdxTypeRegistry::testNumberOfPreservedData() const {
return preserveData.size();
}
-int32_t PdxTypeRegistry::getPDXIdForType(const std::string& type,
- const std::string& poolname,
+int32_t PdxTypeRegistry::getPDXIdForType(const std::string& type, Pool* pool,
std::shared_ptr<PdxType> nType,
bool checkIfThere) {
// WriteGuard guard(g_readerWriterLock);
@@ -56,8 +55,7 @@ int32_t PdxTypeRegistry::getPDXIdForType(const std::string&
type,
}
}
- int typeId = cache->getSerializationRegistry()
- ->GetPDXIdForType(cache->getPoolManager().find(poolname),
nType);
+ int typeId = cache->getSerializationRegistry()->GetPDXIdForType(pool, nType);
nType->setTypeId(typeId);
PdxTypeRegistry::addPdxType(typeId, nType);
@@ -65,7 +63,7 @@ int32_t PdxTypeRegistry::getPDXIdForType(const std::string&
type,
}
int32_t PdxTypeRegistry::getPDXIdForType(std::shared_ptr<PdxType> nType,
- const std::string& poolname) {
+ Pool* pool) {
int32_t typeId = 0;
{
ReadGuard read(g_readerWriterLock);
@@ -88,8 +86,7 @@ int32_t
PdxTypeRegistry::getPDXIdForType(std::shared_ptr<PdxType> nType,
}
}
- typeId = cache->getSerializationRegistry()
- ->GetPDXIdForType(cache->getPoolManager().find(poolname),
nType);
+ typeId = cache->getSerializationRegistry()->GetPDXIdForType(pool, nType);
nType->setTypeId(typeId);
pdxTypeToTypeIdMap.insert(std::make_pair(nType, typeId));
addPdxType(typeId, nType);
diff --git a/cppcache/src/PdxTypeRegistry.hpp b/cppcache/src/PdxTypeRegistry.hpp
index c3504b1..f3bf4f6 100644
--- a/cppcache/src/PdxTypeRegistry.hpp
+++ b/cppcache/src/PdxTypeRegistry.hpp
@@ -119,7 +119,7 @@ class APACHE_GEODE_EXPORT PdxTypeRegistry
void clear();
- int32_t getPDXIdForType(const std::string& type, const std::string& poolname,
+ int32_t getPDXIdForType(const std::string& type, Pool* pool,
std::shared_ptr<PdxType> nType, bool checkIfThere);
bool getPdxIgnoreUnreadFields() const { return pdxIgnoreUnreadFields; }
@@ -138,8 +138,7 @@ class APACHE_GEODE_EXPORT PdxTypeRegistry
std::shared_ptr<EnumInfo> getEnum(int32_t enumVal);
- int32_t getPDXIdForType(std::shared_ptr<PdxType> nType,
- const std::string& poolname);
+ int32_t getPDXIdForType(std::shared_ptr<PdxType> nType, Pool* pool);
ACE_RW_Thread_Mutex& getPreservedDataLock() const {
return g_preservedDataLock;
diff --git a/cppcache/src/PoolManagerImpl.cpp b/cppcache/src/PoolManagerImpl.cpp
index 6d4a6fe..9bdb42d 100644
--- a/cppcache/src/PoolManagerImpl.cpp
+++ b/cppcache/src/PoolManagerImpl.cpp
@@ -69,7 +69,7 @@ std::shared_ptr<Pool> PoolManagerImpl::find(const
std::string& name) const {
std::shared_ptr<Pool> PoolManagerImpl::find(
std::shared_ptr<Region> region) const {
- return find(region->getAttributes().getPoolName().c_str());
+ return find(region->getAttributes().getPoolName());
}
const HashMapOfPools& PoolManagerImpl::getAll() const {
diff --git a/cppcache/src/PreservedDataExpiryHandler.hpp
b/cppcache/src/PreservedDataExpiryHandler.hpp
index d4653d9..e27c04e 100644
--- a/cppcache/src/PreservedDataExpiryHandler.hpp
+++ b/cppcache/src/PreservedDataExpiryHandler.hpp
@@ -38,7 +38,8 @@ namespace client {
* when a preserved data expires.
*
*/
-class APACHE_GEODE_EXPORT PreservedDataExpiryHandler : public
ACE_Event_Handler {
+class APACHE_GEODE_EXPORT PreservedDataExpiryHandler
+ : public ACE_Event_Handler {
public:
/**
* Constructor
diff --git a/cppcache/src/Properties.cpp b/cppcache/src/Properties.cpp
index 219bed4..2c62b40 100644
--- a/cppcache/src/Properties.cpp
+++ b/cppcache/src/Properties.cpp
@@ -209,7 +209,7 @@ void Properties::toData(DataOutput& output) const {
}
void Properties::fromData(DataInput& input) {
- auto mapSize = input.readArrayLen();
+ auto mapSize = input.readArrayLength();
m_map.reserve(mapSize);
for (int i = 0; i < mapSize; i++) {
diff --git a/cppcache/src/PutAllPartialResultServerException.hpp
b/cppcache/src/PutAllPartialResultServerException.hpp
index 3ea0c77..2d2397c 100644
--- a/cppcache/src/PutAllPartialResultServerException.hpp
+++ b/cppcache/src/PutAllPartialResultServerException.hpp
@@ -35,7 +35,8 @@ class PutAllPartialResultServerException;
* @brief PutAllPartialResultServerException class is used to encapsulate
*geode PutAllPartialResultServerException in case of PutAll execution.
**/
-class APACHE_GEODE_EXPORT PutAllPartialResultServerException : public
Serializable {
+class APACHE_GEODE_EXPORT PutAllPartialResultServerException
+ : public Serializable {
/**
* @brief public methods
*/
diff --git a/cppcache/src/RegionAttributes.cpp
b/cppcache/src/RegionAttributes.cpp
index 2a4aca9..870fa7e 100644
--- a/cppcache/src/RegionAttributes.cpp
+++ b/cppcache/src/RegionAttributes.cpp
@@ -302,7 +302,7 @@ void writeString(DataOutput& out, const std::string& field)
{
void readString(DataInput& in, std::string& field) {
// length including null terminator
- auto len = in.readArrayLen();
+ auto len = in.readArrayLength();
// currentBufferPosition is read-only and we are only reading, cast away
const
field = std::string(const_cast<char*>(reinterpret_cast<const char*>(
in.currentBufferPosition())),
diff --git a/cppcache/src/SerializationRegistry.cpp
b/cppcache/src/SerializationRegistry.cpp
index e26170d..625b360 100644
--- a/cppcache/src/SerializationRegistry.cpp
+++ b/cppcache/src/SerializationRegistry.cpp
@@ -254,39 +254,43 @@ std::shared_ptr<PdxSerializable>
SerializationRegistry::getPdxType(
return pdxObj;
}
-void SerializationRegistry::setPdxSerializer(std::shared_ptr<PdxSerializer>
serializer) {
+void SerializationRegistry::setPdxSerializer(
+ std::shared_ptr<PdxSerializer> serializer) {
this->pdxSerializer = serializer;
}
+
std::shared_ptr<PdxSerializer> SerializationRegistry::getPdxSerializer() {
return pdxSerializer;
}
-int32_t SerializationRegistry::GetPDXIdForType(std::shared_ptr<Pool> pool,
- std::shared_ptr<Serializable>
pdxType) const {
- if (pool == nullptr) {
- throw IllegalStateException("Pool not found, Pdx operation failed");
+int32_t SerializationRegistry::GetPDXIdForType(
+ Pool* pool, std::shared_ptr<Serializable> pdxType) const {
+ if (auto poolDM = dynamic_cast<ThinClientPoolDM*>(pool)) {
+ return poolDM->GetPDXIdForType(pdxType);
}
- return static_cast<ThinClientPoolDM*>(pool.get())->GetPDXIdForType(pdxType);
+ throw IllegalStateException("Pool not found, Pdx operation failed");
}
- std::shared_ptr<Serializable>
SerializationRegistry::GetPDXTypeById(std::shared_ptr<Pool> pool,
- int32_t typeId) const {
- if (pool == nullptr) {
- throw IllegalStateException("Pool not found, Pdx operation failed");
+
+std::shared_ptr<Serializable> SerializationRegistry::GetPDXTypeById(
+ Pool* pool, int32_t typeId) const {
+ if (auto poolDM = dynamic_cast<ThinClientPoolDM*>(pool)) {
+ return poolDM->GetPDXTypeById(typeId);
}
- return static_cast<ThinClientPoolDM*>(pool.get())->GetPDXTypeById(typeId);
+ throw IllegalStateException("Pool not found, Pdx operation failed");
}
-int32_t SerializationRegistry::GetEnumValue(std::shared_ptr<Pool> pool,
- std::shared_ptr<Serializable>
enumInfo) const {
+int32_t SerializationRegistry::GetEnumValue(
+ std::shared_ptr<Pool> pool, std::shared_ptr<Serializable> enumInfo) const {
if (pool == nullptr) {
throw IllegalStateException("Pool not found, Pdx operation failed");
}
return static_cast<ThinClientPoolDM*>(pool.get())->GetEnumValue(enumInfo);
-} std::shared_ptr<Serializable>
SerializationRegistry::GetEnum(std::shared_ptr<Pool> pool,
- int32_t val) const {
+}
+std::shared_ptr<Serializable> SerializationRegistry::GetEnum(
+ std::shared_ptr<Pool> pool, int32_t val) const {
if (pool == nullptr) {
throw IllegalStateException("Pool not found, Pdx operation failed");
}
diff --git a/cppcache/src/SerializationRegistry.hpp
b/cppcache/src/SerializationRegistry.hpp
index bd9abc2..a92af6c 100644
--- a/cppcache/src/SerializationRegistry.hpp
+++ b/cppcache/src/SerializationRegistry.hpp
@@ -215,13 +215,15 @@ class APACHE_GEODE_EXPORT SerializationRegistry {
void removeType2(int64_t compId);
- int32_t GetPDXIdForType(std::shared_ptr<Pool> pool,
+ int32_t GetPDXIdForType(Pool* pool,
std::shared_ptr<Serializable> pdxType) const;
- std::shared_ptr<Serializable> GetPDXTypeById(std::shared_ptr<Pool> pool,
+ std::shared_ptr<Serializable> GetPDXTypeById(Pool* pool,
int32_t typeId) const;
- int32_t GetEnumValue(std::shared_ptr<Pool> pool,
std::shared_ptr<Serializable> enumInfo) const;
+ int32_t GetEnumValue(std::shared_ptr<Pool> pool,
+ std::shared_ptr<Serializable> enumInfo) const;
+
std::shared_ptr<Serializable> GetEnum(std::shared_ptr<Pool> pool,
int32_t val) const;
diff --git a/cppcache/src/Struct.cpp b/cppcache/src/Struct.cpp
index cef7a3d..71e078b 100644
--- a/cppcache/src/Struct.cpp
+++ b/cppcache/src/Struct.cpp
@@ -65,19 +65,19 @@ void Struct::fromData(DataInput& input) {
input.advanceCursor(2); // ignore classType
skipClassName(input);
- int32_t numOfFields = input.readArrayLen();
+ int32_t numOfFields = input.readArrayLength();
m_parent = nullptr;
for (int32_t i = 0; i < numOfFields; i++) {
m_fieldNames.emplace(input.readString(), i);
}
- int32_t lengthForTypes = input.readArrayLen();
+ int32_t lengthForTypes = input.readArrayLength();
skipClassName(input);
for (int i = 0; i < lengthForTypes; i++) {
input.advanceCursor(2); // ignore classType
skipClassName(input);
}
- int32_t numOfSerializedValues = input.readArrayLen();
+ int32_t numOfSerializedValues = input.readArrayLength();
skipClassName(input);
for (int i = 0; i < numOfSerializedValues; i++) {
std::shared_ptr<Serializable> val;
diff --git a/cppcache/src/TXCommitMessage.cpp b/cppcache/src/TXCommitMessage.cpp
index 87c8d0e..5f7906e 100644
--- a/cppcache/src/TXCommitMessage.cpp
+++ b/cppcache/src/TXCommitMessage.cpp
@@ -82,7 +82,7 @@ void TXCommitMessage::fromData(DataInput& input) {
if (dfsid == GeodeTypeIdsImpl::ClientProxyMembershipId) {
ClientProxyMembershipID memId1;
- input.advanceCursor(input.readArrayLen());
+ input.advanceCursor(input.readArrayLength());
input.readInt32();
} else {
@@ -104,7 +104,7 @@ void TXCommitMessage::fromData(DataInput& input) {
GF_CACHE_ILLEGAL_STATE_EXCEPTION);
}
- int32_t len = input.readArrayLen();
+ int32_t len = input.readArrayLength();
for (int j = 0; j < len; j++) {
std::shared_ptr<Cacheable> tmp;
input.readObject(tmp);
diff --git a/cppcache/src/TcrMessage.cpp b/cppcache/src/TcrMessage.cpp
index 8b52b43..2bfbaaa 100644
--- a/cppcache/src/TcrMessage.cpp
+++ b/cppcache/src/TcrMessage.cpp
@@ -584,8 +584,6 @@ void TcrMessage::writeBytesOnly(const
std::shared_ptr<Serializable>& se) {
}
void TcrMessage::writeHeader(uint32_t msgType, uint32_t numOfParts) {
- DataOutputInternal::setPoolName(*m_request, getPoolName());
-
int8_t earlyAck = 0x0;
LOGDEBUG("TcrMessage::writeHeader m_isMetaRegion = %d", m_isMetaRegion);
if (m_tcdm != nullptr) {
@@ -883,13 +881,11 @@ void TcrMessage::processChunk(const uint8_t* bytes,
int32_t len,
}
}
-const std::string& TcrMessage::getPoolName() const {
+Pool* TcrMessage::getPool() const {
if (m_region) {
- if (const auto& p = m_region->getPool()) {
- return p->getName();
- }
+ return m_region->getPool().get();
}
- return EMPTY_STRING;
+ return nullptr;
}
void TcrMessage::chunkSecurityHeader(int skipPart, const uint8_t* bytes,
@@ -909,11 +905,10 @@ void TcrMessage::handleByteArrayResponse(
const SerializationRegistry& serializationRegistry,
MemberListForVersionStamp& memberListForVersionStamp) {
auto input = m_tcdm->getConnectionManager().getCacheImpl()->createDataInput(
- (uint8_t*)bytearray, len);
+ (uint8_t*)bytearray, len, getPool());
// TODO:: this need to make sure that pool is there
// if(m_tcdm == nullptr)
// throw IllegalArgumentException("Pool is nullptr in TcrMessage");
- DataInputInternal::setPoolName(*input, getPoolName());
m_msgType = input->readInt32();
int32_t msglen;
msglen = input->readInt32();
@@ -1233,7 +1228,7 @@ void TcrMessage::handleByteArrayResponse(
LOGDEBUG("Expected typeID %d, got %d",
GeodeTypeIds::CacheableArrayList,
bits8);
- bits32 = input->readArrayLen(); // array length
+ bits32 = input->readArrayLength(); // array length
LOGDEBUG("Array length = %d ", bits32);
if (bits32 > 0) {
std::vector<std::shared_ptr<BucketServerLocation>>
@@ -1289,7 +1284,7 @@ void TcrMessage::handleByteArrayResponse(
input->read(); // ignore isObj;
input->read(); // ignore cacheable CacheableHashSet typeid
- bits32 = input->readArrayLen(); // array length
+ bits32 = input->readArrayLength(); // array length
if (bits32 > 0) {
m_fpaSet =
new std::vector<std::shared_ptr<FixedPartitionAttributesImpl>>();
@@ -2557,7 +2552,8 @@ void
TcrMessage::createUserCredentialMessage(TcrConnection* conn) {
m_isSecurityHeaderAdded = false;
writeHeader(m_msgType, 1);
- auto dOut =
m_tcdm->getConnectionManager().getCacheImpl()->createDataOutput();
+ auto dOut = m_tcdm->getConnectionManager().getCacheImpl()->createDataOutput(
+ getPool());
if (m_creds != nullptr) m_creds->toData(*dOut);
@@ -2586,7 +2582,8 @@ void TcrMessage::addSecurityPart(int64_t connectionId,
int64_t unique_id,
m_isSecurityHeaderAdded = true;
LOGDEBUG("addSecurityPart( , ) ");
auto dOutput =
- m_tcdm->getConnectionManager().getCacheImpl()->createDataOutput();
+ m_tcdm->getConnectionManager().getCacheImpl()->createDataOutput(
+ getPool());
dOutput->writeInt(connectionId);
dOutput->writeInt(unique_id);
@@ -2617,7 +2614,8 @@ void TcrMessage::addSecurityPart(int64_t connectionId,
TcrConnection* conn) {
m_isSecurityHeaderAdded = true;
LOGDEBUG("TcrMessage::addSecurityPart only connid");
auto dOutput =
- m_tcdm->getConnectionManager().getCacheImpl()->createDataOutput();
+ m_tcdm->getConnectionManager().getCacheImpl()->createDataOutput(
+ getPool());
dOutput->writeInt(connectionId);
@@ -2786,8 +2784,8 @@ void TcrMessage::setData(const char* bytearray, int32_t
len, uint16_t memId,
const SerializationRegistry& serializationRegistry,
MemberListForVersionStamp& memberListForVersionStamp)
{
if (m_request == nullptr) {
- m_request =
- m_tcdm->getConnectionManager().getCacheImpl()->createDataOutput();
+ m_request =
m_tcdm->getConnectionManager().getCacheImpl()->createDataOutput(
+ getPool());
}
if (bytearray) {
DeleteArray<const char> delByteArr(bytearray);
@@ -2928,7 +2926,7 @@ void TcrMessage::readHashMapForGCVersions(
throw Exception(
"Reading HashMap For GC versions. Expecting type id of hash map. ");
}
- int32_t len = input.readArrayLen();
+ int32_t len = input.readArrayLength();
if (len > 0) {
std::shared_ptr<CacheableKey> key;
@@ -2961,7 +2959,7 @@ void TcrMessage::readHashSetForGCVersions(
throw Exception(
"Reading HashSet For GC versions. Expecting type id of hash set. ");
}
- int32_t len = input.readArrayLen();
+ int32_t len = input.readArrayLength();
if (len > 0) {
std::shared_ptr<CacheableKey> key;
diff --git a/cppcache/src/TcrMessage.hpp b/cppcache/src/TcrMessage.hpp
index 26e0f38..ca50807 100644
--- a/cppcache/src/TcrMessage.hpp
+++ b/cppcache/src/TcrMessage.hpp
@@ -257,7 +257,7 @@ class APACHE_GEODE_EXPORT TcrMessage {
}
}
- const std::string& getPoolName() const;
+ Pool* getPool() const;
/**
* Whether the request is meant to be
diff --git a/cppcache/src/ThinClientRegion.cpp
b/cppcache/src/ThinClientRegion.cpp
index 438997f..4bdf4ab 100644
--- a/cppcache/src/ThinClientRegion.cpp
+++ b/cppcache/src/ThinClientRegion.cpp
@@ -3339,9 +3339,8 @@ void ChunkedInterestResponse::handleChunk(const uint8_t*
chunk,
int32_t chunkLen,
uint8_t isLastChunkWithSecurity,
const CacheImpl* cacheImpl) {
- auto input = cacheImpl->createDataInput(chunk, chunkLen);
-
- DataInputInternal::setPoolName(*input, m_replyMsg.getPoolName());
+ auto input =
+ cacheImpl->createDataInput(chunk, chunkLen, m_replyMsg.getPool());
uint32_t partLen;
if (TcrMessageHelper::readChunkPartHeader(
@@ -3371,9 +3370,8 @@ void ChunkedKeySetResponse::reset() {
void ChunkedKeySetResponse::handleChunk(const uint8_t* chunk, int32_t chunkLen,
uint8_t isLastChunkWithSecurity,
const CacheImpl* cacheImpl) {
- auto input = cacheImpl->createDataInput(chunk, chunkLen);
-
- DataInputInternal::setPoolName(*input, m_replyMsg.getPoolName());
+ auto input =
+ cacheImpl->createDataInput(chunk, chunkLen, m_replyMsg.getPool());
uint32_t partLen;
if (TcrMessageHelper::readChunkPartHeader(
@@ -3406,7 +3404,7 @@ void ChunkedQueryResponse::readObjectPartList(DataInput&
input,
for (int32_t index = 0; index < len; ++index) {
if (input.read() == 2 /* for exception*/) {
- input.advanceCursor(input.readArrayLen()); // skipLen
+ input.advanceCursor(input.readArrayLength()); // skipLen
auto exMsgPtr = input.readString();
throw IllegalStateException(exMsgPtr);
} else {
@@ -3447,8 +3445,8 @@ void ChunkedQueryResponse::handleChunk(const uint8_t*
chunk, int32_t chunkLen,
uint8_t isLastChunkWithSecurity,
const CacheImpl* cacheImpl) {
LOGDEBUG("ChunkedQueryResponse::handleChunk..");
- auto input = cacheImpl->createDataInput(chunk, chunkLen);
- DataInputInternal::setPoolName(*input, m_msg.getPoolName());
+ auto input = cacheImpl->createDataInput(chunk, chunkLen, m_msg.getPool());
+
uint32_t partLen;
TcrMessageHelper::ChunkObjectType objType;
if ((objType = TcrMessageHelper::readChunkPartHeader(
@@ -3490,7 +3488,7 @@ void ChunkedQueryResponse::handleChunk(const uint8_t*
chunk, int32_t chunkLen,
const auto isStructTypeImpl = input->readString();
if (isStructTypeImpl == "org.apache.geode.cache.query.Struct") {
- int32_t numOfFldNames = input->readArrayLen();
+ int32_t numOfFldNames = input->readArrayLength();
bool skip = false;
if (m_structFieldNames.size() != 0) {
skip = true;
@@ -3524,7 +3522,7 @@ void ChunkedQueryResponse::handleChunk(const uint8_t*
chunk, int32_t chunkLen,
auto arrayType = input->read();
if (arrayType == GeodeTypeIds::CacheableObjectArray) {
- int32_t arraySize = input->readArrayLen();
+ int32_t arraySize = input->readArrayLength();
skipClass(*input);
for (int32_t arrayItem = 0; arrayItem < arraySize; ++arrayItem) {
std::shared_ptr<Serializable> value;
@@ -3533,7 +3531,7 @@ void ChunkedQueryResponse::handleChunk(const uint8_t*
chunk, int32_t chunkLen,
m_queryResults->push_back(value);
} else {
input->read();
- int32_t arraySize2 = input->readArrayLen();
+ int32_t arraySize2 = input->readArrayLength();
skipClass(*input);
for (int32_t index = 0; index < arraySize2; ++index) {
input->readObject(value);
@@ -3588,8 +3586,8 @@ void ChunkedFunctionExecutionResponse::handleChunk(
const uint8_t* chunk, int32_t chunkLen, uint8_t isLastChunkWithSecurity,
const CacheImpl* cacheImpl) {
LOGDEBUG("ChunkedFunctionExecutionResponse::handleChunk");
- auto input = cacheImpl->createDataInput(chunk, chunkLen);
- DataInputInternal::setPoolName(*input, m_msg.getPoolName());
+ auto input = cacheImpl->createDataInput(chunk, chunkLen, m_msg.getPool());
+
uint32_t partLen;
int8_t arrayType;
@@ -3618,7 +3616,7 @@ void ChunkedFunctionExecutionResponse::handleChunk(
input->getBytesRead() -
1; // from here need to look value part + memberid AND -1 for array type
// iread adn gnore array length
- input->readArrayLen();
+ input->readArrayLength();
// read a byte to determine whether to read exception part for sendException
// or read objects.
@@ -3664,7 +3662,7 @@ void ChunkedFunctionExecutionResponse::handleChunk(
arrayType = input->read();
// read and ignore its len which is 2
- input->readArrayLen();
+ input->readArrayLength();
}
} else {
// rewind cursor by 1 to what we had read a byte to determine whether to
@@ -3722,8 +3720,8 @@ void ChunkedGetAllResponse::reset() {
void ChunkedGetAllResponse::handleChunk(const uint8_t* chunk, int32_t chunkLen,
uint8_t isLastChunkWithSecurity,
const CacheImpl* cacheImpl) {
- auto input = cacheImpl->createDataInput(chunk, chunkLen);
- DataInputInternal::setPoolName(*input, m_msg.getPoolName());
+ auto input = cacheImpl->createDataInput(chunk, chunkLen, m_msg.getPool());
+
uint32_t partLen;
if (TcrMessageHelper::readChunkPartHeader(
m_msg, *input, GeodeTypeIdsImpl::FixedIDByte,
@@ -3776,8 +3774,8 @@ void ChunkedPutAllResponse::reset() {
void ChunkedPutAllResponse::handleChunk(const uint8_t* chunk, int32_t chunkLen,
uint8_t isLastChunkWithSecurity,
const CacheImpl* cacheImpl) {
- auto input = cacheImpl->createDataInput(chunk, chunkLen);
- DataInputInternal::setPoolName(*input, m_msg.getPoolName());
+ auto input = cacheImpl->createDataInput(chunk, chunkLen, m_msg.getPool());
+
uint32_t partLen;
int8_t chunkType;
if ((chunkType = (TcrMessageHelper::ChunkObjectType)
@@ -3810,10 +3808,10 @@ void ChunkedPutAllResponse::handleChunk(const uint8_t*
chunk, int32_t chunkLen,
const auto byte1 = input->read();
m_msg.readSecureObjectPart(*input, false, true, isLastChunkWithSecurity);
- auto pool = cacheImpl->getPoolManager().find(m_msg.getPoolName());
+ auto pool = m_msg.getPool();
if (pool != nullptr && !pool->isDestroyed() &&
pool->getPRSingleHopEnabled()) {
- ThinClientPoolDM* poolDM = dynamic_cast<ThinClientPoolDM*>(pool.get());
+ auto poolDM = dynamic_cast<ThinClientPoolDM*>(pool);
if ((poolDM != nullptr) &&
(poolDM->getClientMetaDataService() != nullptr) && (byte0 != 0)) {
LOGFINE("enqueued region " + m_region->getFullPath() +
@@ -3836,8 +3834,8 @@ void ChunkedRemoveAllResponse::handleChunk(const uint8_t*
chunk,
int32_t chunkLen,
uint8_t isLastChunkWithSecurity,
const CacheImpl* cacheImpl) {
- auto input = cacheImpl->createDataInput(chunk, chunkLen);
- DataInputInternal::setPoolName(*input, m_msg.getPoolName());
+ auto input = cacheImpl->createDataInput(chunk, chunkLen, m_msg.getPool());
+
uint32_t partLen;
int8_t chunkType;
if ((chunkType = (TcrMessageHelper::ChunkObjectType)
@@ -3871,10 +3869,10 @@ void ChunkedRemoveAllResponse::handleChunk(const
uint8_t* chunk,
const auto byte1 = input->read();
m_msg.readSecureObjectPart(*input, false, true, isLastChunkWithSecurity);
- auto pool = cacheImpl->getPoolManager().find(m_msg.getPoolName());
+ auto pool = m_msg.getPool();
if (pool != nullptr && !pool->isDestroyed() &&
pool->getPRSingleHopEnabled()) {
- ThinClientPoolDM* poolDM = dynamic_cast<ThinClientPoolDM*>(pool.get());
+ auto poolDM = dynamic_cast<ThinClientPoolDM*>(pool);
if ((poolDM != nullptr) &&
(poolDM->getClientMetaDataService() != nullptr) && (byte0 != 0)) {
LOGFINE("enqueued region " + m_region->getFullPath() +
@@ -3894,10 +3892,10 @@ void ChunkedDurableCQListResponse::reset() {
// handles the chunk response for GETDURABLECQS_MSG_TYPE
void ChunkedDurableCQListResponse::handleChunk(const uint8_t* chunk,
- int32_t chunkLen, uint8_t,
- const CacheImpl* m_cacheImpl) {
- auto input = m_cacheImpl->createDataInput(chunk, chunkLen);
- DataInputInternal::setPoolName(*input, m_msg.getPoolName());
+ int32_t chunkLen,
+ uint8_t,
+ const CacheImpl* cacheImpl) {
+ auto input = cacheImpl->createDataInput(chunk, chunkLen, m_msg.getPool());
// read and ignore part length
input->readInt32();
diff --git a/cppcache/src/VersionedCacheableObjectPartList.cpp
b/cppcache/src/VersionedCacheableObjectPartList.cpp
index 0350aed..7d10200 100644
--- a/cppcache/src/VersionedCacheableObjectPartList.cpp
+++ b/cppcache/src/VersionedCacheableObjectPartList.cpp
@@ -45,7 +45,7 @@ void VersionedCacheableObjectPartList::readObjectPart(
if (isException) { // Exception case
// Skip the exception that is in java serialized format, we cant read it.
- input.advanceCursor(input.readArrayLen());
+ input.advanceCursor(input.readArrayLength());
const auto exMsg = input.readString(); ////4.1
std::shared_ptr<Exception> ex;
@@ -59,7 +59,7 @@ void VersionedCacheableObjectPartList::readObjectPart(
m_exceptions->emplace(keyPtr, ex);
} else if (m_serializeValues) {
// read length
- int32_t skipLen = input.readArrayLen();
+ int32_t skipLen = input.readArrayLength();
int8_t* bytes = nullptr;
if (skipLen > 0) {
// readObject
diff --git a/cppcache/src/statistics/HostStatSampler.hpp
b/cppcache/src/statistics/HostStatSampler.hpp
index df1b6cb..a43f604 100644
--- a/cppcache/src/statistics/HostStatSampler.hpp
+++ b/cppcache/src/statistics/HostStatSampler.hpp
@@ -64,8 +64,8 @@ class StatisticsManager;
* statistics. It only has the common functionalities which any sampler needs.
*/
class APACHE_GEODE_EXPORT HostStatSampler : public ACE_Task_Base,
- private NonCopyable,
- private NonAssignable {
+ private NonCopyable,
+ private NonAssignable {
public:
/*
* Constructor:
diff --git a/cppcache/src/statistics/StatArchiveWriter.hpp
b/cppcache/src/statistics/StatArchiveWriter.hpp
index e061aea..b38e422 100644
--- a/cppcache/src/statistics/StatArchiveWriter.hpp
+++ b/cppcache/src/statistics/StatArchiveWriter.hpp
@@ -139,7 +139,8 @@ class APACHE_GEODE_EXPORT StatDataOutput {
friend class StatArchiveWriter;
};
-class APACHE_GEODE_EXPORT ResourceType : private NonCopyable, private
NonAssignable {
+class APACHE_GEODE_EXPORT ResourceType : private NonCopyable,
+ private NonAssignable {
public:
ResourceType(int32_t id, const StatisticsType *type);
int32_t getId() const;
@@ -166,7 +167,8 @@ class APACHE_GEODE_EXPORT ResourceType : private
NonCopyable, private NonAssigna
* FIX : Make the class NonCopyable
*/
-class APACHE_GEODE_EXPORT ResourceInst : private NonCopyable, private
NonAssignable {
+class APACHE_GEODE_EXPORT ResourceInst : private NonCopyable,
+ private NonAssignable {
public:
ResourceInst(int32_t id, Statistics *, const ResourceType *,
StatDataOutput *);
diff --git a/cppcache/src/util/exception.hpp b/cppcache/src/util/exception.hpp
index e697789..620f21c 100644
--- a/cppcache/src/util/exception.hpp
+++ b/cppcache/src/util/exception.hpp
@@ -30,7 +30,7 @@ namespace geode {
namespace client {
extern void APACHE_GEODE_EXPORT GfErrTypeThrowException(const char* str,
- GfErrType err);
+ GfErrType err);
#define GfErrTypeToException(str, err) \
{ \
diff --git a/cppcache/test/DataInputTest.cpp b/cppcache/test/DataInputTest.cpp
index 4a32f9b..95ded92 100644
--- a/cppcache/test/DataInputTest.cpp
+++ b/cppcache/test/DataInputTest.cpp
@@ -59,8 +59,6 @@ class TestDataInput {
// NOP
}
- operator DataInput &() { return m_dataInput; }
-
void read(uint8_t *value) { *value = m_dataInput.read(); }
void read(int8_t *value) { *value = m_dataInput.read(); }
@@ -91,7 +89,7 @@ class TestDataInput {
int64_t readInt64() { return m_dataInput.readInt64(); }
- int32_t readArrayLen() { return m_dataInput.readArrayLen(); }
+ int32_t readArrayLen() { return m_dataInput.readArrayLength(); }
int64_t readUnsignedVL() { return m_dataInput.readUnsignedVL(); }
@@ -716,19 +714,6 @@ TEST_F(DataInputTest, TestSetBuffer) {
<< "Correct bytes remaining after the setting";
}
-TEST_F(DataInputTest, TestSetPoolName) {
- std::string poolName = "Das Schwimmbad";
-
- TestDataInput dataInput("123456789ABCDEF0");
- EXPECT_TRUE(DataInputInternal::getPoolName(dataInput).empty())
- << "Empty pool name before setting";
- DataInputInternal::setPoolName(dataInput, poolName);
- EXPECT_FALSE(DataInputInternal::getPoolName(dataInput).empty())
- << " pool name after setting";
- EXPECT_EQ(poolName, DataInputInternal::getPoolName(dataInput))
- << "Correct pool name after setting";
-}
-
TEST_F(DataInputTest, TestReadNullArray) {
TestDataInput dataInput("FF12345678");
diff --git a/cppcache/test/TcrMessage_unittest.cpp
b/cppcache/test/TcrMessage_unittest.cpp
index 952cc40..714e3e5 100644
--- a/cppcache/test/TcrMessage_unittest.cpp
+++ b/cppcache/test/TcrMessage_unittest.cpp
@@ -31,10 +31,11 @@ using namespace apache::geode::client;
class DataOutputUnderTest : public DataOutput {
public:
using DataOutput::DataOutput;
+ DataOutputUnderTest() : DataOutput(nullptr, nullptr) {}
protected:
virtual const SerializationRegistry &getSerializationRegistry()
- const override {
+ const override {
return m_serializationRegistry;
}
diff --git a/tests/cli/QueryHelper/CMakeLists.txt
b/tests/cli/QueryHelper/CMakeLists.txt
index 7659007..fb1c871 100644
--- a/tests/cli/QueryHelper/CMakeLists.txt
+++ b/tests/cli/QueryHelper/CMakeLists.txt
@@ -49,6 +49,7 @@ target_link_libraries(QueryWrapper
PRIVATE
c++cli
c++11
+ _WarningsAsError
)
# Makes project only reference, no .lib.
diff --git a/tests/cli/QueryHelper/QueryStringsM.cpp
b/tests/cli/QueryHelper/QueryStringsM.cpp
index 37adb61..a3cdd81 100644
--- a/tests/cli/QueryHelper/QueryStringsM.cpp
+++ b/tests/cli/QueryHelper/QueryStringsM.cpp
@@ -212,8 +212,8 @@ namespace Apache
StructSetRowCounts = gcnew array<Int32>( testData::SS_ARRAY_SIZE );
for (Int32 index = 0; index < testData::SS_ARRAY_SIZE; ++index) {
- StructSetRowCounts[ index ] =
- testData::structsetRowCounts[ index ];
+ StructSetRowCounts[ index ] = static_cast<int32_t>(
+ testData::structsetRowCounts[ index ]);
}
StructSetPQRowCounts = gcnew array<Int32>( testData::SSP_ARRAY_SIZE
);
@@ -260,8 +260,8 @@ namespace Apache
RegionQueryRowCounts = gcnew array<Int32>( testData::RQ_ARRAY_SIZE );
for (Int32 index = 0; index < testData::RQ_ARRAY_SIZE; ++index) {
- RegionQueryRowCounts[ index ] =
- testData::regionQueryRowCounts[ index ];
+ RegionQueryRowCounts[ index ] = static_cast<int32_t>(
+ testData::regionQueryRowCounts[ index ]);
}
CqResultSetQueries = gcnew array<QueryStrings^>(
--
To stop receiving notification emails like this one, please contact
[email protected].