Quantcast
Channel: openFrameworks - Latest posts
Viewing all articles
Browse latest Browse all 40524

Serialization of derived classes

$
0
0

Hi arturo,

The main issue is that I have to send an ofParameterGroup containing the appropiate fields of the derived type to the ofBaseSerializer.deserialize() in order to load the field values into the group, but I don't know the correct type yet.

class Base {
    float distance;
}

class FooBase : public Base{
    int number;
}

class BooBase : public Base{
    string name;
}

Serializing FooBase:

<FooBase>
<distance>2.0</distance>
<number>1</number>
</FooBase>

Calling ofBaseSerializer would require an ofParameterGroup with fields distance and number, but I don't know I require this fields until I read the "tag" is "FooBase".

This "manual" xml reading would mean I can't use ofBaseSerializer.deserialize() any more.


Viewing all articles
Browse latest Browse all 40524

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>