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

Ask Your Question
0

Question about GigaSpaces C++ gsxml2cpp Utility

Hello,

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" />
            ...
</class>

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

Thanks.

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

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

yanchan gravatar image

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

jaissefsfex gravatar image
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

Yan,

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.

Shay

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

shay hassidim gravatar image
edit flag offensive delete link more

Comments

Thanks, Shay.

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

Yan.

yanchan gravatar image yanchan  ( 2009-12-24 01:36:48 -0600 )edit

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

shay hassidim gravatar image shay hassidim  ( 2009-12-24 07:09:23 -0600 )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.

Yan.

yanchan gravatar image yanchan  ( 2009-12-27 19:59:22 -0600 )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>
  <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>
  <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>
  <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" />
  </class>

Shay

shay hassidim gravatar image shay hassidim  ( 2009-12-28 13:25:57 -0600 )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.

Yan.

yanchan gravatar image yanchan  ( 2009-12-28 23:18:56 -0600 )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

Stats

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

Seen: 43 times

Last updated: Dec 23 '09