Jump to content
OpenSplice DDS Forum
Sign in to follow this  
Emmanuel Prunet

register_instance vs lookup_instance

Recommended Posts

Hi,

I want to know the best usage of register_instance and lookup_instance on a datawriter for successive write of the same instance.

Should I do :

I)

auto h1 = writer.register_instance(ddsData);

map.insert(h1);

....

writer.write(ddsData, map.find(h1));

 

II)

writer.register_instance(ddsData);

....

writer.write(ddsData, writer.lookup_instance(ddsData));

 

III)

writer.write(ddsData, writer.register_instance(ddsData));

 

 

In I) I register the instance and save it in a map. Then, when I want to write the instance, I get the instance_handle in the map and use it in the write() call.

In II) I just register the instance. Then, when I want to write the instance, I retrieve the instance_handle with lookup_instance and use it in the write() call.

In III) I register the instance in the write() call.

 

If register_instance is idempotent, I think III) is what I want to do : registering the instance the first time then use the instance_handle for the write call.

But I don't know if instance handles are internally stored in a map or if I should do it myself like in I)

Regards

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×