Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question

Question about GigaSpaces C++ gsxml2cpp Utility


We want to generate two serializer code files with gsxml2cpp utility.
But we have got some problems.

For Parent class, we can create the serializer code (PareentClass.cpp) & header (ParentClass.h) with gzxml2cpp.
But we fail to generate the corrected Child class.
The Child class is inherited from Parent class. We add the following elements into the child.gs.xml file.

<include-header file="ParentClass.h" />
    <class name="ChildClass" persist="false" replicate="false" fifo="false" >
        <superclass name="ParentClass" />

The generated ChildClassSerializer class (ChildClass.cpp) is inherited from ParentClassSerializer class.
The ParentClassSerializer class is declared in ParentClass.cpp (generated by gsxml2cpp).
But ChildClass.cpp is included ParentClass.h header file only.
Then the generated ChildClass code (ChildClass.cpp) will fail to compile due to undeclaration of the ParentClassSerializer class.

How to fix the problem?
Is there any missing element for our chlid.gs.xml?

Our XAP version:
- premium v7.1.0 m4
- Linux
- gcc 3.4.5


This thread was imported from the previous forum.
For your reference, the original is available here

asked 2009-12-22 20:57:23 -0500

yanchan's avatar

updated 2013-08-08 09:52:00 -0500

jaissefsfex's avatar
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted


Take a look on the \gigaspaces-xap-premium\cpp\examples\TestRead1\TestInheritance.cpp and the relevant decorations for the classes used (comgigaspacesteststeststudent , com.gigaspaces.tests.teststudentex , etc) within the \gigaspaces-xap-premium\cpp\examples\TestRead1\TestRead1Classes\TestRead1Classes.gs.xml.


answered 2009-12-23 08:23:02 -0500

shay hassidim's avatar
edit flag offensive delete link more


Thanks, Shay.

Is there any method to separate the Parent & Child class in two gs.xml.?
Then generated code are created into different files.


yanchan's avatar yanchan  ( 2009-12-24 01:36:48 -0500 )edit

You will have to call the gsxml2cpp twice. Each with the relevant gs.xml as the input file.

shay hassidim's avatar shay hassidim  ( 2009-12-24 07:09:23 -0500 )edit

Thanks, Shay.

We have tried with two input gs.xml for Parent & Child class before. This is our first posted question.
The Child class serializer (ChildClass.cpp) have not got the Parent class serializer declaration. So that the compliation is fail.


yanchan's avatar yanchan  ( 2009-12-27 19:59:22 -0500 )edit

Yep. I understand. I'm trying to understand why using one gs.xml does not works for you.
What is the difference between the inheritance examples comes with the CPP examples and your specific scenario.

See the TestRead1Classes.gs.xml:

  <class name="com.gigaspaces.tests.test_human" cpp-name="Human" dotnet-name="gigaspaces.humans.CHuman" persist="true" replicate="true" fifo="false" >
    <property name="idField" type="string" null-value="" />
    <id name="idField" auto-generate="false" />
    <routing  name="idField"/>
    <property name="gender" index="true" type="string" null-value="" />
  <class name="com.gigaspaces.tests.test_employee" persist="true" replicate="true" fifo="false" >
    <property name="salary" index="true" type="double" null-value="0" />
    <property name="companyName" index="true" type="string" null-value="" />
    <superclass name="com.gigaspaces.tests.test_human" />
  <class name="com.gigaspaces.tests.test_student" persist="true" replicate="true" fifo="false" >
    <property name="gradeAverage" index="true" type="double" null-value="0" />
    <property name="universityName" index="true" type="string" null-value="" />
    <superclass name="com.gigaspaces.tests.test_human" />
  <class name="com.gigaspaces.tests.test_student_ex" cpp-name="StudentX" dotnet-name="gigaspaces.humans.CFemaleStudent" persist="true" replicate="true" fifo="false" >
    <property name="numberOfKids" index="true" type="int" null-value="0" />
    <property name="address" index="true" type="string" null-value="" />
    <superclass name="com.gigaspaces.tests.test_student" />


shay hassidim's avatar shay hassidim  ( 2009-12-28 13:25:57 -0500 )edit

Thanks Shay.

The single gs.xml case is worked.

But, we want to create ParentClass as a common base object. The ChildClass is worked for different applications or programs. So, parent and child class are generated by different gs.xml.
We don't want to duplicate the same ParentClass declaration in all separate applications.
Also, ChildClass gs.xml should not be mixed up for different applications.


yanchan's avatar yanchan  ( 2009-12-28 23:18:56 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2009-12-22 20:57:23 -0500

Seen: 622 times

Last updated: Dec 23 '09