From Duncan.Perrett at elekta.com Thu Oct 1 10:05:48 2009 From: Duncan.Perrett at elekta.com (Duncan.Perrett@elekta.com) Date: Thu Oct 1 10:19:25 2009 Subject: [xsde-users] Building examples with the Eclipse CDT In-Reply-To: References: Message-ID: Hello, I have successfully built and executed the xsde hybrid "hello" example from the command line with linux and gcc. I have also successfully built and executed it with Rational Rhapsody on Windows with MSCV9. Now I want to build and execute with Eclipse CDT under linux and gcc. Can I use a "managed make" style project and add some build settings or do I have to rely on the examples' resident makefiles? If I create my own Eclipse CDT based project that employs xsde then do I need to craft my own makefile manually? Any help on building xsde programs with Eclipse CDT would be greatly appreciated! Thanks, Duncan From tftomsun at streamteam.de Thu Oct 1 11:23:04 2009 From: tftomsun at streamteam.de (Thomas Frenzel (TomSun)) Date: Thu Oct 1 11:23:14 2009 Subject: [xsde-users] Generated enums for simple types with string enumeration facets In-Reply-To: OF95D2D425.3CF52C05-ON80257642.004CFED9-80257642.004D919D@elekta.com Message-ID: <20091001152304.d4f2a995@streamteam.de> Hello, i already asked about this topic a few month ago. I would like to have generated enumerations that i can use for dealing with simple types that represents an enumeration. I found a small utility that generates classes for enumerations, which provide a comfortable way of accessing the enum values and value names. Please have a look at the utility. Do you think that this could be build in the code generation of xsde? http://www.codeguru.com/cpp/cpp/cpp_mfc/article.php/c4001/ Best Regards, Tom _____ From: Duncan.Perrett@elekta.com To: Boris Kolpackov [mailto:boris@codesynthesis.com] Cc: xsde-users@codesynthesis.com Sent: Thu, 01 Oct 2009 16:05:48 +0200 Subject: Re: [xsde-users] Building examples with the Eclipse CDT Hello, I have successfully built and executed the xsde hybrid "hello" example from the command line with linux and gcc. I have also successfully built and executed it with Rational Rhapsody on Windows with MSCV9. Now I want to build and execute with Eclipse CDT under linux and gcc. Can I use a "managed make" style project and add some build settings or do I have to rely on the examples' resident makefiles? If I create my own Eclipse CDT based project that employs xsde then do I need to craft my own makefile manually? Any help on building xsde programs with Eclipse CDT would be greatly appreciated! Thanks, Duncan From boris at codesynthesis.com Fri Oct 2 05:52:06 2009 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Oct 2 05:44:09 2009 Subject: [xsde-users] Building examples with the Eclipse CDT In-Reply-To: References: Message-ID: Hi Duncan, Duncan.Perrett@elekta.com writes: > Now I want to build and execute with Eclipse CDT under linux and gcc. > > Can I use a "managed make" style project and add some build settings or do > I have to rely on the examples' resident makefiles? I gave it a try and it works almost perfectly with managed make, except for a little snag (more on this below). Here are the step- by-step instruction for setting the example/cxx/hybrid/hello/ example with Eclipse CDT. You can use the same approach for other examples or your application. Here I assume XSD/e is installed in /opt/xsde and that the libxsde library was built using the supplied makefiles. 1. Create a directory for the hello example and copy driver.cxx, hello.xml, and hello.xsd into it. Do not copy the makefile. 2. In Eclipse, do File->New->C++ Project. Type the directory name from step 1 as project name so that the Location field points to the directory created in step 1. Click Next then Finish. At this stage Eclipse will try to build driver.cxx which will result in compile errors. This is expected since we haven't generated the C++ files from the schema yet. 3. In Project Explorer right-click on hello.xsd and select Properties. Select C/C++ Build->Settings, select Build Steps tab, and change Configuration to All. Change "Disable Custom Build Step" to "Apply Custom Build Step Overriding Other Tools". Leave Additional Input Files field blank. In output file names, list all the generated C++ files with the '../' path, separated by semicolon. In our case it will be: ../hello.hxx;../hello.cxx;../hello-pskel.hxx;../hello-pskel.cxx;../hello-pimpl.hxx;../hello-pimpl.cxx In the Command field put the XSD/e compiler command line that is used to compile the schema. Also add '--output-dir ..' and use the '../' path for the schema file. In our case it will be: /top/xsde/bin/xsde cxx-hybrid --generate-parser --generate-aggregate --output-dir .. ../hello.xsd In the Description field put something like "xsde hello.xsd" or "compiling hello.xsd". Click Ok to close the dialog. 4. In Project Explorer right-click on the project name and select Properties. Select C/C++ General->Paths and Symbols, select GNU C++, select Includes tab, and change Configuration to All. Add the path for the libxsde library headers, /opt/xsde/libxsde in our case. Change to the Library Paths tab and add the path to the libxsde.a library, /opt/xsde/libxsde/xsde in our case. Click Apply. Change to C/C++ Build->Settings->GCC C++ Linker->Libraries. Add 'xsde' to the Libraries list. Click Ok to close the dialog. 5. Now Eclipse knows how to build the generated C++ files from the schema. Unfortunately, Eclipse is not smart enough to figure out that some files included in driver.cxx are those generated C++ files and it could have successfully compiled driver.cxx if only it compiled the schema first. So when we don't have the generated C++ files, we need to "bootstrap" the project by explicitly compiling them. Once the files are generated, Eclipse will figure out all the dependencies and everything will work as expected (that is, if we modify hello.xsd, Eclipse will know to first recompile hello.xsd and only then recompile driver.cxx). The easiest way to do this bootstrapping is to add a special target that will trigger the schema compilation. Go to Project-> Make Targets->Create. In Target Name type something like Bootstrap. Then uncheck the "Same as the target name" box and enter the name of the generated file with the '../' path, one file per schema is sufficient. In our case it will be ../hello.hxx. Click Ok to close the dialog. 6. Now we can bootstrap the project by doing Project->Make Targets-> Build and selecting the Bootstrap target. After that we can continue with normal builds. Let me know if you run into any issue with this. Boris From boris at codesynthesis.com Fri Oct 2 06:02:34 2009 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Oct 2 05:54:40 2009 Subject: [xsde-users] Generated enums for simple types with string enumeration facets In-Reply-To: <20091001152304.d4f2a995@streamteam.de> References: <20091001152304.d4f2a995@streamteam.de> Message-ID: Hi Thomas, Thomas Frenzel (TomSun) writes: > i already asked about this topic a few month ago. I would like to have > generated enumerations that i can use for dealing with simple types that > represents an enumeration. Yes, this is in the plans for the next release. If you really need this feature, I can go ahead and implement it and build you a pre- release binary of the XSD/e compiler. Would you be interested in this? Boris From boris at codesynthesis.com Fri Oct 2 10:52:11 2009 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Oct 2 10:44:31 2009 Subject: [xsde-users] Building examples with the Eclipse CDT In-Reply-To: References: Message-ID: Hi Duncan, Duncan.Perrett@elekta.com writes: > Have you been asked this before or are you just a whiz with IDEs and > eclipse? ;-). I think because I had to figure out the same for MS VC++, I had a general idea of where to look. But it took me a couple of hours to work out the details. BTW, I submitted a bug against Eclipse CDT about that dependency issue, in case you are interested: https://bugs.eclipse.org/bugs/show_bug.cgi?id=291179 Boris From tftomsun at streamteam.de Fri Oct 2 10:50:17 2009 From: tftomsun at streamteam.de (Thomas Frenzel (TomSun)) Date: Fri Oct 2 10:50:26 2009 Subject: [xsde-users] Generated enums for simple types with string enumeration facets In-Reply-To: boris.20091002115933@codesynthesis.com Message-ID: <20091002145017.b0e309fc@streamteam.de> Hello Boris, yes this would be very nice! I am excited how the generated code will look like. Will you provide a possibility to convert between the enum value name and the enum value? This would be very useful, because an enumeration simple type in xsd schema must be based on string, but the enumeration in c++ are based on numeric values. Best Regards, Tom _____ From: Boris Kolpackov [mailto:boris@codesynthesis.com] To: Thomas Frenzel (TomSun) [mailto:tftomsun@streamteam.de] Cc: xsde-users@codesynthesis.com Sent: Fri, 02 Oct 2009 12:02:34 +0200 Subject: Re: [xsde-users] Generated enums for simple types with string enumeration facets Hi Thomas, Thomas Frenzel (TomSun) writes: > i already asked about this topic a few month ago. I would like to have > generated enumerations that i can use for dealing with simple types that > represents an enumeration. Yes, this is in the plans for the next release. If you really need this feature, I can go ahead and implement it and build you a pre- release binary of the XSD/e compiler. Would you be interested in this? Boris From Duncan.Perrett at elekta.com Fri Oct 2 10:24:57 2009 From: Duncan.Perrett at elekta.com (Duncan.Perrett@elekta.com) Date: Mon Oct 5 02:43:57 2009 Subject: [xsde-users] Building examples with the Eclipse CDT In-Reply-To: References: Message-ID: Boris, Glad I asked! Well done - that was exactly what I needed. Have you been asked this before or are you just a whiz with IDEs and eclipse? Obviously it works. Hopefully I can now build a prototype project which uses xsde and convince my project team to use it. Thank you for the superb support, Duncan From: Boris Kolpackov To: Duncan.Perrett@elekta.com Cc: xsde-users@codesynthesis.com Date: 02/10/2009 10:42 Subject: Re: [xsde-users] Building examples with the Eclipse CDT Hi Duncan, Duncan.Perrett@elekta.com writes: > Now I want to build and execute with Eclipse CDT under linux and gcc. > > Can I use a "managed make" style project and add some build settings or do > I have to rely on the examples' resident makefiles? I gave it a try and it works almost perfectly with managed make, except for a little snag (more on this below). Here are the step- by-step instruction for setting the example/cxx/hybrid/hello/ example with Eclipse CDT. You can use the same approach for other examples or your application. Here I assume XSD/e is installed in /opt/xsde and that the libxsde library was built using the supplied makefiles. 1. Create a directory for the hello example and copy driver.cxx, hello.xml, and hello.xsd into it. Do not copy the makefile. 2. In Eclipse, do File->New->C++ Project. Type the directory name from step 1 as project name so that the Location field points to the directory created in step 1. Click Next then Finish. At this stage Eclipse will try to build driver.cxx which will result in compile errors. This is expected since we haven't generated the C++ files from the schema yet. 3. In Project Explorer right-click on hello.xsd and select Properties. Select C/C++ Build->Settings, select Build Steps tab, and change Configuration to All. Change "Disable Custom Build Step" to "Apply Custom Build Step Overriding Other Tools". Leave Additional Input Files field blank. In output file names, list all the generated C++ files with the '../' path, separated by semicolon. In our case it will be: ../hello.hxx;../hello.cxx;../hello-pskel.hxx;../hello-pskel.cxx;../hello-pimpl.hxx;../hello-pimpl.cxx In the Command field put the XSD/e compiler command line that is used to compile the schema. Also add '--output-dir ..' and use the '../' path for the schema file. In our case it will be: /top/xsde/bin/xsde cxx-hybrid --generate-parser --generate-aggregate --output-dir .. ../hello.xsd In the Description field put something like "xsde hello.xsd" or "compiling hello.xsd". Click Ok to close the dialog. 4. In Project Explorer right-click on the project name and select Properties. Select C/C++ General->Paths and Symbols, select GNU C++, select Includes tab, and change Configuration to All. Add the path for the libxsde library headers, /opt/xsde/libxsde in our case. Change to the Library Paths tab and add the path to the libxsde.a library, /opt/xsde/libxsde/xsde in our case. Click Apply. Change to C/C++ Build->Settings->GCC C++ Linker->Libraries. Add 'xsde' to the Libraries list. Click Ok to close the dialog. 5. Now Eclipse knows how to build the generated C++ files from the schema. Unfortunately, Eclipse is not smart enough to figure out that some files included in driver.cxx are those generated C++ files and it could have successfully compiled driver.cxx if only it compiled the schema first. So when we don't have the generated C++ files, we need to "bootstrap" the project by explicitly compiling them. Once the files are generated, Eclipse will figure out all the dependencies and everything will work as expected (that is, if we modify hello.xsd, Eclipse will know to first recompile hello.xsd and only then recompile driver.cxx). The easiest way to do this bootstrapping is to add a special target that will trigger the schema compilation. Go to Project-> Make Targets->Create. In Target Name type something like Bootstrap. Then uncheck the "Same as the target name" box and enter the name of the generated file with the '../' path, one file per schema is sufficient. In our case it will be ../hello.hxx. Click Ok to close the dialog. 6. Now we can bootstrap the project by doing Project->Make Targets-> Build and selecting the Bootstrap target. After that we can continue with normal builds. Let me know if you run into any issue with this. Boris From boris at codesynthesis.com Mon Oct 5 04:25:18 2009 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Oct 5 04:17:42 2009 Subject: [xsde-users] Generated enums for simple types with string enumeration facets In-Reply-To: <20091002145017.b0e309fc@streamteam.de> References: <20091002145017.b0e309fc@streamteam.de> Message-ID: Hi Thomas, Thomas Frenzel (TomSun) writes: > I am excited how the generated code will look like. We have already done such XML Schema enum to C++ enum mapping for C++/Tree in XSD, so it will be similar. Just to give you an example, for the following definition: We will generate the following class: class color { public: enum value { red, green, blue }; color (); color (value); operator value () const; const char* string () const; // String representation. private: value v_; }; > Will you provide a possibility to convert between the enum value name > and the enum value? This would be very useful, because an enumeration > simple type in xsd schema must be based on string, but the enumeration > in c++ are based on numeric values. There will be a way to convert from C++ enum value to a string value (the string() function above). I am not yet sure about the other way around (i.e., from string to C++ enum). It will be done in the parser but I am not sure we should also allow this in the interface since it will need error detection, etc. Do you need this functionality? Boris From Duncan.Perrett at elekta.com Tue Oct 6 10:37:21 2009 From: Duncan.Perrett at elekta.com (Duncan.Perrett@elekta.com) Date: Tue Oct 6 11:18:38 2009 Subject: [xsde-users] find() in sequences In-Reply-To: References: Message-ID: Hello, My xsde project has produced classes like class myClassA { -- -- typedef ::xsde::cxx::hybrid::var_sequence< ::TxMessageType > TxMessage_sequence; typedef TxMessage_sequence::iterator TxMessage_iterator; typedef TxMessage_sequence::const_iterator TxMessage_const_iterator; } class TxMessageType { - - const ::std::string& Name () const; ::std::string& Name (); void Name (const ::std::string&); } And I want to search the TxMessage sequence container for a particular string returned by Name(). NodeType::TxMessage_iterator msgPosn = find_if(nodeForMsg->TxMessage().begin(), nodeForMsg->TxMessage().end(), not1(bind2nd(ptr_fun(strcmp),"ADC1_data_dia"))); This doesn't compile and I'm not sure why. make all Building file: ../driver.cxx Invoking: GCC C++ Compiler g++ -I/usr/xsde/xsde-3.1.0-i686-linux-gnu/libxsde -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"driver.d" -MT"driver.d" -o"driver.o" "../driver.cxx" /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_types.h: In instantiation of ?std::iterator_traits >?: /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h:338: instantiated from ?_InputIterator std::find_if(_InputIterator, _InputIterator, _Predicate) [with _InputIterator = xsde::cxx::hybrid::var_iterator, _Predicate = std::unary_negate > >]? ../driver.cxx:81: instantiated from here /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_iterator_base_types.h:129: error: no type named ?iterator_category? in ?class xsde::cxx::hybrid::var_iterator? /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h: In function ?_InputIterator std::find_if(_InputIterator, _InputIterator, _Predicate) [with _InputIterator = xsde::cxx::hybrid::var_iterator, _Predicate = std::unary_negate > >]?: ../driver.cxx:81: instantiated from here /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algo.h:338: error: no matching function for call to ?__iterator_category(xsde::cxx::hybrid::var_iterator&)? make: *** [driver.o] Error 1 Any ideas? Regards, Duncan From boris at codesynthesis.com Wed Oct 7 03:24:14 2009 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Oct 7 03:16:46 2009 Subject: [xsde-users] find() in sequences In-Reply-To: References: Message-ID: Hi Duncan, Duncan.Perrett@elekta.com writes: > class myClassA > { > -- -- > typedef ::xsde::cxx::hybrid::var_sequence< ::TxMessageType > > TxMessage_sequence; > typedef TxMessage_sequence::iterator TxMessage_iterator; > typedef TxMessage_sequence::const_iterator TxMessage_const_iterator; > } > > class TxMessageType > { > - - > const ::std::string& > Name () const; > > ::std::string& > Name (); > > void > Name (const ::std::string&); > } > > > And I want to search the TxMessage sequence container for a particular > string returned by Name(). > > NodeType::TxMessage_iterator msgPosn = > find_if(nodeForMsg->TxMessage().begin(), nodeForMsg->TxMessage().end(), > not1(bind2nd(ptr_fun(strcmp),"ADC1_data_dia"))); > > This doesn't compile and I'm not sure why. Two reasons. The first one has to to with XSD/e's lack of support for fully-conforming STL iterators (that missing iterator_category member that is reported in the error message). We didn't add it because it requires working headers and some of the targets that we support don't have it or have a broken one. But there is no reason why we can't support it conditionally which is what I implemented for the next release of XSD/e. The change is quite simple and I've backported it to 3.1.0. To apply it, you can download this archive: http://www.codesynthesis.com/~boris/tmp/xsde-3.1.0-stl-iterator.tar.gz Then replace the files in xsde-3.1.0 with the ones in the archive (maybe save your config first, if you've made any changes to it). The new configuration parameter is XSDE_STL_ITERATOR. Finally, clean ('make clean') and rebuild ('make') the XSD/e runtime (libxsde). And that's it. If you try to compile the above code again with XSDE_STL_ITERATOR enabled, you will still get an error, though a different one. This has to do with the predicate that you are passing to find_if. Right now that predicate will result in a call like this: strcmp (*i, "ADC1_data_dia"); Here 'i' is NodeType::TxMessage_iterator and '*i' is TxMessageType. See the problem? What you actually need for the above call to work is this: strcmp (i->Name ().c_str (), "ADC1_data_dia"); I don't think there is a way to get this with the bind functionality (you might be able to achieve this with Boost though). Instead, you will need to write your own predicate, something along these lines: struct pred { pred (const char* v): v_ (v) {} bool operator() (const TxMessageType& x) const {return x.Name () == v_;} const char* v_; }; And then: find_if(nodeForMsg->TxMessage().begin(), nodeForMsg->TxMessage().end(), pred("ADC1_data_dia")); Boris From Duncan.Perrett at elekta.com Wed Oct 7 04:18:10 2009 From: Duncan.Perrett at elekta.com (Duncan.Perrett@elekta.com) Date: Wed Oct 7 04:32:51 2009 Subject: [xsde-users] find() in sequences In-Reply-To: References: Message-ID: Boris, That's great. I had assumed that the iterator support wasn't there. I also realized that something wasn't right about my find_if() call not using Name(). I had been looking at ptr_fun, mem_fun, bind2nd etc in the STL book. When you mentioned the predicate solution - I saw that it was in the book a few pages earlier. Perfect. However, I have since gone on to just do this ... for (NodeType::TxMessage_const_iterator j = i->TxMessage().begin(); j != i->TxMessage().end(); ++j) // for each TxMessage of the Node { if (j->Name() == "ADC1_data_dia") { msgTxMsgNum = j; msgNodeNum = i; cout << "match for msg ADC1_data_carr" << " in Node " << i->Name() << " msg no. " << numCANMsgs++ << endl; } numCANMsgs++; } Would installing the iterator support and using find_if() with a predicate be worth doing? Would it be faster/smaller etc? I may end up doing this sort of search once at initialisation so I'm not too worried about speed. Thanks, Duncan From boris at codesynthesis.com Wed Oct 7 04:47:43 2009 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Oct 7 04:40:13 2009 Subject: [xsde-users] find() in sequences In-Reply-To: References: Message-ID: Hi Duncan, Duncan.Perrett@elekta.com writes: > However, I have since gone on to just do this ... > > for (NodeType::TxMessage_const_iterator j = > i->TxMessage().begin(); j != i->TxMessage().end(); ++j) // for each > TxMessage of the Node > { > if (j->Name() == "ADC1_data_dia") > { > msgTxMsgNum = j; > msgNodeNum = i; > cout << "match for msg ADC1_data_carr" << > " in Node " << i->Name() << " msg no. " << > numCANMsgs++ << endl; > } > > numCANMsgs++; > } > > > Would installing the iterator support and using find_if() with a predicate > be worth doing? Would it be faster/smaller etc? It is not going to be faster since find_if() does essentially the same. I also don't think it will be smaller in terms of object code size. It definitely looks more elegant if you can use the bind technique but with a custom predicate it becomes much less appealing unless you have a lot of places where you call find_if() with the same predicate. So I would say use the loop approach if you only need to do it once. Boris From Duncan.Perrett at elekta.com Wed Oct 7 06:21:54 2009 From: Duncan.Perrett at elekta.com (Duncan.Perrett@elekta.com) Date: Wed Oct 7 07:02:27 2009 Subject: [xsde-users] XSD or XSD/e? In-Reply-To: References: Message-ID: Boris - another one for you ; ) I have an ID in the XML file which is a hex number, eg: 0x3C my schema decribes this as BUT this isn't a string. Can I use decimal even though it's in hex? Should I try and get the XML to use pure decimal? Regards, Duncan From boris at codesynthesis.com Wed Oct 7 07:25:25 2009 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Oct 7 07:17:57 2009 Subject: [xsde-users] hex integer representation Message-ID: Hi Duncan, Duncan.Perrett@elekta.com writes: > I have an ID in the XML file which is a hex number, eg: > > 0x3C > > my schema decribes this as > > > > BUT this isn't a string. > > Can I use decimal even though it's in hex? No, none of the built-in schema types support the hex notation you are using above. > Should I try and get the XML to use pure decimal? That would probably be the easiest way. If you need to to keep it in hex and also want to a convenient object model, then you can use type/parse/serializer customization to re-map it to, say, int. You would basically need to do the following: 1. Define a type in XML Schema, say hexInt: 2. When compiling your schemas, re-map hexInt to, say, int. For more information on how to do this see Section 4.8, "Customizing the Object Model" in the C++/Hybrid Mapping Getting Started Guide: http://www.codesynthesis.com/projects/xsde/documentation/cxx/hybrid/guide/#4.8 3. Provide custom parser and serializer implementations for the hexInt type. You can use, for example strtoul or std::istringstream to convert the string to int and sptrintf or std::ostringstream to convert it back to string. For more information on this part, see Section 6.1, "Customizing Parsers and Serializers": http://www.codesynthesis.com/projects/xsde/documentation/cxx/hybrid/guide/#6.1 There is also an example in custom/wildcard which shows how to customization a type in the object model as well as the parser and serializer for it. Boris From tftomsun at streamteam.de Tue Oct 20 05:55:35 2009 From: tftomsun at streamteam.de (Thomas Frenzel (TomSun)) Date: Tue Oct 20 05:55:45 2009 Subject: [xsde-users] Determine whether an object model supports polymorphism In-Reply-To: boris.20090923075440@codesynthesis.com Message-ID: <20091020095535.4c80a438@streamteam.de> Hello Boris, is there any possibility to determine whether a xml object model has been generated with polymorphism support? I would like to have a static bool on the generated object model or the generated parser/serializer classes. Something like: bool MyGeneratedRoot.SupportsPolymorphism() or bool MyGeneratedRoot_paggr.SupportsPolymorphism() Btw. you wanted to provide a beta version including the code generation of enumerations. I am still interested in that beta. :) Best Regards, Tom _____ From: Boris Kolpackov [mailto:boris@codesynthesis.com] To: Samuel Toulouse [mailto:stoulouse@me.com] Cc: xsde-users@codesynthesis.com Sent: Wed, 23 Sep 2009 08:40:52 +0200 Subject: [xsde-users] variable vs fixed-length types Hi Samuel, I have CC'ed the xsde-users mailing list to my reply since other people may be interested this. In general, let's keep our discussions CC'ed to this list so that they will be available to others. Samuel Toulouse writes: > I'm using XSD/e more and more. I'm using XDR binary as it is very > simple, I'd love to see a non-cross platform, compiler specific binary > format, Have you tried the raw binary format from the examples/cxx/hybrid/binary/custom/ example yet? > but that's a discussion we already had, if one day you'll find > it useful, then I'll start to use XSD/e everywhere to generate nearly > all my code/data structures :) I remember you promised some benchmark results for XDR and that custom format I mentioned above ;-). > I've encountered a problem. Let say you want to have a Vector4 type, > there is two way to do it: > > > > > > > > > or: > > > > > > > > > > the problem is: > if you use the first method, you won't be able to change the default > value when declaring a Vector4 element: > > > maxOccurs="1"/> > > > if you use the second method, then this time, XSD/e will consider > Vector4 as a variable-length type with a podSequence, which is not true > because we've used the length facet to have a fixed length type. > I'd like to be able to use the second method if it generates a fixed- > length structure because I'll be able to use default values. Hm, I see what you mean. However, it is not that clear cut. What if the length is set to 1000? Would you still want the resulting type to be treated as fixed-length and copied by value? While there won't be dynamic memory allocations, there will still be the copying of all the elements which can be quite expensive. I guess there should be some limit (probably configurable) on the length. Once it is exceeded, the type is considered variable-length. There are also implementation issues. In the above example, Vector4 will be derived from FloatList which is a normal, unlimited sequence, with dynamic memory allocation, etc. It is not clear how to convert it to a fixed-length one with pre-allocated buffer. I guess one way would be to make the base sequence use the buffer provided by the derived type. BTW, how many types like this do you have? Samuel Toulouse writes: > I was thinking that in my opinion the rule should be: > if there is a length or a maxLength facet, then memory size should be > reserved and structure should be of fixed size. > for example, if you declare a string like this: > > > > > > > > > > > then it should generate something like this: > class Struct { > private: > char filename_[64]; > }; I am not sure maxLength should always result in pre-allocation. Semantically, maxLength places the limit on the number of elements and doesn't really say how many element there will be, typically. For example, an implementation may have a limit of 64Kb and put this value in the maxLength facet while, typically, there won't be more than, say, 10 elements. In this case we probably won't want to have 64Kb pre-allocated for every instance. On the other hand, if maxLength is some small number, say 4, then it probably makes sense to pre-allocate the buffer. Again, I think the strategy here should be to have a configurable limit that one can set while compiling the schemas. The other issue are the string-based types. The length and maxLength facets for these types are defined in terms of Unicode characters. XSD/e stores them in UTF-8. So if you have 64 as maxLength for string, the pre-allocated buffer should be 64*4 to accommodate all cases while, typically, most if that space will be unused. It will also be impossible to pull off that buffer substitution trick mentioned above with std::string. So it seems the only types for which such an optimization is practical are xsd:list and xsd:{hex,base64}Binary. I could try to implement it for xsd:list if you really need it. Boris From boris at codesynthesis.com Tue Oct 20 09:24:31 2009 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Oct 20 09:18:36 2009 Subject: [xsde-users] Re: Determine whether an object model supports polymorphism In-Reply-To: <20091020095535.4c80a438@streamteam.de> References: <20091020095535.4c80a438@streamteam.de> Message-ID: Hi Thomas, Thomas Frenzel (TomSun) writes: > is there any possibility to determine whether a xml object model has > been generated with polymorphism support? I would like to have a static > bool on the generated object model or the generated parser/serializer > classes. Something like: > > bool MyGeneratedRoot.SupportsPolymorphism() > > or bool MyGeneratedRoot_paggr.SupportsPolymorphism() No, there is no such thing at the moment. The closest you can get is to check for the XSDE_POLYMORPHIC macro which indicates that the runtime library has been built with polymorphism support. However, it is still possible to compile the schemas without polymorphism support by specifying the --runtime-polymorphic option instead of --generate-polymorphic. I am also having a hard time imagining where would such a test be useful. I can see where checking if a particular type (as opposed to the whole object model) is polymorphic can be useful. Can you tell us a bit more about what you are trying to achieve? > Btw. you wanted to provide a beta version including the code > generation of enumerations. I am still interested in that beta. :) I sent an email outlining the design and asked for feedback but haven't heard back. So I figured that you must have gotten pulled into something else. Perhaps the email just got lots. Here it is in the archives: http://www.codesynthesis.com/pipermail/xsde-users/2009-October/000158.html If you can let me know what you think, I can go ahead and implement this. Boris From tftomsun at streamteam.de Tue Oct 20 10:58:41 2009 From: tftomsun at streamteam.de (Thomas Frenzel (TomSun)) Date: Tue Oct 20 10:58:51 2009 Subject: [xsde-users] Re: Determine whether an object model supports polymorphism In-Reply-To: boris.20091020151328@codesynthesis.com Message-ID: <20091020145841.04868da8@streamteam.de> Hi Boris, Quote 1: I am also having a hard time imagining where would such a test be useful. I can see where checking if a particular type (as opposed to the whole object model) is polymorphic can be useful. Can you tell us a bit more about what you are trying to achieve? I've implemented a template class called "XmlManager" that takes the xsde generated ObjectModel class, the Serializer (*_saggr) class and the Parserclass (*_paggr) as the type parameters. This template class provides functions like WriteToFile(string), ReadFromFile(string), WriteToStream(iostream), ReadFromStream(iostream). The XmlManager should work for all xsde generated classes, equal if they use polymorphism or not (i use both variants within the same process). Within the XmlManager template class i need the information whether the given object model class uses polymorphism or not in 3 cases (currently the boolean m_polymorphic indicates if the object model uses polymorphism): ... TParser parser; xml_schema::document_pimpl documentParser( parser.root_parser (), parser.root_name (),m_polymorphic); ... ... TSerializer serializer; xml_schema::document_simpl documentSerializer ( serializer.root_serializer (), serializer.root_name (),m_polymorphic); ... ... if(m_polymorphic) { documentSerializer.add_prefix("xsi","http://www.w3.org/2001/XMLSchema-instance"); } ... At the moment i have always to pass to the constructor of my XmlManager the polymorphic flag. The main idea of the XmlManager is, that nobody needs to know anything about the way how the objects will be serialized/deserialized in the background, also not whether polymorphism is used or not. Additional to the XmlManager i've implemented some nice macros that resolves the serializer and parser class for me so that i only need to pass the generated object model class to serialize/deserialize it. My final code lokes like that: (MySuperman is the generated class for the xml root object): ... MySuperman* mySupermanInstance = XML_MANAGER(MySuperman)->ReadFromFile("C:\\temp.xml"); XML_MANAGER(MySuperman)->WriteToFile("C:\\temp_out.xml"); ... Quote 2: I sent an email outlining the design and asked for feedback but haven't heard back. So I figured that you must have gotten pulled into something else. Perhaps the email just got lots. Here it is in the archives: oh, this was a misunderstanding. I didn't know, that you wait for a feedback. Yes the implementation looks sufficient for my needs. I am happy as long as i can convert from the string representation to the numeric representation and vice versa. Maybe an constructor overload that takes the string/char* would be useful, too. It would be nice if you could post the cpp file of your color example. _____ From: Boris Kolpackov [mailto:boris@codesynthesis.com] To: Thomas Frenzel (TomSun) [mailto:tftomsun@streamteam.de] Cc: xsde-users@codesynthesis.com Sent: Tue, 20 Oct 2009 15:24:31 +0200 Subject: Re: Determine whether an object model supports polymorphism Hi Thomas, Thomas Frenzel (TomSun) writes: > is there any possibility to determine whether a xml object model has > been generated with polymorphism support? I would like to have a static > bool on the generated object model or the generated parser/serializer > classes. Something like: > > bool MyGeneratedRoot.SupportsPolymorphism() > > or bool MyGeneratedRoot_paggr.SupportsPolymorphism() No, there is no such thing at the moment. The closest you can get is to check for the XSDE_POLYMORPHIC macro which indicates that the runtime library has been built with polymorphism support. However, it is still possible to compile the schemas without polymorphism support by specifying the --runtime-polymorphic option instead of --generate-polymorphic. I am also having a hard time imagining where would such a test be useful. I can see where checking if a particular type (as opposed to the whole object model) is polymorphic can be useful. Can you tell us a bit more about what you are trying to achieve? > Btw. you wanted to provide a beta version including the code > generation of enumerations. I am still interested in that beta. :) I sent an email outlining the design and asked for feedback but haven't heard back. So I figured that you must have gotten pulled into something else. Perhaps the email just got lots. Here it is in the archives: http://www.codesynthesis.com/pipermail/xsde-users/2009-October/000158.html If you can let me know what you think, I can go ahead and implement this. Boris From tftomsun at streamteam.de Tue Oct 20 11:04:26 2009 From: tftomsun at streamteam.de (Thomas Frenzel (TomSun)) Date: Tue Oct 20 11:04:37 2009 Subject: [xsde-users] Re: Determine whether an object model supports polymorphism In-Reply-To: 20091020145841.04868da8@streamteam.de Message-ID: <20091020150426.957b2691@streamteam.de> Hi Boris, there were some mistakes in my example methods. Maybe this is a bit confusing. I fixed it ... see below _____ From: Thomas Frenzel (TomSun) [mailto:tftomsun@streamteam.de] To: Boris Kolpackov [mailto:boris@codesynthesis.com] Cc: xsde-users@codesynthesis.com Sent: Tue, 20 Oct 2009 16:58:41 +0200 Subject: [xsde-users] Re: Determine whether an object model supports polymorphism Hi Boris, Quote 1: I am also having a hard time imagining where would such a test be useful. I can see where checking if a particular type (as opposed to the whole object model) is polymorphic can be useful. Can you tell us a bit more about what you are trying to achieve? I've implemented a template class called "XmlManager" that takes the xsde generated ObjectModel class, the Serializer (*_saggr) class and the Parserclass (*_paggr) as the type parameters. This template class provides functions like void WriteToFile(string, TData), TData* ReadFromFile(string), void WriteToStream(iostream, TData), TData* ReadFromStream(iostream). The XmlManager should work for all xsde generated classes, equal if they use polymorphism or not (i use both variants within the same process). Within the XmlManager template class i need the information whether the given object model class uses polymorphism or not in 3 cases (currently the boolean m_polymorphic indicates if the object model uses polymorphism): ... TParser parser; xml_schema::document_pimpl documentParser( parser.root_parser (), parser.root_name (),m_polymorphic); ... ... TSerializer serializer; xml_schema::document_simpl documentSerializer ( serializer.root_serializer (), serializer.root_name (),m_polymorphic); ... ... if(m_polymorphic) { documentSerializer.add_prefix("xsi","http://www.w3.org/2001/XMLSchema-instance"); } ... At the moment i have always to pass to the constructor of my XmlManager the polymorphic flag. The main idea of the XmlManager is, that nobody needs to know anything about the way how the objects will be serialized/deserialized in the background, also not whether polymorphism is used or not. Additional to the XmlManager i've implemented some nice macros that resolves the serializer and parser class for me so that i only need to pass the generated object model class to serialize/deserialize it. My final code lokes like that: (MySuperman is the generated class for the xml root object): ... MySuperman* mySupermanInstance = XML_MANAGER(MySuperman)->ReadFromFile("C:\\temp.xml"); XML_MANAGER(MySuperman)->WriteToFile("C:\\temp_out.xml", mySupermanInstance); ... Quote 2: I sent an email outlining the design and asked for feedback but haven't heard back. So I figured that you must have gotten pulled into something else. Perhaps the email just got lots. Here it is in the archives: oh, this was a misunderstanding. I didn't know, that you wait for a feedback. Yes the implementation looks sufficient for my needs. I am happy as long as i can convert from the string representation to the numeric representation and vice versa. Maybe an constructor overload that takes the string/char* would be useful, too. It would be nice if you could post the cpp file of your color example. _____ From: Boris Kolpackov [mailto:boris@codesynthesis.com] To: Thomas Frenzel (TomSun) [mailto:tftomsun@streamteam.de] Cc: xsde-users@codesynthesis.com Sent: Tue, 20 Oct 2009 15:24:31 +0200 Subject: Re: Determine whether an object model supports polymorphism Hi Thomas, Thomas Frenzel (TomSun) writes: > is there any possibility to determine whether a xml object model has > been generated with polymorphism support? I would like to have a static > bool on the generated object model or the generated parser/serializer > classes. Something like: > > bool MyGeneratedRoot.SupportsPolymorphism() > > or bool MyGeneratedRoot_paggr.SupportsPolymorphism() No, there is no such thing at the moment. The closest you can get is to check for the XSDE_POLYMORPHIC macro which indicates that the runtime library has been built with polymorphism support. However, it is still possible to compile the schemas without polymorphism support by specifying the --runtime-polymorphic option instead of --generate-polymorphic. I am also having a hard time imagining where would such a test be useful. I can see where checking if a particular type (as opposed to the whole object model) is polymorphic can be useful. Can you tell us a bit more about what you are trying to achieve? > Btw. you wanted to provide a beta version including the code > generation of enumerations. I am still interested in that beta. :) I sent an email outlining the design and asked for feedback but haven't heard back. So I figured that you must have gotten pulled into something else. Perhaps the email just got lots. Here it is in the archives: http://www.codesynthesis.com/pipermail/xsde-users/2009-October/000158.html If you can let me know what you think, I can go ahead and implement this. Boris From boris at codesynthesis.com Wed Oct 21 10:41:09 2009 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Oct 21 10:35:27 2009 Subject: [xsde-users] Re: Determine whether an object model supports polymorphism In-Reply-To: <20091020145841.04868da8@streamteam.de> References: <20091020145841.04868da8@streamteam.de> Message-ID: Hi Thomas, Thomas Frenzel (TomSun) writes: > Within the XmlManager template class i need the information whether > the given object model class uses polymorphism or not in 3 cases > (currently the boolean m_polymorphic indicates if the object model > uses polymorphism): Thanks for the explanation, it makes sense. I will add the boolean member to the *_paggs and *_saggr classes. > Yes the implementation looks sufficient for my needs. I am happy as long > as i can convert from the string representation to the numeric > representation and vice versa. Ok, I will go ahead and implement this then. Should have something for you to try in a few days unless I get sidetracked. > Maybe an constructor overload that takes the string/char* would be > useful, too. Yes, it could be useful but it would also complicate things since there should be error handling (with and without exceptions), etc. I will keep it minimal for now and see how it goes. > It would be nice if you could post the cpp file of your color example. It will be something along these lines: inline color: color () v_ (red) { } inline color: color (value v) v_ (v) { } inline color: operator value () const { return v_; } static const char* color_str_[] = {"red", "green", "blue"}; const char* color: string () const { return color_str_[v_]; } Boris From tftomsun at streamteam.de Wed Oct 21 13:25:30 2009 From: tftomsun at streamteam.de (Thomas Frenzel (TomSun)) Date: Wed Oct 21 13:25:39 2009 Subject: [xsde-users] Re: Determine whether an object model supports polymorphism In-Reply-To: boris.20091021163044@codesynthesis.com Message-ID: <20091021172530.9c9bfb38@streamteam.de> Hello Boris, first of all, thanks for your positive reply. Quote: Yes, it could be useful but it would also complicate things since there should be error handling (with and without exceptions), etc. I will keep it minimal for now and see how it goes. Maybe you could reduce the effort in the generated code if you provide in your lib a static method... something like static int ParseEnum(char* value, const char*[] enumNames) { // TODO do the error handling and getting the integer representation of the enum value here. } and you could just generated the constructor like this inline color: color (char* enumName) v_ ((value)::ParseEnum(enumName,color_str_)) { } _____ From: Boris Kolpackov [mailto:boris@codesynthesis.com] To: Thomas Frenzel (TomSun) [mailto:tftomsun@streamteam.de] Cc: xsde-users@codesynthesis.com Sent: Wed, 21 Oct 2009 16:41:09 +0200 Subject: Re: Determine whether an object model supports polymorphism Hi Thomas, Thomas Frenzel (TomSun) writes: > Within the XmlManager template class i need the information whether > the given object model class uses polymorphism or not in 3 cases > (currently the boolean m_polymorphic indicates if the object model > uses polymorphism): Thanks for the explanation, it makes sense. I will add the boolean member to the *_paggs and *_saggr classes. > Yes the implementation looks sufficient for my needs. I am happy as long > as i can convert from the string representation to the numeric > representation and vice versa. Ok, I will go ahead and implement this then. Should have something for you to try in a few days unless I get sidetracked. > Maybe an constructor overload that takes the string/char* would be > useful, too. Yes, it could be useful but it would also complicate things since there should be error handling (with and without exceptions), etc. I will keep it minimal for now and see how it goes. > It would be nice if you could post the cpp file of your color example. It will be something along these lines: inline color: color () v_ (red) { } inline color: color (value v) v_ (v) { } inline color: operator value () const { return v_; } static const char* color_str_[] = {"red", "green", "blue"}; const char* color: string () const { return color_str_[v_]; } Boris From boris at codesynthesis.com Thu Oct 22 08:52:48 2009 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Oct 22 08:47:19 2009 Subject: [xsde-users] Re: Determine whether an object model supports polymorphism In-Reply-To: <20091021172530.9c9bfb38@streamteam.de> References: <20091021172530.9c9bfb38@streamteam.de> Message-ID: Hi Thomas, Thomas Frenzel (TomSun) writes: > Maybe you could reduce the effort in the generated code if you > provide in your lib a static method... something like It is not really the effort to generate the code that is the issue. It is the interface (no clean way to report errors when exceptions are disabled) as well as the generated code size concern. So I am trying to keep things as minimal as possible. Do you need this functionality (i.e., conversion from a string representation to enum other than during XML parsing) right now in your application? Or is it something that might be useful in the future? > > static int ParseEnum(char* value, const char*[] enumNames) > { > // TODO do the error handling and getting the integer representation > of the enum value here. > } What if I have two enums that have the same value bit at different "positions" ;-)? > and you could just generated the constructor like this > inline color: > color (char* enumName) > v_ ((value)::ParseEnum(enumName,color_str_)) > { > } No, I don't like this. It should be either implemented properly or not implemented at all. Having a half-done solution is very costly to support. Boris From tftomsun at streamteam.de Fri Oct 23 09:01:22 2009 From: tftomsun at streamteam.de (Thomas Frenzel (TomSun)) Date: Fri Oct 23 09:01:33 2009 Subject: [xsde-users] Re: Determine whether an object model supports polymorphism In-Reply-To: boris.20091022144435@codesynthesis.com Message-ID: <20091023130122.5de14b26@streamteam.de> Hello Boris, Quote 1: Do you need this functionality (i.e., conversion from a string representation to enum other than during XML parsing) right now in your application? Or is it something that might be useful in the future? I don't need this feature at the moment. So, for me its not necessary to implement it now. Its like you said, i just thought its maybe a nice to have feature. If i really need it one day, then i can write you an email again. Quote 2: What if I have two enums that have the same value bit at different "positions" ;-)? Hm, i don't know if i understand the problem. The Parse method would take the string (char*) that has been passed to the Color constructor and the static array of the Color names. So you just need a loop and compare the input name with all the names from the static array. Dependend on constructor you call, you will always pass a different char* array. So even if you define two names twice in two different enumerations, you would still get the right index for each of them. _____ From: Boris Kolpackov [mailto:boris@codesynthesis.com] To: Thomas Frenzel (TomSun) [mailto:tftomsun@streamteam.de] Cc: xsde-users@codesynthesis.com Sent: Thu, 22 Oct 2009 14:52:48 +0200 Subject: Re: Determine whether an object model supports polymorphism Hi Thomas, Thomas Frenzel (TomSun) writes: > Maybe you could reduce the effort in the generated code if you > provide in your lib a static method... something like It is not really the effort to generate the code that is the issue. It is the interface (no clean way to report errors when exceptions are disabled) as well as the generated code size concern. So I am trying to keep things as minimal as possible. Do you need this functionality (i.e., conversion from a string representation to enum other than during XML parsing) right now in your application? Or is it something that might be useful in the future? > > static int ParseEnum(char* value, const char*[] enumNames) > { > // TODO do the error handling and getting the integer representation > of the enum value here. > } What if I have two enums that have the same value bit at different "positions" ;-)? > and you could just generated the constructor like this > inline color: > color (char* enumName) > v_ ((value)::ParseEnum(enumName,color_str_)) > { > } No, I don't like this. It should be either implemented properly or not implemented at all. Having a half-done solution is very costly to support. Boris From acheesehead at gmail.com Fri Oct 23 12:16:26 2009 From: acheesehead at gmail.com (Todd Peterson) Date: Mon Oct 26 09:39:21 2009 Subject: [xsde-users] QNX binary lib Message-ID: Does this lib exist for download? Or, are there instructions for building for QNX? -- Todd Peterson Rio Rancho, NM From boris at codesynthesis.com Mon Oct 26 10:01:19 2009 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Oct 26 09:56:43 2009 Subject: [xsde-users] QNX binary lib In-Reply-To: References: Message-ID: Hi Todd, Todd Peterson writes: > Does this lib exist for download? Or, are there instructions for building > for QNX? There are two components in the XSD/e distribution: the compiler itself (bin/xsde) and the runtime library (libxsde) that is used by the generated code. The XSD/e compiler is not available for the QNX native development environment. It is normally executed on a host development platform (e.g., Linux or Windows) on which cross-compilation is performed. Or you can just generate the code on any Linux or Windows box and copy it over to the QNX target for compilation. The runtime library (libxsde) can be built natively on a QNX target or cross-compiled from a Linux or Windows box. The instructions on how to build libxsde are in the INSTALL file that comes with the binary distributions (for QNX use the GNU make section): http://www.codesynthesis.com/products/xsde/download.xhtml There are also a number of sample configuration files for QNX in the etc/qnx/ directory. Boris From boris at codesynthesis.com Tue Oct 27 04:19:01 2009 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Oct 27 04:14:44 2009 Subject: [xsde-users] C++ enum mapping In-Reply-To: <20091023130122.5de14b26@streamteam.de> References: <20091023130122.5de14b26@streamteam.de> Message-ID: <20091027081901.GA21285@onega.codesynthesis.com> Hi Thomas, I have implemented the XML Schema enumeration to C++ enum mapping for C++/Hybrid but looking at your previous emails I am not sure if that's the mapping you are using. Your original email was talking about C++/Parser and C++/Serializer though your recent emails (e.g., the one about detecting polymorphism) are about C++/Hybrid. Can you also let me know which host development platform you are using so that I can build you a pre-release binary? Boris From tftomsun at streamteam.de Tue Oct 27 05:13:46 2009 From: tftomsun at streamteam.de (Thomas Frenzel (TomSun)) Date: Tue Oct 27 05:13:56 2009 Subject: [xsde-users] Re: C++ enum mapping In-Reply-To: 20091027081901.GA21285@onega.codesynthesis.com Message-ID: <20091027091346.9ae2ebb9@streamteam.de> Hi Boris, hybrid is already perfect. I use mostly the following parameters to generate the code: Xsde\bin\xsde.exe cxx-hybrid --no-stl --no-iostream --generate-parser --generate-serializer --generate-aggregate --generate-typeinfo --generate-polymorphic --no-long-long MySchema.xsd I use xsd/e to exchange data between an embedded WinCE 5.0 device or Win32 PC and .NET code. For the .NET side, i use another code generator called CodeXS. The code that uses Xsde runs on Win CE as well as on Win 32. I just build the different versions against different Xsde Builds. I've attached my config files that i use to build the xsde.lib's for both platforms. Maybe u can use these configurations to build the pre-release. Thank you in advance, Regards, Thomas _____ From: Boris Kolpackov [mailto:boris@codesynthesis.com] To: Thomas Frenzel (TomSun) [mailto:tftomsun@streamteam.de] Cc: xsde-users@codesynthesis.com Sent: Tue, 27 Oct 2009 09:19:01 +0100 Subject: C++ enum mapping Hi Thomas, I have implemented the XML Schema enumeration to C++ enum mapping for C++/Hybrid but looking at your previous emails I am not sure if that's the mapping you are using. Your original email was talking about C++/Parser and C++/Serializer though your recent emails (e.g., the one about detecting polymorphism) are about C++/Hybrid. Can you also let me know which host development platform you are using so that I can build you a pre-release binary? Boris -------------- next part -------------- A non-text attachment was scrubbed... Name: config.nmake.winCE_min_withExAndPoly_MTd Type: application/octet-stream Size: 5568 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsde-users/attachments/20091027/21b6dac2/config.nmake.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: config.nmake.win32_min_withExAndPoly_MTd Type: application/octet-stream Size: 5225 bytes Desc: not available Url : http://codesynthesis.com/pipermail/xsde-users/attachments/20091027/21b6dac2/config.nmake-0001.obj From boris at codesynthesis.com Tue Oct 27 10:24:13 2009 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Oct 27 10:19:52 2009 Subject: [xsde-users] Re: C++ enum mapping In-Reply-To: <20091027091346.9ae2ebb9@streamteam.de> References: <20091027091346.9ae2ebb9@streamteam.de> Message-ID: Hi Thomas, Thomas Frenzel (TomSun) writes: > I use xsd/e to exchange data between an embedded WinCE 5.0 device or > Win32 PC and .NET code. Ok, the binary is ready: http://www.codesynthesis.com/~boris/tmp/xsde-3.2.0.a1-i686-windows.zip You should be able to just copy your config files over and use it as xsde-3.1.0-i686-windows. The two relevant changes are (quoting the NEWS file): * String-based types that use XML Schema restriction by enumeration are now mapped to C++ classes with semantics similar to C++ enum. You can suppress this new mapping and instead get the old behavior (plain inheritance) by specifying the --suppress-enum compiler option. See Section 4.3, "Enumerations" in the Getting Started Guide for more information. * When the code is generated with the --generate-polymorphic or --runtime-polymorphic option, the resulting parser and serializer aggregate classes provide the static polymorphic() function which returns true if the object model corresponding to the root element or root type is polymorphic and false otherwise. This can be used together with the XSDE_POLYMORPHIC macro to implement generic parsing and serialization code that works with both polymorphic and non- polymorphic object models. Let us know if you run into any problems. Boris From tftomsun at streamteam.de Tue Oct 27 12:36:01 2009 From: tftomsun at streamteam.de (Thomas Frenzel (TomSun)) Date: Tue Oct 27 12:36:13 2009 Subject: [xsde-users] Re: C++ enum mapping In-Reply-To: boris.20091027162004@codesynthesis.com Message-ID: <20091027163601.1cbcb2df@streamteam.de> Hi Boris, i've already tried the pre-release version. Everything works fine (the static polymorphic() method as well as the enum mapping). Very nice... :) Thank you! Regards, Tom _____ From: Boris Kolpackov [mailto:boris@codesynthesis.com] To: Thomas Frenzel (TomSun) [mailto:tftomsun@streamteam.de] Cc: xsde-users@codesynthesis.com Sent: Tue, 27 Oct 2009 15:24:13 +0100 Subject: Re: C++ enum mapping Hi Thomas, Thomas Frenzel (TomSun) writes: > I use xsd/e to exchange data between an embedded WinCE 5.0 device or > Win32 PC and .NET code. Ok, the binary is ready: http://www.codesynthesis.com/~boris/tmp/xsde-3.2.0.a1-i686-windows.zip You should be able to just copy your config files over and use it as xsde-3.1.0-i686-windows. The two relevant changes are (quoting the NEWS file): * String-based types that use XML Schema restriction by enumeration are now mapped to C++ classes with semantics similar to C++ enum. You can suppress this new mapping and instead get the old behavior (plain inheritance) by specifying the --suppress-enum compiler option. See Section 4.3, "Enumerations" in the Getting Started Guide for more information. * When the code is generated with the --generate-polymorphic or --runtime-polymorphic option, the resulting parser and serializer aggregate classes provide the static polymorphic() function which returns true if the object model corresponding to the root element or root type is polymorphic and false otherwise. This can be used together with the XSDE_POLYMORPHIC macro to implement generic parsing and serialization code that works with both polymorphic and non- polymorphic object models. Let us know if you run into any problems. Boris From tftomsun at streamteam.de Wed Oct 28 07:22:13 2009 From: tftomsun at streamteam.de (Thomas Frenzel (TomSun)) Date: Wed Oct 28 07:22:23 2009 Subject: [xsde-users] Unicode support Message-ID: <20091028112213.e8164754@streamteam.de> Hi Boris, is there a possibility to generate the xsde with unicode support? For example ther should be used the wchar_t* instead of char*? Regards, Tom From boris at codesynthesis.com Wed Oct 28 10:18:41 2009 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Oct 28 10:14:33 2009 Subject: [xsde-users] Re: Unicode support In-Reply-To: <20091028112213.e8164754@streamteam.de> References: <20091028112213.e8164754@streamteam.de> Message-ID: Hi Thomas, Thomas Frenzel (TomSun) writes: > is there a possibility to generate the xsde with unicode support? The generated code supports Unicode by default. The text in the object model is encoded in UTF-8. > For example ther should be used the wchar_t* instead of char*? No this is not supported. If you need to access the text as wchar_t- based string then you will need to manually convert char/UTF-8 to wchar_t/UTF-16. Boris From tftomsun at streamteam.de Fri Oct 30 09:29:19 2009 From: tftomsun at streamteam.de (Thomas Frenzel (TomSun)) Date: Fri Oct 30 09:29:31 2009 Subject: [xsde-users] Re: Unicode support In-Reply-To: boris.20091028161346@codesynthesis.com Message-ID: <20091030132919.06005b71@streamteam.de> Hi Boris, thank you for the information. I just didn't know enough about the difference between the encodings. I thought before that UTF-16 supports more characters than UTF-8, but its just another encoding algorithm. Regards, Tom _____ From: Boris Kolpackov [mailto:boris@codesynthesis.com] To: Thomas Frenzel (TomSun) [mailto:tftomsun@streamteam.de] Cc: xsde-users@codesynthesis.com Sent: Wed, 28 Oct 2009 15:18:41 +0100 Subject: Re: Unicode support Hi Thomas, Thomas Frenzel (TomSun) writes: > is there a possibility to generate the xsde with unicode support? The generated code supports Unicode by default. The text in the object model is encoded in UTF-8. > For example ther should be used the wchar_t* instead of char*? No this is not supported. If you need to access the text as wchar_t- based string then you will need to manually convert char/UTF-8 to wchar_t/UTF-16. Boris From tftomsun at streamteam.de Fri Oct 30 09:37:21 2009 From: tftomsun at streamteam.de (Thomas Frenzel (TomSun)) Date: Fri Oct 30 09:37:33 2009 Subject: [xsde-users] Disable automatic deletion of char arrays. In-Reply-To: boris.20091028161346@codesynthesis.com Message-ID: <20091030133721.92ac464a@streamteam.de> Hi Boris, i have a new question :) Is there a possibility to turn of the automatic deletion of char arrays and/or other aggregeted pointer based values when the generated class will be deleted? I mean, mostly this is exactly what i want to do, but sometimes i just want to pass a const char array to one of the generated class instances without copying it before. In these cases i have to copy data even if its not necessary. I think an extension of the default constructor with an bool that is false by default would be nice. public MyGeneratedClass(bool deleteAggregatesOnFinalize = false) { .... } Regards, Tom _____ From: Boris Kolpackov [mailto:boris@codesynthesis.com] To: Thomas Frenzel (TomSun) [mailto:tftomsun@streamteam.de] Cc: xsde-users@codesynthesis.com Sent: Wed, 28 Oct 2009 15:18:41 +0100 Subject: Re: Unicode support Hi Thomas, Thomas Frenzel (TomSun) writes: > is there a possibility to generate the xsde with unicode support? The generated code supports Unicode by default. The text in the object model is encoded in UTF-8. > For example ther should be used the wchar_t* instead of char*? No this is not supported. If you need to access the text as wchar_t- based string then you will need to manually convert char/UTF-8 to wchar_t/UTF-16. Boris