[openrtm-beginners:00422] Re: (無題)

Geoffrey Biggs geoffrey.biggs @ aist.go.jp
2013年 4月 15日 (月) 17:27:59 JST


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().

Geoff


On 15 April 2013 17:07, <jaysicks.reg at gmail.com> wrote:

> Thank you for your quick reply. As you guessed right, I would like to pass
> user data to the RTC component instance itself. And I don't necessary need
> it
> in the constructor, it's fine to have it in the onInitialize method. At the
> time of writing my question I thought I was able to pass a custom function
> to
> manager->registerFactory so I thought if I can get custom data to
> MyModuleInit, I would be able to pass that to the RTC. But it turned out it
> didn't work, and I was facing the same problem. So, back to your
> suggestion,
> that is definitely something I can use. But if I'm not mistaken I can only
> pass data in text format. The problem is that the data I would like to pass
> is a class instance (it's complex, and quite hard to serialize). The only
> way
> I can think of working around it, is to have a class with static methods
> mapping ids to userData. I can pass the id as a text to the component, wich
> then calls the static method to get the userData. This is clearly an "ugly
> but working" solution, but definitely better then using the name of the
> component as a key of the map. So there are no way of passing an object
> directly to the RTC? Thanks, Gabor Juhasz
>
> ______________________________**_________________
> openrtm-beginners mailing list
> openrtm-beginners at openrtm.org
> http://www.openrtm.org/**mailman/listinfo/openrtm-**beginners<http://www.openrtm.org/mailman/listinfo/openrtm-beginners>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.openrtm.org/pipermail/openrtm-beginners/attachments/20130415/00705174/attachment-0001.html>


More information about the openrtm-beginners mailing list