OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Serialization with virtual base classes


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
hartwigw
Appreciator


Joined: 20 Mar 2009
Posts: 128

PostPosted: Sat Dec 23, 2017 11:04 am    Post subject:
Serialization with virtual base classes
Reply with quote

Hi,

I already asked a similar question a few days ago but did not get an answer. I try to be a bit more specific. Assume I have the following definitions:

Code:

class VirtualBaseClass : public osg::Object
{
};

class A : virtual public VirtualBaseClass
{
};

class B : virtual public VirtualBaseClass
{
};

class Final : public A, public B
{
};


Now I have to register a wrapper for class Final. How do I do this?

Code:

REGISTER_OBJECT_WRAPPER(Final,
                                             new Final,
                                             Final,
                                             "???????") // What do I have to mention here?
{
}



Thank you!

Cheers,
Hartwig
Back to top
View user's profile Send private message
mp3butcher (Julien Valentin)
Appreciator


Joined: 17 Feb 2010
Posts: 488
Location: France

PostPosted: Sun Dec 24, 2017 8:03 pm    Post subject:
Re: Serialization with virtual base classes
Reply with quote

Hi Hartwig
I believe the best way to understand osg metamodel is study existing serializers in src/osgWrappers/serializers/osg/
In the case of virtual base class you'll have to set OBJECT_CAST macro to dynamic_cast
see https://github.com/openscenegraph/OpenSceneGraph/blob/master/src/osgWrappers/serializers/osg/Callback.cpp for an example
The string in serializer with multiple class names (????) is called the associate list:
it refers to all other serializers that should be invoked (basically all base serializers must be mentionned)
Hope it helps

Happy Xmas

hartwigw wrote:
Hi,

I already asked a similar question a few days ago but did not get an answer. I try to be a bit more specific. Assume I have the following definitions:

Code:

class VirtualBaseClass : public osg::Object
{
};

class A : virtual public VirtualBaseClass
{
};

class B : virtual public VirtualBaseClass
{
};

class Final : public A, public B
{
};


Now I have to register a wrapper for class Final. How do I do this?

Code:

REGISTER_OBJECT_WRAPPER(Final,
                                             new Final,
                                             Final,
                                             "???????") // What do I have to mention here?
{
}



Thank you!

Cheers,
Hartwig
Back to top
View user's profile Send private message Visit poster's website
hartwigw
Appreciator


Joined: 20 Mar 2009
Posts: 128

PostPosted: Tue Dec 26, 2017 10:36 pm    Post subject:
Reply with quote

Hi Julien,

thanks for your reply.

I checked a couple of source files but it seems to be that I did not find the right ones. Anyway, I would never have found the trick with the dynamic cast!

I like OS and the efforts of the community but it is a real shame that OSG is documented so badly.

Thank you!

Cheers,
Hartwig
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12148

PostPosted: Sat Dec 30, 2017 3:52 pm    Post subject:
Serialization with virtual base classes
Reply with quote

On 26 December 2017 at 22:36, Hartwig Wiesmann
<> wrote:
Quote:
I like OS and the efforts of the community but it is a real shame that OSG is documented so badly.

It's also a real shame that whatever effort is done on documentation
is never enough, or appreciated by some users.

This particular topic is niche issue, the vast majority of users will
never come across it, there is a real limit to how much detail you can
expect from free documentation. There isn't some sugar daddy that
magically funds the OSG, there isn't some magic wand that can do
stuff.

Documentation and support is done in people free time, we all have to
prioritise how we spend our time. Personally I have enough on my
plate managing the source code base, investigating and fixing bugs,
reviewing submissions, developing required features, working on
releases. As I go I do write doxygen comments on new features, create
examples to illustrate and test them, other contributors do the same.

Your comment clearly this effort by myself and others is appreciated,
and it's hardly encouraging for others in the community to pitch in if
they just see obnoxious comments about the contributions they make.

If you don't think documentation is good enough then roll your sleeves
up and write what you think is missing, or if you don't have time then
fund someone else to write what you think is required.

Robert.


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts DrawCallback serialization issue jumaroch General 1 Tue Nov 27, 2018 2:26 pm View latest post
No new posts DrawCallback serialization issue jumaroch General 0 Tue Nov 27, 2018 1:44 pm View latest post
No new posts DrawCallback serialization issue jumaroch General 0 Tue Nov 27, 2018 1:43 pm View latest post
No new posts DrawCallback serialization issue jumaroch General 0 Tue Nov 27, 2018 1:12 pm View latest post
No new posts Virtual Planet Builder: increase reso... moet General 0 Wed Oct 17, 2018 11:34 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP