<div dir="ltr">If you look in the ModuleInit() function, you can see the component instance being created by a call to the createComponent() function of the manager. This returns a pointer to the component. If you cast this pointer (using a type-safe dynamic_cast) to your component's type, then you can call its functions. You could add a function to the component to initialise your user data and call that after calling createComponent().<div>
<br></div><div>Geoff</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 15 April 2013 17:07,  <span dir="ltr"><<a href="mailto:jaysicks.reg@gmail.com" target="_blank">jaysicks.reg@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thank you for your quick reply. As you guessed right, I would like to pass<br>
user data to the RTC component instance itself. And I don't necessary need it<br>
in the constructor, it's fine to have it in the onInitialize method. At the<br>
time of writing my question I thought I was able to pass a custom function to<br>
manager->registerFactory so I thought if I can get custom data to<br>
MyModuleInit, I would be able to pass that to the RTC. But it turned out it<br>
didn't work, and I was facing the same problem. So, back to your suggestion,<br>
that is definitely something I can use. But if I'm not mistaken I can only<br>
pass data in text format. The problem is that the data I would like to pass<br>
is a class instance (it's complex, and quite hard to serialize). The only way<br>
I can think of working around it, is to have a class with static methods<br>
mapping ids to userData. I can pass the id as a text to the component, wich<br>
then calls the static method to get the userData. This is clearly an "ugly<br>
but working" solution, but definitely better then using the name of the<br>
component as a key of the map. So there are no way of passing an object<br>
directly to the RTC? Thanks, Gabor Juhasz<br>
<br>
______________________________<u></u>_________________<br>
openrtm-beginners mailing list<br>
<a href="mailto:openrtm-beginners@openrtm.org" target="_blank">openrtm-beginners@openrtm.org</a><br>
<a href="http://www.openrtm.org/mailman/listinfo/openrtm-beginners" target="_blank">http://www.openrtm.org/<u></u>mailman/listinfo/openrtm-<u></u>beginners</a><br>
</blockquote></div><br></div>