http://git-wip-us.apache.org/repos/asf/geode-native/blob/7c7f73cc/src/pdxautoserializer/impl/Main.cpp ---------------------------------------------------------------------- diff --git a/src/pdxautoserializer/impl/Main.cpp b/src/pdxautoserializer/impl/Main.cpp deleted file mode 100644 index 42e651f..0000000 --- a/src/pdxautoserializer/impl/Main.cpp +++ /dev/null @@ -1,462 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "../base_types.hpp" -#include "../InputParserFactory.hpp" -#include "../CodeGeneratorFactory.hpp" -#include "../CodeGenerator.hpp" -#include "Log.hpp" -#include "Helper.hpp" -#include <iostream> - -/** -* @namespace apache::geode::client::pdx_auto_serializer The namespace containing -* the -* auto-serializer classes. -*/ -using namespace apache::geode::client::pdx_auto_serializer; - -/** The name used for invocation of the program on command-line. */ -std::string progName; -/** The parser factory object. */ -InputParserFactory parserFactory; -/** The code generator factory object. */ -CodeGeneratorFactory generatorFactory; -/** The parser returned by the parser factory. */ -InputParser* parser = NULL; -/** The list of classes given by the parser. */ -ASClassVector classes; -/** The <code>CodeGenerator</code> object returned by the factory. */ -CodeGenerator* codeGenerator = NULL; -/** -* The options with their usage for the tool with current parser and -* code generator. -*/ -OptionMap toolOptions; - -/** Name of this module. */ -static std::string ModuleName = "PdxAutoSerializer"; - -/** -* The option used to specify the language of the code to be auto-serialized. -*/ -static const std::string LanguageOption = "language"; - -/** -* The option used to specify the language in which the auto-serialized code -* is to be generated. -*/ -static const std::string GeneratorOption = "generator"; - -/** The option name for class name. */ -static const std::string ClassNameOption = "className"; - -/** The option name for class name String */ -static const std::string getClassNameOption = "classNameStr"; - -/** The option used to obtain usage information. */ -static const std::string UsageOption = "usage"; - -/** The option for help -- gives same output as usage for now. */ -static const std::string HelpOption = "help"; - -/** the option for directory to generate auto-generated files */ -static const std::string outDirectoryOption = "outDir"; - -/** Fill in the default top-level options required for the tool. */ -void addMainOptions(); - -/** -* Parse the command-line and get the resource names and the properties. -* -* @param argc The number of command-line arguments. -* @param argv The string array containing the command-line arguments. -* @param resources The names of the resources. -* @param properties Output parameter containing the properties as a map. -*/ -void parseCommandLine(int argc, char** argv, StringVector& resources, - PropertyMap& properties); - -/** -* Show the program usage. If any language/generator has been selected then -* its options are also shown. -*/ -void showUsage(); - -/** Cleanly destroy all the global objects. */ -void cleanupObjects(); - -/** Cleanup any files or other artifacts in case of abnormal exit. */ -void cleanup(); - -/** -* The main entry point of the tool. -* -* @param argc The number of command-line arguments. -* @param argv The string array containing the command-line arguments. -*/ - -static void Tokenize(const std::string& str, std::vector<std::string>& tokens, - const std::string& delimiters = " ") { - std::string::size_type lastPos = str.find_first_not_of(delimiters, 0); - std::string::size_type pos = str.find_first_of(delimiters, lastPos); - while (std::string::npos != pos || std::string::npos != lastPos) { - tokens.push_back(str.substr(lastPos, pos - lastPos)); - lastPos = str.find_first_not_of(delimiters, pos); - pos = str.find_first_of(delimiters, lastPos); - } -} -int main(int argc, char** argv) { - bool success = false; - struct CleanUp { - private: - bool& m_success; - - public: - explicit CleanUp(bool& success) : m_success(success) {} - ~CleanUp() { - if (m_success) { - cleanupObjects(); - } else { - cleanup(); - } - } - } cleanOnExit(success); - - try { - StringVector resources; - PropertyMap properties; - const std::string languageString = "C++"; - const std::string generatorString = "C++"; - StringVector classNames; - - progName = argv[0]; - std::string::size_type baseIndex = progName.find_last_of("/\\"); - if (baseIndex != std::string::npos) { - progName = progName.substr(baseIndex + 1); - } - addMainOptions(); - parseCommandLine(argc, argv, resources, properties); - std::map<std::string, std::string> classNameStringMap; - - try { - if (languageString.length() > 0 && - (parser = parserFactory.getInstance(languageString)) == NULL) { - throw std::invalid_argument("No such language: " + languageString); - } - - if (generatorString.length() > 0 && - (codeGenerator = generatorFactory.getInstance(generatorString)) == - NULL) { - throw std::invalid_argument("No such code generator: " + - generatorString); - } - - if (parser != NULL) { - parser->getOptions(toolOptions); - } - if (codeGenerator != NULL) { - codeGenerator->getOptions(toolOptions); - } - - std::string usageString; - if (Helper::getSingleProperty(properties, UsageOption, usageString) || - Helper::getSingleProperty(properties, HelpOption, usageString)) { - showUsage(); - return 0; - } - - if (parser == NULL) { - throw std::invalid_argument("No input language specified."); - } - if (codeGenerator == NULL) { - throw std::invalid_argument("No output language specified."); - } - if (resources.size() == 0) { - throw std::invalid_argument("No input resources specified."); - } - - if (!Helper::getMultiProperty(properties, ClassNameOption, classNames) || - classNames.size() == 0) { - Log::warn(ModuleName, - "No class name specified; " - "will serialize all classes."); - } - - std::string classNameString; - - std::vector<std::string> classNameStringVector; - - Helper::getMultiProperty(properties, getClassNameOption, - classNameStringVector); - for (std::vector<std::string>::iterator itr = - classNameStringVector.begin(); - itr != classNameStringVector.end(); ++itr) { - std::vector<std::string> eachClassNameVector; - Tokenize(*itr, eachClassNameVector, ":"); - if (eachClassNameVector.size() == 2) { - classNameStringMap.insert(std::pair<std::string, std::string>( - eachClassNameVector[0], eachClassNameVector[1])); - } else { - throw std::invalid_argument("No input class name string specified."); - } - } - - parser->init(properties); - parser->selectClasses(resources, classNames); - parser->getSelectedClasses(classes); - - codeGenerator->init(properties); - - } catch (const std::exception& ex) { - std::cerr << Helper::typeName(ex) << ": " << ex.what() << std::endl; - std::cerr << "Use --help or --usage option for help" << std::endl; - return 1; - } - - if (properties.size() > 0) { - showUsage(); - return 1; - } - - Log::info(ModuleName, "Classes being serialized:"); - for (ASClassVector::const_iterator classIterator = classes.begin(); - classIterator != classes.end(); ++classIterator) { - Log::info(ModuleName, '\t' + (*classIterator)->getName()); - } - - for (ASClassVector::const_iterator classIterator = classes.begin(); - classIterator != classes.end(); ++classIterator) { - ReferenceVector references; - TypeInfo classInfo; - VariableVector members; - std::string varName = "__var"; - - const ClassInfo* currentClass = *classIterator; - - try { - currentClass->getTypeInfo(classInfo); - codeGenerator->initClass(classInfo); - } catch (const std::exception& ex) { - std::cerr << Helper::typeName(ex) << ": " << ex.what() << std::endl; - std::cerr << "Use --help or --usage option for help" << std::endl; - return 1; - } - - currentClass->getReferences(references); - currentClass->getMembers(members); - - codeGenerator->addFileHeader(argc, argv); - codeGenerator->addReferences(references); - codeGenerator->startClass(members); - - std::vector<CodeGenerator::Method::Type> methods; - methods.push_back(CodeGenerator::Method::TODATA); - methods.push_back(CodeGenerator::Method::FROMDATA); - for (size_t index = 0; index < methods.size(); ++index) { - CodeGenerator::Method::Type method = methods[index]; - codeGenerator->startMethod(method, varName, - currentClass->getMethodPrefix()); - // Adding try block - // Ticket #905 Changes starts here - codeGenerator->addTryBlockStart(method); - // Ticket #905 Changes ends here - for (VariableVectorIterator memberIterator = members.begin(); - memberIterator != members.end(); ++memberIterator) { - codeGenerator->genMethod(method, varName, *memberIterator); - } - // Finish try block - // Ticket #905 Changes starts here - codeGenerator->finishTryBlock(method); - // Ticket #905 Changes ends here - codeGenerator->endMethod(method, varName); - } - codeGenerator->genClassNameMethod(classNameStringMap, - currentClass->getMethodPrefix()); - codeGenerator->genCreateDeserializable(currentClass->getMethodPrefix()); - codeGenerator->genTypeId(currentClass->getMethodPrefix()); - codeGenerator->endClass(); - } - } catch (const std::invalid_argument& ex) { - std::cerr << "Use --help or --usage option for help" << std::endl; - return 1; - } catch (const std::exception& ex) { - std::cerr << Helper::typeName(ex) << ": " << ex.what() << std::endl; - return 1; - } catch (...) { - std::cerr << "Caught an unknown exception." << std::endl; - return 1; - } - success = true; - return 0; -} - -void addMainOptions() { - std::pair<bool, std::string> optionPair; - // std::string languageStr; - // StringVector languages = parserFactory.getParsers(); - // assert(languages.size() > 0); - // StringVectorIterator languageIterator = languages.begin(); - // languageStr = *languageIterator; - // while (++languageIterator != languages.end()) { - // languageStr += ',' + *languageIterator; - //} - // optionPair.first = true; - ///*optionPair.second = "Generate code for the given language " - // "-- one of " + languageStr + " (SINGLE)"; - // toolOptions[LanguageOption] = optionPair;*/ - - // std::string generatorStr; - // StringVector generators = generatorFactory.getGenerators(); - // assert(generators.size() > 0); - // StringVectorIterator generatorIterator = generators.begin(); - // generatorStr = *generatorIterator; - // while (++generatorIterator != generators.end()) { - // generatorStr += ',' + *generatorIterator; - //} - /*optionPair.second = "Generate code in the given generator " - "-- one of " + generatorStr + " (SINGLE)"; - toolOptions[GeneratorOption] = optionPair;*/ - - optionPair.first = true; - optionPair.second = - "Name of the class for which to generate " - "auto-serialization code (MULTIPLE,OPTIONAL)"; - toolOptions[ClassNameOption] = optionPair; - - optionPair.first = false; - optionPair.second = (std::string) "\t\tThis usage message."; - toolOptions[UsageOption] = optionPair; - - optionPair.first = false; - optionPair.second = (std::string) "\t\tThis help message."; - toolOptions[HelpOption] = optionPair; - - optionPair.first = true; - optionPair.second = (std::string) "Name of the class in string representation" - "(MULTIPLE,OPTIONAL)"; - toolOptions[getClassNameOption] = optionPair; - - optionPair.first = false; - optionPair.second = (std::string) "\tName of the directory where auto-generated" - "files will be written, default is current working directory"; - toolOptions[outDirectoryOption] = optionPair; -} - -void parseCommandLine(int argc, char** argv, StringVector& resources, - PropertyMap& properties) { - if (argc < 2) { - throw std::invalid_argument(""); - } - for (int propertyIndex = 1; propertyIndex < argc; propertyIndex++) { - char* arg = argv[propertyIndex]; - if (arg[0] == '-' && arg[1] == '-') { - // Is a property value option. - std::string prop = arg + 2; - std::string propertyName; - std::string propertyValue; - std::string::size_type valPos; - if ((valPos = prop.find('=')) != std::string::npos) { - propertyName = prop.substr(0, valPos); - propertyValue = prop.substr(valPos + 1); - } else { - propertyName = prop; - } - PropertyMap::iterator propertyFind = properties.find(propertyName); - if (propertyFind == properties.end()) { - StringVector propertyValues; - if (propertyValue.length() > 0) { - propertyValues.push_back(propertyValue); - } - properties[propertyName] = propertyValues; - } else if (propertyValue.length() > 0) { - propertyFind->second.push_back(propertyValue); - } - } else { - resources.push_back(arg); - } - } -} - -void showUsage() { - std::cout << "Usage: " << progName << " [OPTIONS] <resources e.g. " - "header> ...\n\n"; - - std::cout << "Resource name should be the path to the header " - "containing the classes to be auto-serialized.\n\n"; - std::cout - << "Options may be one of those given below.\nSINGLE denotes " - "that the option should be specified only once.\nMULTIPLE denotes " - "that the " - "option can be specified more than once.\nOPTIONAL denotes that the " - "option may be skipped in which case the default for that shall be " - "chosen."; - std::cout << '\n' << std::endl; - for (OptionMap::const_iterator optionIterator = toolOptions.begin(); - optionIterator != toolOptions.end(); ++optionIterator) { - std::cout << "--" << optionIterator->first; - if (optionIterator->second.first) { - std::cout << "=VALUE"; - } - std::cout << '\t' << optionIterator->second.second << '\n'; - } - std::cout << std::endl; - - std::cout << "Examples:" << std::endl; - std::cout << "\t pdxautoserializer -outDir=<DIR NAME> <RESOURCE>" - << std::endl; - std::cout - << "\t pdxautoserializer -outDir=<DIR NAME> --className=<CLASSNAME1> "; - std::cout << "--className=<CLASSNAME2> <RESOURCE>" << std::endl; - std::cout << "\t pdxautoserializer -outDir=<DIR NAME> " - "--classNameStr=<CLASSNAME1:User defined String> "; - std::cout << "--classNameStr=<CLASSNAME:User defined String> <RESOURCE>" - << std::endl - << std::endl; - std::cout << "Helper Macros to be defined in Input Header File : " - << std::endl; - std::cout << "GFINCLUDE\t for including a specific member for serialization" - << std::endl; - std::cout << "GFEXCLUDE\t for excluding a specific member for serialization" - << std::endl; - std::cout << "GFID\t\t for considering a member as Identify Field" - << std::endl; - std::cout << "GFARRAYSIZE\t for specifying a array length member" - << std::endl; - std::cout << "GFIGNORE\t for ignoring certain keywords" << std::endl; - std::cout << "For more details refer to documentation on this utility." - << std::endl; -} - -void cleanupObjects() { - Helper::deleteASClasses(classes); - if (parser != NULL) { - delete parser; - parser = NULL; - } - if (codeGenerator != NULL) { - delete codeGenerator; - codeGenerator = NULL; - } -} - -void cleanup() { - if (codeGenerator != NULL) { - codeGenerator->cleanup(); - } - cleanupObjects(); -}
http://git-wip-us.apache.org/repos/asf/geode-native/blob/7c7f73cc/src/tests/cpp/pdxautoserializerclass/AutoPdxVersioned1.cpp ---------------------------------------------------------------------- diff --git a/src/tests/cpp/pdxautoserializerclass/AutoPdxVersioned1.cpp b/src/tests/cpp/pdxautoserializerclass/AutoPdxVersioned1.cpp deleted file mode 100644 index 95ce61f..0000000 --- a/src/tests/cpp/pdxautoserializerclass/AutoPdxVersioned1.cpp +++ /dev/null @@ -1,466 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "AutoPdxVersioned1.hpp" - -using namespace apache::geode::client; -using namespace AutoPdxTests; - -template <typename T1, typename T2> -bool AutoPdxVersioned1::genericValCompare(T1 value1, T2 value2) const { - if (value1 != value2) return false; - LOGINFO("PdxObject::genericValCompare Line_19"); - return true; -} - -template <typename T1, typename T2> -bool AutoPdxVersioned1::genericCompare(T1* value1, T2* value2, - int length) const { - int i = 0; - while (i < length) { - if (value1[i] != value2[i]) { - return false; - } else { - i++; - } - } - LOGINFO("PdxObject::genericCompare Line_34"); - return true; -} - -template <typename T1, typename T2> -bool AutoPdxVersioned1::generic2DCompare(T1** value1, T2** value2, int length, - int* arrLengths) const { - LOGINFO("generic2DCompare length = %d ", length); - LOGINFO("generic2DCompare value1 = %d \t value2", value1[0][0], value2[0][0]); - LOGINFO("generic2DCompare value1 = %d \t value2", value1[1][0], value2[1][0]); - LOGINFO("generic2DCompare value1 = %d \t value2", value1[1][1], value2[1][1]); - for (int j = 0; j < length; j++) { - LOGINFO("generic2DCompare arrlength0 = %d ", arrLengths[j]); - for (int k = 0; k < arrLengths[j]; k++) { - LOGINFO("generic2DCompare arrlength = %d ", arrLengths[j]); - LOGINFO("generic2DCompare value1 = %d \t value2 = %d ", value1[j][k], - value2[j][k]); - if (value1[j][k] != value2[j][k]) return false; - } - } - LOGINFO("PdxObject::genericCompare Line_34"); - return true; -} - -AutoPdxVersioned1::AutoPdxVersioned1(const char* key) { init(key); } - -void AutoPdxVersioned1::init(const char* key) { - m_char = 'C'; - m_bool = true; - m_byte = 0x74; - m_sbyte = 0x67; - m_int16 = 0xab; - m_uint16 = 0x2dd5; - m_int32 = 0x2345abdc; - // m_uint32 = 0x2a65c434; - // m_long = 324897980; - m_ulong = 238749898; - m_float = 23324.324f; - m_double = 3243298498.00; - size_t len = strlen("PdxVersioned ") + strlen(key) + 1; - m_string = new char[len]; - strcpy(m_string, "PdxVersioned "); - strcat(m_string, key); - m_boolArray = new bool[3]; - m_boolArray[0] = true; - m_boolArray[1] = false; - m_boolArray[2] = true; - /*for(int i=0; i<3; i++){ - m_boolArray[i] = true; - };*/ - - m_byteArray = new int8_t[2]; - m_byteArray[0] = 0x34; - m_byteArray[1] = 0x64; - - m_sbyteArray = new int8_t[2]; - m_sbyteArray[0] = 0x34; - m_sbyteArray[1] = 0x64; - - m_charArray = new wchar_t[2]; - m_charArray[0] = L'c'; - m_charArray[1] = L'v'; - - int64_t d = 1310447869154L; - m_date = CacheableDate::create(CacheableDate::duration(d)); - - m_int16Array = new int16_t[2]; - m_int16Array[0] = 0x2332; - m_int16Array[1] = 0x4545; - - m_uint16Array = new int16_t[2]; - m_uint16Array[0] = 0x3243; - m_uint16Array[1] = 0x3232; - - m_int32Array = new int32_t[4]; - m_int32Array[0] = 23; - m_int32Array[1] = 676868; - m_int32Array[2] = 34343; - m_int32Array[3] = 2323; - - m_uint32Array = new int32_t[4]; - m_uint32Array[0] = 435; - m_uint32Array[1] = 234324; - m_uint32Array[2] = 324324; - m_uint32Array[3] = 23432432; - - m_longArray = new int64_t[2]; - m_longArray[0] = 324324L; - m_longArray[1] = 23434545L; - - m_ulongArray = new int64_t[2]; - m_ulongArray[0] = 3245435; - m_ulongArray[1] = 3425435; - - m_floatArray = new float[2]; - m_floatArray[0] = 232.565f; - m_floatArray[1] = 2343254.67f; - - m_doubleArray = new double[2]; - m_doubleArray[0] = 23423432; - m_doubleArray[1] = 4324235435.00; - - m_byteByteArray = new int8_t*[3]; - // for(int i=0; i<2; i++){ - // m_byteByteArray[i] = new int8_t[1]; - //} - m_byteByteArray[0] = new int8_t[1]; - m_byteByteArray[1] = new int8_t[2]; - m_byteByteArray[2] = new int8_t[2]; - m_byteByteArray[0][0] = 0x23; - m_byteByteArray[1][0] = 0x34; - m_byteByteArray[1][1] = 0x55; - m_byteByteArray[2][0] = 0x24; - m_byteByteArray[2][1] = 0x26; - - m_stringArray = new char*[2]; - const char* str1 = (char*)"one"; - const char* str2 = (char*)"two"; - - int size = static_cast<int>(strlen(str1)); - for (int i = 0; i < 2; i++) { - m_stringArray[i] = new char[size]; - } - m_stringArray[0] = const_cast<char*>(str1); - m_stringArray[1] = const_cast<char*>(str2); - - m_arraylist = CacheableArrayList::create(); - m_arraylist->push_back(CacheableInt32::create(1)); - m_arraylist->push_back(CacheableInt32::create(2)); - - m_map = CacheableHashMap::create(); - m_map->insert(CacheableInt32::create(1), CacheableInt32::create(1)); - m_map->insert(CacheableInt32::create(2), CacheableInt32::create(2)); - m_pdxEnum = CacheableEnum::create("pdxEnumTest", "pdx2", pdx2); - m_byte252 = new int8_t[252]; - for (int i = 0; i < 252; i++) { - m_byte252[i] = 0; - } - - m_byte253 = new int8_t[253]; - for (int i = 0; i < 253; i++) { - m_byte253[i] = 0; - } - - m_byte65535 = new int8_t[65535]; - for (int i = 0; i < 65535; i++) { - m_byte65535[i] = 0; - } - - m_byte65536 = new int8_t[65536]; - for (int i = 0; i < 65536; i++) { - m_byte65536[i] = 0; - } - - /*for (int32_t index = 0; index <3; ++index) { - m_objectArray->push_back(objectArray[index]); - }*/ - /* - if (keys.size() > 0) { - m_objectArray = CacheableObjectArray::create(); - for (int32_t index = 0; index < keys.size(); ++index) { - m_objectArray->push_back(keys.operator[](index)); - } - }*/ - - boolArrayLen = 3; - byteArrayLen = 2; - shortArrayLen = uint16Array = int16Array = 2; - intArrayLen = uintArrayLen = 4; - longArrayLen = ulongArrayLen = 2; - doubleArrayLen = 2; - floatArrayLen = 2; - strLenArray = 2; - charArrayLen = 2; - byteByteArrayLen = 3; - m_byte252Len = 252; - m_byte253Len = 253; - m_byte65535Len = 65535; - m_byte65536Len = 65536; - lengthArr = new int[3]; - - lengthArr[0] = 1; - lengthArr[1] = 2; - lengthArr[2] = 2; -} - -CacheableStringPtr AutoPdxVersioned1::toString() const { - char idbuf[1024]; - // sprintf(idbuf,"PdxObject: [ m_bool=%d ] [m_byte=%d] [m_int16=%d] - // [m_int32=%d] [m_float=%f] [m_double=%lf] [ m_string=%s ]",m_bool, m_byte, - // m_int16, m_int32, m_float, m_double, m_string); - // sprintf(idbuf,"PdxObject testObject:[m_int32=%d] string = %s", - // m_int32,m_string); - sprintf(idbuf, "PdxVersioned 1 : %s", m_string); - return CacheableString::create(idbuf); -} - -bool AutoPdxVersioned1::equals(AutoPdxVersioned1& other, - bool isPdxReadSerialized) const { - AutoPdxVersioned1* ot = dynamic_cast<AutoPdxVersioned1*>(&other); - if (ot == NULL) { - return false; - } - if (ot == this) { - return true; - } - genericValCompare(ot->m_int32, m_int32); - genericValCompare(ot->m_bool, m_bool); - genericValCompare(ot->m_byte, m_byte); - genericValCompare(ot->m_int16, m_int16); - // genericValCompare(ot->m_long, m_long); - genericValCompare(ot->m_float, m_float); - genericValCompare(ot->m_double, m_double); - genericValCompare(ot->m_sbyte, m_sbyte); - genericValCompare(ot->m_uint16, m_uint16); - // genericValCompare(ot->m_uint32, m_uint32); - genericValCompare(ot->m_ulong, m_ulong); - genericValCompare(ot->m_char, m_char); - if (strcmp(ot->m_string, m_string) != 0) { - return false; - } - genericCompare(ot->m_byteArray, m_byteArray, byteArrayLen); - genericCompare(ot->m_int16Array, m_int16Array, shortArrayLen); - genericCompare(ot->m_int32Array, m_int32Array, intArrayLen); - genericCompare(ot->m_longArray, m_longArray, longArrayLen); - genericCompare(ot->m_doubleArray, m_doubleArray, doubleArrayLen); - genericCompare(ot->m_floatArray, m_floatArray, floatArrayLen); - genericCompare(ot->m_uint32Array, m_uint32Array, uintArrayLen); - genericCompare(ot->m_ulongArray, m_ulongArray, ulongArrayLen); - genericCompare(ot->m_uint16Array, m_uint16Array, shortArrayLen); - genericCompare(ot->m_sbyteArray, m_sbyteArray, shortArrayLen); - genericCompare(ot->m_charArray, m_charArray, charArrayLen); - // generic2DCompare(ot->m_byteByteArray, m_byteByteArray, byteByteArrayLen, - // lengthArr); - - // CacheableEnumPtr myenum = dynCast<CacheableEnumPtr>(m_pdxEnum); - // CacheableEnumPtr otenum = dynCast<CacheableEnumPtr>(ot->m_pdxEnum); - // if (myenum->getEnumOrdinal() != otenum->getEnumOrdinal()) return false; - // if (strcmp(myenum->getEnumClassName(), otenum->getEnumClassName()) != 0) - // return false; - // if (strcmp(myenum->getEnumName(), otenum->getEnumName()) != 0) return - // false; - - genericValCompare(ot->m_arraylist->size(), m_arraylist->size()); - for (int k = 0; k < m_arraylist->size(); k++) { - genericValCompare(ot->m_arraylist->at(k), m_arraylist->at(k)); - } - - return true; -} - -/************************************************************ - * PdxTypes1 - * *********************************************************/ - -PdxTypes1::PdxTypes1() { - m_i1 = 34324; - m_i2 = 2144; - m_i3 = 4645734; - m_i4 = 73567; - m_wideparentName = L"Wide Parent name"; - m_wideparentArrayName = new wchar_t*[3]; - const wchar_t* wstr1 = L"test1"; - const wchar_t* wstr2 = L"test2"; - const wchar_t* wstr3 = L"test3"; - size_t wsize = wcslen(wstr1); - for (size_t i = 0; i < 3; i++) { - m_wideparentArrayName[i] = new wchar_t[wsize]; - } - m_wideparentArrayName[0] = const_cast<wchar_t*>(wstr1); - m_wideparentArrayName[1] = const_cast<wchar_t*>(wstr2); - m_wideparentArrayName[2] = const_cast<wchar_t*>(wstr3); - m_enum = CacheableEnum::create("Gender", "female", 5); - wideparentArrayNameLen = 3; - - /* - int2DArray = new int*[3]; - int2DArray[0] = new int[1]; - int2DArray[1] = new int[2]; - int2DArray[2] = new int[2]; - int2DArray[0][0] = 123; - int2DArray[1][0] = 234; - int2DArray[1][1] = 432; - int2DArray[2][0] = 564; - int2DArray[2][1] = 1234; - - intlengthArr = new int[3]; - - intlengthArr[0] = 1; - intlengthArr[1] = 2; - intlengthArr[2] = 2; - */ -} - -PdxTypes1::~PdxTypes1() { - // TODO Auto-generated destructor stub -} - -int32_t PdxTypes1::getHashCode() { return 1; } - -bool PdxTypes1::equals(PdxSerializablePtr obj) { - // LOGDEBUG("NIL:PdxTypes1::==::33"); - if (obj == NULLPTR) { - // LOGDEBUG("NIL:PdxTypes1::==::35"); - return false; - } - PdxTypes1Ptr pap = dynCast<PdxTypes1Ptr>(obj); - if (pap == NULLPTR) { - // LOGDEBUG("NIL:PdxTypes1::==::40"); - return false; - } - if (pap == this) { - // LOGDEBUG("NIL:PdxTypes1::==::44"); - return true; - } - LOGINFO("PdxTypes1:[m_i1=%d] [m_i2=%d] [m_i3=%d] [m_i4=%d]", m_i1, m_i2, m_i3, - m_i4); - if (m_i1 == pap->m_i1 && m_i2 == pap->m_i2 && m_i3 == pap->m_i3 && - m_i4 == pap->m_i4) { - // LOGDEBUG("NIL:PdxTypes1::==::48"); - return true; - } - LOGDEBUG("NIL:PdxTypes1::==::51"); - return false; -} - -CacheableStringPtr PdxTypes1::toString() const { - char idbuf[4096]; - sprintf(idbuf, "PdxTypes1:[m_i1=%d] [m_i2=%d] [m_i3=%d] [m_i4=%d]", m_i1, - m_i2, m_i3, m_i4); - return CacheableString::create(idbuf); -} - -/************************************************************ - * PdxTypes2 - * *********************************************************/ -PdxTypes2::PdxTypes2() { - m_s1 = (char*)"one"; - m_i1 = 34324; - m_i2 = 2144; - m_i3 = 4645734; - m_i4 = 73567; - // m_i5 = 73568; //for volatile #894 bug -} - -PdxTypes2::~PdxTypes2() { - // TODO Auto-generated destructor stub -} - -int32_t PdxTypes2::getHashCode() { return 1; } - -bool PdxTypes2::equals(PdxSerializablePtr obj) { - // LOGDEBUG("NIL:96:this::PdxType2 = %s", this->toString()); - - if (obj == NULLPTR) return false; - - PdxTypes2Ptr pap = dynCast<PdxTypes2Ptr>(obj); - // LOGDEBUG("NIl:102:pap::PdxType2 = %s", pap->toString()); - if (pap == NULLPTR) return false; - - // if (pap == this) - // return true; - - if (m_i1 == pap->m_i1 && m_i2 == pap->m_i2 && m_i3 == pap->m_i3 && - m_i4 == pap->m_i4 && (strcmp(m_s1, pap->m_s1) == 0)) { - return true; - } - - return false; -} - -CacheableStringPtr PdxTypes2::toString() const { - char idbuf[4096]; - sprintf(idbuf, "PdxTypes2:[m_i1=%d] [m_i2=%d] [m_i3=%d] [m_i4=%d] [m_s1=%s]", - m_i1, m_i2, m_i3, m_i4, m_s1); - return CacheableString::create(idbuf); -} - -/************************************************************ - * NestedPdx - * *********************************************************/ - -NestedPdx::NestedPdx() { - m_pd1 = new PdxTypes1(); - m_pd2 = new PdxTypes2(); - m_s1 = (char*)"one"; - m_s2 = (char*)"two"; - m_i1 = 34324; - m_i2 = 2144; - m_i3 = 4645734; - m_i4 = 73567; -} - -NestedPdx::~NestedPdx() { - // TODO Auto-generated destructor stub -} - -int32_t NestedPdx::getHashCode() { return 1; } - -bool NestedPdx::equals(PdxSerializablePtr obj) { - if (obj == NULLPTR) return false; - - NestedPdxPtr pap = dynCast<NestedPdxPtr>(obj); - if (pap == NULLPTR) return false; - - // if (pap == this) - // return true; - - if (m_i1 == pap->m_i1 && m_i2 == pap->m_i2 && m_i3 == pap->m_i3 && - m_i4 == pap->m_i4 && (strcmp(m_s1, pap->m_s1) == 0) && - (strcmp(m_s2, pap->m_s2) == 0) && (m_pd1->equals(pap->m_pd1) == true) && - (m_pd2->equals(pap->m_pd2) == true)) { - return true; - } - - return false; -} - -CacheableStringPtr NestedPdx::toString() const { - char idbuf[4096]; - sprintf( - idbuf, - "NestedPdx:[m_i1=%d] [m_i2=%d] [m_i3=%d] [m_i4=%d] [m_s1=%s] [m_s2=%s]", - m_i1, m_i2, m_i3, m_i4, m_s1, m_s2); - return CacheableString::create(idbuf); -} http://git-wip-us.apache.org/repos/asf/geode-native/blob/7c7f73cc/src/tests/cpp/pdxautoserializerclass/AutoPdxVersioned1.hpp ---------------------------------------------------------------------- diff --git a/src/tests/cpp/pdxautoserializerclass/AutoPdxVersioned1.hpp b/src/tests/cpp/pdxautoserializerclass/AutoPdxVersioned1.hpp deleted file mode 100644 index 2befa59..0000000 --- a/src/tests/cpp/pdxautoserializerclass/AutoPdxVersioned1.hpp +++ /dev/null @@ -1,377 +0,0 @@ -#pragma once - -#ifndef GEODE_PDXAUTOSERIALIZERCLASS_AUTOPDXVERSIONED1_H_ -#define GEODE_PDXAUTOSERIALIZERCLASS_AUTOPDXVERSIONED1_H_ - -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <geode/PdxSerializable.hpp> -#include <geode/GeodeCppCache.hpp> -#include <geode/PdxWriter.hpp> -#include <geode/PdxReader.hpp> - -#ifdef _WIN32 -#ifdef BUILD_TESTOBJECT -#define TESTOBJECT_EXPORT LIBEXP -#else -#define TESTOBJECT_EXPORT LIBIMP -#endif -#else -#define TESTOBJECT_EXPORT -#endif - -#define GFIGNORE(X) X -#define GFEXCLUDE -#define GFID -#define GFARRAYSIZE(X) -#define GFARRAYELEMSIZE(X) - -using namespace apache::geode::client; - -namespace AutoPdxTests { - -enum Gender { male, female, other }; -class GFIGNORE(TESTOBJECT_EXPORT) AutoPdxVersioned1 : public PdxSerializable { - private: - int8_t** m_byteByteArray; - wchar_t m_char; - bool m_bool; - bool* m_boolArray; - int8_t m_byte; - int8_t* m_byteArray; - wchar_t* m_charArray; - CacheableArrayListPtr m_arraylist; - CacheableHashMapPtr m_map; - char* m_string; - CacheableDatePtr m_date; - double m_double; - double* m_doubleArray; - float m_float; - float* m_floatArray; - int16_t m_int16; - int32_t m_int32; - int32_t* m_int32Array; - int64_t* m_longArray; - int16_t* m_int16Array; - int8_t m_sbyte; // - int8_t* m_sbyteArray; /// - char** m_stringArray; - int16_t m_uint16; /// - // int32_t m_uint32;/// - // int64_t m_long; - int64_t m_ulong; /// - int32_t* m_uint32Array; - int64_t* m_ulongArray; - int16_t* m_uint16Array; - int8_t *m_byte252, *m_byte253, *m_byte65535, *m_byte65536; - enum pdxEnumTest { pdx1, pdx2, pdx3, pdx4 }; - CacheablePtr m_pdxEnum; - // GFEXCLUDE double m_double1,m_double2; // bug #909 - // wchar_t pdxType_Wchar1; - // GFARRAYSIZE(pdxType_Wchar1) int32_t pdxType_pdxType_Wchar1_Size; // bug - // #908 - - GFARRAYSIZE(m_boolArray) int32_t boolArrayLen; - GFARRAYSIZE(m_charArray) int32_t charArrayLen; - GFARRAYSIZE(m_byteArray) int32_t byteArrayLen; - GFARRAYSIZE(m_sbyteArray) int32_t shortArrayLen; - GFARRAYSIZE(m_int16Array) int32_t int16Array; - GFARRAYSIZE(m_uint16Array) int32_t uint16Array; - GFARRAYSIZE(m_int32Array) int32_t intArrayLen; - GFARRAYSIZE(m_uint32Array) int32_t uintArrayLen; - GFARRAYSIZE(m_longArray) int32_t longArrayLen; - GFARRAYSIZE(m_ulongArray) int32_t ulongArrayLen; - GFARRAYSIZE(m_doubleArray) int32_t doubleArrayLen; - GFARRAYSIZE(m_floatArray) int32_t floatArrayLen; - GFARRAYSIZE(m_stringArray) int32_t strLenArray; - GFARRAYSIZE(m_byte252) int32_t m_byte252Len; - GFARRAYSIZE(m_byte253) int32_t m_byte253Len; - GFARRAYSIZE(m_byte65535) int32_t m_byte65535Len; - GFARRAYSIZE(m_byte65536) int32_t m_byte65536Len; - GFARRAYSIZE(m_byteByteArray) int32_t byteByteArrayLen; - GFARRAYELEMSIZE(m_byteByteArray) int* lengthArr; - // GFARRAYSIZE(m_wideparentArrayName) int32_t wideparentArrayNameLen; - // int* lengthArr; - - public: - /* AutoPdxVersioned1(const char* key) { - LOGINFO("rjk:inside testobject pdxType"); - init(key); - }*/ - AutoPdxVersioned1() { init("def"); } - AutoPdxVersioned1(const char* key); - void init(const char* key); - inline bool compareBool(bool b, bool b2) { - if (b == b2) return b; - throw IllegalStateException("Not got expected value for bool type: "); - } - - virtual ~AutoPdxVersioned1() {} - - virtual uint32_t objectSize() const { - uint32_t objectSize = sizeof(AutoPdxVersioned1); - return objectSize; - } - // void checkNullAndDelete(void *data); - wchar_t getChar() { return m_char; } - - wchar_t* getCharArray() { return m_charArray; } - - int8_t** getArrayOfByteArrays() { return m_byteByteArray; } - - bool getBool() { return m_bool; } - - CacheableHashMapPtr getHashMap() { return m_map; } - - int8_t getSByte() { return m_sbyte; } - - int16_t getUint16() { return m_uint16; } - - // int32_t getUInt() { - // return m_uint32; - //} - - int64_t getULong() { return m_ulong; } - - int16_t* getUInt16Array() { return m_uint16Array; } - - int32_t* getUIntArray() { return m_uint32Array; } - - int64_t* getULongArray() { return m_ulongArray; } - - int8_t* getByte252() { return m_byte252; } - - int8_t* getByte253() { return m_byte253; } - - int8_t* getByte65535() { return m_byte65535; } - - int8_t* getByte65536() { return m_byte65536; } - - int8_t* getSByteArray() { return m_sbyteArray; } - - CacheableEnumPtr getEnum() { return m_pdxEnum; } - CacheableArrayListPtr getArrayList() { return m_arraylist; } - - int8_t getByte() { return m_byte; } - - int16_t getShort() { return m_int16; } - - int32_t getInt() { return m_int32; } - // int64_t getLong(){ - // return m_long; - // } - - float getFloat() { return m_float; } - - double getDouble() { return m_double; } - - const char* getString() { return m_string; } - - bool* getBoolArray() { return m_boolArray; } - - int8_t* getByteArray() { return m_byteArray; } - - int16_t* getShortArray() { return m_int16Array; } - - int32_t* getIntArray() { return m_int32Array; } - - int64_t* getLongArray() { return m_longArray; } - - double* getDoubleArray() { return m_doubleArray; } - - float* getFloatArray() { return m_floatArray; } - - char** getStringArray() { return m_stringArray; } - - CacheableDatePtr getDate() { return m_date; } - - int32_t getByteArrayLength() { return byteArrayLen; } - - int32_t getBoolArrayLength() { return boolArrayLen; } - - int32_t getShortArrayLength() { return shortArrayLen; } - - int32_t getStringArrayLength() { return strLenArray; } - - int32_t getIntArrayLength() { return intArrayLen; } - - int32_t getLongArrayLength() { return longArrayLen; } - - int32_t getFloatArrayLength() { return floatArrayLen; } - - int32_t getDoubleArrayLength() { return doubleArrayLen; } - - int32_t getbyteByteArrayLength() { return byteByteArrayLen; } - - int32_t getCharArrayLength() { return charArrayLen; } - - using PdxSerializable::toData; - using PdxSerializable::fromData; - - virtual void toData(PdxWriterPtr pw) /*const*/; - - virtual void fromData(PdxReaderPtr pr); - - CacheableStringPtr toString() const; - - const char* getClassName() const; - static PdxSerializable* createDeserializable(); - bool equals(AutoPdxTests::AutoPdxVersioned1& other, - bool isPdxReadSerialized) const; - - template <typename T1, typename T2> - bool genericValCompare(T1 value1, T2 value2) const; - - template <typename T1, typename T2> - bool genericCompare(T1* value1, T2* value2, int length) const; - - template <typename T1, typename T2> - bool generic2DCompare(T1** value1, T2** value2, int length, - int* arrLengths) const; -}; -typedef SharedPtr<AutoPdxTests::AutoPdxVersioned1> AutoPdxVersioned1Ptr; - -/************************************************************ - * PdxTypes1 - * *********************************************************/ - -class GFIGNORE(TESTOBJECT_EXPORT) PdxTypes1 : public PdxSerializable { - private: - int32_t m_i1; - int32_t m_i2; - int32_t m_i3; - int32_t m_i4; - const wchar_t* m_wideparentName; - wchar_t** m_wideparentArrayName; - CacheableEnumPtr m_enum; - GFARRAYSIZE(m_wideparentArrayName) int32_t wideparentArrayNameLen; - // int** int2DArray; - // GFARRAYSIZE(int2DArray) int32_t int2DArrayLen; - // GFARRAYELEMSIZE(int2DArray) int* intlengthArr; - public: - PdxTypes1(); - - virtual ~PdxTypes1(); - - int32_t getHashCode(); - - bool equals(PdxSerializablePtr obj); - - CacheableStringPtr toString() const; - - using PdxSerializable::toData; - using PdxSerializable::fromData; - - virtual void fromData(PdxReaderPtr pr); - - virtual void toData(PdxWriterPtr pw); - - const char* getClassName() const; - int32_t getm_i1() { return m_i1; } - static PdxSerializable* createDeserializable(); - const wchar_t* getWideParentName() { return m_wideparentName; } - wchar_t** getWideParentArrayName() { return m_wideparentArrayName; } - CacheableEnumPtr getPdxEnum() { return m_enum; } -}; -typedef SharedPtr<PdxTypes1> PdxTypes1Ptr; - -/************************************************************ - * PdxTypes2 - * *********************************************************/ - -class GFIGNORE(TESTOBJECT_EXPORT) PdxTypes2 : public PdxSerializable { - private: - char* m_s1; //"one" - int32_t m_i1; - int32_t m_i2; - int32_t m_i3; - int32_t m_i4; - // volatile int32_t m_i5; //for volatile #894 bug - public: - PdxTypes2(); - - virtual ~PdxTypes2(); - - int32_t getHashCode(); - - bool equals(PdxSerializablePtr obj); - - CacheableStringPtr toString() const; - - using PdxSerializable::toData; - using PdxSerializable::fromData; - - virtual void fromData(PdxReaderPtr pr); - - virtual void toData(PdxWriterPtr pw); - - const char* getClassName() const; - static PdxSerializable* createDeserializable(); -}; -typedef SharedPtr<PdxTypes2> PdxTypes2Ptr; - -class GFIGNORE(TESTOBJECT_EXPORT) NestedPdx : public PdxSerializable { - private: - PdxTypes1Ptr m_pd1; - PdxTypes2Ptr m_pd2; - char* m_s1; //"one" - char* m_s2; - int32_t m_i1; - int32_t m_i2; - int32_t m_i3; - int32_t m_i4; - - public: - NestedPdx(); - NestedPdx(char* key) { - m_pd1 = new PdxTypes1(); - m_pd2 = new PdxTypes2(); - size_t len = strlen("NestedPdx ") + strlen(key) + 1; - m_s1 = new char[len]; - strcpy(m_s1, "NestedPdx "); - strcat(m_s1, key); - m_s2 = (char*)("two"); - m_i1 = 34324; - m_i2 = 2144; - m_i3 = 4645734; - m_i4 = 73567; - } - virtual ~NestedPdx(); - - int32_t getHashCode(); - - bool equals(PdxSerializablePtr obj); - - CacheableStringPtr toString() const; - - using PdxSerializable::toData; - using PdxSerializable::fromData; - - virtual void fromData(PdxReaderPtr pr); - - virtual void toData(PdxWriterPtr pw); - - const char* getClassName() const; - const char* getString() { return m_s1; } - - static PdxSerializable* createDeserializable(); -}; -typedef SharedPtr<NestedPdx> NestedPdxPtr; -} // namespace AutoPdxTests - -#endif // GEODE_PDXAUTOSERIALIZERCLASS_AUTOPDXVERSIONED1_H_ http://git-wip-us.apache.org/repos/asf/geode-native/blob/7c7f73cc/src/tests/cpp/pdxautoserializerclass/AutoPdxVersioned2.cpp ---------------------------------------------------------------------- diff --git a/src/tests/cpp/pdxautoserializerclass/AutoPdxVersioned2.cpp b/src/tests/cpp/pdxautoserializerclass/AutoPdxVersioned2.cpp deleted file mode 100644 index 05e7d85..0000000 --- a/src/tests/cpp/pdxautoserializerclass/AutoPdxVersioned2.cpp +++ /dev/null @@ -1,296 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "AutoPdxVersioned2.hpp" - -using namespace apache::geode::client; -using namespace AutoPdxTests; - -// TEST_EXPORT Serializable * createAutoPdxVersioned2(const char* key) { -TEST_EXPORT AutoPdxVersioned2* createAutoPdxVersioned2() { - return new AutoPdxVersioned2(); -} - -template <typename T1, typename T2> -bool AutoPdxVersioned2::genericValCompare(T1 value1, T2 value2) const { - if (value1 != value2) return false; - LOGINFO("PdxObject::genericValCompare Line_19"); - return true; -} - -template <typename T1, typename T2> -bool AutoPdxVersioned2::genericCompare(T1* value1, T2* value2, - int length) const { - int i = 0; - while (i < length) { - if (value1[i] != value2[i]) { - return false; - } else { - i++; - } - } - LOGINFO("PdxObject::genericCompare Line_34"); - return true; -} - -template <typename T1, typename T2> -bool AutoPdxVersioned2::generic2DCompare(T1** value1, T2** value2, int length, - int* arrLengths) const { - LOGINFO("generic2DCompare length = %d ", length); - LOGINFO("generic2DCompare value1 = %d \t value2", value1[0][0], value2[0][0]); - LOGINFO("generic2DCompare value1 = %d \t value2", value1[1][0], value2[1][0]); - LOGINFO("generic2DCompare value1 = %d \t value2", value1[1][1], value2[1][1]); - for (int j = 0; j < length; j++) { - LOGINFO("generic2DCompare arrlength0 = %d ", arrLengths[j]); - for (int k = 0; k < arrLengths[j]; k++) { - LOGINFO("generic2DCompare arrlength = %d ", arrLengths[j]); - LOGINFO("generic2DCompare value1 = %d \t value2 = %d ", value1[j][k], - value2[j][k]); - if (value1[j][k] != value2[j][k]) return false; - } - } - LOGINFO("PdxObject::genericCompare Line_34"); - return true; -} - -AutoPdxVersioned2::AutoPdxVersioned2(const char* key) { init(key); } - -void AutoPdxVersioned2::init(const char* key) { - m_char = 'C'; - m_bool = true; - m_byte = 0x74; - m_sbyte = 0x67; - m_int16 = 0xab; - m_uint16 = 0x2dd5; - m_int32 = 0x2345abdc; - m_uint32 = 0x2a65c434; - m_long = 324897980; - m_ulong = 238749898; - m_float = 23324.324f; - m_double = 3243298498.00; - size_t len = strlen("PdxVersioned ") + strlen(key) + 1; - m_string = new char[len]; - strcpy(m_string, "PdxVersioned "); - strcat(m_string, key); - m_boolArray = new bool[3]; - m_boolArray[0] = true; - m_boolArray[1] = false; - m_boolArray[2] = true; - /*for(int i=0; i<3; i++){ - m_boolArray[i] = true; - };*/ - - m_byteArray = new int8_t[2]; - m_byteArray[0] = 0x34; - m_byteArray[1] = 0x64; - - m_sbyteArray = new int8_t[2]; - m_sbyteArray[0] = 0x34; - m_sbyteArray[1] = 0x64; - - m_charArray = new wchar_t[2]; - m_charArray[0] = L'c'; - m_charArray[1] = L'v'; - - int64_t d = 1310447869154L; - m_date = CacheableDate::create(CacheableDate::duration(d)); - - m_int16Array = new int16_t[2]; - m_int16Array[0] = 0x2332; - m_int16Array[1] = 0x4545; - - m_uint16Array = new int16_t[2]; - m_uint16Array[0] = 0x3243; - m_uint16Array[1] = 0x3232; - - m_int32Array = new int32_t[4]; - m_int32Array[0] = 23; - m_int32Array[1] = 676868; - m_int32Array[2] = 34343; - m_int32Array[3] = 2323; - - m_uint32Array = new int32_t[4]; - m_uint32Array[0] = 435; - m_uint32Array[1] = 234324; - m_uint32Array[2] = 324324; - m_uint32Array[3] = 23432432; - - m_longArray = new int64_t[2]; - m_longArray[0] = 324324L; - m_longArray[1] = 23434545L; - - m_ulongArray = new int64_t[2]; - m_ulongArray[0] = 3245435; - m_ulongArray[1] = 3425435; - - m_floatArray = new float[2]; - m_floatArray[0] = 232.565f; - m_floatArray[1] = 2343254.67f; - - m_doubleArray = new double[2]; - m_doubleArray[0] = 23423432; - m_doubleArray[1] = 4324235435.00; - - m_byteByteArray = new int8_t*[3]; - // for(int i=0; i<2; i++){ - // m_byteByteArray[i] = new int8_t[1]; - //} - m_byteByteArray[0] = new int8_t[1]; - m_byteByteArray[1] = new int8_t[2]; - m_byteByteArray[2] = new int8_t[2]; - m_byteByteArray[0][0] = 0x23; - m_byteByteArray[1][0] = 0x34; - m_byteByteArray[1][1] = 0x55; - m_byteByteArray[2][0] = 0x24; - m_byteByteArray[2][1] = 0x25; - - m_stringArray = new char*[2]; - const char* str1 = "one"; - const char* str2 = "two"; - - int size = static_cast<int>(strlen(str1)); - for (int i = 0; i < 2; i++) { - m_stringArray[i] = new char[size]; - } - m_stringArray[0] = const_cast<char*>(str1); - m_stringArray[1] = const_cast<char*>(str2); - - m_arraylist = CacheableArrayList::create(); - m_arraylist->push_back(CacheableInt32::create(1)); - m_arraylist->push_back(CacheableInt32::create(2)); - - m_map = CacheableHashMap::create(); - m_map->insert(CacheableInt32::create(1), CacheableInt32::create(1)); - m_map->insert(CacheableInt32::create(2), CacheableInt32::create(2)); - m_pdxEnum = CacheableEnum::create("pdxEnumTest1", "pdx2", pdx2); - m_byte252 = new int8_t[252]; - for (int i = 0; i < 252; i++) { - m_byte252[i] = 0; - } - - m_byte253 = new int8_t[253]; - for (int i = 0; i < 253; i++) { - m_byte253[i] = 0; - } - - m_byte65535 = new int8_t[65535]; - for (int i = 0; i < 65535; i++) { - m_byte65535[i] = 0; - } - - m_byte65536 = new int8_t[65536]; - for (int i = 0; i < 65536; i++) { - m_byte65536[i] = 0; - } - - /*for (int32_t index = 0; index <3; ++index) { - m_objectArray->push_back(objectArray[index]); - }*/ - /* - if (keys.size() > 0) { - m_objectArray = CacheableObjectArray::create(); - for (int32_t index = 0; index < keys.size(); ++index) { - m_objectArray->push_back(keys.operator[](index)); - } - }*/ - - boolArrayLen = 3; - byteArrayLen = 2; - shortArrayLen = uint16Array = int16Array = 2; - intArrayLen = uintArrayLen = 4; - longArrayLen = ulongArrayLen = 2; - doubleArrayLen = 2; - floatArrayLen = 2; - strLenArray = 2; - charArrayLen = 2; - byteByteArrayLen = 3; - m_byte252Len = 252; - m_byte253Len = 253; - m_byte65535Len = 65535; - m_byte65536Len = 65536; - lengthArr = new int[3]; - - lengthArr[0] = 1; - lengthArr[1] = 2; - lengthArr[2] = 2; -} - -CacheableStringPtr AutoPdxVersioned2::toString() const { - char idbuf[1024]; - // sprintf(idbuf,"PdxObject: [ m_bool=%d ] [m_byte=%d] [m_int16=%d] - // [m_int32=%d] [m_float=%f] [m_double=%lf] [ m_string=%s ]",m_bool, m_byte, - // m_int16, m_int32, m_float, m_double, m_string); - // sprintf(idbuf,"PdxObject testPdxObject:[m_int32=%d] string = %s", - // m_int32,m_string); - sprintf(idbuf, "PdxVersioned 2 : %s", m_string); - return CacheableString::create(idbuf); -} - -bool AutoPdxVersioned2::equals(AutoPdxVersioned2& other, - bool isPdxReadSerialized) const { - AutoPdxVersioned2* ot = dynamic_cast<AutoPdxVersioned2*>(&other); - if (ot == NULL) { - return false; - } - if (ot == this) { - return true; - } - genericValCompare(ot->m_int32, m_int32); - genericValCompare(ot->m_bool, m_bool); - genericValCompare(ot->m_byte, m_byte); - genericValCompare(ot->m_int16, m_int16); - genericValCompare(ot->m_long, m_long); - genericValCompare(ot->m_float, m_float); - genericValCompare(ot->m_double, m_double); - genericValCompare(ot->m_sbyte, m_sbyte); - genericValCompare(ot->m_uint16, m_uint16); - genericValCompare(ot->m_uint32, m_uint32); - genericValCompare(ot->m_ulong, m_ulong); - genericValCompare(ot->m_char, m_char); - if (strcmp(ot->m_string, m_string) != 0) { - return false; - } - genericCompare(ot->m_byteArray, m_byteArray, byteArrayLen); - genericCompare(ot->m_int16Array, m_int16Array, shortArrayLen); - genericCompare(ot->m_int32Array, m_int32Array, intArrayLen); - genericCompare(ot->m_longArray, m_longArray, longArrayLen); - genericCompare(ot->m_doubleArray, m_doubleArray, doubleArrayLen); - genericCompare(ot->m_floatArray, m_floatArray, floatArrayLen); - genericCompare(ot->m_uint32Array, m_uint32Array, intArrayLen); - genericCompare(ot->m_ulongArray, m_ulongArray, longArrayLen); - genericCompare(ot->m_uint16Array, m_uint16Array, shortArrayLen); - genericCompare(ot->m_sbyteArray, m_sbyteArray, shortArrayLen); - genericCompare(ot->m_charArray, m_charArray, charArrayLen); - // generic2DCompare(ot->m_byteByteArray, m_byteByteArray, byteByteArrayLen, - // lengthArr); - - // CacheableEnumPtr myenum = dynCast<CacheableEnumPtr>(m_pdxEnum); - // CacheableEnumPtr otenum = dynCast<CacheableEnumPtr>(ot->m_pdxEnum); - // if (myenum->getEnumOrdinal() != otenum->getEnumOrdinal()) return false; - // if (strcmp(myenum->getEnumClassName(), otenum->getEnumClassName()) != 0) - // return false; - // if (strcmp(myenum->getEnumName(), otenum->getEnumName()) != 0) return - // false; - - genericValCompare(ot->m_arraylist->size(), m_arraylist->size()); - for (int k = 0; k < m_arraylist->size(); k++) { - genericValCompare(ot->m_arraylist->at(k), m_arraylist->at(k)); - } - - LOGINFO("PdxObject::equals DOne Line_201"); - return true; -} http://git-wip-us.apache.org/repos/asf/geode-native/blob/7c7f73cc/src/tests/cpp/pdxautoserializerclass/AutoPdxVersioned2.hpp ---------------------------------------------------------------------- diff --git a/src/tests/cpp/pdxautoserializerclass/AutoPdxVersioned2.hpp b/src/tests/cpp/pdxautoserializerclass/AutoPdxVersioned2.hpp deleted file mode 100644 index 575cb9a..0000000 --- a/src/tests/cpp/pdxautoserializerclass/AutoPdxVersioned2.hpp +++ /dev/null @@ -1,275 +0,0 @@ -#pragma once - -#ifndef GEODE_PDXAUTOSERIALIZERCLASS_AUTOPDXVERSIONED2_H_ -#define GEODE_PDXAUTOSERIALIZERCLASS_AUTOPDXVERSIONED2_H_ - -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <geode/PdxSerializable.hpp> -#include <geode/GeodeCppCache.hpp> -#include <geode/PdxWriter.hpp> -#include <geode/PdxReader.hpp> - -#ifdef _WIN32 -#ifdef BUILD_TESTOBJECT -#define TESTOBJECT_EXPORT LIBEXP -#else -#define TESTOBJECT_EXPORT LIBIMP -#endif -#else -#define TESTOBJECT_EXPORT -#endif - -#ifdef TESTTASK -#undef TESTTASK -#endif -#ifdef TEST_EXPORT -#undef TEST_EXPORT -#endif - -#if defined(_WIN32) -#define TESTTASK extern "C" __declspec(dllexport) int32_t -#define TEST_EXPORT extern "C" __declspec(dllexport) -#else -#define TESTTASK extern "C" int32_t -#define TEST_EXPORT extern "C" -#endif - -/* -#if defined(_WIN32) - #define FUNC_RETURN_INT int -#else - #define FUNC_RETURN_INT int32_t -#endif -*/ - -#define GFIGNORE(X) X -#define GFEXCLUDE -#define GFID -#define GFARRAYSIZE(X) -#define GFARRAYELEMSIZE(X) - -using namespace apache::geode::client; - -namespace AutoPdxTests { - -class GFIGNORE(TESTOBJECT_EXPORT) AutoPdxVersioned2 : public PdxSerializable { - private: - int8_t** m_byteByteArray; - wchar_t m_char; - bool m_bool; - bool* m_boolArray; - int8_t m_byte; - int8_t* m_byteArray; - wchar_t* m_charArray; - CacheableArrayListPtr m_arraylist; - CacheableHashMapPtr m_map; - char* m_string; - CacheableDatePtr m_date; - double m_double; - double* m_doubleArray; - float m_float; - float* m_floatArray; - int16_t m_int16; - int32_t m_int32; - int32_t* m_int32Array; - int64_t* m_longArray; - int16_t* m_int16Array; - int8_t m_sbyte; // - int8_t* m_sbyteArray; /// - char** m_stringArray; - int16_t m_uint16; /// - int32_t m_uint32; /// - int64_t m_long; - int64_t m_ulong; /// - int32_t* m_uint32Array; - int64_t* m_ulongArray; - int16_t* m_uint16Array; - int8_t *m_byte252, *m_byte253, *m_byte65535, *m_byte65536; - enum pdxEnumTest { pdx1, pdx2, pdx3, pdx4 }; - CacheablePtr m_pdxEnum; - // GFEXCLUDE double m_double1,m_double2; // bug #909 - // wchar_t pdxType_Wchar1; - // GFARRAYSIZE(pdxType_Wchar1) int32_t pdxType_pdxType_Wchar1_Size; // bug - // #908 - - GFARRAYSIZE(m_boolArray) int32_t boolArrayLen; - GFARRAYSIZE(m_charArray) int32_t charArrayLen; - GFARRAYSIZE(m_byteArray) int32_t byteArrayLen; - GFARRAYSIZE(m_sbyteArray) int32_t shortArrayLen; - GFARRAYSIZE(m_int16Array) int32_t int16Array; - GFARRAYSIZE(m_uint16Array) int32_t uint16Array; - GFARRAYSIZE(m_int32Array) int32_t intArrayLen; - GFARRAYSIZE(m_uint32Array) int32_t uintArrayLen; - GFARRAYSIZE(m_longArray) int32_t longArrayLen; - GFARRAYSIZE(m_ulongArray) int32_t ulongArrayLen; - GFARRAYSIZE(m_doubleArray) int32_t doubleArrayLen; - GFARRAYSIZE(m_floatArray) int32_t floatArrayLen; - GFARRAYSIZE(m_stringArray) int32_t strLenArray; - GFARRAYSIZE(m_byte252) int32_t m_byte252Len; - GFARRAYSIZE(m_byte253) int32_t m_byte253Len; - GFARRAYSIZE(m_byte65535) int32_t m_byte65535Len; - GFARRAYSIZE(m_byte65536) int32_t m_byte65536Len; - GFARRAYSIZE(m_byteByteArray) int32_t byteByteArrayLen; - GFARRAYELEMSIZE(m_byteByteArray) int* lengthArr; - - public: - // inline void init(const char* key = "abc"){ - - /* - AutoPdxVersioned2(const char* key) { - LOGINFO("rjk:inside testpdxobject pdxType"); - init(key); - } - */ - AutoPdxVersioned2() { init("abc"); } - AutoPdxVersioned2(const char* key); - void init(const char* key); - inline bool compareBool(bool b, bool b2) { - if (b == b2) return b; - throw IllegalStateException("Not got expected value for bool type: "); - } - - virtual ~AutoPdxVersioned2() {} - - virtual uint32_t objectSize() const { - uint32_t objectSize = sizeof(AutoPdxVersioned2); - return objectSize; - } - // void checkNullAndDelete(void *data); - wchar_t getChar() { return m_char; } - - wchar_t* getCharArray() { return m_charArray; } - - int8_t** getArrayOfByteArrays() { return m_byteByteArray; } - - bool getBool() { return m_bool; } - - CacheableHashMapPtr getHashMap() { return m_map; } - - int8_t getSByte() { return m_sbyte; } - - int16_t getUint16() { return m_uint16; } - - int32_t getUInt() { return m_uint32; } - - int64_t getULong() { return m_ulong; } - - int16_t* getUInt16Array() { return m_uint16Array; } - - int32_t* getUIntArray() { return m_uint32Array; } - - int64_t* getULongArray() { return m_ulongArray; } - - int8_t* getByte252() { return m_byte252; } - - int8_t* getByte253() { return m_byte253; } - - int8_t* getByte65535() { return m_byte65535; } - - int8_t* getByte65536() { return m_byte65536; } - - int8_t* getSByteArray() { return m_sbyteArray; } - - int8_t getByte() { return m_byte; } - - int16_t getShort() { return m_int16; } - - int32_t getInt() { return m_int32; } - - int64_t getLong() { return m_long; } - - float getFloat() { return m_float; } - - double getDouble() { return m_double; } - - const char* getString() { return m_string; } - - bool* getBoolArray() { return m_boolArray; } - - int8_t* getByteArray() { return m_byteArray; } - - int16_t* getShortArray() { return m_int16Array; } - - int32_t* getIntArray() { return m_int32Array; } - - int64_t* getLongArray() { return m_longArray; } - - double* getDoubleArray() { return m_doubleArray; } - - float* getFloatArray() { return m_floatArray; } - - char** getStringArray() { return m_stringArray; } - - CacheableDatePtr getDate() { return m_date; } - - CacheableEnumPtr getPdxEnum() { return m_pdxEnum; } - - int32_t getByteArrayLength() { return byteArrayLen; } - - int32_t getBoolArrayLength() { return boolArrayLen; } - - int32_t getShortArrayLength() { return shortArrayLen; } - - int32_t getStringArrayLength() { return strLenArray; } - - int32_t getIntArrayLength() { return intArrayLen; } - - int32_t getLongArrayLength() { return longArrayLen; } - - int32_t getFloatArrayLength() { return floatArrayLen; } - - int32_t getDoubleArrayLength() { return doubleArrayLen; } - - int32_t getbyteByteArrayLength() { return byteByteArrayLen; } - - int32_t getCharArrayLength() { return charArrayLen; } - - using PdxSerializable::toData; - using PdxSerializable::fromData; - - virtual void toData(PdxWriterPtr pw) /*const*/; - - virtual void fromData(PdxReaderPtr pr); - - CacheableStringPtr toString() const; - - const char* getClassName() const; - /*AutoPdxVersioned2(){ - LOGINFO("rjk:inside testpdxobject default pdxType"); - init(); - }*/ - static PdxSerializable* createDeserializable(); - - bool equals(AutoPdxTests::AutoPdxVersioned2& other, - bool isPdxReadSerialized) const; - - template <typename T1, typename T2> - bool genericValCompare(T1 value1, T2 value2) const; - - template <typename T1, typename T2> - bool genericCompare(T1* value1, T2* value2, int length) const; - - template <typename T1, typename T2> - bool generic2DCompare(T1** value1, T2** value2, int length, - int* arrLengths) const; -}; -typedef SharedPtr<AutoPdxTests::AutoPdxVersioned2> AutoPdxVersioned2Ptr; -} // namespace AutoPdxTests - -#endif // GEODE_PDXAUTOSERIALIZERCLASS_AUTOPDXVERSIONED2_H_ http://git-wip-us.apache.org/repos/asf/geode-native/blob/7c7f73cc/src/tests/cpp/pdxautoserializerclass/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/src/tests/cpp/pdxautoserializerclass/CMakeLists.txt b/src/tests/cpp/pdxautoserializerclass/CMakeLists.txt index 6047bc3..cf1c6f3 100644 --- a/src/tests/cpp/pdxautoserializerclass/CMakeLists.txt +++ b/src/tests/cpp/pdxautoserializerclass/CMakeLists.txt @@ -23,24 +23,6 @@ elseif(UNIX) set(DYNAMIC_LIBRARY_PATH LD_LIBRARY_PATH=$<TARGET_LINKER_FILE_DIR:apache-geode>) endif() -macro(add_pdxautoserializer SOURCES_VAR NAMESPACE CLASS HEADER FLAGS) - set(_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAMESPACE}_${CLASS}Serializable.cpp) - set(_INPUT ${CMAKE_CURRENT_SOURCE_DIR}/${HEADER}) - add_custom_command(OUTPUT ${_OUTPUT} - COMMAND ${DYNAMIC_LIBRARY_PATH} $<TARGET_FILE:pdxautoserializer> --className=${CLASS} ${_INPUT} ${FLAGS} - DEPENDS ${_INPUT} - ) - set(${SOURCES_VAR} ${${SOURCES_VAR}} ${_OUTPUT}) -endmacro() - -add_pdxautoserializer(SOURCES AutoPdxTests NestedPdx AutoPdxVersioned1.hpp "") -add_pdxautoserializer(SOURCES AutoPdxTests PdxTypes1 AutoPdxVersioned1.hpp "") -add_pdxautoserializer(SOURCES AutoPdxTests PdxTypes2 AutoPdxVersioned1.hpp "") -add_pdxautoserializer(SOURCES AutoPdxTests PortfolioPdx PortfolioPdx.hpp "") -add_pdxautoserializer(SOURCES AutoPdxTests PositionPdx PositionPdx.hpp "") -add_pdxautoserializer(SOURCES AutoPdxTests AutoPdxVersioned1 AutoPdxVersioned1.hpp --classNameStr=AutoPdxVersioned1:PdxTests.PdxVersioned) -add_pdxautoserializer(SOURCES AutoPdxTests AutoPdxVersioned2 AutoPdxVersioned2.hpp --classNameStr=AutoPdxVersioned2:PdxTests.PdxVersioned) - add_library(pdxobject SHARED ${SOURCES}) set_target_properties(pdxobject PROPERTIES FOLDER test) @@ -52,7 +34,5 @@ target_link_libraries(pdxobject c++11 ) -add_dependencies(pdxobject pdxautoserializer) - include_directories(${CMAKE_CURRENT_SOURCE_DIR}) http://git-wip-us.apache.org/repos/asf/geode-native/blob/7c7f73cc/src/tests/cpp/pdxautoserializerclass/PortfolioPdx.cpp ---------------------------------------------------------------------- diff --git a/src/tests/cpp/pdxautoserializerclass/PortfolioPdx.cpp b/src/tests/cpp/pdxautoserializerclass/PortfolioPdx.cpp index fe6d379..d6cb464 100644 --- a/src/tests/cpp/pdxautoserializerclass/PortfolioPdx.cpp +++ b/src/tests/cpp/pdxautoserializerclass/PortfolioPdx.cpp @@ -97,9 +97,9 @@ PortfolioPdx::~PortfolioPdx() { newVal = NULL; } } -/* + void PortfolioPdx::toData( PdxWriterPtr pw ) { - pw->writeInt("ID", id); + pw->writeInt("ID", ID); pw->markIdentityField("ID"); pw->writeString("pkid", pkid); @@ -136,7 +136,7 @@ void PortfolioPdx::toData( PdxWriterPtr pw ) { void PortfolioPdx::fromData( PdxReaderPtr pr ) { - id = pr->readInt("ID"); + ID = pr->readInt("ID"); pkid = pr->readString("pkid"); position1 = dynCast<PositionPdxPtr>(pr->readObject("position1")); @@ -156,7 +156,7 @@ void PortfolioPdx::fromData( PdxReaderPtr pr ) arrayZeroSize = pr->readByteArray("arrayZeroSize", arrayZeroSizeLen); } -*/ + CacheableStringPtr PortfolioPdx::toString() const { LOGINFO("PortfolioPdx::toString() Start"); char idbuf[1024]; http://git-wip-us.apache.org/repos/asf/geode-native/blob/7c7f73cc/src/tests/cpp/pdxautoserializerclass/PortfolioPdx.hpp ---------------------------------------------------------------------- diff --git a/src/tests/cpp/pdxautoserializerclass/PortfolioPdx.hpp b/src/tests/cpp/pdxautoserializerclass/PortfolioPdx.hpp index ca0881e..e2d2202 100644 --- a/src/tests/cpp/pdxautoserializerclass/PortfolioPdx.hpp +++ b/src/tests/cpp/pdxautoserializerclass/PortfolioPdx.hpp @@ -100,7 +100,7 @@ class GFIGNORE(TESTOBJECT_EXPORT) PortfolioPdx : public PdxSerializable { static PdxSerializable* createDeserializable(); - const char* getClassName() const; + const char* getClassName() const { return this->type; } using PdxSerializable::toData; using PdxSerializable::fromData; http://git-wip-us.apache.org/repos/asf/geode-native/blob/7c7f73cc/src/tests/cpp/pdxautoserializerclass/PositionPdx.cpp ---------------------------------------------------------------------- diff --git a/src/tests/cpp/pdxautoserializerclass/PositionPdx.cpp b/src/tests/cpp/pdxautoserializerclass/PositionPdx.cpp index 637c5f1..3508fbd 100644 --- a/src/tests/cpp/pdxautoserializerclass/PositionPdx.cpp +++ b/src/tests/cpp/pdxautoserializerclass/PositionPdx.cpp @@ -99,7 +99,7 @@ void PositionPdx::init() { volatility = 0; pid = 0; } -/* + void PositionPdx::toData( PdxWriterPtr pw) { pw->writeLong("avg20DaysVol", avg20DaysVol); pw->markIdentityField("avg20DaysVol"); @@ -169,7 +169,6 @@ void PositionPdx::fromData( PdxReaderPtr pr ){ volatility = pr->readLong("volatility"); pid = pr->readInt("pid"); } -*/ CacheableStringPtr PositionPdx::toString() const { char buf[1024]; sprintf(buf, "PositionPdx Object:[ id=%d ]", this->pid); http://git-wip-us.apache.org/repos/asf/geode-native/blob/7c7f73cc/src/tests/cpp/pdxautoserializerclass/PositionPdx.hpp ---------------------------------------------------------------------- diff --git a/src/tests/cpp/pdxautoserializerclass/PositionPdx.hpp b/src/tests/cpp/pdxautoserializerclass/PositionPdx.hpp index f3aab5c..4f06135 100644 --- a/src/tests/cpp/pdxautoserializerclass/PositionPdx.hpp +++ b/src/tests/cpp/pdxautoserializerclass/PositionPdx.hpp @@ -98,7 +98,9 @@ class GFIGNORE(TESTOBJECT_EXPORT) PositionPdx static PdxSerializable* createDeserializable(); - const char* getClassName() const; + const char* getClassName() { return "PositionPdxType"; } + + const char* getClassName() const { return "PositionPdxType"; } private: void init(); http://git-wip-us.apache.org/repos/asf/geode-native/blob/7c7f73cc/src/tests/cpp/testobject/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/src/tests/cpp/testobject/CMakeLists.txt b/src/tests/cpp/testobject/CMakeLists.txt index 4e2b323..bd78b86 100644 --- a/src/tests/cpp/testobject/CMakeLists.txt +++ b/src/tests/cpp/testobject/CMakeLists.txt @@ -26,52 +26,10 @@ elseif(UNIX) endif() macro(add_pdxautoserializer SOURCES_VAR NAMESPACE CLASS HEADER SUFFIX CLASSNAMESTR) - set(_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAMESPACE}_${CLASS}${SUFFIX}.cpp) - set(_INPUT ${CMAKE_CURRENT_SOURCE_DIR}/${HEADER}) - add_custom_command(OUTPUT ${_OUTPUT} - COMMAND ${DYNAMIC_LIBRARY_PATH} $<TARGET_FILE:pdxautoserializer> --className=${CLASS} --suffix=${SUFFIX} --classNameStr=${CLASSNAMESTR} ${_INPUT} - DEPENDS ${_INPUT} - ) - set(${SOURCES_VAR} ${${SOURCES_VAR}} ${_OUTPUT}) + set(${SOURCES_VAR} ${${SOURCES_VAR}} ${CMAKE_CURRENT_SOURCE_DIR}/${NAMESPACE}_${CLASS}${SUFFIX}.cpp) endmacro() include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -add_pdxautoserializer(SOURCES PdxAutoTests PdxAutoMegaType PdxAutoMegaType.hpp Serializable "") - -add_pdxautoserializer(SOURCES PdxTestsAuto CharTypes PdxTypeWithAuto.hpp _UTImpl "") -add_pdxautoserializer(SOURCES PdxTestsAuto PdxType PdxTypeWithAuto.hpp _UTImpl PdxType:PdxTests.PdxTestsWithAuto) -add_pdxautoserializer(SOURCES PdxTestsAuto Address PdxTypeWithAuto.hpp _UTImpl Address:PdxTests.Address) -add_pdxautoserializer(SOURCES PdxTestsAuto Child PdxTypeWithAuto.hpp _UTImpl "") - -add_pdxautoserializer(SOURCES PdxTestsAuto PdxTypes1 VariousPdxTypesWithAuto.hpp _UTImpl "") -add_pdxautoserializer(SOURCES PdxTestsAuto PdxTypes2 VariousPdxTypesWithAuto.hpp _UTImpl "") -add_pdxautoserializer(SOURCES PdxTestsAuto PdxTypes3 VariousPdxTypesWithAuto.hpp _UTImpl "") -add_pdxautoserializer(SOURCES PdxTestsAuto PdxTypes4 VariousPdxTypesWithAuto.hpp _UTImpl "") -add_pdxautoserializer(SOURCES PdxTestsAuto PdxTypes5 VariousPdxTypesWithAuto.hpp _UTImpl "") -add_pdxautoserializer(SOURCES PdxTestsAuto PdxTypes6 VariousPdxTypesWithAuto.hpp _UTImpl "") -add_pdxautoserializer(SOURCES PdxTestsAuto PdxTypes7 VariousPdxTypesWithAuto.hpp _UTImpl "") -add_pdxautoserializer(SOURCES PdxTestsAuto PdxTypes8 VariousPdxTypesWithAuto.hpp _UTImpl "") -add_pdxautoserializer(SOURCES PdxTestsAuto PdxTypes9 VariousPdxTypesWithAuto.hpp _UTImpl "") -add_pdxautoserializer(SOURCES PdxTestsAuto PdxTypes10 VariousPdxTypesWithAuto.hpp _UTImpl "") -add_pdxautoserializer(SOURCES PdxTestsAuto NestedPdx VariousPdxTypesWithAuto.hpp _UTImpl "") - -add_pdxautoserializer(SOURCES PdxTestsAuto PdxType1V1 PdxClassV1WithAuto.hpp _UTImpl PdxType1V1:PdxTestsAuto.PdxType1V1) -add_pdxautoserializer(SOURCES PdxTestsAuto PdxType2V1 PdxClassV1WithAuto.hpp _UTImpl PdxType2V1:PdxTestsAuto.PdxType2V1) -add_pdxautoserializer(SOURCES PdxTestsAuto PdxType3V1 PdxClassV1WithAuto.hpp _UTImpl PdxType3V1:PdxTestsAuto.PdxType3V1) -add_pdxautoserializer(SOURCES PdxTestsAuto PdxTypesV1R1 PdxClassV1WithAuto.hpp _UTImpl PdxTypesV1R1:PdxTestsAuto.PdxTypesV1R1) -add_pdxautoserializer(SOURCES PdxTestsAuto PdxTypesV1R2 PdxClassV1WithAuto.hpp _UTImpl PdxTypesV1R2:PdxTestsAuto.PdxTypesV1R2) -add_pdxautoserializer(SOURCES PdxTestsAuto PdxTypesIgnoreUnreadFieldsV1 PdxClassV1WithAuto.hpp _UTImpl dxTypesIgnoreUnreadFieldsV1:PdxTestsAuto.PdxTypesIgnoreUnreadFieldsV1) -add_pdxautoserializer(SOURCES PdxTestsAuto TestEqualsV1 PdxClassV1WithAuto.hpp _UTImpl TestEqualsV1:PdxTestsAuto.TestEqualsV1) -add_pdxautoserializer(SOURCES PdxTestsAuto PdxVersionedV1 PdxClassV1WithAuto.hpp _UTImpl PdxVersionedV1:PdxTestsAuto.PdxVersionedV1) - -add_pdxautoserializer(SOURCES PdxTestsAuto PdxTypes1V2 PdxClassV2WithAuto.hpp _UTImpl PdxTypes1V2:PdxTestsAuto.PdxType1V1) -add_pdxautoserializer(SOURCES PdxTestsAuto PdxTypes2V2 PdxClassV2WithAuto.hpp _UTImpl PdxTypes2V2:PdxTestsAuto.PdxType2V1) -add_pdxautoserializer(SOURCES PdxTestsAuto PdxTypes3V2 PdxClassV2WithAuto.hpp _UTImpl PdxTypes3V2:PdxTestsAuto.PdxType3V1) -add_pdxautoserializer(SOURCES PdxTestsAuto PdxTypesR1V2 PdxClassV2WithAuto.hpp _UTImpl PdxTypesR1V2:PdxTestsAuto.PdxTypesV1R1) -add_pdxautoserializer(SOURCES PdxTestsAuto PdxTypesR2V2 PdxClassV2WithAuto.hpp _UTImpl PdxTypesR2V2:PdxTestsAuto.PdxTypesV1R2) -add_pdxautoserializer(SOURCES PdxTestsAuto PdxTypesIgnoreUnreadFieldsV2 PdxClassV2WithAuto.hpp _UTImpl dxTypesIgnoreUnreadFieldsV2:PdxTestsAuto.PdxTypesIgnoreUnreadFieldsV1) -add_pdxautoserializer(SOURCES PdxTestsAuto PdxVersionedV2 PdxClassV2WithAuto.hpp _UTImpl PdxVersionedV2:PdxTestsAuto.PdxVersionedV1) - add_library(testobject SHARED ${SOURCES}) set_target_properties(testobject PROPERTIES FOLDER test)
