http://git-wip-us.apache.org/repos/asf/geode/blob/fc9f1f6f/src/clicache/src/impl/ManagedTransactionListener.cpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/impl/ManagedTransactionListener.cpp b/src/clicache/src/impl/ManagedTransactionListener.cpp index 83ee192..857ba7b 100644 --- a/src/clicache/src/impl/ManagedTransactionListener.cpp +++ b/src/clicache/src/impl/ManagedTransactionListener.cpp @@ -37,15 +37,15 @@ namespace apache namespace client { - apache::geode::client::TransactionListener* ManagedTransactionListenerGeneric::create( const char* assemblyPath, - const char* factoryFunctionName ) + apache::geode::client::TransactionListener* ManagedTransactionListenerGeneric::create(const char* assemblyPath, + const char* factoryFunctionName) { try { String^ mg_assemblyPath = - Apache::Geode::Client::ManagedString::Get( assemblyPath ); + Apache::Geode::Client::ManagedString::Get(assemblyPath); String^ mg_factoryFunctionName = - Apache::Geode::Client::ManagedString::Get( factoryFunctionName ); + Apache::Geode::Client::ManagedString::Get(factoryFunctionName); String^ mg_typeName = nullptr; String^ mg_genericKey = nullptr; @@ -57,38 +57,38 @@ namespace apache int32_t commaIndx = -1; if (mg_factoryFunctionName == nullptr || - ( dotIndx = mg_factoryFunctionName->LastIndexOf( '.' ) ) < 0 ) + (dotIndx = mg_factoryFunctionName->LastIndexOf('.')) < 0) { std::string ex_str = "ManagedTransactionListenerGeneric: Factory function name '"; ex_str += factoryFunctionName; ex_str += "' does not contain type name"; - throw apache::geode::client::IllegalArgumentException( ex_str.c_str( ) ); + throw apache::geode::client::IllegalArgumentException(ex_str.c_str()); } - if ((genericsCloseIndx = mg_factoryFunctionName->LastIndexOf( '>' )) < 0 ) + if ((genericsCloseIndx = mg_factoryFunctionName->LastIndexOf('>')) < 0) { std::string ex_str = "ManagedTransactionListenerGeneric: Factory function name '"; ex_str += factoryFunctionName; ex_str += "' does not contain any generic type parameters"; - throw apache::geode::client::IllegalArgumentException( ex_str.c_str( ) ); + throw apache::geode::client::IllegalArgumentException(ex_str.c_str()); } - if ((genericsOpenIndx = mg_factoryFunctionName->LastIndexOf( '<' )) < 0 || - genericsOpenIndx > genericsCloseIndx) + if ((genericsOpenIndx = mg_factoryFunctionName->LastIndexOf('<')) < 0 || + genericsOpenIndx > genericsCloseIndx) { std::string ex_str = "ManagedTransactionListenerGeneric: Factory function name '"; ex_str += factoryFunctionName; ex_str += "' does not contain expected generic type parameters"; - throw apache::geode::client::IllegalArgumentException( ex_str.c_str( ) ); + throw apache::geode::client::IllegalArgumentException(ex_str.c_str()); } - if ((commaIndx = mg_factoryFunctionName->LastIndexOf( ',' )) < 0 || - (commaIndx < genericsOpenIndx || commaIndx > genericsCloseIndx)) + if ((commaIndx = mg_factoryFunctionName->LastIndexOf(',')) < 0 || + (commaIndx < genericsOpenIndx || commaIndx > genericsCloseIndx)) { std::string ex_str = "ManagedTransactionListenerGeneric: Factory function name '"; ex_str += factoryFunctionName; ex_str += "' does not contain expected generic type parameter comma separator"; - throw apache::geode::client::IllegalArgumentException( ex_str.c_str( ) ); + throw apache::geode::client::IllegalArgumentException(ex_str.c_str()); } StringBuilder^ typeBuilder = gcnew StringBuilder(mg_factoryFunctionName->Substring(0, genericsOpenIndx)); @@ -97,10 +97,10 @@ namespace apache mg_genericKey = mg_genericKey->Trim(); mg_genericVal = mg_factoryFunctionName->Substring(commaIndx + 1, genericsCloseIndx - commaIndx - 1); mg_genericVal = mg_genericVal->Trim(); - mg_factoryFunctionName = mg_factoryFunctionName->Substring( dotIndx + 1 ); + mg_factoryFunctionName = mg_factoryFunctionName->Substring(dotIndx + 1); Apache::Geode::Client::Log::Fine("Attempting to instantiate a [{0}<{1}, {2}>] via the [{3}] factory method.", - mg_typeName, mg_genericKey, mg_genericVal, mg_factoryFunctionName); + mg_typeName, mg_genericKey, mg_genericVal, mg_factoryFunctionName); typeBuilder->Append("`2"); mg_typeName = typeBuilder->ToString(); @@ -108,7 +108,7 @@ namespace apache Assembly^ assmb = nullptr; try { - assmb = Assembly::Load( mg_assemblyPath ); + assmb = Assembly::Load(mg_assemblyPath); } catch (System::Exception^) { @@ -118,7 +118,7 @@ namespace apache { std::string ex_str = "ManagedTransactionListenerGeneric: Could not load assembly: "; ex_str += assemblyPath; - throw apache::geode::client::IllegalArgumentException( ex_str.c_str( ) ); + throw apache::geode::client::IllegalArgumentException(ex_str.c_str()); } Apache::Geode::Client::Log::Debug("Loading type: [{0}]", mg_typeName); @@ -134,21 +134,21 @@ namespace apache if (types[0] == nullptr || types[1] == nullptr) { std::string ex_str = "ManagedTransactionListenerGeneric: Could not get both generic type argument instances"; - throw apache::geode::client::IllegalArgumentException( ex_str.c_str( ) ); + throw apache::geode::client::IllegalArgumentException(ex_str.c_str()); } typeInst = typeInst->MakeGenericType(types); Apache::Geode::Client::Log::Info("Loading function: [{0}]", mg_factoryFunctionName); - MethodInfo^ mInfo = typeInst->GetMethod( mg_factoryFunctionName, - BindingFlags::Public | BindingFlags::Static | BindingFlags::IgnoreCase ); + MethodInfo^ mInfo = typeInst->GetMethod(mg_factoryFunctionName, + BindingFlags::Public | BindingFlags::Static | BindingFlags::IgnoreCase); if (mInfo != nullptr) { Object^ userptr = nullptr; try { - userptr = mInfo->Invoke( typeInst, nullptr ); + userptr = mInfo->Invoke(typeInst, nullptr); } catch (System::Exception^ ex) { @@ -162,9 +162,9 @@ namespace apache ex_str += factoryFunctionName; ex_str += "] in assembly: "; ex_str += assemblyPath; - throw apache::geode::client::IllegalArgumentException( ex_str.c_str( ) ); + throw apache::geode::client::IllegalArgumentException(ex_str.c_str()); } - return new ManagedTransactionListenerGeneric( userptr ); + return new ManagedTransactionListenerGeneric(userptr); } else { @@ -173,17 +173,17 @@ namespace apache ex_str += factoryFunctionName; ex_str += "] in assembly: "; ex_str += assemblyPath; - throw apache::geode::client::IllegalArgumentException( ex_str.c_str( ) ); + throw apache::geode::client::IllegalArgumentException(ex_str.c_str()); } } else { - Apache::Geode::Client::ManagedString typeName( mg_typeName ); + Apache::Geode::Client::ManagedString typeName(mg_typeName); std::string ex_str = "ManagedTransactionListenerGeneric: Could not load type ["; ex_str += typeName.CharPtr; ex_str += "] in assembly: "; ex_str += assemblyPath; - throw apache::geode::client::IllegalArgumentException( ex_str.c_str( ) ); + throw apache::geode::client::IllegalArgumentException(ex_str.c_str()); } } catch (const apache::geode::client::Exception&) @@ -192,21 +192,21 @@ namespace apache } catch (System::Exception^ ex) { - Apache::Geode::Client::ManagedString mg_exStr( ex->ToString( ) ); + Apache::Geode::Client::ManagedString mg_exStr(ex->ToString()); std::string ex_str = "ManagedTransactionListenerGeneric: Got an exception while " "loading managed library: "; ex_str += mg_exStr.CharPtr; - throw apache::geode::client::IllegalArgumentException( ex_str.c_str( ) ); + throw apache::geode::client::IllegalArgumentException(ex_str.c_str()); } return NULL; } - void ManagedTransactionListenerGeneric::afterCommit(apache::geode::client::TransactionEventPtr& te ) + void ManagedTransactionListenerGeneric::afterCommit(apache::geode::client::TransactionEventPtr& te) { try { - Apache::Geode::Client::Log::Error("ManagedTransactionListenerGeneric::afterCommit in" ); - Apache::Geode::Client::TransactionEvent mevent( te.ptr() ); - m_managedptr->AfterCommit( %mevent ); - Apache::Geode::Client::Log::Error("ManagedTransactionListenerGeneric::afterCommit in" ); + Apache::Geode::Client::Log::Error("ManagedTransactionListenerGeneric::afterCommit in"); + Apache::Geode::Client::TransactionEvent mevent(te.ptr()); + m_managedptr->AfterCommit(%mevent); + Apache::Geode::Client::Log::Error("ManagedTransactionListenerGeneric::afterCommit in"); } catch (Apache::Geode::Client::GemFireException^ ex) { @@ -216,11 +216,11 @@ namespace apache Apache::Geode::Client::GemFireException::ThrowNative(ex); } } - void ManagedTransactionListenerGeneric::afterFailedCommit(apache::geode::client::TransactionEventPtr& te ) + void ManagedTransactionListenerGeneric::afterFailedCommit(apache::geode::client::TransactionEventPtr& te) { try { - Apache::Geode::Client::TransactionEvent mevent( te.ptr() ); - m_managedptr->AfterFailedCommit( %mevent ); + Apache::Geode::Client::TransactionEvent mevent(te.ptr()); + m_managedptr->AfterFailedCommit(%mevent); } catch (Apache::Geode::Client::GemFireException^ ex) { ex->ThrowNative(); @@ -229,11 +229,11 @@ namespace apache Apache::Geode::Client::GemFireException::ThrowNative(ex); } } - void ManagedTransactionListenerGeneric::afterRollback(apache::geode::client::TransactionEventPtr& te ) + void ManagedTransactionListenerGeneric::afterRollback(apache::geode::client::TransactionEventPtr& te) { try { - Apache::Geode::Client::TransactionEvent mevent( te.ptr() ); - m_managedptr->AfterRollback( %mevent ); + Apache::Geode::Client::TransactionEvent mevent(te.ptr()); + m_managedptr->AfterRollback(%mevent); } catch (Apache::Geode::Client::GemFireException^ ex) { ex->ThrowNative();
http://git-wip-us.apache.org/repos/asf/geode/blob/fc9f1f6f/src/clicache/src/impl/ManagedTransactionWriter.cpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/impl/ManagedTransactionWriter.cpp b/src/clicache/src/impl/ManagedTransactionWriter.cpp index c3f09a9..19bdf8d 100644 --- a/src/clicache/src/impl/ManagedTransactionWriter.cpp +++ b/src/clicache/src/impl/ManagedTransactionWriter.cpp @@ -38,15 +38,15 @@ namespace apache namespace client { - apache::geode::client::TransactionWriter* ManagedTransactionWriterGeneric::create( const char* assemblyPath, - const char* factoryFunctionName ) + apache::geode::client::TransactionWriter* ManagedTransactionWriterGeneric::create(const char* assemblyPath, + const char* factoryFunctionName) { try { String^ mg_assemblyPath = - Apache::Geode::Client::ManagedString::Get( assemblyPath ); + Apache::Geode::Client::ManagedString::Get(assemblyPath); String^ mg_factoryFunctionName = - Apache::Geode::Client::ManagedString::Get( factoryFunctionName ); + Apache::Geode::Client::ManagedString::Get(factoryFunctionName); String^ mg_typeName = nullptr; String^ mg_genericKey = nullptr; @@ -58,38 +58,38 @@ namespace apache int32_t commaIndx = -1; if (mg_factoryFunctionName == nullptr || - ( dotIndx = mg_factoryFunctionName->LastIndexOf( '.' ) ) < 0 ) + (dotIndx = mg_factoryFunctionName->LastIndexOf('.')) < 0) { std::string ex_str = "ManagedTransactionWriterGeneric: Factory function name '"; ex_str += factoryFunctionName; ex_str += "' does not contain type name"; - throw apache::geode::client::IllegalArgumentException( ex_str.c_str( ) ); + throw apache::geode::client::IllegalArgumentException(ex_str.c_str()); } - if ((genericsCloseIndx = mg_factoryFunctionName->LastIndexOf( '>' )) < 0 ) + if ((genericsCloseIndx = mg_factoryFunctionName->LastIndexOf('>')) < 0) { std::string ex_str = "ManagedTransactionWriterGeneric: Factory function name '"; ex_str += factoryFunctionName; ex_str += "' does not contain any generic type parameters"; - throw apache::geode::client::IllegalArgumentException( ex_str.c_str( ) ); + throw apache::geode::client::IllegalArgumentException(ex_str.c_str()); } - if ((genericsOpenIndx = mg_factoryFunctionName->LastIndexOf( '<' )) < 0 || - genericsOpenIndx > genericsCloseIndx) + if ((genericsOpenIndx = mg_factoryFunctionName->LastIndexOf('<')) < 0 || + genericsOpenIndx > genericsCloseIndx) { std::string ex_str = "ManagedTransactionWriterGeneric: Factory function name '"; ex_str += factoryFunctionName; ex_str += "' does not contain expected generic type parameters"; - throw apache::geode::client::IllegalArgumentException( ex_str.c_str( ) ); + throw apache::geode::client::IllegalArgumentException(ex_str.c_str()); } - if ((commaIndx = mg_factoryFunctionName->LastIndexOf( ',' )) < 0 || - (commaIndx < genericsOpenIndx || commaIndx > genericsCloseIndx)) + if ((commaIndx = mg_factoryFunctionName->LastIndexOf(',')) < 0 || + (commaIndx < genericsOpenIndx || commaIndx > genericsCloseIndx)) { std::string ex_str = "ManagedTransactionWriterGeneric: Factory function name '"; ex_str += factoryFunctionName; ex_str += "' does not contain expected generic type parameter comma separator"; - throw apache::geode::client::IllegalArgumentException( ex_str.c_str( ) ); + throw apache::geode::client::IllegalArgumentException(ex_str.c_str()); } StringBuilder^ typeBuilder = gcnew StringBuilder(mg_factoryFunctionName->Substring(0, genericsOpenIndx)); @@ -98,10 +98,10 @@ namespace apache mg_genericKey = mg_genericKey->Trim(); mg_genericVal = mg_factoryFunctionName->Substring(commaIndx + 1, genericsCloseIndx - commaIndx - 1); mg_genericVal = mg_genericVal->Trim(); - mg_factoryFunctionName = mg_factoryFunctionName->Substring( dotIndx + 1 ); + mg_factoryFunctionName = mg_factoryFunctionName->Substring(dotIndx + 1); Apache::Geode::Client::Log::Fine("Attempting to instantiate a [{0}<{1}, {2}>] via the [{3}] factory method.", - mg_typeName, mg_genericKey, mg_genericVal, mg_factoryFunctionName); + mg_typeName, mg_genericKey, mg_genericVal, mg_factoryFunctionName); typeBuilder->Append("`2"); mg_typeName = typeBuilder->ToString(); @@ -109,7 +109,7 @@ namespace apache Assembly^ assmb = nullptr; try { - assmb = Assembly::Load( mg_assemblyPath ); + assmb = Assembly::Load(mg_assemblyPath); } catch (System::Exception^) { @@ -119,7 +119,7 @@ namespace apache { std::string ex_str = "ManagedTransactionWriterGeneric: Could not load assembly: "; ex_str += assemblyPath; - throw apache::geode::client::IllegalArgumentException( ex_str.c_str( ) ); + throw apache::geode::client::IllegalArgumentException(ex_str.c_str()); } Apache::Geode::Client::Log::Debug("Loading type: [{0}]", mg_typeName); @@ -135,21 +135,21 @@ namespace apache if (types[0] == nullptr || types[1] == nullptr) { std::string ex_str = "ManagedTransactionWriterGeneric: Could not get both generic type argument instances"; - throw apache::geode::client::IllegalArgumentException( ex_str.c_str( ) ); + throw apache::geode::client::IllegalArgumentException(ex_str.c_str()); } typeInst = typeInst->MakeGenericType(types); Apache::Geode::Client::Log::Info("Loading function: [{0}]", mg_factoryFunctionName); - MethodInfo^ mInfo = typeInst->GetMethod( mg_factoryFunctionName, - BindingFlags::Public | BindingFlags::Static | BindingFlags::IgnoreCase ); + MethodInfo^ mInfo = typeInst->GetMethod(mg_factoryFunctionName, + BindingFlags::Public | BindingFlags::Static | BindingFlags::IgnoreCase); if (mInfo != nullptr) { Object^ userptr = nullptr; try { - userptr = mInfo->Invoke( typeInst, nullptr ); + userptr = mInfo->Invoke(typeInst, nullptr); } catch (System::Exception^ ex) { @@ -163,9 +163,9 @@ namespace apache ex_str += factoryFunctionName; ex_str += "] in assembly: "; ex_str += assemblyPath; - throw apache::geode::client::IllegalArgumentException( ex_str.c_str( ) ); + throw apache::geode::client::IllegalArgumentException(ex_str.c_str()); } - return new ManagedTransactionWriterGeneric( userptr ); + return new ManagedTransactionWriterGeneric(userptr); } else { @@ -174,17 +174,17 @@ namespace apache ex_str += factoryFunctionName; ex_str += "] in assembly: "; ex_str += assemblyPath; - throw apache::geode::client::IllegalArgumentException( ex_str.c_str( ) ); + throw apache::geode::client::IllegalArgumentException(ex_str.c_str()); } } else { - Apache::Geode::Client::ManagedString typeName( mg_typeName ); + Apache::Geode::Client::ManagedString typeName(mg_typeName); std::string ex_str = "ManagedTransactionWriterGeneric: Could not load type ["; ex_str += typeName.CharPtr; ex_str += "] in assembly: "; ex_str += assemblyPath; - throw apache::geode::client::IllegalArgumentException( ex_str.c_str( ) ); + throw apache::geode::client::IllegalArgumentException(ex_str.c_str()); } } catch (const apache::geode::client::Exception&) @@ -193,19 +193,19 @@ namespace apache } catch (System::Exception^ ex) { - Apache::Geode::Client::ManagedString mg_exStr( ex->ToString( ) ); + Apache::Geode::Client::ManagedString mg_exStr(ex->ToString()); std::string ex_str = "ManagedTransactionWriterGeneric: Got an exception while " "loading managed library: "; ex_str += mg_exStr.CharPtr; - throw apache::geode::client::IllegalArgumentException( ex_str.c_str( ) ); + throw apache::geode::client::IllegalArgumentException(ex_str.c_str()); } return NULL; } - void ManagedTransactionWriterGeneric::beforeCommit(apache::geode::client::TransactionEventPtr& te ) + void ManagedTransactionWriterGeneric::beforeCommit(apache::geode::client::TransactionEventPtr& te) { try { - Apache::Geode::Client::TransactionEvent mevent( te.ptr() ); - m_managedptr->BeforeCommit( %mevent ); + Apache::Geode::Client::TransactionEvent mevent(te.ptr()); + m_managedptr->BeforeCommit(%mevent); } catch (Apache::Geode::Client::GemFireException^ ex) { ex->ThrowNative(); http://git-wip-us.apache.org/repos/asf/geode/blob/fc9f1f6f/src/clicache/src/impl/PdxFieldType.cpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/impl/PdxFieldType.cpp b/src/clicache/src/impl/PdxFieldType.cpp index 083aa7a..04040e2 100644 --- a/src/clicache/src/impl/PdxFieldType.cpp +++ b/src/clicache/src/impl/PdxFieldType.cpp @@ -67,39 +67,39 @@ namespace Apache Int32 PdxFieldType::VarLenOffsetIndex::get() { - return m_vlOffsetIndex; + return m_vlOffsetIndex; } void PdxFieldType::VarLenOffsetIndex::set(Int32 val) { - m_vlOffsetIndex = val; + m_vlOffsetIndex = val; } Int32 PdxFieldType::RelativeOffset::get() { - return m_relativeOffset; + return m_relativeOffset; } void PdxFieldType::RelativeOffset::set(Int32 val) { - m_relativeOffset = val; - } + m_relativeOffset = val; + } - //it compares fieldname and type-id - bool PdxFieldType::Equals(Object^ otherObj) + //it compares fieldname and type-id + bool PdxFieldType::Equals(Object^ otherObj) { - if(otherObj == nullptr) + if (otherObj == nullptr) return false; PdxFieldType^ otherFieldType = dynamic_cast<PdxFieldType^>(otherObj); - if(otherFieldType == nullptr) + if (otherFieldType == nullptr) return false; - if(otherFieldType == this) + if (otherFieldType == this) return true; - if(otherFieldType->m_fieldName == m_fieldName && otherFieldType->m_typeId == m_typeId) + if (otherFieldType->m_fieldName == m_fieldName && otherFieldType->m_typeId == m_typeId) return true; return false; @@ -108,35 +108,35 @@ namespace Apache Int32 PdxFieldType::GetHashCode() { int hash = m_cachedHashcode; - if(hash == 0) + if (hash == 0) { - if(m_fieldName != nullptr) + if (m_fieldName != nullptr) { - hash = hash*31 + m_fieldName->GetHashCode(); + hash = hash * 31 + m_fieldName->GetHashCode(); } hash = hash * 31 + m_typeId; - if(hash == 0) + if (hash == 0) hash = 1; m_cachedHashcode = hash; } - + return m_cachedHashcode; } - void PdxFieldType::ToData( DataOutput^ output ) + void PdxFieldType::ToData(DataOutput^ output) { output->WriteString(m_fieldName); output->WriteInt32(m_sequenceId); output->WriteInt32(m_varLenFieldIdx); output->WriteByte(m_typeId); - + output->WriteInt32(m_relativeOffset); output->WriteInt32(m_vlOffsetIndex); output->WriteBoolean(m_isIdentityField); } - - IGFSerializable^ PdxFieldType::FromData( DataInput^ input ) + + IGFSerializable^ PdxFieldType::FromData(DataInput^ input) { m_fieldName = input->ReadString(); m_sequenceId = input->ReadInt32(); @@ -149,42 +149,42 @@ namespace Apache m_fixedSize = getFixedTypeSize(); - if(m_fixedSize != -1) - m_isVariableLengthType = false; + if (m_fixedSize != -1) + m_isVariableLengthType = false; else m_isVariableLengthType = true; - - return this; + + return this; } Int32 PdxFieldType::getFixedTypeSize() { - switch (m_typeId) - { - case PdxTypes::BYTE: - case PdxTypes::BOOLEAN: - return GemFireClassIds::BOOLEAN_SIZE; - - case PdxTypes::SHORT: - case PdxTypes::CHAR: + switch (m_typeId) + { + case PdxTypes::BYTE: + case PdxTypes::BOOLEAN: + return GeodeClassIds::BOOLEAN_SIZE; + + case PdxTypes::SHORT: + case PdxTypes::CHAR: //case apache::geode::client::GeodeTypeIds::CacheableChar: //TODO - return GemFireClassIds::CHAR_SIZE; - - case PdxTypes::INT: - case PdxTypes::FLOAT: + return GeodeClassIds::CHAR_SIZE; + + case PdxTypes::INT: + case PdxTypes::FLOAT: //case DSCODE.ENUM: - return GemFireClassIds::INTEGER_SIZE; - - case PdxTypes::LONG: - case PdxTypes::DOUBLE: - case PdxTypes::DATE: - return GemFireClassIds::LONG_SIZE; - + return GeodeClassIds::INTEGER_SIZE; + + case PdxTypes::LONG: + case PdxTypes::DOUBLE: + case PdxTypes::DATE: + return GeodeClassIds::LONG_SIZE; + default: return -1; - } // namespace Client - } // namespace Geode -} // namespace Apache + } // namespace Client + } // namespace Geode + } // namespace Apache } } http://git-wip-us.apache.org/repos/asf/geode/blob/fc9f1f6f/src/clicache/src/impl/PdxFieldType.hpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/impl/PdxFieldType.hpp b/src/clicache/src/impl/PdxFieldType.hpp index ea88ca7..aa0bcfd 100644 --- a/src/clicache/src/impl/PdxFieldType.hpp +++ b/src/clicache/src/impl/PdxFieldType.hpp @@ -20,7 +20,7 @@ using namespace System; #include "../DataOutput.hpp" #include "../DataInput.hpp" -#include "../GemFireClassIds.hpp" +#include "../GeodeClassIds.hpp" namespace Apache { @@ -49,12 +49,12 @@ namespace Apache Int32 getFixedTypeSize(); public: PdxFieldType(String^ fieldName, - String^ className, - Byte typeId, - Int32 sequenceId, - bool isVariableLengthType, - Int32 fixedSize, - Int32 varLenFieldIdx) + String^ className, + Byte typeId, + Int32 sequenceId, + bool isVariableLengthType, + Int32 fixedSize, + Int32 varLenFieldIdx) { m_cachedHashcode = 0; m_fieldName = fieldName; @@ -99,8 +99,8 @@ namespace Apache property bool IdentityField { - bool get() {return m_isIdentityField;} - void set(bool value) {m_isIdentityField = value;} + bool get() { return m_isIdentityField; } + void set(bool value) { m_isIdentityField = value; } } property Int32 Size @@ -125,26 +125,26 @@ namespace Apache void set(Int32 Value); } - virtual bool Equals(Object^ otherObj) override; - virtual Int32 GetHashCode() override; - - virtual void ToData( DataOutput^ output ); - virtual IGFSerializable^ FromData( DataInput^ input ); - virtual property uint32_t ObjectSize - { - uint32_t get( ){return 0;} - } - virtual property uint32_t ClassId - { - uint32_t get( ){return m_typeId;} - } - virtual String^ ToString( ) override - { - return "PdxFieldName:" + m_fieldName + ", TypeId: " + m_typeId + ", VarLenFieldIdx:" + m_varLenFieldIdx + ", sequenceid:" + m_sequenceId; - } + virtual bool Equals(Object^ otherObj) override; + virtual Int32 GetHashCode() override; + + virtual void ToData(DataOutput^ output); + virtual IGFSerializable^ FromData(DataInput^ input); + virtual property uint32_t ObjectSize + { + uint32_t get(){ return 0; } + } + virtual property uint32_t ClassId + { + uint32_t get(){ return m_typeId; } + } + virtual String^ ToString() override + { + return "PdxFieldName:" + m_fieldName + ", TypeId: " + m_typeId + ", VarLenFieldIdx:" + m_varLenFieldIdx + ", sequenceid:" + m_sequenceId; + } }; - } // namespace Client - } // namespace Geode -} // namespace Apache + } // namespace Client + } // namespace Geode + } // namespace Apache } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/geode/blob/fc9f1f6f/src/clicache/src/impl/PdxInstanceFactoryImpl.cpp ---------------------------------------------------------------------- diff --git a/src/clicache/src/impl/PdxInstanceFactoryImpl.cpp b/src/clicache/src/impl/PdxInstanceFactoryImpl.cpp index 640477f..8790c78 100644 --- a/src/clicache/src/impl/PdxInstanceFactoryImpl.cpp +++ b/src/clicache/src/impl/PdxInstanceFactoryImpl.cpp @@ -28,326 +28,326 @@ namespace Apache namespace Client { - namespace Internal + namespace Internal + { + PdxInstanceFactoryImpl::PdxInstanceFactoryImpl(String^ className) { - PdxInstanceFactoryImpl::PdxInstanceFactoryImpl(String^ className) - { - if(className == nullptr) - throw gcnew IllegalStateException( - "Classname should not be null."); - m_pdxType = gcnew PdxType(className, false); - m_FieldVsValues = gcnew Dictionary<String^, Object^>(); - m_created = false; - } + if (className == nullptr) + throw gcnew IllegalStateException( + "Classname should not be null."); + m_pdxType = gcnew PdxType(className, false); + m_FieldVsValues = gcnew Dictionary<String^, Object^>(); + m_created = false; + } - IPdxInstance^ PdxInstanceFactoryImpl::Create() + IPdxInstance^ PdxInstanceFactoryImpl::Create() + { + if (m_created) { - if(m_created) - { - throw gcnew IllegalStateException( - "The IPdxInstanceFactory.Create() method can only be called once."); - } - //need to get typeid; - IPdxInstance^ pi = gcnew PdxInstanceImpl(m_FieldVsValues, m_pdxType); - m_created = true; - return pi; + throw gcnew IllegalStateException( + "The IPdxInstanceFactory.Create() method can only be called once."); } + //need to get typeid; + IPdxInstance^ pi = gcnew PdxInstanceImpl(m_FieldVsValues, m_pdxType); + m_created = true; + return pi; + } - IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteChar(String^ fieldName, Char value) - { - isFieldAdded(fieldName); - m_pdxType->AddFixedLengthTypeField(fieldName, "char", PdxTypes::CHAR, GemFireClassIds::CHAR_SIZE); - m_FieldVsValues->Add(fieldName, value); - return this; - } - - IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteBoolean(String^ fieldName, Boolean value) + IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteChar(String^ fieldName, Char value) + { + isFieldAdded(fieldName); + m_pdxType->AddFixedLengthTypeField(fieldName, "char", PdxTypes::CHAR, GeodeClassIds::CHAR_SIZE); + m_FieldVsValues->Add(fieldName, value); + return this; + } + + IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteBoolean(String^ fieldName, Boolean value) + { + isFieldAdded(fieldName); + m_pdxType->AddFixedLengthTypeField(fieldName, "boolean", PdxTypes::BOOLEAN, GeodeClassIds::BOOLEAN_SIZE); + m_FieldVsValues->Add(fieldName, value); + return this; + } + + IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteByte(String^ fieldName, SByte value) + { + isFieldAdded(fieldName); + m_pdxType->AddFixedLengthTypeField(fieldName, "byte", PdxTypes::BYTE, GeodeClassIds::BYTE_SIZE); + m_FieldVsValues->Add(fieldName, value); + return this; + } + + IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteShort(String^ fieldName, Int16 value) + { + isFieldAdded(fieldName); + m_pdxType->AddFixedLengthTypeField(fieldName, "short", PdxTypes::SHORT, GeodeClassIds::SHORT_SIZE); + m_FieldVsValues->Add(fieldName, value); + return this; + } + + IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteInt(String^ fieldName, Int32 value) + { + isFieldAdded(fieldName); + m_pdxType->AddFixedLengthTypeField(fieldName, "int", PdxTypes::INT, GeodeClassIds::INTEGER_SIZE); + m_FieldVsValues->Add(fieldName, value); + return this; + } + + IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteLong(String^ fieldName, Int64 value) + { + isFieldAdded(fieldName); + m_pdxType->AddFixedLengthTypeField(fieldName, "long", PdxTypes::LONG, GeodeClassIds::LONG_SIZE); + m_FieldVsValues->Add(fieldName, value); + return this; + } + + IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteFloat(String^ fieldName, float value) + { + isFieldAdded(fieldName); + m_pdxType->AddFixedLengthTypeField(fieldName, "float", PdxTypes::FLOAT, GeodeClassIds::FLOAT_SIZE); + m_FieldVsValues->Add(fieldName, value); + return this; + } + + IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteDouble(String^ fieldName, double value) + { + isFieldAdded(fieldName); + m_pdxType->AddFixedLengthTypeField(fieldName, "double", PdxTypes::DOUBLE, GeodeClassIds::DOUBLE_SIZE); + m_FieldVsValues->Add(fieldName, value); + return this; + } + + IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteDate(String^ fieldName, System::DateTime value) + { + isFieldAdded(fieldName); + m_pdxType->AddFixedLengthTypeField(fieldName, "Date", PdxTypes::DATE, GeodeClassIds::DATE_SIZE); + m_FieldVsValues->Add(fieldName, value); + return this; + } + + IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteString(String^ fieldName, String^ value) + { + isFieldAdded(fieldName); + m_pdxType->AddVariableLengthTypeField(fieldName, "String", PdxTypes::STRING); + m_FieldVsValues->Add(fieldName, value); + return this; + } + + IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteObject(String^ fieldName, Object^ value) + { + isFieldAdded(fieldName); + m_pdxType->AddVariableLengthTypeField(fieldName, /*obj->GetType()->FullName*/"Object", PdxTypes::OBJECT); + m_FieldVsValues->Add(fieldName, value); + return this; + } + + IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteBooleanArray(String^ fieldName, array<Boolean>^ value) + { + isFieldAdded(fieldName); + m_pdxType->AddVariableLengthTypeField(fieldName, "bool[]", PdxTypes::BOOLEAN_ARRAY); + m_FieldVsValues->Add(fieldName, value); + return this; + } + + IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteCharArray(String^ fieldName, array<Char>^ value) + { + isFieldAdded(fieldName); + m_pdxType->AddVariableLengthTypeField(fieldName, "char[]", PdxTypes::CHAR_ARRAY); + m_FieldVsValues->Add(fieldName, value); + return this; + } + + IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteByteArray(String^ fieldName, array<Byte>^ value) + { + isFieldAdded(fieldName); + m_pdxType->AddVariableLengthTypeField(fieldName, "byte[]", PdxTypes::BYTE_ARRAY); + m_FieldVsValues->Add(fieldName, value); + return this; + } + + IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteShortArray(String^ fieldName, array<Int16>^ value) + { + isFieldAdded(fieldName); + m_pdxType->AddVariableLengthTypeField(fieldName, "short[]", PdxTypes::SHORT_ARRAY); + m_FieldVsValues->Add(fieldName, value); + return this; + } + + IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteIntArray(String^ fieldName, array<Int32>^ value) + { + isFieldAdded(fieldName); + m_pdxType->AddVariableLengthTypeField(fieldName, "int[]", PdxTypes::INT_ARRAY); + m_FieldVsValues->Add(fieldName, value); + return this; + } + + IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteLongArray(String^ fieldName, array<Int64>^ value) + { + isFieldAdded(fieldName); + m_pdxType->AddVariableLengthTypeField(fieldName, "long[]", PdxTypes::LONG_ARRAY); + m_FieldVsValues->Add(fieldName, value); + return this; + } + + IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteFloatArray(String^ fieldName, array<float>^ value) + { + isFieldAdded(fieldName); + m_pdxType->AddVariableLengthTypeField(fieldName, "float[]", PdxTypes::FLOAT_ARRAY); + m_FieldVsValues->Add(fieldName, value); + return this; + } + + IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteDoubleArray(String^ fieldName, array<double>^ value) + { + isFieldAdded(fieldName); + m_pdxType->AddVariableLengthTypeField(fieldName, "double[]", PdxTypes::DOUBLE_ARRAY); + m_FieldVsValues->Add(fieldName, value); + return this; + } + + IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteStringArray(String^ fieldName, array<String^>^ value) + { + isFieldAdded(fieldName); + m_pdxType->AddVariableLengthTypeField(fieldName, "String[]", PdxTypes::STRING_ARRAY); + m_FieldVsValues->Add(fieldName, value); + return this; + } + + IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteObjectArray(String^ fieldName, System::Collections::Generic::List<Object^>^ value) + { + isFieldAdded(fieldName); + m_pdxType->AddVariableLengthTypeField(fieldName, "Object[]", PdxTypes::OBJECT_ARRAY); + m_FieldVsValues->Add(fieldName, value); + return this; + } + + IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteArrayOfByteArrays(String^ fieldName, array<array<Byte>^>^ value) + { + isFieldAdded(fieldName); + m_pdxType->AddVariableLengthTypeField(fieldName, "byte[][]", PdxTypes::ARRAY_OF_BYTE_ARRAYS); + m_FieldVsValues->Add(fieldName, value); + return this; + } + + IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteField(String^ fieldName, Object^ fieldValue, Type^ type) + { + isFieldAdded(fieldName); + if (type->Equals(DotNetTypes::IntType)) { - isFieldAdded(fieldName); - m_pdxType->AddFixedLengthTypeField(fieldName, "boolean", PdxTypes::BOOLEAN, GemFireClassIds::BOOLEAN_SIZE); - m_FieldVsValues->Add(fieldName, value); - return this; + return this->WriteInt(fieldName, (int)fieldValue); } - - IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteByte(String^ fieldName, SByte value) + else if (type->Equals(DotNetTypes::StringType)) { - isFieldAdded(fieldName); - m_pdxType->AddFixedLengthTypeField(fieldName, "byte", PdxTypes::BYTE, GemFireClassIds::BYTE_SIZE); - m_FieldVsValues->Add(fieldName, value); - return this; + return this->WriteString(fieldName, (String^)fieldValue); } - - IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteShort(String^ fieldName, Int16 value) + else if (type->Equals(DotNetTypes::BooleanType)) { - isFieldAdded(fieldName); - m_pdxType->AddFixedLengthTypeField(fieldName, "short", PdxTypes::SHORT, GemFireClassIds::SHORT_SIZE); - m_FieldVsValues->Add(fieldName, value); - return this; + return this->WriteBoolean(fieldName, (bool)fieldValue); } - - IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteInt(String^ fieldName, Int32 value) + else if (type->Equals(DotNetTypes::FloatType)) { - isFieldAdded(fieldName); - m_pdxType->AddFixedLengthTypeField(fieldName, "int", PdxTypes::INT, GemFireClassIds::INTEGER_SIZE); - m_FieldVsValues->Add(fieldName, value); - return this; + return this->WriteFloat(fieldName, (float)fieldValue); } - - IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteLong(String^ fieldName, Int64 value) + else if (type->Equals(DotNetTypes::DoubleType)) { - isFieldAdded(fieldName); - m_pdxType->AddFixedLengthTypeField(fieldName, "long", PdxTypes::LONG, GemFireClassIds::LONG_SIZE); - m_FieldVsValues->Add(fieldName, value); - return this; + return this->WriteDouble(fieldName, (double)fieldValue); } - - IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteFloat(String^ fieldName, float value) + else if (type->Equals(DotNetTypes::CharType)) { - isFieldAdded(fieldName); - m_pdxType->AddFixedLengthTypeField(fieldName, "float", PdxTypes::FLOAT, GemFireClassIds::FLOAT_SIZE); - m_FieldVsValues->Add(fieldName, value); - return this; + return this->WriteChar(fieldName, (Char)fieldValue); } - - IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteDouble(String^ fieldName, double value) + else if (type->Equals(DotNetTypes::SByteType)) { - isFieldAdded(fieldName); - m_pdxType->AddFixedLengthTypeField(fieldName, "double", PdxTypes::DOUBLE, GemFireClassIds::DOUBLE_SIZE); - m_FieldVsValues->Add(fieldName, value); - return this; + return this->WriteByte(fieldName, (SByte)fieldValue); } - - IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteDate(String^ fieldName, System::DateTime value) + else if (type->Equals(DotNetTypes::ShortType)) { - isFieldAdded(fieldName); - m_pdxType->AddFixedLengthTypeField(fieldName, "Date", PdxTypes::DATE, GemFireClassIds::DATE_SIZE); - m_FieldVsValues->Add(fieldName, value); - return this; + return this->WriteShort(fieldName, (short)fieldValue); } - - IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteString(String^ fieldName, String^ value) + else if (type->Equals(DotNetTypes::LongType)) { - isFieldAdded(fieldName); - m_pdxType->AddVariableLengthTypeField(fieldName, "String", PdxTypes::STRING); - m_FieldVsValues->Add(fieldName, value); - return this; + return this->WriteLong(fieldName, (Int64)fieldValue); } - - IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteObject(String^ fieldName, Object^ value) + else if (type->Equals(DotNetTypes::ByteArrayType)) { - isFieldAdded(fieldName); - m_pdxType->AddVariableLengthTypeField(fieldName, /*obj->GetType()->FullName*/"Object", PdxTypes::OBJECT); - m_FieldVsValues->Add(fieldName, value); - return this; + return this->WriteByteArray(fieldName, (array<Byte>^)fieldValue); } - - IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteBooleanArray(String^ fieldName, array<Boolean>^ value) + else if (type->Equals(DotNetTypes::DoubleArrayType)) { - isFieldAdded(fieldName); - m_pdxType->AddVariableLengthTypeField(fieldName, "bool[]", PdxTypes::BOOLEAN_ARRAY); - m_FieldVsValues->Add(fieldName, value); - return this; + return this->WriteDoubleArray(fieldName, (array<double>^)fieldValue); } - - IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteCharArray(String^ fieldName, array<Char>^ value) + else if (type->Equals(DotNetTypes::FloatArrayType)) { - isFieldAdded(fieldName); - m_pdxType->AddVariableLengthTypeField(fieldName, "char[]", PdxTypes::CHAR_ARRAY); - m_FieldVsValues->Add(fieldName, value); - return this; + return this->WriteFloatArray(fieldName, (array<float>^)fieldValue); } - - IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteByteArray(String^ fieldName, array<Byte>^ value) + else if (type->Equals(DotNetTypes::ShortArrayType)) { - isFieldAdded(fieldName); - m_pdxType->AddVariableLengthTypeField(fieldName, "byte[]", PdxTypes::BYTE_ARRAY); - m_FieldVsValues->Add(fieldName, value); - return this; + return this->WriteShortArray(fieldName, (array<Int16>^)fieldValue); } - - IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteShortArray(String^ fieldName, array<Int16>^ value) + else if (type->Equals(DotNetTypes::IntArrayType)) { - isFieldAdded(fieldName); - m_pdxType->AddVariableLengthTypeField(fieldName, "short[]", PdxTypes::SHORT_ARRAY); - m_FieldVsValues->Add(fieldName, value); - return this; + return this->WriteIntArray(fieldName, (array<int32>^)fieldValue); } - - IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteIntArray(String^ fieldName, array<Int32>^ value) + else if (type->Equals(DotNetTypes::LongArrayType)) { - isFieldAdded(fieldName); - m_pdxType->AddVariableLengthTypeField(fieldName, "int[]", PdxTypes::INT_ARRAY); - m_FieldVsValues->Add(fieldName, value); - return this; + return this->WriteLongArray(fieldName, (array<Int64>^)fieldValue); } - - IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteLongArray(String^ fieldName, array<Int64>^ value) + else if (type->Equals(DotNetTypes::BoolArrayType)) { - isFieldAdded(fieldName); - m_pdxType->AddVariableLengthTypeField(fieldName, "long[]", PdxTypes::LONG_ARRAY); - m_FieldVsValues->Add(fieldName, value); - return this; + return this->WriteBooleanArray(fieldName, (array<bool>^)fieldValue); } - - IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteFloatArray(String^ fieldName, array<float>^ value) + else if (type->Equals(DotNetTypes::CharArrayType)) { - isFieldAdded(fieldName); - m_pdxType->AddVariableLengthTypeField(fieldName, "float[]", PdxTypes::FLOAT_ARRAY); - m_FieldVsValues->Add(fieldName, value); - return this; + return this->WriteCharArray(fieldName, (array<Char>^)fieldValue); } - - IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteDoubleArray(String^ fieldName, array<double>^ value) + else if (type->Equals(DotNetTypes::StringArrayType)) { - isFieldAdded(fieldName); - m_pdxType->AddVariableLengthTypeField(fieldName, "double[]", PdxTypes::DOUBLE_ARRAY); - m_FieldVsValues->Add(fieldName, value); - return this; + return this->WriteStringArray(fieldName, (array<String^>^)fieldValue); } - - IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteStringArray(String^ fieldName, array<String^>^ value) + else if (type->Equals(DotNetTypes::DateType)) { - isFieldAdded(fieldName); - m_pdxType->AddVariableLengthTypeField(fieldName, "String[]", PdxTypes::STRING_ARRAY); - m_FieldVsValues->Add(fieldName, value); - return this; + return this->WriteDate(fieldName, (DateTime)fieldValue); } - - IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteObjectArray(String^ fieldName, System::Collections::Generic::List<Object^>^ value) + else if (type->Equals(DotNetTypes::ByteArrayOfArrayType)) { - isFieldAdded(fieldName); - m_pdxType->AddVariableLengthTypeField(fieldName, "Object[]", PdxTypes::OBJECT_ARRAY); - m_FieldVsValues->Add(fieldName, value); - return this; + return this->WriteArrayOfByteArrays(fieldName, (array<array<Byte>^>^)fieldValue); } - - IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteArrayOfByteArrays(String^ fieldName, array<array<Byte>^>^ value) + else if (type->Equals(DotNetTypes::ObjectArrayType)) { - isFieldAdded(fieldName); - m_pdxType->AddVariableLengthTypeField(fieldName, "byte[][]", PdxTypes::ARRAY_OF_BYTE_ARRAYS); - m_FieldVsValues->Add(fieldName, value); - return this; + return this->WriteObjectArray(fieldName, safe_cast<System::Collections::Generic::List<Object^>^>(fieldValue)); } - - IPdxInstanceFactory^ PdxInstanceFactoryImpl::WriteField(String^ fieldName, Object^ fieldValue, Type^ type) + else { - isFieldAdded(fieldName); - if(type->Equals(DotNetTypes::IntType)) - { - return this->WriteInt(fieldName, (int)fieldValue); - } - else if(type->Equals(DotNetTypes::StringType)) - { - return this->WriteString(fieldName, (String^)fieldValue); - } - else if(type->Equals(DotNetTypes::BooleanType)) - { - return this->WriteBoolean(fieldName, (bool)fieldValue); - } - else if(type->Equals(DotNetTypes::FloatType)) - { - return this->WriteFloat(fieldName, (float)fieldValue); - } - else if(type->Equals(DotNetTypes::DoubleType)) - { - return this->WriteDouble(fieldName, (double)fieldValue); - } - else if(type->Equals(DotNetTypes::CharType)) - { - return this->WriteChar(fieldName, (Char)fieldValue); - } - else if(type->Equals(DotNetTypes::SByteType)) - { - return this->WriteByte(fieldName, (SByte)fieldValue); - } - else if(type->Equals(DotNetTypes::ShortType)) - { - return this->WriteShort(fieldName, (short)fieldValue); - } - else if(type->Equals(DotNetTypes::LongType)) - { - return this->WriteLong(fieldName, (Int64)fieldValue); - } - else if(type->Equals(DotNetTypes::ByteArrayType)) - { - return this->WriteByteArray(fieldName, (array<Byte>^)fieldValue); - } - else if(type->Equals(DotNetTypes::DoubleArrayType)) - { - return this->WriteDoubleArray(fieldName, (array<double>^)fieldValue); - } - else if(type->Equals(DotNetTypes::FloatArrayType)) - { - return this->WriteFloatArray(fieldName, (array<float>^)fieldValue); - } - else if(type->Equals(DotNetTypes::ShortArrayType)) - { - return this->WriteShortArray(fieldName, (array<Int16>^)fieldValue); - } - else if(type->Equals(DotNetTypes::IntArrayType)) - { - return this->WriteIntArray(fieldName, (array<int32>^)fieldValue); - } - else if(type->Equals(DotNetTypes::LongArrayType)) - { - return this->WriteLongArray(fieldName, (array<Int64>^)fieldValue); - } - else if(type->Equals(DotNetTypes::BoolArrayType)) - { - return this->WriteBooleanArray(fieldName, (array<bool>^)fieldValue); - } - else if(type->Equals(DotNetTypes::CharArrayType)) - { - return this->WriteCharArray(fieldName, (array<Char>^)fieldValue); - } - else if(type->Equals(DotNetTypes::StringArrayType)) - { - return this->WriteStringArray(fieldName, (array<String^>^)fieldValue); - } - else if(type->Equals(DotNetTypes::DateType)) - { - return this->WriteDate(fieldName, (DateTime)fieldValue); - } - else if(type->Equals(DotNetTypes::ByteArrayOfArrayType)) - { - return this->WriteArrayOfByteArrays(fieldName, (array<array<Byte>^>^)fieldValue); - } - else if(type->Equals(DotNetTypes::ObjectArrayType)) - { - return this->WriteObjectArray(fieldName, safe_cast<System::Collections::Generic::List<Object^>^>(fieldValue)); - } - else - { - return this->WriteObject(fieldName, fieldValue); - //throw gcnew IllegalStateException("WriteField unable to serialize " - // + fieldName + " of " + type); - } - // return this; + return this->WriteObject(fieldName, fieldValue); + //throw gcnew IllegalStateException("WriteField unable to serialize " + // + fieldName + " of " + type); } - - IPdxInstanceFactory^ PdxInstanceFactoryImpl::MarkIdentityField(String^ fieldName) - { - PdxFieldType^ pft = m_pdxType->GetPdxField(fieldName); + // return this; + } - if(pft == nullptr) - { - throw gcnew IllegalStateException( - "Field must be added before calling MarkIdentityField "); - } + IPdxInstanceFactory^ PdxInstanceFactoryImpl::MarkIdentityField(String^ fieldName) + { + PdxFieldType^ pft = m_pdxType->GetPdxField(fieldName); - pft->IdentityField = true; - return this; + if (pft == nullptr) + { + throw gcnew IllegalStateException( + "Field must be added before calling MarkIdentityField "); } - void PdxInstanceFactoryImpl::isFieldAdded(String^ fieldName) + pft->IdentityField = true; + return this; + } + + void PdxInstanceFactoryImpl::isFieldAdded(String^ fieldName) + { + if (fieldName == nullptr || fieldName->Length == 0 || m_FieldVsValues->ContainsKey(fieldName)) { - if(fieldName == nullptr || fieldName->Length == 0 || m_FieldVsValues->ContainsKey(fieldName)) - { - throw gcnew IllegalStateException( - "Field: " + fieldName + " either already added into PdxInstanceFactory or it is null"); - } // namespace Client - } // namespace Geode -} // namespace Apache + throw gcnew IllegalStateException( + "Field: " + fieldName + " either already added into PdxInstanceFactory or it is null"); + } // namespace Client + } // namespace Geode + } // namespace Apache } }